makersclaw 0.2.0 → 0.3.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/THIRD-PARTY-NOTICES.md +180 -0
- package/package.json +3 -2
- package/r/annotate.json +62 -0
- package/r/approval-request.json +52 -0
- package/r/audio-player.json +74 -0
- package/r/auth-form.json +55 -0
- package/r/board.json +10 -6
- package/r/calendar-view.json +105 -0
- package/r/cart.json +62 -0
- package/r/chart.json +83 -0
- package/r/chat.json +95 -0
- package/r/code-editor.json +94 -0
- package/r/comment-box.json +64 -0
- package/r/contact-section.json +53 -0
- package/r/core.json +205 -8
- package/r/csv-import.json +63 -0
- package/r/data-table.json +69 -0
- package/r/diagram.json +74 -0
- package/r/doc-editor.json +82 -0
- package/r/doc-page.json +61 -0
- package/r/email-render.json +73 -0
- package/r/faq.json +50 -0
- package/r/file-upload.json +54 -0
- package/r/flow-canvas.json +93 -0
- package/r/footer.json +52 -0
- package/r/gantt.json +70 -0
- package/r/job-panel.json +12 -7
- package/r/json-editor.json +66 -0
- package/r/map.json +89 -0
- package/r/menubar.json +52 -0
- package/r/mind-map.json +67 -0
- package/r/navigation-menu.json +52 -0
- package/r/order-detail.json +54 -0
- package/r/org-chart.json +66 -0
- package/r/page-builder.json +105 -0
- package/r/payment-methods.json +51 -0
- package/r/pdf-document.json +79 -0
- package/r/pdf-viewer.json +88 -0
- package/r/product-detail.json +76 -0
- package/r/product-grid.json +65 -0
- package/r/record-form.json +67 -0
- package/r/record-notes.json +55 -0
- package/r/registry.json +3411 -29
- package/r/search-dialog.json +51 -0
- package/r/settings-list.json +66 -0
- package/r/setup-checklist.json +51 -0
- package/r/share-dialog.json +52 -0
- package/r/sidebar.json +69 -0
- package/r/signature-pad.json +72 -0
- package/r/sketch-canvas.json +99 -0
- package/r/spreadsheet.json +90 -0
- package/r/stat-cards.json +66 -0
- package/r/task-list.json +63 -0
- package/r/task-model.json +98 -0
- package/r/testimonials.json +52 -0
- package/r/transaction-list.json +53 -0
- package/r/whiteboard.json +66 -0
- package/registry/blocks/annotate/README.md +179 -0
- package/registry/blocks/annotate/annotate-data.js +250 -0
- package/registry/blocks/annotate/annotate.jsx +646 -0
- package/registry/blocks/annotate/block.json +10 -0
- package/registry/blocks/annotate/demo.jsx +135 -0
- package/registry/blocks/annotate/index.js +15 -0
- package/registry/blocks/approval-request/README.md +116 -0
- package/registry/blocks/approval-request/approval-request.jsx +386 -0
- package/registry/blocks/approval-request/block.json +10 -0
- package/registry/blocks/approval-request/demo.jsx +127 -0
- package/registry/blocks/approval-request/index.js +4 -0
- package/registry/blocks/audio-player/README.md +167 -0
- package/registry/blocks/audio-player/audio-player.jsx +623 -0
- package/registry/blocks/audio-player/block.json +14 -0
- package/registry/blocks/audio-player/colors.js +109 -0
- package/registry/blocks/audio-player/demo.jsx +209 -0
- package/registry/blocks/audio-player/index.js +6 -0
- package/registry/blocks/audio-player/time.js +67 -0
- package/registry/blocks/audio-player/wavesurfer.js +9 -0
- package/registry/blocks/auth-form/README.md +126 -0
- package/registry/blocks/auth-form/auth-form.jsx +568 -0
- package/registry/blocks/auth-form/block.json +10 -0
- package/registry/blocks/auth-form/demo.jsx +131 -0
- package/registry/blocks/auth-form/index.js +3 -0
- package/registry/blocks/board/README.md +55 -5
- package/registry/blocks/board/block.json +2 -2
- package/registry/blocks/board/board.jsx +230 -86
- package/registry/blocks/board/demo.jsx +103 -24
- package/registry/blocks/calendar-view/README.md +180 -0
- package/registry/blocks/calendar-view/agenda.jsx +147 -0
- package/registry/blocks/calendar-view/block.json +76 -0
- package/registry/blocks/calendar-view/calendar-model.js +442 -0
- package/registry/blocks/calendar-view/calendar.jsx +627 -0
- package/registry/blocks/calendar-view/demo.jsx +195 -0
- package/registry/blocks/calendar-view/draft.jsx +49 -0
- package/registry/blocks/calendar-view/index.js +39 -0
- package/registry/blocks/calendar-view/month.jsx +346 -0
- package/registry/blocks/calendar-view/paint.js +69 -0
- package/registry/blocks/calendar-view/time-grid.jsx +527 -0
- package/registry/blocks/calendar-view/tray.jsx +87 -0
- package/registry/blocks/cart/README.md +146 -0
- package/registry/blocks/cart/block.json +10 -0
- package/registry/blocks/cart/cart.jsx +597 -0
- package/registry/blocks/cart/demo.jsx +98 -0
- package/registry/blocks/cart/index.js +4 -0
- package/registry/blocks/cart/money.js +28 -0
- package/registry/blocks/chart/README.md +316 -0
- package/registry/blocks/chart/block.json +10 -0
- package/registry/blocks/chart/cartesian.jsx +642 -0
- package/registry/blocks/chart/core.jsx +262 -0
- package/registry/blocks/chart/demo.jsx +357 -0
- package/registry/blocks/chart/heatmap.jsx +336 -0
- package/registry/blocks/chart/index.js +8 -0
- package/registry/blocks/chart/pie.jsx +245 -0
- package/registry/blocks/chart/sparkline.jsx +88 -0
- package/registry/blocks/chat/README.md +273 -0
- package/registry/blocks/chat/attachment.jsx +95 -0
- package/registry/blocks/chat/block.json +10 -0
- package/registry/blocks/chat/chat.jsx +132 -0
- package/registry/blocks/chat/composer.jsx +364 -0
- package/registry/blocks/chat/demo.jsx +578 -0
- package/registry/blocks/chat/header.jsx +34 -0
- package/registry/blocks/chat/index.js +9 -0
- package/registry/blocks/chat/message.jsx +450 -0
- package/registry/blocks/chat/scroller.jsx +247 -0
- package/registry/blocks/chat/text.jsx +104 -0
- package/registry/blocks/code-editor/README.md +210 -0
- package/registry/blocks/code-editor/block.json +22 -0
- package/registry/blocks/code-editor/code-editor.jsx +534 -0
- package/registry/blocks/code-editor/codemirror.js +38 -0
- package/registry/blocks/code-editor/demo.jsx +205 -0
- package/registry/blocks/code-editor/index.js +8 -0
- package/registry/blocks/code-editor/json.js +317 -0
- package/registry/blocks/code-editor/sql.js +136 -0
- package/registry/blocks/code-editor/text.js +101 -0
- package/registry/blocks/code-editor/theme.js +186 -0
- package/registry/blocks/comment-box/README.md +123 -0
- package/registry/blocks/comment-box/block.json +10 -0
- package/registry/blocks/comment-box/comment-body.jsx +217 -0
- package/registry/blocks/comment-box/comment-box.jsx +198 -0
- package/registry/blocks/comment-box/comment-time.jsx +77 -0
- package/registry/blocks/comment-box/demo.jsx +141 -0
- package/registry/blocks/comment-box/index.js +8 -0
- package/registry/blocks/contact-section/README.md +152 -0
- package/registry/blocks/contact-section/block.json +11 -0
- package/registry/blocks/contact-section/contact-section.jsx +509 -0
- package/registry/blocks/contact-section/demo.jsx +93 -0
- package/registry/blocks/contact-section/index.js +4 -0
- package/registry/blocks/csv-import/README.md +133 -0
- package/registry/blocks/csv-import/block.json +13 -0
- package/registry/blocks/csv-import/csv-import.jsx +479 -0
- package/registry/blocks/csv-import/demo.jsx +106 -0
- package/registry/blocks/csv-import/import.js +200 -0
- package/registry/blocks/csv-import/index.js +7 -0
- package/registry/blocks/data-table/README.md +386 -0
- package/registry/blocks/data-table/block.json +10 -0
- package/registry/blocks/data-table/data-table.jsx +1164 -0
- package/registry/blocks/data-table/demo.jsx +588 -0
- package/registry/blocks/data-table/index.js +5 -0
- package/registry/blocks/data-table/model.js +169 -0
- package/registry/blocks/diagram/README.md +108 -0
- package/registry/blocks/diagram/block.json +13 -0
- package/registry/blocks/diagram/demo.jsx +113 -0
- package/registry/blocks/diagram/diagram.jsx +481 -0
- package/registry/blocks/diagram/index.js +7 -0
- package/registry/blocks/diagram/mermaid.js +52 -0
- package/registry/blocks/diagram/palette.js +313 -0
- package/registry/blocks/diagram/source.js +98 -0
- package/registry/blocks/doc-editor/README.md +215 -0
- package/registry/blocks/doc-editor/block.json +15 -0
- package/registry/blocks/doc-editor/demo.jsx +225 -0
- package/registry/blocks/doc-editor/doc-editor.jsx +291 -0
- package/registry/blocks/doc-editor/doc.js +309 -0
- package/registry/blocks/doc-editor/index.js +7 -0
- package/registry/blocks/doc-editor/schema.jsx +56 -0
- package/registry/blocks/doc-editor/shadcn-classes.js +110 -0
- package/registry/blocks/doc-editor/theme.js +82 -0
- package/registry/blocks/doc-page/README.md +119 -0
- package/registry/blocks/doc-page/autosave.js +104 -0
- package/registry/blocks/doc-page/block.json +10 -0
- package/registry/blocks/doc-page/demo.jsx +137 -0
- package/registry/blocks/doc-page/doc-page.jsx +276 -0
- package/registry/blocks/doc-page/index.js +4 -0
- package/registry/blocks/email-render/README.md +151 -0
- package/registry/blocks/email-render/block.json +14 -0
- package/registry/blocks/email-render/demo.jsx +153 -0
- package/registry/blocks/email-render/doc-email.jsx +210 -0
- package/registry/blocks/email-render/email.jsx +221 -0
- package/registry/blocks/email-render/index.js +10 -0
- package/registry/blocks/email-render/render.js +50 -0
- package/registry/blocks/email-render/theme.js +215 -0
- package/registry/blocks/faq/README.md +101 -0
- package/registry/blocks/faq/block.json +11 -0
- package/registry/blocks/faq/demo.jsx +89 -0
- package/registry/blocks/faq/faq.jsx +220 -0
- package/registry/blocks/faq/index.js +4 -0
- package/registry/blocks/file-upload/README.md +138 -0
- package/registry/blocks/file-upload/block.json +10 -0
- package/registry/blocks/file-upload/demo.jsx +204 -0
- package/registry/blocks/file-upload/file-upload.jsx +635 -0
- package/registry/blocks/file-upload/index.js +4 -0
- package/registry/blocks/flow-canvas/README.md +420 -0
- package/registry/blocks/flow-canvas/block.json +13 -0
- package/registry/blocks/flow-canvas/board.js +819 -0
- package/registry/blocks/flow-canvas/chrome.jsx +649 -0
- package/registry/blocks/flow-canvas/context.jsx +35 -0
- package/registry/blocks/flow-canvas/demo.jsx +249 -0
- package/registry/blocks/flow-canvas/edges.jsx +107 -0
- package/registry/blocks/flow-canvas/flow-canvas.jsx +1329 -0
- package/registry/blocks/flow-canvas/index.js +41 -0
- package/registry/blocks/flow-canvas/nodes.jsx +392 -0
- package/registry/blocks/flow-canvas/theme.js +174 -0
- package/registry/blocks/footer/README.md +133 -0
- package/registry/blocks/footer/block.json +11 -0
- package/registry/blocks/footer/demo.jsx +119 -0
- package/registry/blocks/footer/footer.jsx +406 -0
- package/registry/blocks/footer/index.js +4 -0
- package/registry/blocks/gantt/README.md +220 -0
- package/registry/blocks/gantt/block.json +10 -0
- package/registry/blocks/gantt/demo.jsx +148 -0
- package/registry/blocks/gantt/gantt.jsx +923 -0
- package/registry/blocks/gantt/index.js +7 -0
- package/registry/blocks/gantt/rows.jsx +468 -0
- package/registry/blocks/gantt/schedule.js +278 -0
- package/registry/blocks/job-panel/README.md +80 -0
- package/registry/blocks/job-panel/block.json +3 -3
- package/registry/blocks/job-panel/demo.jsx +230 -3
- package/registry/blocks/job-panel/job-panel.jsx +169 -3
- package/registry/blocks/json-editor/README.md +133 -0
- package/registry/blocks/json-editor/block.json +10 -0
- package/registry/blocks/json-editor/demo.jsx +92 -0
- package/registry/blocks/json-editor/index.js +7 -0
- package/registry/blocks/json-editor/json-editor.jsx +305 -0
- package/registry/blocks/json-editor/json-tree.jsx +393 -0
- package/registry/blocks/json-editor/tree.js +225 -0
- package/registry/blocks/map/README.md +221 -0
- package/registry/blocks/map/block.json +14 -0
- package/registry/blocks/map/demo.jsx +201 -0
- package/registry/blocks/map/geo.js +198 -0
- package/registry/blocks/map/index.js +8 -0
- package/registry/blocks/map/list.jsx +128 -0
- package/registry/blocks/map/map-view.jsx +715 -0
- package/registry/blocks/map/maplibre.js +30 -0
- package/registry/blocks/map/marks.jsx +146 -0
- package/registry/blocks/map/theme.js +142 -0
- package/registry/blocks/menubar/README.md +109 -0
- package/registry/blocks/menubar/block.json +10 -0
- package/registry/blocks/menubar/demo.jsx +128 -0
- package/registry/blocks/menubar/index.js +4 -0
- package/registry/blocks/menubar/menubar.jsx +199 -0
- package/registry/blocks/mind-map/README.md +206 -0
- package/registry/blocks/mind-map/block.json +10 -0
- package/registry/blocks/mind-map/demo.jsx +103 -0
- package/registry/blocks/mind-map/index.js +31 -0
- package/registry/blocks/mind-map/mind-map.jsx +1125 -0
- package/registry/blocks/mind-map/topic.jsx +143 -0
- package/registry/blocks/mind-map/tree.js +645 -0
- package/registry/blocks/navigation-menu/README.md +124 -0
- package/registry/blocks/navigation-menu/block.json +10 -0
- package/registry/blocks/navigation-menu/demo.jsx +84 -0
- package/registry/blocks/navigation-menu/index.js +4 -0
- package/registry/blocks/navigation-menu/navigation-menu.jsx +448 -0
- package/registry/blocks/order-detail/README.md +109 -0
- package/registry/blocks/order-detail/block.json +10 -0
- package/registry/blocks/order-detail/demo.jsx +88 -0
- package/registry/blocks/order-detail/index.js +4 -0
- package/registry/blocks/order-detail/order-detail.jsx +354 -0
- package/registry/blocks/org-chart/README.md +145 -0
- package/registry/blocks/org-chart/block.json +10 -0
- package/registry/blocks/org-chart/demo.jsx +94 -0
- package/registry/blocks/org-chart/index.js +7 -0
- package/registry/blocks/org-chart/org-chart.jsx +631 -0
- package/registry/blocks/org-chart/org.js +245 -0
- package/registry/blocks/org-chart/person.jsx +96 -0
- package/registry/blocks/page-builder/README.md +257 -0
- package/registry/blocks/page-builder/block.json +14 -0
- package/registry/blocks/page-builder/demo.jsx +145 -0
- package/registry/blocks/page-builder/grapes.js +18 -0
- package/registry/blocks/page-builder/index.js +11 -0
- package/registry/blocks/page-builder/page-builder.jsx +704 -0
- package/registry/blocks/page-builder/page-view.jsx +33 -0
- package/registry/blocks/page-builder/page.js +118 -0
- package/registry/blocks/page-builder/panels.jsx +588 -0
- package/registry/blocks/page-builder/sections.js +209 -0
- package/registry/blocks/page-builder/theme.js +87 -0
- package/registry/blocks/page-builder/thumbs.jsx +189 -0
- package/registry/blocks/page-builder/tokens.js +329 -0
- package/registry/blocks/payment-methods/README.md +104 -0
- package/registry/blocks/payment-methods/block.json +10 -0
- package/registry/blocks/payment-methods/demo.jsx +71 -0
- package/registry/blocks/payment-methods/index.js +4 -0
- package/registry/blocks/payment-methods/payment-methods.jsx +302 -0
- package/registry/blocks/pdf-document/README.md +213 -0
- package/registry/blocks/pdf-document/block.json +13 -0
- package/registry/blocks/pdf-document/demo.jsx +136 -0
- package/registry/blocks/pdf-document/index.js +33 -0
- package/registry/blocks/pdf-document/money.js +83 -0
- package/registry/blocks/pdf-document/pdf-document.jsx +144 -0
- package/registry/blocks/pdf-document/primitives.jsx +271 -0
- package/registry/blocks/pdf-document/quote.jsx +179 -0
- package/registry/blocks/pdf-document/theme.js +193 -0
- package/registry/blocks/pdf-viewer/README.md +191 -0
- package/registry/blocks/pdf-viewer/block.json +14 -0
- package/registry/blocks/pdf-viewer/demo.jsx +252 -0
- package/registry/blocks/pdf-viewer/helpers.js +270 -0
- package/registry/blocks/pdf-viewer/index.js +8 -0
- package/registry/blocks/pdf-viewer/notes.jsx +195 -0
- package/registry/blocks/pdf-viewer/pdf-viewer.jsx +1368 -0
- package/registry/blocks/pdf-viewer/pdfjs.js +37 -0
- package/registry/blocks/pdf-viewer/ssr-shim-end.js +6 -0
- package/registry/blocks/pdf-viewer/ssr-shim.js +44 -0
- package/registry/blocks/product-detail/README.md +217 -0
- package/registry/blocks/product-detail/block.json +10 -0
- package/registry/blocks/product-detail/demo.jsx +233 -0
- package/registry/blocks/product-detail/index.js +7 -0
- package/registry/blocks/product-detail/price.jsx +115 -0
- package/registry/blocks/product-detail/product-detail.jsx +348 -0
- package/registry/blocks/product-detail/product-media.jsx +102 -0
- package/registry/blocks/product-detail/product-options.jsx +144 -0
- package/registry/blocks/product-grid/README.md +162 -0
- package/registry/blocks/product-grid/block.json +10 -0
- package/registry/blocks/product-grid/demo.jsx +255 -0
- package/registry/blocks/product-grid/index.js +5 -0
- package/registry/blocks/product-grid/product-card.jsx +232 -0
- package/registry/blocks/product-grid/product-grid.jsx +235 -0
- package/registry/blocks/record-form/README.md +196 -0
- package/registry/blocks/record-form/block.json +10 -0
- package/registry/blocks/record-form/demo.jsx +525 -0
- package/registry/blocks/record-form/index.js +4 -0
- package/registry/blocks/record-form/record-fields.jsx +457 -0
- package/registry/blocks/record-form/record-form.jsx +415 -0
- package/registry/blocks/record-form/rules.js +81 -0
- package/registry/blocks/record-notes/README.md +139 -0
- package/registry/blocks/record-notes/block.json +10 -0
- package/registry/blocks/record-notes/demo.jsx +179 -0
- package/registry/blocks/record-notes/index.js +4 -0
- package/registry/blocks/record-notes/record-notes.jsx +266 -0
- package/registry/blocks/search-dialog/README.md +108 -0
- package/registry/blocks/search-dialog/block.json +10 -0
- package/registry/blocks/search-dialog/demo.jsx +116 -0
- package/registry/blocks/search-dialog/index.js +3 -0
- package/registry/blocks/search-dialog/search-dialog.jsx +235 -0
- package/registry/blocks/settings-list/README.md +171 -0
- package/registry/blocks/settings-list/block.json +10 -0
- package/registry/blocks/settings-list/demo.jsx +333 -0
- package/registry/blocks/settings-list/index.js +4 -0
- package/registry/blocks/settings-list/row-state.jsx +93 -0
- package/registry/blocks/settings-list/settings-list.jsx +349 -0
- package/registry/blocks/settings-list/settings-matrix.jsx +118 -0
- package/registry/blocks/setup-checklist/README.md +142 -0
- package/registry/blocks/setup-checklist/block.json +10 -0
- package/registry/blocks/setup-checklist/demo.jsx +159 -0
- package/registry/blocks/setup-checklist/index.js +4 -0
- package/registry/blocks/setup-checklist/setup-checklist.jsx +446 -0
- package/registry/blocks/share-dialog/README.md +113 -0
- package/registry/blocks/share-dialog/block.json +10 -0
- package/registry/blocks/share-dialog/demo.jsx +140 -0
- package/registry/blocks/share-dialog/index.js +3 -0
- package/registry/blocks/share-dialog/share-dialog.jsx +384 -0
- package/registry/blocks/sidebar/README.md +190 -0
- package/registry/blocks/sidebar/block.json +43 -0
- package/registry/blocks/sidebar/demo.jsx +577 -0
- package/registry/blocks/sidebar/index.js +4 -0
- package/registry/blocks/sidebar/sidebar-panel.jsx +149 -0
- package/registry/blocks/sidebar/sidebar.jsx +864 -0
- package/registry/blocks/signature-pad/README.md +137 -0
- package/registry/blocks/signature-pad/block.json +13 -0
- package/registry/blocks/signature-pad/colors.js +115 -0
- package/registry/blocks/signature-pad/demo.jsx +94 -0
- package/registry/blocks/signature-pad/index.js +6 -0
- package/registry/blocks/signature-pad/pad.js +7 -0
- package/registry/blocks/signature-pad/signature-pad.jsx +434 -0
- package/registry/blocks/signature-pad/signature.js +68 -0
- package/registry/blocks/sketch-canvas/README.md +280 -0
- package/registry/blocks/sketch-canvas/block.json +13 -0
- package/registry/blocks/sketch-canvas/demo.jsx +159 -0
- package/registry/blocks/sketch-canvas/excalidraw.js +40 -0
- package/registry/blocks/sketch-canvas/index.js +9 -0
- package/registry/blocks/sketch-canvas/palette.js +226 -0
- package/registry/blocks/sketch-canvas/sketch-canvas.jsx +1188 -0
- package/registry/blocks/sketch-canvas/sketch.js +179 -0
- package/registry/blocks/sketch-canvas/ssr-shim-end.js +6 -0
- package/registry/blocks/sketch-canvas/ssr-shim.js +45 -0
- package/registry/blocks/sketch-canvas/stamps.js +104 -0
- package/registry/blocks/sketch-canvas/theme.js +131 -0
- package/registry/blocks/spreadsheet/README.md +307 -0
- package/registry/blocks/spreadsheet/block.json +13 -0
- package/registry/blocks/spreadsheet/cells.jsx +455 -0
- package/registry/blocks/spreadsheet/chrome.jsx +325 -0
- package/registry/blocks/spreadsheet/demo.jsx +177 -0
- package/registry/blocks/spreadsheet/grid.js +387 -0
- package/registry/blocks/spreadsheet/index.js +34 -0
- package/registry/blocks/spreadsheet/spreadsheet.jsx +1732 -0
- package/registry/blocks/spreadsheet/types.js +473 -0
- package/registry/blocks/stat-cards/README.md +173 -0
- package/registry/blocks/stat-cards/block.json +10 -0
- package/registry/blocks/stat-cards/demo.jsx +257 -0
- package/registry/blocks/stat-cards/index.js +4 -0
- package/registry/blocks/stat-cards/stat-cards.jsx +307 -0
- package/registry/blocks/stat-cards/usage.jsx +243 -0
- package/registry/blocks/task-list/README.md +176 -0
- package/registry/blocks/task-list/block.json +10 -0
- package/registry/blocks/task-list/demo.jsx +134 -0
- package/registry/blocks/task-list/index.js +5 -0
- package/registry/blocks/task-list/task-list.jsx +907 -0
- package/registry/blocks/task-model/README.md +455 -0
- package/registry/blocks/task-model/block.json +167 -0
- package/registry/blocks/task-model/changes.js +89 -0
- package/registry/blocks/task-model/dates.js +371 -0
- package/registry/blocks/task-model/demo.jsx +215 -0
- package/registry/blocks/task-model/dnd.jsx +240 -0
- package/registry/blocks/task-model/index.js +97 -0
- package/registry/blocks/task-model/model.js +919 -0
- package/registry/blocks/task-model/parts.jsx +449 -0
- package/registry/blocks/task-model/toolbar.jsx +271 -0
- package/registry/blocks/testimonials/README.md +139 -0
- package/registry/blocks/testimonials/block.json +11 -0
- package/registry/blocks/testimonials/demo.jsx +137 -0
- package/registry/blocks/testimonials/index.js +4 -0
- package/registry/blocks/testimonials/testimonials.jsx +430 -0
- package/registry/blocks/transaction-list/README.md +126 -0
- package/registry/blocks/transaction-list/block.json +10 -0
- package/registry/blocks/transaction-list/demo.jsx +79 -0
- package/registry/blocks/transaction-list/index.js +4 -0
- package/registry/blocks/transaction-list/transaction-list.jsx +383 -0
- package/registry/blocks/whiteboard/README.md +179 -0
- package/registry/blocks/whiteboard/block.json +10 -0
- package/registry/blocks/whiteboard/demo.jsx +169 -0
- package/registry/blocks/whiteboard/index.js +6 -0
- package/registry/blocks/whiteboard/templates.js +150 -0
- package/registry/blocks/whiteboard/whiteboard.jsx +721 -0
- package/src/install.mjs +18 -0
- package/src/shadcn.mjs +8 -0
- package/templates/next/files/README.md +145 -11
- package/templates/next/files/app/globals.css +55 -4
- package/templates/next/files/check/run.mjs +3 -3
- package/templates/next/files/components/ui/avatar.jsx +141 -0
- package/templates/next/files/components/ui/breadcrumb.jsx +149 -0
- package/templates/next/files/components/ui/button-group.jsx +70 -0
- package/templates/next/files/components/ui/button.jsx +132 -12
- package/templates/next/files/components/ui/calendar.jsx +609 -0
- package/templates/next/files/components/ui/carousel.jsx +281 -0
- package/templates/next/files/components/ui/collapsible.jsx +208 -0
- package/templates/next/files/components/ui/combobox.jsx +608 -0
- package/templates/next/files/components/ui/command.jsx +577 -0
- package/templates/next/files/components/ui/context-menu.jsx +191 -0
- package/templates/next/files/components/ui/date-picker.jsx +360 -0
- package/templates/next/files/components/ui/distribution.jsx +117 -0
- package/templates/next/files/components/ui/feedback.jsx +143 -0
- package/templates/next/files/components/ui/field.jsx +115 -3
- package/templates/next/files/components/ui/file-input.jsx +234 -0
- package/templates/next/files/components/ui/icon.jsx +130 -8
- package/templates/next/files/components/ui/image.jsx +143 -0
- package/templates/next/files/components/ui/index.js +47 -2
- package/templates/next/files/components/ui/input-group.jsx +213 -0
- package/templates/next/files/components/ui/input-otp.jsx +170 -0
- package/templates/next/files/components/ui/item.jsx +206 -0
- package/templates/next/files/components/ui/menu.jsx +454 -82
- package/templates/next/files/components/ui/notice.jsx +126 -14
- package/templates/next/files/components/ui/pagination.jsx +156 -0
- package/templates/next/files/components/ui/popover.jsx +284 -0
- package/templates/next/files/components/ui/radio.jsx +193 -0
- package/templates/next/files/components/ui/rating.jsx +131 -0
- package/templates/next/files/components/ui/resizable.jsx +338 -0
- package/templates/next/files/components/ui/scroll-area.jsx +123 -0
- package/templates/next/files/components/ui/separator.jsx +119 -0
- package/templates/next/files/components/ui/sheet.jsx +96 -11
- package/templates/next/files/components/ui/slider.jsx +174 -0
- package/templates/next/files/components/ui/stat.jsx +574 -0
- package/templates/next/files/components/ui/steps.jsx +338 -0
- package/templates/next/files/components/ui/swatch.jsx +33 -0
- package/templates/next/files/components/ui/table.jsx +130 -0
- package/templates/next/files/components/ui/toast.jsx +440 -0
- package/templates/next/files/components/ui/toggle.jsx +195 -0
- package/templates/next/files/components/ui/tooltip.jsx +270 -0
- package/templates/next/template.json +264 -8
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
# Data table
|
|
2
|
+
|
|
3
|
+
Records as a table the founder can work. Click a header to sort (shift-click
|
|
4
|
+
to sort by more than one column), search every column, narrow by facets that
|
|
5
|
+
show how many rows each choice leaves, pick which columns show, select rows
|
|
6
|
+
and act on them together from a bar that appears, act on one row from its
|
|
7
|
+
menu or from buttons in the row, open a row with a click, and move through
|
|
8
|
+
pages of a chosen size. Opt in to rows that open to show their details,
|
|
9
|
+
rows filed under group headings with subtotals, an aligned totals row,
|
|
10
|
+
arrow keys over the rows, and a first column that stays put while a wide table scrolls sideways.
|
|
11
|
+
Loading shows skeleton rows; "no rows yet" and "nothing matches" are two
|
|
12
|
+
different states, the second with a way out. It runs over `rows` in the
|
|
13
|
+
browser, or — with `manual` — shows the page a server chose.
|
|
14
|
+
|
|
15
|
+
```jsx
|
|
16
|
+
import { DataTable } from "../components/blocks/data-table"; // a Makersclaw app ("./blocks/data-table" from components/)
|
|
17
|
+
import { DataTable } from "@/components/makersclaw/blocks/data-table"; // a shadcn project
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
It is a client component: render it from a `"use client"` component, and
|
|
21
|
+
load the rows in the server surface (README §4).
|
|
22
|
+
|
|
23
|
+
## The data
|
|
24
|
+
|
|
25
|
+
Any array of objects with a unique id (`idColumn`, default `"id"`). Each
|
|
26
|
+
column reads one key of a row, or draws the cell itself with `cell(row)`.
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
const COLUMNS = [
|
|
30
|
+
{ key: "number", header: "Invoice", sortable: true, hideable: false },
|
|
31
|
+
{ key: "customer", header: "Customer", sortable: true, cell: (r) => <CustomerCell r={r} /> },
|
|
32
|
+
{ key: "status", header: "Status", sortable: true, cell: (r) => <Badge tone={TONE[r.status]}>{r.status}</Badge> },
|
|
33
|
+
{ key: "amount", header: "Amount", sortable: true, align: "end", cell: (r) => money(r.amount) },
|
|
34
|
+
{ key: "method", header: "Method", hidden: true },
|
|
35
|
+
];
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
A column:
|
|
39
|
+
|
|
40
|
+
- `key` — the row key it reads (and its id for sort, filters, visibility).
|
|
41
|
+
- `header` — what the header says; default made from the key.
|
|
42
|
+
- `cell(row)` — what the cell draws; default the value as text. Kit parts
|
|
43
|
+
and tokens only.
|
|
44
|
+
- `sortable` — the header becomes a sort button.
|
|
45
|
+
- `sortValue(row)` — what it sorts by, when the cell is not the value
|
|
46
|
+
(a status in its own order, a date string, a nested field). Numbers sort
|
|
47
|
+
as numbers, strings naturally ("INV-9" before "INV-10"); blanks sort
|
|
48
|
+
last either way.
|
|
49
|
+
- `searchValue(row)` — what the search matches; default `sortValue` or
|
|
50
|
+
the value. `searchable: false` leaves the column out of the search.
|
|
51
|
+
- `align` — `"start"` (default) or `"end"` (amounts: right-aligned,
|
|
52
|
+
tabular figures). `numeric: true` means the same.
|
|
53
|
+
- `width` — a CSS width for the column (`"8rem"`).
|
|
54
|
+
- `hideable` — default true; false keeps it out of the Columns menu.
|
|
55
|
+
- `hidden` — starts hidden (the Columns menu can show it).
|
|
56
|
+
- `className` · `headerClassName` — layout on its cells or its header.
|
|
57
|
+
Never colour.
|
|
58
|
+
|
|
59
|
+
Any other key on a column is kept and ignored, so a block built on this
|
|
60
|
+
one can carry its own (report-table's `kind`).
|
|
61
|
+
|
|
62
|
+
## Props
|
|
63
|
+
|
|
64
|
+
- `rows` — the records. Pass `useFixture(rows, SAMPLE).rows` and the
|
|
65
|
+
examples show, sort and filter like rows, but a bulk action never
|
|
66
|
+
receives them (they are not rows): selecting only examples and pressing
|
|
67
|
+
one says so and changes nothing.
|
|
68
|
+
- `columns` — as above.
|
|
69
|
+
- `idColumn` — default `"id"`.
|
|
70
|
+
- `label` — what the table is called to a screen reader, default `"Table"`.
|
|
71
|
+
- `noun` — what a row is ("invoice"): used in "1–10 of 60 invoices", the
|
|
72
|
+
facet counts and the announcements. Default `"row"`.
|
|
73
|
+
|
|
74
|
+
Search
|
|
75
|
+
|
|
76
|
+
- `searchable` — default true: a search field with a glyph leads the
|
|
77
|
+
toolbar. Every word must appear somewhere in the row.
|
|
78
|
+
- `searchPlaceholder` — default `"Search…"`.
|
|
79
|
+
- `search` · `defaultSearch` · `onSearchChange(text)` — the text.
|
|
80
|
+
|
|
81
|
+
Facets
|
|
82
|
+
|
|
83
|
+
- `facets` — `[{ key, label?, options?, value?(row) }]`: one multi-choice
|
|
84
|
+
Combobox per facet, each option with the number of rows it would show
|
|
85
|
+
at its right (counted over the search and the other facets). `options`
|
|
86
|
+
`[{ value, label }]` fixes the choices and their order; without it they
|
|
87
|
+
are the values found in `rows`. `value(row)` when the facet is not a
|
|
88
|
+
plain key.
|
|
89
|
+
- `filters` · `defaultFilters` · `onFiltersChange(filters)` — the chosen
|
|
90
|
+
values, `{ status: ["paid", "overdue"], owner: ["Maya"] }`.
|
|
91
|
+
|
|
92
|
+
Sort
|
|
93
|
+
|
|
94
|
+
- `sort` · `defaultSort` · `onSortChange(sort)` — `[{ key, dir: "asc" | "desc" }]`,
|
|
95
|
+
the first entry sorts first. A press cycles a column asc → desc → off.
|
|
96
|
+
- `multiSort` — default true: shift-click adds a column to the sort (each
|
|
97
|
+
sorted header shows its place). False: one column at a time.
|
|
98
|
+
|
|
99
|
+
Selection
|
|
100
|
+
|
|
101
|
+
- `selectable` — checkboxes on every row and a select-this-page box in
|
|
102
|
+
the header. On by default when `bulkActions`, `selection` or
|
|
103
|
+
`onSelectionChange` is given.
|
|
104
|
+
- `selection` · `defaultSelection` · `onSelectionChange(ids)` — the chosen
|
|
105
|
+
ids, as strings. A selection survives search, filters and paging.
|
|
106
|
+
- `bulkActions` — `[{ label, onSelect(rows, ids), icon?, tone?: "danger", disabled?, keepSelection? }]`,
|
|
107
|
+
or `(selectedRows) => [...]`. With rows selected a bar shows the count,
|
|
108
|
+
"Select all N" (when the whole page is chosen and more match), Clear,
|
|
109
|
+
and these as buttons. `onSelect` may be async; return
|
|
110
|
+
`{ ok: false, error }` (or throw) and the bar says why it failed and
|
|
111
|
+
keeps the selection. Anything else clears the selection, unless
|
|
112
|
+
`keepSelection: true` (an export).
|
|
113
|
+
|
|
114
|
+
Columns
|
|
115
|
+
|
|
116
|
+
- `hiddenColumns` · `defaultHiddenColumns` · `onHiddenColumnsChange(keys)` —
|
|
117
|
+
the keys not shown. Default: the columns marked `hidden`. The Columns
|
|
118
|
+
menu (checkbox items) sets it; the last column shown cannot be hidden.
|
|
119
|
+
|
|
120
|
+
Pages
|
|
121
|
+
|
|
122
|
+
- `page` · `defaultPage` (1) · `onPageChange(page)` — 1-based. A new
|
|
123
|
+
search, filter, sort or page size goes back to page 1; a page past the
|
|
124
|
+
end (rows removed) goes to the last.
|
|
125
|
+
- `pageSize` · `defaultPageSize` (10) · `onPageSizeChange(n)`, `pageSizes`
|
|
126
|
+
(default `[10, 25, 50, 100]`) — the "Rows per page" choice.
|
|
127
|
+
- `paginate` — default true; false shows every row and no pager.
|
|
128
|
+
|
|
129
|
+
Rows
|
|
130
|
+
|
|
131
|
+
- `rowActions(row)` — the row's "…" menu, in kit `Menu` items
|
|
132
|
+
(`[{ label, onSelect, icon?, tone?: "danger" }, { type: "separator" }, …]`;
|
|
133
|
+
a falsy item is skipped). Nothing returned, no menu.
|
|
134
|
+
- `inlineActions` — draw a row's first actions as buttons in the row
|
|
135
|
+
instead of in the menu: a number (the first N of `rowActions(row)`) or
|
|
136
|
+
`true` (all of them). An action with `inline: true` is always a button,
|
|
137
|
+
one with `inline: false` never is; separators and labels stay in the
|
|
138
|
+
menu, and the "…" menu holds whatever is left. A button with an `icon`
|
|
139
|
+
is a square glyph button with a tooltip (on a phone card, the glyph and
|
|
140
|
+
the words); without one it is a small text button ("View"). Its
|
|
141
|
+
`onSelect(row)` may be async: the button spins and the row's other
|
|
142
|
+
buttons wait, and `{ ok: false, error }` (or a throw) shows a danger
|
|
143
|
+
notice above the table naming the action and the row. `tone: "danger"`
|
|
144
|
+
and `disabled` work as in the menu. Default: none — every action in the
|
|
145
|
+
menu, as before.
|
|
146
|
+
- `onRowClick(row)` — a click on the row (not on its checkbox, menu or a
|
|
147
|
+
link inside a cell), or Enter on a focused row: open your `Sheet`.
|
|
148
|
+
- `rowTone(row)` — `"success" | "info" | "warning" | "danger" | "highlighted"`
|
|
149
|
+
or nothing: a tint on the row's cells from the theme's status colours
|
|
150
|
+
(hover deepens it). `"highlighted"` is a pinned or best row, not a
|
|
151
|
+
status: a light primary tint and a bar at its leading edge. Status tones
|
|
152
|
+
are for status only.
|
|
153
|
+
- `rowClassName(row)` — more classes on the row (layout, weight). Never
|
|
154
|
+
colour; that is `rowTone`.
|
|
155
|
+
|
|
156
|
+
Details (expandable rows)
|
|
157
|
+
|
|
158
|
+
- `renderExpanded(row)` — what shows under a row when it is open. Adds a
|
|
159
|
+
leading chevron column; the chevron turns when the row is open, and is
|
|
160
|
+
a button with `aria-expanded`. A row with no `onRowClick` also opens on
|
|
161
|
+
a click or Enter.
|
|
162
|
+
- `canExpand(row)` — false leaves a row without a chevron. Default: every
|
|
163
|
+
row can open.
|
|
164
|
+
- `expanded` · `defaultExpanded` · `onExpandedChange(ids)` — the open ids,
|
|
165
|
+
as strings.
|
|
166
|
+
|
|
167
|
+
Groups
|
|
168
|
+
|
|
169
|
+
- `groupBy` — a key or `(row) => value`: each group gets a heading row
|
|
170
|
+
with its label and how many rows it holds. Sort first, then group: a
|
|
171
|
+
sort orders rows inside their groups and never moves a group. Paging
|
|
172
|
+
counts rows; a group split across pages repeats its heading.
|
|
173
|
+
- `groupOrder` — the group values to put first, in order
|
|
174
|
+
(`["overdue", "pending"]`; the rest follow in the order they first
|
|
175
|
+
appear in `rows`), or a compare function over two group values.
|
|
176
|
+
Default: the order groups first appear in `rows`.
|
|
177
|
+
- `groupLabel(value, rows)` — the heading's label. Default the value
|
|
178
|
+
(`"None"` for a blank).
|
|
179
|
+
- `groupSummary(rows)` — a node at the heading's right: a sum, a count.
|
|
180
|
+
`rows` is the whole group, not only this page's part.
|
|
181
|
+
- `groupFooter(rows)` — a subtotal row under the group, bold on a tinted
|
|
182
|
+
background, on the page where the group ends. Return a map of column
|
|
183
|
+
key to node (`{ amount: "$4,200" }`) for cells aligned under their
|
|
184
|
+
columns ("Subtotal" fills the first column unless the map has it), or
|
|
185
|
+
one node for a single right-aligned cell.
|
|
186
|
+
|
|
187
|
+
Totals
|
|
188
|
+
|
|
189
|
+
- `totals` — a map of column key to node, or `(rows) => map` over every
|
|
190
|
+
row that matches the search and filters (all pages; in `manual`, the
|
|
191
|
+
rows given): one row in the table's `<tfoot>`, each value under its
|
|
192
|
+
column. `footer` is still the free node under the table.
|
|
193
|
+
- `totalsLabel` — default `"Total"`, in the first column when the map
|
|
194
|
+
has nothing for it; `null` for none.
|
|
195
|
+
|
|
196
|
+
Keyboard
|
|
197
|
+
|
|
198
|
+
- `keyboard` — arrow keys over the rows. One row is in the tab order at
|
|
199
|
+
a time (the last one focused, else the first) and shows a focus ring.
|
|
200
|
+
↑ ↓ move, Home and End go to the first and last row on the page, Space
|
|
201
|
+
selects the row (when `selectable`), Enter opens it as a click does,
|
|
202
|
+
→ and ← open and close its details, Esc clears the selection. Works on
|
|
203
|
+
the phone cards too.
|
|
204
|
+
|
|
205
|
+
Layout
|
|
206
|
+
|
|
207
|
+
- `stickyFirstColumn` — the first shown column (and the chevron and
|
|
208
|
+
checkbox before it) stays put while the table scrolls sideways, with an
|
|
209
|
+
edge line. A wide table always scrolls inside its own box, never the
|
|
210
|
+
page; details rows and group headings are drawn at the box's visible
|
|
211
|
+
width.
|
|
212
|
+
|
|
213
|
+
Slots and states
|
|
214
|
+
|
|
215
|
+
- `toolbar` — your controls at the toolbar's end, before Columns: the one
|
|
216
|
+
"New invoice" button, an export.
|
|
217
|
+
- `footer` — a node under the table, above the pager: a total, a note.
|
|
218
|
+
- `loading` — skeleton rows in place of the body (the toolbar stays).
|
|
219
|
+
- `error` — a danger Notice above the table (a failed read).
|
|
220
|
+
- `emptyTitle` · `emptyBody` · `emptyAction` · `emptyIcon` — the state for
|
|
221
|
+
no rows at all. No matches has its own state with "Clear filters".
|
|
222
|
+
- `mobile` — `"scroll"` (default): under 640px the table scrolls sideways
|
|
223
|
+
inside its own box; the page never does. `"cards"`: under 640px each row
|
|
224
|
+
is a card — the first shown column as its title, the others as
|
|
225
|
+
label/value pairs, with its checkbox and menu. Pick cards when rows are
|
|
226
|
+
read more than compared; scroll when columns are compared.
|
|
227
|
+
- `cardTitle(row)` — the card's title instead of the first column (the
|
|
228
|
+
card then lists every shown column).
|
|
229
|
+
- `variant` — `"outline"` (a bordered card; default) or `"plain"` (no
|
|
230
|
+
border, for a table already inside a `Card`).
|
|
231
|
+
- `className` — layout around it (width, margin). Never colour.
|
|
232
|
+
|
|
233
|
+
### Controlled or not — letting a server drive it
|
|
234
|
+
|
|
235
|
+
Every piece of state has three props: the value, a `default…` and an
|
|
236
|
+
`on…Change`. Pass only the default (or nothing) and the table keeps it.
|
|
237
|
+
Pass the value and the table shows what you pass and calls `on…Change`
|
|
238
|
+
with what the founder asked for; you set it back. Each is independent, so
|
|
239
|
+
you can own just the page and leave the rest to the table.
|
|
240
|
+
|
|
241
|
+
For a table too big for the browser, set `manual`: the table stops
|
|
242
|
+
searching, filtering, sorting and slicing, `rows` is the current page, and
|
|
243
|
+
`rowCount` is how many rows the server has. Own `search`, `filters`,
|
|
244
|
+
`sort`, `page` and `pageSize`, re-read on each change, and give each facet
|
|
245
|
+
its `options` with a `count` (`{ value, label, count }`), since the table
|
|
246
|
+
cannot count rows it does not have. With `manual`, a bulk action's second
|
|
247
|
+
argument, `ids`, is every selected id, including rows not on this page.
|
|
248
|
+
|
|
249
|
+
```jsx
|
|
250
|
+
const [q, setQ] = useState({ search: "", filters: {}, sort: [], page: 1, pageSize: 25 });
|
|
251
|
+
// …read rows + total for q on the server (a Server Action, a route)…
|
|
252
|
+
<DataTable manual rows={pageRows} rowCount={total} loading={pending}
|
|
253
|
+
search={q.search} onSearchChange={(search) => setQ((s) => ({ ...s, search }))}
|
|
254
|
+
filters={q.filters} onFiltersChange={(filters) => setQ((s) => ({ ...s, filters }))}
|
|
255
|
+
sort={q.sort} onSortChange={(sort) => setQ((s) => ({ ...s, sort }))}
|
|
256
|
+
page={q.page} onPageChange={(page) => setQ((s) => ({ ...s, page }))}
|
|
257
|
+
pageSize={q.pageSize} onPageSizeChange={(pageSize) => setQ((s) => ({ ...s, pageSize }))}
|
|
258
|
+
columns={COLUMNS} facets={[{ key: "status", options: statusCounts }]} />
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
The pure helpers the table uses are exported too — `processRows`,
|
|
262
|
+
`searchRows`, `filterRows`, `sortRows`, `facetOptions`, `nextSort`,
|
|
263
|
+
`groupRows`, `groupValueOf` and `useControllable` — so a surface can compute the same answer the table
|
|
264
|
+
shows (a total over the filtered rows) without drawing it twice.
|
|
265
|
+
|
|
266
|
+
## Example
|
|
267
|
+
|
|
268
|
+
```jsx
|
|
269
|
+
// components/Invoices.jsx — client: the table, the row sheet
|
|
270
|
+
"use client";
|
|
271
|
+
import { useState } from "react";
|
|
272
|
+
import { updateRow } from "../lib/actions";
|
|
273
|
+
import { Badge, Button, Sheet } from "./ui";
|
|
274
|
+
import { FixtureNotice, useFixture } from "./parts";
|
|
275
|
+
import { DataTable } from "./blocks/data-table";
|
|
276
|
+
|
|
277
|
+
const TONE = { paid: "success", pending: "info", overdue: "danger", draft: "neutral" };
|
|
278
|
+
const COLUMNS = [
|
|
279
|
+
{ key: "number", header: "Invoice", sortable: true, hideable: false },
|
|
280
|
+
{ key: "customer", header: "Customer", sortable: true },
|
|
281
|
+
{ key: "status", header: "Status", sortable: true, cell: (r) => <Badge tone={TONE[r.status]}>{r.status}</Badge> },
|
|
282
|
+
{ key: "amount", header: "Amount", sortable: true, align: "end", cell: (r) => `$${r.amount.toLocaleString()}` },
|
|
283
|
+
{ key: "due", header: "Due", sortable: true },
|
|
284
|
+
];
|
|
285
|
+
const SAMPLE = [
|
|
286
|
+
{ number: "INV-1001", customer: "Northwind", status: "paid", amount: 1200, due: "2026-10-01" },
|
|
287
|
+
{ number: "INV-1002", customer: "Acme Ltd", status: "overdue", amount: 450, due: "2026-09-01" },
|
|
288
|
+
];
|
|
289
|
+
|
|
290
|
+
export default function Invoices({ invoices }) {
|
|
291
|
+
const fixture = useFixture(invoices, SAMPLE);
|
|
292
|
+
const [open, setOpen] = useState(null);
|
|
293
|
+
const markPaid = (rows) =>
|
|
294
|
+
Promise.all(rows.map((r) => updateRow({ source: "public.invoices", id: r.id, patch: { status: "paid" } })))
|
|
295
|
+
.then((all) => all.find((r) => r.ok === false) ?? { ok: true });
|
|
296
|
+
return (
|
|
297
|
+
<div className="grid gap-4">
|
|
298
|
+
{fixture.isFixture ? <FixtureNotice onClear={fixture.clear} /> : null}
|
|
299
|
+
<DataTable
|
|
300
|
+
label="Invoices"
|
|
301
|
+
noun="invoice"
|
|
302
|
+
rows={fixture.rows}
|
|
303
|
+
columns={COLUMNS}
|
|
304
|
+
facets={[{ key: "status", label: "Status" }]}
|
|
305
|
+
defaultSort={[{ key: "due", dir: "asc" }]}
|
|
306
|
+
bulkActions={[{ label: "Mark paid", icon: "check", onSelect: markPaid }]}
|
|
307
|
+
rowActions={(r) => [{ label: "Open", icon: "eye", onSelect: () => setOpen(r) }]}
|
|
308
|
+
onRowClick={setOpen}
|
|
309
|
+
rowTone={(r) => (r.status === "overdue" ? "warning" : null)}
|
|
310
|
+
toolbar={<Button variant="primary" icon="plus">New invoice</Button>}
|
|
311
|
+
mobile="cards"
|
|
312
|
+
emptyTitle="No invoices yet"
|
|
313
|
+
/>
|
|
314
|
+
<Sheet open={Boolean(open)} onClose={() => setOpen(null)} title={open?.number}>
|
|
315
|
+
{/* the invoice's fields */}
|
|
316
|
+
</Sheet>
|
|
317
|
+
</div>
|
|
318
|
+
);
|
|
319
|
+
}
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### Details, groups and totals
|
|
323
|
+
|
|
324
|
+
A budget: line items under departments, sorted within them, a subtotal
|
|
325
|
+
per department, a total, the months scrolling under the line item.
|
|
326
|
+
|
|
327
|
+
```jsx
|
|
328
|
+
const MONTHS = ["jan", "feb", "mar"];
|
|
329
|
+
const money = (n) => `$${n.toLocaleString()}`;
|
|
330
|
+
const sumOf = (rows, key) => rows.reduce((s, r) => s + r[key], 0);
|
|
331
|
+
const sums = (rows) => Object.fromEntries([...MONTHS, "total"].map((k) => [k, money(sumOf(rows, k))]));
|
|
332
|
+
const COLUMNS = [
|
|
333
|
+
{ key: "item", header: "Line item", sortable: true },
|
|
334
|
+
...MONTHS.map((m) => ({ key: m, align: "end", sortable: true, cell: (r) => money(r[m]) })),
|
|
335
|
+
{ key: "total", align: "end", sortable: true, cell: (r) => money(r.total) },
|
|
336
|
+
];
|
|
337
|
+
|
|
338
|
+
<DataTable label="Budget" noun="line item" rows={lines} columns={COLUMNS}
|
|
339
|
+
paginate={false} keyboard stickyFirstColumn
|
|
340
|
+
groupBy="department" groupOrder={["Engineering"]}
|
|
341
|
+
groupSummary={(rows) => `${money(sumOf(rows, "total"))} this quarter`}
|
|
342
|
+
groupFooter={sums} totals={sums}
|
|
343
|
+
renderExpanded={(r) => <p className="text-sm">{r.note}</p>}
|
|
344
|
+
canExpand={(r) => Boolean(r.note)}
|
|
345
|
+
defaultSort={[{ key: "total", dir: "desc" }]} />
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
### Buttons in the row
|
|
349
|
+
|
|
350
|
+
Tasks whose actions depend on their state, the common ones as buttons in
|
|
351
|
+
the row and the rest in the menu:
|
|
352
|
+
|
|
353
|
+
```jsx
|
|
354
|
+
<DataTable label="Tasks" noun="task" rows={tasks} columns={COLUMNS}
|
|
355
|
+
rowActions={(t) => [
|
|
356
|
+
t.status === "todo" && { label: "Start", icon: "play", inline: true, onSelect: (r) => setStatus(r, "doing") },
|
|
357
|
+
t.status === "doing" && { label: "Complete", icon: "check", inline: true, onSelect: (r) => setStatus(r, "done") },
|
|
358
|
+
{ label: "Delete", icon: "trash", tone: "danger", inline: true, onSelect: remove }, // async, may return { ok: false, error }
|
|
359
|
+
{ label: "Copy ID", icon: "copy", onSelect: copyId },
|
|
360
|
+
]} />
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
`setStatus` and `remove` return a promise of `{ ok }`, as a Server Action
|
|
364
|
+
does; a failure is said above the table.
|
|
365
|
+
|
|
366
|
+
## What it will not do
|
|
367
|
+
|
|
368
|
+
- Edit a cell in place: open the row (`onRowClick`) in a `Sheet`.
|
|
369
|
+
- Fetch: rows come in as props; with `manual` you read each page.
|
|
370
|
+
- Collapse a group, pin more than the first column, resize or reorder
|
|
371
|
+
columns, or virtualise thousands of rows — page them (`manual`)
|
|
372
|
+
instead.
|
|
373
|
+
- Colour a column: a cell says what it means with kit parts (`Badge`,
|
|
374
|
+
`StatusDot`); a row's tone is `rowTone`, and only for status.
|
|
375
|
+
|
|
376
|
+
A table it cannot be is your own component in `components/`, built from
|
|
377
|
+
the kit's `Table` parts — not an edit to this block. Its files are fixed:
|
|
378
|
+
`npm run check` refuses a change, and `makersclaw add data-table` restores
|
|
379
|
+
them.
|
|
380
|
+
|
|
381
|
+
## Credits
|
|
382
|
+
|
|
383
|
+
The row buttons and the orders example follow blocks.so
|
|
384
|
+
(https://github.com/ephraimduncan/blocks, MIT) and Creative Tim UI
|
|
385
|
+
(https://github.com/creativetimofficial/ui, MIT); this is a rewrite on the
|
|
386
|
+
Makersclaw kit, not their code.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "data-table",
|
|
3
|
+
"title": "Data table",
|
|
4
|
+
"description": "Records as a table the founder can work: sort by a column (shift for several), search every column, faceted filters with counts, column visibility, row selection with a bulk-actions bar, a menu per row or its first actions as buttons in the row (async, with a spinner and a failure notice), row click, pagination with a page size, loading, empty and no-matches states, and cards on a phone. Opt in to expandable rows, row groups with subtotals, an aligned totals row, arrow-key navigation and a sticky first column. Client-side over rows, or driven by a server.",
|
|
5
|
+
"useWhen": "A list of records to scan, find, sort and act on: invoices, customers, orders, leads, users, tickets. Not for records that move through stages (a board), a few key numbers (stats), or a grid of cards whose picture matters more than its columns.",
|
|
6
|
+
"tags": ["table", "data", "records", "list", "grid", "sort", "filter", "search", "facets", "select", "bulk", "pagination", "columns", "crud", "expand", "group", "subtotal", "totals", "keyboard", "sticky", "row actions", "inline actions", "orders"],
|
|
7
|
+
"exports": ["DataTable", "useControllable", "processRows", "sortRows", "searchRows", "filterRows", "facetOptions", "nextSort", "groupRows", "groupValueOf"],
|
|
8
|
+
"files": ["index.js", "data-table.jsx", "model.js"],
|
|
9
|
+
"requires": []
|
|
10
|
+
}
|