@k8ordo/ui 2.3.1 → 4.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/README.md +75 -183
- package/dist/catalog/icon-map.d.mts +108 -0
- package/dist/catalog/icon-map.mjs +212 -0
- package/dist/catalog/icon-names.d.mts +1 -0
- package/dist/catalog/icon-names.mjs +108 -0
- package/dist/catalog/index.d.mts +1289 -0
- package/dist/catalog/index.mjs +419 -0
- package/dist/catalog/render.css +34 -0
- package/dist/catalog/render.d.mts +72 -0
- package/dist/catalog/render.mjs +631 -0
- package/dist/catalog/render.module.mjs +11 -0
- package/dist/{integrations/_shared → catalog}/schemas.d.mts +550 -307
- package/dist/{integrations/_shared → catalog}/schemas.mjs +191 -184
- package/dist/catalog/to-tree.d.mts +4 -0
- package/dist/catalog/to-tree.mjs +17 -0
- package/dist/components/_internal/checked-values.d.mts +1 -0
- package/dist/components/_internal/checked-values.mjs +5 -0
- package/dist/components/_internal/field-message.css +25 -0
- package/dist/components/_internal/field-message.d.mts +10 -0
- package/dist/components/_internal/field-message.mjs +22 -0
- package/dist/components/_internal/field-message.module.mjs +9 -0
- package/dist/components/_internal/focus-ring.css +1 -1
- package/dist/components/_internal/high-contrast.css +1 -0
- package/dist/components/{observers/in-view → _internal}/in-view.mjs +1 -1
- package/dist/components/{observers/resize → _internal}/resize.mjs +1 -1
- package/dist/components/ai/_internal/attachment-preview.mjs +3 -3
- package/dist/components/ai/_internal/collapsible.mjs +2 -2
- package/dist/components/ai/attachment/attachment.d.mts +1 -1
- package/dist/components/ai/attachment/index.d.mts +1 -1
- package/dist/components/ai/conversation/conversation.mjs +4 -4
- package/dist/components/ai/index.d.mts +2 -2
- package/dist/components/ai/message/index.d.mts +2 -2
- package/dist/components/ai/message/message.d.mts +2 -2
- package/dist/components/ai/message/message.mjs +14 -12
- package/dist/components/ai/prompt-input/prompt-input.mjs +5 -5
- package/dist/components/ai/reasoning/reasoning.mjs +1 -1
- package/dist/components/ai/source/index.d.mts +2 -2
- package/dist/components/ai/source/source.d.mts +2 -2
- package/dist/components/ai/source/source.mjs +2 -2
- package/dist/components/ai/tool-invocation/approval-bar.mjs +11 -22
- package/dist/components/ai/tool-invocation/tool-invocation.d.mts +2 -2
- package/dist/components/ai/tool-invocation/tool-invocation.mjs +2 -1
- package/dist/components/buttons/button/button.css +1 -1
- package/dist/components/buttons/button/button.d.mts +34 -37
- package/dist/components/buttons/button/button.mjs +37 -24
- package/dist/components/buttons/button/button.module.mjs +0 -1
- package/dist/components/buttons/button/index.d.mts +2 -2
- package/dist/components/buttons/copy-button/copy-button.mjs +6 -4
- package/dist/components/buttons/icon-button/icon-button.css +3 -3
- package/dist/components/buttons/icon-button/icon-button.d.mts +37 -43
- package/dist/components/buttons/icon-button/icon-button.mjs +73 -63
- package/dist/components/buttons/icon-button/icon-button.module.mjs +2 -2
- package/dist/components/buttons/icon-button/index.d.mts +2 -2
- package/dist/components/buttons/toolbar/toolbar.css +5 -1
- package/dist/components/buttons/toolbar/toolbar.mjs +1 -1
- package/dist/components/data-display/accordion/accordion-button.d.mts +4 -1
- package/dist/components/data-display/accordion/accordion-button.mjs +5 -5
- package/dist/components/data-display/accordion/index.d.mts +3 -3
- package/dist/components/data-display/card/card-action.d.mts +6 -0
- package/dist/components/data-display/card/card-action.mjs +21 -0
- package/dist/components/data-display/card/card.css +24 -0
- package/dist/components/data-display/card/card.d.mts +26 -3
- package/dist/components/data-display/card/card.mjs +46 -6
- package/dist/components/data-display/card/card.module.mjs +4 -1
- package/dist/components/data-display/card/index.d.mts +2 -2
- package/dist/components/data-display/carousel/carousel.mjs +3 -3
- package/dist/components/data-display/code/code.css +4 -0
- package/dist/components/data-display/code-block/code-block.mjs +1 -1
- package/dist/components/data-display/data-table/data-table.css +0 -3
- package/dist/components/data-display/data-table/data-table.mjs +25 -26
- package/dist/components/data-display/tree/tree.d.mts +1 -1
- package/dist/components/data-display/tree/tree.mjs +7 -6
- package/dist/components/feedback/alert/alert.d.mts +2 -7
- package/dist/components/feedback/alert/alert.mjs +12 -11
- package/dist/components/feedback/alert/index.d.mts +2 -2
- package/dist/components/feedback/callout/callout.mjs +3 -3
- package/dist/components/feedback/progress/progress.mjs +1 -1
- package/dist/components/feedback/toast/context.d.mts +4 -5
- package/dist/components/feedback/toast/index.d.mts +2 -2
- package/dist/components/feedback/toast/provider.d.mts +7 -2
- package/dist/components/feedback/toast/provider.mjs +7 -2
- package/dist/components/feedback/toast/toast.d.mts +2 -3
- package/dist/components/form/autocomplete/autocomplete.d.mts +2 -2
- package/dist/components/form/autocomplete/autocomplete.mjs +15 -12
- package/dist/components/form/calendar/calendar.mjs +4 -6
- package/dist/components/form/checkbox/checkbox.d.mts +3 -1
- package/dist/components/form/checkbox/checkbox.mjs +45 -45
- package/dist/components/form/checkbox-card/checkbox-card.d.mts +3 -2
- package/dist/components/form/checkbox-card/checkbox-card.mjs +13 -6
- package/dist/components/form/checkbox-group/checkbox-group.d.mts +15 -20
- package/dist/components/form/checkbox-group/checkbox-group.mjs +18 -26
- package/dist/components/form/checkbox-group/index.d.mts +2 -34
- package/dist/components/form/checkbox-group/index.mjs +1 -8
- package/dist/components/form/color-picker/color-picker.css +3 -5
- package/dist/components/form/color-picker/color-picker.d.mts +0 -1
- package/dist/components/form/color-picker/color-picker.mjs +4 -4
- package/dist/components/form/combobox/combobox.d.mts +0 -1
- package/dist/components/form/combobox/combobox.mjs +9 -8
- package/dist/components/form/date-picker/date-picker.css +0 -5
- package/dist/components/form/date-picker/date-picker.mjs +22 -23
- package/dist/components/form/file-field/file-field.d.mts +6 -3
- package/dist/components/form/file-field/file-field.mjs +42 -19
- package/dist/components/form/file-field/index.d.mts +4 -1
- package/dist/components/form/form/form.mjs +0 -1
- package/dist/components/form/form-control/form-control.css +0 -15
- package/dist/components/form/form-control/form-control.d.mts +3 -4
- package/dist/components/form/form-control/form-control.mjs +44 -46
- package/dist/components/form/form-control/form-control.module.mjs +0 -3
- package/dist/components/form/number-field/number-field.d.mts +2 -2
- package/dist/components/form/number-field/number-field.mjs +13 -52
- package/dist/components/form/password-input/password-input.mjs +3 -2
- package/dist/components/form/radio/radio.mjs +4 -2
- package/dist/components/form/radio-card/radio-card.mjs +9 -2
- package/dist/components/form/range-slider/range-slider.d.mts +4 -2
- package/dist/components/form/range-slider/range-slider.mjs +2 -4
- package/dist/components/form/select/select.css +6 -4
- package/dist/components/form/select/select.d.mts +5 -0
- package/dist/components/form/select/select.mjs +10 -7
- package/dist/components/form/slider/slider.d.mts +2 -2
- package/dist/components/form/slider/slider.mjs +3 -6
- package/dist/components/form/switch/switch.d.mts +3 -0
- package/dist/components/form/switch/switch.mjs +43 -31
- package/dist/components/form/text-field/index.d.mts +2 -2
- package/dist/components/form/text-field/text-field.css +4 -0
- package/dist/components/form/text-field/text-field.d.mts +1 -1
- package/dist/components/form/textarea/textarea.d.mts +0 -1
- package/dist/components/form/textarea/textarea.mjs +1 -1
- package/dist/components/icons/alert.d.mts +6 -0
- package/dist/components/icons/alert.mjs +17 -0
- package/dist/components/icons/{vertical-writing.d.mts → arrow-down.d.mts} +1 -1
- package/dist/components/icons/arrow-down.mjs +8 -0
- package/dist/components/icons/arrow-left.d.mts +3 -0
- package/dist/components/icons/arrow-left.mjs +8 -0
- package/dist/components/icons/arrow-right.d.mts +3 -0
- package/dist/components/icons/arrow-right.mjs +8 -0
- package/dist/components/icons/{twitter.d.mts → arrow-up.d.mts} +1 -1
- package/dist/components/icons/arrow-up.mjs +8 -0
- package/dist/components/icons/base.d.mts +0 -1
- package/dist/components/icons/base.mjs +1 -2
- package/dist/components/icons/{qiita.d.mts → bell.d.mts} +1 -1
- package/dist/components/icons/bell.mjs +8 -0
- package/dist/components/icons/{github-mark.d.mts → blend.d.mts} +1 -1
- package/dist/components/icons/blend.mjs +16 -0
- package/dist/components/icons/book-text.d.mts +3 -0
- package/dist/components/icons/book-text.mjs +8 -0
- package/dist/components/icons/bookmark.d.mts +3 -0
- package/dist/components/icons/bookmark.mjs +8 -0
- package/dist/components/icons/bot-message.d.mts +3 -0
- package/dist/components/icons/bot-message.mjs +8 -0
- package/dist/components/icons/bot.d.mts +3 -0
- package/dist/components/icons/bot.mjs +14 -0
- package/dist/components/icons/calendar.d.mts +3 -0
- package/dist/components/icons/calendar.mjs +14 -0
- package/dist/components/icons/check.d.mts +3 -0
- package/dist/components/icons/check.mjs +8 -0
- package/dist/components/icons/chevron-down.d.mts +3 -0
- package/dist/components/icons/chevron-down.mjs +8 -0
- package/dist/components/icons/chevron-left.d.mts +3 -0
- package/dist/components/icons/chevron-left.mjs +8 -0
- package/dist/components/icons/chevron-right.d.mts +3 -0
- package/dist/components/icons/chevron-right.mjs +8 -0
- package/dist/components/icons/chevron-up.d.mts +3 -0
- package/dist/components/icons/chevron-up.mjs +8 -0
- package/dist/components/icons/chevron.d.mts +6 -0
- package/dist/components/icons/chevron.mjs +17 -0
- package/dist/components/icons/chevrons-up-down.d.mts +3 -0
- package/dist/components/icons/chevrons-up-down.mjs +8 -0
- package/dist/components/icons/circle-alert.d.mts +3 -0
- package/dist/components/icons/circle-alert.mjs +12 -0
- package/dist/components/icons/circle-check.d.mts +3 -0
- package/dist/components/icons/circle-check.mjs +12 -0
- package/dist/components/icons/circle-help.d.mts +3 -0
- package/dist/components/icons/circle-help.mjs +12 -0
- package/dist/components/icons/circle-x.d.mts +3 -0
- package/dist/components/icons/circle-x.mjs +12 -0
- package/dist/components/icons/clipboard-check.d.mts +3 -0
- package/dist/components/icons/clipboard-check.mjs +18 -0
- package/dist/components/icons/clock.d.mts +3 -0
- package/dist/components/icons/clock.mjs +12 -0
- package/dist/components/icons/code.d.mts +3 -0
- package/dist/components/icons/code.mjs +8 -0
- package/dist/components/icons/color-scale.mjs +18 -30
- package/dist/components/icons/contrast.d.mts +3 -0
- package/dist/components/icons/contrast.mjs +15 -0
- package/dist/components/icons/copy.d.mts +3 -0
- package/dist/components/icons/copy.mjs +14 -0
- package/dist/components/icons/download.d.mts +3 -0
- package/dist/components/icons/download.mjs +8 -0
- package/dist/components/icons/ellipsis-vertical.d.mts +3 -0
- package/dist/components/icons/ellipsis-vertical.mjs +27 -0
- package/dist/components/icons/ellipsis.d.mts +3 -0
- package/dist/components/icons/ellipsis.mjs +27 -0
- package/dist/components/icons/external-link.d.mts +3 -0
- package/dist/components/icons/external-link.mjs +8 -0
- package/dist/components/icons/eye-closed.d.mts +3 -0
- package/dist/components/icons/eye-closed.mjs +8 -0
- package/dist/components/icons/eye.d.mts +3 -0
- package/dist/components/icons/eye.mjs +12 -0
- package/dist/components/icons/file-text.d.mts +3 -0
- package/dist/components/icons/file-text.mjs +12 -0
- package/dist/components/icons/file.d.mts +3 -0
- package/dist/components/icons/file.mjs +8 -0
- package/dist/components/icons/filter.d.mts +3 -0
- package/dist/components/icons/filter.mjs +8 -0
- package/dist/components/icons/flask.d.mts +3 -0
- package/dist/components/icons/flask.mjs +8 -0
- package/dist/components/icons/folder-open.d.mts +3 -0
- package/dist/components/icons/folder-open.mjs +8 -0
- package/dist/components/icons/folder.d.mts +3 -0
- package/dist/components/icons/folder.mjs +8 -0
- package/dist/components/icons/git-fork.d.mts +3 -0
- package/dist/components/icons/git-fork.mjs +25 -0
- package/dist/components/icons/git-pull-request.d.mts +3 -0
- package/dist/components/icons/git-pull-request.mjs +20 -0
- package/dist/components/icons/globe.d.mts +3 -0
- package/dist/components/icons/globe.mjs +12 -0
- package/dist/components/icons/grid.d.mts +3 -0
- package/dist/components/icons/grid.mjs +37 -0
- package/dist/components/icons/grip-vertical.d.mts +3 -0
- package/dist/components/icons/grip-vertical.mjs +45 -0
- package/dist/components/icons/heart.d.mts +3 -0
- package/dist/components/icons/heart.mjs +8 -0
- package/dist/components/icons/history.d.mts +3 -0
- package/dist/components/icons/history.mjs +8 -0
- package/dist/components/icons/home.d.mts +3 -0
- package/dist/components/icons/home.mjs +8 -0
- package/dist/components/icons/image.d.mts +3 -0
- package/dist/components/icons/image.mjs +22 -0
- package/dist/components/icons/index.d.mts +107 -9
- package/dist/components/icons/index.mjs +107 -8
- package/dist/components/icons/info.d.mts +3 -0
- package/dist/components/icons/info.mjs +12 -0
- package/dist/components/icons/lightbulb.d.mts +3 -0
- package/dist/components/icons/lightbulb.mjs +8 -0
- package/dist/components/icons/line-icon.d.mts +3 -0
- package/dist/components/icons/line-icon.mjs +17 -0
- package/dist/components/icons/link.d.mts +3 -0
- package/dist/components/icons/link.mjs +11 -0
- package/dist/components/icons/list.d.mts +3 -0
- package/dist/components/icons/list.mjs +8 -0
- package/dist/components/icons/lock-open.d.mts +3 -0
- package/dist/components/icons/lock-open.mjs +14 -0
- package/dist/components/icons/lock.d.mts +3 -0
- package/dist/components/icons/lock.mjs +14 -0
- package/dist/components/icons/log-in.d.mts +3 -0
- package/dist/components/icons/log-in.mjs +8 -0
- package/dist/components/icons/log-out.d.mts +3 -0
- package/dist/components/icons/log-out.mjs +8 -0
- package/dist/components/icons/mail.d.mts +3 -0
- package/dist/components/icons/mail.mjs +14 -0
- package/dist/components/icons/map-pin.d.mts +3 -0
- package/dist/components/icons/map-pin.mjs +12 -0
- package/dist/components/icons/maximize.d.mts +3 -0
- package/dist/components/icons/maximize.mjs +8 -0
- package/dist/components/icons/menu.d.mts +3 -0
- package/dist/components/icons/menu.mjs +8 -0
- package/dist/components/icons/message-circle.d.mts +3 -0
- package/dist/components/icons/message-circle.mjs +8 -0
- package/dist/components/icons/minimize.d.mts +3 -0
- package/dist/components/icons/minimize.mjs +8 -0
- package/dist/components/icons/minus.d.mts +3 -0
- package/dist/components/icons/minus.mjs +8 -0
- package/dist/components/icons/monitor.d.mts +3 -0
- package/dist/components/icons/monitor.mjs +14 -0
- package/dist/components/icons/moon.d.mts +3 -0
- package/dist/components/icons/moon.mjs +8 -0
- package/dist/components/icons/package.d.mts +3 -0
- package/dist/components/icons/package.mjs +8 -0
- package/dist/components/icons/paint-bucket.d.mts +3 -0
- package/dist/components/icons/paint-bucket.mjs +8 -0
- package/dist/components/icons/palette.d.mts +3 -0
- package/dist/components/icons/palette.mjs +8 -0
- package/dist/components/icons/panel-left.d.mts +3 -0
- package/dist/components/icons/panel-left.mjs +14 -0
- package/dist/components/icons/paperclip.d.mts +3 -0
- package/dist/components/icons/paperclip.mjs +11 -0
- package/dist/components/icons/pause.d.mts +3 -0
- package/dist/components/icons/pause.mjs +20 -0
- package/dist/components/icons/pencil.d.mts +3 -0
- package/dist/components/icons/pencil.mjs +8 -0
- package/dist/components/icons/pin.d.mts +3 -0
- package/dist/components/icons/pin.mjs +11 -0
- package/dist/components/icons/play.d.mts +3 -0
- package/dist/components/icons/play.mjs +8 -0
- package/dist/components/icons/plus.d.mts +3 -0
- package/dist/components/icons/plus.mjs +8 -0
- package/dist/components/icons/presentation.d.mts +3 -0
- package/dist/components/icons/presentation.mjs +8 -0
- package/dist/components/icons/redo.d.mts +3 -0
- package/dist/components/icons/redo.mjs +8 -0
- package/dist/components/icons/refresh.d.mts +3 -0
- package/dist/components/icons/refresh.mjs +8 -0
- package/dist/components/icons/rocket.d.mts +3 -0
- package/dist/components/icons/rocket.mjs +19 -0
- package/dist/components/icons/rss.d.mts +3 -0
- package/dist/components/icons/rss.mjs +13 -0
- package/dist/components/icons/search.d.mts +3 -0
- package/dist/components/icons/search.mjs +12 -0
- package/dist/components/icons/send.d.mts +3 -0
- package/dist/components/icons/send.mjs +8 -0
- package/dist/components/icons/settings.d.mts +3 -0
- package/dist/components/icons/settings.mjs +12 -0
- package/dist/components/icons/share.d.mts +3 -0
- package/dist/components/icons/share.mjs +25 -0
- package/dist/components/icons/shield-check.d.mts +3 -0
- package/dist/components/icons/shield-check.mjs +8 -0
- package/dist/components/icons/smile.d.mts +3 -0
- package/dist/components/icons/smile.mjs +12 -0
- package/dist/components/icons/sparkles.d.mts +3 -0
- package/dist/components/icons/sparkles.mjs +8 -0
- package/dist/components/icons/square.d.mts +3 -0
- package/dist/components/icons/square.mjs +14 -0
- package/dist/components/icons/squircle.d.mts +3 -0
- package/dist/components/icons/squircle.mjs +8 -0
- package/dist/components/icons/star.d.mts +3 -0
- package/dist/components/icons/star.mjs +8 -0
- package/dist/components/icons/sun.d.mts +3 -0
- package/dist/components/icons/sun.mjs +12 -0
- package/dist/components/icons/table.d.mts +3 -0
- package/dist/components/icons/table.mjs +14 -0
- package/dist/components/icons/tag.d.mts +3 -0
- package/dist/components/icons/tag.mjs +8 -0
- package/dist/components/icons/text-horizontal.d.mts +3 -0
- package/dist/components/icons/text-horizontal.mjs +8 -0
- package/dist/components/icons/text-vertical.d.mts +3 -0
- package/dist/components/icons/text-vertical.mjs +8 -0
- package/dist/components/icons/thumbs-down.d.mts +3 -0
- package/dist/components/icons/thumbs-down.mjs +8 -0
- package/dist/components/icons/thumbs-up.d.mts +3 -0
- package/dist/components/icons/thumbs-up.mjs +8 -0
- package/dist/components/icons/trash.d.mts +3 -0
- package/dist/components/icons/trash.mjs +8 -0
- package/dist/components/icons/triangle-alert.d.mts +3 -0
- package/dist/components/icons/triangle-alert.mjs +8 -0
- package/dist/components/icons/undo.d.mts +3 -0
- package/dist/components/icons/undo.mjs +8 -0
- package/dist/components/icons/upload.d.mts +3 -0
- package/dist/components/icons/upload.mjs +8 -0
- package/dist/components/icons/user.d.mts +3 -0
- package/dist/components/icons/user.mjs +12 -0
- package/dist/components/icons/users.d.mts +3 -0
- package/dist/components/icons/users.mjs +12 -0
- package/dist/components/icons/x.d.mts +3 -0
- package/dist/components/icons/x.mjs +8 -0
- package/dist/components/index.d.mts +58 -76
- package/dist/components/index.mjs +13 -27
- package/dist/components/layout/resizable-panels/resizable-panels.mjs +3 -3
- package/dist/components/navigation/anchor/anchor.css +3 -3
- package/dist/components/navigation/anchor/anchor.mjs +20 -7
- package/dist/components/navigation/anchor/anchor.module.mjs +1 -1
- package/dist/components/navigation/breadcrumb/breadcrumb.d.mts +6 -4
- package/dist/components/navigation/breadcrumb/breadcrumb.mjs +3 -2
- package/dist/components/navigation/pagination/pagination.d.mts +2 -2
- package/dist/components/navigation/pagination/pagination.mjs +3 -3
- package/dist/components/navigation/side-nav/side-nav.mjs +1 -1
- package/dist/components/navigation/stepper/stepper.mjs +3 -3
- package/dist/components/navigation/tabs/index.d.mts +10 -5
- package/dist/components/navigation/tabs/tabs.d.mts +11 -6
- package/dist/components/navigation/tabs/tabs.mjs +24 -27
- package/dist/components/overlays/_internal/modal-header.css +38 -0
- package/dist/components/overlays/_internal/modal-header.d.mts +7 -0
- package/dist/components/overlays/_internal/modal-header.mjs +32 -0
- package/dist/components/overlays/_internal/modal-header.module.mjs +10 -0
- package/dist/components/overlays/command-palette/command-palette.d.mts +2 -2
- package/dist/components/overlays/command-palette/command-palette.mjs +9 -8
- package/dist/components/overlays/context-menu/context-menu.mjs +3 -3
- package/dist/components/overlays/context-menu/index.d.mts +27 -2
- package/dist/components/overlays/dialog/dialog.css +3 -21
- package/dist/components/overlays/dialog/dialog.d.mts +20 -9
- package/dist/components/overlays/dialog/dialog.mjs +35 -73
- package/dist/components/overlays/dialog/dialog.module.mjs +1 -3
- package/dist/components/overlays/dialog/index.d.mts +2 -15
- package/dist/components/overlays/dialog/index.mjs +1 -8
- package/dist/components/overlays/drawer/drawer.css +4 -26
- package/dist/components/overlays/drawer/drawer.d.mts +7 -2
- package/dist/components/overlays/drawer/drawer.mjs +24 -37
- package/dist/components/overlays/drawer/drawer.module.mjs +2 -6
- package/dist/components/overlays/dropdown-menu/dropdown-menu.d.mts +35 -5
- package/dist/components/overlays/dropdown-menu/dropdown-menu.mjs +30 -12
- package/dist/components/overlays/dropdown-menu/hooks.d.mts +1 -1
- package/dist/components/overlays/dropdown-menu/hooks.mjs +1 -1
- package/dist/components/overlays/dropdown-menu/index.d.mts +34 -4
- package/dist/components/overlays/dropdown-menu/shared.css +1 -0
- package/dist/components/overlays/dropdown-menu/sub-menu.mjs +4 -4
- package/dist/components/overlays/list-box/hooks.mjs +2 -2
- package/dist/components/overlays/list-box/index.d.mts +2 -25
- package/dist/components/overlays/list-box/index.mjs +1 -9
- package/dist/components/overlays/list-box/list-box.d.mts +11 -16
- package/dist/components/overlays/list-box/list-box.mjs +24 -16
- package/dist/components/overlays/modal/modal.d.mts +8 -7
- package/dist/components/overlays/modal/modal.mjs +23 -32
- package/dist/components/overlays/popover/anchor-positioning.d.mts +3 -16
- package/dist/components/overlays/popover/anchor-positioning.mjs +14 -6
- package/dist/components/overlays/popover/hooks.d.mts +0 -2
- package/dist/components/overlays/popover/hooks.mjs +0 -2
- package/dist/components/overlays/popover/index.d.mts +19 -2
- package/dist/components/overlays/popover/index.mjs +7 -2
- package/dist/components/overlays/popover/popover.css +6 -0
- package/dist/components/overlays/popover/popover.d.mts +15 -2
- package/dist/components/overlays/popover/popover.mjs +28 -13
- package/dist/components/overlays/popover/popover.module.mjs +2 -1
- package/dist/components/overlays/tooltip/bridge.css +1 -1
- package/dist/components/overlays/tooltip/tooltip.mjs +5 -5
- package/dist/helpers/index.mjs +1 -1
- package/dist/i18n/en.mjs +1 -2
- package/dist/i18n/index.d.mts +3 -4
- package/dist/i18n/index.mjs +1 -2
- package/dist/i18n/ja.mjs +1 -2
- package/dist/i18n/messages.d.mts +2 -4
- package/dist/i18n/usage.d.mts +2 -1
- package/dist/i18n/usage.mjs +3 -3
- package/dist/index.d.mts +30 -45
- package/dist/index.mjs +4 -18
- package/dist/internal/iso-date.mjs +1 -1
- package/dist/styles/index.css +79 -231
- package/dist/styles/tailwind.css +1 -4
- package/dist/styles/tokens.css +281 -0
- package/dist/styles/tokens.d.mts +1 -1
- package/dist/styles/tokens.mjs +1 -1
- package/dist/types/index.d.mts +2 -2
- package/dist/types/variables.d.mts +4 -2
- package/docs/GUIDE.md +145 -69
- package/docs/llms.txt +38 -11
- package/docs/props.generated.json +1414 -645
- package/docs/references/ai-chat.md +94 -44
- package/docs/references/color.md +15 -15
- package/docs/references/components.md +636 -504
- package/docs/references/generative-ui.md +378 -187
- package/docs/references/interaction-design.md +6 -5
- package/docs/references/spatial-design.md +8 -8
- package/docs/references/types.md +22 -25
- package/package.json +43 -73
- package/dist/components/ai/_internal/icons.d.mts +0 -6
- package/dist/components/ai/_internal/icons.mjs +0 -13
- package/dist/components/form/date-field/date-field.css +0 -31
- package/dist/components/form/date-field/date-field.d.mts +0 -7
- package/dist/components/form/date-field/date-field.mjs +0 -19
- package/dist/components/form/date-field/date-field.module.mjs +0 -4
- package/dist/components/form/date-field/index.d.mts +0 -2
- package/dist/components/form/date-field/index.mjs +0 -1
- package/dist/components/icons/browsers.d.mts +0 -6
- package/dist/components/icons/browsers.mjs +0 -890
- package/dist/components/icons/github-mark.mjs +0 -18
- package/dist/components/icons/logo.css +0 -17
- package/dist/components/icons/logo.d.mts +0 -4
- package/dist/components/icons/logo.mjs +0 -29
- package/dist/components/icons/logo.module.mjs +0 -8
- package/dist/components/icons/lucide-imports.d.mts +0 -67
- package/dist/components/icons/lucide-imports.mjs +0 -67
- package/dist/components/icons/lucide.d.mts +0 -67
- package/dist/components/icons/lucide.mjs +0 -255
- package/dist/components/icons/qiita.mjs +0 -27
- package/dist/components/icons/twitter.css +0 -9
- package/dist/components/icons/twitter.mjs +0 -20
- package/dist/components/icons/twitter.module.mjs +0 -4
- package/dist/components/icons/vertical-writing.mjs +0 -25
- package/dist/components/observers/in-view/index.d.mts +0 -2
- package/dist/components/observers/in-view/index.mjs +0 -1
- package/dist/components/observers/resize/index.d.mts +0 -2
- package/dist/components/observers/resize/index.mjs +0 -1
- package/dist/components/overlays/_internal/modal-dialog-context.d.mts +0 -11
- package/dist/components/overlays/_internal/modal-dialog-context.mjs +0 -12
- package/dist/components/providers/index.d.mts +0 -3
- package/dist/components/providers/index.mjs +0 -3
- package/dist/components/providers/portal-root.d.mts +0 -8
- package/dist/components/providers/portal-root.mjs +0 -11
- package/dist/components/providers/ui-provider.d.mts +0 -2
- package/dist/components/providers/ui-provider.mjs +0 -6
- package/dist/integrations/_shared/openui-defs.d.mts +0 -15
- package/dist/integrations/_shared/openui-defs.mjs +0 -230
- package/dist/integrations/_shared/renderers.css +0 -50
- package/dist/integrations/_shared/renderers.d.mts +0 -88
- package/dist/integrations/_shared/renderers.mjs +0 -936
- package/dist/integrations/_shared/renderers.module.mjs +0 -13
- package/dist/integrations/ai-sdk/index.d.mts +0 -3
- package/dist/integrations/ai-sdk/index.mjs +0 -1
- package/dist/integrations/ai-sdk/map-parts.d.mts +0 -44
- package/dist/integrations/ai-sdk/map-parts.mjs +0 -56
- package/dist/integrations/json-render/catalog.d.mts +0 -1155
- package/dist/integrations/json-render/catalog.mjs +0 -373
- package/dist/integrations/json-render/registry.d.mts +0 -26
- package/dist/integrations/json-render/registry.mjs +0 -192
- package/dist/integrations/openui/form-views.d.mts +0 -24
- package/dist/integrations/openui/form-views.mjs +0 -89
- package/dist/integrations/openui/library.d.mts +0 -202
- package/dist/integrations/openui/library.mjs +0 -83
- package/dist/integrations/openui/prompt.d.mts +0 -2
- package/dist/integrations/openui/prompt.mjs +0 -18
- /package/dist/components/{observers → _internal}/fragment-instance.d.mts +0 -0
- /package/dist/components/{observers/in-view → _internal}/in-view.d.mts +0 -0
- /package/dist/components/{observers/resize → _internal}/resize.d.mts +0 -0
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
import { accordionProps, alertProps, anchorProps, autocompleteProps, avatarProps, badgeProps, breadcrumbProps, buttonProps, calendarProps, calloutProps, cardProps, carouselProps, checkboxCardProps, checkboxGroupProps, checkboxProps, codeProps, colorPickerProps, comboboxProps, copyButtonProps, dataTableProps, datePickerProps, dialogProps, drawerProps, dropdownMenuItemProps, dropdownMenuProps, emptyStateProps, fileFieldProps, formProps, gridProps, headingProps, iconButtonProps, iconProps, kbdProps, listBoxProps, numberFieldProps, paginationProps, passwordInputProps, popoverProps, progressProps, radioCardProps, radioProps, rangeSliderProps, selectProps, separatorProps, sideNavProps, skeletonProps, sliderProps, spinnerProps, stackProps, stepperProps, switchProps, tableProps, tabsProps, textFieldProps, textareaProps, toastProps, toolbarProps, tooltipProps, treeProps } from "./schemas.mjs";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
// src/catalog/index.ts
|
|
4
|
+
const entry = (definition) => definition;
|
|
5
|
+
const press = (description) => ({ press: description });
|
|
6
|
+
const firstOption = (props) => props.defaultValue ?? props.options[0]?.value ?? "";
|
|
7
|
+
/**
|
|
8
|
+
* `@k8ordo/ui/catalog` (server-safe)
|
|
9
|
+
*
|
|
10
|
+
* Every component a model may place, described for no format in particular:
|
|
11
|
+
* what it is, the props it takes, whether it holds children, and which prop
|
|
12
|
+
* is its value. A json-render catalog, an OpenUI library, or an A2UI catalog
|
|
13
|
+
* is built from this by mapping over the entries; the drawing side is
|
|
14
|
+
* `@k8ordo/ui/catalog/render`.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* import { catalog } from '@k8ordo/ui/catalog';
|
|
18
|
+
*
|
|
19
|
+
* for (const [name, { description, props }] of Object.entries(catalog)) {
|
|
20
|
+
* // register `name` with the format you use
|
|
21
|
+
* }
|
|
22
|
+
*/
|
|
23
|
+
const catalog = {
|
|
24
|
+
Stack: entry({
|
|
25
|
+
description: "Layout container that places its children in a row or a column with even spacing. gap sets the space between children and padding (none to xl) the space inside; give a section padding when it needs room around its content.",
|
|
26
|
+
props: stackProps,
|
|
27
|
+
children: true
|
|
28
|
+
}),
|
|
29
|
+
Grid: entry({
|
|
30
|
+
description: "Places its children in a grid. Set cols (1 to 6, auto-fill, or auto-fit) and gap; with auto-fill or auto-fit, minItemSize sets the smallest size of each cell.",
|
|
31
|
+
props: gridProps,
|
|
32
|
+
children: true
|
|
33
|
+
}),
|
|
34
|
+
Card: entry({
|
|
35
|
+
description: "Card that groups content (a container). size (sm/md/lg, default md) sets its inner padding, so a Stack inside it needs no padding of its own. With href the whole card is a link; binding press makes the whole card a button instead. Links and buttons inside it stay pressable on their own.",
|
|
36
|
+
props: cardProps,
|
|
37
|
+
children: true,
|
|
38
|
+
events: press("The user pressed the card.")
|
|
39
|
+
}),
|
|
40
|
+
Form: entry({
|
|
41
|
+
description: "Wrapper for form elements (a vertical layout). It submits nothing by itself, Enter included: report a submission with the press of a Button inside it.",
|
|
42
|
+
props: formProps,
|
|
43
|
+
children: true
|
|
44
|
+
}),
|
|
45
|
+
Carousel: entry({
|
|
46
|
+
description: "Horizontally scrolling carousel with previous and next buttons. Each child is one slide. slideSize sets how much of the track one slide takes (full, lg, md for two, sm for three).",
|
|
47
|
+
props: carouselProps,
|
|
48
|
+
children: true
|
|
49
|
+
}),
|
|
50
|
+
Button: entry({
|
|
51
|
+
description: "Action button. With href it renders as a link (<a>) and reports no press.",
|
|
52
|
+
props: buttonProps,
|
|
53
|
+
events: press("The user pressed the button.")
|
|
54
|
+
}),
|
|
55
|
+
IconButton: entry({
|
|
56
|
+
description: "Icon-only button (label is required and shown as its tooltip).",
|
|
57
|
+
props: iconButtonProps,
|
|
58
|
+
events: press("The user pressed the button.")
|
|
59
|
+
}),
|
|
60
|
+
CopyButton: entry({
|
|
61
|
+
description: "Button that copies value to the clipboard and confirms it. With iconOnly, label becomes its tooltip.",
|
|
62
|
+
props: copyButtonProps
|
|
63
|
+
}),
|
|
64
|
+
Toolbar: entry({
|
|
65
|
+
description: "Row (or column) of buttons that arrow keys move between, e.g. formatting actions. Give each item an icon to show only the icon.",
|
|
66
|
+
props: toolbarProps
|
|
67
|
+
}),
|
|
68
|
+
Anchor: entry({
|
|
69
|
+
description: "Text link.",
|
|
70
|
+
props: anchorProps
|
|
71
|
+
}),
|
|
72
|
+
Breadcrumb: entry({
|
|
73
|
+
description: "Breadcrumb trail.",
|
|
74
|
+
props: breadcrumbProps
|
|
75
|
+
}),
|
|
76
|
+
Pagination: entry({
|
|
77
|
+
description: "Pagination.",
|
|
78
|
+
props: paginationProps,
|
|
79
|
+
value: {
|
|
80
|
+
prop: "defaultPage",
|
|
81
|
+
initial: (props) => props.defaultPage ?? 1
|
|
82
|
+
}
|
|
83
|
+
}),
|
|
84
|
+
Stepper: entry({
|
|
85
|
+
description: "Steps of a process in order, marking the ones done and the current one (display only).",
|
|
86
|
+
props: stepperProps
|
|
87
|
+
}),
|
|
88
|
+
SideNav: entry({
|
|
89
|
+
description: "Side navigation: groups of links, each group under a small title. Mark the page being shown with current: true.",
|
|
90
|
+
props: sideNavProps
|
|
91
|
+
}),
|
|
92
|
+
Badge: entry({
|
|
93
|
+
description: "Badge for a status or a label.",
|
|
94
|
+
props: badgeProps
|
|
95
|
+
}),
|
|
96
|
+
Heading: entry({
|
|
97
|
+
description: "Heading (h1 to h6).",
|
|
98
|
+
props: headingProps
|
|
99
|
+
}),
|
|
100
|
+
Avatar: entry({
|
|
101
|
+
description: "Avatar (an image or initials).",
|
|
102
|
+
props: avatarProps
|
|
103
|
+
}),
|
|
104
|
+
Code: entry({
|
|
105
|
+
description: "Inline code or value.",
|
|
106
|
+
props: codeProps
|
|
107
|
+
}),
|
|
108
|
+
Kbd: entry({
|
|
109
|
+
description: "Keyboard shortcut. keys lists the keys pressed together, and each is drawn as its own key cap.",
|
|
110
|
+
props: kbdProps
|
|
111
|
+
}),
|
|
112
|
+
EmptyState: entry({
|
|
113
|
+
description: "Placeholder for a list, table, or search with nothing to show: a title, an optional description, and an optional icon.",
|
|
114
|
+
props: emptyStateProps
|
|
115
|
+
}),
|
|
116
|
+
Icon: entry({
|
|
117
|
+
description: "Icon, chosen by name.",
|
|
118
|
+
props: iconProps
|
|
119
|
+
}),
|
|
120
|
+
Alert: entry({
|
|
121
|
+
description: "Alert that reports a status. message is a string or an array of strings.",
|
|
122
|
+
props: alertProps
|
|
123
|
+
}),
|
|
124
|
+
Callout: entry({
|
|
125
|
+
description: "Note inside the content (a tip, a caveat). Unlike Alert, it is not announced as a status. content is plain text; label is an optional bold line above it.",
|
|
126
|
+
props: calloutProps
|
|
127
|
+
}),
|
|
128
|
+
Spinner: entry({
|
|
129
|
+
description: "Loading spinner.",
|
|
130
|
+
props: spinnerProps
|
|
131
|
+
}),
|
|
132
|
+
Progress: entry({
|
|
133
|
+
description: "Progress bar. Leave value out when progress is unknown; it then shows an animated bar.",
|
|
134
|
+
props: progressProps
|
|
135
|
+
}),
|
|
136
|
+
Skeleton: entry({
|
|
137
|
+
description: "Loading placeholder.",
|
|
138
|
+
props: skeletonProps
|
|
139
|
+
}),
|
|
140
|
+
Separator: entry({
|
|
141
|
+
description: "Divider line.",
|
|
142
|
+
props: separatorProps
|
|
143
|
+
}),
|
|
144
|
+
Tabs: entry({
|
|
145
|
+
description: "Tabs. Each tab has a label and text content; content must be a plain string.",
|
|
146
|
+
props: tabsProps
|
|
147
|
+
}),
|
|
148
|
+
Accordion: entry({
|
|
149
|
+
description: "Accordion of items that open and close. Each item has a title and text content; content must be a plain string.",
|
|
150
|
+
props: accordionProps
|
|
151
|
+
}),
|
|
152
|
+
Table: entry({
|
|
153
|
+
description: "Table with columns (the headers) and rows (the cell strings of each row). Every row must have exactly as many cells as there are columns.",
|
|
154
|
+
props: tableProps
|
|
155
|
+
}),
|
|
156
|
+
DataTable: entry({
|
|
157
|
+
description: "Table the reader can sort (by the columns marked sortable) and, with selectable, pick rows from. Use it for records someone works through; use Table for data only read. Every row must have exactly as many cells as there are columns.",
|
|
158
|
+
props: dataTableProps
|
|
159
|
+
}),
|
|
160
|
+
Tree: entry({
|
|
161
|
+
description: "Tree of nodes that open and close, such as files and folders, navigable with the arrow keys. List every node flat; a child names its parent by parentId.",
|
|
162
|
+
props: treeProps
|
|
163
|
+
}),
|
|
164
|
+
Dialog: entry({
|
|
165
|
+
description: "Dialog over the page that a button labeled triggerLabel opens, headed by title with a close button. side puts it in the center (the default) or along the bottom edge.",
|
|
166
|
+
props: dialogProps,
|
|
167
|
+
children: true
|
|
168
|
+
}),
|
|
169
|
+
Drawer: entry({
|
|
170
|
+
description: "Panel along the left or right edge of the page (side, right by default) that a button labeled triggerLabel opens, headed by title with a close button.",
|
|
171
|
+
props: drawerProps,
|
|
172
|
+
children: true
|
|
173
|
+
}),
|
|
174
|
+
Popover: entry({
|
|
175
|
+
description: "Popover that a button labeled triggerLabel opens and closes.",
|
|
176
|
+
props: popoverProps,
|
|
177
|
+
children: true
|
|
178
|
+
}),
|
|
179
|
+
Tooltip: entry({
|
|
180
|
+
description: "Tooltip shown on hover or focus.",
|
|
181
|
+
props: tooltipProps
|
|
182
|
+
}),
|
|
183
|
+
DropdownMenu: entry({
|
|
184
|
+
description: "Dropdown menu that a button labeled triggerLabel opens. Its children are its items, each a DropdownMenuItem.",
|
|
185
|
+
props: dropdownMenuProps,
|
|
186
|
+
children: true
|
|
187
|
+
}),
|
|
188
|
+
DropdownMenuItem: entry({
|
|
189
|
+
description: "One item of a DropdownMenu; place it only as a child of a DropdownMenu.",
|
|
190
|
+
props: dropdownMenuItemProps,
|
|
191
|
+
events: press("The user chose the item.")
|
|
192
|
+
}),
|
|
193
|
+
Toast: entry({
|
|
194
|
+
description: "Toast notification that a button labeled triggerLabel shows.",
|
|
195
|
+
props: toastProps
|
|
196
|
+
}),
|
|
197
|
+
TextField: entry({
|
|
198
|
+
description: "Single-line text input. type picks the kind of value: an email address, a URL, a date, a time, and so on. A password is a PasswordInput, and a number a NumberField.",
|
|
199
|
+
props: textFieldProps,
|
|
200
|
+
value: {
|
|
201
|
+
prop: "defaultValue",
|
|
202
|
+
initial: (props) => props.defaultValue ?? ""
|
|
203
|
+
}
|
|
204
|
+
}),
|
|
205
|
+
Textarea: entry({
|
|
206
|
+
description: "Multi-line text input.",
|
|
207
|
+
props: textareaProps,
|
|
208
|
+
value: {
|
|
209
|
+
prop: "defaultValue",
|
|
210
|
+
initial: (props) => props.defaultValue ?? ""
|
|
211
|
+
}
|
|
212
|
+
}),
|
|
213
|
+
PasswordInput: entry({
|
|
214
|
+
description: "Password input.",
|
|
215
|
+
props: passwordInputProps,
|
|
216
|
+
value: {
|
|
217
|
+
prop: "defaultValue",
|
|
218
|
+
initial: (props) => props.defaultValue ?? ""
|
|
219
|
+
}
|
|
220
|
+
}),
|
|
221
|
+
NumberField: entry({
|
|
222
|
+
description: "Number input.",
|
|
223
|
+
props: numberFieldProps,
|
|
224
|
+
value: {
|
|
225
|
+
prop: "defaultValue",
|
|
226
|
+
initial: (props) => props.defaultValue ?? null
|
|
227
|
+
}
|
|
228
|
+
}),
|
|
229
|
+
Slider: entry({
|
|
230
|
+
description: "Slider.",
|
|
231
|
+
props: sliderProps,
|
|
232
|
+
value: {
|
|
233
|
+
prop: "defaultValue",
|
|
234
|
+
initial: (props) => props.defaultValue ?? props.min ?? 0
|
|
235
|
+
}
|
|
236
|
+
}),
|
|
237
|
+
RangeSlider: entry({
|
|
238
|
+
description: "Slider with two thumbs for picking a range. Its value is [lower, upper].",
|
|
239
|
+
props: rangeSliderProps,
|
|
240
|
+
value: {
|
|
241
|
+
prop: "defaultValue",
|
|
242
|
+
initial: (props) => props.defaultValue ?? [props.min ?? 0, props.max ?? 100]
|
|
243
|
+
}
|
|
244
|
+
}),
|
|
245
|
+
DatePicker: entry({
|
|
246
|
+
description: "Date input with a visible label and a button that opens a calendar. Dates are YYYY-MM-DD strings.",
|
|
247
|
+
props: datePickerProps,
|
|
248
|
+
value: {
|
|
249
|
+
prop: "defaultValue",
|
|
250
|
+
initial: (props) => props.defaultValue ?? ""
|
|
251
|
+
}
|
|
252
|
+
}),
|
|
253
|
+
Calendar: entry({
|
|
254
|
+
description: "Month calendar shown inline for picking one day (YYYY-MM-DD). It submits nothing; in a form, use DatePicker.",
|
|
255
|
+
props: calendarProps,
|
|
256
|
+
value: {
|
|
257
|
+
prop: "defaultValue",
|
|
258
|
+
initial: (props) => props.defaultValue ?? ""
|
|
259
|
+
}
|
|
260
|
+
}),
|
|
261
|
+
ColorPicker: entry({
|
|
262
|
+
description: "Color input with a visible label: a #rrggbb text field, hue / saturation / lightness sliders, and optional preset swatches.",
|
|
263
|
+
props: colorPickerProps,
|
|
264
|
+
value: {
|
|
265
|
+
prop: "defaultValue",
|
|
266
|
+
initial: (props) => props.defaultValue ?? ""
|
|
267
|
+
}
|
|
268
|
+
}),
|
|
269
|
+
Combobox: entry({
|
|
270
|
+
description: "Text field with a visible label that filters a list of options as you type, for picking one. Prefer it to ListBox when there are many options.",
|
|
271
|
+
props: comboboxProps,
|
|
272
|
+
value: {
|
|
273
|
+
prop: "defaultValue",
|
|
274
|
+
initial: (props) => props.defaultValue ?? ""
|
|
275
|
+
}
|
|
276
|
+
}),
|
|
277
|
+
Checkbox: entry({
|
|
278
|
+
description: "Checkbox.",
|
|
279
|
+
props: checkboxProps,
|
|
280
|
+
value: {
|
|
281
|
+
prop: "defaultChecked",
|
|
282
|
+
initial: (props) => props.defaultChecked ?? false
|
|
283
|
+
}
|
|
284
|
+
}),
|
|
285
|
+
Switch: entry({
|
|
286
|
+
description: "On/off switch.",
|
|
287
|
+
props: switchProps,
|
|
288
|
+
value: {
|
|
289
|
+
prop: "defaultChecked",
|
|
290
|
+
initial: (props) => props.defaultChecked ?? false
|
|
291
|
+
}
|
|
292
|
+
}),
|
|
293
|
+
Select: entry({
|
|
294
|
+
description: "Dropdown select.",
|
|
295
|
+
props: selectProps,
|
|
296
|
+
value: {
|
|
297
|
+
prop: "defaultValue",
|
|
298
|
+
initial: firstOption
|
|
299
|
+
}
|
|
300
|
+
}),
|
|
301
|
+
Radio: entry({
|
|
302
|
+
description: "Radio buttons for a single choice.",
|
|
303
|
+
props: radioProps,
|
|
304
|
+
value: {
|
|
305
|
+
prop: "defaultValue",
|
|
306
|
+
initial: firstOption
|
|
307
|
+
}
|
|
308
|
+
}),
|
|
309
|
+
RadioCard: entry({
|
|
310
|
+
description: "Single choice presented as cards.",
|
|
311
|
+
props: radioCardProps,
|
|
312
|
+
value: {
|
|
313
|
+
prop: "defaultValue",
|
|
314
|
+
initial: firstOption
|
|
315
|
+
}
|
|
316
|
+
}),
|
|
317
|
+
CheckboxCard: entry({
|
|
318
|
+
description: "Multiple choice presented as cards.",
|
|
319
|
+
props: checkboxCardProps,
|
|
320
|
+
value: {
|
|
321
|
+
prop: "defaultValue",
|
|
322
|
+
initial: (props) => props.defaultValue ?? []
|
|
323
|
+
}
|
|
324
|
+
}),
|
|
325
|
+
ListBox: entry({
|
|
326
|
+
description: "Button showing the chosen option that opens a list in a popup for picking one; label names the button.",
|
|
327
|
+
props: listBoxProps,
|
|
328
|
+
value: {
|
|
329
|
+
prop: "defaultValue",
|
|
330
|
+
initial: firstOption
|
|
331
|
+
}
|
|
332
|
+
}),
|
|
333
|
+
CheckboxGroup: entry({
|
|
334
|
+
description: "Group of checkboxes.",
|
|
335
|
+
props: checkboxGroupProps,
|
|
336
|
+
value: {
|
|
337
|
+
prop: "defaultValue",
|
|
338
|
+
initial: (props) => props.defaultValue ?? []
|
|
339
|
+
}
|
|
340
|
+
}),
|
|
341
|
+
Autocomplete: entry({
|
|
342
|
+
description: "Tag-style autocomplete for multiple choices.",
|
|
343
|
+
props: autocompleteProps,
|
|
344
|
+
value: {
|
|
345
|
+
prop: "defaultValue",
|
|
346
|
+
initial: (props) => props.defaultValue ?? []
|
|
347
|
+
}
|
|
348
|
+
}),
|
|
349
|
+
FileField: entry({
|
|
350
|
+
description: "File picker field. With dropzone, files can also be dropped onto it.",
|
|
351
|
+
props: fileFieldProps
|
|
352
|
+
})
|
|
353
|
+
};
|
|
354
|
+
/**
|
|
355
|
+
* Cross-cutting constraints a model most often breaks, for the format's
|
|
356
|
+
* system prompt (json-render's `customRules`, OpenUI's `additionalRules`).
|
|
357
|
+
*/
|
|
358
|
+
const catalogRules = [
|
|
359
|
+
"Every row in rows of a Table or DataTable must have exactly as many cells as there are columns.",
|
|
360
|
+
"An href must be an absolute URL starting with https:// or http://, or a path starting with a single /.",
|
|
361
|
+
"The content of Tabs and Accordion must be plain text; components cannot be nested inside it."
|
|
362
|
+
];
|
|
363
|
+
/** Tells whether `name` names an entry of `catalog`, and types it as one. */
|
|
364
|
+
const isCatalogName = (name) => Object.hasOwn(catalog, name);
|
|
365
|
+
/** The name of every entry of `catalog`, in its order. */
|
|
366
|
+
const catalogNames = Object.keys(catalog).filter(isCatalogName);
|
|
367
|
+
const unknownProps = (at, given, allowed) => given.filter((key) => !allowed.includes(key)).map((key) => `${at}: Unknown prop "${key}". Allowed props: ${allowed.join(", ")}.`);
|
|
368
|
+
const keysAt = (schema, path) => {
|
|
369
|
+
if (schema instanceof z.ZodOptional) return keysAt(schema.unwrap(), path);
|
|
370
|
+
const [key, ...rest] = path;
|
|
371
|
+
if (schema instanceof z.ZodArray && typeof key === "number") return keysAt(schema.element, rest);
|
|
372
|
+
if (schema instanceof z.ZodObject) {
|
|
373
|
+
if (key === void 0) return Object.keys(schema.shape);
|
|
374
|
+
return typeof key === "string" ? keysAt(schema.shape[key], rest) : [];
|
|
375
|
+
}
|
|
376
|
+
return [];
|
|
377
|
+
};
|
|
378
|
+
/**
|
|
379
|
+
* Checks what a model wrote for one component and returns what is wrong with
|
|
380
|
+
* it, in English, ready to send back to the model. An empty array means the
|
|
381
|
+
* component exists and its props are valid.
|
|
382
|
+
*
|
|
383
|
+
* Unknown props are reported as well: zod drops a key the schema does not
|
|
384
|
+
* know instead of failing, so a prop the model invented would otherwise pass
|
|
385
|
+
* and render as if it were not there. An unknown key inside an object nested
|
|
386
|
+
* in the props (a `Table` column, an `Accordion` item, an option) is reported
|
|
387
|
+
* the same way, under the path of that object
|
|
388
|
+
* (`Table.columns.0: Unknown prop "width". Allowed props: label, align.`).
|
|
389
|
+
* The schema refuses such a key, so a zod parse of the props fails on it too.
|
|
390
|
+
*
|
|
391
|
+
* Props are also checked against each other, each issue under the path it is
|
|
392
|
+
* at and along with the other issues, once the props a check reads are valid:
|
|
393
|
+
* every row of a `Table` or `DataTable` against the columns
|
|
394
|
+
* (`Table.rows.2: …`), the `defaultValue` of a `TextField` with a date or
|
|
395
|
+
* time `type` against that kind's input format (`TextField.defaultValue: …`),
|
|
396
|
+
* and the `defaultValue` of `Select`, `Radio`, `RadioCard`, `ListBox`,
|
|
397
|
+
* `CheckboxGroup`, and `CheckboxCard` against the values of the options
|
|
398
|
+
* (`CheckboxGroup.defaultValue.1: …`).
|
|
399
|
+
*
|
|
400
|
+
* @example
|
|
401
|
+
* catalogPropIssues('Button', { label: 'OK', colour: 'primary' });
|
|
402
|
+
* // ['Button: Unknown prop "colour". Allowed props: label, variant, …']
|
|
403
|
+
*/
|
|
404
|
+
const catalogPropIssues = (type, props, options = {}) => {
|
|
405
|
+
if (!isCatalogName(type)) return [`Unknown component type "${type}". Use one of: ${Object.keys(catalog).join(", ")}.`];
|
|
406
|
+
const full = catalog[type].props;
|
|
407
|
+
const unresolved = (options.unresolved ?? []).filter((key) => Object.hasOwn(full.shape, key));
|
|
408
|
+
const schema = full.safeExtend(Object.fromEntries(unresolved.map((key) => [key, z.unknown().optional()])));
|
|
409
|
+
const values = typeof props === "object" && props !== null ? Object.fromEntries(Object.entries(props).filter(([key]) => !unresolved.includes(key))) : props;
|
|
410
|
+
const parsed = schema.safeParse(values);
|
|
411
|
+
const issues = parsed.success ? [] : parsed.error.issues.flatMap((issue) => {
|
|
412
|
+
const at = `${type}${issue.path.map((key) => `.${String(key)}`).join("")}`;
|
|
413
|
+
return issue.code === "unrecognized_keys" ? unknownProps(at, issue.keys, keysAt(full, issue.path)) : [`${at}: ${issue.message}`];
|
|
414
|
+
});
|
|
415
|
+
const given = typeof props === "object" && props !== null ? Object.keys(props) : [];
|
|
416
|
+
issues.push(...unknownProps(type, given, Object.keys(full.shape)));
|
|
417
|
+
return issues;
|
|
418
|
+
};
|
|
419
|
+
export { catalog, catalogNames, catalogPropIssues, catalogRules, isCatalogName };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
@layer properties, theme, base;
|
|
2
|
+
|
|
3
|
+
@layer components {
|
|
4
|
+
._6ZAXXG_cardSm {
|
|
5
|
+
padding: calc(var(--spacing) * 4);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
._6ZAXXG_cardMd {
|
|
9
|
+
padding: calc(var(--spacing) * 6);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
._6ZAXXG_cardLg {
|
|
13
|
+
padding: calc(var(--spacing) * 8);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
._6ZAXXG_keys {
|
|
17
|
+
align-items: center;
|
|
18
|
+
gap: calc(var(--spacing) * 1);
|
|
19
|
+
display: inline-flex;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
._6ZAXXG_popover {
|
|
23
|
+
padding: calc(var(--spacing) * 4);
|
|
24
|
+
color: var(--color-fg-base);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
._6ZAXXG_dropHint {
|
|
28
|
+
color: var(--color-fg-mute);
|
|
29
|
+
font-size: var(--font-size-sm);
|
|
30
|
+
line-height: var(--line-height-sm);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@layer utilities;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { CatalogEventOf, CatalogName, CatalogProps, CatalogValueOf } from "./index.mjs";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* What a format hands the renderer of the component `N`: the props the model
|
|
5
|
+
* wrote, the children the format drew, for a field its value and the setter
|
|
6
|
+
* the format's state is written through, and for a component with events the
|
|
7
|
+
* handlers of the ones the model bound.
|
|
8
|
+
*/
|
|
9
|
+
export type RenderArgs<N extends CatalogName> = {
|
|
10
|
+
/**
|
|
11
|
+
* Values that fit the entry's `props` schema, with no `null`: a prop the
|
|
12
|
+
* model left out is absent or `undefined`. The glue drops the `null` keys a
|
|
13
|
+
* format wrote (OpenUI Lang writes an omitted value as `null`), nested ones
|
|
14
|
+
* included, parses the rest with the schema, and passes what the parse
|
|
15
|
+
* returns; it draws nothing for an element that fails.
|
|
16
|
+
*/
|
|
17
|
+
props: CatalogProps<N>;
|
|
18
|
+
/** One node per child, keyed (`Children.toArray` keys them). Left out for a component without children. */
|
|
19
|
+
children?: readonly ReactNode[];
|
|
20
|
+
} & ([CatalogValueOf<N>] extends [never] ? unknown : {
|
|
21
|
+
value: CatalogValueOf<N>;
|
|
22
|
+
setValue: (next: CatalogValueOf<N>) => void;
|
|
23
|
+
}) & ([CatalogEventOf<N>] extends [never] ? unknown : {
|
|
24
|
+
/**
|
|
25
|
+
* The handler of each event the model bound, by name. An event left out
|
|
26
|
+
* is unbound, and the component draws as if it had no such event: a
|
|
27
|
+
* card is not pressable, a button presses to no effect.
|
|
28
|
+
*/
|
|
29
|
+
on?: Partial<Record<CatalogEventOf<N>, () => void | Promise<void>>>;
|
|
30
|
+
});
|
|
31
|
+
/** Draws the component `N` with `@k8ordo/ui`. */
|
|
32
|
+
export type Renderer<N extends CatalogName> = (args: RenderArgs<N>) => ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* `RenderArgs` with the types of the component erased, for a glue that knows
|
|
35
|
+
* a component's name only at run time: the props it parsed with the entry's
|
|
36
|
+
* schema, and for a field its value and setter, typed as `unknown`.
|
|
37
|
+
*/
|
|
38
|
+
export type AnyRenderArgs = {
|
|
39
|
+
props: Record<string, unknown>;
|
|
40
|
+
children?: readonly ReactNode[];
|
|
41
|
+
value?: unknown;
|
|
42
|
+
setValue?: (next: unknown) => void;
|
|
43
|
+
on?: Record<string, () => void | Promise<void>>;
|
|
44
|
+
};
|
|
45
|
+
/** A renderer of `renderers` with the types of its component erased (see `rendererOf`). */
|
|
46
|
+
export type AnyRenderer = (args: AnyRenderArgs) => ReactNode;
|
|
47
|
+
/**
|
|
48
|
+
* `@k8ordo/ui/catalog/render` ('use client')
|
|
49
|
+
*
|
|
50
|
+
* How each component of `@k8ordo/ui/catalog` is drawn, with the same names.
|
|
51
|
+
* A format's renderer looks the component up here and calls it with the props
|
|
52
|
+
* and children it resolved; a field also gets the value the format holds and
|
|
53
|
+
* a setter for it, so the format decides where the value lives.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* 'use client';
|
|
57
|
+
* import { renderers } from '@k8ordo/ui/catalog/render';
|
|
58
|
+
*
|
|
59
|
+
* renderers.Button({ props: { label: 'OK' } });
|
|
60
|
+
*/
|
|
61
|
+
export declare const renderers: { [N in CatalogName]: Renderer<N>; };
|
|
62
|
+
/**
|
|
63
|
+
* The renderer of `name` with the types of its component erased, for a glue
|
|
64
|
+
* that maps over the catalog and so knows the name only at run time. Parse
|
|
65
|
+
* the props with `catalog[name].props` before calling it, as for
|
|
66
|
+
* `renderers[name]`.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* const render = rendererOf(name);
|
|
70
|
+
* render({ props: parsed, children, value, setValue, on });
|
|
71
|
+
*/
|
|
72
|
+
export declare const rendererOf: (name: CatalogName) => AnyRenderer;
|