@k8ordo/ui 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +197 -187
- package/dist/components/_internal/focus-ring.css +37 -0
- package/dist/components/_internal/focus-ring.module.mjs +9 -0
- package/dist/components/_internal/form-value.d.mts +34 -0
- package/dist/components/_internal/form-value.mjs +91 -0
- package/dist/components/_internal/high-contrast.css +18 -0
- package/dist/components/_internal/high-contrast.module.mjs +5 -0
- package/dist/components/_internal/ignore-changes.d.mts +20 -0
- package/dist/components/_internal/ignore-changes.mjs +37 -0
- package/dist/components/_internal/nav-link.css +78 -0
- package/dist/components/_internal/nav-link.d.mts +5 -0
- package/dist/components/_internal/nav-link.mjs +8 -0
- package/dist/components/_internal/nav-link.module.mjs +14 -0
- package/dist/components/_internal/sr-only.css +17 -0
- package/dist/components/_internal/sr-only.module.mjs +5 -0
- package/dist/components/_internal/status-tone.css +37 -0
- package/dist/components/_internal/status-tone.d.mts +20 -0
- package/dist/components/_internal/status-tone.mjs +22 -0
- package/dist/components/_internal/status-tone.module.mjs +14 -0
- package/dist/components/ai/_internal/attachment-preview.css +75 -0
- package/dist/components/ai/_internal/attachment-preview.d.mts +15 -0
- package/dist/components/ai/_internal/attachment-preview.mjs +50 -0
- package/dist/components/ai/_internal/attachment-preview.module.mjs +14 -0
- package/dist/components/ai/_internal/collapsible.css +62 -0
- package/dist/components/ai/_internal/collapsible.d.mts +4 -2
- package/dist/components/ai/_internal/collapsible.mjs +42 -33
- package/dist/components/ai/_internal/collapsible.module.mjs +12 -0
- package/dist/components/ai/_internal/icons.d.mts +8 -0
- package/dist/components/ai/_internal/icons.mjs +14 -0
- package/dist/components/ai/_internal/streaming-cursor.css +28 -0
- package/dist/components/ai/_internal/streaming-cursor.d.mts +2 -3
- package/dist/components/ai/_internal/streaming-cursor.mjs +2 -1
- package/dist/components/ai/_internal/streaming-cursor.module.mjs +8 -0
- package/dist/components/ai/attachment/attachment.css +17 -0
- package/dist/components/ai/attachment/attachment.d.mts +15 -0
- package/dist/components/ai/attachment/attachment.mjs +25 -0
- package/dist/components/ai/attachment/attachment.module.mjs +8 -0
- package/dist/components/ai/attachment/index.d.mts +13 -0
- package/dist/components/ai/attachment/index.mjs +8 -0
- package/dist/components/ai/conversation/conversation.css +71 -0
- package/dist/components/ai/conversation/conversation.d.mts +4 -4
- package/dist/components/ai/conversation/conversation.mjs +38 -34
- package/dist/components/ai/conversation/conversation.module.mjs +11 -0
- package/dist/components/ai/conversation/index.d.mts +2 -3
- package/dist/components/ai/index.d.mts +4 -2
- package/dist/components/ai/index.mjs +3 -1
- package/dist/components/ai/message/index.d.mts +29 -3
- package/dist/components/ai/message/index.mjs +7 -2
- package/dist/components/ai/message/message.css +71 -0
- package/dist/components/ai/message/message.d.mts +34 -3
- package/dist/components/ai/message/message.mjs +99 -9
- package/dist/components/ai/message/message.module.mjs +18 -0
- package/dist/components/ai/prompt-input/index.d.mts +11 -4
- package/dist/components/ai/prompt-input/index.mjs +3 -1
- package/dist/components/ai/prompt-input/prompt-input.css +101 -0
- package/dist/components/ai/prompt-input/prompt-input.d.mts +15 -5
- package/dist/components/ai/prompt-input/prompt-input.mjs +152 -37
- package/dist/components/ai/prompt-input/prompt-input.module.mjs +15 -0
- package/dist/components/ai/reasoning/index.mjs +1 -2
- package/dist/components/ai/reasoning/reasoning.css +16 -0
- package/dist/components/ai/reasoning/reasoning.d.mts +2 -2
- package/dist/components/ai/reasoning/reasoning.mjs +5 -5
- package/dist/components/ai/reasoning/reasoning.module.mjs +8 -0
- package/dist/components/ai/response/index.mjs +1 -2
- package/dist/components/ai/response/response.css +453 -0
- package/dist/components/ai/response/response.d.mts +4 -5
- package/dist/components/ai/response/response.mjs +20 -15
- package/dist/components/ai/response/response.module.mjs +8 -0
- package/dist/components/ai/source/index.d.mts +12 -0
- package/dist/components/ai/source/index.mjs +8 -0
- package/dist/components/ai/source/source.css +54 -0
- package/dist/components/ai/source/source.d.mts +14 -0
- package/dist/components/ai/source/source.mjs +51 -0
- package/dist/components/ai/source/source.module.mjs +12 -0
- package/dist/components/ai/suggestion/index.d.mts +2 -3
- package/dist/components/ai/suggestion/suggestion.css +32 -0
- package/dist/components/ai/suggestion/suggestion.d.mts +3 -3
- package/dist/components/ai/suggestion/suggestion.mjs +7 -6
- package/dist/components/ai/suggestion/suggestion.module.mjs +8 -0
- package/dist/components/ai/tool-invocation/approval-bar.css +26 -0
- package/dist/components/ai/tool-invocation/approval-bar.d.mts +12 -0
- package/dist/components/ai/tool-invocation/approval-bar.mjs +59 -0
- package/dist/components/ai/tool-invocation/approval-bar.module.mjs +9 -0
- package/dist/components/ai/tool-invocation/index.mjs +1 -2
- package/dist/components/ai/tool-invocation/tool-invocation.css +55 -0
- package/dist/components/ai/tool-invocation/tool-invocation.d.mts +5 -4
- package/dist/components/ai/tool-invocation/tool-invocation.mjs +39 -18
- package/dist/components/ai/tool-invocation/tool-invocation.module.mjs +15 -0
- package/dist/components/ai/types.d.mts +21 -4
- package/dist/components/buttons/button/button.css +158 -0
- package/dist/components/buttons/button/button.d.mts +32 -8
- package/dist/components/buttons/button/button.mjs +46 -36
- package/dist/components/buttons/button/button.module.mjs +23 -0
- package/dist/components/buttons/button/index.d.mts +2 -2
- package/dist/components/buttons/button/index.mjs +1 -2
- package/dist/components/buttons/copy-button/copy-button.css +15 -0
- package/dist/components/buttons/copy-button/copy-button.d.mts +10 -0
- package/dist/components/buttons/copy-button/copy-button.mjs +70 -0
- package/dist/components/buttons/copy-button/copy-button.module.mjs +8 -0
- package/dist/components/buttons/copy-button/index.d.mts +2 -0
- package/dist/components/buttons/copy-button/index.mjs +1 -0
- package/dist/components/buttons/icon-button/icon-button.css +81 -0
- package/dist/components/buttons/icon-button/icon-button.d.mts +39 -11
- package/dist/components/buttons/icon-button/icon-button.mjs +70 -57
- package/dist/components/buttons/icon-button/icon-button.module.mjs +15 -0
- package/dist/components/buttons/icon-button/index.d.mts +2 -2
- package/dist/components/buttons/icon-button/index.mjs +1 -2
- package/dist/components/buttons/toolbar/index.d.mts +14 -0
- package/dist/components/buttons/toolbar/index.mjs +9 -0
- package/dist/components/buttons/toolbar/toolbar.css +30 -0
- package/dist/components/buttons/toolbar/toolbar.d.mts +19 -0
- package/dist/components/buttons/toolbar/toolbar.mjs +111 -0
- package/dist/components/buttons/toolbar/toolbar.module.mjs +9 -0
- package/dist/components/data-display/accordion/accordion-button.css +48 -0
- package/dist/components/data-display/accordion/accordion-button.d.mts +2 -3
- package/dist/components/data-display/accordion/accordion-button.mjs +5 -4
- package/dist/components/data-display/accordion/accordion-button.module.mjs +9 -0
- package/dist/components/data-display/accordion/accordion-item.css +11 -0
- package/dist/components/data-display/accordion/accordion-item.d.mts +2 -3
- package/dist/components/data-display/accordion/accordion-item.mjs +2 -1
- package/dist/components/data-display/accordion/accordion-item.module.mjs +5 -0
- package/dist/components/data-display/accordion/accordion-panel.css +9 -0
- package/dist/components/data-display/accordion/accordion-panel.d.mts +2 -3
- package/dist/components/data-display/accordion/accordion-panel.mjs +2 -2
- package/dist/components/data-display/accordion/accordion-panel.module.mjs +5 -0
- package/dist/components/data-display/accordion/accordion.css +19 -0
- package/dist/components/data-display/accordion/accordion.d.mts +2 -3
- package/dist/components/data-display/accordion/accordion.mjs +2 -1
- package/dist/components/data-display/accordion/accordion.module.mjs +5 -0
- package/dist/components/data-display/accordion/context.d.mts +3 -3
- package/dist/components/data-display/accordion/index.d.mts +2 -3
- package/dist/components/data-display/avatar/avatar.css +95 -0
- package/dist/components/data-display/avatar/avatar.d.mts +2 -2
- package/dist/components/data-display/avatar/avatar.mjs +22 -6
- package/dist/components/data-display/avatar/avatar.module.mjs +18 -0
- package/dist/components/data-display/avatar/index.mjs +1 -2
- package/dist/components/data-display/badge/badge.css +160 -0
- package/dist/components/data-display/badge/badge.d.mts +2 -2
- package/dist/components/data-display/badge/badge.mjs +30 -5
- package/dist/components/data-display/badge/badge.module.mjs +21 -0
- package/dist/components/data-display/badge/index.mjs +1 -2
- package/dist/components/data-display/card/card.css +44 -0
- package/dist/components/data-display/card/card.d.mts +2 -2
- package/dist/components/data-display/card/card.mjs +12 -2
- package/dist/components/data-display/card/card.module.mjs +12 -0
- package/dist/components/data-display/card/index.mjs +1 -2
- package/dist/components/data-display/carousel/carousel.css +83 -0
- package/dist/components/data-display/carousel/carousel.d.mts +12 -0
- package/dist/components/data-display/carousel/carousel.mjs +186 -0
- package/dist/components/data-display/carousel/carousel.module.mjs +18 -0
- package/dist/components/data-display/carousel/index.d.mts +11 -0
- package/dist/components/data-display/carousel/index.mjs +8 -0
- package/dist/components/data-display/code/code.css +37 -0
- package/dist/components/data-display/code/code.d.mts +2 -2
- package/dist/components/data-display/code/code.mjs +7 -6
- package/dist/components/data-display/code/code.module.mjs +9 -0
- package/dist/components/data-display/code/find-all-colors.d.mts +2 -2
- package/dist/components/data-display/code/find-all-colors.mjs +0 -161
- package/dist/components/data-display/code/index.mjs +1 -2
- package/dist/components/data-display/code-block/code-block.css +161 -0
- package/dist/components/data-display/code-block/code-block.d.mts +13 -0
- package/dist/components/data-display/code-block/code-block.mjs +44 -0
- package/dist/components/data-display/code-block/code-block.module.mjs +11 -0
- package/dist/components/data-display/code-block/highlight.d.mts +10 -0
- package/dist/components/data-display/code-block/highlight.mjs +54 -0
- package/dist/components/data-display/code-block/index.d.mts +2 -0
- package/dist/components/data-display/code-block/index.mjs +1 -0
- package/dist/components/data-display/data-table/data-table.css +74 -0
- package/dist/components/data-display/data-table/data-table.d.mts +32 -0
- package/dist/components/data-display/data-table/data-table.mjs +155 -0
- package/dist/components/data-display/data-table/data-table.module.mjs +14 -0
- package/dist/components/data-display/data-table/index.d.mts +2 -0
- package/dist/components/data-display/data-table/index.mjs +1 -0
- package/dist/components/data-display/heading/heading.css +99 -0
- package/dist/components/data-display/heading/heading.d.mts +2 -2
- package/dist/components/data-display/heading/heading.mjs +15 -14
- package/dist/components/data-display/heading/heading.module.mjs +20 -0
- package/dist/components/data-display/heading/index.mjs +1 -2
- package/dist/components/data-display/kbd/index.d.mts +2 -0
- package/dist/components/data-display/kbd/index.mjs +1 -0
- package/dist/components/data-display/kbd/kbd.css +21 -0
- package/dist/components/data-display/kbd/kbd.d.mts +9 -0
- package/dist/components/data-display/kbd/kbd.mjs +17 -0
- package/dist/components/data-display/kbd/kbd.module.mjs +5 -0
- package/dist/components/data-display/prose/index.d.mts +2 -0
- package/dist/components/data-display/prose/index.mjs +1 -0
- package/dist/components/data-display/prose/prose.css +253 -0
- package/dist/components/data-display/prose/prose.d.mts +6 -0
- package/dist/components/data-display/prose/prose.mjs +10 -0
- package/dist/components/data-display/prose/prose.module.mjs +5 -0
- package/dist/components/data-display/table/index.mjs +1 -2
- package/dist/components/data-display/table/table.css +107 -0
- package/dist/components/data-display/table/table.d.mts +10 -8
- package/dist/components/data-display/table/table.mjs +26 -15
- package/dist/components/data-display/table/table.module.mjs +22 -0
- package/dist/components/data-display/tree/index.d.mts +2 -0
- package/dist/components/data-display/tree/index.mjs +1 -0
- package/dist/components/data-display/tree/tree.css +70 -0
- package/dist/components/data-display/tree/tree.d.mts +21 -0
- package/dist/components/data-display/tree/tree.mjs +144 -0
- package/dist/components/data-display/tree/tree.module.mjs +14 -0
- package/dist/components/feedback/alert/alert.css +42 -0
- package/dist/components/feedback/alert/alert.d.mts +3 -3
- package/dist/components/feedback/alert/alert.mjs +20 -23
- package/dist/components/feedback/alert/alert.module.mjs +14 -0
- package/dist/components/feedback/alert/index.mjs +1 -2
- package/dist/components/feedback/callout/callout.css +38 -0
- package/dist/components/feedback/callout/callout.d.mts +11 -0
- package/dist/components/feedback/callout/callout.mjs +38 -0
- package/dist/components/feedback/callout/callout.module.mjs +11 -0
- package/dist/components/feedback/callout/index.d.mts +2 -0
- package/dist/components/feedback/callout/index.mjs +1 -0
- package/dist/components/feedback/empty-state/empty-state.css +36 -0
- package/dist/components/feedback/empty-state/empty-state.d.mts +11 -0
- package/dist/components/feedback/empty-state/empty-state.mjs +27 -0
- package/dist/components/feedback/empty-state/empty-state.module.mjs +11 -0
- package/dist/components/feedback/empty-state/index.d.mts +2 -0
- package/dist/components/feedback/empty-state/index.mjs +1 -0
- package/dist/components/feedback/progress/index.mjs +1 -2
- package/dist/components/feedback/progress/progress.css +78 -0
- package/dist/components/feedback/progress/progress.d.mts +5 -4
- package/dist/components/feedback/progress/progress.mjs +17 -3
- package/dist/components/feedback/progress/progress.module.mjs +12 -0
- package/dist/components/feedback/skeleton/index.mjs +1 -2
- package/dist/components/feedback/skeleton/skeleton.css +64 -0
- package/dist/components/feedback/skeleton/skeleton.d.mts +2 -2
- package/dist/components/feedback/skeleton/skeleton.mjs +19 -2
- package/dist/components/feedback/skeleton/skeleton.module.mjs +17 -0
- package/dist/components/feedback/spinner/index.mjs +1 -2
- package/dist/components/feedback/spinner/spinner.css +40 -0
- package/dist/components/feedback/spinner/spinner.d.mts +2 -2
- package/dist/components/feedback/spinner/spinner.mjs +13 -7
- package/dist/components/feedback/spinner/spinner.module.mjs +12 -0
- package/dist/components/feedback/toast/context.d.mts +8 -9
- package/dist/components/feedback/toast/provider.css +69 -0
- package/dist/components/feedback/toast/provider.d.mts +2 -3
- package/dist/components/feedback/toast/provider.mjs +17 -13
- package/dist/components/feedback/toast/provider.module.mjs +12 -0
- package/dist/components/feedback/toast/toast.d.mts +2 -2
- package/dist/components/form/autocomplete/autocomplete.css +154 -0
- package/dist/components/form/autocomplete/autocomplete.d.mts +2 -2
- package/dist/components/form/autocomplete/autocomplete.mjs +70 -46
- package/dist/components/form/autocomplete/autocomplete.module.mjs +21 -0
- package/dist/components/form/autocomplete/index.mjs +1 -2
- package/dist/components/form/calendar/calendar.css +98 -0
- package/dist/components/form/calendar/calendar.d.mts +15 -0
- package/dist/components/form/calendar/calendar.mjs +182 -0
- package/dist/components/form/calendar/calendar.module.mjs +18 -0
- package/dist/components/form/calendar/index.d.mts +2 -0
- package/dist/components/form/calendar/index.mjs +1 -0
- package/dist/components/form/checkbox/checkbox.css +90 -0
- package/dist/components/form/checkbox/checkbox.d.mts +4 -2
- package/dist/components/form/checkbox/checkbox.mjs +29 -27
- package/dist/components/form/checkbox/checkbox.module.mjs +13 -0
- package/dist/components/form/checkbox/index.mjs +1 -2
- package/dist/components/form/checkbox-card/checkbox-card.css +138 -0
- package/dist/components/form/checkbox-card/checkbox-card.d.mts +3 -3
- package/dist/components/form/checkbox-card/checkbox-card.mjs +17 -23
- package/dist/components/form/checkbox-card/checkbox-card.module.mjs +17 -0
- package/dist/components/form/checkbox-card/index.mjs +1 -2
- package/dist/components/form/checkbox-group/checkbox-group.css +15 -0
- package/dist/components/form/checkbox-group/checkbox-group.d.mts +7 -5
- package/dist/components/form/checkbox-group/checkbox-group.mjs +12 -16
- package/dist/components/form/checkbox-group/checkbox-group.module.mjs +8 -0
- package/dist/components/form/checkbox-group/index.d.mts +4 -3
- package/dist/components/form/color-picker/color-picker.css +172 -0
- package/dist/components/form/color-picker/color-picker.d.mts +29 -0
- package/dist/components/form/color-picker/color-picker.mjs +239 -0
- package/dist/components/form/color-picker/color-picker.module.mjs +20 -0
- package/dist/components/form/color-picker/index.d.mts +2 -0
- package/dist/components/form/color-picker/index.mjs +1 -0
- package/dist/components/form/combobox/combobox.css +143 -0
- package/dist/components/form/combobox/combobox.d.mts +33 -0
- package/dist/components/form/combobox/combobox.mjs +278 -0
- package/dist/components/form/combobox/combobox.module.mjs +19 -0
- package/dist/components/form/combobox/index.d.mts +2 -0
- package/dist/components/form/combobox/index.mjs +1 -0
- package/dist/components/form/date-field/date-field.css +31 -0
- package/dist/components/form/date-field/date-field.d.mts +9 -0
- package/dist/components/form/date-field/date-field.mjs +20 -0
- package/dist/components/form/date-field/date-field.module.mjs +5 -0
- package/dist/components/form/date-field/index.d.mts +2 -0
- package/dist/components/form/date-field/index.mjs +1 -0
- package/dist/components/form/date-picker/date-picker.css +90 -0
- package/dist/components/form/date-picker/date-picker.d.mts +13 -0
- package/dist/components/form/date-picker/date-picker.mjs +77 -0
- package/dist/components/form/date-picker/date-picker.module.mjs +14 -0
- package/dist/components/form/date-picker/index.d.mts +2 -0
- package/dist/components/form/date-picker/index.mjs +1 -0
- package/dist/components/form/file-field/file-field.css +88 -0
- package/dist/components/form/file-field/file-field.d.mts +9 -6
- package/dist/components/form/file-field/file-field.mjs +130 -37
- package/dist/components/form/file-field/file-field.module.mjs +17 -0
- package/dist/components/form/file-field/index.d.mts +5 -3
- package/dist/components/form/file-field/index.mjs +2 -1
- package/dist/components/form/form/form.css +11 -0
- package/dist/components/form/form/form.d.mts +4 -3
- package/dist/components/form/form/form.mjs +2 -1
- package/dist/components/form/form/form.module.mjs +5 -0
- package/dist/components/form/form/index.mjs +1 -2
- package/dist/components/form/form-control/form-control.css +43 -0
- package/dist/components/form/form-control/form-control.d.mts +2 -2
- package/dist/components/form/form-control/form-control.mjs +11 -10
- package/dist/components/form/form-control/form-control.module.mjs +12 -0
- package/dist/components/form/form-control/index.mjs +1 -2
- package/dist/components/form/number-field/cast.d.mts +2 -3
- package/dist/components/form/number-field/cast.mjs +3 -22
- package/dist/components/form/number-field/index.mjs +1 -2
- package/dist/components/form/number-field/number-field.css +122 -0
- package/dist/components/form/number-field/number-field.d.mts +10 -9
- package/dist/components/form/number-field/number-field.mjs +126 -54
- package/dist/components/form/number-field/number-field.module.mjs +10 -0
- package/dist/components/form/password-input/index.mjs +1 -2
- package/dist/components/form/password-input/password-input.css +88 -0
- package/dist/components/form/password-input/password-input.d.mts +2 -2
- package/dist/components/form/password-input/password-input.mjs +15 -12
- package/dist/components/form/password-input/password-input.module.mjs +12 -0
- package/dist/components/form/radio/index.mjs +1 -2
- package/dist/components/form/radio/radio.css +89 -0
- package/dist/components/form/radio/radio.d.mts +3 -2
- package/dist/components/form/radio/radio.mjs +15 -19
- package/dist/components/form/radio/radio.module.mjs +16 -0
- package/dist/components/form/radio-card/index.mjs +1 -2
- package/dist/components/form/radio-card/radio-card.css +147 -0
- package/dist/components/form/radio-card/radio-card.d.mts +4 -3
- package/dist/components/form/radio-card/radio-card.mjs +17 -23
- package/dist/components/form/radio-card/radio-card.module.mjs +19 -0
- package/dist/components/form/range-slider/index.d.mts +2 -0
- package/dist/components/form/range-slider/index.mjs +1 -0
- package/dist/components/form/range-slider/range-slider.css +67 -0
- package/dist/components/form/range-slider/range-slider.d.mts +31 -0
- package/dist/components/form/range-slider/range-slider.mjs +135 -0
- package/dist/components/form/range-slider/range-slider.module.mjs +14 -0
- package/dist/components/form/select/index.mjs +1 -2
- package/dist/components/form/select/select.css +74 -0
- package/dist/components/form/select/select.d.mts +2 -2
- package/dist/components/form/select/select.mjs +25 -8
- package/dist/components/form/select/select.module.mjs +12 -0
- package/dist/components/form/slider/index.mjs +1 -2
- package/dist/components/form/slider/range-input-class.css +97 -0
- package/dist/components/form/slider/range-input-class.d.mts +7 -0
- package/dist/components/form/slider/range-input-class.mjs +10 -0
- package/dist/components/form/slider/range-input-class.module.mjs +8 -0
- package/dist/components/form/slider/slider.css +55 -0
- package/dist/components/form/slider/slider.d.mts +6 -6
- package/dist/components/form/slider/slider.mjs +44 -11
- package/dist/components/form/slider/slider.module.mjs +12 -0
- package/dist/components/form/switch/index.mjs +1 -2
- package/dist/components/form/switch/switch.css +103 -0
- package/dist/components/form/switch/switch.d.mts +2 -2
- package/dist/components/form/switch/switch.mjs +14 -17
- package/dist/components/form/switch/switch.module.mjs +16 -0
- package/dist/components/form/text-field/index.mjs +1 -2
- package/dist/components/form/text-field/text-field.css +41 -0
- package/dist/components/form/text-field/text-field.d.mts +4 -4
- package/dist/components/form/text-field/text-field.mjs +2 -3
- package/dist/components/form/text-field/text-field.module.mjs +5 -0
- package/dist/components/form/textarea/index.mjs +1 -2
- package/dist/components/form/textarea/textarea.css +50 -0
- package/dist/components/form/textarea/textarea.d.mts +3 -2
- package/dist/components/form/textarea/textarea.mjs +6 -20
- package/dist/components/form/textarea/textarea.module.mjs +9 -0
- package/dist/components/icons/base.css +40 -0
- package/dist/components/icons/base.d.mts +4 -5
- package/dist/components/icons/base.mjs +10 -10
- package/dist/components/icons/base.module.mjs +13 -0
- package/dist/components/icons/browsers.d.mts +5 -6
- package/dist/components/icons/color-scale.d.mts +2 -3
- package/dist/components/icons/github-mark.d.mts +2 -3
- package/dist/components/icons/logo.css +17 -0
- package/dist/components/icons/logo.d.mts +3 -4
- package/dist/components/icons/logo.mjs +4 -3
- package/dist/components/icons/logo.module.mjs +9 -0
- package/dist/components/icons/lucide-deep.d.mts +3 -1
- package/dist/components/icons/lucide-imports.d.mts +3 -1
- package/dist/components/icons/lucide-imports.mjs +3 -1
- package/dist/components/icons/lucide.d.mts +60 -60
- package/dist/components/icons/qiita.d.mts +2 -3
- package/dist/components/icons/twitter.css +9 -0
- package/dist/components/icons/twitter.d.mts +2 -3
- package/dist/components/icons/twitter.mjs +2 -1
- package/dist/components/icons/twitter.module.mjs +5 -0
- package/dist/components/icons/vertical-writing.d.mts +2 -3
- package/dist/components/index.d.mts +48 -9
- package/dist/components/index.mjs +32 -10
- package/dist/components/layout/_shared/gap.css +25 -0
- package/dist/components/layout/_shared/gap.d.mts +8 -9
- package/dist/components/layout/_shared/gap.mjs +6 -5
- package/dist/components/layout/_shared/gap.module.mjs +11 -0
- package/dist/components/layout/_shared/padding.css +25 -0
- package/dist/components/layout/_shared/padding.d.mts +8 -9
- package/dist/components/layout/_shared/padding.mjs +6 -5
- package/dist/components/layout/_shared/padding.module.mjs +11 -0
- package/dist/components/layout/grid/grid.css +93 -0
- package/dist/components/layout/grid/grid.d.mts +5 -6
- package/dist/components/layout/grid/grid.mjs +21 -20
- package/dist/components/layout/grid/grid.module.mjs +25 -0
- package/dist/components/layout/grid/index.mjs +1 -2
- package/dist/components/layout/resizable-panels/index.d.mts +18 -0
- package/dist/components/layout/resizable-panels/index.mjs +9 -0
- package/dist/components/layout/resizable-panels/resizable-panels.css +77 -0
- package/dist/components/layout/resizable-panels/resizable-panels.d.mts +22 -0
- package/dist/components/layout/resizable-panels/resizable-panels.mjs +164 -0
- package/dist/components/layout/resizable-panels/resizable-panels.module.mjs +16 -0
- package/dist/components/layout/separator/index.mjs +1 -2
- package/dist/components/layout/separator/separator.css +37 -0
- package/dist/components/layout/separator/separator.d.mts +2 -2
- package/dist/components/layout/separator/separator.mjs +12 -9
- package/dist/components/layout/separator/separator.module.mjs +12 -0
- package/dist/components/layout/stack/index.mjs +1 -2
- package/dist/components/layout/stack/stack.css +49 -0
- package/dist/components/layout/stack/stack.d.mts +3 -4
- package/dist/components/layout/stack/stack.mjs +11 -10
- package/dist/components/layout/stack/stack.module.mjs +17 -0
- package/dist/components/navigation/anchor/anchor.css +29 -0
- package/dist/components/navigation/anchor/anchor.d.mts +2 -2
- package/dist/components/navigation/anchor/anchor.mjs +5 -2
- package/dist/components/navigation/anchor/anchor.module.mjs +8 -0
- package/dist/components/navigation/anchor/index.mjs +1 -2
- package/dist/components/navigation/breadcrumb/breadcrumb.css +72 -0
- package/dist/components/navigation/breadcrumb/breadcrumb.d.mts +5 -5
- package/dist/components/navigation/breadcrumb/breadcrumb.mjs +15 -9
- package/dist/components/navigation/breadcrumb/breadcrumb.module.mjs +14 -0
- package/dist/components/navigation/breadcrumb/index.d.mts +2 -3
- package/dist/components/navigation/pagination/index.mjs +1 -2
- package/dist/components/navigation/pagination/pagination.css +36 -0
- package/dist/components/navigation/pagination/pagination.d.mts +2 -2
- package/dist/components/navigation/pagination/pagination.mjs +9 -8
- package/dist/components/navigation/pagination/pagination.module.mjs +11 -0
- package/dist/components/navigation/side-nav/index.d.mts +16 -0
- package/dist/components/navigation/side-nav/index.mjs +10 -0
- package/dist/components/navigation/side-nav/side-nav.css +73 -0
- package/dist/components/navigation/side-nav/side-nav.d.mts +32 -0
- package/dist/components/navigation/side-nav/side-nav.mjs +62 -0
- package/dist/components/navigation/side-nav/side-nav.module.mjs +11 -0
- package/dist/components/navigation/stepper/index.d.mts +2 -0
- package/dist/components/navigation/stepper/index.mjs +1 -0
- package/dist/components/navigation/stepper/stepper.css +151 -0
- package/dist/components/navigation/stepper/stepper.d.mts +20 -0
- package/dist/components/navigation/stepper/stepper.mjs +87 -0
- package/dist/components/navigation/stepper/stepper.module.mjs +29 -0
- package/dist/components/navigation/table-of-contents/index.d.mts +2 -0
- package/dist/components/navigation/table-of-contents/index.mjs +1 -0
- package/dist/components/navigation/table-of-contents/table-of-contents.css +17 -0
- package/dist/components/navigation/table-of-contents/table-of-contents.d.mts +12 -0
- package/dist/components/navigation/table-of-contents/table-of-contents.mjs +94 -0
- package/dist/components/navigation/table-of-contents/table-of-contents.module.mjs +8 -0
- package/dist/components/navigation/tabs/index.d.mts +2 -3
- package/dist/components/navigation/tabs/tabs.css +70 -0
- package/dist/components/navigation/tabs/tabs.d.mts +5 -6
- package/dist/components/navigation/tabs/tabs.mjs +51 -42
- package/dist/components/navigation/tabs/tabs.module.mjs +12 -0
- package/dist/components/observers/fragment-instance.d.mts +1 -0
- package/dist/components/observers/in-view/in-view.d.mts +11 -0
- package/dist/components/observers/in-view/in-view.mjs +60 -0
- package/dist/components/observers/in-view/index.d.mts +2 -0
- package/dist/components/observers/in-view/index.mjs +1 -0
- package/dist/components/observers/resize/index.d.mts +2 -0
- package/dist/components/observers/resize/index.mjs +1 -0
- package/dist/components/observers/resize/resize.d.mts +7 -0
- package/dist/components/observers/resize/resize.mjs +25 -0
- package/dist/components/overlays/_internal/modal-dialog-context.d.mts +4 -5
- package/dist/components/overlays/_internal/use-can-hover.d.mts +2 -3
- package/dist/components/overlays/_internal/use-hover-intent.d.mts +3 -4
- package/dist/components/overlays/_internal/use-list-navigation.d.mts +17 -11
- package/dist/components/overlays/_internal/use-list-navigation.mjs +42 -26
- package/dist/components/overlays/command-palette/command-palette.css +91 -0
- package/dist/components/overlays/command-palette/command-palette.d.mts +25 -0
- package/dist/components/overlays/command-palette/command-palette.mjs +139 -0
- package/dist/components/overlays/command-palette/command-palette.module.mjs +14 -0
- package/dist/components/overlays/command-palette/index.d.mts +2 -0
- package/dist/components/overlays/command-palette/index.mjs +1 -0
- package/dist/components/overlays/context-menu/context-menu.d.mts +13 -0
- package/dist/components/overlays/context-menu/context-menu.mjs +79 -0
- package/dist/components/overlays/context-menu/index.d.mts +21 -0
- package/dist/components/overlays/context-menu/index.mjs +13 -0
- package/dist/components/overlays/dialog/dialog.css +31 -0
- package/dist/components/overlays/dialog/dialog.d.mts +4 -5
- package/dist/components/overlays/dialog/dialog.mjs +10 -7
- package/dist/components/overlays/dialog/dialog.module.mjs +10 -0
- package/dist/components/overlays/dialog/index.d.mts +2 -3
- package/dist/components/overlays/drawer/drawer.css +48 -0
- package/dist/components/overlays/drawer/drawer.d.mts +2 -3
- package/dist/components/overlays/drawer/drawer.mjs +11 -10
- package/dist/components/overlays/drawer/drawer.module.mjs +13 -0
- package/dist/components/overlays/drawer/index.mjs +1 -2
- package/dist/components/overlays/dropdown-menu/dropdown-menu.d.mts +7 -10
- package/dist/components/overlays/dropdown-menu/dropdown-menu.mjs +10 -9
- package/dist/components/overlays/dropdown-menu/hooks.d.mts +7 -6
- package/dist/components/overlays/dropdown-menu/hooks.mjs +3 -3
- package/dist/components/overlays/dropdown-menu/index.d.mts +8 -10
- package/dist/components/overlays/dropdown-menu/shared.css +51 -0
- package/dist/components/overlays/dropdown-menu/shared.d.mts +3 -6
- package/dist/components/overlays/dropdown-menu/shared.mjs +4 -6
- package/dist/components/overlays/dropdown-menu/shared.module.mjs +8 -0
- package/dist/components/overlays/dropdown-menu/sub-menu.css +28 -0
- package/dist/components/overlays/dropdown-menu/sub-menu.d.mts +3 -6
- package/dist/components/overlays/dropdown-menu/sub-menu.mjs +15 -15
- package/dist/components/overlays/dropdown-menu/sub-menu.module.mjs +9 -0
- package/dist/components/overlays/dropdown-menu/use-safe-triangle.d.mts +2 -3
- package/dist/components/overlays/list-box/hooks.d.mts +6 -5
- package/dist/components/overlays/list-box/hooks.mjs +5 -4
- package/dist/components/overlays/list-box/index.d.mts +2 -3
- package/dist/components/overlays/list-box/list-box.css +74 -0
- package/dist/components/overlays/list-box/list-box.d.mts +5 -6
- package/dist/components/overlays/list-box/list-box.mjs +15 -13
- package/dist/components/overlays/list-box/list-box.module.mjs +10 -0
- package/dist/components/overlays/modal/index.mjs +1 -2
- package/dist/components/overlays/modal/modal.css +119 -0
- package/dist/components/overlays/modal/modal.d.mts +2 -3
- package/dist/components/overlays/modal/modal.mjs +14 -11
- package/dist/components/overlays/modal/modal.module.mjs +11 -0
- package/dist/components/overlays/popover/anchor-positioning.d.mts +4 -4
- package/dist/components/overlays/popover/escape-stack.d.mts +2 -3
- package/dist/components/overlays/popover/hooks.d.mts +7 -7
- package/dist/components/overlays/popover/index.d.mts +2 -2
- package/dist/components/overlays/popover/popover.css +51 -0
- package/dist/components/overlays/popover/popover.d.mts +4 -4
- package/dist/components/overlays/popover/popover.mjs +11 -5
- package/dist/components/overlays/popover/popover.module.mjs +11 -0
- package/dist/components/overlays/tooltip/bridge.css +68 -0
- package/dist/components/overlays/tooltip/bridge.d.mts +2 -3
- package/dist/components/overlays/tooltip/bridge.mjs +7 -21
- package/dist/components/overlays/tooltip/bridge.module.mjs +11 -0
- package/dist/components/overlays/tooltip/index.d.mts +2 -2
- package/dist/components/overlays/tooltip/tooltip.css +15 -0
- package/dist/components/overlays/tooltip/tooltip.d.mts +5 -6
- package/dist/components/overlays/tooltip/tooltip.mjs +3 -2
- package/dist/components/overlays/tooltip/tooltip.module.mjs +5 -0
- package/dist/components/providers/index.d.mts +1 -2
- package/dist/components/providers/portal-root.d.mts +9 -7
- package/dist/components/providers/portal-root.mjs +7 -7
- package/dist/components/providers/ui-provider.d.mts +2 -6
- package/dist/components/providers/ui-provider.mjs +1 -5
- package/dist/helpers/chain.d.mts +2 -2
- package/dist/helpers/chain.mjs +0 -23
- package/dist/helpers/create-safe-context.d.mts +2 -2
- package/dist/helpers/create-safe-context.mjs +0 -17
- package/dist/helpers/index.d.mts +1 -2
- package/dist/helpers/index.mjs +2 -3
- package/dist/helpers/merge-props.d.mts +2 -2
- package/dist/helpers/merge-props.mjs +2 -37
- package/dist/helpers/merge-refs.d.mts +2 -3
- package/dist/helpers/merge-refs.mjs +0 -32
- package/dist/hooks/click-away/index.d.mts +2 -3
- package/dist/hooks/controllable-state/index.d.mts +2 -2
- package/dist/hooks/controllable-state/index.mjs +9 -11
- package/dist/hooks/index.d.mts +2 -20
- package/dist/hooks/index.mjs +2 -19
- package/dist/hooks/writing-mode/index.d.mts +15 -5
- package/dist/hooks/writing-mode/index.mjs +21 -14
- package/dist/i18n/current.d.mts +23 -0
- package/dist/i18n/current.mjs +43 -0
- package/dist/i18n/en.d.mts +2 -3
- package/dist/i18n/en.mjs +46 -0
- package/dist/i18n/index.d.mts +3 -2
- package/dist/i18n/index.mjs +4 -3
- package/dist/i18n/ja.d.mts +2 -3
- package/dist/i18n/ja.mjs +46 -0
- package/dist/i18n/messages.d.mts +81 -3
- package/dist/i18n/usage.d.mts +8 -0
- package/dist/i18n/usage.mjs +131 -0
- package/dist/index.d.mts +29 -34
- package/dist/index.mjs +32 -35
- package/dist/integrations/_shared/openui-defs.d.mts +3 -4
- package/dist/integrations/_shared/openui-defs.mjs +123 -54
- package/dist/integrations/_shared/renderers.css +50 -0
- package/dist/integrations/_shared/renderers.d.mts +71 -52
- package/dist/integrations/_shared/renderers.mjs +288 -30
- package/dist/integrations/_shared/renderers.module.mjs +14 -0
- package/dist/integrations/_shared/schemas.d.mts +384 -102
- package/dist/integrations/_shared/schemas.mjs +165 -27
- package/dist/integrations/ai-sdk/index.d.mts +2 -2
- package/dist/integrations/ai-sdk/index.mjs +1 -2
- package/dist/integrations/ai-sdk/map-parts.d.mts +25 -7
- package/dist/integrations/ai-sdk/map-parts.mjs +28 -3
- package/dist/integrations/json-render/catalog.d.mts +336 -17
- package/dist/integrations/json-render/catalog.mjs +120 -57
- package/dist/integrations/json-render/registry.d.mts +3 -4
- package/dist/integrations/json-render/registry.mjs +38 -4
- package/dist/integrations/openui/form-views.d.mts +23 -18
- package/dist/integrations/openui/form-views.mjs +27 -3
- package/dist/integrations/openui/library.d.mts +59 -6
- package/dist/integrations/openui/library.mjs +18 -3
- package/dist/integrations/openui/prompt.d.mts +2 -3
- package/dist/internal/accepts-file.d.mts +8 -0
- package/dist/internal/accepts-file.mjs +19 -0
- package/dist/internal/carries-files.d.mts +3 -0
- package/dist/internal/carries-files.mjs +4 -0
- package/dist/internal/clamp.d.mts +2 -3
- package/dist/internal/clamp.mjs +0 -11
- package/dist/internal/commit-input-value.d.mts +10 -0
- package/dist/internal/commit-input-value.mjs +15 -0
- package/dist/internal/dropped-files.d.mts +3 -0
- package/dist/internal/dropped-files.mjs +8 -0
- package/dist/internal/focus-trap.d.mts +5 -6
- package/dist/internal/focus-trap.mjs +4 -4
- package/dist/internal/hex-color.d.mts +22 -0
- package/dist/internal/hex-color.mjs +53 -0
- package/dist/internal/iso-date.d.mts +39 -0
- package/dist/internal/iso-date.mjs +98 -0
- package/dist/internal/to-precision.d.mts +2 -3
- package/dist/internal/to-precision.mjs +0 -8
- package/dist/styles/index.css +513 -2526
- package/dist/styles/tailwind.css +217 -17
- package/dist/styles/tokens.d.mts +1 -2
- package/dist/styles/tokens.mjs +1 -2
- package/dist/types/variables.d.mts +7 -9
- package/docs/GUIDE.md +239 -72
- package/docs/llms.txt +11 -7
- package/docs/props.generated.json +2156 -309
- package/docs/references/ai-chat.md +345 -62
- package/docs/references/color.md +222 -78
- package/docs/references/components.md +1667 -242
- package/docs/references/generative-ui.md +126 -17
- package/docs/references/interaction-design.md +65 -35
- package/docs/references/spatial-design.md +83 -63
- package/docs/references/types.md +101 -0
- package/docs/references/typography.md +159 -51
- package/package.json +65 -63
- package/dist/components/_internal/focus-ring.d.mts +0 -8
- package/dist/components/_internal/focus-ring.mjs +0 -8
- package/dist/components/layout/scroll-linked/index.d.mts +0 -2
- package/dist/components/layout/scroll-linked/index.mjs +0 -2
- package/dist/components/layout/scroll-linked/scroll-linked.d.mts +0 -14
- package/dist/components/layout/scroll-linked/scroll-linked.mjs +0 -59
- package/dist/helpers/cn.d.mts +0 -5
- package/dist/helpers/cn.mjs +0 -27
- package/dist/hooks/breakpoint/index.d.mts +0 -5
- package/dist/hooks/breakpoint/index.mjs +0 -24
- package/dist/hooks/client/index.d.mts +0 -4
- package/dist/hooks/client/index.mjs +0 -6
- package/dist/hooks/clipboard/index.d.mts +0 -7
- package/dist/hooks/clipboard/index.mjs +0 -15
- package/dist/hooks/debounced-transition/index.d.mts +0 -5
- package/dist/hooks/debounced-transition/index.mjs +0 -49
- package/dist/hooks/deferred-debounce/index.d.mts +0 -4
- package/dist/hooks/deferred-debounce/index.mjs +0 -9
- package/dist/hooks/disclosure/index.d.mts +0 -10
- package/dist/hooks/disclosure/index.mjs +0 -20
- package/dist/hooks/hover/index.d.mts +0 -12
- package/dist/hooks/hover/index.mjs +0 -19
- package/dist/hooks/intersection-observer/index.d.mts +0 -3
- package/dist/hooks/intersection-observer/index.mjs +0 -3
- package/dist/hooks/intersection-observer/use-in-view.d.mts +0 -11
- package/dist/hooks/intersection-observer/use-in-view.mjs +0 -18
- package/dist/hooks/intersection-observer/use-intersection-observer.d.mts +0 -11
- package/dist/hooks/intersection-observer/use-intersection-observer.mjs +0 -33
- package/dist/hooks/interval/index.d.mts +0 -4
- package/dist/hooks/interval/index.mjs +0 -19
- package/dist/hooks/resize/index.d.mts +0 -8
- package/dist/hooks/resize/index.mjs +0 -24
- package/dist/hooks/scroll-direction/index.d.mts +0 -13
- package/dist/hooks/scroll-direction/index.mjs +0 -67
- package/dist/hooks/scroll-lock/index.d.mts +0 -9
- package/dist/hooks/scroll-lock/index.mjs +0 -59
- package/dist/hooks/step/index.d.mts +0 -15
- package/dist/hooks/step/index.mjs +0 -39
- package/dist/hooks/timeout/index.d.mts +0 -4
- package/dist/hooks/timeout/index.mjs +0 -19
- package/dist/hooks/window-resize/index.d.mts +0 -11
- package/dist/hooks/window-resize/index.mjs +0 -21
- package/dist/hooks/window-size/index.d.mts +0 -8
- package/dist/hooks/window-size/index.mjs +0 -31
- package/dist/i18n/context.d.mts +0 -9
- package/dist/i18n/context.mjs +0 -19
- package/dist/styles/base.css +0 -315
- package/dist/styles/tokens.css +0 -380
- package/dist/styles/tokens.generated.d.mts +0 -840
- package/dist/styles/tokens.generated.mjs +0 -813
- package/dist/styles/utilities.css +0 -62
- package/docs/references/helpers.md +0 -223
- package/docs/references/hooks.md +0 -301
|
@@ -10,10 +10,104 @@ Both are optional peer dependencies — install only the one you use.
|
|
|
10
10
|
```bash
|
|
11
11
|
# json-render
|
|
12
12
|
pnpm add @json-render/core @json-render/react zod
|
|
13
|
-
# OpenUI
|
|
14
|
-
pnpm add @openuidev/react-lang zod
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
# OpenUI — both entries import lang-core directly, so install both packages
|
|
14
|
+
pnpm add @openuidev/react-lang @openuidev/lang-core zod
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
`@openuidev/lang-core` is not optional for OpenUI: `@k8ordo/ui/openui` builds its
|
|
18
|
+
component library with it and `@k8ordo/ui/openui/prompt` is the React-free entry
|
|
19
|
+
on top of it. `@openuidev/react-lang` depends on it as well, but pnpm will not
|
|
20
|
+
let your app resolve a dependency of a dependency — declare it yourself.
|
|
21
|
+
|
|
22
|
+
json-render is 0.x, where a minor bump is a breaking release, so `@k8ordo/ui`
|
|
23
|
+
declares a range that stops at the next minor; OpenUI is 1.x, and the range
|
|
24
|
+
stops at the next major. The peer table in the package's README
|
|
25
|
+
(`node_modules/@k8ordo/ui/README.md` when installed via npm) lists the current
|
|
26
|
+
range for each package. Pick a version inside it.
|
|
27
|
+
|
|
28
|
+
Within that range, resolve exactly **one copy** of each framework. The adapters
|
|
29
|
+
read the framework's own React context — `useStateField` for OpenUI,
|
|
30
|
+
`useBoundProp` for json-render — so if your app and `@k8ordo/ui` end up on two
|
|
31
|
+
different copies, the context objects are different objects: every schema check,
|
|
32
|
+
the types, and the build all pass, and the form views throw
|
|
33
|
+
`useOpenUI must be used within a <Renderer /> component.` at render time. With
|
|
34
|
+
pnpm this happens as soon as your version differs from the one `@k8ordo/ui`
|
|
35
|
+
resolves, even when both satisfy the range.
|
|
36
|
+
|
|
37
|
+
## What the catalog covers
|
|
38
|
+
|
|
39
|
+
Both adapters register the same components, and the prompts they generate list
|
|
40
|
+
them. Most are the exported component of the same name. A few are shaped for a
|
|
41
|
+
model instead:
|
|
42
|
+
|
|
43
|
+
- **Icons** are one `Icon` entry whose `name` picks the glyph from a curated
|
|
44
|
+
set of icons that need nothing but a size. `ChevronIcon` has an entry of its
|
|
45
|
+
own, and `AlertIcon` is the `StatusIcon` entry.
|
|
46
|
+
- **Toasts** are a `Toast` entry, standing in for `ToastProvider` and
|
|
47
|
+
`useToast`: a self-contained widget whose `triggerLabel` button shows the
|
|
48
|
+
toast.
|
|
49
|
+
- **Overlays** (`Modal`, `Dialog`, `Drawer`, `Popover`, `Tooltip`,
|
|
50
|
+
`DropdownMenu`) are self-contained widgets too. Each declares its own trigger
|
|
51
|
+
with `triggerLabel` and handles opening and closing itself.
|
|
52
|
+
- **Compound components** (`Tabs`, `Accordion`, `Table`, `Breadcrumb`, …) are
|
|
53
|
+
one entry each, with their parts flattened into data such as
|
|
54
|
+
`tabs: [{ label, content }]`. `Carousel` is one container entry whose
|
|
55
|
+
children are its slides, one child per slide.
|
|
56
|
+
- **Kbd** takes `keys: string[]` and draws the whole shortcut, one key cap per
|
|
57
|
+
entry, where the component itself is one key.
|
|
58
|
+
|
|
59
|
+
Every other component the package exports is either in the catalog or in the
|
|
60
|
+
list below, and the package's tests keep it that way.
|
|
61
|
+
|
|
62
|
+
## What the catalog leaves out
|
|
63
|
+
|
|
64
|
+
These exports are left out on purpose, so a model cannot place them:
|
|
65
|
+
|
|
66
|
+
- `ContextMenu` — it opens on a right-click, which nothing on screen invites,
|
|
67
|
+
so actions put in it would be hidden in a generated UI. It belongs on your
|
|
68
|
+
application's own content (a file, a row).
|
|
69
|
+
- `InView`, `Resize` — they report to a callback and draw nothing of their own,
|
|
70
|
+
and a spec has no code to receive the report.
|
|
71
|
+
- `UIProvider` — your application mounts it once, around the generated UI as
|
|
72
|
+
well.
|
|
73
|
+
- `PortalRootProvider`, `usePortalRoot` — wiring for your own `createPortal`
|
|
74
|
+
calls. The generated overlays open their own surfaces.
|
|
75
|
+
- `Conversation`, `Message`, `PromptInput`, `Reasoning`, `Suggestion`,
|
|
76
|
+
`ToolInvocation`, `Attachment`, and `Source` from `@k8ordo/ui/ai`, and
|
|
77
|
+
`Response` from
|
|
78
|
+
`@k8ordo/ui/ai/response` — the chat the generated UI is shown in. Your
|
|
79
|
+
application builds it from its message stream; a spec does not place it.
|
|
80
|
+
- `CodeBlock` from `@k8ordo/ui/code-block` — it highlights on the server, as an
|
|
81
|
+
async Server Component. The generated UI renders on the client, where it
|
|
82
|
+
cannot run, and placing it there would ship the highlighter to the browser.
|
|
83
|
+
`Code` (inline code) is in the catalog.
|
|
84
|
+
- `CommandPalette` — every item runs a function of your application, which a
|
|
85
|
+
spec cannot write, and it is chrome your application opens from a shortcut
|
|
86
|
+
rather than something placed in a reply. For actions inside the generated UI,
|
|
87
|
+
use `Button` or `DropdownMenu`.
|
|
88
|
+
- `ResizablePanels` — it divides a parent of fixed size into a workspace, the
|
|
89
|
+
frame an application draws around its content. The generated UI flows inside
|
|
90
|
+
a message and has no height to divide; to set things side by side, use
|
|
91
|
+
`Grid`.
|
|
92
|
+
- `Prose` — it typesets the bare HTML that Markdown renders to. A spec places
|
|
93
|
+
components, which keep their own look, so it would have nothing to typeset;
|
|
94
|
+
lay a flow out with `Stack`.
|
|
95
|
+
- `TableOfContents` — it points at the ids of the document's headings and
|
|
96
|
+
follows the scroll. The headings a spec places carry no id, so there would be
|
|
97
|
+
nothing to point at.
|
|
98
|
+
|
|
99
|
+
## Prompt language
|
|
100
|
+
|
|
101
|
+
Everything the adapters hand the model — component descriptions, `uiRules`,
|
|
102
|
+
schema descriptions, and the repair prompt — is English, whatever your
|
|
103
|
+
application's locale. The model reads it; your users never see it. To pin the
|
|
104
|
+
language of the text the model writes into the UI, add a rule of your own:
|
|
105
|
+
|
|
106
|
+
```tsx
|
|
107
|
+
// json-render
|
|
108
|
+
catalog.prompt({ customRules: [...uiRules, 'Write all UI text in Japanese.'] });
|
|
109
|
+
// OpenUI
|
|
110
|
+
prompt({ additionalRules: ['Write all UI text in Japanese.'] });
|
|
17
111
|
```
|
|
18
112
|
|
|
19
113
|
## json-render
|
|
@@ -40,13 +134,20 @@ collect form values.
|
|
|
40
134
|
|
|
41
135
|
```tsx
|
|
42
136
|
'use client';
|
|
137
|
+
import type { UISpec } from '@k8ordo/ui/json-render';
|
|
43
138
|
import { JsonRenderUI } from '@k8ordo/ui/json-render/registry';
|
|
44
139
|
|
|
45
|
-
export function GenUi({ spec }: { spec:
|
|
140
|
+
export function GenUi({ spec }: { spec: UISpec }) {
|
|
46
141
|
return <JsonRenderUI spec={spec} />;
|
|
47
142
|
}
|
|
48
143
|
```
|
|
49
144
|
|
|
145
|
+
Props:
|
|
146
|
+
|
|
147
|
+
- `spec`: `Spec | null` (required; a `UISpec` is assignable to json-render's `Spec` without a cast, and `null` renders nothing)
|
|
148
|
+
- `loading`: boolean (passed to `Renderer`: set it while the spec is still streaming in, so children that have not arrived yet are skipped without a warning)
|
|
149
|
+
- `onStateChange`: `(changes: Array<{ path: string; value: unknown }>) => void` (called once per state update with every changed path and its new value)
|
|
150
|
+
|
|
50
151
|
For an advanced setup (your own `navigate`, `handlers`, or
|
|
51
152
|
`validationFunctions`), pass the low-level `registry` straight to
|
|
52
153
|
`@json-render/react`'s `JSONUIProvider` / `Renderer`.
|
|
@@ -54,9 +155,12 @@ For an advanced setup (your own `navigate`, `handlers`, or
|
|
|
54
155
|
### 3. Validate LLM output, then render or repair it
|
|
55
156
|
|
|
56
157
|
`validateGeneratedSpec` applies mechanical fixes, validates the structure, then
|
|
57
|
-
validates props per component. On failure it returns
|
|
58
|
-
|
|
59
|
-
|
|
158
|
+
validates props per component. On failure it returns the `issues` it found (each
|
|
159
|
+
a `message`, plus the `elementKey` of the offending element when there is one)
|
|
160
|
+
and a repair prompt built from them that you can send straight back to the LLM.
|
|
161
|
+
Use it instead of `catalog.validate()`, which rejects valid specs in the current
|
|
162
|
+
upstream version. The result and issue types are exported as
|
|
163
|
+
`ValidateGeneratedSpecResult` and `GeneratedSpecIssue`.
|
|
60
164
|
|
|
61
165
|
```tsx
|
|
62
166
|
import { validateGeneratedSpec } from '@k8ordo/ui/json-render';
|
|
@@ -87,8 +191,9 @@ const spec = {
|
|
|
87
191
|
} satisfies UISpec;
|
|
88
192
|
```
|
|
89
193
|
|
|
90
|
-
`
|
|
91
|
-
out the props type of a
|
|
194
|
+
`UISpecElement` (one element of a `UISpec`), `ComponentName`, and
|
|
195
|
+
`ComponentProps<K>` are exported as well, so you can pull out the props type of a
|
|
196
|
+
specific component.
|
|
92
197
|
|
|
93
198
|
## OpenUI
|
|
94
199
|
|
|
@@ -114,10 +219,14 @@ import { prompt } from '@k8ordo/ui/openui/prompt';
|
|
|
114
219
|
const systemPrompt = prompt(); // No React dependency — callable from RSC or an API route
|
|
115
220
|
```
|
|
116
221
|
|
|
117
|
-
|
|
118
|
-
`
|
|
119
|
-
|
|
120
|
-
|
|
222
|
+
`prompt` takes an optional `PromptOptions` from `@openuidev/lang-core`
|
|
223
|
+
(`preamble`, `additionalRules`, `examples`, …) and passes it straight through to
|
|
224
|
+
the library's prompt generation.
|
|
225
|
+
|
|
226
|
+
Containers nest freely in OpenUI, as they do in json-render: `Stack`, `Grid`,
|
|
227
|
+
`Card`, `Form`, `Modal`, `Dialog`, `Drawer`, and `Popover` each list every
|
|
228
|
+
container among their children, so a `Card` can sit inside a `Stack` and a
|
|
229
|
+
`Stack` inside another `Stack`.
|
|
121
230
|
|
|
122
231
|
## Exports at a glance
|
|
123
232
|
|
|
@@ -126,8 +235,8 @@ freely.
|
|
|
126
235
|
| `@k8ordo/ui/json-render` | server-safe | `catalog`, `validateGeneratedSpec`, `uiRules`, types (`UISpec`, …) |
|
|
127
236
|
| `@k8ordo/ui/json-render/registry` | `'use client'` | `JsonRenderUI` (pre-wired), `registry` (low level) |
|
|
128
237
|
| `@k8ordo/ui/openui` | `'use client'` | `library` (rendering) |
|
|
129
|
-
| `@k8ordo/ui/openui/prompt` | server-safe | `prompt()` (prompt generation)
|
|
238
|
+
| `@k8ordo/ui/openui/prompt` | server-safe | `prompt(options?)` (prompt generation) |
|
|
130
239
|
|
|
131
240
|
> All of them assume you have loaded `@k8ordo/ui/styles.css` (or
|
|
132
|
-
> `@k8ordo/ui/tailwind.css` in a Tailwind CSS 4 project) and
|
|
133
|
-
> `UIProvider`.
|
|
241
|
+
> `@k8ordo/ui/tailwind.css` after Tailwind, in a Tailwind CSS 4 project) and
|
|
242
|
+
> wrapped the tree in `UIProvider`.
|
|
@@ -6,26 +6,33 @@ Interaction in `@k8ordo/ui` follows one principle: quiet change.
|
|
|
6
6
|
|
|
7
7
|
Design with these eight states in mind.
|
|
8
8
|
|
|
9
|
-
| State | Style
|
|
10
|
-
| -------- |
|
|
11
|
-
| Default | The base style
|
|
12
|
-
| Hover |
|
|
13
|
-
| Focus | `
|
|
14
|
-
| Active |
|
|
15
|
-
| Disabled | `opacity
|
|
16
|
-
| Loading | A spinner or a skeleton
|
|
17
|
-
| Selected |
|
|
18
|
-
| Error |
|
|
9
|
+
| State | Style |
|
|
10
|
+
| -------- | --------------------------------------------------------- |
|
|
11
|
+
| Default | The base style |
|
|
12
|
+
| Hover | `--color-bg-mute` — a gentle color shift |
|
|
13
|
+
| Focus | `box-shadow: var(--shadow-ring-info)` on `:focus-visible` |
|
|
14
|
+
| Active | `--color-bg-emphasize` |
|
|
15
|
+
| Disabled | `opacity: 0.5; cursor: not-allowed` |
|
|
16
|
+
| Loading | A spinner or a skeleton |
|
|
17
|
+
| Selected | `--color-primary-bg-subtle` |
|
|
18
|
+
| Error | `--color-border-error` + `--color-fg-error` |
|
|
19
19
|
|
|
20
20
|
## Transitions
|
|
21
21
|
|
|
22
22
|
Restrained, natural motion.
|
|
23
23
|
|
|
24
|
-
| Purpose | Recommended setting
|
|
25
|
-
| ------------------------------ |
|
|
26
|
-
| Hover color change |
|
|
27
|
-
| Opacity change | `
|
|
28
|
-
| When size changes are involved |
|
|
24
|
+
| Purpose | Recommended setting |
|
|
25
|
+
| ------------------------------ | -------------------------------------------------------- |
|
|
26
|
+
| Hover color change | the colors over `--duration-fast` with `--easing-out` |
|
|
27
|
+
| Opacity change | `opacity` over `--duration-moderate` with `--easing-out` |
|
|
28
|
+
| When size changes are involved | the changing properties over `--duration-fast` |
|
|
29
|
+
| A page or a panel replaced | `<ViewTransition>` — the browser's cross-fade |
|
|
30
|
+
|
|
31
|
+
`--duration-fast` is 150ms, `--duration-moderate` 200ms and `--duration-slow`
|
|
32
|
+
300ms. `--easing-out` and `--easing-in-out` are Tailwind's curves
|
|
33
|
+
(`cubic-bezier(0, 0, 0.2, 1)` and `cubic-bezier(0.4, 0, 0.2, 1)`), not the CSS
|
|
34
|
+
keywords of the same name. With `tailwind.css`: `transition-colors
|
|
35
|
+
duration-150 ease-out`.
|
|
29
36
|
|
|
30
37
|
### Timing principles
|
|
31
38
|
|
|
@@ -36,32 +43,54 @@ Restrained, natural motion.
|
|
|
36
43
|
|
|
37
44
|
### Choosing an animation
|
|
38
45
|
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
```css
|
|
47
|
+
/* Good: transition only the colors that change */
|
|
48
|
+
.item {
|
|
49
|
+
transition-property: color, background-color;
|
|
50
|
+
transition-duration: var(--duration-fast);
|
|
51
|
+
transition-timing-function: var(--easing-out);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@media (hover: hover) {
|
|
55
|
+
.item:hover {
|
|
56
|
+
background-color: var(--color-bg-mute);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* OK: list every property when several change */
|
|
61
|
+
.card {
|
|
62
|
+
transition-property: background-color, scale;
|
|
63
|
+
transition-duration: var(--duration-fast);
|
|
64
|
+
transition-timing-function: var(--easing-out);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* Bad: bounce or spring easing */
|
|
48
68
|
```
|
|
49
69
|
|
|
50
70
|
## Focus management
|
|
51
71
|
|
|
52
|
-
- Use
|
|
53
|
-
- Keep the focus ring consistent with
|
|
54
|
-
- Clear the default outline
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
72
|
+
- Use `:focus-visible`, not `:focus` — no ring appears on a mouse click
|
|
73
|
+
- Keep the focus ring consistent with `--shadow-ring-info`
|
|
74
|
+
- Clear the default outline before applying the ring, and give it back under forced colors, where the ring (a shadow) disappears
|
|
75
|
+
- Keep focus on a button that is waiting on its own action: show the wait with `aria-busy` and `aria-disabled` and ignore presses, rather than setting `disabled`. Chromium moves focus to `body` when the focused element becomes disabled, so the keyboard user who pressed it loses their place. `Button` and `IconButton` do this for `onAction`
|
|
76
|
+
- For the same reason, a text field whose form's action is pending turns `readOnly`, not `disabled`, and ignores the keys that would change its value, so the user who pressed Enter in it keeps their place. `TextField`, `Textarea`, `PasswordInput`, `NumberField`, `DateField`, `DatePicker`, `ColorPicker`, `Combobox`, and `Autocomplete` do this. `readOnly` does not apply to a checkbox, radio, range, or select, yet Enter in one still submits the form through its submit button, so `Checkbox`, `Radio`, `Switch`, `Slider`, `RangeSlider`, and `Select` take `aria-disabled` instead and ignore what would change their value. A checkbox or radio cancels the click in the capture phase and stops it there: cancelled any later, React's change tracking has already recorded the toggle the browser then undoes, calls `onChange` for it, and misses the next real one. A range ignores the arrow, Home, End, and Page keys and the pointer; a select ignores those keys, Space, F4, typed characters, and the pointer
|
|
77
|
+
|
|
78
|
+
```css
|
|
79
|
+
.control:focus-visible {
|
|
80
|
+
outline-style: none;
|
|
81
|
+
box-shadow: var(--shadow-ring-info);
|
|
82
|
+
|
|
83
|
+
@media (forced-colors: active) {
|
|
84
|
+
outline: 2px solid transparent;
|
|
85
|
+
outline-offset: 2px;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
59
88
|
```
|
|
60
89
|
|
|
61
90
|
## Form design
|
|
62
91
|
|
|
63
92
|
- Put the label above the input (a left-aligned label reads badly in Japanese)
|
|
64
|
-
- Put the error message directly under the input,
|
|
93
|
+
- Put the error message directly under the input, in `--color-fg-error` at `--font-size-sm`
|
|
65
94
|
- Mark required fields with `*` after the label
|
|
66
95
|
- Validate on submit; keep real-time validation to a minimum
|
|
67
96
|
- Use the `FormControl` component so labels and errors stay consistent
|
|
@@ -83,13 +112,14 @@ import { FormControl, TextField } from '@k8ordo/ui';
|
|
|
83
112
|
|
|
84
113
|
- Set `aria-label` / `aria-describedby` where they belong
|
|
85
114
|
- Guarantee keyboard navigation (Tab, Enter, Escape, arrow keys)
|
|
86
|
-
- Respect `prefers-reduced-motion`
|
|
115
|
+
- Respect `prefers-reduced-motion`. Under it the stylesheet turns off the open animation of Popover and what is built on it (DropdownMenu, ListBox, Tooltip), the Toast, Modal, and Drawer animations, the Tabs indicator slide, and every view transition; `Card`'s hover scale runs only under `prefers-reduced-motion: no-preference`. Skeleton's pulse, Spinner's spin, and the Accordion chevron, Switch thumb, and Progress bar transitions keep running. Put your own motion under `@media (prefers-reduced-motion: no-preference)`
|
|
87
116
|
- Never signal state with color alone; pair it with an icon or text
|
|
117
|
+
- The components follow `prefers-contrast: more` and stay legible under `forced-colors: active` (see [High contrast and forced colors](./color.md#high-contrast-and-forced-colors)); do the same in your own UI
|
|
88
118
|
|
|
89
119
|
## What not to do
|
|
90
120
|
|
|
91
121
|
- Bounce or spring easing
|
|
92
122
|
- Animation longer than 300ms
|
|
93
|
-
- A strong primary color (
|
|
94
|
-
- `cursor
|
|
123
|
+
- A strong primary color (`--color-primary-bg`) on hover
|
|
124
|
+
- `cursor: pointer` on anything that is not a button (links do not need it either)
|
|
95
125
|
- A submit button with no double-click guard
|
|
@@ -5,32 +5,34 @@ leave room.
|
|
|
5
5
|
|
|
6
6
|
## Spacing principles
|
|
7
7
|
|
|
8
|
-
A 4pt spacing system,
|
|
8
|
+
A 4pt spacing system: one token, `--spacing` (0.25rem), multiplied by the step
|
|
9
|
+
you want — `calc(var(--spacing) * 6)` is 1.5rem. With `tailwind.css`, the
|
|
10
|
+
step is the utility's number (`p-6`, `gap-8`).
|
|
9
11
|
|
|
10
12
|
### Padding inside a component
|
|
11
13
|
|
|
12
|
-
| Use |
|
|
13
|
-
| ----------------- |
|
|
14
|
-
| Compact |
|
|
15
|
-
| Standard |
|
|
16
|
-
| Generous |
|
|
17
|
-
| Inside a big card |
|
|
14
|
+
| Use | Step | Value |
|
|
15
|
+
| ----------------- | ---- | ----- |
|
|
16
|
+
| Compact | 4 | 16px |
|
|
17
|
+
| Standard | 6 | 24px |
|
|
18
|
+
| Generous | 8 | 32px |
|
|
19
|
+
| Inside a big card | 10 | 40px |
|
|
18
20
|
|
|
19
21
|
### Spacing between blocks of text
|
|
20
22
|
|
|
21
|
-
| Relationship |
|
|
22
|
-
| ---------------------- |
|
|
23
|
-
| Closely related |
|
|
24
|
-
| Standard |
|
|
25
|
-
| Between sections |
|
|
26
|
-
| Between major sections |
|
|
23
|
+
| Relationship | Step | Use |
|
|
24
|
+
| ---------------------- | ---- | --------------------------------------- |
|
|
25
|
+
| Closely related | 2 | Descriptions, help text |
|
|
26
|
+
| Standard | 4 | Between paragraphs, between form fields |
|
|
27
|
+
| Between sections | 8 | A section break |
|
|
28
|
+
| Between major sections | 12 | A page-level break |
|
|
27
29
|
|
|
28
30
|
### Spacing between sections
|
|
29
31
|
|
|
30
|
-
| Relationship |
|
|
31
|
-
| ---------------- |
|
|
32
|
-
| Between cards |
|
|
33
|
-
| Between sections |
|
|
32
|
+
| Relationship | Step | Use |
|
|
33
|
+
| ---------------- | ------ | ------------------------------ |
|
|
34
|
+
| Between cards | 6 | Cards side by side (in a grid) |
|
|
35
|
+
| Between sections | 8 – 10 | Sections stacked vertically |
|
|
34
36
|
|
|
35
37
|
## Border radius
|
|
36
38
|
|
|
@@ -40,74 +42,92 @@ Vary the radius with the element's role.
|
|
|
40
42
|
|
|
41
43
|
### Things you touch (soft)
|
|
42
44
|
|
|
43
|
-
| Use |
|
|
44
|
-
| ----------------------------- |
|
|
45
|
-
| Button |
|
|
46
|
-
| Input, Textarea, Select |
|
|
47
|
-
| Card, CheckboxCard, RadioCard |
|
|
45
|
+
| Use | Token | Value |
|
|
46
|
+
| ----------------------------- | --------------- | ----- |
|
|
47
|
+
| Button | `--radius-full` | Pill |
|
|
48
|
+
| Input, Textarea, Select | `--radius-xl` | 1rem |
|
|
49
|
+
| Card, CheckboxCard, RadioCard | `--radius-xl` | 1rem |
|
|
48
50
|
|
|
49
51
|
### Things you read (precise)
|
|
50
52
|
|
|
51
|
-
| Use |
|
|
52
|
-
| -------- |
|
|
53
|
-
| Alert |
|
|
54
|
-
|
|
|
55
|
-
|
|
|
56
|
-
|
|
|
53
|
+
| Use | Token | Value |
|
|
54
|
+
| -------- | --------------- | ------------------------------ |
|
|
55
|
+
| Alert | `--radius-lg` | 0.75rem |
|
|
56
|
+
| Callout | `--radius-lg` | 0.75rem |
|
|
57
|
+
| Badge | `--radius-full` | Pill (fine, since it is small) |
|
|
58
|
+
| Tabs | As-is | |
|
|
59
|
+
| Checkbox | `--radius-md` | 0.5rem |
|
|
57
60
|
|
|
58
61
|
### Everything else
|
|
59
62
|
|
|
60
|
-
| Use |
|
|
61
|
-
| -------------------------------- |
|
|
62
|
-
| Dialog, Modal |
|
|
63
|
-
| Avatar, IconButton, progress bar |
|
|
63
|
+
| Use | Token |
|
|
64
|
+
| -------------------------------- | --------------- |
|
|
65
|
+
| Dialog, Modal | `--radius-lg` |
|
|
66
|
+
| Avatar, IconButton, progress bar | `--radius-full` |
|
|
67
|
+
|
|
68
|
+
With `tailwind.css` these are `rounded-full`, `rounded-xl`, … .
|
|
64
69
|
|
|
65
70
|
## Shadow
|
|
66
71
|
|
|
67
72
|
Express depth with a soft, gentle shadow.
|
|
68
73
|
|
|
69
|
-
| Use | Style
|
|
70
|
-
| ------------------------ |
|
|
71
|
-
| Card (default) |
|
|
72
|
-
| Card (
|
|
73
|
-
| Modal / Dialog / Tooltip |
|
|
74
|
-
| Dropdown / ListBox |
|
|
75
|
-
| Button | None
|
|
74
|
+
| Use | Style |
|
|
75
|
+
| ------------------------ | -------------------------------------------------------- |
|
|
76
|
+
| Card (default) | `--shadow-sm` (with `variant="shadow"`) |
|
|
77
|
+
| Card (outlined) | a 1px `--color-border-mute` border (`variant="outline"`) |
|
|
78
|
+
| Modal / Dialog / Tooltip | `--shadow-md` |
|
|
79
|
+
| Dropdown / ListBox | `--shadow-md` |
|
|
80
|
+
| Button | None |
|
|
76
81
|
|
|
77
|
-
Never use
|
|
82
|
+
Never use `--shadow-xl` or heavier. The focus ring is a shadow too,
|
|
83
|
+
`--shadow-ring-info`; with a surface's own shadow, list the ring first:
|
|
84
|
+
`box-shadow: var(--shadow-ring-info), var(--shadow-xs)`.
|
|
78
85
|
|
|
79
86
|
## Page structure
|
|
80
87
|
|
|
81
88
|
### The bg-subtle plus white card pattern
|
|
82
89
|
|
|
83
|
-
Make the page background
|
|
84
|
-
white cards.
|
|
90
|
+
Make the page background `--color-bg-subtle` (a light grey) and float the
|
|
91
|
+
content on white cards.
|
|
92
|
+
|
|
93
|
+
```css
|
|
94
|
+
.page {
|
|
95
|
+
min-height: 100vh;
|
|
96
|
+
background-color: var(--color-bg-subtle);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.body {
|
|
100
|
+
padding: calc(var(--spacing) * 6);
|
|
101
|
+
}
|
|
102
|
+
```
|
|
85
103
|
|
|
86
104
|
```tsx
|
|
87
105
|
// Good: a white card floating on a grey ground
|
|
88
|
-
<div className=
|
|
89
|
-
<Card
|
|
90
|
-
<div className=
|
|
106
|
+
<div className={styles.page}>
|
|
107
|
+
<Card variant="shadow">
|
|
108
|
+
<div className={styles.body}>Content</div>
|
|
91
109
|
</Card>
|
|
92
110
|
</div>
|
|
93
111
|
```
|
|
94
112
|
|
|
95
113
|
### Build hierarchy out of spacing
|
|
96
114
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
115
|
+
Let the size of the gap show how related things are: 12 steps above a
|
|
116
|
+
section, 2 between a heading and the description that belongs to it, 8 before
|
|
117
|
+
content that sits a little apart. The same gap everywhere flattens the page.
|
|
118
|
+
|
|
119
|
+
```css
|
|
120
|
+
.section {
|
|
121
|
+
margin-top: calc(var(--spacing) * 12);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.description {
|
|
125
|
+
margin-top: calc(var(--spacing) * 2);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.content {
|
|
129
|
+
margin-top: calc(var(--spacing) * 8);
|
|
130
|
+
}
|
|
111
131
|
```
|
|
112
132
|
|
|
113
133
|
### A card is not the answer to everything
|
|
@@ -117,10 +137,10 @@ Content does not have to go in a card. Spacing and a separator are often enough.
|
|
|
117
137
|
```tsx
|
|
118
138
|
import { Separator } from '@k8ordo/ui';
|
|
119
139
|
|
|
120
|
-
// Good: divide with a separator
|
|
140
|
+
// Good: divide with a separator (.divider { padding-block: calc(var(--spacing) * 8); })
|
|
121
141
|
<div>
|
|
122
142
|
<section>Content A</section>
|
|
123
|
-
<div className=
|
|
143
|
+
<div className={styles.divider}>
|
|
124
144
|
<Separator />
|
|
125
145
|
</div>
|
|
126
146
|
<section>Content B</section>
|
|
@@ -133,7 +153,7 @@ import { Separator } from '@k8ordo/ui';
|
|
|
133
153
|
|
|
134
154
|
## What not to do
|
|
135
155
|
|
|
136
|
-
- Extremely tight spacing such as `
|
|
156
|
+
- Extremely tight spacing such as one step (`calc(var(--spacing) * 1)`)
|
|
137
157
|
- Cramming content in (space wins over information density)
|
|
138
158
|
- Nested cards (Card in Card)
|
|
139
|
-
- A z-index
|
|
159
|
+
- A z-index of your own: stack with `--z-index-raised` (inside a component), `--z-index-overlay`, `--z-index-modal` and `--z-index-toast`
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Types
|
|
2
|
+
|
|
3
|
+
The shared types `@k8ordo/ui` exports for typing component props.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import type {
|
|
7
|
+
Direction,
|
|
8
|
+
DrawerSide,
|
|
9
|
+
ModalSide,
|
|
10
|
+
Option,
|
|
11
|
+
Placement,
|
|
12
|
+
Status,
|
|
13
|
+
} from '@k8ordo/ui';
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Status
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
type Status = 'success' | 'info' | 'warning' | 'error';
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Used for the status of `Alert`, `Callout`, `Toast`, and `AlertIcon`. `Badge` takes its own `tone`, which also allows `'neutral'`.
|
|
23
|
+
|
|
24
|
+
## Direction
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
type Direction = 'up' | 'down' | 'right' | 'left';
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Used to point ChevronIcon and similar icons.
|
|
31
|
+
|
|
32
|
+
## Placement
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
type Placement =
|
|
36
|
+
| 'top'
|
|
37
|
+
| 'top-start'
|
|
38
|
+
| 'top-end'
|
|
39
|
+
| 'bottom'
|
|
40
|
+
| 'bottom-start'
|
|
41
|
+
| 'bottom-end'
|
|
42
|
+
| 'left'
|
|
43
|
+
| 'left-start'
|
|
44
|
+
| 'left-end'
|
|
45
|
+
| 'right'
|
|
46
|
+
| 'right-start'
|
|
47
|
+
| 'right-end';
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Placement relative to an anchor element, for Popover, Tooltip, DropdownMenu,
|
|
51
|
+
and ListBox (the `placement` prop), and for IconButton's tooltip
|
|
52
|
+
(`tooltipPlacement`).
|
|
53
|
+
|
|
54
|
+
## ModalSide
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
type ModalSide = 'center' | 'bottom' | 'left' | 'right';
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Which viewport edge a Modal sticks to (the `side` prop). It is a different
|
|
61
|
+
idea from `Placement`, which is relative to an anchor, so the prop name differs
|
|
62
|
+
too.
|
|
63
|
+
|
|
64
|
+
## DrawerSide
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
type DrawerSide = Extract<ModalSide, 'left' | 'right'>;
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
The subset of `ModalSide` a Drawer accepts: a drawer always slides in from an
|
|
71
|
+
edge, so `center` is excluded.
|
|
72
|
+
|
|
73
|
+
## Option
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
type Option = Readonly<{ value: string; label: string }>;
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Used for the choices in Radio, Select, Autocomplete, and similar components.
|
|
80
|
+
|
|
81
|
+
## Component prop types
|
|
82
|
+
|
|
83
|
+
The root also exports types that belong to one component, for typing your own
|
|
84
|
+
code around it:
|
|
85
|
+
|
|
86
|
+
| Type | What it types |
|
|
87
|
+
| --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
|
|
88
|
+
| `StackProps` / `GridProps` | Every prop of `Stack` / `Grid`, for a component that wraps one |
|
|
89
|
+
| `GapSize` / `PaddingSize` | The `none`–`xl` scale of `gap` (Stack, Grid) and `padding` (Stack) |
|
|
90
|
+
| `ButtonRenderItemProps` / `IconButtonRenderItemProps` | What `renderItem` receives on `Button` / `IconButton` |
|
|
91
|
+
| `IconButtonTriggerProps` | `Partial<TooltipTriggerProps>`: the tooltip wiring in `IconButtonRenderItemProps`' `triggerProps` |
|
|
92
|
+
| `PopoverTriggerProps` / `PopoverContentProps` / `TooltipTriggerProps` | What `renderItem` receives on `Popover.Trigger` / `Popover.Content` / `Tooltip.Trigger` |
|
|
93
|
+
| `ToolbarItemProps` | What `renderItem` receives on `Toolbar.Item`: `ref`, `tabIndex`, `onFocus` |
|
|
94
|
+
| `CommandPaletteItem` | A command in `CommandPalette`: `id`, `label`, `onSelect`, plus `group`, `keywords`, `shortcut` |
|
|
95
|
+
| `AlertAction` / `ToastAction` / `ToastOptions` | `Alert`'s `action`, and the `action` and `duration` a toast takes |
|
|
96
|
+
| `ColorPickerSwatch` | A preset in `ColorPicker`'s `swatches`: `value` (`#rrggbb`) and `label`, the color's name |
|
|
97
|
+
| `ComboboxSearch` | `Combobox`'s `search`: `(query, { signal }) => Promise<readonly Option[]>` |
|
|
98
|
+
| `CheckboxCardOption` / `RadioCardOption` | A choice in `CheckboxCard` / `RadioCard`: `value` and `label`, plus `description`, `visual`, `disabled` |
|
|
99
|
+
| `StepperStep` | A step in `Stepper`: `label`, plus `description` |
|
|
100
|
+
| `CellAlign` | A table cell's `align`: `'left'`, `'center'`, or `'right'` |
|
|
101
|
+
| `BaseIconProps` / `IconRenderProps` | An icon's `size`, and the props an icon puts on its `<svg>` |
|