@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,25 @@
|
|
|
1
|
+
import { FC, InputHTMLAttributes, Ref } from "react";
|
|
2
|
+
//#region src/components/form/number-field/number-field.d.ts
|
|
3
|
+
type BaseProps = {
|
|
4
|
+
invalid?: boolean;
|
|
5
|
+
precision?: number;
|
|
6
|
+
ref?: Ref<HTMLInputElement>;
|
|
7
|
+
} & Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'role' | 'className' | 'style' | 'value' | 'onChange' | 'defaultValue' | 'children' | 'step' | 'min' | 'max'> & {
|
|
8
|
+
step?: number;
|
|
9
|
+
min?: number;
|
|
10
|
+
max?: number;
|
|
11
|
+
};
|
|
12
|
+
type ControlledProps = {
|
|
13
|
+
value: number;
|
|
14
|
+
onChange: (value: number) => void;
|
|
15
|
+
defaultValue?: never;
|
|
16
|
+
};
|
|
17
|
+
type UncontrolledProps = {
|
|
18
|
+
defaultValue?: number;
|
|
19
|
+
value?: never;
|
|
20
|
+
onChange?: (value: number) => void;
|
|
21
|
+
};
|
|
22
|
+
type Props = BaseProps & (ControlledProps | UncontrolledProps);
|
|
23
|
+
declare const NumberField: FC<Props>;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { NumberField };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { FOCUS_RING_WITHIN } from "../../_internal/focus-ring.mjs";
|
|
3
|
+
import { cn } from "../../../helpers/cn.mjs";
|
|
4
|
+
import { useMessages } from "../../../i18n/context.mjs";
|
|
5
|
+
import { chain } from "../../../helpers/chain.mjs";
|
|
6
|
+
import { useControllableState } from "../../../hooks/controllable-state/index.mjs";
|
|
7
|
+
import { ChevronIcon } from "../../icons/lucide.mjs";
|
|
8
|
+
import { toPrecision } from "../../../internal/to-precision.mjs";
|
|
9
|
+
import { clamp } from "../../../internal/clamp.mjs";
|
|
10
|
+
import { cast } from "./cast.mjs";
|
|
11
|
+
import { useState } from "react";
|
|
12
|
+
import { useFormStatus } from "react-dom";
|
|
13
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
//#region src/components/form/number-field/number-field.tsx
|
|
15
|
+
const NumberField = ({ invalid = false, disabled = false, required = false, value, defaultValue, onChange, onBlur, onKeyDown, ref, step = 1, precision = 0, max = 9007199254740991, min = -9007199254740991, ...rest }) => {
|
|
16
|
+
const messages = useMessages();
|
|
17
|
+
const [currentValue, setCurrentValue] = useControllableState({
|
|
18
|
+
value,
|
|
19
|
+
defaultValue: defaultValue ?? 0,
|
|
20
|
+
onChange
|
|
21
|
+
});
|
|
22
|
+
const [displayValue, setDisplayValue] = useState(() => currentValue.toFixed(precision));
|
|
23
|
+
const [prevValue, setPrevValue] = useState(currentValue);
|
|
24
|
+
const { pending } = useFormStatus();
|
|
25
|
+
if (currentValue !== prevValue) {
|
|
26
|
+
setDisplayValue(currentValue.toFixed(precision));
|
|
27
|
+
setPrevValue(currentValue);
|
|
28
|
+
}
|
|
29
|
+
const handleChange = (newValue) => {
|
|
30
|
+
setCurrentValue(newValue);
|
|
31
|
+
};
|
|
32
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
33
|
+
className: cn("relative flex h-12 w-full items-center justify-between gap-2 rounded-xl border border-border-base bg-bg-base vertical:h-auto vertical:w-12", FOCUS_RING_WITHIN, "has-aria-invalid:border-border-error", "has-disabled:cursor-not-allowed has-disabled:border-border-mute has-disabled:bg-bg-mute hover:has-disabled:has-hover:bg-bg-mute"),
|
|
34
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
35
|
+
autoComplete: "off",
|
|
36
|
+
autoCorrect: "off",
|
|
37
|
+
inputMode: "decimal",
|
|
38
|
+
...rest,
|
|
39
|
+
"aria-invalid": invalid,
|
|
40
|
+
"aria-required": required,
|
|
41
|
+
"aria-valuemax": max,
|
|
42
|
+
"aria-valuemin": min,
|
|
43
|
+
"aria-valuenow": currentValue,
|
|
44
|
+
className: cn("grow bg-transparent pe-8 ps-3 focus-visible:outline-hidden size-full", "disabled:cursor-not-allowed", "read-only:cursor-not-allowed"),
|
|
45
|
+
disabled,
|
|
46
|
+
readOnly: pending || void 0,
|
|
47
|
+
onBlur: chain(onBlur, () => {
|
|
48
|
+
const newValue = clamp(cast(displayValue, precision), min, max);
|
|
49
|
+
handleChange(newValue);
|
|
50
|
+
setDisplayValue(newValue.toFixed(precision));
|
|
51
|
+
}),
|
|
52
|
+
onChange: (e) => {
|
|
53
|
+
if (e.nativeEvent instanceof InputEvent && e.nativeEvent.isComposing) return;
|
|
54
|
+
setDisplayValue(e.target.value);
|
|
55
|
+
},
|
|
56
|
+
onKeyDown: chain(onKeyDown, (e) => {
|
|
57
|
+
if (e.key === "ArrowUp") {
|
|
58
|
+
const newValue = clamp(toPrecision(cast(displayValue, precision) + step, precision), min, max);
|
|
59
|
+
handleChange(newValue);
|
|
60
|
+
setDisplayValue(newValue.toFixed(precision));
|
|
61
|
+
}
|
|
62
|
+
if (e.key === "ArrowDown") {
|
|
63
|
+
const newValue = clamp(toPrecision(cast(displayValue, precision) - step, precision), min, max);
|
|
64
|
+
handleChange(newValue);
|
|
65
|
+
setDisplayValue(newValue.toFixed(precision));
|
|
66
|
+
}
|
|
67
|
+
}),
|
|
68
|
+
pattern: "[0-9]*(.[0-9]+)?",
|
|
69
|
+
ref,
|
|
70
|
+
role: "spinbutton",
|
|
71
|
+
type: "text",
|
|
72
|
+
value: displayValue
|
|
73
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
74
|
+
"aria-hidden": "true",
|
|
75
|
+
className: "vertical:inset-e-auto vertical:bottom-1 vertical:h-auto vertical:w-full vertical:flex-row vertical:px-1 vertical:py-0 absolute inset-e-1 flex h-full flex-col py-1",
|
|
76
|
+
children: [/* @__PURE__ */ jsxs("button", {
|
|
77
|
+
className: cn("flex w-6 grow items-center justify-center rounded-md text-fg-mute transition-colors vertical:h-6 vertical:w-auto", "hover:bg-bg-mute hover:text-fg-base", "disabled:cursor-not-allowed disabled:text-fg-mute hover:disabled:bg-transparent"),
|
|
78
|
+
disabled: disabled || pending,
|
|
79
|
+
onClick: () => {
|
|
80
|
+
const newValue = clamp(toPrecision(cast(displayValue, precision) + step, precision), min, max);
|
|
81
|
+
handleChange(newValue);
|
|
82
|
+
setDisplayValue(newValue.toFixed(precision));
|
|
83
|
+
},
|
|
84
|
+
tabIndex: -1,
|
|
85
|
+
type: "button",
|
|
86
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
87
|
+
className: "sr-only",
|
|
88
|
+
children: messages.numberFieldIncrement
|
|
89
|
+
}), /* @__PURE__ */ jsx(ChevronIcon, {
|
|
90
|
+
direction: "up",
|
|
91
|
+
size: "sm"
|
|
92
|
+
})]
|
|
93
|
+
}), /* @__PURE__ */ jsxs("button", {
|
|
94
|
+
className: cn("flex w-6 grow items-center justify-center rounded-md text-fg-mute transition-colors vertical:h-6 vertical:w-auto", "hover:bg-bg-mute hover:text-fg-base", "disabled:cursor-not-allowed disabled:text-fg-mute hover:disabled:bg-transparent"),
|
|
95
|
+
disabled: disabled || pending,
|
|
96
|
+
onClick: () => {
|
|
97
|
+
const newValue = clamp(toPrecision(cast(displayValue, precision) - step, precision), min, max);
|
|
98
|
+
handleChange(newValue);
|
|
99
|
+
setDisplayValue(newValue.toFixed(precision));
|
|
100
|
+
},
|
|
101
|
+
tabIndex: -1,
|
|
102
|
+
type: "button",
|
|
103
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
104
|
+
className: "sr-only",
|
|
105
|
+
children: messages.numberFieldDecrement
|
|
106
|
+
}), /* @__PURE__ */ jsx(ChevronIcon, {
|
|
107
|
+
direction: "down",
|
|
108
|
+
size: "sm"
|
|
109
|
+
})]
|
|
110
|
+
})]
|
|
111
|
+
})]
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
//#endregion
|
|
115
|
+
export { NumberField };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FC, InputHTMLAttributes, Ref } from "react";
|
|
2
|
+
//#region src/components/form/password-input/password-input.d.ts
|
|
3
|
+
type Props = {
|
|
4
|
+
invalid?: boolean;
|
|
5
|
+
showLabel?: string;
|
|
6
|
+
hideLabel?: string;
|
|
7
|
+
ref?: Ref<HTMLInputElement>;
|
|
8
|
+
} & Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'className' | 'style'>;
|
|
9
|
+
declare const PasswordInput: FC<Props>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { PasswordInput };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { FOCUS_RING_NO_BORDER, FOCUS_RING_WITHIN } from "../../_internal/focus-ring.mjs";
|
|
3
|
+
import { cn } from "../../../helpers/cn.mjs";
|
|
4
|
+
import { useMessages } from "../../../i18n/context.mjs";
|
|
5
|
+
import { useDisclosure } from "../../../hooks/disclosure/index.mjs";
|
|
6
|
+
import { ViewIcon, ViewOffIcon } from "../../icons/lucide.mjs";
|
|
7
|
+
import { useFormStatus } from "react-dom";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/form/password-input/password-input.tsx
|
|
10
|
+
const PasswordInput = ({ invalid = false, autoComplete = "current-password", showLabel, hideLabel, disabled = false, readOnly, ref, ...rest }) => {
|
|
11
|
+
const messages = useMessages();
|
|
12
|
+
const { isOpen: isVisible, toggle: toggleVisible } = useDisclosure();
|
|
13
|
+
const { pending } = useFormStatus();
|
|
14
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
15
|
+
className: cn("relative flex w-full items-center rounded-xl border border-border-base bg-bg-base vertical:h-full vertical:w-auto", invalid && "border-border-error", (disabled || pending) && "cursor-not-allowed border-border-mute bg-bg-mute", FOCUS_RING_WITHIN),
|
|
16
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
17
|
+
"aria-invalid": invalid,
|
|
18
|
+
autoComplete,
|
|
19
|
+
className: cn("w-full grow bg-transparent px-3 py-2 focus-visible:outline-hidden vertical:h-full vertical:w-auto", "disabled:cursor-not-allowed", "read-only:cursor-not-allowed read-only:bg-bg-subtle"),
|
|
20
|
+
disabled,
|
|
21
|
+
readOnly: pending || readOnly,
|
|
22
|
+
ref,
|
|
23
|
+
type: isVisible ? "text" : "password",
|
|
24
|
+
...rest
|
|
25
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
26
|
+
"aria-label": isVisible ? hideLabel ?? messages.passwordHide : showLabel ?? messages.passwordShow,
|
|
27
|
+
className: cn("me-2 inline-flex shrink-0 items-center justify-center rounded-md p-1 text-fg-mute transition-colors", FOCUS_RING_NO_BORDER, !disabled && !pending && "hover:bg-bg-mute hover:text-fg-base", (disabled || pending) && "cursor-not-allowed text-fg-mute/70"),
|
|
28
|
+
disabled: disabled || pending,
|
|
29
|
+
onClick: toggleVisible,
|
|
30
|
+
type: "button",
|
|
31
|
+
children: isVisible ? /* @__PURE__ */ jsx(ViewOffIcon, { size: "sm" }) : /* @__PURE__ */ jsx(ViewIcon, { size: "sm" })
|
|
32
|
+
})]
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
//#endregion
|
|
36
|
+
export { PasswordInput };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Option } from "../../../types/variables.mjs";
|
|
2
|
+
import { ChangeEvent, FC, HTMLAttributes, Ref } from "react";
|
|
3
|
+
//#region src/components/form/radio/radio.d.ts
|
|
4
|
+
type BaseProps = {
|
|
5
|
+
'aria-labelledby': string;
|
|
6
|
+
name?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
options: readonly Option[];
|
|
9
|
+
ref?: Ref<HTMLDivElement>;
|
|
10
|
+
} & Omit<HTMLAttributes<HTMLDivElement>, 'role' | 'className' | 'style' | 'children' | 'aria-labelledby' | 'onChange'>;
|
|
11
|
+
type ControlledProps = {
|
|
12
|
+
value: string;
|
|
13
|
+
onChange: (value: string, event: ChangeEvent<HTMLInputElement>) => void;
|
|
14
|
+
defaultValue?: never;
|
|
15
|
+
};
|
|
16
|
+
type UncontrolledProps = {
|
|
17
|
+
defaultValue?: string;
|
|
18
|
+
value?: never;
|
|
19
|
+
onChange?: (value: string, event: ChangeEvent<HTMLInputElement>) => void;
|
|
20
|
+
};
|
|
21
|
+
type Props = BaseProps & (ControlledProps | UncontrolledProps);
|
|
22
|
+
declare const Radio: FC<Props>;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { Radio };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { FOCUS_RING_PEER } from "../../_internal/focus-ring.mjs";
|
|
3
|
+
import { cn } from "../../../helpers/cn.mjs";
|
|
4
|
+
import { useControllableState } from "../../../hooks/controllable-state/index.mjs";
|
|
5
|
+
import { useFormStatus } from "react-dom";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/form/radio/radio.tsx
|
|
8
|
+
const Radio = ({ "aria-labelledby": labelledbyId, name, disabled = false, value, defaultValue, onChange, options, ref, ...rest }) => {
|
|
9
|
+
const [selectedValue, setSelectedValue] = useControllableState({
|
|
10
|
+
value,
|
|
11
|
+
defaultValue
|
|
12
|
+
});
|
|
13
|
+
const { pending } = useFormStatus();
|
|
14
|
+
const isControlled = value !== void 0;
|
|
15
|
+
const disabledResolved = disabled || pending;
|
|
16
|
+
const selectValue = (nextValue, event) => {
|
|
17
|
+
setSelectedValue(nextValue);
|
|
18
|
+
onChange?.(nextValue, event);
|
|
19
|
+
};
|
|
20
|
+
return /* @__PURE__ */ jsx("div", {
|
|
21
|
+
...rest,
|
|
22
|
+
"aria-labelledby": labelledbyId,
|
|
23
|
+
className: cn("flex cursor-pointer flex-col gap-2", disabledResolved && "cursor-not-allowed"),
|
|
24
|
+
ref,
|
|
25
|
+
role: "radiogroup",
|
|
26
|
+
children: options.map((option) => /* @__PURE__ */ jsxs("label", {
|
|
27
|
+
className: cn("flex items-center gap-2 text-left", disabledResolved ? "cursor-not-allowed" : "cursor-pointer"),
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ jsx("input", {
|
|
30
|
+
...isControlled ? { checked: value === option.value } : { defaultChecked: defaultValue === option.value },
|
|
31
|
+
className: "peer sr-only",
|
|
32
|
+
disabled: disabledResolved,
|
|
33
|
+
name: name ?? labelledbyId,
|
|
34
|
+
onChange: (event) => {
|
|
35
|
+
selectValue(option.value, event);
|
|
36
|
+
},
|
|
37
|
+
type: "radio",
|
|
38
|
+
value: option.value
|
|
39
|
+
}),
|
|
40
|
+
/* @__PURE__ */ jsx("span", {
|
|
41
|
+
"aria-hidden": true,
|
|
42
|
+
className: cn("inline-flex size-5 items-center justify-center rounded-full border-2 transition-colors", FOCUS_RING_PEER, selectedValue === option.value ? "border-border-base bg-primary-bg" : "border-border-mute bg-bg-base", disabledResolved && "border-border-mute bg-bg-mute"),
|
|
43
|
+
children: /* @__PURE__ */ jsx("span", { className: cn("size-2 rounded-full transition-opacity", selectedValue === option.value ? "bg-primary-border opacity-100" : "bg-transparent opacity-0") })
|
|
44
|
+
}),
|
|
45
|
+
/* @__PURE__ */ jsx("span", { children: option.label })
|
|
46
|
+
]
|
|
47
|
+
}, option.value))
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
//#endregion
|
|
51
|
+
export { Radio };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FC, FieldsetHTMLAttributes, ReactNode, Ref } from "react";
|
|
2
|
+
//#region src/components/form/radio-card/radio-card.d.ts
|
|
3
|
+
type RadioCardOption = Readonly<{
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
visual?: ReactNode;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}>;
|
|
10
|
+
type BaseProps = {
|
|
11
|
+
'aria-labelledby': string;
|
|
12
|
+
invalid?: boolean;
|
|
13
|
+
options: readonly RadioCardOption[];
|
|
14
|
+
ref?: Ref<HTMLFieldSetElement>;
|
|
15
|
+
} & Omit<FieldsetHTMLAttributes<HTMLFieldSetElement>, 'className' | 'style' | 'children' | 'onChange' | 'defaultValue' | 'aria-labelledby' | 'role'>;
|
|
16
|
+
type ControlledProps = {
|
|
17
|
+
value: string;
|
|
18
|
+
onChange: (value: string) => void;
|
|
19
|
+
defaultValue?: never;
|
|
20
|
+
};
|
|
21
|
+
type UncontrolledProps = {
|
|
22
|
+
defaultValue?: string;
|
|
23
|
+
value?: never;
|
|
24
|
+
onChange?: (value: string) => void;
|
|
25
|
+
};
|
|
26
|
+
type Props = BaseProps & (ControlledProps | UncontrolledProps);
|
|
27
|
+
declare const RadioCard: FC<Props>;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { RadioCard, RadioCardOption };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../helpers/cn.mjs";
|
|
3
|
+
import { useControllableState } from "../../../hooks/controllable-state/index.mjs";
|
|
4
|
+
import { useId } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/form/radio-card/radio-card.tsx
|
|
7
|
+
const RadioCard = ({ "aria-labelledby": labelledbyId, name, disabled = false, invalid = false, options, value, defaultValue, onChange, ref, ...rest }) => {
|
|
8
|
+
const groupId = useId();
|
|
9
|
+
const [currentValue, setCurrentValue] = useControllableState({
|
|
10
|
+
value,
|
|
11
|
+
defaultValue
|
|
12
|
+
});
|
|
13
|
+
const selectValue = (nextValue) => {
|
|
14
|
+
setCurrentValue(nextValue);
|
|
15
|
+
onChange?.(nextValue);
|
|
16
|
+
};
|
|
17
|
+
return /* @__PURE__ */ jsx("fieldset", {
|
|
18
|
+
...rest,
|
|
19
|
+
"aria-labelledby": labelledbyId,
|
|
20
|
+
className: cn("m-0 min-w-0 border-0 p-0 inline-full", "grid gap-3", disabled && "opacity-70"),
|
|
21
|
+
ref,
|
|
22
|
+
role: "radiogroup",
|
|
23
|
+
children: options.map((option) => {
|
|
24
|
+
const checked = currentValue === option.value;
|
|
25
|
+
const optionDisabled = disabled || option.disabled === true;
|
|
26
|
+
const hasDescription = option.description !== void 0 && option.description !== "";
|
|
27
|
+
const hasVisual = option.visual !== void 0 && option.visual !== null;
|
|
28
|
+
const optionId = `${groupId}-${option.value}`;
|
|
29
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
30
|
+
className: cn("flex min-w-0 rounded-xl border bg-bg-base p-4 text-left transition-colors inline-full", "has-[input:focus-visible]:outline-hidden has-[input:focus-visible]:ring-2 has-[input:focus-visible]:ring-border-info", checked && "border-primary-border bg-primary-bg-subtle hover:bg-primary-bg-mute", invalid ? "border-border-error" : !checked && "border-border-mute hover:bg-bg-subtle", optionDisabled && "cursor-not-allowed border-border-mute bg-bg-subtle text-fg-mute"),
|
|
31
|
+
id: optionId,
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ jsx("input", {
|
|
34
|
+
"aria-describedby": hasDescription ? `${optionId}-description` : void 0,
|
|
35
|
+
"aria-labelledby": `${optionId}-label`,
|
|
36
|
+
checked,
|
|
37
|
+
className: "sr-only",
|
|
38
|
+
disabled: optionDisabled,
|
|
39
|
+
name: name ?? groupId,
|
|
40
|
+
onChange: () => {
|
|
41
|
+
selectValue(option.value);
|
|
42
|
+
},
|
|
43
|
+
type: "radio",
|
|
44
|
+
value: option.value
|
|
45
|
+
}),
|
|
46
|
+
hasVisual ? /* @__PURE__ */ jsx("span", {
|
|
47
|
+
"aria-hidden": true,
|
|
48
|
+
className: "mr-4 shrink-0",
|
|
49
|
+
children: option.visual
|
|
50
|
+
}) : null,
|
|
51
|
+
/* @__PURE__ */ jsxs("span", {
|
|
52
|
+
className: "flex min-w-0 flex-1 flex-col gap-1",
|
|
53
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
54
|
+
className: "text-fg-base font-medium",
|
|
55
|
+
id: `${optionId}-label`,
|
|
56
|
+
children: option.label
|
|
57
|
+
}), hasDescription ? /* @__PURE__ */ jsx("span", {
|
|
58
|
+
className: "text-fg-mute text-sm",
|
|
59
|
+
id: `${optionId}-description`,
|
|
60
|
+
children: option.description
|
|
61
|
+
}) : null]
|
|
62
|
+
}),
|
|
63
|
+
/* @__PURE__ */ jsx("span", {
|
|
64
|
+
"aria-hidden": true,
|
|
65
|
+
className: cn("mt-0.5 ml-4 inline-flex size-5 shrink-0 items-center justify-center rounded-full border", checked ? "border-border-base bg-primary-bg" : "border-border-mute bg-bg-base"),
|
|
66
|
+
children: /* @__PURE__ */ jsx("span", { className: cn("size-2 rounded-full bg-primary-border transition-opacity", checked ? "opacity-100" : "opacity-0") })
|
|
67
|
+
})
|
|
68
|
+
]
|
|
69
|
+
}, option.value);
|
|
70
|
+
})
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
//#endregion
|
|
74
|
+
export { RadioCard };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Option } from "../../../types/variables.mjs";
|
|
2
|
+
import { FC, Ref, SelectHTMLAttributes } from "react";
|
|
3
|
+
//#region src/components/form/select/select.d.ts
|
|
4
|
+
type Props = {
|
|
5
|
+
invalid?: boolean;
|
|
6
|
+
options: readonly Option[];
|
|
7
|
+
ref?: Ref<HTMLSelectElement>;
|
|
8
|
+
} & Omit<SelectHTMLAttributes<HTMLSelectElement>, 'className' | 'style'>;
|
|
9
|
+
declare const Select: FC<Props>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { Select };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { FOCUS_RING_WITHIN } from "../../_internal/focus-ring.mjs";
|
|
3
|
+
import { cn } from "../../../helpers/cn.mjs";
|
|
4
|
+
import { ChevronIcon } from "../../icons/lucide.mjs";
|
|
5
|
+
import { useFormStatus } from "react-dom";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/form/select/select.tsx
|
|
8
|
+
const Select = ({ invalid = false, options, disabled = false, ref, ...rest }) => {
|
|
9
|
+
const { pending } = useFormStatus();
|
|
10
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
11
|
+
className: cn("relative flex h-fit w-full items-center rounded-xl border border-border-base bg-bg-base vertical:h-full vertical:w-fit", invalid && "border-border-error", (disabled || pending) && "cursor-not-allowed border-border-mute bg-bg-mute", FOCUS_RING_WITHIN),
|
|
12
|
+
children: [/* @__PURE__ */ jsx("select", {
|
|
13
|
+
"aria-invalid": invalid,
|
|
14
|
+
className: cn("w-full grow appearance-none bg-transparent px-3 py-2 text-fg-base focus-visible:outline-hidden vertical:h-full vertical:w-auto", "disabled:cursor-not-allowed"),
|
|
15
|
+
disabled: disabled || pending,
|
|
16
|
+
ref,
|
|
17
|
+
...rest,
|
|
18
|
+
children: options.map((option) => /* @__PURE__ */ jsx("option", {
|
|
19
|
+
value: option.value,
|
|
20
|
+
children: option.label
|
|
21
|
+
}, option.value))
|
|
22
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
23
|
+
"aria-hidden": true,
|
|
24
|
+
className: "vertical:-rotate-90 pointer-events-none me-3 shrink-0",
|
|
25
|
+
children: /* @__PURE__ */ jsx(ChevronIcon, {
|
|
26
|
+
direction: "down",
|
|
27
|
+
size: "sm"
|
|
28
|
+
})
|
|
29
|
+
})]
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { Select };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FC, InputHTMLAttributes, Ref } from "react";
|
|
2
|
+
//#region src/components/form/slider/slider.d.ts
|
|
3
|
+
type BaseProps = {
|
|
4
|
+
invalid?: boolean;
|
|
5
|
+
step?: number;
|
|
6
|
+
max?: number;
|
|
7
|
+
min?: number;
|
|
8
|
+
ref?: Ref<HTMLInputElement>;
|
|
9
|
+
} & Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'className' | 'style' | 'value' | 'onChange' | 'defaultValue' | 'children' | 'step' | 'max' | 'min'>;
|
|
10
|
+
type ControlledProps = {
|
|
11
|
+
value: number;
|
|
12
|
+
onChange: (value: number) => void;
|
|
13
|
+
defaultValue?: never;
|
|
14
|
+
};
|
|
15
|
+
type UncontrolledProps = {
|
|
16
|
+
defaultValue?: number;
|
|
17
|
+
value?: never;
|
|
18
|
+
onChange?: (value: number) => void;
|
|
19
|
+
};
|
|
20
|
+
type Props = BaseProps & (ControlledProps | UncontrolledProps);
|
|
21
|
+
declare const Slider: FC<Props>;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { Slider };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../helpers/cn.mjs";
|
|
3
|
+
import { useControllableState } from "../../../hooks/controllable-state/index.mjs";
|
|
4
|
+
import { useFormStatus } from "react-dom";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/form/slider/slider.tsx
|
|
7
|
+
const Slider = ({ invalid = false, disabled = false, required = false, value, defaultValue, onChange, ref, step = 1, max = 100, min = 0, ...rest }) => {
|
|
8
|
+
const [currentValue, handleChange] = useControllableState({
|
|
9
|
+
value,
|
|
10
|
+
defaultValue: defaultValue ?? min,
|
|
11
|
+
onChange
|
|
12
|
+
});
|
|
13
|
+
const { pending } = useFormStatus();
|
|
14
|
+
const disabledResolved = disabled || pending;
|
|
15
|
+
const range = max > min ? max - min : 1;
|
|
16
|
+
const progress = (currentValue - min) / range * 100;
|
|
17
|
+
const clampedProgress = `${Math.min(Math.max(progress, 0), 100)}%`;
|
|
18
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
19
|
+
className: cn("relative flex items-center justify-center", "block-8 inline-full vertical:inline-48", disabledResolved && "opacity-50"),
|
|
20
|
+
style: { "--slider-progress": clampedProgress },
|
|
21
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
22
|
+
"aria-hidden": true,
|
|
23
|
+
className: "bg-bg-mute relative rounded-full block-2 inline-full",
|
|
24
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
25
|
+
"aria-hidden": true,
|
|
26
|
+
className: cn("bg-primary-bg absolute inset-s-0 inset-be-0 block-full inline-(--slider-progress) rounded-full", invalid && "bg-bg-error")
|
|
27
|
+
})
|
|
28
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
29
|
+
...rest,
|
|
30
|
+
"aria-invalid": invalid,
|
|
31
|
+
"aria-valuemax": max,
|
|
32
|
+
"aria-valuemin": min,
|
|
33
|
+
"aria-valuenow": currentValue,
|
|
34
|
+
className: cn("absolute inset-0 z-10 appearance-none bg-transparent", "h-8 w-full vertical:h-auto vertical:w-8 vertical:[writing-mode:vertical-lr]", "focus:outline-none", "disabled:cursor-not-allowed", "[&::-webkit-slider-runnable-track]:h-2 [&::-webkit-slider-runnable-track]:rounded-full [&::-webkit-slider-runnable-track]:bg-transparent", "[&::-webkit-slider-thumb]:-mt-1 [&::-webkit-slider-thumb]:size-4 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:border [&::-webkit-slider-thumb]:border-border-base [&::-webkit-slider-thumb]:bg-bg-base [&::-webkit-slider-thumb]:shadow-xs", "[&:focus-visible::-webkit-slider-thumb]:border-transparent [&:focus-visible::-webkit-slider-thumb]:ring-2 [&:focus-visible::-webkit-slider-thumb]:ring-border-info", "[&::-moz-range-track]:h-2 [&::-moz-range-track]:rounded-full [&::-moz-range-track]:bg-transparent", "[&::-moz-range-progress]:h-2 [&::-moz-range-progress]:rounded-full [&::-moz-range-progress]:bg-transparent", "[&::-moz-range-thumb]:size-4 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border [&::-moz-range-thumb]:border-border-base [&::-moz-range-thumb]:bg-bg-base [&::-moz-range-thumb]:shadow-xs", "[&:focus-visible::-moz-range-thumb]:border-transparent [&:focus-visible::-moz-range-thumb]:ring-2 [&:focus-visible::-moz-range-thumb]:ring-border-info", invalid && "[&::-moz-range-thumb]:border-border-error [&::-webkit-slider-thumb]:border-border-error [&:focus-visible::-moz-range-thumb]:ring-border-error [&:focus-visible::-webkit-slider-thumb]:ring-border-error"),
|
|
35
|
+
disabled: disabledResolved,
|
|
36
|
+
max,
|
|
37
|
+
min,
|
|
38
|
+
onChange: (event) => {
|
|
39
|
+
handleChange(Number(event.target.value));
|
|
40
|
+
},
|
|
41
|
+
ref,
|
|
42
|
+
required,
|
|
43
|
+
step,
|
|
44
|
+
type: "range",
|
|
45
|
+
value: currentValue
|
|
46
|
+
})]
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
//#endregion
|
|
50
|
+
export { Slider };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ChangeEvent, FC, InputHTMLAttributes, Ref } from "react";
|
|
2
|
+
//#region src/components/form/switch/switch.d.ts
|
|
3
|
+
type BaseProps = {
|
|
4
|
+
invalid?: boolean;
|
|
5
|
+
label: string;
|
|
6
|
+
ref?: Ref<HTMLInputElement>;
|
|
7
|
+
} & Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'role' | 'className' | 'style' | 'value' | 'onChange' | 'defaultChecked' | 'checked' | 'children'>;
|
|
8
|
+
type ControlledProps = {
|
|
9
|
+
checked: boolean;
|
|
10
|
+
onChange: (checked: boolean, event: ChangeEvent<HTMLInputElement>) => void;
|
|
11
|
+
defaultChecked?: never;
|
|
12
|
+
};
|
|
13
|
+
type UncontrolledProps = {
|
|
14
|
+
defaultChecked?: boolean;
|
|
15
|
+
checked?: never;
|
|
16
|
+
onChange?: (checked: boolean, event: ChangeEvent<HTMLInputElement>) => void;
|
|
17
|
+
};
|
|
18
|
+
type Props = BaseProps & (ControlledProps | UncontrolledProps);
|
|
19
|
+
declare const Switch: FC<Props>;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { Switch };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { FOCUS_RING_PEER_NO_BORDER } from "../../_internal/focus-ring.mjs";
|
|
3
|
+
import { cn } from "../../../helpers/cn.mjs";
|
|
4
|
+
import { useControllableState } from "../../../hooks/controllable-state/index.mjs";
|
|
5
|
+
import { useId } from "react";
|
|
6
|
+
import { useFormStatus } from "react-dom";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/form/switch/switch.tsx
|
|
9
|
+
const Switch = ({ checked, defaultChecked, id, disabled = false, invalid = false, required = false, label, onChange, ref, ...rest }) => {
|
|
10
|
+
const generatedId = useId();
|
|
11
|
+
const inputId = id ?? generatedId;
|
|
12
|
+
const [isSelected, setSelected] = useControllableState({
|
|
13
|
+
value: checked,
|
|
14
|
+
defaultValue: defaultChecked ?? false
|
|
15
|
+
});
|
|
16
|
+
const { pending } = useFormStatus();
|
|
17
|
+
const isControlled = checked !== void 0;
|
|
18
|
+
const disabledResolved = disabled || pending;
|
|
19
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
20
|
+
className: cn("inline-flex w-fit items-center gap-3", disabledResolved ? "cursor-not-allowed text-fg-mute" : "cursor-pointer"),
|
|
21
|
+
htmlFor: inputId,
|
|
22
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
23
|
+
className: "relative inline-flex shrink-0",
|
|
24
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
25
|
+
...rest,
|
|
26
|
+
"aria-checked": isSelected,
|
|
27
|
+
"aria-invalid": invalid,
|
|
28
|
+
"aria-required": required,
|
|
29
|
+
...isControlled ? { checked: isSelected } : { defaultChecked },
|
|
30
|
+
className: "peer sr-only",
|
|
31
|
+
disabled: disabledResolved,
|
|
32
|
+
id: inputId,
|
|
33
|
+
onChange: (event) => {
|
|
34
|
+
setSelected(event.target.checked);
|
|
35
|
+
onChange?.(event.target.checked, event);
|
|
36
|
+
},
|
|
37
|
+
ref,
|
|
38
|
+
required,
|
|
39
|
+
role: "switch",
|
|
40
|
+
type: "checkbox"
|
|
41
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
42
|
+
"aria-hidden": true,
|
|
43
|
+
className: cn("inline-flex items-center rounded-full transition-colors", "h-7 w-12 vertical:h-12 vertical:w-7", invalid && "ring-2 ring-border-error", isSelected ? "bg-primary-bg" : "bg-bg-mute", disabledResolved && "bg-bg-subtle", FOCUS_RING_PEER_NO_BORDER, "peer-focus-visible:ring-offset-2"),
|
|
44
|
+
children: /* @__PURE__ */ jsx("span", { className: cn("ms-0.5 size-5 rounded-full bg-bg-base shadow-xs transition-transform", isSelected && "translate-x-5 vertical:translate-x-0 vertical:translate-y-5", disabledResolved && "bg-bg-emphasize") })
|
|
45
|
+
})]
|
|
46
|
+
}), label ? /* @__PURE__ */ jsx("span", { children: label }) : null]
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
//#endregion
|
|
50
|
+
export { Switch };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FC, HTMLInputTypeAttribute, InputHTMLAttributes, Ref } from "react";
|
|
2
|
+
//#region src/components/form/text-field/text-field.d.ts
|
|
3
|
+
type TextInputType = Extract<HTMLInputTypeAttribute, 'text' | 'email' | 'tel' | 'url' | 'search'>;
|
|
4
|
+
type Props = {
|
|
5
|
+
invalid?: boolean;
|
|
6
|
+
ref?: Ref<HTMLInputElement>;
|
|
7
|
+
type?: TextInputType;
|
|
8
|
+
} & Omit<InputHTMLAttributes<HTMLInputElement>, 'className' | 'style' | 'type'>;
|
|
9
|
+
declare const TextField: FC<Props>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { TextField };
|