@adia-ai/web-components 0.0.1
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 +195 -0
- package/a2ui/dockables/action.js +152 -0
- package/a2ui/dockables/base.js +30 -0
- package/a2ui/dockables/controller.js +97 -0
- package/a2ui/dockables/data-source.js +103 -0
- package/a2ui/dockables/index.js +6 -0
- package/a2ui/dockables/lifecycle.js +84 -0
- package/a2ui/dockables/provider.js +59 -0
- package/a2ui/index.js +19 -0
- package/a2ui/manifest-runtime.js +226 -0
- package/a2ui/registry.js +200 -0
- package/a2ui/renderer.js +361 -0
- package/a2ui/root.js +152 -0
- package/a2ui/stream.js +243 -0
- package/a2ui/surface-manifest.js +294 -0
- package/a2ui/surface.js +222 -0
- package/a2ui/wire-factory.js +134 -0
- package/a2ui/wiring-engine.js +209 -0
- package/a2ui/wiring-registry.js +342 -0
- package/components/accordion/accordion.a2ui.json +129 -0
- package/components/accordion/accordion.css +133 -0
- package/components/accordion/accordion.js +125 -0
- package/components/accordion/accordion.yaml +527 -0
- package/components/action-list/action-list.a2ui.json +64 -0
- package/components/action-list/action-list.css +115 -0
- package/components/action-list/action-list.js +149 -0
- package/components/action-list/action-list.yaml +56 -0
- package/components/agent-artifact/agent-artifact.a2ui.json +99 -0
- package/components/agent-artifact/agent-artifact.css +94 -0
- package/components/agent-artifact/agent-artifact.js +169 -0
- package/components/agent-artifact/agent-artifact.yaml +71 -0
- package/components/agent-feedback-bar/agent-feedback-bar.a2ui.json +91 -0
- package/components/agent-feedback-bar/agent-feedback-bar.css +33 -0
- package/components/agent-feedback-bar/agent-feedback-bar.js +152 -0
- package/components/agent-feedback-bar/agent-feedback-bar.yaml +65 -0
- package/components/agent-questions/agent-questions.a2ui.json +89 -0
- package/components/agent-questions/agent-questions.css +146 -0
- package/components/agent-questions/agent-questions.js +189 -0
- package/components/agent-questions/agent-questions.yaml +63 -0
- package/components/agent-reasoning/agent-reasoning.a2ui.json +100 -0
- package/components/agent-reasoning/agent-reasoning.css +273 -0
- package/components/agent-reasoning/agent-reasoning.js +469 -0
- package/components/agent-reasoning/agent-reasoning.yaml +70 -0
- package/components/agent-suggestions/agent-suggestions.a2ui.json +87 -0
- package/components/agent-suggestions/agent-suggestions.css +18 -0
- package/components/agent-suggestions/agent-suggestions.js +87 -0
- package/components/agent-suggestions/agent-suggestions.yaml +59 -0
- package/components/agent-trace/agent-trace.a2ui.json +78 -0
- package/components/agent-trace/agent-trace.css +275 -0
- package/components/agent-trace/agent-trace.js +216 -0
- package/components/agent-trace/agent-trace.yaml +53 -0
- package/components/alert/alert.a2ui.json +211 -0
- package/components/alert/alert.css +88 -0
- package/components/alert/alert.js +96 -0
- package/components/alert/alert.yaml +205 -0
- package/components/avatar/avatar.a2ui.json +215 -0
- package/components/avatar/avatar.css +159 -0
- package/components/avatar/avatar.js +157 -0
- package/components/avatar/avatar.yaml +559 -0
- package/components/badge/badge.a2ui.json +169 -0
- package/components/badge/badge.css +78 -0
- package/components/badge/badge.js +53 -0
- package/components/badge/badge.yaml +612 -0
- package/components/block/block.a2ui.json +135 -0
- package/components/block/block.css +29 -0
- package/components/block/block.js +23 -0
- package/components/block/block.yaml +115 -0
- package/components/breadcrumb/breadcrumb.a2ui.json +86 -0
- package/components/breadcrumb/breadcrumb.css +78 -0
- package/components/breadcrumb/breadcrumb.js +44 -0
- package/components/breadcrumb/breadcrumb.yaml +84 -0
- package/components/button/button.a2ui.json +172 -0
- package/components/button/button.css +168 -0
- package/components/button/button.js +60 -0
- package/components/button/button.yaml +120 -0
- package/components/calendar-picker/calendar-picker.a2ui.json +139 -0
- package/components/calendar-picker/calendar-picker.css +321 -0
- package/components/calendar-picker/calendar-picker.js +324 -0
- package/components/calendar-picker/calendar-picker.yaml +243 -0
- package/components/canvas/canvas.a2ui.json +75 -0
- package/components/canvas/canvas.css +52 -0
- package/components/canvas/canvas.js +179 -0
- package/components/canvas/canvas.yaml +62 -0
- package/components/card/card.a2ui.json +276 -0
- package/components/card/card.css +362 -0
- package/components/card/card.js +58 -0
- package/components/card/card.yaml +527 -0
- package/components/chart/chart.a2ui.json +298 -0
- package/components/chart/chart.css +512 -0
- package/components/chart/chart.js +1075 -0
- package/components/chart/chart.yaml +540 -0
- package/components/chat/chat-input.css +141 -0
- package/components/chat/chat-input.js +242 -0
- package/components/chat/chat.a2ui.json +181 -0
- package/components/chat/chat.css +193 -0
- package/components/chat/chat.js +155 -0
- package/components/chat/chat.yaml +230 -0
- package/components/check/check.a2ui.json +134 -0
- package/components/check/check.css +126 -0
- package/components/check/check.js +58 -0
- package/components/check/check.yaml +109 -0
- package/components/code/code.a2ui.json +153 -0
- package/components/code/code.css +133 -0
- package/components/code/code.js +114 -0
- package/components/code/code.yaml +163 -0
- package/components/col/col.a2ui.json +104 -0
- package/components/col/col.css +36 -0
- package/components/col/col.js +19 -0
- package/components/col/col.yaml +364 -0
- package/components/color-picker/color-picker.a2ui.json +100 -0
- package/components/color-picker/color-picker.css +182 -0
- package/components/color-picker/color-picker.js +537 -0
- package/components/color-picker/color-picker.yaml +105 -0
- package/components/command/command.a2ui.json +221 -0
- package/components/command/command.css +251 -0
- package/components/command/command.js +284 -0
- package/components/command/command.yaml +186 -0
- package/components/description-list/description-list.a2ui.json +89 -0
- package/components/description-list/description-list.css +70 -0
- package/components/description-list/description-list.js +75 -0
- package/components/description-list/description-list.yaml +59 -0
- package/components/divider/divider.a2ui.json +126 -0
- package/components/divider/divider.css +102 -0
- package/components/divider/divider.js +47 -0
- package/components/divider/divider.yaml +366 -0
- package/components/drawer/drawer.a2ui.json +199 -0
- package/components/drawer/drawer.css +342 -0
- package/components/drawer/drawer.js +263 -0
- package/components/drawer/drawer.yaml +366 -0
- package/components/embed/embed.a2ui.json +150 -0
- package/components/embed/embed.css +28 -0
- package/components/embed/embed.js +63 -0
- package/components/embed/embed.yaml +224 -0
- package/components/empty-state/empty-state.a2ui.json +133 -0
- package/components/empty-state/empty-state.css +58 -0
- package/components/empty-state/empty-state.js +87 -0
- package/components/empty-state/empty-state.yaml +314 -0
- package/components/footer/footer.a2ui.json +79 -0
- package/components/footer/footer.yaml +239 -0
- package/components/grid/grid.a2ui.json +171 -0
- package/components/grid/grid.css +37 -0
- package/components/grid/grid.js +21 -0
- package/components/grid/grid.yaml +577 -0
- package/components/header/header.a2ui.json +76 -0
- package/components/header/header.yaml +336 -0
- package/components/heatmap/heatmap.a2ui.json +150 -0
- package/components/heatmap/heatmap.css +146 -0
- package/components/heatmap/heatmap.js +246 -0
- package/components/heatmap/heatmap.yaml +131 -0
- package/components/icon/icon.a2ui.json +79 -0
- package/components/icon/icon.css +20 -0
- package/components/icon/icon.js +26 -0
- package/components/icon/icon.yaml +233 -0
- package/components/image/image.a2ui.json +261 -0
- package/components/image/image.css +76 -0
- package/components/image/image.js +102 -0
- package/components/image/image.yaml +477 -0
- package/components/index.js +85 -0
- package/components/input/input.a2ui.json +284 -0
- package/components/input/input.css +162 -0
- package/components/input/input.js +148 -0
- package/components/input/input.yaml +496 -0
- package/components/inspector/inspector.a2ui.json +67 -0
- package/components/inspector/inspector.css +31 -0
- package/components/inspector/inspector.js +133 -0
- package/components/inspector/inspector.yaml +58 -0
- package/components/kbd/kbd.a2ui.json +96 -0
- package/components/kbd/kbd.css +62 -0
- package/components/kbd/kbd.js +24 -0
- package/components/kbd/kbd.yaml +213 -0
- package/components/list/list.a2ui.json +145 -0
- package/components/list/list.css +103 -0
- package/components/list/list.js +236 -0
- package/components/list/list.yaml +122 -0
- package/components/menu/menu.a2ui.json +146 -0
- package/components/menu/menu.css +146 -0
- package/components/menu/menu.js +296 -0
- package/components/menu/menu.yaml +123 -0
- package/components/modal/modal.a2ui.json +136 -0
- package/components/modal/modal.css +153 -0
- package/components/modal/modal.js +181 -0
- package/components/modal/modal.yaml +114 -0
- package/components/noodles/noodles.a2ui.json +145 -0
- package/components/noodles/noodles.css +118 -0
- package/components/noodles/noodles.js +470 -0
- package/components/noodles/noodles.yaml +123 -0
- package/components/otp-input/otp-input.a2ui.json +104 -0
- package/components/otp-input/otp-input.css +78 -0
- package/components/otp-input/otp-input.js +170 -0
- package/components/otp-input/otp-input.yaml +218 -0
- package/components/pagination/pagination.a2ui.json +122 -0
- package/components/pagination/pagination.css +162 -0
- package/components/pagination/pagination.js +185 -0
- package/components/pagination/pagination.yaml +165 -0
- package/components/pane/pane.a2ui.json +94 -0
- package/components/pane/pane.css +166 -0
- package/components/pane/pane.js +140 -0
- package/components/pane/pane.yaml +197 -0
- package/components/pipeline-status/pipeline-status.a2ui.json +90 -0
- package/components/pipeline-status/pipeline-status.css +162 -0
- package/components/pipeline-status/pipeline-status.js +176 -0
- package/components/pipeline-status/pipeline-status.yaml +99 -0
- package/components/popover/popover.a2ui.json +181 -0
- package/components/popover/popover.css +57 -0
- package/components/popover/popover.js +170 -0
- package/components/popover/popover.yaml +257 -0
- package/components/progress/progress.a2ui.json +199 -0
- package/components/progress/progress.css +88 -0
- package/components/progress/progress.js +64 -0
- package/components/progress/progress.yaml +342 -0
- package/components/progress-row/progress-row.a2ui.json +100 -0
- package/components/progress-row/progress-row.css +57 -0
- package/components/progress-row/progress-row.js +92 -0
- package/components/progress-row/progress-row.yaml +87 -0
- package/components/radio/radio.a2ui.json +232 -0
- package/components/radio/radio.css +102 -0
- package/components/radio/radio.js +73 -0
- package/components/radio/radio.yaml +248 -0
- package/components/range/range.a2ui.json +151 -0
- package/components/range/range.css +148 -0
- package/components/range/range.js +177 -0
- package/components/range/range.yaml +188 -0
- package/components/rating/rating.a2ui.json +105 -0
- package/components/rating/rating.css +92 -0
- package/components/rating/rating.js +138 -0
- package/components/rating/rating.yaml +74 -0
- package/components/richtext/richtext.a2ui.json +82 -0
- package/components/richtext/richtext.css +225 -0
- package/components/richtext/richtext.js +74 -0
- package/components/richtext/richtext.yaml +89 -0
- package/components/row/row.a2ui.json +102 -0
- package/components/row/row.css +51 -0
- package/components/row/row.js +39 -0
- package/components/row/row.yaml +358 -0
- package/components/search/search.a2ui.json +186 -0
- package/components/search/search.css +28 -0
- package/components/search/search.js +124 -0
- package/components/search/search.yaml +154 -0
- package/components/section/section.a2ui.json +78 -0
- package/components/section/section.yaml +338 -0
- package/components/segment/segment.a2ui.json +100 -0
- package/components/segment/segment.css +81 -0
- package/components/segment/segment.js +32 -0
- package/components/segment/segment.yaml +216 -0
- package/components/segmented/segmented.a2ui.json +106 -0
- package/components/segmented/segmented.css +67 -0
- package/components/segmented/segmented.js +149 -0
- package/components/segmented/segmented.yaml +91 -0
- package/components/select/select.a2ui.json +203 -0
- package/components/select/select.css +277 -0
- package/components/select/select.js +388 -0
- package/components/select/select.yaml +375 -0
- package/components/skeleton/skeleton.a2ui.json +120 -0
- package/components/skeleton/skeleton.css +47 -0
- package/components/skeleton/skeleton.js +43 -0
- package/components/skeleton/skeleton.yaml +153 -0
- package/components/slider/slider.a2ui.json +162 -0
- package/components/slider/slider.css +137 -0
- package/components/slider/slider.js +162 -0
- package/components/slider/slider.yaml +299 -0
- package/components/stack/stack.a2ui.json +62 -0
- package/components/stack/stack.css +28 -0
- package/components/stack/stack.js +18 -0
- package/components/stack/stack.yaml +54 -0
- package/components/stat/stat.a2ui.json +246 -0
- package/components/stat/stat.css +101 -0
- package/components/stat/stat.js +91 -0
- package/components/stat/stat.yaml +206 -0
- package/components/stepper/stepper.a2ui.json +77 -0
- package/components/stepper/stepper.css +243 -0
- package/components/stepper/stepper.js +118 -0
- package/components/stepper/stepper.yaml +73 -0
- package/components/stream/stream.a2ui.json +98 -0
- package/components/stream/stream.css +37 -0
- package/components/stream/stream.js +99 -0
- package/components/stream/stream.yaml +87 -0
- package/components/swiper/swiper.a2ui.json +140 -0
- package/components/swiper/swiper.css +267 -0
- package/components/swiper/swiper.js +285 -0
- package/components/swiper/swiper.yaml +268 -0
- package/components/switch/switch.a2ui.json +134 -0
- package/components/switch/switch.css +104 -0
- package/components/switch/switch.js +53 -0
- package/components/switch/switch.yaml +322 -0
- package/components/table/cell-types.js +296 -0
- package/components/table/table.a2ui.json +458 -0
- package/components/table/table.css +531 -0
- package/components/table/table.js +1392 -0
- package/components/table/table.yaml +528 -0
- package/components/tabs/tab.js +34 -0
- package/components/tabs/tabs.a2ui.json +174 -0
- package/components/tabs/tabs.css +162 -0
- package/components/tabs/tabs.js +226 -0
- package/components/tabs/tabs.yaml +255 -0
- package/components/tag/tag.a2ui.json +148 -0
- package/components/tag/tag.css +118 -0
- package/components/tag/tag.js +88 -0
- package/components/tag/tag.yaml +125 -0
- package/components/text/text.a2ui.json +99 -0
- package/components/text/text.css +65 -0
- package/components/text/text.js +35 -0
- package/components/text/text.yaml +360 -0
- package/components/textarea/textarea.a2ui.json +91 -0
- package/components/textarea/textarea.css +93 -0
- package/components/textarea/textarea.js +114 -0
- package/components/textarea/textarea.yaml +79 -0
- package/components/timeline/timeline.a2ui.json +82 -0
- package/components/timeline/timeline.css +389 -0
- package/components/timeline/timeline.js +171 -0
- package/components/timeline/timeline.yaml +185 -0
- package/components/toast/toast.a2ui.json +199 -0
- package/components/toast/toast.css +211 -0
- package/components/toast/toast.js +146 -0
- package/components/toast/toast.yaml +184 -0
- package/components/toggle-group/toggle-group.a2ui.json +126 -0
- package/components/toggle-group/toggle-group.css +102 -0
- package/components/toggle-group/toggle-group.js +147 -0
- package/components/toggle-group/toggle-group.yaml +98 -0
- package/components/toolbar/toolbar.a2ui.json +131 -0
- package/components/toolbar/toolbar.css +132 -0
- package/components/toolbar/toolbar.js +366 -0
- package/components/toolbar/toolbar.yaml +238 -0
- package/components/tooltip/tooltip.a2ui.json +148 -0
- package/components/tooltip/tooltip.css +39 -0
- package/components/tooltip/tooltip.js +96 -0
- package/components/tooltip/tooltip.yaml +201 -0
- package/components/tree/tree.a2ui.json +119 -0
- package/components/tree/tree.css +133 -0
- package/components/tree/tree.js +253 -0
- package/components/tree/tree.yaml +92 -0
- package/components/upload/upload.a2ui.json +185 -0
- package/components/upload/upload.css +115 -0
- package/components/upload/upload.js +189 -0
- package/components/upload/upload.yaml +302 -0
- package/core/anchor.js +187 -0
- package/core/controller.js +182 -0
- package/core/element.js +257 -0
- package/core/form.js +217 -0
- package/core/icons.js +180 -0
- package/core/markdown.js +95 -0
- package/core/polyfills.js +23 -0
- package/core/provider.js +262 -0
- package/core/signals.js +113 -0
- package/core/template.js +226 -0
- package/core/transport.js +77 -0
- package/package.json +38 -0
- package/patterns/adia-chat/adia-chat.a2ui.json +149 -0
- package/patterns/adia-chat/adia-chat.css +10 -0
- package/patterns/adia-chat/adia-chat.js +297 -0
- package/patterns/adia-chat/adia-chat.yaml +118 -0
- package/patterns/adia-chat/css/adia-chat.empty.css +12 -0
- package/patterns/adia-chat/css/adia-chat.layout.css +60 -0
- package/patterns/adia-chat/css/adia-chat.markdown.css +74 -0
- package/patterns/adia-chat/css/adia-chat.messages.css +87 -0
- package/patterns/adia-chat/css/adia-chat.streaming.css +30 -0
- package/patterns/adia-chat/css/adia-chat.tokens.css +95 -0
- package/patterns/adia-chat/index.html +93 -0
- package/patterns/adia-editor/adia-editor.a2ui.json +58 -0
- package/patterns/adia-editor/adia-editor.css +6 -0
- package/patterns/adia-editor/adia-editor.js +56 -0
- package/patterns/adia-editor/adia-editor.yaml +36 -0
- package/patterns/adia-editor/css/adia-editor.layout.css +86 -0
- package/patterns/adia-editor/css/adia-editor.tokens.css +28 -0
- package/patterns/adia-editor/index.html +179 -0
- package/patterns/app-nav/app-nav.a2ui.json +89 -0
- package/patterns/app-nav/app-nav.css +92 -0
- package/patterns/app-nav/app-nav.js +99 -0
- package/patterns/app-nav/app-nav.yaml +54 -0
- package/patterns/app-nav-group/app-nav-group.a2ui.json +82 -0
- package/patterns/app-nav-group/app-nav-group.css +261 -0
- package/patterns/app-nav-group/app-nav-group.js +116 -0
- package/patterns/app-nav-group/app-nav-group.yaml +59 -0
- package/patterns/app-nav-item/app-nav-item.a2ui.json +83 -0
- package/patterns/app-nav-item/app-nav-item.css +156 -0
- package/patterns/app-nav-item/app-nav-item.js +42 -0
- package/patterns/app-nav-item/app-nav-item.yaml +62 -0
- package/patterns/app-shell/app-shell.a2ui.json +114 -0
- package/patterns/app-shell/app-shell.css +14 -0
- package/patterns/app-shell/app-shell.js +251 -0
- package/patterns/app-shell/app-shell.yaml +66 -0
- package/patterns/app-shell/css/app-shell.collapsed.css +86 -0
- package/patterns/app-shell/css/app-shell.helpers.css +42 -0
- package/patterns/app-shell/css/app-shell.main.css +58 -0
- package/patterns/app-shell/css/app-shell.shell.css +44 -0
- package/patterns/app-shell/css/app-shell.sidebar.css +116 -0
- package/patterns/app-shell/css/app-shell.templates.css +214 -0
- package/patterns/app-shell/css/app-shell.tokens.css +116 -0
- package/patterns/app-shell/index.html +112 -0
- package/patterns/gen-ui/gen-ui.a2ui.json +72 -0
- package/patterns/gen-ui/gen-ui.css +83 -0
- package/patterns/gen-ui/gen-ui.js +136 -0
- package/patterns/gen-ui/gen-ui.yaml +43 -0
- package/patterns/index.js +10 -0
- package/patterns/section-nav/section-nav.a2ui.json +91 -0
- package/patterns/section-nav/section-nav.css +59 -0
- package/patterns/section-nav/section-nav.js +42 -0
- package/patterns/section-nav/section-nav.yaml +58 -0
- package/patterns/section-nav-group/section-nav-group.a2ui.json +95 -0
- package/patterns/section-nav-group/section-nav-group.css +74 -0
- package/patterns/section-nav-group/section-nav-group.js +84 -0
- package/patterns/section-nav-group/section-nav-group.yaml +66 -0
- package/patterns/section-nav-item/section-nav-item.a2ui.json +97 -0
- package/patterns/section-nav-item/section-nav-item.css +96 -0
- package/patterns/section-nav-item/section-nav-item.js +66 -0
- package/patterns/section-nav-item/section-nav-item.yaml +70 -0
- package/styles/colors/index.css +6 -0
- package/styles/colors/parameters.css +52 -0
- package/styles/colors/primitives-accent.css +89 -0
- package/styles/colors/primitives-brand.css +89 -0
- package/styles/colors/primitives-danger.css +89 -0
- package/styles/colors/primitives-info.css +89 -0
- package/styles/colors/primitives-neutral.css +91 -0
- package/styles/colors/primitives-shared.css +57 -0
- package/styles/colors/primitives-success.css +89 -0
- package/styles/colors/primitives-warning.css +89 -0
- package/styles/colors/primitives.css +17 -0
- package/styles/colors/scrims.css +182 -0
- package/styles/colors/semantics.css +595 -0
- package/styles/colors/surfaces.css +43 -0
- package/styles/fonts.css +99 -0
- package/styles/layouts/admin.css +7 -0
- package/styles/prose.css +186 -0
- package/styles/styles.css +193 -0
- package/styles/themes.css +155 -0
- package/styles/tokens.css +304 -0
- package/styles/typography.css +853 -0
- package/traits/active-state.js +24 -0
- package/traits/anchor-positioning.js +66 -0
- package/traits/attention-pulse.js +30 -0
- package/traits/confetti-burst.js +65 -0
- package/traits/confetti.js +57 -0
- package/traits/count-up.js +42 -0
- package/traits/define.js +76 -0
- package/traits/dirty-state.js +38 -0
- package/traits/drag-ghost.js +38 -0
- package/traits/draggable.js +73 -0
- package/traits/fade-presence.js +52 -0
- package/traits/focus-trap.js +63 -0
- package/traits/focusable.js +38 -0
- package/traits/glow-focus.js +33 -0
- package/traits/gradient-shift.js +32 -0
- package/traits/haptic-feedback.js +28 -0
- package/traits/hotkey.js +62 -0
- package/traits/hoverable.js +26 -0
- package/traits/index.js +55 -0
- package/traits/inertia-drag.js +133 -0
- package/traits/intersection-observer.js +33 -0
- package/traits/keyboard-nav.js +36 -0
- package/traits/magnetic-hover.js +37 -0
- package/traits/noise-texture.js +30 -0
- package/traits/parallax.js +42 -0
- package/traits/portal.js +27 -0
- package/traits/pressable.js +75 -0
- package/traits/resizable.js +100 -0
- package/traits/resize-observer.js +31 -0
- package/traits/ripple.js +53 -0
- package/traits/roving-tabindex.js +67 -0
- package/traits/scale-press.js +43 -0
- package/traits/scroll-lock.js +27 -0
- package/traits/shimmer-loading.js +44 -0
- package/traits/snap-to-grid.js +28 -0
- package/traits/sound-feedback.js +30 -0
- package/traits/spring-animate.js +56 -0
- package/traits/tilt-hover.js +37 -0
- package/traits/tossable.js +178 -0
- package/traits/typeahead.js +63 -0
- package/traits/typewriter.js +35 -0
- package/traits/validation.js +118 -0
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
# Generated by scripts/migrate-yamls-to-v1.mjs — migrated to v1 contract.
|
|
2
|
+
# Edit this file; run `npm run build:components` to regenerate a2ui.json.
|
|
3
|
+
$schema: ../../../../scripts/schemas/component.yaml.schema.json
|
|
4
|
+
name: AdiaSwitch
|
|
5
|
+
tag: switch-ui
|
|
6
|
+
component: Switch
|
|
7
|
+
category: layout
|
|
8
|
+
version: 1
|
|
9
|
+
description: Toggle switch. The host IS the control.
|
|
10
|
+
props:
|
|
11
|
+
name:
|
|
12
|
+
description: Form field name
|
|
13
|
+
type: string
|
|
14
|
+
default: ""
|
|
15
|
+
required:
|
|
16
|
+
description: Marks as required
|
|
17
|
+
type: boolean
|
|
18
|
+
default: false
|
|
19
|
+
reflect: true
|
|
20
|
+
checked:
|
|
21
|
+
description: Whether the toggle is on
|
|
22
|
+
type: boolean
|
|
23
|
+
default: false
|
|
24
|
+
reflect: true
|
|
25
|
+
disabled:
|
|
26
|
+
description: Disables the toggle
|
|
27
|
+
type: boolean
|
|
28
|
+
default: false
|
|
29
|
+
reflect: true
|
|
30
|
+
hint:
|
|
31
|
+
description: Help text below the label
|
|
32
|
+
type: string
|
|
33
|
+
default: ""
|
|
34
|
+
label:
|
|
35
|
+
description: Label text beside the toggle
|
|
36
|
+
type: string
|
|
37
|
+
default: ""
|
|
38
|
+
size:
|
|
39
|
+
description: "Sizing scale (xs/sm/md/lg/xl)."
|
|
40
|
+
type: string
|
|
41
|
+
default: ""
|
|
42
|
+
value:
|
|
43
|
+
description: Form value (submitted as 'on' when checked)
|
|
44
|
+
type: string
|
|
45
|
+
default: ""
|
|
46
|
+
events:
|
|
47
|
+
change:
|
|
48
|
+
description: Fired when checked state changes
|
|
49
|
+
slots:
|
|
50
|
+
hint:
|
|
51
|
+
description: Help text below the label
|
|
52
|
+
label:
|
|
53
|
+
description: Label text beside the toggle
|
|
54
|
+
thumb:
|
|
55
|
+
description: Sliding thumb indicator inside track
|
|
56
|
+
track:
|
|
57
|
+
description: Toggle track container (holds thumb)
|
|
58
|
+
states:
|
|
59
|
+
- name: idle
|
|
60
|
+
description: Default, ready for interaction.
|
|
61
|
+
- name: disabled
|
|
62
|
+
description: Non-interactive; dimmed.
|
|
63
|
+
attribute: disabled
|
|
64
|
+
traits: []
|
|
65
|
+
tokens:
|
|
66
|
+
--toggle-thumb-background:
|
|
67
|
+
description: Thumb color
|
|
68
|
+
--toggle-thumb-size:
|
|
69
|
+
description: Thumb diameter
|
|
70
|
+
--toggle-track-background:
|
|
71
|
+
description: Unchecked track color
|
|
72
|
+
--toggle-track-checked:
|
|
73
|
+
description: Checked track color
|
|
74
|
+
--toggle-track-height:
|
|
75
|
+
description: Track height
|
|
76
|
+
--toggle-track-width:
|
|
77
|
+
description: Track width
|
|
78
|
+
a2ui:
|
|
79
|
+
rules: []
|
|
80
|
+
anti_patterns: []
|
|
81
|
+
examples:
|
|
82
|
+
- name: notification-preferences
|
|
83
|
+
description: Notification preferences card with toggle switches for different notification channels
|
|
84
|
+
and types.
|
|
85
|
+
a2ui: >-
|
|
86
|
+
[
|
|
87
|
+
{
|
|
88
|
+
"id": "root",
|
|
89
|
+
"component": "Card",
|
|
90
|
+
"children": [
|
|
91
|
+
"hdr",
|
|
92
|
+
"sec"
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"id": "hdr",
|
|
97
|
+
"component": "Header",
|
|
98
|
+
"children": [
|
|
99
|
+
"title",
|
|
100
|
+
"desc"
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"id": "title",
|
|
105
|
+
"component": "Text",
|
|
106
|
+
"slot": "heading",
|
|
107
|
+
"variant": "span",
|
|
108
|
+
"textContent": "Notification Preferences"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"id": "desc",
|
|
112
|
+
"component": "Text",
|
|
113
|
+
"slot": "description",
|
|
114
|
+
"textContent": "Choose how you want to be notified"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"id": "sec",
|
|
118
|
+
"component": "Section",
|
|
119
|
+
"children": [
|
|
120
|
+
"list"
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"id": "list",
|
|
125
|
+
"component": "Column",
|
|
126
|
+
"gap": "4",
|
|
127
|
+
"children": [
|
|
128
|
+
"r1",
|
|
129
|
+
"r2",
|
|
130
|
+
"r3",
|
|
131
|
+
"r4",
|
|
132
|
+
"r5"
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"id": "r1",
|
|
137
|
+
"component": "Row",
|
|
138
|
+
"gap": "3",
|
|
139
|
+
"align": "center",
|
|
140
|
+
"children": [
|
|
141
|
+
"info1",
|
|
142
|
+
"sw1"
|
|
143
|
+
]
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"id": "info1",
|
|
147
|
+
"component": "Column",
|
|
148
|
+
"gap": "0",
|
|
149
|
+
"grow": true,
|
|
150
|
+
"children": [
|
|
151
|
+
"label1",
|
|
152
|
+
"hint1"
|
|
153
|
+
]
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"id": "label1",
|
|
157
|
+
"component": "Text",
|
|
158
|
+
"weight": "semibold",
|
|
159
|
+
"textContent": "Email Notifications"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"id": "hint1",
|
|
163
|
+
"component": "Text",
|
|
164
|
+
"color": "muted",
|
|
165
|
+
"textContent": "Receive updates via email"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"id": "sw1",
|
|
169
|
+
"component": "Switch",
|
|
170
|
+
"checked": true
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"id": "r2",
|
|
174
|
+
"component": "Row",
|
|
175
|
+
"gap": "3",
|
|
176
|
+
"align": "center",
|
|
177
|
+
"children": [
|
|
178
|
+
"info2",
|
|
179
|
+
"sw2"
|
|
180
|
+
]
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"id": "info2",
|
|
184
|
+
"component": "Column",
|
|
185
|
+
"gap": "0",
|
|
186
|
+
"grow": true,
|
|
187
|
+
"children": [
|
|
188
|
+
"label2",
|
|
189
|
+
"hint2"
|
|
190
|
+
]
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"id": "label2",
|
|
194
|
+
"component": "Text",
|
|
195
|
+
"weight": "semibold",
|
|
196
|
+
"textContent": "Push Notifications"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"id": "hint2",
|
|
200
|
+
"component": "Text",
|
|
201
|
+
"color": "muted",
|
|
202
|
+
"textContent": "Browser and mobile push alerts"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"id": "sw2",
|
|
206
|
+
"component": "Switch",
|
|
207
|
+
"checked": true
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"id": "r3",
|
|
211
|
+
"component": "Row",
|
|
212
|
+
"gap": "3",
|
|
213
|
+
"align": "center",
|
|
214
|
+
"children": [
|
|
215
|
+
"info3",
|
|
216
|
+
"sw3"
|
|
217
|
+
]
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"id": "info3",
|
|
221
|
+
"component": "Column",
|
|
222
|
+
"gap": "0",
|
|
223
|
+
"grow": true,
|
|
224
|
+
"children": [
|
|
225
|
+
"label3",
|
|
226
|
+
"hint3"
|
|
227
|
+
]
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"id": "label3",
|
|
231
|
+
"component": "Text",
|
|
232
|
+
"weight": "semibold",
|
|
233
|
+
"textContent": "Marketing Emails"
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"id": "hint3",
|
|
237
|
+
"component": "Text",
|
|
238
|
+
"color": "muted",
|
|
239
|
+
"textContent": "Product updates and announcements"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"id": "sw3",
|
|
243
|
+
"component": "Switch"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"id": "r4",
|
|
247
|
+
"component": "Row",
|
|
248
|
+
"gap": "3",
|
|
249
|
+
"align": "center",
|
|
250
|
+
"children": [
|
|
251
|
+
"info4",
|
|
252
|
+
"sw4"
|
|
253
|
+
]
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"id": "info4",
|
|
257
|
+
"component": "Column",
|
|
258
|
+
"gap": "0",
|
|
259
|
+
"grow": true,
|
|
260
|
+
"children": [
|
|
261
|
+
"label4",
|
|
262
|
+
"hint4"
|
|
263
|
+
]
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
"id": "label4",
|
|
267
|
+
"component": "Text",
|
|
268
|
+
"weight": "semibold",
|
|
269
|
+
"textContent": "Security Alerts"
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"id": "hint4",
|
|
273
|
+
"component": "Text",
|
|
274
|
+
"color": "muted",
|
|
275
|
+
"textContent": "Login attempts and password changes"
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
"id": "sw4",
|
|
279
|
+
"component": "Switch",
|
|
280
|
+
"checked": true
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"id": "r5",
|
|
284
|
+
"component": "Row",
|
|
285
|
+
"gap": "3",
|
|
286
|
+
"align": "center",
|
|
287
|
+
"children": [
|
|
288
|
+
"info5",
|
|
289
|
+
"sw5"
|
|
290
|
+
]
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"id": "info5",
|
|
294
|
+
"component": "Column",
|
|
295
|
+
"gap": "0",
|
|
296
|
+
"grow": true,
|
|
297
|
+
"children": [
|
|
298
|
+
"label5",
|
|
299
|
+
"hint5"
|
|
300
|
+
]
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"id": "label5",
|
|
304
|
+
"component": "Text",
|
|
305
|
+
"weight": "semibold",
|
|
306
|
+
"textContent": "Weekly Digest"
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
"id": "hint5",
|
|
310
|
+
"component": "Text",
|
|
311
|
+
"color": "muted",
|
|
312
|
+
"textContent": "Summary of activity each week"
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
"id": "sw5",
|
|
316
|
+
"component": "Switch"
|
|
317
|
+
}
|
|
318
|
+
]
|
|
319
|
+
keywords:
|
|
320
|
+
- switch
|
|
321
|
+
synonyms: {}
|
|
322
|
+
related: []
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
// cell-types.js - Built-in cell type registry for table-ui
|
|
2
|
+
|
|
3
|
+
const cellTypes = {};
|
|
4
|
+
|
|
5
|
+
function registerCellType(name, config) {
|
|
6
|
+
cellTypes[name] = config;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// Sort functions
|
|
10
|
+
export const sortFns = {
|
|
11
|
+
basic: (a, b) => (a < b ? -1 : a > b ? 1 : 0),
|
|
12
|
+
alphanumeric: (a, b) =>
|
|
13
|
+
String(a ?? '').localeCompare(String(b ?? ''), undefined, {
|
|
14
|
+
numeric: true,
|
|
15
|
+
sensitivity: 'base',
|
|
16
|
+
}),
|
|
17
|
+
numeric: (a, b) => (Number(a) || 0) - (Number(b) || 0),
|
|
18
|
+
datetime: (a, b) =>
|
|
19
|
+
new Date(a || 0).getTime() - new Date(b || 0).getTime(),
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// 1. text (default)
|
|
23
|
+
registerCellType('text', {
|
|
24
|
+
render(value, row, cell) {
|
|
25
|
+
cell.textContent = value ?? '';
|
|
26
|
+
},
|
|
27
|
+
format(value) {
|
|
28
|
+
return String(value ?? '');
|
|
29
|
+
},
|
|
30
|
+
align: 'left',
|
|
31
|
+
sortFn: 'alphanumeric',
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// 2. number
|
|
35
|
+
registerCellType('number', {
|
|
36
|
+
render(value, row, cell) {
|
|
37
|
+
cell.textContent =
|
|
38
|
+
value != null ? new Intl.NumberFormat().format(value) : '';
|
|
39
|
+
},
|
|
40
|
+
format(value) {
|
|
41
|
+
return String(value ?? '');
|
|
42
|
+
},
|
|
43
|
+
align: 'right',
|
|
44
|
+
sortFn: 'numeric',
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// 3. currency
|
|
48
|
+
registerCellType('currency', {
|
|
49
|
+
render(value, row, cell, meta) {
|
|
50
|
+
cell.textContent =
|
|
51
|
+
value != null
|
|
52
|
+
? new Intl.NumberFormat('en-US', {
|
|
53
|
+
style: 'currency',
|
|
54
|
+
currency: meta?.currency || 'USD',
|
|
55
|
+
}).format(value)
|
|
56
|
+
: '';
|
|
57
|
+
},
|
|
58
|
+
format(value, row, meta) {
|
|
59
|
+
return value != null
|
|
60
|
+
? new Intl.NumberFormat('en-US', {
|
|
61
|
+
style: 'currency',
|
|
62
|
+
currency: meta?.currency || 'USD',
|
|
63
|
+
}).format(value)
|
|
64
|
+
: '';
|
|
65
|
+
},
|
|
66
|
+
align: 'right',
|
|
67
|
+
sortFn: 'numeric',
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// 4. percent
|
|
71
|
+
registerCellType('percent', {
|
|
72
|
+
render(value, row, cell) {
|
|
73
|
+
cell.textContent = value != null ? `${value}%` : '';
|
|
74
|
+
},
|
|
75
|
+
format(value) {
|
|
76
|
+
return value != null ? `${value}%` : '';
|
|
77
|
+
},
|
|
78
|
+
align: 'right',
|
|
79
|
+
sortFn: 'numeric',
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// 5. date
|
|
83
|
+
const dateFmtOpts = { year: 'numeric', month: 'short', day: 'numeric' };
|
|
84
|
+
|
|
85
|
+
registerCellType('date', {
|
|
86
|
+
render(value, row, cell) {
|
|
87
|
+
cell.textContent = value
|
|
88
|
+
? new Intl.DateTimeFormat('en-US', dateFmtOpts).format(new Date(value))
|
|
89
|
+
: '';
|
|
90
|
+
},
|
|
91
|
+
format(value) {
|
|
92
|
+
return value
|
|
93
|
+
? new Intl.DateTimeFormat('en-US', dateFmtOpts).format(new Date(value))
|
|
94
|
+
: '';
|
|
95
|
+
},
|
|
96
|
+
align: 'left',
|
|
97
|
+
sortFn: 'datetime',
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// 6. datetime
|
|
101
|
+
const datetimeFmtOpts = {
|
|
102
|
+
year: 'numeric',
|
|
103
|
+
month: 'short',
|
|
104
|
+
day: 'numeric',
|
|
105
|
+
hour: 'numeric',
|
|
106
|
+
minute: '2-digit',
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
registerCellType('datetime', {
|
|
110
|
+
render(value, row, cell) {
|
|
111
|
+
cell.textContent = value
|
|
112
|
+
? new Intl.DateTimeFormat('en-US', datetimeFmtOpts).format(
|
|
113
|
+
new Date(value)
|
|
114
|
+
)
|
|
115
|
+
: '';
|
|
116
|
+
},
|
|
117
|
+
format(value) {
|
|
118
|
+
return value
|
|
119
|
+
? new Intl.DateTimeFormat('en-US', datetimeFmtOpts).format(
|
|
120
|
+
new Date(value)
|
|
121
|
+
)
|
|
122
|
+
: '';
|
|
123
|
+
},
|
|
124
|
+
align: 'left',
|
|
125
|
+
sortFn: 'datetime',
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
// 7. boolean
|
|
129
|
+
registerCellType('boolean', {
|
|
130
|
+
render(value, row, cell) {
|
|
131
|
+
let el = cell.querySelector('check-ui');
|
|
132
|
+
if (!el) {
|
|
133
|
+
cell.textContent = '';
|
|
134
|
+
el = document.createElement('check-ui');
|
|
135
|
+
el.setAttribute('disabled', '');
|
|
136
|
+
cell.appendChild(el);
|
|
137
|
+
}
|
|
138
|
+
if (value) {
|
|
139
|
+
el.setAttribute('checked', '');
|
|
140
|
+
} else {
|
|
141
|
+
el.removeAttribute('checked');
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
format(value) {
|
|
145
|
+
return value ? 'Yes' : 'No';
|
|
146
|
+
},
|
|
147
|
+
align: 'center',
|
|
148
|
+
sortFn: 'basic',
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
// 8. badge
|
|
152
|
+
registerCellType('badge', {
|
|
153
|
+
render(value, row, cell, meta) {
|
|
154
|
+
let el = cell.querySelector('badge-ui');
|
|
155
|
+
if (!el) {
|
|
156
|
+
cell.textContent = '';
|
|
157
|
+
el = document.createElement('badge-ui');
|
|
158
|
+
cell.appendChild(el);
|
|
159
|
+
}
|
|
160
|
+
el.setAttribute('text', String(value ?? ''));
|
|
161
|
+
const variants = meta?.variants || {};
|
|
162
|
+
el.setAttribute('variant', variants[value] || 'neutral');
|
|
163
|
+
},
|
|
164
|
+
format(value) {
|
|
165
|
+
return String(value ?? '');
|
|
166
|
+
},
|
|
167
|
+
align: 'left',
|
|
168
|
+
sortFn: 'alphanumeric',
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
// 9. avatar
|
|
172
|
+
registerCellType('avatar', {
|
|
173
|
+
render(value, row, cell) {
|
|
174
|
+
let wrapper = cell.querySelector('row-ui');
|
|
175
|
+
if (!wrapper) {
|
|
176
|
+
cell.textContent = '';
|
|
177
|
+
wrapper = document.createElement('row-ui');
|
|
178
|
+
wrapper.setAttribute('gap', '2');
|
|
179
|
+
wrapper.setAttribute('align', 'center');
|
|
180
|
+
const av = document.createElement('avatar-ui');
|
|
181
|
+
av.setAttribute('size', 'sm');
|
|
182
|
+
const span = document.createElement('span');
|
|
183
|
+
wrapper.appendChild(av);
|
|
184
|
+
wrapper.appendChild(span);
|
|
185
|
+
cell.appendChild(wrapper);
|
|
186
|
+
}
|
|
187
|
+
const av = wrapper.querySelector('avatar-ui');
|
|
188
|
+
const span = wrapper.querySelector('span');
|
|
189
|
+
av.setAttribute('name', String(value ?? ''));
|
|
190
|
+
span.textContent = String(value ?? '');
|
|
191
|
+
},
|
|
192
|
+
format(value) {
|
|
193
|
+
return String(value ?? '');
|
|
194
|
+
},
|
|
195
|
+
align: 'left',
|
|
196
|
+
sortFn: 'alphanumeric',
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
// 10. link
|
|
200
|
+
registerCellType('link', {
|
|
201
|
+
render(value, row, cell, meta) {
|
|
202
|
+
let el = cell.querySelector('a');
|
|
203
|
+
if (!el) {
|
|
204
|
+
cell.textContent = '';
|
|
205
|
+
el = document.createElement('a');
|
|
206
|
+
el.style.color = 'var(--table-accent, var(--a-primary))';
|
|
207
|
+
el.style.textDecoration = 'none';
|
|
208
|
+
cell.appendChild(el);
|
|
209
|
+
}
|
|
210
|
+
const str = String(value ?? '');
|
|
211
|
+
// Auto-detect email: add mailto: href but show clean text
|
|
212
|
+
const isEmail = str.includes('@') && !str.startsWith('http');
|
|
213
|
+
el.href = isEmail ? `mailto:${str}` : str;
|
|
214
|
+
el.textContent = meta?.label ?? str;
|
|
215
|
+
},
|
|
216
|
+
format(value) {
|
|
217
|
+
return String(value ?? '');
|
|
218
|
+
},
|
|
219
|
+
align: 'left',
|
|
220
|
+
sortFn: 'alphanumeric',
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
// 11. progress
|
|
224
|
+
registerCellType('progress', {
|
|
225
|
+
render(value, row, cell) {
|
|
226
|
+
let wrapper = cell.querySelector('row-ui');
|
|
227
|
+
if (!wrapper) {
|
|
228
|
+
cell.textContent = '';
|
|
229
|
+
wrapper = document.createElement('row-ui');
|
|
230
|
+
wrapper.setAttribute('gap', '2');
|
|
231
|
+
wrapper.setAttribute('align', 'center');
|
|
232
|
+
const prog = document.createElement('progress-ui');
|
|
233
|
+
prog.setAttribute('size', 'sm');
|
|
234
|
+
prog.style.flex = '1';
|
|
235
|
+
const span = document.createElement('span');
|
|
236
|
+
wrapper.appendChild(prog);
|
|
237
|
+
wrapper.appendChild(span);
|
|
238
|
+
cell.appendChild(wrapper);
|
|
239
|
+
}
|
|
240
|
+
const prog = wrapper.querySelector('progress-ui');
|
|
241
|
+
const span = wrapper.querySelector('span');
|
|
242
|
+
prog.setAttribute('value', value != null ? String(value) : '0');
|
|
243
|
+
span.textContent = value != null ? `${value}%` : '';
|
|
244
|
+
},
|
|
245
|
+
format(value) {
|
|
246
|
+
return value != null ? `${value}%` : '';
|
|
247
|
+
},
|
|
248
|
+
align: 'left',
|
|
249
|
+
sortFn: 'numeric',
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
// 12. actions
|
|
253
|
+
registerCellType('actions', {
|
|
254
|
+
render(value, row, cell, meta) {
|
|
255
|
+
const actions = meta?.actions || [];
|
|
256
|
+
let wrapper = cell.querySelector('row-ui');
|
|
257
|
+
|
|
258
|
+
// Rebuild if action count changed
|
|
259
|
+
if (wrapper && wrapper.children.length !== actions.length) {
|
|
260
|
+
wrapper.remove();
|
|
261
|
+
wrapper = null;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if (!wrapper) {
|
|
265
|
+
cell.textContent = '';
|
|
266
|
+
wrapper = document.createElement('row-ui');
|
|
267
|
+
wrapper.setAttribute('gap', '1');
|
|
268
|
+
|
|
269
|
+
for (const action of actions) {
|
|
270
|
+
const btn = document.createElement('button-ui');
|
|
271
|
+
btn.setAttribute('icon', action.icon || '');
|
|
272
|
+
btn.setAttribute('variant', 'ghost');
|
|
273
|
+
btn.setAttribute('size', 'sm');
|
|
274
|
+
btn.setAttribute('aria-label', action.label || '');
|
|
275
|
+
btn.addEventListener('click', () => {
|
|
276
|
+
btn.dispatchEvent(
|
|
277
|
+
new CustomEvent(action.event, {
|
|
278
|
+
bubbles: true,
|
|
279
|
+
detail: { row },
|
|
280
|
+
})
|
|
281
|
+
);
|
|
282
|
+
});
|
|
283
|
+
wrapper.appendChild(btn);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
cell.appendChild(wrapper);
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
format() {
|
|
290
|
+
return '';
|
|
291
|
+
},
|
|
292
|
+
align: 'center',
|
|
293
|
+
sortFn: null,
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
export { cellTypes, registerCellType };
|