basalt-ui 0.4.2 → 1.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/AGENTS.md +70 -0
- package/CHANGELOG.md +199 -41
- package/LICENSE +201 -0
- package/README.md +434 -160
- package/agent/rules/basalt-agent.md +395 -0
- package/agent/rules/basalt-charts.md +170 -0
- package/agent/rules/basalt-commands.md +320 -0
- package/agent/rules/basalt-content.md +390 -0
- package/agent/rules/basalt-data.md +237 -0
- package/agent/rules/basalt-forms.md +186 -0
- package/agent/rules/basalt-mantine.md +327 -0
- package/agent/rules/basalt-notifications.md +264 -0
- package/agent/rules/basalt-query.md +130 -0
- package/agent/rules/basalt-router.md +173 -0
- package/agent/rules/basalt-state.md +99 -0
- package/agent/rules/basalt-tokens.md +148 -0
- package/agent/templates/CLAUDE-block.md.tpl +35 -0
- package/agent/templates/DESIGN.md.tpl +71 -0
- package/agent/templates/__root.tpl +31 -0
- package/agent/templates/query-client.ts.tpl +12 -0
- package/bin/basalt.mjs +14 -0
- package/configs/check.yml +29 -0
- package/configs/lefthook.yml +21 -0
- package/configs/oxfmt.json +8 -0
- package/configs/oxlint-plugin.js +269 -0
- package/configs/oxlint-plugin.test.ts +107 -0
- package/configs/oxlint.json +116 -0
- package/configs/tsconfig.base.json +20 -0
- package/configs/tsconfig.node.json +8 -0
- package/configs/tsconfig.react-app.json +8 -0
- package/dist/agent/ai-sdk-transport.d.ts +85 -0
- package/dist/agent/ai-sdk-transport.d.ts.map +1 -0
- package/dist/agent/ai-sdk-transport.js +109 -0
- package/dist/agent/history.d.ts +55 -0
- package/dist/agent/history.d.ts.map +1 -0
- package/dist/agent/history.js +32 -0
- package/dist/agent/index.d.ts +53 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +23 -0
- package/dist/agent/outcome.d.ts +71 -0
- package/dist/agent/outcome.d.ts.map +1 -0
- package/dist/agent/outcome.js +30 -0
- package/dist/agent/part-list.d.ts +75 -0
- package/dist/agent/part-list.d.ts.map +1 -0
- package/dist/agent/part-list.js +127 -0
- package/dist/agent/parts.d.ts +91 -0
- package/dist/agent/parts.d.ts.map +1 -0
- package/dist/agent/parts.js +49 -0
- package/dist/agent/stick-to-bottom.d.ts +23 -0
- package/dist/agent/stick-to-bottom.d.ts.map +1 -0
- package/dist/agent/stick-to-bottom.js +73 -0
- package/dist/agent/thread.d.ts +124 -0
- package/dist/agent/thread.d.ts.map +1 -0
- package/dist/agent/thread.js +131 -0
- package/dist/agent/transport.d.ts +87 -0
- package/dist/agent/transport.d.ts.map +1 -0
- package/dist/agent/transport.js +21 -0
- package/dist/agent/use-agent-stream.d.ts +34 -0
- package/dist/agent/use-agent-stream.d.ts.map +1 -0
- package/dist/agent/use-agent-stream.js +56 -0
- package/dist/agent/use-agent-thread-runs.d.ts +72 -0
- package/dist/agent/use-agent-thread-runs.d.ts.map +1 -0
- package/dist/agent/use-agent-thread-runs.js +217 -0
- package/dist/agent-chat/composer.d.ts +18 -0
- package/dist/agent-chat/composer.d.ts.map +1 -0
- package/dist/agent-chat/composer.js +86 -0
- package/dist/agent-chat/index.d.ts +24 -0
- package/dist/agent-chat/index.d.ts.map +1 -0
- package/dist/agent-chat/index.js +15 -0
- package/dist/agent-chat/thread-detail-panel.d.ts +27 -0
- package/dist/agent-chat/thread-detail-panel.d.ts.map +1 -0
- package/dist/agent-chat/thread-detail-panel.js +108 -0
- package/dist/agent-chat/thread-feed.d.ts +18 -0
- package/dist/agent-chat/thread-feed.d.ts.map +1 -0
- package/dist/agent-chat/thread-feed.js +42 -0
- package/dist/agent-chat/thread-message.d.ts +31 -0
- package/dist/agent-chat/thread-message.d.ts.map +1 -0
- package/dist/agent-chat/thread-message.js +128 -0
- package/dist/agent-chat/thread-outcome-card.d.ts +19 -0
- package/dist/agent-chat/thread-outcome-card.d.ts.map +1 -0
- package/dist/agent-chat/thread-outcome-card.js +120 -0
- package/dist/agent-chat/thread-workspace.d.ts +27 -0
- package/dist/agent-chat/thread-workspace.d.ts.map +1 -0
- package/dist/agent-chat/thread-workspace.js +95 -0
- package/dist/charts/hooks/useChartSize.d.ts +25 -0
- package/dist/charts/hooks/useChartSize.d.ts.map +1 -0
- package/dist/charts/hooks/useChartSize.js +8 -0
- package/dist/charts/hooks/useChartTooltip.d.ts +13 -0
- package/dist/charts/hooks/useChartTooltip.d.ts.map +1 -0
- package/dist/charts/hooks/useChartTooltip.js +26 -0
- package/dist/charts/hooks/useHoverSync.d.ts +30 -0
- package/dist/charts/hooks/useHoverSync.d.ts.map +1 -0
- package/dist/charts/hooks/useHoverSync.js +70 -0
- package/dist/charts/hover-context.d.ts +21 -0
- package/dist/charts/hover-context.d.ts.map +1 -0
- package/dist/charts/hover-context.js +12 -0
- package/dist/charts/hover-sync.d.ts +14 -0
- package/dist/charts/hover-sync.d.ts.map +1 -0
- package/dist/charts/hover-sync.js +17 -0
- package/dist/charts/index.d.ts +47 -0
- package/dist/charts/index.d.ts.map +1 -0
- package/dist/charts/index.js +129 -0
- package/dist/charts/kinds/Bars.d.ts +129 -0
- package/dist/charts/kinds/Bars.d.ts.map +1 -0
- package/dist/charts/kinds/Bars.js +467 -0
- package/dist/charts/kinds/Donut.d.ts +65 -0
- package/dist/charts/kinds/Donut.d.ts.map +1 -0
- package/dist/charts/kinds/Donut.js +158 -0
- package/dist/charts/kinds/DualPanel.d.ts +67 -0
- package/dist/charts/kinds/DualPanel.d.ts.map +1 -0
- package/dist/charts/kinds/DualPanel.js +326 -0
- package/dist/charts/kinds/Heatmap.d.ts +59 -0
- package/dist/charts/kinds/Heatmap.d.ts.map +1 -0
- package/dist/charts/kinds/Heatmap.js +175 -0
- package/dist/charts/kinds/MultiLine.d.ts +73 -0
- package/dist/charts/kinds/MultiLine.d.ts.map +1 -0
- package/dist/charts/kinds/MultiLine.js +275 -0
- package/dist/charts/kinds/StackedArea.d.ts +35 -0
- package/dist/charts/kinds/StackedArea.d.ts.map +1 -0
- package/dist/charts/kinds/StackedArea.js +151 -0
- package/dist/charts/kinds/ZonedLine.d.ts +94 -0
- package/dist/charts/kinds/ZonedLine.d.ts.map +1 -0
- package/dist/charts/kinds/ZonedLine.js +218 -0
- package/dist/charts/primitives/AreaGradient.d.ts +18 -0
- package/dist/charts/primitives/AreaGradient.d.ts.map +1 -0
- package/dist/charts/primitives/AreaGradient.js +13 -0
- package/dist/charts/primitives/Axes.d.ts +22 -0
- package/dist/charts/primitives/Axes.d.ts.map +1 -0
- package/dist/charts/primitives/Axes.js +79 -0
- package/dist/charts/primitives/ChartCard.d.ts +14 -0
- package/dist/charts/primitives/ChartCard.d.ts.map +1 -0
- package/dist/charts/primitives/ChartCard.js +144 -0
- package/dist/charts/primitives/ChartFrame.d.ts +70 -0
- package/dist/charts/primitives/ChartFrame.d.ts.map +1 -0
- package/dist/charts/primitives/ChartFrame.js +77 -0
- package/dist/charts/primitives/ChartLegend.d.ts +36 -0
- package/dist/charts/primitives/ChartLegend.d.ts.map +1 -0
- package/dist/charts/primitives/ChartLegend.js +234 -0
- package/dist/charts/primitives/ChartTooltip.d.ts +34 -0
- package/dist/charts/primitives/ChartTooltip.d.ts.map +1 -0
- package/dist/charts/primitives/ChartTooltip.js +134 -0
- package/dist/charts/primitives/Crosshair.d.ts +23 -0
- package/dist/charts/primitives/Crosshair.d.ts.map +1 -0
- package/dist/charts/primitives/Crosshair.js +21 -0
- package/dist/charts/primitives/HoverOverlay.d.ts +9 -0
- package/dist/charts/primitives/HoverOverlay.d.ts.map +1 -0
- package/dist/charts/primitives/HoverOverlay.js +21 -0
- package/dist/charts/primitives/ResponsiveChart.d.ts +45 -0
- package/dist/charts/primitives/ResponsiveChart.d.ts.map +1 -0
- package/dist/charts/primitives/ResponsiveChart.js +24 -0
- package/dist/charts/primitives/ZoneRects.d.ts +38 -0
- package/dist/charts/primitives/ZoneRects.d.ts.map +1 -0
- package/dist/charts/primitives/ZoneRects.js +30 -0
- package/dist/charts/series.d.ts +99 -0
- package/dist/charts/series.d.ts.map +1 -0
- package/dist/charts/series.js +55 -0
- package/dist/charts/sparklines/BarSparkline.d.ts +13 -0
- package/dist/charts/sparklines/BarSparkline.d.ts.map +1 -0
- package/dist/charts/sparklines/BarSparkline.js +33 -0
- package/dist/charts/sparklines/LineSparkline.d.ts +15 -0
- package/dist/charts/sparklines/LineSparkline.d.ts.map +1 -0
- package/dist/charts/sparklines/LineSparkline.js +39 -0
- package/dist/charts/sparklines/index.d.ts +3 -0
- package/dist/charts/sparklines/index.d.ts.map +1 -0
- package/dist/charts/sparklines/index.js +6 -0
- package/dist/charts/theme.d.ts +21 -0
- package/dist/charts/theme.d.ts.map +1 -0
- package/dist/charts/theme.js +30 -0
- package/dist/charts/utils/domain.d.ts +20 -0
- package/dist/charts/utils/domain.d.ts.map +1 -0
- package/dist/charts/utils/domain.js +7 -0
- package/dist/charts/utils/format.d.ts +5 -0
- package/dist/charts/utils/format.d.ts.map +1 -0
- package/dist/charts/utils/format.js +27 -0
- package/dist/charts/utils/ticks.d.ts +5 -0
- package/dist/charts/utils/ticks.d.ts.map +1 -0
- package/dist/charts/utils/ticks.js +18 -0
- package/dist/cli/index.d.ts +273 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +907 -0
- package/dist/commands/ShortcutsHelp.d.ts +17 -0
- package/dist/commands/ShortcutsHelp.d.ts.map +1 -0
- package/dist/commands/ShortcutsHelp.js +64 -0
- package/dist/commands/define-commands.d.ts +140 -0
- package/dist/commands/define-commands.d.ts.map +1 -0
- package/dist/commands/define-commands.js +26 -0
- package/dist/commands/define-overlays.d.ts +134 -0
- package/dist/commands/define-overlays.d.ts.map +1 -0
- package/dist/commands/define-overlays.js +53 -0
- package/dist/commands/index.d.ts +42 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +46 -0
- package/dist/commands/overlays-mount.d.ts +117 -0
- package/dist/commands/overlays-mount.d.ts.map +1 -0
- package/dist/commands/overlays-mount.js +116 -0
- package/dist/commands/projectors.d.ts +152 -0
- package/dist/commands/projectors.d.ts.map +1 -0
- package/dist/commands/projectors.js +87 -0
- package/dist/commands/shortcut-format.d.ts +48 -0
- package/dist/commands/shortcut-format.d.ts.map +1 -0
- package/dist/commands/shortcut-format.js +33 -0
- package/dist/commands/useCommandHotkeys.d.ts +14 -0
- package/dist/commands/useCommandHotkeys.d.ts.map +1 -0
- package/dist/commands/useCommandHotkeys.js +45 -0
- package/dist/connectivity/connectivity-indicator.d.ts +8 -0
- package/dist/connectivity/connectivity-indicator.d.ts.map +1 -0
- package/dist/connectivity/connectivity-indicator.js +203 -0
- package/dist/connectivity/connectivity-provider.d.ts +7 -0
- package/dist/connectivity/connectivity-provider.d.ts.map +1 -0
- package/dist/connectivity/connectivity-provider.js +125 -0
- package/dist/connectivity/index.d.ts +13 -0
- package/dist/connectivity/index.d.ts.map +1 -0
- package/dist/connectivity/index.js +8 -0
- package/dist/connectivity/types.d.ts +36 -0
- package/dist/connectivity/types.d.ts.map +1 -0
- package/dist/connectivity/types.js +0 -0
- package/dist/connectivity/use-connectivity.d.ts +3 -0
- package/dist/connectivity/use-connectivity.d.ts.map +1 -0
- package/dist/connectivity/use-connectivity.js +14 -0
- package/dist/content/article-actions.d.ts +39 -0
- package/dist/content/article-actions.d.ts.map +1 -0
- package/dist/content/article-actions.js +28 -0
- package/dist/content/article-card.d.ts +58 -0
- package/dist/content/article-card.d.ts.map +1 -0
- package/dist/content/article-card.js +76 -0
- package/dist/content/article-card.module.css +109 -0
- package/dist/content/article-card.module.css.d.ts +16 -0
- package/dist/content/article-filter-bar.d.ts +40 -0
- package/dist/content/article-filter-bar.d.ts.map +1 -0
- package/dist/content/article-filter-bar.js +56 -0
- package/dist/content/article-layout.d.ts +61 -0
- package/dist/content/article-layout.d.ts.map +1 -0
- package/dist/content/article-layout.js +71 -0
- package/dist/content/article-layout.module.css +131 -0
- package/dist/content/article-layout.module.css.d.ts +20 -0
- package/dist/content/article-model.d.ts +62 -0
- package/dist/content/article-model.d.ts.map +1 -0
- package/dist/content/article-model.js +41 -0
- package/dist/content/block-split.d.ts +24 -0
- package/dist/content/block-split.d.ts.map +1 -0
- package/dist/content/block-split.js +63 -0
- package/dist/content/callout-alert.d.ts +27 -0
- package/dist/content/callout-alert.d.ts.map +1 -0
- package/dist/content/callout-alert.js +59 -0
- package/dist/content/callout.d.ts +24 -0
- package/dist/content/callout.d.ts.map +1 -0
- package/dist/content/callout.js +59 -0
- package/dist/content/callout.module.css +77 -0
- package/dist/content/callout.module.css.d.ts +16 -0
- package/dist/content/code-block.d.ts +26 -0
- package/dist/content/code-block.d.ts.map +1 -0
- package/dist/content/code-block.js +41 -0
- package/dist/content/code-block.module.css +86 -0
- package/dist/content/code-block.module.css.d.ts +14 -0
- package/dist/content/copy-action.d.ts +29 -0
- package/dist/content/copy-action.d.ts.map +1 -0
- package/dist/content/copy-action.js +46 -0
- package/dist/content/fence-block.d.ts +19 -0
- package/dist/content/fence-block.d.ts.map +1 -0
- package/dist/content/fence-block.js +23 -0
- package/dist/content/glyphs.d.ts +18 -0
- package/dist/content/glyphs.d.ts.map +1 -0
- package/dist/content/glyphs.js +43 -0
- package/dist/content/guide.d.ts +47 -0
- package/dist/content/guide.d.ts.map +1 -0
- package/dist/content/guide.js +110 -0
- package/dist/content/guide.module.css +62 -0
- package/dist/content/guide.module.css.d.ts +13 -0
- package/dist/content/heading-anchor.d.ts +8 -0
- package/dist/content/heading-anchor.d.ts.map +1 -0
- package/dist/content/heading-anchor.js +23 -0
- package/dist/content/heading-components.d.ts +5 -0
- package/dist/content/heading-components.d.ts.map +1 -0
- package/dist/content/heading-components.js +41 -0
- package/dist/content/highlighter.d.ts +8 -0
- package/dist/content/highlighter.d.ts.map +1 -0
- package/dist/content/highlighter.js +85 -0
- package/dist/content/index.d.ts +45 -0
- package/dist/content/index.d.ts.map +1 -0
- package/dist/content/index.js +43 -0
- package/dist/content/markdown-hast.d.ts +23 -0
- package/dist/content/markdown-hast.d.ts.map +1 -0
- package/dist/content/markdown-hast.js +48 -0
- package/dist/content/markdown.d.ts +68 -0
- package/dist/content/markdown.d.ts.map +1 -0
- package/dist/content/markdown.js +180 -0
- package/dist/content/mdx.d.ts +20 -0
- package/dist/content/mdx.d.ts.map +1 -0
- package/dist/content/mdx.js +64 -0
- package/dist/content/mermaid.d.ts +32 -0
- package/dist/content/mermaid.d.ts.map +1 -0
- package/dist/content/mermaid.js +70 -0
- package/dist/content/mermaid.module.css +20 -0
- package/dist/content/mermaid.module.css.d.ts +8 -0
- package/dist/content/prose.d.ts +29 -0
- package/dist/content/prose.d.ts.map +1 -0
- package/dist/content/prose.js +24 -0
- package/dist/content/prose.module.css +330 -0
- package/dist/content/prose.module.css.d.ts +12 -0
- package/dist/content/reading-progress.d.ts +20 -0
- package/dist/content/reading-progress.d.ts.map +1 -0
- package/dist/content/reading-progress.js +38 -0
- package/dist/content/reading-progress.module.css +22 -0
- package/dist/content/reading-progress.module.css.d.ts +9 -0
- package/dist/content/slug.d.ts +28 -0
- package/dist/content/slug.d.ts.map +1 -0
- package/dist/content/slug.js +28 -0
- package/dist/content/toc.d.ts +37 -0
- package/dist/content/toc.d.ts.map +1 -0
- package/dist/content/toc.js +134 -0
- package/dist/content/toc.module.css +51 -0
- package/dist/content/toc.module.css.d.ts +13 -0
- package/dist/content/url-hardening.d.ts +23 -0
- package/dist/content/url-hardening.d.ts.map +1 -0
- package/dist/content/url-hardening.js +23 -0
- package/dist/dashboard/delta-badge.d.ts +13 -0
- package/dist/dashboard/delta-badge.d.ts.map +1 -0
- package/dist/dashboard/delta-badge.js +45 -0
- package/dist/dashboard/empty-state.d.ts +15 -0
- package/dist/dashboard/empty-state.d.ts.map +1 -0
- package/dist/dashboard/empty-state.js +56 -0
- package/dist/dashboard/index.d.ts +5 -0
- package/dist/dashboard/index.d.ts.map +1 -0
- package/dist/dashboard/index.js +16 -0
- package/dist/dashboard/settings-section.d.ts +24 -0
- package/dist/dashboard/settings-section.d.ts.map +1 -0
- package/dist/dashboard/settings-section.js +61 -0
- package/dist/dashboard/settings-section.module.css +23 -0
- package/dist/dashboard/settings-section.module.css.d.ts +10 -0
- package/dist/dashboard/stat-card.d.ts +18 -0
- package/dist/dashboard/stat-card.d.ts.map +1 -0
- package/dist/dashboard/stat-card.js +74 -0
- package/dist/data/data-table.d.ts +198 -0
- package/dist/data/data-table.d.ts.map +1 -0
- package/dist/data/data-table.js +342 -0
- package/dist/data/index.d.ts +34 -0
- package/dist/data/index.d.ts.map +1 -0
- package/dist/data/index.js +2 -0
- package/dist/data/table.d.ts +24 -0
- package/dist/data/table.d.ts.map +1 -0
- package/dist/data/table.js +20 -0
- package/dist/data/virtual-list.d.ts +74 -0
- package/dist/data/virtual-list.d.ts.map +1 -0
- package/dist/data/virtual-list.js +86 -0
- package/dist/data/virtual.d.ts +20 -0
- package/dist/data/virtual.d.ts.map +1 -0
- package/dist/data/virtual.js +4 -0
- package/dist/forms/FormErrorSummary.d.ts +29 -0
- package/dist/forms/FormErrorSummary.d.ts.map +1 -0
- package/dist/forms/FormErrorSummary.js +28 -0
- package/dist/forms/create-form.d.ts +31 -0
- package/dist/forms/create-form.d.ts.map +1 -0
- package/dist/forms/create-form.js +18 -0
- package/dist/forms/field.d.ts +22 -0
- package/dist/forms/field.d.ts.map +1 -0
- package/dist/forms/field.js +9 -0
- package/dist/forms/index.d.ts +17 -0
- package/dist/forms/index.d.ts.map +1 -0
- package/dist/forms/index.js +13 -0
- package/dist/forms/use-form-draft.d.ts +61 -0
- package/dist/forms/use-form-draft.d.ts.map +1 -0
- package/dist/forms/use-form-draft.js +55 -0
- package/dist/guard/guard-hook.d.ts +40 -0
- package/dist/guard/guard-hook.d.ts.map +1 -0
- package/dist/guard/guard-hook.js +55 -0
- package/dist/guard/index.d.ts +144 -0
- package/dist/guard/index.d.ts.map +1 -0
- package/dist/guard/index.js +315 -0
- package/dist/guard/types.d.ts +97 -0
- package/dist/guard/types.d.ts.map +1 -0
- package/dist/guard/types.js +0 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +90 -0
- package/dist/motion/index.d.ts +29 -0
- package/dist/motion/index.d.ts.map +1 -0
- package/dist/motion/index.js +12 -0
- package/dist/notifications/bell.d.ts +12 -0
- package/dist/notifications/bell.d.ts.map +1 -0
- package/dist/notifications/bell.js +84 -0
- package/dist/notifications/center.d.ts +20 -0
- package/dist/notifications/center.d.ts.map +1 -0
- package/dist/notifications/center.js +144 -0
- package/dist/notifications/define-notifications.d.ts +97 -0
- package/dist/notifications/define-notifications.d.ts.map +1 -0
- package/dist/notifications/define-notifications.js +27 -0
- package/dist/notifications/index.d.ts +36 -0
- package/dist/notifications/index.d.ts.map +1 -0
- package/dist/notifications/index.js +52 -0
- package/dist/notifications/notify.d.ts +92 -0
- package/dist/notifications/notify.d.ts.map +1 -0
- package/dist/notifications/notify.js +127 -0
- package/dist/notifications/overlay.d.ts +20 -0
- package/dist/notifications/overlay.d.ts.map +1 -0
- package/dist/notifications/overlay.js +12 -0
- package/dist/notifications/store.d.ts +120 -0
- package/dist/notifications/store.d.ts.map +1 -0
- package/dist/notifications/store.js +113 -0
- package/dist/provider/index.d.ts +93 -0
- package/dist/provider/index.d.ts.map +1 -0
- package/dist/provider/index.js +106 -0
- package/dist/query/devtools.d.ts +21 -0
- package/dist/query/devtools.d.ts.map +1 -0
- package/dist/query/devtools.js +12 -0
- package/dist/query/index.d.ts +65 -0
- package/dist/query/index.d.ts.map +1 -0
- package/dist/query/index.js +68 -0
- package/dist/register.d.ts +139 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.js +6 -0
- package/dist/router-tanstack/index.d.ts +74 -0
- package/dist/router-tanstack/index.d.ts.map +1 -0
- package/dist/router-tanstack/index.js +29 -0
- package/dist/router-tanstack/multi-search-param-store.d.ts +78 -0
- package/dist/router-tanstack/multi-search-param-store.d.ts.map +1 -0
- package/dist/router-tanstack/multi-search-param-store.js +35 -0
- package/dist/router-tanstack/search-param-store.d.ts +92 -0
- package/dist/router-tanstack/search-param-store.d.ts.map +1 -0
- package/dist/router-tanstack/search-param-store.js +26 -0
- package/dist/shell/account-types.d.ts +118 -0
- package/dist/shell/account-types.d.ts.map +1 -0
- package/dist/shell/account-types.js +0 -0
- package/dist/shell/app-breadcrumbs.d.ts +17 -0
- package/dist/shell/app-breadcrumbs.d.ts.map +1 -0
- package/dist/shell/app-breadcrumbs.js +39 -0
- package/dist/shell/app-header.module.css +73 -0
- package/dist/shell/app-header.module.css.d.ts +11 -0
- package/dist/shell/app-mobile-nav.d.ts +26 -0
- package/dist/shell/app-mobile-nav.d.ts.map +1 -0
- package/dist/shell/app-mobile-nav.js +106 -0
- package/dist/shell/app-mobile-nav.module.css +100 -0
- package/dist/shell/app-mobile-nav.module.css.d.ts +14 -0
- package/dist/shell/app-sidebar-account.d.ts +3 -0
- package/dist/shell/app-sidebar-account.d.ts.map +1 -0
- package/dist/shell/app-sidebar-account.js +84 -0
- package/dist/shell/app-sidebar.d.ts +56 -0
- package/dist/shell/app-sidebar.d.ts.map +1 -0
- package/dist/shell/app-sidebar.js +455 -0
- package/dist/shell/app-sidebar.module.css +414 -0
- package/dist/shell/app-sidebar.module.css.d.ts +34 -0
- package/dist/shell/index.d.ts +123 -0
- package/dist/shell/index.d.ts.map +1 -0
- package/dist/shell/index.js +179 -0
- package/dist/shell/page-header.d.ts +13 -0
- package/dist/shell/page-header.d.ts.map +1 -0
- package/dist/shell/page-header.js +23 -0
- package/dist/shell/sidebar-search.d.ts +12 -0
- package/dist/shell/sidebar-search.d.ts.map +1 -0
- package/dist/shell/sidebar-search.js +62 -0
- package/dist/shell/sidebar-search.module.css +62 -0
- package/dist/shell/sidebar-search.module.css.d.ts +11 -0
- package/dist/state.d.ts +62 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/state.js +124 -0
- package/dist/styles.css +166 -0
- package/dist/surfaces.d.ts +376 -0
- package/dist/surfaces.d.ts.map +1 -0
- package/dist/surfaces.js +306 -0
- package/dist/theme/controls.module.css +143 -0
- package/dist/theme/controls.module.css.d.ts +17 -0
- package/dist/theme/floating.module.css +35 -0
- package/dist/theme/floating.module.css.d.ts +9 -0
- package/dist/theme/index.d.ts +22 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +733 -0
- package/dist/theme/nav-link.module.css +67 -0
- package/dist/theme/nav-link.module.css.d.ts +8 -0
- package/dist/theme/segmented-control.module.css +14 -0
- package/dist/theme/segmented-control.module.css.d.ts +8 -0
- package/dist/theme/timeline.module.css +29 -0
- package/dist/theme/timeline.module.css.d.ts +9 -0
- package/dist/theme-lab/index.d.ts +59 -0
- package/dist/theme-lab/index.d.ts.map +1 -0
- package/dist/theme-lab/index.js +263 -0
- package/dist/theme-toggle/index.d.ts +8 -0
- package/dist/theme-toggle/index.d.ts.map +1 -0
- package/dist/theme-toggle/index.js +155 -0
- package/dist/tokens/index.d.ts +151 -0
- package/dist/tokens/index.d.ts.map +1 -0
- package/dist/tokens/index.js +246 -0
- package/dist/tokens/palette.d.ts +304 -0
- package/dist/tokens/palette.d.ts.map +1 -0
- package/dist/tokens/palette.js +186 -0
- package/dist/vite.d.ts +30 -0
- package/dist/vite.d.ts.map +1 -0
- package/dist/vite.js +68 -0
- package/llms.txt +149 -0
- package/package.json +243 -46
- package/src/agent/ai-sdk-transport.ts +280 -0
- package/src/agent/history.ts +128 -0
- package/src/agent/index.ts +92 -0
- package/src/agent/outcome.ts +120 -0
- package/src/agent/part-list.tsx +292 -0
- package/src/agent/parts.ts +136 -0
- package/src/agent/stick-to-bottom.tsx +154 -0
- package/src/agent/thread.ts +312 -0
- package/src/agent/transport.ts +114 -0
- package/src/agent/use-agent-stream.ts +141 -0
- package/src/agent/use-agent-thread-runs.ts +440 -0
- package/src/agent-chat/composer.tsx +131 -0
- package/src/agent-chat/index.ts +35 -0
- package/src/agent-chat/thread-detail-panel.tsx +192 -0
- package/src/agent-chat/thread-feed.tsx +81 -0
- package/src/agent-chat/thread-message.tsx +251 -0
- package/src/agent-chat/thread-outcome-card.tsx +196 -0
- package/src/agent-chat/thread-workspace.tsx +179 -0
- package/src/charts/hooks/useChartSize.ts +31 -0
- package/src/charts/hooks/useChartTooltip.ts +31 -0
- package/src/charts/hooks/useHoverSync.ts +116 -0
- package/src/charts/hover-context.ts +28 -0
- package/src/charts/hover-sync.tsx +37 -0
- package/src/charts/index.ts +118 -0
- package/src/charts/kinds/Bars.tsx +634 -0
- package/src/charts/kinds/Donut.tsx +233 -0
- package/src/charts/kinds/DualPanel.tsx +432 -0
- package/src/charts/kinds/Heatmap.tsx +255 -0
- package/src/charts/kinds/MultiLine.tsx +376 -0
- package/src/charts/kinds/StackedArea.tsx +218 -0
- package/src/charts/kinds/ZonedLine.tsx +346 -0
- package/src/charts/primitives/AreaGradient.tsx +26 -0
- package/src/charts/primitives/Axes.tsx +97 -0
- package/src/charts/primitives/ChartCard.tsx +180 -0
- package/src/charts/primitives/ChartFrame.tsx +157 -0
- package/src/charts/primitives/ChartLegend.tsx +302 -0
- package/src/charts/primitives/ChartTooltip.tsx +158 -0
- package/src/charts/primitives/Crosshair.tsx +40 -0
- package/src/charts/primitives/HoverOverlay.tsx +24 -0
- package/src/charts/primitives/ResponsiveChart.tsx +64 -0
- package/src/charts/primitives/ZoneRects.tsx +67 -0
- package/src/charts/series.ts +163 -0
- package/src/charts/sparklines/BarSparkline.tsx +48 -0
- package/src/charts/sparklines/LineSparkline.tsx +57 -0
- package/src/charts/sparklines/index.ts +2 -0
- package/src/charts/theme.tsx +53 -0
- package/src/charts/utils/domain.test.ts +24 -0
- package/src/charts/utils/domain.ts +22 -0
- package/src/charts/utils/format.ts +27 -0
- package/src/charts/utils/ticks.ts +18 -0
- package/src/cli/check-theme.test.ts +658 -0
- package/src/cli/index.ts +1497 -0
- package/src/cli/init-sync.test.ts +160 -0
- package/src/commands/ShortcutsHelp.tsx +129 -0
- package/src/commands/define-commands.ts +184 -0
- package/src/commands/define-overlays.ts +197 -0
- package/src/commands/index.ts +86 -0
- package/src/commands/overlays-mount.tsx +301 -0
- package/src/commands/projectors.ts +267 -0
- package/src/commands/shortcut-format.ts +83 -0
- package/src/commands/useCommandHotkeys.ts +114 -0
- package/src/connectivity/connectivity-indicator.tsx +249 -0
- package/src/connectivity/connectivity-provider.tsx +186 -0
- package/src/connectivity/index.ts +18 -0
- package/src/connectivity/types.ts +39 -0
- package/src/connectivity/use-connectivity.ts +25 -0
- package/src/content/article-actions.test.ts +78 -0
- package/src/content/article-actions.ts +72 -0
- package/src/content/article-card.module.css +109 -0
- package/src/content/article-card.module.css.d.ts +16 -0
- package/src/content/article-card.tsx +173 -0
- package/src/content/article-filter-bar.tsx +88 -0
- package/src/content/article-layout.module.css +131 -0
- package/src/content/article-layout.module.css.d.ts +20 -0
- package/src/content/article-layout.tsx +167 -0
- package/src/content/article-model.test.ts +119 -0
- package/src/content/article-model.ts +110 -0
- package/src/content/block-split.test.ts +75 -0
- package/src/content/block-split.ts +102 -0
- package/src/content/callout-alert.ts +88 -0
- package/src/content/callout.module.css +77 -0
- package/src/content/callout.module.css.d.ts +16 -0
- package/src/content/callout.tsx +96 -0
- package/src/content/code-block.module.css +86 -0
- package/src/content/code-block.module.css.d.ts +14 -0
- package/src/content/code-block.tsx +82 -0
- package/src/content/copy-action.tsx +79 -0
- package/src/content/fence-block.tsx +39 -0
- package/src/content/glyphs.tsx +53 -0
- package/src/content/guide.module.css +62 -0
- package/src/content/guide.module.css.d.ts +13 -0
- package/src/content/guide.tsx +174 -0
- package/src/content/heading-anchor.tsx +54 -0
- package/src/content/heading-components.tsx +62 -0
- package/src/content/highlighter.ts +123 -0
- package/src/content/index.ts +60 -0
- package/src/content/markdown-hast.ts +80 -0
- package/src/content/markdown.tsx +346 -0
- package/src/content/mdx.tsx +127 -0
- package/src/content/mermaid.module.css +20 -0
- package/src/content/mermaid.module.css.d.ts +8 -0
- package/src/content/mermaid.tsx +124 -0
- package/src/content/prose.module.css +330 -0
- package/src/content/prose.module.css.d.ts +12 -0
- package/src/content/prose.tsx +53 -0
- package/src/content/reading-progress.module.css +22 -0
- package/src/content/reading-progress.module.css.d.ts +9 -0
- package/src/content/reading-progress.tsx +67 -0
- package/src/content/slug.test.ts +62 -0
- package/src/content/slug.ts +57 -0
- package/src/content/toc.module.css +51 -0
- package/src/content/toc.module.css.d.ts +13 -0
- package/src/content/toc.tsx +226 -0
- package/src/content/url-hardening.ts +46 -0
- package/src/dashboard/delta-badge.tsx +70 -0
- package/src/dashboard/empty-state.tsx +80 -0
- package/src/dashboard/index.ts +11 -0
- package/src/dashboard/settings-section.module.css +23 -0
- package/src/dashboard/settings-section.module.css.d.ts +10 -0
- package/src/dashboard/settings-section.tsx +118 -0
- package/src/dashboard/stat-card.tsx +105 -0
- package/src/data/data-table.tsx +695 -0
- package/src/data/index.ts +37 -0
- package/src/data/table.ts +46 -0
- package/src/data/virtual-list.tsx +180 -0
- package/src/data/virtual.ts +21 -0
- package/src/forms/FormErrorSummary.tsx +64 -0
- package/src/forms/create-form.ts +57 -0
- package/src/forms/field.ts +30 -0
- package/src/forms/index.ts +26 -0
- package/src/forms/use-form-draft.ts +170 -0
- package/src/guard/check-source.test.ts +834 -0
- package/src/guard/guard-hook.test.ts +173 -0
- package/src/guard/guard-hook.ts +122 -0
- package/src/guard/index.ts +510 -0
- package/src/guard/types.ts +117 -0
- package/src/index.ts +139 -0
- package/src/motion/index.ts +26 -0
- package/src/notifications/bell.tsx +108 -0
- package/src/notifications/center.tsx +245 -0
- package/src/notifications/define-notifications.ts +162 -0
- package/src/notifications/index.ts +79 -0
- package/src/notifications/notify.tsx +260 -0
- package/src/notifications/overlay.tsx +64 -0
- package/src/notifications/store.ts +287 -0
- package/src/provider/index.tsx +234 -0
- package/src/query/devtools.tsx +38 -0
- package/src/query/index.ts +129 -0
- package/src/register.ts +158 -0
- package/src/router-tanstack/index.ts +111 -0
- package/src/router-tanstack/multi-search-param-store.test.ts +56 -0
- package/src/router-tanstack/multi-search-param-store.ts +122 -0
- package/src/router-tanstack/search-param-store.ts +125 -0
- package/src/shell/account-types.ts +119 -0
- package/src/shell/app-breadcrumbs.tsx +90 -0
- package/src/shell/app-header.module.css +73 -0
- package/src/shell/app-header.module.css.d.ts +11 -0
- package/src/shell/app-mobile-nav.module.css +100 -0
- package/src/shell/app-mobile-nav.module.css.d.ts +14 -0
- package/src/shell/app-mobile-nav.tsx +146 -0
- package/src/shell/app-sidebar-account.tsx +142 -0
- package/src/shell/app-sidebar.module.css +414 -0
- package/src/shell/app-sidebar.module.css.d.ts +34 -0
- package/src/shell/app-sidebar.tsx +632 -0
- package/src/shell/index.tsx +343 -0
- package/src/shell/page-header.tsx +35 -0
- package/src/shell/sidebar-search.module.css +62 -0
- package/src/shell/sidebar-search.module.css.d.ts +11 -0
- package/src/shell/sidebar-search.tsx +80 -0
- package/src/state.ts +246 -0
- package/src/styles.css +166 -0
- package/src/styles.floor.test.ts +36 -0
- package/src/surfaces.ts +489 -0
- package/src/theme/border-coverage.test.ts +272 -0
- package/src/theme/contrast.test.ts +306 -0
- package/src/theme/controls.module.css +143 -0
- package/src/theme/controls.module.css.d.ts +17 -0
- package/src/theme/floating.module.css +35 -0
- package/src/theme/floating.module.css.d.ts +9 -0
- package/src/theme/index.ts +933 -0
- package/src/theme/nav-link.module.css +67 -0
- package/src/theme/nav-link.module.css.d.ts +8 -0
- package/src/theme/segmented-control.module.css +14 -0
- package/src/theme/segmented-control.module.css.d.ts +8 -0
- package/src/theme/shadow-surfaces.test.ts +421 -0
- package/src/theme/timeline.module.css +29 -0
- package/src/theme/timeline.module.css.d.ts +9 -0
- package/src/theme-lab/index.tsx +359 -0
- package/src/theme-lab/theme-lab.test.ts +60 -0
- package/src/theme-toggle/index.tsx +180 -0
- package/src/tokens/index.ts +363 -0
- package/src/tokens/palette.ts +288 -0
- package/src/vite.ts +122 -0
- package/src/index.css +0 -877
- package/src/starlight.css +0 -308
- package/tailwind.config.js +0 -78
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
---
|
|
2
|
+
source: basalt-ui
|
|
3
|
+
description: Mantine form conventions for basalt-ui apps — useBasaltForm, field, FormErrorSummary, useFormDraft from the shipped ./forms battery. @mantine/form is an optional peer.
|
|
4
|
+
paths:
|
|
5
|
+
- 'src/**'
|
|
6
|
+
- 'apps/**/src/**'
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Basalt Forms
|
|
10
|
+
|
|
11
|
+
basalt-ui ships `./forms` — a Mantine form adapter battery providing `useBasaltForm`, `field`,
|
|
12
|
+
`FormErrorSummary`, and `useFormDraft` on top of `@mantine/form`. `@mantine/form` is an **optional
|
|
13
|
+
peer** — install it explicitly before using this battery:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
bun add @mantine/form
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Valibot is the default validation library (install it too: `bun add valibot`). Zod 4 works if
|
|
20
|
+
already standardised in the project.
|
|
21
|
+
|
|
22
|
+
## useBasaltForm
|
|
23
|
+
|
|
24
|
+
`useBasaltForm` is a typed `useForm` wrapper that applies basalt defaults — `mode: 'uncontrolled'`
|
|
25
|
+
and `schemaResolver(schema, { sync: true })` when a schema is provided.
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import * as v from 'valibot'
|
|
29
|
+
import { useBasaltForm, field } from 'basalt-ui/forms'
|
|
30
|
+
import { TextInput, NumberInput, Button } from '@mantine/core'
|
|
31
|
+
|
|
32
|
+
const Schema = v.object({
|
|
33
|
+
name: v.pipe(v.string(), v.minLength(2, 'Name must be at least 2 characters')),
|
|
34
|
+
email: v.pipe(v.string(), v.email('Enter a valid email')),
|
|
35
|
+
amount: v.pipe(v.number(), v.minValue(0, 'Amount must be non-negative')),
|
|
36
|
+
})
|
|
37
|
+
type Values = v.InferOutput<typeof Schema>
|
|
38
|
+
const INITIAL: Values = { name: '', email: '', amount: 0 }
|
|
39
|
+
|
|
40
|
+
function MyForm() {
|
|
41
|
+
const form = useBasaltForm({ initialValues: INITIAL, schema: Schema })
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<form onSubmit={form.onSubmit((values) => console.log(values))}>
|
|
45
|
+
<TextInput {...field(form, 'name')} label="Name" />
|
|
46
|
+
<TextInput {...field(form, 'email')} label="Email" />
|
|
47
|
+
<NumberInput {...field(form, 'amount')} label="Amount" />
|
|
48
|
+
<Button type="submit">Submit</Button>
|
|
49
|
+
</form>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
- **`mode: 'uncontrolled'`** is the default — avoids per-keystroke re-renders. Pass
|
|
55
|
+
`mode: 'controlled'` if real-time derived state is needed.
|
|
56
|
+
- **Schema param** types against `StandardSchemaV1` from `basalt-ui` (vendored spec, not a package).
|
|
57
|
+
A real Valibot or Zod 4 schema is structurally assignable — no wrapper needed.
|
|
58
|
+
- **`{ sync: true }`** keeps `form.validate()` / `form.isValid()` synchronous for sync schemas.
|
|
59
|
+
Omit only when the schema has async refinements.
|
|
60
|
+
|
|
61
|
+
## field
|
|
62
|
+
|
|
63
|
+
`field(form, path)` bundles `getInputProps(path)` + `key(path)` into one spread — the two things
|
|
64
|
+
every Mantine v9 uncontrolled field requires:
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
<TextInput {...field(form, 'email')} label="Email" />
|
|
68
|
+
// equivalent to:
|
|
69
|
+
<TextInput {...form.getInputProps('email')} key={form.key('email')} label="Email" />
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## schemaResolver options
|
|
73
|
+
|
|
74
|
+
- **`{ sync: true }`** — required for sync schemas (Zod 4, Valibot, ArkType). Keeps
|
|
75
|
+
`form.validate()` and `form.isValid()` synchronous.
|
|
76
|
+
- **Zod 4** — `import { z } from 'zod'`. Zod 4's root export implements Standard Schema natively.
|
|
77
|
+
- **Valibot** — `import * as v from 'valibot'`. No separate resolver needed; the object schema
|
|
78
|
+
is directly assignable to `StandardSchemaV1`.
|
|
79
|
+
- **ArkType**, **Effect/Schema** — also implement Standard Schema natively.
|
|
80
|
+
- Type schema params against `StandardSchemaV1` from `basalt-ui` (never `ZodSchema`).
|
|
81
|
+
|
|
82
|
+
## FormErrorSummary
|
|
83
|
+
|
|
84
|
+
An accessible error-summary component for long forms and screen readers. Renders a Mantine `Alert`
|
|
85
|
+
with `role="alert"` listing all field errors. Returns `null` when the form is clean.
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
import { FormErrorSummary } from 'basalt-ui/forms'
|
|
89
|
+
|
|
90
|
+
// Place at the top of the form so screen readers announce errors on submit:
|
|
91
|
+
;<form onSubmit={form.onSubmit(handleSubmit)}>
|
|
92
|
+
<FormErrorSummary form={form} title="Fix these before submitting" />
|
|
93
|
+
{/* fields */}
|
|
94
|
+
</form>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
- Place at the **top of the form** so AT focus moves to the summary on submit failure.
|
|
98
|
+
- `title` defaults to `"Please fix the following errors"`.
|
|
99
|
+
- Renders `null` (no DOM node) when `form.errors` is empty — safe to include unconditionally.
|
|
100
|
+
|
|
101
|
+
## useFormDraft
|
|
102
|
+
|
|
103
|
+
`useFormDraft` persists form values to `localStorage` via `createPersistedState` (versioned,
|
|
104
|
+
SSR-safe, cross-tab). It restores the draft on mount and exposes `clearDraft` + `saveDraft`.
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
import { useBasaltForm, field, FormErrorSummary, useFormDraft } from 'basalt-ui/forms'
|
|
108
|
+
import { Button, TextInput } from '@mantine/core'
|
|
109
|
+
|
|
110
|
+
const INITIAL: Values = { name: '', email: '' }
|
|
111
|
+
|
|
112
|
+
function EditForm() {
|
|
113
|
+
const { clearDraft, saveDraft } = useFormDraft(form, { key: 'edit-form', version: 1 })
|
|
114
|
+
|
|
115
|
+
// Wire saveDraft into useBasaltForm's onValuesChange for automatic autosave:
|
|
116
|
+
const form = useBasaltForm({
|
|
117
|
+
initialValues: INITIAL,
|
|
118
|
+
schema: Schema,
|
|
119
|
+
onValuesChange: saveDraft, // ← automatic autosave on every field change
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<form
|
|
124
|
+
onSubmit={form.onSubmit((values) => {
|
|
125
|
+
submit(values)
|
|
126
|
+
clearDraft() // ← clear on success
|
|
127
|
+
})}
|
|
128
|
+
>
|
|
129
|
+
<FormErrorSummary form={form} />
|
|
130
|
+
<TextInput {...field(form, 'name')} label="Name" />
|
|
131
|
+
<Button type="submit">Submit</Button>
|
|
132
|
+
<Button variant="subtle" onClick={clearDraft}>Discard draft</Button>
|
|
133
|
+
</form>
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Autosave mechanism
|
|
139
|
+
|
|
140
|
+
`@mantine/form` v9 has no built-in whole-form change subscription on an existing form instance —
|
|
141
|
+
`form.watch` is per-field only. The correct autosave paths are:
|
|
142
|
+
|
|
143
|
+
1. **`useBasaltForm({ onValuesChange: saveDraft })`** (recommended) — `onValuesChange` fires on every
|
|
144
|
+
value change with `(values, previous)`. Pass `saveDraft` directly (it snapshots `form.getValues()`
|
|
145
|
+
internally).
|
|
146
|
+
2. **`<TextInput {...field(form, 'name')} onBlur={saveDraft} />`** — explicit blur-based autosave.
|
|
147
|
+
Use this for externally-created forms or when keystroke-level persistence is too aggressive.
|
|
148
|
+
|
|
149
|
+
### Key must be stable
|
|
150
|
+
|
|
151
|
+
The `key` option must not change between renders. Changing it recreates the storage instance and
|
|
152
|
+
loses the current draft. Use a module-level constant or a prop passed down from the route.
|
|
153
|
+
|
|
154
|
+
### Version bump
|
|
155
|
+
|
|
156
|
+
Increment `version` when the form values shape changes (added/removed fields, renamed keys). The
|
|
157
|
+
draft is automatically discarded and falls back to `initialValues` — no migration needed for simple
|
|
158
|
+
shape changes.
|
|
159
|
+
|
|
160
|
+
### clearDraft on success
|
|
161
|
+
|
|
162
|
+
Always call `clearDraft()` in `onSubmit`'s success path so stale form data doesn't reappear after
|
|
163
|
+
a successful save:
|
|
164
|
+
|
|
165
|
+
```ts
|
|
166
|
+
form.onSubmit(async (values) => {
|
|
167
|
+
await mutation.mutateAsync(values)
|
|
168
|
+
clearDraft()
|
|
169
|
+
})
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## List helpers
|
|
173
|
+
|
|
174
|
+
For dynamic lists: `form.insertListItem('items', {...})` / `form.removeListItem('items', index)`.
|
|
175
|
+
Access via `form.getValues().items[index]` (uncontrolled) and bind with
|
|
176
|
+
`form.getInputProps('items.0.field')` / `field(form, 'items.0.field')`.
|
|
177
|
+
|
|
178
|
+
## Submission
|
|
179
|
+
|
|
180
|
+
```ts
|
|
181
|
+
form.onSubmit((values) => mutation.mutate(values))
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Reset after success with `form.reset()` — never mutate `form.values` directly. Surface validation
|
|
185
|
+
as inline field errors via `getInputProps`; toast only on submit-level failures.
|
|
186
|
+
See basalt-query.md for the mutation/invalidation pattern.
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
---
|
|
2
|
+
source: basalt-ui
|
|
3
|
+
description: Mantine v9 usage conventions for basalt-ui apps — provider order, the Vx bridge, component defaults, and interaction feedback. Partly enforced by-construction via createBasaltTheme.
|
|
4
|
+
paths:
|
|
5
|
+
- 'src/**'
|
|
6
|
+
- 'apps/**/src/**'
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Basalt Mantine — Usage Conventions
|
|
10
|
+
|
|
11
|
+
basalt-ui is a framework for Mantine v9 apps. `createBasaltTheme` and `BasaltProvider` encode most of
|
|
12
|
+
the theming opinion **by construction** — this rule covers the conventions the framework can't enforce
|
|
13
|
+
in code.
|
|
14
|
+
|
|
15
|
+
## Provider order
|
|
16
|
+
|
|
17
|
+
Mount `BasaltProvider` (which wraps `MantineProvider` + injects the palette `<style>` + bridges the Vx
|
|
18
|
+
tokens) at the top of the tree, before the router. A typical `main.tsx` stack, top to bottom:
|
|
19
|
+
|
|
20
|
+
1. `BasaltProvider` (Mantine + palette CSS + Vx bridge; pass `theme={createBasaltTheme(overrides)}`)
|
|
21
|
+
2. `Notifications` (from `@mantine/notifications`) — optional
|
|
22
|
+
3. `ModalsProvider` (from `@mantine/modals`) — optional
|
|
23
|
+
4. data layer (e.g. `QueryClientProvider`)
|
|
24
|
+
5. `RouterProvider`
|
|
25
|
+
|
|
26
|
+
Never wrap `BasaltProvider` inside the router — Mantine's context must be available before any route
|
|
27
|
+
renders.
|
|
28
|
+
|
|
29
|
+
## Theming
|
|
30
|
+
|
|
31
|
+
- Use `createBasaltTheme(overrides?)` for the theme — it merges your overrides over `baseTheme`
|
|
32
|
+
(last-wins), so you can retune any field without forking. Don't hand-build `createTheme`.
|
|
33
|
+
- The theme reskins **every** Mantine accent to the modern-zinc identity (`docs/DESIGN-SPEC.md` in
|
|
34
|
+
the basalt-ui repo) —
|
|
35
|
+
**cool-neutral zinc** ramps on both light and dark — plus a **single saturated sky-blue accent**
|
|
36
|
+
— split by role: as INK (links, active-nav icon, chart lines, focus ring) `#0077bd` light /
|
|
37
|
+
`#8ec5ff` dark; as a FILLED SURFACE `#0077bd` in BOTH schemes with a white label — and binds
|
|
38
|
+
Mantine's surface vars AND its color families to the same `--vx-*` tokens
|
|
39
|
+
the charts use (`cssVariablesResolver`, pre-wired in `BasaltProvider`), so chrome and charts share
|
|
40
|
+
one scheme-reactive identity. (Blueprint / Basalt zinc-charcoal are the historical hue-tuning
|
|
41
|
+
ancestors; `docs/DESIGN-SPEC.md` in the basalt-ui repo supersedes both.) Don't add a second
|
|
42
|
+
`cssVariablesResolver`.
|
|
43
|
+
- Color scheme: read/write via `useMantineColorScheme()`. **Never** read the color scheme from
|
|
44
|
+
localStorage directly, and never `localStorage.getItem('theme')` — see basalt-state.md.
|
|
45
|
+
- Owned `spacing`/`radius` scales and the `fontWeights` ladder live in the theme — consume them as
|
|
46
|
+
tokens (`p="md"`, `radius="sm"`, `fw="semibold"`), not raw numbers (see basalt-tokens.md).
|
|
47
|
+
|
|
48
|
+
## Color & accent restraint
|
|
49
|
+
|
|
50
|
+
Restraint is the #1 lever — neutrals carry the surface, the accent only points. The palette is
|
|
51
|
+
**one saturated sky-blue accent** over cool-neutral zinc; the neutrals do ~90% of the work
|
|
52
|
+
(60/30/10, pushed toward 90/10).
|
|
53
|
+
|
|
54
|
+
- **The accent appears ONLY on**: the primary data series, active-nav **icons** and active **child**
|
|
55
|
+
labels, links, primary buttons, focus rings, and the leader bar in meters. It does **NOT** appear
|
|
56
|
+
on borders, large fills, every icon, or secondary/routine buttons. Don't flood blue — "ink earns
|
|
57
|
+
its color."
|
|
58
|
+
- **Active nav = panel bg + `shadow-card`** + an **accent-colored icon** + weight-600 ink text.
|
|
59
|
+
Inactive = muted text, faint icon; hover = ink-6% tint. This is baked into the theme's NavLink
|
|
60
|
+
defaults (`--nl-*` vars) and holds for _every_ render path, including a consumer's router `<Link>`
|
|
61
|
+
passed via `renderNavLink`. Child items indent with a 1px `divider` left border; active child =
|
|
62
|
+
accent text, weight 600.
|
|
63
|
+
- **Buttons**: the primary action = filled accent (`variant="filled"`), **exactly one per view**.
|
|
64
|
+
Every other/secondary action = `variant="default"` (neutral). Do **not** use a colored
|
|
65
|
+
`variant="light"` for routine actions.
|
|
66
|
+
- **Status hues stay muted/forest.** Positive deltas use `color="green"` (forest green), never
|
|
67
|
+
`color="teal"` (vivid turquoise) or a saturated emerald. Status (`red`/`green`/`orange`/`yellow`)
|
|
68
|
+
is for signal only, kept muted — never raw Material/AntD.
|
|
69
|
+
- **Dark mode** is cool-neutral zinc (`#27272a`-family panels on a darker `#18181b`-mixed page) —
|
|
70
|
+
not steel-blue, not pure black. Lift elevation via `shadow-card`'s whisper shadow + inset ring;
|
|
71
|
+
the accent uses its lighter shade (`#8ec5ff`) on dark to avoid glow/bleed **as INK** — links,
|
|
72
|
+
active-nav icons, chart lines, focus ring. A FILLED control is the opposite case: it keeps the
|
|
73
|
+
deep `#0077bd` fill and a white label in both schemes, because a light fill cannot carry white
|
|
74
|
+
text and a darker one fades into the dark page (<3:1). Fill with `--vx-accentFill`, never
|
|
75
|
+
`--vx-accent`.
|
|
76
|
+
- **Light mode** is never pure-white page + pure-black text (harsh halation). Page is a
|
|
77
|
+
slightly-darker zinc mix (`#ececee`-ish) than the panel (`#f4f4f5`) so cards lift subtly off it;
|
|
78
|
+
text = near-black ink (`#262626`). Depth comes from `shadow-card` (whisper shadow + 1px ring), not
|
|
79
|
+
a plain hairline border.
|
|
80
|
+
|
|
81
|
+
## Bridging Mantine ↔ charts
|
|
82
|
+
|
|
83
|
+
Charts are Mantine-free, but their color scheme must track Mantine's toggle. `BasaltProvider` already
|
|
84
|
+
bridges this. If you compose the providers manually, one — and only one — file may import both
|
|
85
|
+
`@mantine/core` and `basalt-ui/charts` to read the scheme and feed `VxThemeProvider`:
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
import { useMantineColorScheme } from '@mantine/core'
|
|
89
|
+
import { VxThemeProvider } from 'basalt-ui/charts'
|
|
90
|
+
|
|
91
|
+
export function VxBridge({ children }: { children: React.ReactNode }) {
|
|
92
|
+
const { colorScheme } = useMantineColorScheme()
|
|
93
|
+
const resolved = colorScheme === 'auto' ? 'dark' : colorScheme
|
|
94
|
+
return <VxThemeProvider colorScheme={resolved}>{children}</VxThemeProvider>
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Route components import chart primitives directly from `basalt-ui/charts` — never from the bridge file.
|
|
99
|
+
|
|
100
|
+
## Component conventions
|
|
101
|
+
|
|
102
|
+
- **Shell**: `BasaltShell` wraps every page (compose it once at the root). Don't add another shell
|
|
103
|
+
inside a page. Wire nav badges with `NavCountBadge`.
|
|
104
|
+
- **Layout**: prefer `Stack`/`Group`/`SimpleGrid` over manual flex/grid CSS.
|
|
105
|
+
- **Notifications**: `notifications.show(...)` from `@mantine/notifications` — never roll a custom toast.
|
|
106
|
+
- **Modals**: `modals.openConfirmModal(...)` for destructive actions; `modals.open(...)` for forms.
|
|
107
|
+
- **Inputs**: from `@mantine/core` (`TextInput`, `Select`, `Combobox`, …). Don't use native `<select>`.
|
|
108
|
+
The theme defaults inputs to `md` (16px font) so iOS Safari never zooms on focus. The floor
|
|
109
|
+
(`styles.css`) is `!important` and mechanically enforced: `raw-form-control` flags any raw
|
|
110
|
+
`<input>`/`<select>`/`<textarea>`, `sub-16-input-font` flags a sub-16 `fontSize` on a form control
|
|
111
|
+
as dead code against the floor.
|
|
112
|
+
- **DatePickerInput**: from `@mantine/dates` (if you separately install it). In v9 it uses string
|
|
113
|
+
values (`YYYY-MM-DD`) for `value`/`onChange` — no `Date` conversion.
|
|
114
|
+
- **Responsive chart sizing**: use `ResponsiveChart` or `useChartSize` from `basalt-ui/charts`
|
|
115
|
+
(see basalt-charts.md). Never `useElementSize` from `@mantine/hooks` in a chart file (Mantine is
|
|
116
|
+
banned inside `charts/**`), and never raw `@visx/responsive` outside `charts/**`.
|
|
117
|
+
|
|
118
|
+
## Strict surfaces & layout primitives
|
|
119
|
+
|
|
120
|
+
The theme runs a **strict surface system**: Mantine components don't chain through
|
|
121
|
+
`--mantine-color-default-*` — each reads a **raw ramp step** directly — so `cssVariablesResolver`
|
|
122
|
+
**collapses the ramp steps onto the basalt tokens**. Light borders (`--mantine-color-gray-2/3/4`)
|
|
123
|
+
and dark borders (`--mantine-color-dark-4`) both resolve to `--vx-surface-border`; light
|
|
124
|
+
hover/subtle steps (`--mantine-color-gray-0/1`) resolve to the `--vx-surface-subtle` token;
|
|
125
|
+
`Card`/`Paper` backgrounds are forced to `--vx-surface-panel` via theme `styles` (Mantine otherwise
|
|
126
|
+
defaults card bg to the page body color, so cards blend into the page); `--app-shell-border-color`
|
|
127
|
+
is pinned to `--vx-surface-border`. Net: **one border shade, one card background, one radius
|
|
128
|
+
(`--vx-radius-card`) across every surface** — AppShell, Table, Input, Divider, Tabs, Popover,
|
|
129
|
+
Accordion, cards. The agent cannot reintroduce a divergent border/bg (no more off-system
|
|
130
|
+
`#aba59c`). Surfaces must come from `VX.surface.*` + the radius token — **never** inline
|
|
131
|
+
`border`/`borderRadius`/`backgroundColor`/`boxShadow`, and never a raw Mantine ramp-step var
|
|
132
|
+
(`var(--mantine-color-gray-N)`).
|
|
133
|
+
|
|
134
|
+
**Never pass `withBorder` to a `Card`/`Paper`.** Card depth is `--vx-shadow-card`, which bakes its
|
|
135
|
+
1px ring into the shadow value itself; the theme's `styles.root` pins bg/shadow/radius but does not
|
|
136
|
+
clear `border`, so `withBorder` draws a _second_, real edge on top of the ring and the card reads
|
|
137
|
+
heavy and boxed. This is the most common way a migrated app silently keeps its old hairline
|
|
138
|
+
identity — the prop is on-token (its color resolves to `--vx-surface-border`), so only the
|
|
139
|
+
`card-with-border` guard kind catches it. `withBorder={false}` and `<Card.Section withBorder>` (a
|
|
140
|
+
section divider, not card depth) are both fine.
|
|
141
|
+
|
|
142
|
+
- **Use Mantine primitives, not raw HTML.** To keep padding/spacing/radius/colors consistent,
|
|
143
|
+
consumer code must compose Mantine layout/surface primitives — `Box`, `Flex`, `Grid`,
|
|
144
|
+
`SimpleGrid`, `Stack`, `Group`, `Paper`, `Card` — instead of raw `<div>`/`<span>` with inline
|
|
145
|
+
`style`. Raw HTML with inline layout/surface styling defeats the token system.
|
|
146
|
+
- **Mechanical enforcement.** `basalt check-theme` adds five surface guard kinds (each a config knob,
|
|
147
|
+
default ON; `theme-allow` line-comment escape): `off-system-surface-var` (raw ramp-step vars),
|
|
148
|
+
`card-with-border` (`withBorder` on a `Card`/`Paper`), `raw-html-layout` (raw `<div>`/`<span>` with
|
|
149
|
+
inline layout/surface styling), `inline-spacing` (inline spacing literals), `inline-display`
|
|
150
|
+
(inline `display` literals). The Mantine-free `src/charts/**` is the only place raw `<div>` is
|
|
151
|
+
allowed — and it must still use `VX.*` tokens.
|
|
152
|
+
|
|
153
|
+
## Scroll regions
|
|
154
|
+
|
|
155
|
+
**A scroll region inside app chrome is a Mantine `ScrollArea`, not a raw `overflow: auto` box.**
|
|
156
|
+
ScrollArea draws its own bar absolutely inside a `position: relative; overflow: hidden` root, so the
|
|
157
|
+
bar floats over the content; a native bar reserves gutter width and reflows the column the moment
|
|
158
|
+
the content overflows. `AppSidebar`'s nav is the reference pattern — `<ScrollArea type="hover"
|
|
159
|
+
scrollbars="y" scrollbarSize={9}>` with the flex fill (`flex: 1; min-height: 0`) on the ScrollArea
|
|
160
|
+
root and the content classes on the inner `Stack`, so child-combinator spacing rules still see the
|
|
161
|
+
content's own children through the wrapper.
|
|
162
|
+
|
|
163
|
+
`styles.css` re-hides the native bar on `.mantine-ScrollArea-viewport`: basalt's global
|
|
164
|
+
`*::-webkit-scrollbar` theming otherwise re-exposes the bar ScrollArea hides, yielding two bars plus
|
|
165
|
+
an always-on gutter. That fix makes **one overlay bar** the framework-wide outcome for every
|
|
166
|
+
ScrollArea consumer — do not undo it, and do not re-theme the viewport's native bar.
|
|
167
|
+
|
|
168
|
+
A raw `overflow: auto` element is still correct where a library owns the scroll container and needs
|
|
169
|
+
a real scrollable node: `BasaltStickToBottom` (scroll anchoring) and `BasaltVirtualList` (TanStack
|
|
170
|
+
Virtual measures the scroll element). That is why this is a documented standard rather than a lint
|
|
171
|
+
rule — the legitimate exceptions are context-dependent, not syntactic. Prefer ScrollArea for
|
|
172
|
+
everything else: sidebars, panels, menus, palettes, and any chrome that scrolls.
|
|
173
|
+
|
|
174
|
+
## Elevation, density & shape
|
|
175
|
+
|
|
176
|
+
basalt-ui targets dense, professional surfaces (a terminal, not a marketing page). The depth and
|
|
177
|
+
shape doctrine lives here; the spacing/radius/type **tokens** are in basalt-tokens.md.
|
|
178
|
+
|
|
179
|
+
- **Density is the point** (Linear/Notion). Sections separate by surface change and shadow/hairline,
|
|
180
|
+
not by large air — default to the tighter spacing step. The shipped dense defaults: shell header
|
|
181
|
+
**48px**, navbar width **216** (collapsed **64**) with **`sm` (12px)** padding; sidebar section
|
|
182
|
+
gap **`sm`**, compact nav rows (`--nl-padding: 6px 8px`, `min-height: 30px`, `sm` font), brand row
|
|
183
|
+
32px. Pages: KPI/card padding **~17–19px**, page `Stack`/`SimpleGrid` gaps **`sm`**; ChartCard
|
|
184
|
+
header/body padding raised to ~16–18px.
|
|
185
|
+
- **Surface single-source.** All cards — Mantine `Card`/`Paper` **and** the Mantine-free
|
|
186
|
+
`ChartCard` — resolve to **one radius token** (`--vx-radius-card` = **7px**) and
|
|
187
|
+
**one depth token** (`shadow-card` — a whisper shadow + 1px ring, the ring lives IN the shadow, no
|
|
188
|
+
separate `border` property). Cards must never diverge: same radius, same shadow. Never
|
|
189
|
+
inline-override `border`/`borderRadius`/`boxShadow`/`backgroundColor` on a surface — use the
|
|
190
|
+
radius token (`radius="md"` / `var(--vx-radius-card)`) + `VX.shadowCard` + `VX.surface.*`.
|
|
191
|
+
Mechanically enforced by `basalt check-theme`'s `raw-surface` guard. Outer spacing comes from the
|
|
192
|
+
parent `Stack`/`SimpleGrid` gap, not an intrinsic card margin.
|
|
193
|
+
- **Depth = `shadow-card`, not a plain hairline** (see `docs/DESIGN-SPEC.md` in the basalt-ui repo,
|
|
194
|
+
doctrine inversion #1 — this supersedes the old "never a drop shadow" rule). Elevation tiers: 0 flat (no shadow — body,
|
|
195
|
+
page bg); 1 surface (`shadow-card` on `canvas` — cards, panels, chart cards); 2 elevated (same
|
|
196
|
+
`shadow-card`, `surface-elevated` bg — tooltips, lifted cards); 3 focus (2px primary outline —
|
|
197
|
+
focused control). `Card`/`Paper` default to the `shadow-card` shadow (no `withBorder`), and the
|
|
198
|
+
Mantine-free `ChartCard` matches them (`VX.shadowCard` + `--vx-radius-card` radius). The same
|
|
199
|
+
inversion applies to every **`variant="default"` control surface**, not just Card/Paper: Button,
|
|
200
|
+
ActionIcon, and the field idiom (Input/TextInput/…) all render panel/field bg + `shadow-card`
|
|
201
|
+
with a _transparent_ 1px border box (never `border: none` — the box stays so focus/error can
|
|
202
|
+
recolor it with no layout shift). `--mantine-color-default-border` is pinned to `transparent` in
|
|
203
|
+
`cssVariablesResolver`, which is the ONE lever that kills the stock hairline for every
|
|
204
|
+
default-variant component at once (`defaultVariantColorsResolver`'s `variant === 'default'`
|
|
205
|
+
branch reads that single var); the shadow itself is added per-component in
|
|
206
|
+
`controls.module.css`, since Mantine never declares one for `default`. Layout dividers (header
|
|
207
|
+
bottom border, sidebar section separators) still use plain borders — only card/control depth
|
|
208
|
+
moved to shadow. (Genuinely floating elements — modals, popovers, menus — get elevation from
|
|
209
|
+
Mantine's own shadow scale, not from the card token.) `CheckboxCard`/`RadioCard` (`withBorder`,
|
|
210
|
+
their own default) and `Chip` (its own default, internally `variant="filled"` — Chip has no
|
|
211
|
+
literal `"default"`) get the SAME triad — panel bg + `shadow-card`, border dropped — via
|
|
212
|
+
dedicated rules in `controls.module.css`; `PillsInput` reuses the Input field idiom's `classNames`
|
|
213
|
+
wiring directly (it renders `InputBase` under its own `__staticSelector`, so the base `Input`
|
|
214
|
+
theme entry never reached it). A dedicated test, `src/theme/border-coverage.test.ts`, mechanically
|
|
215
|
+
enumerates every `@mantine/core` component whose shipped CSS declares a border and asserts it's
|
|
216
|
+
either a themed `baseTheme.components` key or a reasoned `BORDER_ALLOWLIST` entry — this is what
|
|
217
|
+
catches the NEXT unthemed bordered component (Button/ActionIcon shipped with no `.extend()` block
|
|
218
|
+
at all, which no consumer-source guard can ever see).
|
|
219
|
+
- **The shadow-card ring must land on the box that carries the surface's `border-radius`.**
|
|
220
|
+
`shadow-card`/`shadow-ctrl` bakes a 1px ring into the shadow value itself, and the ring is drawn
|
|
221
|
+
by the shadowed box's OWN corners — it never reads correctly against a different element's radius
|
|
222
|
+
(the Input wrapper bug: a `position: relative` box with `border-radius: 0` drew a square ring
|
|
223
|
+
around the 8px-rounded `<input>` inside it). Background usually co-locates with the radius since
|
|
224
|
+
most surfaces declare both on the same box, but it's the radius the ring is contractually bound
|
|
225
|
+
to, not the background — `ChartCard.tsx` legitimately carries the shadow on a box with NO
|
|
226
|
+
background (an inner box, sharing its exact radius, paints the fill instead, because `overflow:
|
|
227
|
+
hidden` on the same box as the shadow would clip the shadow itself) and is correct. `src/theme/
|
|
228
|
+
shadow-surfaces.test.ts` mechanically enumerates every site that applies either token and requires
|
|
229
|
+
a written `roundedBy` reason naming where that box's radius comes from.
|
|
230
|
+
- **Tight radii read precise/technical** (Linear): `sm` for controls, `md` for cards, `pill` for
|
|
231
|
+
badges. Consume the token, never a raw number (basalt-tokens.md).
|
|
232
|
+
- **Type is carried by the three-font system** (sans body / head condensed headings / mono
|
|
233
|
+
numerals — basalt-tokens.md), numbers in the mono tabular stack so metric columns align (a
|
|
234
|
+
Coinbase pattern).
|
|
235
|
+
|
|
236
|
+
## Composing the shell from sub-components
|
|
237
|
+
|
|
238
|
+
`BasaltShell` is the canonical single-mount. When a fully custom layout is needed, the shell
|
|
239
|
+
sub-components are available individually from `basalt-ui`:
|
|
240
|
+
|
|
241
|
+
- `AppSidebar` — desktop sidebar (sections, collapse, brand, footer/settings extras)
|
|
242
|
+
- `MobileNav` — bottom-tab mobile nav
|
|
243
|
+
- `AppBreadcrumbs` — breadcrumb bar (reads from `useRouterBreadcrumbs` or a manual trail)
|
|
244
|
+
- `PageHeaderProvider` + `PageActions` + `PageActionsOutlet` — portal-based page action slots
|
|
245
|
+
- `NavCountBadge` — count badge for sidebar nav items
|
|
246
|
+
|
|
247
|
+
```tsx
|
|
248
|
+
import {
|
|
249
|
+
AppSidebar,
|
|
250
|
+
MobileNav,
|
|
251
|
+
AppBreadcrumbs,
|
|
252
|
+
PageHeaderProvider,
|
|
253
|
+
PageActionsOutlet,
|
|
254
|
+
NavCountBadge,
|
|
255
|
+
} from 'basalt-ui'
|
|
256
|
+
|
|
257
|
+
function CustomShell({ children }: { children: React.ReactNode }) {
|
|
258
|
+
return (
|
|
259
|
+
<PageHeaderProvider>
|
|
260
|
+
<AppSidebar sections={sections} brand={brand} renderNavLink={renderNavLink} />
|
|
261
|
+
<MobileNav sections={mobileSections} renderNavLink={renderNavLink} />
|
|
262
|
+
<main>
|
|
263
|
+
<AppBreadcrumbs />
|
|
264
|
+
<PageActionsOutlet />
|
|
265
|
+
{children}
|
|
266
|
+
</main>
|
|
267
|
+
</PageHeaderProvider>
|
|
268
|
+
)
|
|
269
|
+
}
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
Prefer `BasaltShell` unless the layout genuinely diverges — it already composes all of the above
|
|
273
|
+
with the correct wiring (collapse persistence, mobile breakpoint, breadcrumb integration).
|
|
274
|
+
|
|
275
|
+
## Icons
|
|
276
|
+
|
|
277
|
+
basalt-ui takes icons as `ReactNode` (no icon dependency shipped). Use a single icon library across the
|
|
278
|
+
app — `@tabler/icons-react` pairs cleanly with Mantine. Size via the icon's `size` prop (`size={16}`),
|
|
279
|
+
not CSS.
|
|
280
|
+
|
|
281
|
+
## Interaction feedback (micro-animations)
|
|
282
|
+
|
|
283
|
+
Every action button (Save, Log, Add, Delete, Toggle) must give immediate visual confirmation — silent
|
|
284
|
+
success feels broken. Three layers, applied together:
|
|
285
|
+
|
|
286
|
+
1. **In-flight state** — `loading` prop on `<Button>` (built-in spinner). Disables clicks automatically.
|
|
287
|
+
2. **Post-success state on the trigger itself** — flip the button briefly: swap label `Save → Saved`,
|
|
288
|
+
set `color="green"` (the success status hue — never `teal`/`violet`, which the theme guard rejects as
|
|
289
|
+
off-identity), reveal an `IconCheck` via `<Transition mounted={justSaved} transition="pop"
|
|
290
|
+
duration={180}>`. Hold ~1.2–1.5s, then reset. The user's eye is on the thing they clicked — feedback
|
|
291
|
+
lands there, not only in a corner toast.
|
|
292
|
+
3. **Toast (`notifications.show`)** — only for outcomes the user might miss (writes that succeed
|
|
293
|
+
off-screen, errors, async background work). Don't toast trivial UI toggles. `autoClose` ≤ 2000ms for
|
|
294
|
+
success; errors stay until dismissed.
|
|
295
|
+
|
|
296
|
+
Guidelines:
|
|
297
|
+
|
|
298
|
+
- Durations: 120–200ms for state flips, 180–250ms for `Transition`, never above 300ms (feels laggy).
|
|
299
|
+
- Never animate layout-shifting properties (height, width) on buttons — animate `transform`, `opacity`,
|
|
300
|
+
`color`, `background`.
|
|
301
|
+
- A button that turns into a check **is** the confirmation; the toast is for context the user can't see.
|
|
302
|
+
- Destructive actions: `modals.openConfirmModal` first, then the same in-button success pattern after.
|
|
303
|
+
- Form errors: prefer inline field errors over toast; toast only for submit-level failures.
|
|
304
|
+
|
|
305
|
+
## Motion (`motion`)
|
|
306
|
+
|
|
307
|
+
basalt-ui ships `motion` (motion.dev, formerly framer-motion) as a bundled dependency — the same
|
|
308
|
+
precedent as `@visx/*`: an internal implementation detail, not a peer the consumer opts into.
|
|
309
|
+
`ThemeToggle` is the first consumer (icon morph + direct-select popover reveal).
|
|
310
|
+
|
|
311
|
+
- **Reach for Mantine's own `<Transition>`** (above) for simple mount/unmount fades/pops — it's
|
|
312
|
+
already there, needs no import. **Reach for `motion`** when the interaction needs something
|
|
313
|
+
`Transition` can't do: crossfade between two different elements (not just show/hide one),
|
|
314
|
+
spring physics, or a gesture-driven reveal.
|
|
315
|
+
- **Import from `motion/react`, never the raw `framer-motion` package** — `motion` re-exports it,
|
|
316
|
+
but a direct `framer-motion` import bypasses the pinned/vetted specifier. Enforced by oxlint
|
|
317
|
+
`no-restricted-imports` (repo-local and the shipped consumer preset).
|
|
318
|
+
- **Never a hardcoded duration/spring/ease literal in a `transition={{...}}` prop.** Import
|
|
319
|
+
`MOTION_DURATION` / `MOTION_SPRING` / `MOTION_EASE_STANDARD` from `basalt-ui` instead — the
|
|
320
|
+
motion analog of routing color through `VX.*`. `MOTION_DURATION` is capped at 0.3s (300ms),
|
|
321
|
+
matching the interaction-feedback ceiling above. Mechanically enforced by `basalt check-theme`'s
|
|
322
|
+
`raw-motion-value` guard (default ON; `theme-allow` line-comment escape).
|
|
323
|
+
- **Always branch on `useReducedMotion`** (`@mantine/hooks`) — render a real unanimated code path
|
|
324
|
+
(no `motion.*` wrapper at all), not just `transition={{ duration: 0 }}`. See `ThemeToggle`'s
|
|
325
|
+
`SchemeGlyph` for the pattern.
|
|
326
|
+
- **Restraint applies to motion too.** Subtle and purposeful — a state change earns a transition,
|
|
327
|
+
idle chrome does not. Never a looping/pulsing idle animation.
|