@contui/ui 0.0.0-stage → 0.1.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/LICENSE +30 -0
- package/README.md +150 -2
- package/cli/contui.mjs +250 -0
- package/dist/charts/area-chart.d.ts +8 -0
- package/dist/charts/area-chart.js +9 -0
- package/dist/charts/bar-chart.d.ts +9 -0
- package/dist/charts/bar-chart.js +10 -0
- package/dist/charts/bubble-chart.d.ts +60 -0
- package/dist/charts/bubble-chart.js +392 -0
- package/dist/charts/bullet-chart.d.ts +53 -0
- package/dist/charts/bullet-chart.js +123 -0
- package/dist/charts/candlestick-chart.d.ts +77 -0
- package/dist/charts/candlestick-chart.js +558 -0
- package/dist/charts/cartesian.d.ts +121 -0
- package/dist/charts/cartesian.js +625 -0
- package/dist/charts/chart-card.d.ts +80 -0
- package/dist/charts/chart-card.js +114 -0
- package/dist/charts/donut-chart.d.ts +40 -0
- package/dist/charts/donut-chart.js +88 -0
- package/dist/charts/funnel-chart.d.ts +16 -0
- package/dist/charts/funnel-chart.js +164 -0
- package/dist/charts/horizontal-bar-chart.d.ts +67 -0
- package/dist/charts/horizontal-bar-chart.js +481 -0
- package/dist/charts/index.d.ts +21 -0
- package/dist/charts/index.js +32 -0
- package/dist/charts/legend.d.ts +23 -0
- package/dist/charts/legend.js +22 -0
- package/dist/charts/lib/candlestick-window.d.ts +15 -0
- package/dist/charts/lib/candlestick-window.js +23 -0
- package/dist/charts/lib/color.d.ts +39 -0
- package/dist/charts/lib/color.js +83 -0
- package/dist/charts/lib/format.d.ts +11 -0
- package/dist/charts/lib/format.js +33 -0
- package/dist/charts/lib/frame.d.ts +6 -0
- package/dist/charts/lib/frame.js +6 -0
- package/dist/charts/lib/layout.d.ts +11 -0
- package/dist/charts/lib/layout.js +71 -0
- package/dist/charts/lib/path.d.ts +35 -0
- package/dist/charts/lib/path.js +203 -0
- package/dist/charts/lib/scale.d.ts +41 -0
- package/dist/charts/lib/scale.js +80 -0
- package/dist/charts/lib/use-active.d.ts +18 -0
- package/dist/charts/lib/use-active.js +71 -0
- package/dist/charts/lib/use-size.d.ts +9 -0
- package/dist/charts/lib/use-size.js +40 -0
- package/dist/charts/line-chart.d.ts +7 -0
- package/dist/charts/line-chart.js +8 -0
- package/dist/charts/radar-chart.d.ts +27 -0
- package/dist/charts/radar-chart.js +165 -0
- package/dist/charts/rose-chart.d.ts +35 -0
- package/dist/charts/rose-chart.js +242 -0
- package/dist/charts/sparkline.d.ts +35 -0
- package/dist/charts/sparkline.js +110 -0
- package/dist/charts/tooltip.d.ts +35 -0
- package/dist/charts/tooltip.js +22 -0
- package/dist/charts/treemap.d.ts +28 -0
- package/dist/charts/treemap.js +103 -0
- package/dist/charts/uptime-strip.d.ts +40 -0
- package/dist/charts/uptime-strip.js +178 -0
- package/dist/components/accordion.d.ts +31 -0
- package/dist/components/accordion.js +34 -0
- package/dist/components/activity-item.d.ts +12 -0
- package/dist/components/activity-item.js +6 -0
- package/dist/components/alert.d.ts +21 -0
- package/dist/components/alert.js +58 -0
- package/dist/components/assistant-answer.d.ts +52 -0
- package/dist/components/assistant-answer.js +40 -0
- package/dist/components/assistant-prompt.d.ts +63 -0
- package/dist/components/assistant-prompt.js +122 -0
- package/dist/components/avatar.d.ts +28 -0
- package/dist/components/avatar.js +75 -0
- package/dist/components/badge.d.ts +16 -0
- package/dist/components/badge.js +33 -0
- package/dist/components/bar-list.d.ts +65 -0
- package/dist/components/bar-list.js +119 -0
- package/dist/components/block-slider.d.ts +43 -0
- package/dist/components/block-slider.js +63 -0
- package/dist/components/branch-graph.d.ts +87 -0
- package/dist/components/branch-graph.js +231 -0
- package/dist/components/breadcrumb.d.ts +41 -0
- package/dist/components/breadcrumb.js +53 -0
- package/dist/components/button.d.ts +23 -0
- package/dist/components/button.js +108 -0
- package/dist/components/calendar.d.ts +5 -0
- package/dist/components/calendar.js +90 -0
- package/dist/components/card.d.ts +65 -0
- package/dist/components/card.js +104 -0
- package/dist/components/chat-attachment.d.ts +47 -0
- package/dist/components/chat-attachment.js +63 -0
- package/dist/components/chat-event.d.ts +7 -0
- package/dist/components/chat-event.js +7 -0
- package/dist/components/chat-message.d.ts +59 -0
- package/dist/components/chat-message.js +91 -0
- package/dist/components/chat-reference.d.ts +20 -0
- package/dist/components/chat-reference.js +41 -0
- package/dist/components/chat-shared.d.ts +21 -0
- package/dist/components/chat-shared.js +23 -0
- package/dist/components/chat-suggestions.d.ts +59 -0
- package/dist/components/chat-suggestions.js +88 -0
- package/dist/components/chat-thread.d.ts +39 -0
- package/dist/components/chat-thread.js +172 -0
- package/dist/components/chat-typing.d.ts +35 -0
- package/dist/components/chat-typing.js +66 -0
- package/dist/components/checkbox.d.ts +18 -0
- package/dist/components/checkbox.js +33 -0
- package/dist/components/checklist.d.ts +26 -0
- package/dist/components/checklist.js +18 -0
- package/dist/components/chip.d.ts +29 -0
- package/dist/components/chip.js +61 -0
- package/dist/components/code-input.d.ts +40 -0
- package/dist/components/code-input.js +285 -0
- package/dist/components/color-picker.d.ts +38 -0
- package/dist/components/color-picker.js +855 -0
- package/dist/components/combobox.d.ts +75 -0
- package/dist/components/combobox.js +112 -0
- package/dist/components/command-menu.d.ts +58 -0
- package/dist/components/command-menu.js +166 -0
- package/dist/components/copy-button.d.ts +16 -0
- package/dist/components/copy-button.js +31 -0
- package/dist/components/data-grid.d.ts +50 -0
- package/dist/components/data-grid.js +599 -0
- package/dist/components/date-picker.d.ts +109 -0
- package/dist/components/date-picker.js +268 -0
- package/dist/components/description-list.d.ts +12 -0
- package/dist/components/description-list.js +10 -0
- package/dist/components/dialog.d.ts +57 -0
- package/dist/components/dialog.js +140 -0
- package/dist/components/dock.d.ts +45 -0
- package/dist/components/dock.js +79 -0
- package/dist/components/drop-zone.d.ts +46 -0
- package/dist/components/drop-zone.js +101 -0
- package/dist/components/dropdown-menu.d.ts +50 -0
- package/dist/components/dropdown-menu.js +78 -0
- package/dist/components/editable-cell.d.ts +34 -0
- package/dist/components/editable-cell.js +89 -0
- package/dist/components/empty-state.d.ts +17 -0
- package/dist/components/empty-state.js +9 -0
- package/dist/components/field.d.ts +43 -0
- package/dist/components/field.js +75 -0
- package/dist/components/filter-condition.d.ts +188 -0
- package/dist/components/filter-condition.js +113 -0
- package/dist/components/filter-menu.d.ts +57 -0
- package/dist/components/filter-menu.js +46 -0
- package/dist/components/header-bar.d.ts +84 -0
- package/dist/components/header-bar.js +94 -0
- package/dist/components/hold-button.d.ts +15 -0
- package/dist/components/hold-button.js +88 -0
- package/dist/components/icon-tile.d.ts +12 -0
- package/dist/components/icon-tile.js +29 -0
- package/dist/components/info-tip.d.ts +13 -0
- package/dist/components/info-tip.js +26 -0
- package/dist/components/input.d.ts +17 -0
- package/dist/components/input.js +83 -0
- package/dist/components/kbd.d.ts +6 -0
- package/dist/components/kbd.js +7 -0
- package/dist/components/menu-item.d.ts +56 -0
- package/dist/components/menu-item.js +94 -0
- package/dist/components/message-composer.d.ts +75 -0
- package/dist/components/message-composer.js +199 -0
- package/dist/components/nav-rail.d.ts +31 -0
- package/dist/components/nav-rail.js +85 -0
- package/dist/components/notice.d.ts +45 -0
- package/dist/components/notice.js +66 -0
- package/dist/components/optimistic-undo.d.ts +28 -0
- package/dist/components/optimistic-undo.js +43 -0
- package/dist/components/option-row.d.ts +15 -0
- package/dist/components/option-row.js +14 -0
- package/dist/components/page-content.d.ts +11 -0
- package/dist/components/page-content.js +31 -0
- package/dist/components/pagination.d.ts +34 -0
- package/dist/components/pagination.js +41 -0
- package/dist/components/popover.d.ts +27 -0
- package/dist/components/popover.js +25 -0
- package/dist/components/progress.d.ts +33 -0
- package/dist/components/progress.js +75 -0
- package/dist/components/radio-group.d.ts +7 -0
- package/dist/components/radio-group.js +33 -0
- package/dist/components/readonly-field.d.ts +33 -0
- package/dist/components/readonly-field.js +80 -0
- package/dist/components/segmented-control.d.ts +21 -0
- package/dist/components/segmented-control.js +108 -0
- package/dist/components/select.d.ts +42 -0
- package/dist/components/select.js +86 -0
- package/dist/components/separator.d.ts +10 -0
- package/dist/components/separator.js +7 -0
- package/dist/components/setting-row.d.ts +53 -0
- package/dist/components/setting-row.js +93 -0
- package/dist/components/sidebar-switcher.d.ts +47 -0
- package/dist/components/sidebar-switcher.js +20 -0
- package/dist/components/sidebar.d.ts +220 -0
- package/dist/components/sidebar.js +327 -0
- package/dist/components/skeleton.d.ts +18 -0
- package/dist/components/skeleton.js +23 -0
- package/dist/components/slider.d.ts +15 -0
- package/dist/components/slider.js +28 -0
- package/dist/components/spinner.d.ts +14 -0
- package/dist/components/spinner.js +19 -0
- package/dist/components/status-dot.d.ts +24 -0
- package/dist/components/status-dot.js +35 -0
- package/dist/components/stepper.d.ts +60 -0
- package/dist/components/stepper.js +197 -0
- package/dist/components/switch.d.ts +9 -0
- package/dist/components/switch.js +26 -0
- package/dist/components/table-cell.d.ts +38 -0
- package/dist/components/table-cell.js +107 -0
- package/dist/components/table-context.d.ts +48 -0
- package/dist/components/table-context.js +69 -0
- package/dist/components/table-head.d.ts +42 -0
- package/dist/components/table-head.js +188 -0
- package/dist/components/table-tree.d.ts +96 -0
- package/dist/components/table-tree.js +137 -0
- package/dist/components/table.d.ts +78 -0
- package/dist/components/table.js +119 -0
- package/dist/components/tabs.d.ts +27 -0
- package/dist/components/tabs.js +79 -0
- package/dist/components/textarea.d.ts +3 -0
- package/dist/components/textarea.js +20 -0
- package/dist/components/theme.d.ts +41 -0
- package/dist/components/theme.js +60 -0
- package/dist/components/thinking.d.ts +68 -0
- package/dist/components/thinking.js +94 -0
- package/dist/components/toast.d.ts +39 -0
- package/dist/components/toast.js +110 -0
- package/dist/components/toolbar.d.ts +25 -0
- package/dist/components/toolbar.js +92 -0
- package/dist/components/tooltip.d.ts +23 -0
- package/dist/components/tooltip.js +27 -0
- package/dist/components/top-nav.d.ts +129 -0
- package/dist/components/top-nav.js +211 -0
- package/dist/components/truncate.d.ts +29 -0
- package/dist/components/truncate.js +138 -0
- package/dist/deprecated.d.ts +43 -0
- package/dist/deprecated.js +47 -0
- package/dist/index.d.ts +93 -0
- package/dist/index.js +93 -0
- package/dist/lib/cn.d.ts +5 -0
- package/dist/lib/cn.js +14 -0
- package/dist/lib/color.d.ts +136 -0
- package/dist/lib/color.js +307 -0
- package/dist/lib/contrast.d.ts +53 -0
- package/dist/lib/contrast.js +169 -0
- package/dist/lib/create-theme.d.ts +240 -0
- package/dist/lib/create-theme.js +461 -0
- package/dist/lib/harmony.d.ts +102 -0
- package/dist/lib/harmony.js +426 -0
- package/dist/lib/import-theme.d.ts +22 -0
- package/dist/lib/import-theme.js +221 -0
- package/dist/lib/overflow-scroll.d.ts +25 -0
- package/dist/lib/overflow-scroll.js +66 -0
- package/dist/lib/radio-toggle-render.d.ts +3 -0
- package/dist/lib/radio-toggle-render.js +9 -0
- package/dist/lib/reorder.d.ts +38 -0
- package/dist/lib/reorder.js +193 -0
- package/dist/lib/spacing.d.ts +101 -0
- package/dist/lib/spacing.js +118 -0
- package/dist/lib/tailwind-palette.d.ts +5 -0
- package/dist/lib/tailwind-palette.js +351 -0
- package/dist/lib/truncate.d.ts +18 -0
- package/dist/lib/truncate.js +69 -0
- package/dist/lib/use-single-value.d.ts +5 -0
- package/dist/lib/use-single-value.js +17 -0
- package/dist/styles.css +7988 -0
- package/mcp/server.mjs +87590 -0
- package/package.json +58 -5
- package/skills/continuum-fix-padding/SKILL.md +69 -0
- package/skills/continuum-fix-padding/scripts/compute.ts +155 -0
- package/skills/continuum-fix-padding/scripts/spacing.ts +189 -0
- package/skills/continuum-taste/SKILL.md +186 -0
- package/skills/continuum-taste/assets/tokens.css +647 -0
- package/skills/continuum-taste/references/charts.md +375 -0
- package/skills/continuum-taste/references/components.md +1369 -0
- package/skills/continuum-taste/references/foundations.md +539 -0
- package/skills/continuum-taste/references/media/canvas.md +75 -0
- package/skills/continuum-taste/references/media/css.md +61 -0
- package/skills/continuum-taste/references/media/react.md +161 -0
- package/skills/continuum-taste/references/method.md +87 -0
- package/skills/continuum-taste/references/pages.md +391 -0
- package/skills/continuum-taste/references/patterns.md +77 -0
- package/skills/continuum-taste/references/screens/agent.tsx +450 -0
- package/skills/continuum-taste/references/screens/analytics-overview.tsx +377 -0
- package/skills/continuum-taste/references/screens/checkout-funnel.tsx +193 -0
- package/skills/continuum-taste/references/screens/customer.tsx +475 -0
- package/skills/continuum-taste/references/screens/customers.tsx +608 -0
- package/skills/continuum-taste/references/screens/index.tsx +72 -0
- package/skills/continuum-taste/references/screens/invoice-editor.tsx +558 -0
- package/skills/continuum-taste/references/screens/new-customer.tsx +205 -0
- package/skills/continuum-taste/references/screens/overview.tsx +196 -0
- package/skills/continuum-taste/references/screens/report-generator.tsx +329 -0
- package/skills/continuum-taste/references/screens/risk-report.tsx +577 -0
- package/skills/continuum-taste/references/screens/sequence-editor.tsx +455 -0
- package/skills/continuum-taste/references/screens/settings.tsx +288 -0
- package/skills/continuum-taste/references/screens/shared.tsx +204 -0
- package/skills/continuum-taste/references/screens/sign-in.tsx +104 -0
- package/skills/continuum-taste/references/screens/workspace.tsx +596 -0
- package/skills/continuum-taste/references/theming.md +95 -0
- package/src/charts/area-chart.tsx +17 -0
- package/src/charts/bar-chart.tsx +15 -0
- package/src/charts/bubble-chart.tsx +913 -0
- package/src/charts/bullet-chart.tsx +419 -0
- package/src/charts/candlestick-chart.tsx +1242 -0
- package/src/charts/cartesian.tsx +1437 -0
- package/src/charts/chart-card.tsx +394 -0
- package/src/charts/donut-chart.tsx +299 -0
- package/src/charts/funnel-chart.tsx +373 -0
- package/src/charts/horizontal-bar-chart.tsx +991 -0
- package/src/charts/index.ts +76 -0
- package/src/charts/legend.tsx +59 -0
- package/src/charts/lib/candlestick-window.ts +42 -0
- package/src/charts/lib/color.ts +110 -0
- package/src/charts/lib/format.ts +42 -0
- package/src/charts/lib/frame.ts +6 -0
- package/src/charts/lib/layout.ts +78 -0
- package/src/charts/lib/path.ts +225 -0
- package/src/charts/lib/scale.ts +91 -0
- package/src/charts/lib/use-active.ts +87 -0
- package/src/charts/lib/use-size.ts +45 -0
- package/src/charts/line-chart.tsx +16 -0
- package/src/charts/radar-chart.tsx +485 -0
- package/src/charts/rose-chart.tsx +553 -0
- package/src/charts/sparkline.tsx +293 -0
- package/src/charts/tooltip.tsx +105 -0
- package/src/charts/treemap.tsx +271 -0
- package/src/charts/uptime-strip.tsx +469 -0
- package/src/components/accordion.tsx +136 -0
- package/src/components/activity-item.tsx +43 -0
- package/src/components/alert.tsx +135 -0
- package/src/components/assistant-answer.tsx +185 -0
- package/src/components/assistant-prompt.tsx +352 -0
- package/src/components/avatar.tsx +157 -0
- package/src/components/badge.tsx +55 -0
- package/src/components/bar-list.tsx +350 -0
- package/src/components/block-slider.tsx +189 -0
- package/src/components/branch-graph.tsx +580 -0
- package/src/components/breadcrumb.tsx +173 -0
- package/src/components/button.tsx +157 -0
- package/src/components/calendar.tsx +154 -0
- package/src/components/card.tsx +296 -0
- package/src/components/chat-attachment.tsx +255 -0
- package/src/components/chat-event.tsx +34 -0
- package/src/components/chat-message.tsx +332 -0
- package/src/components/chat-reference.tsx +100 -0
- package/src/components/chat-shared.ts +41 -0
- package/src/components/chat-suggestions.tsx +188 -0
- package/src/components/chat-thread.tsx +348 -0
- package/src/components/chat-typing.tsx +155 -0
- package/src/components/checkbox.tsx +83 -0
- package/src/components/checklist.tsx +146 -0
- package/src/components/chip.tsx +152 -0
- package/src/components/code-input.tsx +406 -0
- package/src/components/color-picker.tsx +1385 -0
- package/src/components/combobox.tsx +420 -0
- package/src/components/command-menu.tsx +405 -0
- package/src/components/copy-button.tsx +87 -0
- package/src/components/data-grid.tsx +965 -0
- package/src/components/date-picker.tsx +652 -0
- package/src/components/description-list.tsx +39 -0
- package/src/components/dialog.tsx +367 -0
- package/src/components/dock.tsx +192 -0
- package/src/components/drop-zone.tsx +283 -0
- package/src/components/dropdown-menu.tsx +323 -0
- package/src/components/editable-cell.tsx +219 -0
- package/src/components/empty-state.tsx +50 -0
- package/src/components/field.tsx +148 -0
- package/src/components/filter-condition.tsx +463 -0
- package/src/components/filter-menu.tsx +196 -0
- package/src/components/header-bar.tsx +220 -0
- package/src/components/hold-button.tsx +146 -0
- package/src/components/icon-tile.tsx +43 -0
- package/src/components/info-tip.tsx +87 -0
- package/src/components/input.tsx +136 -0
- package/src/components/kbd.tsx +17 -0
- package/src/components/menu-item.tsx +216 -0
- package/src/components/message-composer.tsx +458 -0
- package/src/components/nav-rail.tsx +235 -0
- package/src/components/notice.tsx +133 -0
- package/src/components/optimistic-undo.ts +68 -0
- package/src/components/option-row.tsx +54 -0
- package/src/components/page-content.tsx +44 -0
- package/src/components/pagination.tsx +182 -0
- package/src/components/popover.tsx +113 -0
- package/src/components/progress.tsx +222 -0
- package/src/components/radio-group.tsx +80 -0
- package/src/components/readonly-field.tsx +251 -0
- package/src/components/segmented-control.tsx +205 -0
- package/src/components/select.tsx +259 -0
- package/src/components/separator.tsx +30 -0
- package/src/components/setting-row.tsx +277 -0
- package/src/components/sidebar-switcher.tsx +134 -0
- package/src/components/sidebar.tsx +804 -0
- package/src/components/skeleton.tsx +57 -0
- package/src/components/slider.tsx +106 -0
- package/src/components/spinner.tsx +43 -0
- package/src/components/status-dot.tsx +100 -0
- package/src/components/stepper.tsx +459 -0
- package/src/components/switch.tsx +54 -0
- package/src/components/table-cell.tsx +239 -0
- package/src/components/table-context.ts +135 -0
- package/src/components/table-head.tsx +393 -0
- package/src/components/table-tree.tsx +357 -0
- package/src/components/table.tsx +295 -0
- package/src/components/tabs.tsx +191 -0
- package/src/components/textarea.tsx +44 -0
- package/src/components/theme.tsx +120 -0
- package/src/components/thinking.tsx +295 -0
- package/src/components/toast.tsx +308 -0
- package/src/components/toolbar.tsx +166 -0
- package/src/components/tooltip.tsx +84 -0
- package/src/components/top-nav.tsx +660 -0
- package/src/components/truncate.tsx +234 -0
- package/src/deprecated.ts +61 -0
- package/src/index.ts +184 -0
- package/src/lib/cn.ts +22 -0
- package/src/lib/color.ts +469 -0
- package/src/lib/contrast.ts +220 -0
- package/src/lib/create-theme.ts +659 -0
- package/src/lib/harmony.ts +609 -0
- package/src/lib/import-theme.ts +272 -0
- package/src/lib/overflow-scroll.tsx +108 -0
- package/src/lib/radio-toggle-render.tsx +15 -0
- package/src/lib/reorder.ts +222 -0
- package/src/lib/spacing.ts +189 -0
- package/src/lib/tailwind-palette.ts +355 -0
- package/src/lib/truncate.ts +79 -0
- package/src/lib/use-single-value.ts +23 -0
- package/src/styles/continuum.css +3 -0
- package/src/styles/theme.css +524 -0
- package/src/styles/tokens.css +647 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Tabs as TabsPrimitive } from '@base-ui/react/tabs';
|
|
2
|
+
import { type ComponentProps } from 'react';
|
|
3
|
+
import { type WithClassName } from '../lib/cn.js';
|
|
4
|
+
export type TabsVariant = 'pill' | 'line';
|
|
5
|
+
export declare const Tabs: ({ className, ...props }: WithClassName<ComponentProps<typeof TabsPrimitive.Root>>) => import("react").JSX.Element;
|
|
6
|
+
export type TabsListProps = WithClassName<ComponentProps<typeof TabsPrimitive.List>> & {
|
|
7
|
+
/**
|
|
8
|
+
* `line` (the default) sets the tabs on a hairline and underlines the active one, for the tabs of a
|
|
9
|
+
* page, section or panel under its title. `pill` fills the active tab, for a tight spot in a card or dialog.
|
|
10
|
+
*/
|
|
11
|
+
variant?: TabsVariant;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* More tabs than fit scroll sideways, as the dock's items do: a chevron either side, the edge with
|
|
15
|
+
* more faded, and the active tab kept in view. A list that fits is left exactly as it was: it only
|
|
16
|
+
* becomes a scroller once it overflows, so a focus ring on its first or last tab is never clipped.
|
|
17
|
+
*/
|
|
18
|
+
export declare const TabsList: ({ activateOnFocus, variant, className, ...props }: TabsListProps) => import("react").JSX.Element;
|
|
19
|
+
/**
|
|
20
|
+
* One tab. Holds, in this order: an optional leading icon, the label, then an optional trailing
|
|
21
|
+
* piece (a `TabsCount`, a `Kbd`, a `StatusDot` or an icon). Badges and chips stay out: at 22–25px
|
|
22
|
+
* they fill a 29px tab and read as a button inside a button.
|
|
23
|
+
*/
|
|
24
|
+
export declare const TabsTrigger: ({ className, ...props }: WithClassName<ComponentProps<typeof TabsPrimitive.Tab>>) => import("react").JSX.Element;
|
|
25
|
+
/** The number after a tab's label ("Findings 12"). Takes the tab's colour, so it follows the active state. */
|
|
26
|
+
export declare const TabsCount: ({ className, ...props }: ComponentProps<"span">) => import("react").JSX.Element;
|
|
27
|
+
export declare const TabsContent: ({ className, ...props }: WithClassName<ComponentProps<typeof TabsPrimitive.Panel>>) => import("react").JSX.Element;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Tabs as TabsPrimitive } from '@base-ui/react/tabs';
|
|
4
|
+
import { createContext, useCallback, useContext, useEffect, useRef, } from 'react';
|
|
5
|
+
import { cn } from '../lib/cn.js';
|
|
6
|
+
import { OverflowChevron, useOverflowScroll } from '../lib/overflow-scroll.js';
|
|
7
|
+
import { focusRing } from './button.js';
|
|
8
|
+
// A context, not a parent selector, so a pill list nested in a line list keeps its own look.
|
|
9
|
+
const TabsVariantContext = createContext('line');
|
|
10
|
+
export const Tabs = ({ className, ...props }) => (_jsx(TabsPrimitive.Root, { className: cn('flex flex-col gap-4', className), "data-slot": "tabs", ...props }));
|
|
11
|
+
/**
|
|
12
|
+
* More tabs than fit scroll sideways, as the dock's items do: a chevron either side, the edge with
|
|
13
|
+
* more faded, and the active tab kept in view. A list that fits is left exactly as it was: it only
|
|
14
|
+
* becomes a scroller once it overflows, so a focus ring on its first or last tab is never clipped.
|
|
15
|
+
*/
|
|
16
|
+
export const TabsList = ({ activateOnFocus = true, variant = 'line', className, ...props }) => {
|
|
17
|
+
const { ref, edges, step, reveal, style } = useOverflowScroll();
|
|
18
|
+
const list = useRef(null);
|
|
19
|
+
const shown = useRef({
|
|
20
|
+
tab: null,
|
|
21
|
+
});
|
|
22
|
+
const setList = useCallback((node) => {
|
|
23
|
+
list.current = node;
|
|
24
|
+
ref(node);
|
|
25
|
+
}, [ref]);
|
|
26
|
+
// Brought into view only when the active tab changes, as the top nav does, so a re-render never
|
|
27
|
+
// scrolls the row back while someone is looking along it. The list holds no value, so the
|
|
28
|
+
// active tab is known by its place; `reveal` is new once the row has mounted, and the row
|
|
29
|
+
// starting to scroll counts too, since only then can the tab be out of view.
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
const tabs = Array.from(list.current?.children ?? []);
|
|
32
|
+
const index = tabs.findIndex(tab => tab.matches('[data-active]'));
|
|
33
|
+
const tab = index < 0 ? null : `${index}:${tabs[index]?.textContent ?? ''}`;
|
|
34
|
+
const { overflows } = edges;
|
|
35
|
+
const last = shown.current;
|
|
36
|
+
if (tab === last.tab && reveal === last.reveal && overflows === last.overflows)
|
|
37
|
+
return;
|
|
38
|
+
shown.current = { tab, overflows, reveal };
|
|
39
|
+
if (tab && overflows)
|
|
40
|
+
reveal('[data-active]');
|
|
41
|
+
});
|
|
42
|
+
return (_jsx(TabsVariantContext.Provider, { value: variant, children: _jsxs("div", { className: cn('relative flex min-w-0 items-center',
|
|
43
|
+
// The hairline belongs to the frame, not the scroller, so it runs the full width
|
|
44
|
+
// under the chevrons and never fades with the row. The active tab's underline
|
|
45
|
+
// paints over its last pixel, as it hung over the list's border before.
|
|
46
|
+
variant === 'line' &&
|
|
47
|
+
"before:absolute before:inset-x-0 before:bottom-0 before:h-px before:bg-neutral-200 before:content-['']"), "data-slot": "tabs-list-frame", children: [edges.overflows && (_jsx(OverflowChevron, { className: chevron, direction: -1, disabled: !edges.start, onStep: step })), _jsx(TabsPrimitive.List
|
|
48
|
+
// Arrow keys select as they move, as they did before: a tab here only swaps a panel, so
|
|
49
|
+
// there is nothing costly to guard behind Enter.
|
|
50
|
+
, {
|
|
51
|
+
// Arrow keys select as they move, as they did before: a tab here only swaps a panel, so
|
|
52
|
+
// there is nothing costly to guard behind Enter.
|
|
53
|
+
activateOnFocus: activateOnFocus, className: cn('flex min-w-0 flex-1 items-center', variant === 'pill' && 'gap-0.5',
|
|
54
|
+
// Scrolling, the row clips 4px over and under its tabs, so a focus ring keeps its room.
|
|
55
|
+
edges.overflows && 'scrollbar-none -my-1 overflow-x-auto py-1', className), "data-slot": "tabs-list", "data-variant": variant, ref: setList, style: edges.overflows ? style : undefined, ...props }), edges.overflows && (_jsx(OverflowChevron, { className: chevron, direction: 1, disabled: !edges.end, onStep: step }))] }) }));
|
|
56
|
+
};
|
|
57
|
+
// A pill tab's 34px and corner, for both looks.
|
|
58
|
+
const chevron = 'size-control rounded-control';
|
|
59
|
+
const triggerVariants = {
|
|
60
|
+
// The control row's height and corner, so a pill tab sits level with the buttons and fields beside it.
|
|
61
|
+
pill: 'h-control rounded-control px-3 text-neutral-600 hover:bg-neutral-950/5 hover:text-neutral-950 data-active:bg-tint data-active:text-tint-fg',
|
|
62
|
+
// Set edge to edge, so the underline spans the tab, and 44px tall, so the label has room above the line.
|
|
63
|
+
// Its last pixel is the frame's hairline, so the 2px underline sits on the line, not above it.
|
|
64
|
+
line: "relative h-tab rounded-chip px-3 text-neutral-600 after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 after:bg-neutral-950 after:opacity-0 after:transition-opacity after:duration-150 after:content-[''] hover:text-neutral-950 data-active:text-neutral-950 data-active:after:opacity-100",
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* One tab. Holds, in this order: an optional leading icon, the label, then an optional trailing
|
|
68
|
+
* piece (a `TabsCount`, a `Kbd`, a `StatusDot` or an icon). Badges and chips stay out: at 22–25px
|
|
69
|
+
* they fill a 29px tab and read as a button inside a button.
|
|
70
|
+
*/
|
|
71
|
+
export const TabsTrigger = ({ className, ...props }) => {
|
|
72
|
+
const variant = useContext(TabsVariantContext);
|
|
73
|
+
return (_jsx(TabsPrimitive.Tab, { className: cn('inline-flex cursor-pointer select-none items-center justify-center gap-2 whitespace-nowrap font-medium text-xs transition-[background-color,color] duration-150', triggerVariants[variant],
|
|
74
|
+
// Base UI marks a disabled tab with data-disabled, which also covers a rendered non-button.
|
|
75
|
+
'data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg:not([class*=size-])]:size-icon [&_svg]:shrink-0', focusRing, className), "data-slot": "tabs-trigger", ...props }));
|
|
76
|
+
};
|
|
77
|
+
/** The number after a tab's label ("Findings 12"). Takes the tab's colour, so it follows the active state. */
|
|
78
|
+
export const TabsCount = ({ className, ...props }) => (_jsx("span", { className: cn('inline-flex h-4 min-w-4 items-center justify-center rounded-pill bg-current/10 px-1 font-medium text-xxs tabular-nums', className), "data-slot": "tabs-count", ...props }));
|
|
79
|
+
export const TabsContent = ({ className, ...props }) => (_jsx(TabsPrimitive.Panel, { className: cn(focusRing, className), "data-slot": "tabs-content", ...props }));
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
/** A multi-line Input (medium size): same border states, grows downwards only. */
|
|
3
|
+
export declare const Textarea: ({ className, id, disabled, "aria-describedby": describedBy, "aria-invalid": ariaInvalid, ...props }: ComponentProps<"textarea">) => import("react").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from '../lib/cn.js';
|
|
4
|
+
import { focusRing } from './button.js';
|
|
5
|
+
import { useFieldControl } from './field.js';
|
|
6
|
+
import { inputTextClass } from './input.js';
|
|
7
|
+
/** A multi-line Input (medium size): same border states, grows downwards only. */
|
|
8
|
+
export const Textarea = ({ className, id, disabled, 'aria-describedby': describedBy, 'aria-invalid': ariaInvalid, ...props }) => {
|
|
9
|
+
const { invalid, ...control } = useFieldControl({
|
|
10
|
+
id,
|
|
11
|
+
disabled,
|
|
12
|
+
'aria-describedby': describedBy,
|
|
13
|
+
'aria-invalid': ariaInvalid,
|
|
14
|
+
});
|
|
15
|
+
return (_jsx("textarea", { className: cn('block min-h-24 w-full resize-y rounded-control border bg-control px-3 py-2.5 shadow-control transition-[border-color,background-color] duration-150', inputTextClass, 'disabled:opacity-50', focusRing, invalid
|
|
16
|
+
? 'border-error-500'
|
|
17
|
+
: control.disabled
|
|
18
|
+
? 'border-neutral-200'
|
|
19
|
+
: 'border-neutral-200 hover:border-neutral-300 hover:bg-control-hover hover:placeholder:text-neutral-700 focus:border-neutral-300', className), "data-slot": "textarea", ...control, ...props }));
|
|
20
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
export type ThemeMode = 'light' | 'dark';
|
|
4
|
+
type ThemeValue = {
|
|
5
|
+
/** The id of a custom theme (its `.continuum[data-theme=…]` block); none for the default. */
|
|
6
|
+
theme?: string;
|
|
7
|
+
mode: ThemeMode;
|
|
8
|
+
/** Corner scale: every radius token times this; 1 is the theme as drawn. */
|
|
9
|
+
radius: number;
|
|
10
|
+
};
|
|
11
|
+
export declare const useTheme: () => ThemeValue;
|
|
12
|
+
type ThemeProps = useRender.ComponentProps<'div'> & Partial<ThemeValue>;
|
|
13
|
+
/**
|
|
14
|
+
* Opens a themed scope. Everything the system styles has to sit inside one,
|
|
15
|
+
* because the tokens and the built stylesheet only apply under `.continuum`.
|
|
16
|
+
* `theme` names a custom theme written by the theme builder or `createThemeCss`;
|
|
17
|
+
* without one the default tokens apply. Pass `render={<body />}` or any element
|
|
18
|
+
* to make it the scope itself.
|
|
19
|
+
*/
|
|
20
|
+
export declare const Theme: ({ theme, mode, radius, render, ref, className, style, ...props }: ThemeProps) => import("react").JSX.Element;
|
|
21
|
+
/**
|
|
22
|
+
* Where the overlays inside it open: menus, popovers, tooltips, dialogs, sheets and toasts portal
|
|
23
|
+
* into `container` instead of the body. The container has to hold fixed descendants (a transform,
|
|
24
|
+
* `contain: paint` or `container-type: size`) and be sized to the screen it stands for, so a scrim,
|
|
25
|
+
* a sheet and a menu's collisions keep to it, as a preview of a phone's screen needs. An overlay's
|
|
26
|
+
* own `container` prop still wins.
|
|
27
|
+
*/
|
|
28
|
+
export declare const PortalContainer: ({ container, children, }: {
|
|
29
|
+
container: HTMLElement | null;
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
}) => import("react").JSX.Element;
|
|
32
|
+
/** The container an overlay portals into: its own if given, else the nearest PortalContainer's, else the body. */
|
|
33
|
+
export declare const usePortalContainer: <T = HTMLElement>(container?: T | null) => HTMLElement | NonNullable<T> | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Re-opens the current theme inside a portal. Base UI renders menus, tooltips
|
|
36
|
+
* and dialogs at the end of the body, outside the scope that styles them.
|
|
37
|
+
*/
|
|
38
|
+
export declare const ThemeScope: ({ children }: {
|
|
39
|
+
children: ReactNode;
|
|
40
|
+
}) => import("react").JSX.Element;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { mergeProps } from '@base-ui/react/merge-props';
|
|
4
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
5
|
+
import { LucideProvider } from 'lucide-react';
|
|
6
|
+
import { createContext, useContext, useMemo } from 'react';
|
|
7
|
+
import { cn } from '../lib/cn.js';
|
|
8
|
+
const ThemeContext = createContext({ mode: 'light', radius: 1 });
|
|
9
|
+
/** The scale as a style, left off at 1 so the theme's own values apply untouched. */
|
|
10
|
+
const radiusStyle = (radius, style) => radius === 1 ? style : { ...style, '--continuum-radius-scale': radius };
|
|
11
|
+
export const useTheme = () => useContext(ThemeContext);
|
|
12
|
+
/**
|
|
13
|
+
* Opens a themed scope. Everything the system styles has to sit inside one,
|
|
14
|
+
* because the tokens and the built stylesheet only apply under `.continuum`.
|
|
15
|
+
* `theme` names a custom theme written by the theme builder or `createThemeCss`;
|
|
16
|
+
* without one the default tokens apply. Pass `render={<body />}` or any element
|
|
17
|
+
* to make it the scope itself.
|
|
18
|
+
*/
|
|
19
|
+
export const Theme = ({ theme, mode, radius, render, ref, className, style, ...props }) => {
|
|
20
|
+
const parent = useTheme();
|
|
21
|
+
const value = useMemo(() => ({
|
|
22
|
+
theme: theme ?? parent.theme,
|
|
23
|
+
mode: mode ?? parent.mode,
|
|
24
|
+
radius: radius ?? parent.radius,
|
|
25
|
+
}), [theme, mode, radius, parent.theme, parent.mode, parent.radius]);
|
|
26
|
+
const element = useRender({
|
|
27
|
+
defaultTagName: 'div',
|
|
28
|
+
render,
|
|
29
|
+
ref,
|
|
30
|
+
props: mergeProps({
|
|
31
|
+
className: cn('continuum', className),
|
|
32
|
+
style: radiusStyle(value.radius, style),
|
|
33
|
+
// Plain attributes rather than state, so a missing theme sets no attribute at all.
|
|
34
|
+
...{ 'data-theme': value.theme, 'data-mode': value.mode },
|
|
35
|
+
}, props),
|
|
36
|
+
});
|
|
37
|
+
return (_jsx(ThemeContext.Provider, { value: value, children: _jsx(LucideProvider, { size: 16, strokeWidth: 2, children: element }) }));
|
|
38
|
+
};
|
|
39
|
+
const PortalContext = createContext(null);
|
|
40
|
+
/**
|
|
41
|
+
* Where the overlays inside it open: menus, popovers, tooltips, dialogs, sheets and toasts portal
|
|
42
|
+
* into `container` instead of the body. The container has to hold fixed descendants (a transform,
|
|
43
|
+
* `contain: paint` or `container-type: size`) and be sized to the screen it stands for, so a scrim,
|
|
44
|
+
* a sheet and a menu's collisions keep to it, as a preview of a phone's screen needs. An overlay's
|
|
45
|
+
* own `container` prop still wins.
|
|
46
|
+
*/
|
|
47
|
+
export const PortalContainer = ({ container, children, }) => _jsx(PortalContext.Provider, { value: container, children: children });
|
|
48
|
+
/** The container an overlay portals into: its own if given, else the nearest PortalContainer's, else the body. */
|
|
49
|
+
export const usePortalContainer = (container) => {
|
|
50
|
+
const fallback = useContext(PortalContext);
|
|
51
|
+
return container ?? fallback ?? undefined;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Re-opens the current theme inside a portal. Base UI renders menus, tooltips
|
|
55
|
+
* and dialogs at the end of the body, outside the scope that styles them.
|
|
56
|
+
*/
|
|
57
|
+
export const ThemeScope = ({ children }) => {
|
|
58
|
+
const { theme, mode, radius } = useTheme();
|
|
59
|
+
return (_jsx("div", { className: "continuum contents", "data-mode": mode, "data-theme": theme, style: radiusStyle(radius), children: children }));
|
|
60
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { type ComponentProps, type ReactNode } from 'react';
|
|
3
|
+
export declare const thinkingMarkVariants: (props?: ({
|
|
4
|
+
size?: "sm" | "md" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
export type ThinkingMarkProps = Omit<ComponentProps<'span'>, 'children'> & VariantProps<typeof thinkingMarkVariants>;
|
|
7
|
+
/**
|
|
8
|
+
* Nine small squares in the text colour, in a 3 by 3 grid, with a wave rolling across them from the
|
|
9
|
+
* top left corner to the bottom right: each swells to full and back as it passes (1.4s a wave, 2.8s
|
|
10
|
+
* under reduced motion). Decorative; whatever holds it says what is happening.
|
|
11
|
+
*/
|
|
12
|
+
export declare const ThinkingMark: ({ size, className, ...props }: ThinkingMarkProps) => import("react").JSX.Element;
|
|
13
|
+
export type ThinkingTextProps = ComponentProps<'span'>;
|
|
14
|
+
/**
|
|
15
|
+
* Words that are being worked on: a band of light crosses them, letter by letter, every 2s, from the
|
|
16
|
+
* line's own grey to full ink and back, so the words themselves say the work is going on. Still, in
|
|
17
|
+
* `neutral-600`, under reduced motion.
|
|
18
|
+
*/
|
|
19
|
+
export declare const ThinkingText: ({ className, ...props }: ThinkingTextProps) => import("react").JSX.Element;
|
|
20
|
+
export type ThinkingProps = ComponentProps<'output'> & VariantProps<typeof thinkingMarkVariants> & {
|
|
21
|
+
/** What it is doing, in a few words; "Thinking" when left out. Announced when it changes. */
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* The mark and a few words beside it, in a line ("Thinking", "Searching the docs"): for a short wait
|
|
26
|
+
* with something already on screen to sit beside. A status: its words are read once, and again when
|
|
27
|
+
* they change.
|
|
28
|
+
*/
|
|
29
|
+
export declare const Thinking: ({ size, children, className, ...props }: ThinkingProps) => import("react").JSX.Element;
|
|
30
|
+
export type ThinkingCaretProps = Omit<ComponentProps<'span'>, 'children'> & {
|
|
31
|
+
/** Read once when the words start coming; `false` for a message that says it is busy itself. */
|
|
32
|
+
label?: string | false;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* One square at the end of words still coming in, swelling and fading (1.2s each way, 2.4s under
|
|
36
|
+
* reduced motion). It goes after the last word and moves on with the text; take it away when the
|
|
37
|
+
* last word is in.
|
|
38
|
+
*/
|
|
39
|
+
export declare const ThinkingCaret: ({ label, className, ...props }: ThinkingCaretProps) => import("react").JSX.Element;
|
|
40
|
+
/** "42s", "3m 05s", "1h 12m": how long a run has been going, short enough to sit beside its title. */
|
|
41
|
+
export declare const formatThinkingElapsed: (ms: number) => string;
|
|
42
|
+
export type ThinkingStep = {
|
|
43
|
+
label: ReactNode;
|
|
44
|
+
/** Done, being worked on now, or still to come. */
|
|
45
|
+
state: 'done' | 'active' | 'waiting';
|
|
46
|
+
};
|
|
47
|
+
export type ThinkingRunProps = Omit<ComponentProps<'div'>, 'title'> & {
|
|
48
|
+
/**
|
|
49
|
+
* The run's steps, when it knows them: listed under the title, the finished ones with a check, the
|
|
50
|
+
* one it is on with the mark and its words lit, the ones to come faint. Takes the place of the
|
|
51
|
+
* step line.
|
|
52
|
+
*/
|
|
53
|
+
steps?: ThinkingStep[];
|
|
54
|
+
/** What the run is doing as a whole: "Reconciling March invoices". */
|
|
55
|
+
title: ReactNode;
|
|
56
|
+
/** The step it is on now, in a line: "Reading invoices.csv". Announced as it changes. */
|
|
57
|
+
children?: ReactNode;
|
|
58
|
+
/** When the run began; the time since counts up beside the title, every second. */
|
|
59
|
+
startedAt?: number | Date;
|
|
60
|
+
/** At the end of the row, usually a secondary "Stop" button. */
|
|
61
|
+
action?: ReactNode;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* A run that takes a while (tens of seconds to minutes): a card with the mark, what the run is doing
|
|
65
|
+
* and the step it is on, how long it has been going, and a way to stop it; a light runs along its
|
|
66
|
+
* bottom edge, so it reads as working even while the step stays the same.
|
|
67
|
+
*/
|
|
68
|
+
export declare const ThinkingRun: ({ title, children, steps, startedAt, action, className, ...props }: ThinkingRunProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { Check } from 'lucide-react';
|
|
5
|
+
import { useEffect, useState } from 'react';
|
|
6
|
+
import { cn } from '../lib/cn.js';
|
|
7
|
+
/*
|
|
8
|
+
* What shows while an assistant thinks or works, in three sizes of wait. All of it moves by opacity
|
|
9
|
+
* and translate alone, so it stays smooth while the page is busy streaming, and every loop slows
|
|
10
|
+
* under reduced motion rather than stop: a still mark would read as stuck, not as thinking.
|
|
11
|
+
*/
|
|
12
|
+
export const thinkingMarkVariants = cva('inline-grid shrink-0 grid-cols-3', {
|
|
13
|
+
variants: {
|
|
14
|
+
size: {
|
|
15
|
+
// Nine 2 squares 1 apart (8 across), beside 11px type.
|
|
16
|
+
sm: 'gap-px *:size-0.5',
|
|
17
|
+
// Nine 3 squares 1 apart (11 across), beside 13px type.
|
|
18
|
+
md: 'gap-px *:size-[3px]',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
defaultVariants: { size: 'md' },
|
|
22
|
+
});
|
|
23
|
+
// Each square's diagonal, 0 at the top left to 4 at the bottom right: the wave reaches them in turn.
|
|
24
|
+
const squares = Array.from({ length: 9 }, (_, index) => (index % 3) + Math.floor(index / 3));
|
|
25
|
+
/**
|
|
26
|
+
* Nine small squares in the text colour, in a 3 by 3 grid, with a wave rolling across them from the
|
|
27
|
+
* top left corner to the bottom right: each swells to full and back as it passes (1.4s a wave, 2.8s
|
|
28
|
+
* under reduced motion). Decorative; whatever holds it says what is happening.
|
|
29
|
+
*/
|
|
30
|
+
export const ThinkingMark = ({ size, className, ...props }) => (_jsx("span", { "aria-hidden": true, className: cn(
|
|
31
|
+
// The wave's length is set once here and each diagonal starts an eighth of it later.
|
|
32
|
+
'[--think:1.4s] motion-reduce:[--think:2.8s]', thinkingMarkVariants({ size }), className), "data-slot": "thinking-mark", ...props, children: squares.map((diagonal, index) => (_jsx("span", { className: "animate-think rounded-[0.5px] bg-current [animation-duration:var(--think)]",
|
|
33
|
+
// Negative, so the wave is already rolling on the first frame instead of starting dark.
|
|
34
|
+
style: { animationDelay: `calc(var(--think) * ${diagonal / 8 - 1})` } }, index))) }));
|
|
35
|
+
/**
|
|
36
|
+
* Words that are being worked on: a band of light crosses them, letter by letter, every 2s, from the
|
|
37
|
+
* line's own grey to full ink and back, so the words themselves say the work is going on. Still, in
|
|
38
|
+
* `neutral-600`, under reduced motion.
|
|
39
|
+
*/
|
|
40
|
+
export const ThinkingText = ({ className, ...props }) => (_jsx("span", { className: cn('animate-glint bg-[linear-gradient(90deg,var(--color-neutral-600)_40%,var(--color-neutral-950)_50%,var(--color-neutral-600)_60%)] bg-size-[200%_100%] bg-clip-text text-transparent', 'motion-reduce:animate-none motion-reduce:bg-none motion-reduce:text-neutral-600', className), "data-slot": "thinking-text", ...props }));
|
|
41
|
+
/**
|
|
42
|
+
* The mark and a few words beside it, in a line ("Thinking", "Searching the docs"): for a short wait
|
|
43
|
+
* with something already on screen to sit beside. A status: its words are read once, and again when
|
|
44
|
+
* they change.
|
|
45
|
+
*/
|
|
46
|
+
export const Thinking = ({ size, children = 'Thinking', className, ...props }) => (_jsxs("output", { "aria-atomic": true, className: cn('inline-flex min-w-0 items-center text-neutral-600', size === 'sm' ? 'gap-1.5 text-xxs' : 'gap-2 text-xs', className), "data-slot": "thinking", ...props, children: [_jsx(ThinkingMark, { className: "text-neutral-950", size: size }), _jsx(ThinkingText, { className: "min-w-0 truncate", children: children })] }));
|
|
47
|
+
/**
|
|
48
|
+
* One square at the end of words still coming in, swelling and fading (1.2s each way, 2.4s under
|
|
49
|
+
* reduced motion). It goes after the last word and moves on with the text; take it away when the
|
|
50
|
+
* last word is in.
|
|
51
|
+
*/
|
|
52
|
+
export const ThinkingCaret = ({ label = 'Writing', className, ...props }) => (_jsxs("span", { className: "contents", "data-slot": "thinking-caret-root", children: [_jsx("span", { "aria-hidden": true, className: cn(
|
|
53
|
+
// A 6 square on the baseline, 4 after the last letter: a block, so it never reads as a
|
|
54
|
+
// text caret the reader could type at.
|
|
55
|
+
'ml-1 inline-block size-1.5 animate-breathe rounded-[1px] bg-current align-baseline text-neutral-950 motion-reduce:[animation-duration:2.4s]', className), "data-slot": "thinking-caret", ...props }), label !== false && _jsx("output", { className: "sr-only", children: label })] }));
|
|
56
|
+
/** "42s", "3m 05s", "1h 12m": how long a run has been going, short enough to sit beside its title. */
|
|
57
|
+
export const formatThinkingElapsed = (ms) => {
|
|
58
|
+
const total = Math.max(0, Math.floor(ms / 1000));
|
|
59
|
+
const h = Math.floor(total / 3600);
|
|
60
|
+
const m = Math.floor((total % 3600) / 60);
|
|
61
|
+
const s = total % 60;
|
|
62
|
+
if (h > 0)
|
|
63
|
+
return `${h}h ${String(m).padStart(2, '0')}m`;
|
|
64
|
+
if (m > 0)
|
|
65
|
+
return `${m}m ${String(s).padStart(2, '0')}s`;
|
|
66
|
+
return `${s}s`;
|
|
67
|
+
};
|
|
68
|
+
// The time since `from`, every second; nothing until it has mounted, so a server render matches.
|
|
69
|
+
const useElapsed = (from) => {
|
|
70
|
+
const start = from instanceof Date ? from.getTime() : from;
|
|
71
|
+
const [now, setNow] = useState(null);
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (start == null)
|
|
74
|
+
return;
|
|
75
|
+
setNow(Date.now());
|
|
76
|
+
const timer = window.setInterval(() => setNow(Date.now()), 1000);
|
|
77
|
+
return () => window.clearInterval(timer);
|
|
78
|
+
}, [start]);
|
|
79
|
+
return start == null || now == null ? null : now - start;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* A run that takes a while (tens of seconds to minutes): a card with the mark, what the run is doing
|
|
83
|
+
* and the step it is on, how long it has been going, and a way to stop it; a light runs along its
|
|
84
|
+
* bottom edge, so it reads as working even while the step stays the same.
|
|
85
|
+
*/
|
|
86
|
+
export const ThinkingRun = ({ title, children, steps, startedAt, action, className, ...props }) => {
|
|
87
|
+
const elapsed = useElapsed(startedAt);
|
|
88
|
+
const active = steps?.find(step => step.state === 'active');
|
|
89
|
+
return (_jsxs("div", { "aria-busy": true, className: cn('relative flex min-w-0 flex-col gap-3 rounded-card border border-neutral-200 bg-neutral-50 py-3 pr-3 pl-4', className), "data-slot": "thinking-run", ...props, children: [_jsxs("div", { className: "flex min-w-0 items-center gap-3", children: [_jsxs("div", { className: "flex min-w-0 flex-1 gap-3", children: [_jsx("span", { className: "flex h-lh w-[11px] shrink-0 items-center text-neutral-950 text-xs", children: _jsx(ThinkingMark, {}) }), _jsxs("output", { "aria-atomic": true, className: "flex min-w-0 flex-col text-xs", children: [_jsx("span", { className: "truncate font-medium text-neutral-950", children: title }), steps === undefined && children != null && children !== false && (_jsx(ThinkingText, { className: "truncate", "data-slot": "thinking-run-step", children: children })), active && _jsx("span", { className: "sr-only", children: active.label })] })] }), elapsed != null && (_jsx("span", { className: "shrink-0 text-neutral-600 text-xxs tabular-nums", "data-slot": "thinking-run-elapsed", children: formatThinkingElapsed(elapsed) })), action] }), steps && (
|
|
90
|
+
// The steps, under the title and on its text edge: the mark's 11 slot, then 12.
|
|
91
|
+
_jsx("ol", { "aria-hidden": true, className: "flex flex-col gap-2 pl-[23px] text-xs", "data-slot": "thinking-run-steps", children: steps.map((step, index) => (_jsxs("li", { className: "flex min-w-0 items-center gap-3", "data-state": step.state, children: [_jsxs("span", { className: "flex w-[11px] shrink-0 justify-center", children: [step.state === 'done' && (_jsx(Check, { className: "size-3 text-neutral-500", strokeWidth: 2.5 })), step.state === 'active' && (_jsx(ThinkingMark, { className: "text-neutral-950", size: "sm" })), step.state === 'waiting' && (_jsx("span", { className: "size-1 rounded-[1px] bg-neutral-300" }))] }), step.state === 'active' ? (_jsx(ThinkingText, { className: "truncate", children: step.label })) : (_jsx("span", { className: cn('truncate', step.state === 'done'
|
|
92
|
+
? 'text-neutral-600'
|
|
93
|
+
: 'text-neutral-400'), children: step.label }))] }, index))) })), _jsx("span", { "aria-hidden": true, className: "pointer-events-none absolute -inset-px overflow-hidden rounded-[inherit]", children: _jsx("span", { className: "absolute inset-x-0 bottom-0 h-px", children: _jsx("span", { className: "absolute inset-y-0 left-0 w-1/4 animate-sweep bg-linear-to-r from-transparent via-neutral-950 to-transparent motion-reduce:w-full motion-reduce:animate-breathe motion-reduce:via-neutral-400 motion-reduce:[animation-duration:2.4s]" }) }) })] }));
|
|
94
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Toast as ToastPrimitive } from '@base-ui/react/toast';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
export type ToastProviderProps = {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
/** How long a toast stays, in ms; 0 keeps it until it is closed. */
|
|
6
|
+
timeout?: number;
|
|
7
|
+
/** How many show at once; older ones leave first. */
|
|
8
|
+
limit?: number;
|
|
9
|
+
/** Where the toasts are portalled; the body by default. */
|
|
10
|
+
container?: HTMLElement | null;
|
|
11
|
+
/** Classes for the stack; lift it with `bottom-*` where a bottom bar sits below. */
|
|
12
|
+
viewportClassName?: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Holds the toasts for everything inside it and draws them in the bottom right corner, across the
|
|
16
|
+
* foot on a phone. They pile up, the newest in front and the older ones peeking
|
|
17
|
+
* over it; pointing at the pile fans it out. Raise one from anywhere below it with
|
|
18
|
+
* `useToast().add({ title, description, type, actionProps })`; a `data.tab` makes it a folder card.
|
|
19
|
+
*/
|
|
20
|
+
export declare const ToastProvider: ({ children, timeout, limit, container, viewportClassName, }: ToastProviderProps) => import("react").JSX.Element;
|
|
21
|
+
/** The toast manager: `add`, `close`, `update` and `promise`, and the toasts showing now. */
|
|
22
|
+
export declare const useToast: typeof ToastPrimitive.useToastManager;
|
|
23
|
+
/** Per-toast options, passed as `data` to `add`. */
|
|
24
|
+
export type ToastData = {
|
|
25
|
+
/**
|
|
26
|
+
* A tab on top, like a folder's, saying what is going on ("Report archived", "Export in
|
|
27
|
+
* progress"); the action moves into it beside the words.
|
|
28
|
+
*/
|
|
29
|
+
tab?: string;
|
|
30
|
+
/** A 16px icon, or a 36px picture of the thing, for the well, where a `type` has none of its own. */
|
|
31
|
+
icon?: ReactNode;
|
|
32
|
+
/** The action's icon; an undo arrow for an `undo` action, an arrow for anything else. Its label names it. */
|
|
33
|
+
actionIcon?: ReactNode;
|
|
34
|
+
/**
|
|
35
|
+
* The action takes back what the toast reports, so it draws the undo arrow whatever its label
|
|
36
|
+
* says ("Restore", "Ongedaan maken"). Left out, an action labelled "Undo" still counts as one.
|
|
37
|
+
*/
|
|
38
|
+
undo?: boolean;
|
|
39
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Toast as ToastPrimitive } from '@base-ui/react/toast';
|
|
4
|
+
import { ArrowRight, CircleAlert, CircleCheck, Info, TriangleAlert, Undo2, X } from 'lucide-react';
|
|
5
|
+
import { cn } from '../lib/cn.js';
|
|
6
|
+
import { focusRing } from './button.js';
|
|
7
|
+
import { Theme, ThemeScope, usePortalContainer, useTheme } from './theme.js';
|
|
8
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from './tooltip.js';
|
|
9
|
+
/*
|
|
10
|
+
* A layer above dialogs, menus and tooltips (z-50): a toast raised while a dialog is open reports on
|
|
11
|
+
* what the dialog did, so it stands over the scrim rather than under it.
|
|
12
|
+
*/
|
|
13
|
+
const TOAST_LAYER = 'z-60';
|
|
14
|
+
/**
|
|
15
|
+
* Holds the toasts for everything inside it and draws them in the bottom right corner, across the
|
|
16
|
+
* foot on a phone. They pile up, the newest in front and the older ones peeking
|
|
17
|
+
* over it; pointing at the pile fans it out. Raise one from anywhere below it with
|
|
18
|
+
* `useToast().add({ title, description, type, actionProps })`; a `data.tab` makes it a folder card.
|
|
19
|
+
*/
|
|
20
|
+
export const ToastProvider = ({ children, timeout = 5000, limit = 3, container, viewportClassName, }) => (_jsxs(ToastPrimitive.Provider, { limit: limit, timeout: timeout, children: [children, _jsx(ToastPrimitive.Portal, { container: usePortalContainer(container), children: _jsx(ThemeScope, { children: _jsx(ToastPrimitive.Viewport, { className: cn(
|
|
21
|
+
// The toasts stand on its foot, so it needs a width but no height.
|
|
22
|
+
'fixed right-6 bottom-6 w-toast outline-none max-sm:inset-x-4 max-sm:bottom-4 max-sm:w-auto', TOAST_LAYER, viewportClassName), "data-slot": "toast-viewport", children: _jsx(ToastList, {}) }) }) })] }));
|
|
23
|
+
/** The toast manager: `add`, `close`, `update` and `promise`, and the toasts showing now. */
|
|
24
|
+
export const useToast = ToastPrimitive.useToastManager;
|
|
25
|
+
// The tones and glyphs of an Alert, so a toast of a type reads as an alert of that tone would.
|
|
26
|
+
const typeIcons = {
|
|
27
|
+
primary: _jsx(Info, { strokeWidth: 2 }),
|
|
28
|
+
success: _jsx(CircleCheck, { strokeWidth: 2 }),
|
|
29
|
+
warning: _jsx(TriangleAlert, { strokeWidth: 2 }),
|
|
30
|
+
error: _jsx(CircleAlert, { strokeWidth: 2 }),
|
|
31
|
+
};
|
|
32
|
+
// The well takes the badge's wash, its 500 at 20%, under the glyph at 700: a glyph needs 3:1 on
|
|
33
|
+
// it, which 700 reaches in every tone, where the badge's words need 4.5:1 and take 800.
|
|
34
|
+
const wellTones = {
|
|
35
|
+
primary: 'bg-primary-500/20 text-primary-700',
|
|
36
|
+
success: 'bg-success-500/20 text-success-700',
|
|
37
|
+
warning: 'bg-warning-500/20 text-warning-700',
|
|
38
|
+
error: 'bg-error-500/20 text-error-700',
|
|
39
|
+
neutral: 'bg-neutral-500/20 text-neutral-700',
|
|
40
|
+
};
|
|
41
|
+
/*
|
|
42
|
+
* The pile, from the variables Base UI sets on each toast. Collapsed, a toast behind the front one
|
|
43
|
+
* takes its height, shrinks a tenth per place and rises 8px a place, so the older ones peek over
|
|
44
|
+
* the front. Fanned out, each stands at its own offset with a 12px gap, and the gap is bridged so
|
|
45
|
+
* the pointer can cross it without the pile closing.
|
|
46
|
+
*/
|
|
47
|
+
const pileClass = [
|
|
48
|
+
'[--gap:12px] [--peek:8px] [--scale:calc(max(0,1-(var(--toast-index)*0.1)))] [--shrink:calc(1-var(--scale))]',
|
|
49
|
+
'[--height:var(--toast-frontmost-height,var(--toast-height))]',
|
|
50
|
+
'[--offset-y:calc(var(--toast-offset-y)*-1-var(--toast-index)*var(--gap)+var(--toast-swipe-movement-y))]',
|
|
51
|
+
'group/toast absolute right-0 bottom-0 z-[calc(100-var(--toast-index))] flex w-full origin-bottom flex-col items-end',
|
|
52
|
+
// Behind, it is cut to the front one's height; its top, a tab or a card's edge, is what shows.
|
|
53
|
+
'h-(--height) overflow-hidden data-expanded:h-(--toast-height) data-expanded:overflow-visible',
|
|
54
|
+
'[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-var(--toast-index)*var(--peek)-var(--shrink)*var(--height)))_scale(var(--scale))]',
|
|
55
|
+
'data-expanded:[transform:translateX(var(--toast-swipe-movement-x))_translateY(var(--offset-y))]',
|
|
56
|
+
"after:absolute after:top-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']",
|
|
57
|
+
// It rises in from below and leaves the way it is swiped, or back down.
|
|
58
|
+
'data-starting-style:[transform:translateY(24px)] data-starting-style:opacity-0',
|
|
59
|
+
'data-ending-style:opacity-0 [&[data-ending-style]:not([data-swipe-direction])]:[transform:translateY(24px)]',
|
|
60
|
+
'data-ending-style:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+100%))]',
|
|
61
|
+
'data-ending-style:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+100%))]',
|
|
62
|
+
// Past the limit, the oldest fades out of the back of the pile.
|
|
63
|
+
'data-limited:opacity-0',
|
|
64
|
+
'[transition:transform_400ms_var(--ease-out-strong),opacity_400ms,height_150ms] motion-reduce:transition-none',
|
|
65
|
+
];
|
|
66
|
+
// What a toast says shows only at the front of the pile or once it fans out; behind, just its shape.
|
|
67
|
+
const faceClass = 'opacity-[calc(1-min(var(--toast-index),1))] transition-opacity duration-200 group-data-expanded/toast:opacity-100';
|
|
68
|
+
// The surface, a hairline round it, in the mode opposite the page's (see ToastList).
|
|
69
|
+
const surfaceClass = 'border border-neutral-200 bg-neutral-50 text-neutral-950 text-xs';
|
|
70
|
+
// A 36px square on the card: the ×, and the action when there is no tab to hold it.
|
|
71
|
+
const squareClass = cn('inline-flex size-option shrink-0 cursor-pointer items-center justify-center rounded-item text-neutral-600 transition-[background-color,color] duration-150 hover:bg-neutral-950/5 hover:text-neutral-950 [&_svg]:size-4', focusRing, faceClass);
|
|
72
|
+
// Past these, a title or description wraps in the 360px card.
|
|
73
|
+
const LONG_TITLE = 32;
|
|
74
|
+
const LONG_DESCRIPTION = 44;
|
|
75
|
+
/**
|
|
76
|
+
* The action as an icon, named in a tooltip, since Base UI's own action always shows its label.
|
|
77
|
+
* In a tab it sits in the line of text and only darkens and lightens, as a word would; on the
|
|
78
|
+
* card it is a 36px square beside the ×.
|
|
79
|
+
*/
|
|
80
|
+
const ToastActionIcon = ({ toast, inTab }) => {
|
|
81
|
+
const { children: label, ...actionProps } = toast.actionProps ?? {};
|
|
82
|
+
if (!label)
|
|
83
|
+
return null;
|
|
84
|
+
return (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { render: _jsx("button", { ...actionProps, "aria-label": typeof label === 'string' ? label : undefined, className: inTab
|
|
85
|
+
? cn('-my-0.5 inline-flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-chip text-neutral-950 transition-colors duration-150 hover:text-neutral-600 [&_svg]:size-3.5', focusRing, faceClass)
|
|
86
|
+
: squareClass, "data-slot": "toast-action", type: "button", children: toast.data?.actionIcon ??
|
|
87
|
+
((toast.data?.undo ?? label === 'Undo') ? (_jsx(Undo2, { strokeWidth: 2 })) : (_jsx(ArrowRight, { strokeWidth: 2 }))) }) }), _jsx(TooltipContent, { positionerClassName: TOAST_LAYER, children: label })] }));
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* One toast: a card with the thing (`title`, two lines at most), a line about it (`description`,
|
|
91
|
+
* three at most) and its icon in a badge-toned well, then the action and the ×. A `data.tab` sets
|
|
92
|
+
* a tab on top saying what is going on, and the action moves into it. It is drawn in the mode
|
|
93
|
+
* opposite the page's, so it stands out in either and keeps the theme's own colours.
|
|
94
|
+
*/
|
|
95
|
+
const ToastList = () => {
|
|
96
|
+
const { toasts } = useToast();
|
|
97
|
+
const { mode } = useTheme();
|
|
98
|
+
return toasts.map(toast => {
|
|
99
|
+
const icon = toast.data?.icon ?? (toast.type ? typeIcons[toast.type] : undefined);
|
|
100
|
+
const tab = toast.data?.tab;
|
|
101
|
+
// Text that wraps reads as a paragraph, so the title stands a little further off it.
|
|
102
|
+
const wordy = (typeof toast.title === 'string' && toast.title.length > LONG_TITLE) ||
|
|
103
|
+
(typeof toast.description === 'string' && toast.description.length > LONG_DESCRIPTION);
|
|
104
|
+
return (_jsx(ToastPrimitive.Root, { className: cn(pileClass), "data-slot": "toast", swipeDirection: ['down', 'right'], toast: toast, children: _jsxs(Theme, { className: "flex h-full w-full flex-col items-start", mode: mode === 'dark' ? 'light' : 'dark', children: [tab && (_jsxs("span", { className: cn(surfaceClass, 'relative z-10 -mb-px flex max-w-3/4 items-center gap-2 rounded-t-item border-b-0 px-4 pt-2.5 pb-1 text-neutral-600'), "data-slot": "toast-tab", children: [_jsx("span", { className: cn('truncate', faceClass), children: tab }), _jsx(ToastActionIcon, { inTab: true, toast: toast }), _jsxs("svg", { "aria-hidden": "true", className: "absolute bottom-0 left-[calc(100%+1px)] size-[calc(var(--radius-item)*1.2)] overflow-visible", viewBox: "0 0 12 12", children: [_jsx("path", { className: "fill-neutral-50", d: "M-0.5 -0.5A12 12 0 0 0 11.5 11.5V12H-1Z" }), _jsx("path", { className: "fill-none stroke-neutral-200", d: "M-0.5 -0.5A12 12 0 0 0 11.5 11.5", vectorEffect: "non-scaling-stroke" })] })] })), _jsxs("div", { className: cn(
|
|
105
|
+
// Top-aligned, so a name or line that wraps grows the card down and the well and × stay put.
|
|
106
|
+
'flex w-full min-w-0 flex-1 items-start gap-1.5 rounded-card p-2', tab && 'rounded-tl-none', !icon && 'pl-4', surfaceClass), "data-slot": "toast-card", children: [icon && (_jsx("span", { className: cn('flex size-option shrink-0 items-center justify-center overflow-hidden rounded-item [&_svg:not([class*=size-])]:size-4', wellTones[toast.type ?? 'neutral'] ?? wellTones.neutral, faceClass), "data-slot": "toast-icon", children: icon })), _jsxs("span", { className: cn(
|
|
107
|
+
// Two lines beside the 36px well; more text grows it.
|
|
108
|
+
'flex min-h-option min-w-0 flex-1 flex-col justify-center py-0.5 pr-1', wordy ? 'gap-1.5' : 'gap-0.5', icon && 'ml-2.5', faceClass), children: [_jsx(ToastPrimitive.Title, { className: "line-clamp-2 font-medium text-sm", "data-slot": "toast-title", render: _jsx("span", {}) }), _jsx(ToastPrimitive.Description, { className: "line-clamp-3 text-neutral-600", "data-slot": "toast-description", render: _jsx("span", {}) })] }), _jsxs("span", { className: "flex shrink-0", children: [!tab && _jsx(ToastActionIcon, { inTab: false, toast: toast }), _jsx(ToastPrimitive.Close, { "aria-label": "Dismiss", className: squareClass, "data-slot": "toast-close", children: _jsx(X, { strokeWidth: 2 }) })] })] })] }) }, toast.id));
|
|
109
|
+
});
|
|
110
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Toolbar as ToolbarPrimitive } from '@base-ui/react/toolbar';
|
|
2
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { type ComponentProps, type ReactNode } from 'react';
|
|
4
|
+
declare const toolbarVariants: (props?: ({
|
|
5
|
+
variant?: "inline" | "floating" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
export type ToolbarProps = Omit<ComponentProps<typeof ToolbarPrimitive.Root>, 'className'> & VariantProps<typeof toolbarVariants> & {
|
|
8
|
+
className?: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* `inline` is an AI toolbar over a table cell or a selection: flush segments
|
|
12
|
+
* split by hairlines. `floating` is a bottom action bar: padded, with rounded
|
|
13
|
+
* items and no dividers, at the dock's height with the inline bar's corners.
|
|
14
|
+
*/
|
|
15
|
+
export declare const Toolbar: ({ variant, className, children, ...props }: ToolbarProps) => import("react").JSX.Element;
|
|
16
|
+
export declare const ToolbarButton: ({ className, ...props }: Omit<ComponentProps<typeof ToolbarPrimitive.Button>, "className"> & {
|
|
17
|
+
className?: string;
|
|
18
|
+
}) => import("react").JSX.Element;
|
|
19
|
+
type ToolbarChipProps = ComponentProps<'span'> & {
|
|
20
|
+
/** Replaces the default sparkles icon. */
|
|
21
|
+
icon?: ReactNode;
|
|
22
|
+
};
|
|
23
|
+
/** The lead chip ("AI suggestions") at the start of the toolbar, coloured like a primary badge. */
|
|
24
|
+
export declare const ToolbarChip: ({ icon, className, children, ...props }: ToolbarChipProps) => import("react").JSX.Element;
|
|
25
|
+
export {};
|