@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
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
import { ICON_NAMES } from "./icon-names.mjs";
|
|
1
2
|
import { z } from "zod";
|
|
2
|
-
// src/
|
|
3
|
+
// src/catalog/schemas.ts
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* サーバーコンポーネントから import して `catalog.prompt()` のプロンプト生成に
|
|
8
|
-
* 使える。描画ロジックは ./renderers('use client')に分離している。
|
|
5
|
+
* React は `import type` でしか読まない。`@k8ordo/ui/catalog` はサーバーでも
|
|
6
|
+
* 読み込めることを約束していて、形式のつなぎはこのスキーマからプロンプトを作り、
|
|
7
|
+
* モデルの出力を確かめる。描き方は ./render('use client')に置く。
|
|
9
8
|
*
|
|
10
9
|
* ## 二重メンテ防止
|
|
11
10
|
*
|
|
@@ -23,32 +22,47 @@ import { z } from "zod";
|
|
|
23
22
|
* enum 値はトークン由来の固定値に制約することで、生成 UI が崩れないように
|
|
24
23
|
* している。
|
|
25
24
|
*
|
|
26
|
-
* ##
|
|
25
|
+
* ## キーの並び順は契約
|
|
27
26
|
*
|
|
28
|
-
* OpenUI Lang
|
|
29
|
-
*
|
|
30
|
-
*
|
|
27
|
+
* 位置引数で props を書く形式(OpenUI Lang の `Button("ヘルプ", "outline", "base", ...)`)
|
|
28
|
+
* は、引数をキーの並び順で props に戻す。そのため **各 schema のキーの並び順は
|
|
29
|
+
* 契約**で、モデルが書いた文字列も保存された文字列もそれに頼っている。
|
|
31
30
|
*
|
|
32
|
-
* -
|
|
33
|
-
* - 既存キーの削除・並べ替え: 保存済みの OpenUI 文字列の引数が全部ずれる。
|
|
34
|
-
* - 新しいキーの追加: **必ず末尾に足す**。途中に挿入すると以降の位置が 1 つずつ
|
|
31
|
+
* - 新しい任意のキーは **必ず末尾に足す**。途中に挿入すると以降の位置が 1 つずつ
|
|
35
32
|
* ずれ、既存の文字列が無言で誤描画される(型エラーにもならない)。
|
|
33
|
+
* - 新しい必須のキーは、その項目の保存済みの文字列をどれも通らなくするので、
|
|
34
|
+
* 並びを決め直してよい。入力欄の label は name の直後に置く。末尾に置くと、
|
|
35
|
+
* モデルは前にある任意の引数をすべて null で埋めて書くことになる。
|
|
36
|
+
* - 既存キーの削除・並べ替えも、後ろの引数を全部ずらす。
|
|
37
|
+
* - 既存キーのリネームは位置を変えないが、名前で props を書く形式(json-render、
|
|
38
|
+
* A2UI)の保存済みの spec を壊す。
|
|
36
39
|
*
|
|
37
40
|
* ## スキーマの実体が同一性
|
|
38
41
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
+
* 形式によっては zod のインスタンスそのものを鍵に部品を登録する(OpenUI の
|
|
43
|
+
* `createLibrary` は `reg.add(comp.props, { id: name })`)。2 つの部品に同じ
|
|
44
|
+
* インスタンスを渡すと後勝ちで上書きされ、先に登録した方が JSON Schema の
|
|
42
45
|
* `$defs` から丸ごと消える(型エラーにもならない)。キーが同じ schema を作る
|
|
43
46
|
* ときは、プレーンな shape オブジェクトを spread して **別インスタンス**にする。
|
|
47
|
+
*
|
|
48
|
+
* ## 入れ子のオブジェクトは strictObject
|
|
49
|
+
*
|
|
50
|
+
* zod の object は知らないキーを誤りにせず取り除く。props の知らないキーは
|
|
51
|
+
* catalogPropIssues が自分で数えて報告するが、その検査は入れ子に届かない。
|
|
52
|
+
* 列、項目、選択肢のように props の中に置くオブジェクトは z.strictObject で
|
|
53
|
+
* 書き、書き間違えたキー(`alig`)を誤りにする。
|
|
44
54
|
*/
|
|
45
55
|
/**
|
|
46
56
|
* LLM 生成の `href` は `<a href>` に直接渡るため、`javascript:` や `data:` の
|
|
47
|
-
* スキームが通ると XSS になる。`http(s)://` 始まり、または `/`
|
|
57
|
+
* スキームが通ると XSS になる。`http(s)://` 始まり、または `/` 1 つから始まる
|
|
48
58
|
* 相対パスのみを許可する。`z.url()` は `javascript:` を拒否しないため正規表現で
|
|
49
59
|
* 明示的にブロックしている。
|
|
60
|
+
*
|
|
61
|
+
* `//host` と `/\host` はスキームを省いた別のサイトの URL で、`/` で始まっても
|
|
62
|
+
* パスではない。ブラウザは URL の途中のタブと改行を読み飛ばすので、`/<タブ>/host`
|
|
63
|
+
* も同じ URL になる。どれも弾く。
|
|
50
64
|
*/
|
|
51
|
-
const safeUrl = z.string().regex(/^(https?:\/\/|\/)
|
|
65
|
+
const safeUrl = z.string().regex(/^(?:https?:\/\/|\/(?![/\\]))[^\t\n\r]*$/u, "Only an http:// or https:// URL, or a path starting with a single /, is allowed");
|
|
52
66
|
const buttonProps = z.object({
|
|
53
67
|
label: z.string(),
|
|
54
68
|
variant: z.enum([
|
|
@@ -69,59 +83,7 @@ const buttonProps = z.object({
|
|
|
69
83
|
fullWidth: z.boolean().optional(),
|
|
70
84
|
href: safeUrl.optional()
|
|
71
85
|
});
|
|
72
|
-
const iconName = z.enum(
|
|
73
|
-
"plus",
|
|
74
|
-
"minus",
|
|
75
|
-
"check",
|
|
76
|
-
"close",
|
|
77
|
-
"copy",
|
|
78
|
-
"send",
|
|
79
|
-
"mail",
|
|
80
|
-
"subscribe",
|
|
81
|
-
"rss",
|
|
82
|
-
"history",
|
|
83
|
-
"update-date",
|
|
84
|
-
"publish-date",
|
|
85
|
-
"link",
|
|
86
|
-
"external-link",
|
|
87
|
-
"location",
|
|
88
|
-
"navigation-menu",
|
|
89
|
-
"list",
|
|
90
|
-
"table",
|
|
91
|
-
"form",
|
|
92
|
-
"view",
|
|
93
|
-
"view-off",
|
|
94
|
-
"light-mode",
|
|
95
|
-
"dark-mode",
|
|
96
|
-
"palette",
|
|
97
|
-
"color-contrast",
|
|
98
|
-
"color-info",
|
|
99
|
-
"mixed-color",
|
|
100
|
-
"horizontal-writing",
|
|
101
|
-
"vertical-writing",
|
|
102
|
-
"tag",
|
|
103
|
-
"blog",
|
|
104
|
-
"news",
|
|
105
|
-
"slide",
|
|
106
|
-
"sparkles",
|
|
107
|
-
"ai",
|
|
108
|
-
"atom",
|
|
109
|
-
"accessibility",
|
|
110
|
-
"shield-check",
|
|
111
|
-
"prepare",
|
|
112
|
-
"informative",
|
|
113
|
-
"good",
|
|
114
|
-
"bad",
|
|
115
|
-
"easy",
|
|
116
|
-
"difficult",
|
|
117
|
-
"interesting",
|
|
118
|
-
"boring",
|
|
119
|
-
"shallow",
|
|
120
|
-
"logo",
|
|
121
|
-
"github",
|
|
122
|
-
"twitter",
|
|
123
|
-
"qiita"
|
|
124
|
-
]);
|
|
86
|
+
const iconName = z.enum(ICON_NAMES);
|
|
125
87
|
const iconProps = z.object({
|
|
126
88
|
name: iconName,
|
|
127
89
|
size: z.enum([
|
|
@@ -139,11 +101,11 @@ const iconButtonProps = z.object({
|
|
|
139
101
|
"lg"
|
|
140
102
|
]).optional(),
|
|
141
103
|
color: z.enum([
|
|
142
|
-
"transparent",
|
|
143
104
|
"base",
|
|
144
105
|
"primary",
|
|
145
106
|
"secondary"
|
|
146
|
-
]).optional()
|
|
107
|
+
]).optional(),
|
|
108
|
+
variant: z.enum(["solid", "skeleton"]).optional()
|
|
147
109
|
});
|
|
148
110
|
const copyButtonProps = z.object({
|
|
149
111
|
value: z.string().describe("Text copied to the clipboard"),
|
|
@@ -155,32 +117,6 @@ const copyButtonProps = z.object({
|
|
|
155
117
|
"lg"
|
|
156
118
|
]).optional()
|
|
157
119
|
});
|
|
158
|
-
const chevronIconProps = z.object({
|
|
159
|
-
direction: z.enum([
|
|
160
|
-
"up",
|
|
161
|
-
"down",
|
|
162
|
-
"left",
|
|
163
|
-
"right"
|
|
164
|
-
]),
|
|
165
|
-
size: z.enum([
|
|
166
|
-
"sm",
|
|
167
|
-
"md",
|
|
168
|
-
"lg"
|
|
169
|
-
]).optional()
|
|
170
|
-
});
|
|
171
|
-
const statusIconProps = z.object({
|
|
172
|
-
status: z.enum([
|
|
173
|
-
"success",
|
|
174
|
-
"info",
|
|
175
|
-
"warning",
|
|
176
|
-
"error"
|
|
177
|
-
]),
|
|
178
|
-
size: z.enum([
|
|
179
|
-
"sm",
|
|
180
|
-
"md",
|
|
181
|
-
"lg"
|
|
182
|
-
]).optional()
|
|
183
|
-
});
|
|
184
120
|
const badgeProps = z.object({
|
|
185
121
|
label: z.string(),
|
|
186
122
|
tone: z.enum([
|
|
@@ -243,14 +179,27 @@ const carouselProps = z.object({
|
|
|
243
179
|
"sm"
|
|
244
180
|
]).optional()
|
|
245
181
|
});
|
|
246
|
-
const accordionProps = z.object({ items: z.array(z.
|
|
182
|
+
const accordionProps = z.object({ items: z.array(z.strictObject({
|
|
247
183
|
title: z.string(),
|
|
248
184
|
content: z.string(),
|
|
249
185
|
defaultOpen: z.boolean().optional()
|
|
250
186
|
})).min(1).describe("Accordion items, each with a title and a plain-text body") });
|
|
187
|
+
const whenParsed = (...keys) => (payload) => payload.issues.every((issue) => {
|
|
188
|
+
const [key] = issue.path ?? [];
|
|
189
|
+
return typeof key === "string" && !keys.includes(key);
|
|
190
|
+
});
|
|
191
|
+
const rowsFitColumns = (props, ctx) => {
|
|
192
|
+
if (!Array.isArray(props.columns) || !Array.isArray(props.rows)) return;
|
|
193
|
+
const { length } = props.columns;
|
|
194
|
+
for (const [index, row] of props.rows.entries()) if (Array.isArray(row) && row.length !== length) ctx.addIssue({
|
|
195
|
+
code: "custom",
|
|
196
|
+
path: ["rows", index],
|
|
197
|
+
message: `Expected ${length} cells (one per column), received ${row.length}`
|
|
198
|
+
});
|
|
199
|
+
};
|
|
251
200
|
const tableProps = z.object({
|
|
252
201
|
caption: z.string().optional(),
|
|
253
|
-
columns: z.array(z.
|
|
202
|
+
columns: z.array(z.strictObject({
|
|
254
203
|
label: z.string(),
|
|
255
204
|
align: z.enum([
|
|
256
205
|
"left",
|
|
@@ -259,10 +208,10 @@ const tableProps = z.object({
|
|
|
259
208
|
]).optional()
|
|
260
209
|
})).min(1),
|
|
261
210
|
rows: z.array(z.array(z.string())).describe("Cell strings of each row, in the same order and number as columns")
|
|
262
|
-
});
|
|
211
|
+
}).superRefine(rowsFitColumns, { when: whenParsed("columns", "rows") });
|
|
263
212
|
const dataTableProps = z.object({
|
|
264
213
|
label: z.string().describe("Accessible name of the table"),
|
|
265
|
-
columns: z.array(z.
|
|
214
|
+
columns: z.array(z.strictObject({
|
|
266
215
|
label: z.string(),
|
|
267
216
|
align: z.enum([
|
|
268
217
|
"left",
|
|
@@ -273,10 +222,10 @@ const dataTableProps = z.object({
|
|
|
273
222
|
})).min(1),
|
|
274
223
|
rows: z.array(z.array(z.string())).describe("Cell strings of each row, in the same order and number as columns"),
|
|
275
224
|
selectable: z.boolean().optional()
|
|
276
|
-
});
|
|
225
|
+
}).superRefine(rowsFitColumns, { when: whenParsed("columns", "rows") });
|
|
277
226
|
const treeProps = z.object({
|
|
278
227
|
label: z.string().describe("Accessible name of the tree"),
|
|
279
|
-
items: z.array(z.
|
|
228
|
+
items: z.array(z.strictObject({
|
|
280
229
|
id: z.string(),
|
|
281
230
|
label: z.string(),
|
|
282
231
|
parentId: z.string().optional(),
|
|
@@ -286,12 +235,12 @@ const treeProps = z.object({
|
|
|
286
235
|
const cardProps = z.object({
|
|
287
236
|
width: z.enum(["full", "fit"]).optional(),
|
|
288
237
|
variant: z.enum(["shadow", "outline"]).optional(),
|
|
289
|
-
interactive: z.boolean().optional(),
|
|
290
238
|
size: z.enum([
|
|
291
239
|
"sm",
|
|
292
240
|
"md",
|
|
293
241
|
"lg"
|
|
294
|
-
]).optional()
|
|
242
|
+
]).optional(),
|
|
243
|
+
href: safeUrl.optional().describe("Makes the whole card a link to this URL")
|
|
295
244
|
});
|
|
296
245
|
const alertProps = z.object({
|
|
297
246
|
tone: z.enum([
|
|
@@ -420,7 +369,7 @@ const breadcrumbProps = z.object({
|
|
|
420
369
|
"md",
|
|
421
370
|
"lg"
|
|
422
371
|
]).optional(),
|
|
423
|
-
items: z.array(z.
|
|
372
|
+
items: z.array(z.strictObject({
|
|
424
373
|
label: z.string(),
|
|
425
374
|
href: safeUrl.optional(),
|
|
426
375
|
current: z.boolean().optional()
|
|
@@ -428,9 +377,9 @@ const breadcrumbProps = z.object({
|
|
|
428
377
|
});
|
|
429
378
|
const sideNavProps = z.object({
|
|
430
379
|
label: z.string().describe("Accessible name of the navigation"),
|
|
431
|
-
groups: z.array(z.
|
|
380
|
+
groups: z.array(z.strictObject({
|
|
432
381
|
title: z.string(),
|
|
433
|
-
links: z.array(z.
|
|
382
|
+
links: z.array(z.strictObject({
|
|
434
383
|
label: z.string(),
|
|
435
384
|
href: safeUrl,
|
|
436
385
|
current: z.boolean().optional()
|
|
@@ -447,7 +396,7 @@ const paginationProps = z.object({
|
|
|
447
396
|
});
|
|
448
397
|
const stepperProps = z.object({
|
|
449
398
|
label: z.string().describe("Accessible name of the list of steps"),
|
|
450
|
-
steps: z.array(z.
|
|
399
|
+
steps: z.array(z.strictObject({
|
|
451
400
|
label: z.string(),
|
|
452
401
|
description: z.string().optional()
|
|
453
402
|
})).min(1).describe("Steps in order"),
|
|
@@ -456,34 +405,88 @@ const stepperProps = z.object({
|
|
|
456
405
|
});
|
|
457
406
|
const tabsProps = z.object({
|
|
458
407
|
label: z.string().optional().describe("Accessible name of the tab list"),
|
|
459
|
-
tabs: z.array(z.
|
|
408
|
+
tabs: z.array(z.strictObject({
|
|
460
409
|
label: z.string(),
|
|
461
410
|
content: z.string()
|
|
462
411
|
})).min(1).describe("Label and text panel of each tab")
|
|
463
412
|
});
|
|
413
|
+
const fieldLabel = () => z.string().describe("Visible label of the field");
|
|
414
|
+
const fieldHelpText = () => z.string().optional().describe("Help text shown under the field");
|
|
464
415
|
const textInputShape = {
|
|
465
416
|
name: z.string(),
|
|
417
|
+
label: fieldLabel(),
|
|
466
418
|
placeholder: z.string().optional(),
|
|
467
419
|
defaultValue: z.string().optional(),
|
|
468
420
|
invalid: z.boolean().optional(),
|
|
469
421
|
disabled: z.boolean().optional(),
|
|
470
422
|
readOnly: z.boolean().optional()
|
|
471
423
|
};
|
|
472
|
-
const
|
|
424
|
+
const DATE_TIME_FORMATS = /* @__PURE__ */ new Map([
|
|
425
|
+
["date", {
|
|
426
|
+
format: "YYYY-MM-DD",
|
|
427
|
+
schema: z.iso.date()
|
|
428
|
+
}],
|
|
429
|
+
["time", {
|
|
430
|
+
format: "HH:MM or HH:MM:SS",
|
|
431
|
+
schema: z.iso.time()
|
|
432
|
+
}],
|
|
433
|
+
["datetime-local", {
|
|
434
|
+
format: "YYYY-MM-DDTHH:MM or YYYY-MM-DDTHH:MM:SS",
|
|
435
|
+
schema: z.iso.datetime({ local: true })
|
|
436
|
+
}],
|
|
437
|
+
["month", {
|
|
438
|
+
format: "YYYY-MM",
|
|
439
|
+
schema: z.string().regex(/^\d{4}-(?:0[1-9]|1[0-2])$/u)
|
|
440
|
+
}],
|
|
441
|
+
["week", {
|
|
442
|
+
format: "YYYY-Www",
|
|
443
|
+
schema: z.string().regex(/^\d{4}-W(?:0[1-9]|[1-4]\d|5[0-3])$/u)
|
|
444
|
+
}]
|
|
445
|
+
]);
|
|
446
|
+
const defaultValueFitsType = (props, ctx) => {
|
|
447
|
+
const { type, defaultValue } = props;
|
|
448
|
+
if (typeof type !== "string" || typeof defaultValue !== "string") return;
|
|
449
|
+
const kind = DATE_TIME_FORMATS.get(type);
|
|
450
|
+
if (kind !== void 0 && !kind.schema.safeParse(defaultValue).success) ctx.addIssue({
|
|
451
|
+
code: "custom",
|
|
452
|
+
path: ["defaultValue"],
|
|
453
|
+
message: `Expected ${kind.format} for type "${type}", received "${defaultValue}"`
|
|
454
|
+
});
|
|
455
|
+
};
|
|
456
|
+
const textFieldProps = z.object({
|
|
457
|
+
...textInputShape,
|
|
458
|
+
type: z.enum([
|
|
459
|
+
"text",
|
|
460
|
+
"email",
|
|
461
|
+
"tel",
|
|
462
|
+
"url",
|
|
463
|
+
"search",
|
|
464
|
+
"date",
|
|
465
|
+
"time",
|
|
466
|
+
"datetime-local",
|
|
467
|
+
"month",
|
|
468
|
+
"week"
|
|
469
|
+
]).optional().describe("Kind of value the field takes (text when omitted); a date or time kind holds the input format, such as YYYY-MM-DD for date"),
|
|
470
|
+
helpText: fieldHelpText()
|
|
471
|
+
}).superRefine(defaultValueFitsType, { when: whenParsed("type", "defaultValue") });
|
|
473
472
|
const textareaProps = z.object({
|
|
474
473
|
...textInputShape,
|
|
475
474
|
rows: z.int().min(1).max(40).optional().describe("Number of rows shown at first"),
|
|
476
|
-
autoResize: z.boolean().optional().describe("Grow the height to fit the text")
|
|
475
|
+
autoResize: z.boolean().optional().describe("Grow the height to fit the text"),
|
|
476
|
+
helpText: fieldHelpText()
|
|
477
477
|
});
|
|
478
478
|
const passwordInputProps = z.object({
|
|
479
479
|
name: z.string(),
|
|
480
|
+
label: fieldLabel(),
|
|
480
481
|
placeholder: z.string().optional(),
|
|
481
482
|
defaultValue: z.string().optional(),
|
|
482
483
|
invalid: z.boolean().optional(),
|
|
483
|
-
disabled: z.boolean().optional()
|
|
484
|
+
disabled: z.boolean().optional(),
|
|
485
|
+
helpText: fieldHelpText()
|
|
484
486
|
});
|
|
485
487
|
const numericInputShape = {
|
|
486
488
|
name: z.string(),
|
|
489
|
+
label: fieldLabel(),
|
|
487
490
|
defaultValue: z.number().optional(),
|
|
488
491
|
min: z.number().optional(),
|
|
489
492
|
max: z.number().optional(),
|
|
@@ -491,25 +494,28 @@ const numericInputShape = {
|
|
|
491
494
|
invalid: z.boolean().optional(),
|
|
492
495
|
disabled: z.boolean().optional()
|
|
493
496
|
};
|
|
494
|
-
const numberFieldProps = z.object({
|
|
497
|
+
const numberFieldProps = z.object({
|
|
498
|
+
...numericInputShape,
|
|
499
|
+
helpText: fieldHelpText()
|
|
500
|
+
});
|
|
495
501
|
const sliderProps = z.object({
|
|
496
502
|
...numericInputShape,
|
|
497
503
|
min: z.number().optional().describe("Lower bound (0 when omitted)"),
|
|
498
|
-
max: z.number().optional().describe("Upper bound (100 when omitted)")
|
|
504
|
+
max: z.number().optional().describe("Upper bound (100 when omitted)"),
|
|
505
|
+
helpText: fieldHelpText()
|
|
499
506
|
});
|
|
500
507
|
const isoDate = () => z.iso.date();
|
|
501
|
-
const
|
|
508
|
+
const datePickerProps = z.object({
|
|
502
509
|
name: z.string(),
|
|
503
|
-
label:
|
|
510
|
+
label: fieldLabel(),
|
|
504
511
|
defaultValue: isoDate().optional().describe("YYYY-MM-DD"),
|
|
505
512
|
min: isoDate().optional().describe("Earliest date that can be entered"),
|
|
506
513
|
max: isoDate().optional().describe("Latest date that can be entered"),
|
|
507
514
|
invalid: z.boolean().optional(),
|
|
508
515
|
disabled: z.boolean().optional(),
|
|
509
|
-
required: z.boolean().optional()
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
const datePickerProps = z.object({ ...dateInputShape });
|
|
516
|
+
required: z.boolean().optional(),
|
|
517
|
+
helpText: fieldHelpText()
|
|
518
|
+
});
|
|
513
519
|
const calendarProps = z.object({
|
|
514
520
|
name: z.string().describe("State key the picked date is stored under"),
|
|
515
521
|
defaultValue: isoDate().optional().describe("YYYY-MM-DD"),
|
|
@@ -518,32 +524,35 @@ const calendarProps = z.object({
|
|
|
518
524
|
});
|
|
519
525
|
const rangeSliderProps = z.object({
|
|
520
526
|
name: z.string().describe("Both thumbs submit under this name, lower value first"),
|
|
521
|
-
label:
|
|
527
|
+
label: fieldLabel(),
|
|
522
528
|
defaultValue: z.tuple([z.number(), z.number()]).optional().describe("[lower, upper]; the whole range when omitted"),
|
|
523
529
|
min: z.number().optional().describe("Lower bound (0 when omitted)"),
|
|
524
530
|
max: z.number().optional().describe("Upper bound (100 when omitted)"),
|
|
525
531
|
step: z.number().optional(),
|
|
526
532
|
invalid: z.boolean().optional(),
|
|
527
|
-
disabled: z.boolean().optional()
|
|
533
|
+
disabled: z.boolean().optional(),
|
|
534
|
+
helpText: fieldHelpText()
|
|
528
535
|
});
|
|
529
536
|
const hexColor = () => z.string().regex(/^#[0-9a-fA-F]{6}$/u);
|
|
530
537
|
const colorPickerProps = z.object({
|
|
531
538
|
name: z.string(),
|
|
532
|
-
label:
|
|
539
|
+
label: fieldLabel(),
|
|
533
540
|
defaultValue: hexColor().optional().describe("#rrggbb"),
|
|
534
|
-
swatches: z.array(z.
|
|
541
|
+
swatches: z.array(z.strictObject({
|
|
535
542
|
value: hexColor().describe("#rrggbb"),
|
|
536
543
|
label: z.string().describe("Name of the color, read out for the swatch")
|
|
537
544
|
})).optional().describe("Preset colors offered as buttons"),
|
|
538
545
|
invalid: z.boolean().optional(),
|
|
539
546
|
disabled: z.boolean().optional(),
|
|
540
|
-
required: z.boolean().optional()
|
|
547
|
+
required: z.boolean().optional(),
|
|
548
|
+
helpText: fieldHelpText()
|
|
541
549
|
});
|
|
542
550
|
const checkboxProps = z.object({
|
|
543
551
|
name: z.string(),
|
|
544
552
|
label: z.string(),
|
|
545
553
|
defaultChecked: z.boolean().optional(),
|
|
546
|
-
disabled: z.boolean().optional()
|
|
554
|
+
disabled: z.boolean().optional(),
|
|
555
|
+
helpText: fieldHelpText()
|
|
547
556
|
});
|
|
548
557
|
const switchProps = z.object({
|
|
549
558
|
name: z.string(),
|
|
@@ -551,9 +560,10 @@ const switchProps = z.object({
|
|
|
551
560
|
defaultChecked: z.boolean().optional(),
|
|
552
561
|
disabled: z.boolean().optional(),
|
|
553
562
|
invalid: z.boolean().optional(),
|
|
554
|
-
required: z.boolean().optional()
|
|
563
|
+
required: z.boolean().optional(),
|
|
564
|
+
helpText: fieldHelpText()
|
|
555
565
|
});
|
|
556
|
-
const selectOption = z.
|
|
566
|
+
const selectOption = z.strictObject({
|
|
557
567
|
value: z.string(),
|
|
558
568
|
label: z.string()
|
|
559
569
|
});
|
|
@@ -561,101 +571,100 @@ const radioCardOption = selectOption.extend({
|
|
|
561
571
|
description: z.string().optional(),
|
|
562
572
|
disabled: z.boolean().optional()
|
|
563
573
|
});
|
|
574
|
+
const defaultValueIsOption = (props, ctx) => {
|
|
575
|
+
const { options, defaultValue } = props;
|
|
576
|
+
if (!Array.isArray(options)) return;
|
|
577
|
+
const values = options.flatMap((option) => typeof option === "object" && option !== null && "value" in option && typeof option.value === "string" ? [option.value] : []);
|
|
578
|
+
const chosen = Array.isArray(defaultValue) ? defaultValue.map((value, index) => [["defaultValue", index], value]) : [[["defaultValue"], defaultValue]];
|
|
579
|
+
for (const [path, value] of chosen) if (typeof value === "string" && !values.includes(value)) ctx.addIssue({
|
|
580
|
+
code: "custom",
|
|
581
|
+
path,
|
|
582
|
+
message: `Expected the value of an option (${values.map((v) => `"${v}"`).join(" | ")}), received "${value}"`
|
|
583
|
+
});
|
|
584
|
+
};
|
|
585
|
+
const whenOptionsParsed = { when: whenParsed("options", "defaultValue") };
|
|
564
586
|
const selectProps = z.object({
|
|
565
587
|
name: z.string(),
|
|
588
|
+
label: fieldLabel(),
|
|
566
589
|
options: z.array(selectOption).min(1).describe("Choices (value / label)"),
|
|
567
590
|
defaultValue: z.string().optional(),
|
|
568
591
|
invalid: z.boolean().optional(),
|
|
569
|
-
disabled: z.boolean().optional()
|
|
570
|
-
|
|
592
|
+
disabled: z.boolean().optional(),
|
|
593
|
+
helpText: fieldHelpText()
|
|
594
|
+
}).superRefine(defaultValueIsOption, whenOptionsParsed);
|
|
571
595
|
const radioProps = z.object({
|
|
572
596
|
name: z.string(),
|
|
573
|
-
label:
|
|
597
|
+
label: fieldLabel(),
|
|
574
598
|
options: z.array(selectOption).min(1),
|
|
575
599
|
defaultValue: z.string().optional(),
|
|
576
|
-
disabled: z.boolean().optional()
|
|
577
|
-
|
|
600
|
+
disabled: z.boolean().optional(),
|
|
601
|
+
helpText: fieldHelpText()
|
|
602
|
+
}).superRefine(defaultValueIsOption, whenOptionsParsed);
|
|
578
603
|
const radioCardProps = z.object({
|
|
579
604
|
name: z.string(),
|
|
580
|
-
label:
|
|
605
|
+
label: fieldLabel(),
|
|
581
606
|
options: z.array(radioCardOption).min(1),
|
|
582
607
|
defaultValue: z.string().optional(),
|
|
583
608
|
invalid: z.boolean().optional(),
|
|
584
|
-
disabled: z.boolean().optional()
|
|
585
|
-
|
|
609
|
+
disabled: z.boolean().optional(),
|
|
610
|
+
helpText: fieldHelpText()
|
|
611
|
+
}).superRefine(defaultValueIsOption, whenOptionsParsed);
|
|
586
612
|
const checkboxCardProps = z.object({
|
|
587
613
|
name: z.string(),
|
|
614
|
+
label: fieldLabel(),
|
|
588
615
|
options: z.array(radioCardOption).min(1),
|
|
589
616
|
defaultValue: z.array(z.string()).optional(),
|
|
590
617
|
invalid: z.boolean().optional(),
|
|
591
618
|
disabled: z.boolean().optional(),
|
|
592
|
-
|
|
593
|
-
});
|
|
619
|
+
helpText: fieldHelpText()
|
|
620
|
+
}).superRefine(defaultValueIsOption, whenOptionsParsed);
|
|
594
621
|
const listBoxProps = z.object({
|
|
595
|
-
name: z.string(),
|
|
622
|
+
name: z.string().describe("State key the chosen value is stored under"),
|
|
623
|
+
label: z.string().describe("Name of the button that opens the list, read out before the chosen option"),
|
|
596
624
|
options: z.array(selectOption).min(1),
|
|
597
|
-
defaultValue: z.string().optional()
|
|
598
|
-
|
|
599
|
-
});
|
|
625
|
+
defaultValue: z.string().optional()
|
|
626
|
+
}).superRefine(defaultValueIsOption, whenOptionsParsed);
|
|
600
627
|
const checkboxGroupProps = z.object({
|
|
601
628
|
name: z.string(),
|
|
629
|
+
label: fieldLabel(),
|
|
602
630
|
options: z.array(selectOption).min(1),
|
|
603
631
|
defaultValue: z.array(z.string()).optional(),
|
|
604
|
-
|
|
605
|
-
});
|
|
632
|
+
helpText: fieldHelpText()
|
|
633
|
+
}).superRefine(defaultValueIsOption, whenOptionsParsed);
|
|
606
634
|
const autocompleteProps = z.object({
|
|
607
635
|
name: z.string(),
|
|
636
|
+
label: fieldLabel(),
|
|
608
637
|
options: z.array(selectOption).min(1),
|
|
609
638
|
defaultValue: z.array(z.string()).optional(),
|
|
610
639
|
invalid: z.boolean().optional(),
|
|
611
|
-
disabled: z.boolean().optional()
|
|
640
|
+
disabled: z.boolean().optional(),
|
|
641
|
+
helpText: fieldHelpText()
|
|
612
642
|
});
|
|
613
643
|
const comboboxProps = z.object({
|
|
614
644
|
name: z.string(),
|
|
615
|
-
label:
|
|
645
|
+
label: fieldLabel(),
|
|
616
646
|
options: z.array(selectOption).min(1).describe("Choices (value / label); typing filters them by label"),
|
|
617
647
|
defaultValue: z.string().optional().describe("value of the chosen option"),
|
|
618
648
|
placeholder: z.string().optional(),
|
|
619
649
|
invalid: z.boolean().optional(),
|
|
620
650
|
disabled: z.boolean().optional(),
|
|
621
|
-
required: z.boolean().optional()
|
|
651
|
+
required: z.boolean().optional(),
|
|
652
|
+
helpText: fieldHelpText()
|
|
622
653
|
});
|
|
623
654
|
const fileFieldProps = z.object({
|
|
655
|
+
label: fieldLabel(),
|
|
624
656
|
triggerLabel: z.string().optional().describe("Text of the file picker button (the built-in wording when omitted)"),
|
|
625
657
|
multiple: z.boolean().optional(),
|
|
626
658
|
maxFiles: z.number().optional(),
|
|
627
659
|
clearable: z.boolean().optional(),
|
|
628
|
-
dropzone: z.boolean().optional().describe("Show an area files can be dropped onto, with the button in it")
|
|
629
|
-
|
|
630
|
-
const formControlProps = z.object({
|
|
631
|
-
label: z.string(),
|
|
632
|
-
fieldType: z.enum([
|
|
633
|
-
"text",
|
|
634
|
-
"textarea",
|
|
635
|
-
"password"
|
|
636
|
-
]).optional(),
|
|
637
|
-
name: z.string(),
|
|
638
|
-
placeholder: z.string().optional(),
|
|
639
|
-
defaultValue: z.string().optional(),
|
|
640
|
-
helpText: z.string().optional(),
|
|
641
|
-
errorText: z.string().optional(),
|
|
642
|
-
required: z.boolean().optional(),
|
|
643
|
-
invalid: z.boolean().optional()
|
|
644
|
-
});
|
|
645
|
-
const formProps = z.object({ action: safeUrl.optional().describe("URL the form submits to (optional)") });
|
|
646
|
-
const modalProps = z.object({
|
|
647
|
-
triggerLabel: z.string().describe("Text of the button that opens the modal"),
|
|
648
|
-
title: z.string(),
|
|
649
|
-
side: z.enum([
|
|
650
|
-
"center",
|
|
651
|
-
"bottom",
|
|
652
|
-
"right",
|
|
653
|
-
"left"
|
|
654
|
-
]).optional()
|
|
660
|
+
dropzone: z.boolean().optional().describe("Show an area files can be dropped onto, with the button in it"),
|
|
661
|
+
helpText: fieldHelpText()
|
|
655
662
|
});
|
|
663
|
+
const formProps = z.object({});
|
|
656
664
|
const dialogProps = z.object({
|
|
657
665
|
triggerLabel: z.string().describe("Text of the button that opens the dialog"),
|
|
658
|
-
title: z.string()
|
|
666
|
+
title: z.string(),
|
|
667
|
+
side: z.enum(["center", "bottom"]).optional()
|
|
659
668
|
});
|
|
660
669
|
const drawerProps = z.object({
|
|
661
670
|
triggerLabel: z.string().describe("Text of the button that opens the drawer"),
|
|
@@ -669,14 +678,12 @@ const tooltipProps = z.object({
|
|
|
669
678
|
});
|
|
670
679
|
const toolbarProps = z.object({
|
|
671
680
|
label: z.string().describe("Accessible name of the toolbar"),
|
|
672
|
-
items: z.array(z.
|
|
681
|
+
items: z.array(z.strictObject({
|
|
673
682
|
label: z.string(),
|
|
674
683
|
icon: iconName.optional().describe("Show only this icon; label becomes its accessible name")
|
|
675
684
|
})).min(1).describe("Buttons in the toolbar, in order"),
|
|
676
685
|
orientation: z.enum(["horizontal", "vertical"]).optional()
|
|
677
686
|
});
|
|
678
|
-
const dropdownMenuProps = z.object({
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
});
|
|
682
|
-
export { accordionProps, alertProps, anchorProps, autocompleteProps, avatarProps, badgeProps, breadcrumbProps, buttonProps, calendarProps, calloutProps, cardProps, carouselProps, checkboxCardProps, checkboxGroupProps, checkboxProps, chevronIconProps, codeProps, colorPickerProps, comboboxProps, copyButtonProps, dataTableProps, dateFieldProps, datePickerProps, dialogProps, drawerProps, dropdownMenuProps, emptyStateProps, fileFieldProps, formControlProps, formProps, gridProps, headingProps, iconButtonProps, iconName, iconProps, kbdProps, listBoxProps, modalProps, numberFieldProps, paginationProps, passwordInputProps, popoverProps, progressProps, radioCardProps, radioProps, rangeSliderProps, selectProps, separatorProps, sideNavProps, skeletonProps, sliderProps, spinnerProps, stackProps, statusIconProps, stepperProps, switchProps, tableProps, tabsProps, textFieldProps, textareaProps, toastProps, toolbarProps, tooltipProps, treeProps };
|
|
687
|
+
const dropdownMenuProps = z.object({ triggerLabel: z.string() });
|
|
688
|
+
const dropdownMenuItemProps = z.object({ label: z.string() });
|
|
689
|
+
export { 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, iconName, 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 };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/catalog/to-tree.ts
|
|
2
|
+
const toTree = (items) => {
|
|
3
|
+
const ids = new Set(items.map((item) => item.id));
|
|
4
|
+
const build = (parentId) => items.filter((item) => parentId === void 0 ? item.parentId === void 0 || !ids.has(item.parentId) : item.parentId === parentId).map((item) => {
|
|
5
|
+
const children = build(item.id);
|
|
6
|
+
return children.length > 0 ? {
|
|
7
|
+
id: item.id,
|
|
8
|
+
label: item.label,
|
|
9
|
+
children
|
|
10
|
+
} : {
|
|
11
|
+
id: item.id,
|
|
12
|
+
label: item.label
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
return build(void 0);
|
|
16
|
+
};
|
|
17
|
+
export { toTree };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const checkedValuesAround: (box: HTMLInputElement) => string[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// src/components/_internal/checked-values.ts
|
|
2
|
+
const checkedValuesAround = (box) => {
|
|
3
|
+
return [...box.closest("fieldset")?.querySelectorAll("input[type=\"checkbox\"]") ?? []].filter((input) => input.checked).map((input) => input.value);
|
|
4
|
+
};
|
|
5
|
+
export { checkedValuesAround };
|