@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,41 @@
|
|
|
1
|
+
import type { Menu as MenuPrimitive } from '@base-ui/react/menu';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
4
|
+
import { House } from 'lucide-react';
|
|
5
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
6
|
+
import { type DropdownMenuContentProps } from './dropdown-menu.js';
|
|
7
|
+
/** Header-bar trail from the app shell and the analytics top bars. */
|
|
8
|
+
export declare const Breadcrumb: ({ "aria-label": ariaLabel, ...props }: ComponentProps<"nav">) => import("react").JSX.Element;
|
|
9
|
+
export declare const breadcrumbListVariants: (props?: ({
|
|
10
|
+
size?: "md" | "lg" | null | undefined;
|
|
11
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
12
|
+
export type BreadcrumbListProps = ComponentProps<'ol'> & VariantProps<typeof breadcrumbListVariants>;
|
|
13
|
+
export declare const BreadcrumbList: ({ size, className, ...props }: BreadcrumbListProps) => import("react").JSX.Element;
|
|
14
|
+
export declare const BreadcrumbItem: ({ className, ...props }: ComponentProps<"li">) => import("react").JSX.Element;
|
|
15
|
+
export type BreadcrumbLinkProps = useRender.ComponentProps<'a'>;
|
|
16
|
+
/** Pass `render={<Link to="…" />}` to use the router's own link. */
|
|
17
|
+
export declare const BreadcrumbLink: ({ render, ref, className, ...props }: BreadcrumbLinkProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
18
|
+
export declare const BreadcrumbPage: ({ className, ...props }: ComponentProps<"span">) => import("react").JSX.Element;
|
|
19
|
+
export declare const BreadcrumbSeparator: ({ className, children, ...props }: ComponentProps<"li">) => import("react").JSX.Element;
|
|
20
|
+
export type BreadcrumbMenuProps = Omit<MenuPrimitive.Root.Props, 'children'> & {
|
|
21
|
+
/**
|
|
22
|
+
* The crumb's text, for a switcher ("Northwind ⌄") that moves to a sibling: another workspace,
|
|
23
|
+
* project or report. Left out, the trigger is an ellipsis for the pages a long trail hides.
|
|
24
|
+
*/
|
|
25
|
+
label?: ReactNode;
|
|
26
|
+
/** Names the ellipsis; a labelled switcher is named by its label. */
|
|
27
|
+
'aria-label'?: string;
|
|
28
|
+
/** DropdownMenuItems: the hidden pages, or the siblings to switch to. */
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
/** Where the menu is portalled; the body by default. */
|
|
31
|
+
container?: DropdownMenuContentProps['container'];
|
|
32
|
+
className?: string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* A crumb that opens a menu. With a `label` it switches between siblings; without, it is the "…"
|
|
36
|
+
* that stands in for the middle of a long trail, so the bar keeps where you came from and where
|
|
37
|
+
* you are, and the rest is one click away.
|
|
38
|
+
*/
|
|
39
|
+
export declare const BreadcrumbMenu: ({ label, "aria-label": ariaLabel, children, container, className, ...props }: BreadcrumbMenuProps) => import("react").JSX.Element;
|
|
40
|
+
/** House icon that stands in for the root crumb; wrap it in a BreadcrumbLink to make it a link. */
|
|
41
|
+
export declare const BreadcrumbHome: ({ "aria-label": ariaLabel, className, ...props }: ComponentProps<typeof House>) => import("react").JSX.Element;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { mergeProps } from '@base-ui/react/merge-props';
|
|
4
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
5
|
+
import { cva } from 'class-variance-authority';
|
|
6
|
+
import { ChevronRight, ChevronsUpDown, Ellipsis, House } from 'lucide-react';
|
|
7
|
+
import { cn } from '../lib/cn.js';
|
|
8
|
+
import { focusRing } from './button.js';
|
|
9
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger, } from './dropdown-menu.js';
|
|
10
|
+
/** Header-bar trail from the app shell and the analytics top bars. */
|
|
11
|
+
export const Breadcrumb = ({ 'aria-label': ariaLabel = 'Breadcrumb', ...props }) => _jsx("nav", { "aria-label": ariaLabel, "data-slot": "breadcrumb", ...props });
|
|
12
|
+
// One line, always: a trail that wraps would push the header bar's height. The page truncates first.
|
|
13
|
+
// In a compact shell (a phone) the trail keeps only where you are and the page above it: home and
|
|
14
|
+
// the crumbs before the parent hide, the last three items being the parent, its chevron and the page.
|
|
15
|
+
export const breadcrumbListVariants = cva('flex min-w-0 items-center gap-2 text-neutral-600 @max-shell-compact/shell:[&>li:not(:nth-last-child(-n+3))]:hidden', {
|
|
16
|
+
variants: {
|
|
17
|
+
size: {
|
|
18
|
+
md: 'font-normal text-xs leading-4',
|
|
19
|
+
// The 2024 and 2025 product headers set the trail a size up, in medium.
|
|
20
|
+
lg: 'font-medium text-sm',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
size: 'md',
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
export const BreadcrumbList = ({ size, className, ...props }) => (_jsx("ol", { className: cn(breadcrumbListVariants({ size }), className), "data-slot": "breadcrumb-list", ...props }));
|
|
28
|
+
export const BreadcrumbItem = ({ className, ...props }) => (_jsx("li", { className: cn(
|
|
29
|
+
// Links keep their width; only the current page gives way when the bar is short.
|
|
30
|
+
'inline-flex shrink-0 items-center gap-2 has-data-[slot=breadcrumb-page]:min-w-0 has-data-[slot=breadcrumb-page]:shrink', className), "data-slot": "breadcrumb-item", ...props }));
|
|
31
|
+
/** Pass `render={<Link to="…" />}` to use the router's own link. */
|
|
32
|
+
export const BreadcrumbLink = ({ render, ref, className, ...props }) => useRender({
|
|
33
|
+
defaultTagName: 'a',
|
|
34
|
+
render,
|
|
35
|
+
ref,
|
|
36
|
+
// State keys become data attributes, so this sets data-slot="breadcrumb-link".
|
|
37
|
+
state: { slot: 'breadcrumb-link' },
|
|
38
|
+
props: mergeProps({
|
|
39
|
+
className: cn('rounded-chip text-neutral-600 transition-colors duration-150 hover:text-neutral-950', focusRing, className),
|
|
40
|
+
}, props),
|
|
41
|
+
});
|
|
42
|
+
export const BreadcrumbPage = ({ className, ...props }) => (_jsx("span", { "aria-current": "page", className: cn('min-w-0 truncate text-neutral-950', className), "data-slot": "breadcrumb-page", ...props }));
|
|
43
|
+
export const BreadcrumbSeparator = ({ className, children, ...props }) => (_jsx("li", { "aria-hidden": true, className: cn('inline-flex text-neutral-400 [&_svg]:size-4', className), "data-slot": "breadcrumb-separator", role: "presentation", ...props, children: children ?? _jsx(ChevronRight, { strokeWidth: 2 }) }));
|
|
44
|
+
/**
|
|
45
|
+
* A crumb that opens a menu. With a `label` it switches between siblings; without, it is the "…"
|
|
46
|
+
* that stands in for the middle of a long trail, so the bar keeps where you came from and where
|
|
47
|
+
* you are, and the rest is one click away.
|
|
48
|
+
*/
|
|
49
|
+
export const BreadcrumbMenu = ({ label, 'aria-label': ariaLabel, children, container, className, ...props }) => (_jsxs(DropdownMenu, { ...props, children: [_jsxs(DropdownMenuTrigger, { "aria-label": label ? undefined : (ariaLabel ?? 'Show hidden pages'), className: cn(
|
|
50
|
+
// Pulled out by its padding, so its text lines up with the crumbs beside it.
|
|
51
|
+
'-mx-1.5 inline-flex h-control-sm shrink-0 cursor-pointer items-center gap-1 rounded-chip px-1.5 text-neutral-600', 'transition-[background-color,color] duration-150 hover:bg-neutral-950/5 hover:text-neutral-950', 'data-popup-open:bg-selected data-popup-open:text-neutral-950 [&_svg]:size-4 [&_svg]:shrink-0', focusRing, className), "data-slot": "breadcrumb-menu", children: [label ?? _jsx(Ellipsis, { strokeWidth: 2 }), label && _jsx(ChevronsUpDown, { className: "text-neutral-400", strokeWidth: 2 })] }), _jsx(DropdownMenuContent, { align: "start", className: "min-w-menu-wide", container: container, children: children })] }));
|
|
52
|
+
/** House icon that stands in for the root crumb; wrap it in a BreadcrumbLink to make it a link. */
|
|
53
|
+
export const BreadcrumbHome = ({ 'aria-label': ariaLabel = 'Home', className, ...props }) => (_jsx(House, { "aria-label": ariaLabel, className: cn('size-4 shrink-0 text-neutral-400', className), "data-slot": "breadcrumb-home", role: "img", strokeWidth: 2, ...props }));
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
2
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
+
export declare const focusRing = "outline-none focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-focus focus-visible:outline-offset-2";
|
|
4
|
+
export declare const touchTarget = "relative pointer-coarse:after:absolute pointer-coarse:after:top-1/2 pointer-coarse:after:left-1/2 pointer-coarse:after:size-11 pointer-coarse:after:-translate-1/2 pointer-coarse:after:content-['']";
|
|
5
|
+
export declare const buttonVariants: (props?: ({
|
|
6
|
+
variant?: "primary" | "secondary" | "ghost" | "tint" | null | undefined;
|
|
7
|
+
size?: "icon" | "md" | "lg" | "icon-sm" | null | undefined;
|
|
8
|
+
shape?: "pill" | "default" | null | undefined;
|
|
9
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
|
+
export type ButtonProps = useRender.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
|
11
|
+
/**
|
|
12
|
+
* Busy with what it started: a spinner leads the label (or takes an icon button's place) and
|
|
13
|
+
* clicks are held off. It stays at full strength, unlike disabled, since it is working.
|
|
14
|
+
*/
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* One label size (13px medium) at both heights; size only changes padding, so
|
|
19
|
+
* a button sits level with the input beside it: md with a small one, lg with a
|
|
20
|
+
* medium one. Icons sit at 16px either side. Pass `render={<a href="…" />}`
|
|
21
|
+
* to draw a link as a button.
|
|
22
|
+
*/
|
|
23
|
+
export declare const Button: ({ variant, size, shape, loading, render, ref, className, type, children, ...props }: ButtonProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { mergeProps } from '@base-ui/react/merge-props';
|
|
4
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
5
|
+
import { cva } from 'class-variance-authority';
|
|
6
|
+
import { Children, isValidElement } from 'react';
|
|
7
|
+
import { cn } from '../lib/cn.js';
|
|
8
|
+
import { Spinner } from './spinner.js';
|
|
9
|
+
export const focusRing = 'outline-none focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-focus focus-visible:outline-offset-2';
|
|
10
|
+
/*
|
|
11
|
+
* A finger needs about 44px to land on, and a 28 or 34px square is drawn for a mouse. On a coarse
|
|
12
|
+
* pointer an invisible 44px square is centred over the control, so the target grows and nothing
|
|
13
|
+
* round it moves. The control is positioned so the square centres on it; a caller's `absolute`
|
|
14
|
+
* replaces that through cn(). For small controls that use no ::after of their own.
|
|
15
|
+
*/
|
|
16
|
+
export const touchTarget = "relative pointer-coarse:after:absolute pointer-coarse:after:top-1/2 pointer-coarse:after:left-1/2 pointer-coarse:after:size-11 pointer-coarse:after:-translate-1/2 pointer-coarse:after:content-['']";
|
|
17
|
+
export const buttonVariants = cva([
|
|
18
|
+
'inline-flex shrink-0 cursor-pointer select-none items-center justify-center gap-2 whitespace-nowrap font-medium text-xs transition-[background-color,border-color,color,opacity,scale] duration-150 ease-out-strong',
|
|
19
|
+
// Gives a little under the press, so a click is felt; still under reduced motion.
|
|
20
|
+
'active:scale-[0.97] motion-reduce:active:scale-100',
|
|
21
|
+
'disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&_svg:not([class*=size-])]:size-icon [&_svg]:shrink-0',
|
|
22
|
+
focusRing,
|
|
23
|
+
], {
|
|
24
|
+
variants: {
|
|
25
|
+
variant: {
|
|
26
|
+
primary: [
|
|
27
|
+
'bg-action text-on-action shadow-action [background-image:var(--action-gradient)]',
|
|
28
|
+
'hover:bg-action-hover hover:[background-image:none]',
|
|
29
|
+
],
|
|
30
|
+
secondary:
|
|
31
|
+
// Its hover is the 5% ink wash over whatever fill the theme gives controls.
|
|
32
|
+
'border border-neutral-200 bg-control text-neutral-950 shadow-control hover:border-neutral-300 hover:bg-[color-mix(in_oklab,var(--color-neutral-950)_5%,var(--color-control-hover))]',
|
|
33
|
+
ghost: 'text-neutral-600 hover:bg-neutral-950/5 hover:text-neutral-800',
|
|
34
|
+
// For AI actions beside the primary one: the theme's wash, no shadow. Hover mixes the
|
|
35
|
+
// wash towards its own text colour, so it deepens in every theme and in dark mode.
|
|
36
|
+
tint: 'bg-tint text-tint-fg hover:bg-[color-mix(in_oklab,var(--color-tint),var(--color-tint-fg)_8%)]',
|
|
37
|
+
},
|
|
38
|
+
size: {
|
|
39
|
+
// The control row: level with a small input, select or segmented control beside it.
|
|
40
|
+
// An icon's end sits a step tighter than a label's, so the whole reads centred.
|
|
41
|
+
md: 'h-control rounded-control px-4 data-[icon=both]:px-3 data-[icon=leading]:pl-3 data-[icon=trailing]:pr-3',
|
|
42
|
+
// The field row: level with a medium input, and the height of the dock's action.
|
|
43
|
+
lg: 'h-control-lg rounded-control px-4 [--spacing-icon:var(--spacing-icon-lg)]',
|
|
44
|
+
icon: ['size-control rounded-control', touchTarget],
|
|
45
|
+
'icon-sm': ['size-control-sm rounded-chip', touchTarget],
|
|
46
|
+
},
|
|
47
|
+
shape: {
|
|
48
|
+
default: '',
|
|
49
|
+
// One corner a height: a round button keeps the control's corner, so it sits with the rest.
|
|
50
|
+
pill: 'rounded-control',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
defaultVariants: {
|
|
54
|
+
variant: 'primary',
|
|
55
|
+
size: 'md',
|
|
56
|
+
shape: 'default',
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
/** Which ends of a label hold an element (an icon, a spinner) rather than text. */
|
|
60
|
+
const iconEnds = (children, loading) => {
|
|
61
|
+
const items = Children.toArray(children);
|
|
62
|
+
const leading = loading || isValidElement(items[0]);
|
|
63
|
+
const trailing = items.length > 1 && isValidElement(items[items.length - 1]);
|
|
64
|
+
if (leading && trailing)
|
|
65
|
+
return 'both';
|
|
66
|
+
if (leading)
|
|
67
|
+
return 'leading';
|
|
68
|
+
if (trailing)
|
|
69
|
+
return 'trailing';
|
|
70
|
+
return undefined;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* One label size (13px medium) at both heights; size only changes padding, so
|
|
74
|
+
* a button sits level with the input beside it: md with a small one, lg with a
|
|
75
|
+
* medium one. Icons sit at 16px either side. Pass `render={<a href="…" />}`
|
|
76
|
+
* to draw a link as a button.
|
|
77
|
+
*/
|
|
78
|
+
export const Button = ({ variant, size, shape, loading = false, render, ref, className, type = 'button', children, ...props }) => {
|
|
79
|
+
const iconOnly = size === 'icon' || size === 'icon-sm';
|
|
80
|
+
// While loading, a click, Enter or Space does nothing and a submit button sends no form; the
|
|
81
|
+
// button keeps focus, so the keyboard does not lose its place while the work finishes.
|
|
82
|
+
const holdOff = (event) => {
|
|
83
|
+
event.preventDefault();
|
|
84
|
+
event.preventBaseUIHandler?.();
|
|
85
|
+
};
|
|
86
|
+
return useRender({
|
|
87
|
+
defaultTagName: 'button',
|
|
88
|
+
render,
|
|
89
|
+
ref,
|
|
90
|
+
// State keys become data attributes, so this sets data-slot="button", data-size, data-loading and
|
|
91
|
+
// data-icon; a part that holds a button (a table cell) can fit it by its size.
|
|
92
|
+
state: {
|
|
93
|
+
slot: 'button',
|
|
94
|
+
size: size ?? 'md',
|
|
95
|
+
loading,
|
|
96
|
+
icon: iconOnly ? undefined : iconEnds(children, loading),
|
|
97
|
+
},
|
|
98
|
+
props: mergeProps({
|
|
99
|
+
className: cn(buttonVariants({ variant, size, shape }), loading && 'pointer-events-none', className),
|
|
100
|
+
// A link or other element passed through render keeps its own semantics.
|
|
101
|
+
type: render ? undefined : type,
|
|
102
|
+
'aria-busy': loading || undefined,
|
|
103
|
+
children: loading ? (iconOnly ? (_jsx(Spinner, { className: "size-icon" })) : (_jsxs(_Fragment, { children: [_jsx(Spinner, { className: "size-icon" }), children] }))) : (children),
|
|
104
|
+
}, props,
|
|
105
|
+
// Merged last, so its handler runs before the caller's and stops it.
|
|
106
|
+
loading ? { onClick: holdOff } : undefined),
|
|
107
|
+
});
|
|
108
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type ComponentProps } from 'react';
|
|
2
|
+
import { DayPicker } from 'react-day-picker';
|
|
3
|
+
export type CalendarProps = ComponentProps<typeof DayPicker>;
|
|
4
|
+
/** A month grid for picking a day or a range, on react-day-picker; weeks start on Monday (en-GB). */
|
|
5
|
+
export declare const Calendar: ({ className, classNames, components, locale, showOutsideDays, ...props }: CalendarProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { ChevronDown, ChevronLeft, ChevronRight } from 'lucide-react';
|
|
4
|
+
import { useEffect, useRef } from 'react';
|
|
5
|
+
import { DayPicker, } from 'react-day-picker';
|
|
6
|
+
import { enGB } from 'react-day-picker/locale';
|
|
7
|
+
import { cn } from '../lib/cn.js';
|
|
8
|
+
import { buttonVariants, focusRing } from './button.js';
|
|
9
|
+
/*
|
|
10
|
+
* The cell is a td and the day a 32px button inside it. A range is drawn on the cells, so the strip
|
|
11
|
+
* runs unbroken between days while each button keeps its own corners; the ends of a range fill only
|
|
12
|
+
* the inner half of their cell, so the strip starts under the middle of the action-coloured day.
|
|
13
|
+
*/
|
|
14
|
+
const CalendarDay = ({ day: _day, modifiers, className, ...props }) => {
|
|
15
|
+
const { range_start: start, range_end: end, range_middle: middle, hidden } = modifiers;
|
|
16
|
+
return (_jsx("td", { className: cn('p-0 text-center', !hidden && [
|
|
17
|
+
// Of-type, not first/last child: with week numbers on, a th opens each row.
|
|
18
|
+
middle && 'bg-tint first-of-type:rounded-l-item last-of-type:rounded-r-item',
|
|
19
|
+
start &&
|
|
20
|
+
!end &&
|
|
21
|
+
'bg-linear-to-r from-50% from-transparent to-50% to-tint last-of-type:bg-none',
|
|
22
|
+
end &&
|
|
23
|
+
!start &&
|
|
24
|
+
'bg-linear-to-l from-50% from-transparent to-50% to-tint first-of-type:bg-none',
|
|
25
|
+
],
|
|
26
|
+
// DayPicker's own classes for the cell: classNames.day and any modifiersClassNames.
|
|
27
|
+
className), "data-slot": "calendar-day", ...props }));
|
|
28
|
+
};
|
|
29
|
+
const dayButtonClass = [
|
|
30
|
+
'relative inline-flex size-cell cursor-pointer select-none items-center justify-center rounded-item font-normal text-neutral-900 text-xs tabular-nums transition-[background-color,color] duration-150',
|
|
31
|
+
'hover:bg-neutral-950/5 hover:text-neutral-950',
|
|
32
|
+
// Neighbouring days sit flush, so the focused one is lifted above them to keep its ring whole.
|
|
33
|
+
'focus-visible:z-10',
|
|
34
|
+
focusRing,
|
|
35
|
+
// Today is marked quietly: a medium weight and a dot that takes the text colour, whatever the fill.
|
|
36
|
+
// The colour only on a plain day: on the action fill or the tint it would beat their own text colour.
|
|
37
|
+
'data-today:font-medium data-today:not-data-chosen:not-data-range-middle:text-neutral-950',
|
|
38
|
+
'data-today:after:-translate-x-1/2 data-today:after:absolute data-today:after:bottom-1 data-today:after:left-1/2 data-today:after:size-0.75 data-today:after:rounded-full data-today:after:bg-current',
|
|
39
|
+
'data-outside:text-neutral-400',
|
|
40
|
+
'data-range-middle:text-tint-fg data-range-middle:hover:bg-neutral-950/5',
|
|
41
|
+
// The chosen day, and both ends of a range, take the one action colour.
|
|
42
|
+
'data-chosen:bg-action data-chosen:text-on-action data-chosen:shadow-action data-chosen:[background-image:var(--action-gradient)]',
|
|
43
|
+
'data-chosen:hover:bg-action-hover data-chosen:hover:text-on-action data-chosen:hover:[background-image:none]',
|
|
44
|
+
// DayPicker keeps the focused disabled day focusable through aria-disabled instead of disabled.
|
|
45
|
+
'disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50',
|
|
46
|
+
];
|
|
47
|
+
const CalendarDayButton = ({ day, modifiers, className, ...props }) => {
|
|
48
|
+
const ref = useRef(null);
|
|
49
|
+
// DayPicker moves focus by flagging a day; the button has to take it, as the stock one does.
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (modifiers.focused)
|
|
52
|
+
ref.current?.focus();
|
|
53
|
+
}, [modifiers.focused]);
|
|
54
|
+
const chosen = modifiers.selected && !modifiers.range_middle ? true : undefined;
|
|
55
|
+
return (_jsx("button", { className: cn(dayButtonClass, className), "data-chosen": chosen, "data-outside": day.outside || undefined, "data-range-middle": modifiers.range_middle || undefined, "data-slot": "calendar-day-button", "data-today": modifiers.today || undefined, ref: ref, ...props }));
|
|
56
|
+
};
|
|
57
|
+
const CalendarChevron = ({ className, orientation, disabled: _disabled }) => {
|
|
58
|
+
const Icon = orientation === 'left' ? ChevronLeft : orientation === 'right' ? ChevronRight : ChevronDown;
|
|
59
|
+
return _jsx(Icon, { "aria-hidden": true, className: cn('size-4', className), strokeWidth: 2 });
|
|
60
|
+
};
|
|
61
|
+
const CalendarRoot = ({ rootRef, className, ...props }) => (_jsx("div", { className: className, "data-slot": "calendar", ref: rootRef, ...props }));
|
|
62
|
+
/** A month grid for picking a day or a range, on react-day-picker; weeks start on Monday (en-GB). */
|
|
63
|
+
export const Calendar = ({ className, classNames, components, locale = enGB, showOutsideDays = true, ...props }) => (_jsx(DayPicker, { className: cn('relative w-fit text-xs', className), classNames: {
|
|
64
|
+
months: 'flex gap-6',
|
|
65
|
+
month: 'flex flex-col gap-3',
|
|
66
|
+
// One bar over all months: previous on the far left, next on the far right, level with the captions.
|
|
67
|
+
nav: 'pointer-events-none absolute inset-x-0 top-0 z-10 flex h-control-sm items-center justify-between',
|
|
68
|
+
button_previous: cn(buttonVariants({ variant: 'ghost', size: 'icon-sm' }), 'pointer-events-auto'),
|
|
69
|
+
button_next: cn(buttonVariants({ variant: 'ghost', size: 'icon-sm' }), 'pointer-events-auto'),
|
|
70
|
+
month_caption: 'flex h-control-sm items-center justify-center px-8',
|
|
71
|
+
caption_label: 'flex select-none items-center gap-1 font-medium text-neutral-950 text-sm [&_svg]:text-neutral-600',
|
|
72
|
+
dropdowns: 'flex items-center gap-1.5',
|
|
73
|
+
dropdown_root: 'relative rounded-chip has-focus-visible:outline-2 has-focus-visible:outline-focus has-focus-visible:outline-offset-2',
|
|
74
|
+
// The native select sits invisibly over the label, so the platform's own picker opens.
|
|
75
|
+
dropdown: 'absolute inset-0 cursor-pointer opacity-0',
|
|
76
|
+
// Separate borders let the rows breathe while a range strip still runs across each week.
|
|
77
|
+
month_grid: 'border-separate border-spacing-x-0 border-spacing-y-0.5',
|
|
78
|
+
weekday: 'h-control-sm w-cell select-none p-0 font-normal text-neutral-600 text-xxs',
|
|
79
|
+
week_number_header: 'w-cell select-none font-normal text-neutral-600 text-xxs',
|
|
80
|
+
week_number: 'w-cell select-none text-center text-neutral-600 text-xxs tabular-nums',
|
|
81
|
+
footer: 'pt-3 text-neutral-600 text-xs',
|
|
82
|
+
hidden: 'invisible',
|
|
83
|
+
...classNames,
|
|
84
|
+
}, components: {
|
|
85
|
+
Root: CalendarRoot,
|
|
86
|
+
Chevron: CalendarChevron,
|
|
87
|
+
Day: CalendarDay,
|
|
88
|
+
DayButton: CalendarDayButton,
|
|
89
|
+
...components,
|
|
90
|
+
}, locale: locale, showOutsideDays: showOutsideDays, ...props }));
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
2
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
3
|
+
export declare const cardVariants: (props?: ({
|
|
4
|
+
layout?: "list" | "default" | "chart" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
export type CardProps = ComponentProps<'div'> & VariantProps<typeof cardVariants>;
|
|
7
|
+
/**
|
|
8
|
+
* Bordered surface from the analytics screens. Cards share the page colour and
|
|
9
|
+
* are told apart by the hairline alone, so there is no shadow. `list` is the
|
|
10
|
+
* top pages and donut cards, `chart` the area chart cards. A card with a head
|
|
11
|
+
* puts its content in CardContent, so a theme that frames cards can stage it.
|
|
12
|
+
*/
|
|
13
|
+
export declare const Card: ({ layout, className, ...props }: CardProps) => import("react").JSX.Element;
|
|
14
|
+
export declare const CardHeader: ({ className, ...props }: ComponentProps<"div">) => import("react").JSX.Element;
|
|
15
|
+
/**
|
|
16
|
+
* What a card holds under its head. Plain, a box with nothing of its own; in a theme that frames
|
|
17
|
+
* its cards, the stage: the surface with a hairline inside the frame. Its children keep the card's gap.
|
|
18
|
+
*/
|
|
19
|
+
export declare const CardContent: ({ className, ...props }: ComponentProps<"div">) => import("react").JSX.Element;
|
|
20
|
+
/** What closes a card under its content: on the frame when framed, under a hairline when plain. */
|
|
21
|
+
export declare const CardFooter: ({ className, ...props }: ComponentProps<"div">) => import("react").JSX.Element;
|
|
22
|
+
export declare const CardTitle: ({ className, ...props }: ComponentProps<"p">) => import("react").JSX.Element;
|
|
23
|
+
export declare const cardValueVariants: (props?: ({
|
|
24
|
+
size?: "md" | "lg" | "xl" | null | undefined;
|
|
25
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
26
|
+
export type CardValueProps = ComponentProps<'p'> & VariantProps<typeof cardValueVariants>;
|
|
27
|
+
/** Headline number: 18px in KPI cards, 24 or 31 in chart card headers. */
|
|
28
|
+
export declare const CardValue: ({ size, className, ...props }: CardValueProps) => import("react").JSX.Element;
|
|
29
|
+
/** A figure that stands beside the key one in a stat card's foot: "Plan" $118K. */
|
|
30
|
+
export type StatFact = {
|
|
31
|
+
label: ReactNode;
|
|
32
|
+
value: ReactNode;
|
|
33
|
+
};
|
|
34
|
+
export type StatCardProps = Omit<ComponentProps<'div'>, 'children'> & {
|
|
35
|
+
label: ReactNode;
|
|
36
|
+
value: ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* A secondary figure that belongs to the value ("1 invoice, due 30 Nov", "of 418"): a quiet line
|
|
39
|
+
* under it, never inline after it.
|
|
40
|
+
*/
|
|
41
|
+
note?: ReactNode;
|
|
42
|
+
delta?: ReactNode;
|
|
43
|
+
/**
|
|
44
|
+
* Colours the delta pill; `neutral` for changes that are neither good nor bad. Read from a
|
|
45
|
+
* leading minus on the delta when left out.
|
|
46
|
+
*/
|
|
47
|
+
trend?: 'up' | 'down' | 'neutral';
|
|
48
|
+
/** What the change is measured against, after the pill in the quiet ink: "on last month". */
|
|
49
|
+
comparison?: ReactNode;
|
|
50
|
+
/** A 16 icon before the label, for a dashboard of many cards. */
|
|
51
|
+
icon?: ReactNode;
|
|
52
|
+
/** The card's own controls at the label's right: a ghost `icon-sm` menu button. */
|
|
53
|
+
actions?: ReactNode;
|
|
54
|
+
/** The figure's recent shape under it: a `Sparkline` from `@contui/ui/charts`. */
|
|
55
|
+
chart?: ReactNode;
|
|
56
|
+
/** Two or three figures that stand beside the key one, in a foot of their own. */
|
|
57
|
+
facts?: readonly StatFact[];
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* A key figure. Plain, it is the label, the value and its change in a pill. When the reader needs
|
|
61
|
+
* more of the figure it grows by parts, each only when there is something to put in it: an icon
|
|
62
|
+
* and a menu on the label's line, what the change is measured against, the figure's recent shape,
|
|
63
|
+
* and a foot of the figures that stand beside it.
|
|
64
|
+
*/
|
|
65
|
+
export declare const StatCard: ({ label, value, note, delta, trend: trendProp, comparison, icon, actions, chart, facts, className, ...props }: StatCardProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from 'class-variance-authority';
|
|
3
|
+
import { cn } from '../lib/cn.js';
|
|
4
|
+
import { Badge } from './badge.js';
|
|
5
|
+
/*
|
|
6
|
+
* The card is a card-frame (theme.css): its padding and gap are set as the part's plain values, so a
|
|
7
|
+
* theme that frames its cards can move them onto the frame, the head and the stage.
|
|
8
|
+
*/
|
|
9
|
+
export const cardVariants = cva('card-frame flex min-w-0 flex-col border border-neutral-200 shadow-card', {
|
|
10
|
+
variants: {
|
|
11
|
+
layout: {
|
|
12
|
+
default: '[--card-gap:calc(var(--spacing)*4)] [--card-pad:calc(var(--spacing)*4)]',
|
|
13
|
+
list: '[--card-gap:calc(var(--spacing)*4)] [--card-pad:calc(var(--spacing)*5)]',
|
|
14
|
+
// The deep bottom pad leaves room under a chart's x labels.
|
|
15
|
+
chart: '[--card-gap:calc(var(--spacing)*8)] [--card-pad:calc(var(--spacing)*5)_calc(var(--spacing)*5)_calc(var(--spacing)*12)]',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
layout: 'default',
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
/**
|
|
23
|
+
* Bordered surface from the analytics screens. Cards share the page colour and
|
|
24
|
+
* are told apart by the hairline alone, so there is no shadow. `list` is the
|
|
25
|
+
* top pages and donut cards, `chart` the area chart cards. A card with a head
|
|
26
|
+
* puts its content in CardContent, so a theme that frames cards can stage it.
|
|
27
|
+
*/
|
|
28
|
+
export const Card = ({ layout, className, ...props }) => (_jsx("div", { className: cn(cardVariants({ layout }), className), "data-slot": "card", ...props }));
|
|
29
|
+
export const CardHeader = ({ className, ...props }) => (_jsx("div", { className: cn('card-head flex flex-col gap-0.5', className), "data-slot": "card-header", ...props }));
|
|
30
|
+
/**
|
|
31
|
+
* What a card holds under its head. Plain, a box with nothing of its own; in a theme that frames
|
|
32
|
+
* its cards, the stage: the surface with a hairline inside the frame. Its children keep the card's gap.
|
|
33
|
+
*/
|
|
34
|
+
export const CardContent = ({ className, ...props }) => (_jsx("div", {
|
|
35
|
+
// It fills the card, so a card stretched to its row's height keeps its stage to the frame's foot.
|
|
36
|
+
className: cn('card-stage flex min-w-0 flex-1 flex-col gap-(--card-gap)', className), "data-slot": "card-content", ...props }));
|
|
37
|
+
/** What closes a card under its content: on the frame when framed, under a hairline when plain. */
|
|
38
|
+
export const CardFooter = ({ className, ...props }) => (_jsx("div", { className: cn('card-foot', className), "data-slot": "card-footer", ...props }));
|
|
39
|
+
export const CardTitle = ({ className, ...props }) => (_jsx("p", { className: cn('font-normal text-neutral-600 text-xs', className), "data-slot": "card-title", ...props }));
|
|
40
|
+
export const cardValueVariants = cva('font-medium text-neutral-950 tabular-nums', {
|
|
41
|
+
variants: {
|
|
42
|
+
size: {
|
|
43
|
+
md: 'text-lg',
|
|
44
|
+
lg: 'text-2xl',
|
|
45
|
+
xl: 'text-3xl',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
defaultVariants: {
|
|
49
|
+
size: 'md',
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
/** Headline number: 18px in KPI cards, 24 or 31 in chart card headers. */
|
|
53
|
+
export const CardValue = ({ size, className, ...props }) => (_jsx("p", { className: cn(cardValueVariants({ size }), className), "data-slot": "card-value", ...props }));
|
|
54
|
+
/**
|
|
55
|
+
* The way a change figure points when no trend is given: down when its text starts with a minus
|
|
56
|
+
* (a hyphen, the minus sign or an en dash), up otherwise.
|
|
57
|
+
*/
|
|
58
|
+
const trendOf = (figure) => {
|
|
59
|
+
const text = typeof figure === 'string' || typeof figure === 'number'
|
|
60
|
+
? String(figure)
|
|
61
|
+
: Array.isArray(figure) &&
|
|
62
|
+
(typeof figure[0] === 'string' || typeof figure[0] === 'number')
|
|
63
|
+
? String(figure[0])
|
|
64
|
+
: '';
|
|
65
|
+
return /^\s*[-−–]/.test(text) ? 'down' : 'up';
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* A key figure. Plain, it is the label, the value and its change in a pill. When the reader needs
|
|
69
|
+
* more of the figure it grows by parts, each only when there is something to put in it: an icon
|
|
70
|
+
* and a menu on the label's line, what the change is measured against, the figure's recent shape,
|
|
71
|
+
* and a foot of the figures that stand beside it.
|
|
72
|
+
*/
|
|
73
|
+
export const StatCard = ({ label, value, note, delta, trend: trendProp, comparison, icon, actions, chart, facts, className, ...props }) => {
|
|
74
|
+
const trend = trendProp ?? trendOf(delta);
|
|
75
|
+
const hasFacts = facts != null && facts.length > 0;
|
|
76
|
+
const head = (_jsxs("div", { className: "flex min-w-0 items-center justify-between gap-2", children: [_jsxs(CardTitle, { className: "flex min-w-0 items-center gap-2", children: [icon && (_jsx("span", { "aria-hidden": true, className: "flex shrink-0 text-neutral-600 [&_svg]:size-4", children: icon })), _jsx("span", { className: "truncate", children: label })] }), actions && _jsx("div", { className: "-my-1.5 -mr-1.5 flex shrink-0 items-center", children: actions })] }));
|
|
77
|
+
/*
|
|
78
|
+
* A card that carries more than its figure (a trend, facts) reads as a small chart card: the
|
|
79
|
+
* label on a line of its own, then the figure at the chart card's size with its change beside
|
|
80
|
+
* it, so the eye has one thing to land on and the rest stands back. A plain card keeps the
|
|
81
|
+
* label over the value and the pill under them.
|
|
82
|
+
*/
|
|
83
|
+
const rich = chart != null || hasFacts;
|
|
84
|
+
const pill = delta !== undefined && (_jsx(Badge, { className: "shrink-0", tone: trend === 'up' ? 'success' : trend === 'down' ? 'error' : 'neutral', variant: "pill", children: delta }));
|
|
85
|
+
const figure = rich ? (_jsxs("div", { className: "flex flex-col gap-3.5", "data-slot": "stat-card-figure", children: [_jsxs("div", { className: "flex flex-col gap-1", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx(CardValue, { className: "shrink-0 text-xl", size: "lg", children: value }), pill, comparison != null && (_jsx("span", { className: "min-w-0 truncate text-neutral-600 text-xs", children: comparison }))] }), _jsx("p", { "aria-hidden": note == null, className: "truncate text-neutral-600 text-xs", children: note ?? ' ' })] }), chart] })) : (_jsxs("div", { className: "flex flex-col gap-3", "data-slot": "stat-card-figure", children: [_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx(CardValue, { children: value }), note != null && _jsx("p", { className: "text-neutral-600 text-xs", children: note })] }), (pill || comparison != null) && (_jsxs("p", { className: "flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-xs", children: [pill, comparison != null && _jsx("span", { className: "text-neutral-600", children: comparison })] }))] }));
|
|
86
|
+
const foot = hasFacts && (
|
|
87
|
+
// One line, always: a label gives way before a fact wraps and pushes its card out of level.
|
|
88
|
+
_jsx("dl", { className: "flex min-w-0 gap-4 text-xs", "data-slot": "stat-card-facts", children: facts.map((fact, index) => (
|
|
89
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: the facts are given in order
|
|
90
|
+
_jsxs("div", { className: "flex min-w-0 items-baseline gap-1.5", children: [_jsx("dt", { className: "min-w-0 truncate text-neutral-600", children: fact.label }), _jsx("dd", { className: "shrink-0 font-medium text-neutral-950 tabular-nums", children: fact.value })] }, index))) }));
|
|
91
|
+
// Plain, the label sits 4 over the figure; framed, the label stands on the frame as the card's
|
|
92
|
+
// head and the figure on a 16 stage, as a stat card in a row of framed ones should.
|
|
93
|
+
if (!rich) {
|
|
94
|
+
return (_jsxs(Card, { "data-slot": "stat-card", ...props, className: cn('[--card-gap:var(--spacing)] [--card-stage-pad:calc(var(--spacing)*4)]', className), children: [_jsx("div", { className: "card-head", children: head }), _jsx("div", { className: "card-stage flex flex-1 flex-col", children: figure })] }));
|
|
95
|
+
}
|
|
96
|
+
/*
|
|
97
|
+
* Its padding by what it holds (the formula): 24, 16 under the facts. The figure and its trend
|
|
98
|
+
* are the card's content, its stage when the theme frames cards; the label and the facts stand
|
|
99
|
+
* on the frame then, and the hairline over the facts gives way to the stage's edge.
|
|
100
|
+
*/
|
|
101
|
+
return (_jsxs(Card, { className: cn('[--card-gap:calc(var(--spacing)*3.5)]', hasFacts
|
|
102
|
+
? '[--card-pad:calc(var(--spacing)*6)_calc(var(--spacing)*6)_calc(var(--spacing)*4)]'
|
|
103
|
+
: '[--card-pad:calc(var(--spacing)*6)]', className), "data-slot": "stat-card", ...props, children: [_jsx("div", { className: "card-head", children: head }), _jsx("div", { className: "card-stage flex flex-1 flex-col", children: figure }), hasFacts && (_jsx("div", { className: "card-foot mt-auto", children: _jsx("div", { className: "card-rule [--card-rule-bleed:calc(var(--spacing)*6)] [--card-rule-space:calc(var(--spacing)*4)]", children: foot }) }))] }));
|
|
104
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
export type ChatAttachmentProps = Omit<ComponentProps<'div'>, 'children'> & {
|
|
3
|
+
/**
|
|
4
|
+
* `file`: an icon well, the name and its extension. `image`: a square thumbnail. `record`: a
|
|
5
|
+
* linked record (an application, an invoice) on a line of its own: icon, kind, token, status.
|
|
6
|
+
*/
|
|
7
|
+
variant?: 'file' | 'image' | 'record';
|
|
8
|
+
/** The file's name, e.g. "Application.pdf"; also the image's alt text. A record's kind: "Application". */
|
|
9
|
+
name: string;
|
|
10
|
+
/** A record's identifier, shown as a ChatToken: "#app_1CU94h5M". */
|
|
11
|
+
token?: ReactNode;
|
|
12
|
+
/** A record's state at the end, usually a soft Badge: "In review". */
|
|
13
|
+
status?: ReactNode;
|
|
14
|
+
/** The extension, e.g. ".pdf"; taken from the name when left out. */
|
|
15
|
+
ext?: string;
|
|
16
|
+
/** The image to show, for `image`. */
|
|
17
|
+
src?: string;
|
|
18
|
+
/** Replaces the file icon in the well. */
|
|
19
|
+
icon?: ReactNode;
|
|
20
|
+
/** Draws a remove button (×) that calls it: in the composer, before the message is sent. */
|
|
21
|
+
onRemove?: () => void;
|
|
22
|
+
/** The remove button's name; "Remove <name>" by default. */
|
|
23
|
+
removeLabel?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Where a long file name cuts: in the `middle` by default, so the end that tells one file from
|
|
26
|
+
* the next stays (`invoice-2026-…-0142`); `end` for names read from the start.
|
|
27
|
+
*/
|
|
28
|
+
truncate?: 'end' | 'middle';
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* One file or record going with a message: above the composer while it waits, removable, and under
|
|
32
|
+
* the message once sent. A file shows a 40 well tinted by its kind with its name and extension; an
|
|
33
|
+
* image, a square thumbnail; a record, a full-width line with its kind, token and status.
|
|
34
|
+
*/
|
|
35
|
+
export declare const ChatAttachment: ({ variant, name, ext, src, icon, token, status, onRemove, removeLabel, truncate, className, ...props }: ChatAttachmentProps) => import("react").JSX.Element;
|
|
36
|
+
export type ChatAttachmentsProps = ComponentProps<'div'> & {
|
|
37
|
+
/** Whose message they go with, as on `ChatMessage`: `own` at the right, `other` at the left. */
|
|
38
|
+
variant?: 'own' | 'other';
|
|
39
|
+
/** The same as `variant`, by side: `end` is `own`, `start` is `other`. */
|
|
40
|
+
align?: 'start' | 'end';
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* A row of `ChatAttachment`s, 8 apart, wrapping; a record takes a line of its own. In the
|
|
44
|
+
* composer's `attachments` slot it waits 8 above the box; in a thread, right after a message, it
|
|
45
|
+
* hangs 4 under it on the message's side.
|
|
46
|
+
*/
|
|
47
|
+
export declare const ChatAttachments: ({ variant, align, className, ...props }: ChatAttachmentsProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { File as FileIcon, FileText, X } from 'lucide-react';
|
|
4
|
+
import { cn } from '../lib/cn.js';
|
|
5
|
+
import { truncationTail } from '../lib/truncate.js';
|
|
6
|
+
import { Button, focusRing } from './button.js';
|
|
7
|
+
import { ChatToken } from './chat-reference.js';
|
|
8
|
+
import { Truncate } from './truncate.js';
|
|
9
|
+
/** Splits "Application.pdf" into its name and ".pdf"; a name with no dot has no extension. */
|
|
10
|
+
const splitName = (name, ext) => {
|
|
11
|
+
if (ext != null) {
|
|
12
|
+
const dotted = ext.startsWith('.') ? ext : `.${ext}`;
|
|
13
|
+
return {
|
|
14
|
+
base: name.toLowerCase().endsWith(dotted.toLowerCase())
|
|
15
|
+
? name.slice(0, -dotted.length)
|
|
16
|
+
: name,
|
|
17
|
+
ext: dotted,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const dot = name.lastIndexOf('.');
|
|
21
|
+
return dot > 0 ? { base: name.slice(0, dot), ext: name.slice(dot) } : { base: name, ext: '' };
|
|
22
|
+
};
|
|
23
|
+
// The well takes a tone from the kind of file: a PDF the error ramp, as PDFs are known by their red.
|
|
24
|
+
const wellTones = {
|
|
25
|
+
pdf: 'bg-error-500/20 text-error-800',
|
|
26
|
+
neutral: 'bg-neutral-500/20 text-neutral-800',
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* One file or record going with a message: above the composer while it waits, removable, and under
|
|
30
|
+
* the message once sent. A file shows a 40 well tinted by its kind with its name and extension; an
|
|
31
|
+
* image, a square thumbnail; a record, a full-width line with its kind, token and status.
|
|
32
|
+
*/
|
|
33
|
+
export const ChatAttachment = ({ variant = 'file', name, ext, src, icon, token, status, onRemove, removeLabel, truncate = 'middle', className, ...props }) => {
|
|
34
|
+
const parts = splitName(name, ext);
|
|
35
|
+
const label = removeLabel ?? `Remove ${name}`;
|
|
36
|
+
if (variant === 'record') {
|
|
37
|
+
return (_jsxs("div", { className: cn(
|
|
38
|
+
// A line of its own, drawn as a ChatReference is (control-xl high, the control's
|
|
39
|
+
// corner, 12 apart), so a record keeps one shape waiting and in the thread.
|
|
40
|
+
'flex min-h-control-xl w-full min-w-0 shrink-0 basis-full items-center gap-3 rounded-control border border-neutral-200 bg-neutral-50 py-1 pl-3 text-neutral-950 text-xs [&_svg:not([class*=size-])]:size-4 [&_svg]:shrink-0', onRemove ? 'pr-1' : 'pr-3', className), "data-slot": "chat-attachment", "data-variant": "record", ...props, children: [_jsx("span", { "aria-hidden": true, className: "flex text-neutral-600", "data-slot": "chat-attachment-icon", children: icon ?? _jsx(FileText, { strokeWidth: 2 }) }), _jsx("span", { className: "shrink-0 font-medium", "data-slot": "chat-attachment-name", children: name }), token != null && (_jsx(ChatToken, { className: "min-w-0 truncate", "data-slot": "chat-attachment-token", children: token })), status != null && (_jsx("span", { className: "ml-auto flex shrink-0 pl-1", "data-slot": "chat-attachment-status", children: status })), onRemove && (_jsx(Button, { "aria-label": label, className: status == null ? 'ml-auto' : undefined, "data-slot": "chat-attachment-remove", onClick: onRemove, size: "icon-sm", variant: "ghost", children: _jsx(X, { "aria-hidden": true, strokeWidth: 2 }) }))] }));
|
|
41
|
+
}
|
|
42
|
+
if (variant === 'image') {
|
|
43
|
+
return (_jsxs("div", { className: cn('relative size-control-xl shrink-0', className), "data-slot": "chat-attachment", "data-variant": "image", ...props, children: [_jsx("img", { alt: name, className: "size-full rounded-item border border-neutral-200 bg-neutral-100 object-cover", src: src }), onRemove && (_jsx("button", { "aria-label": label, className: cn(
|
|
44
|
+
// A small round chip on the corner, so the picture itself stays whole.
|
|
45
|
+
'absolute -top-1.5 -right-1.5 inline-flex size-5 cursor-pointer items-center justify-center rounded-full border border-neutral-200 bg-neutral-50 text-neutral-600 transition-colors duration-150 hover:text-neutral-950', focusRing), "data-slot": "chat-attachment-remove", onClick: onRemove, type: "button", children: _jsx(X, { "aria-hidden": true, className: "size-3", strokeWidth: 2 }) }))] }));
|
|
46
|
+
}
|
|
47
|
+
const tone = parts.ext.toLowerCase() === '.pdf' ? 'pdf' : 'neutral';
|
|
48
|
+
const Icon = tone === 'pdf' ? FileText : FileIcon;
|
|
49
|
+
return (_jsxs("div", { className: cn(
|
|
50
|
+
// 48 high, as the image beside it: a row-high well (40) inset 4 within the hairline.
|
|
51
|
+
'flex h-control-xl min-w-0 max-w-72 shrink-0 items-center gap-2.5 rounded-item border border-neutral-200 bg-neutral-50 p-[calc(--spacing(1)-1px)] text-neutral-950', onRemove ? 'pr-1' : 'pr-3', className), "data-slot": "chat-attachment", "data-variant": "file", ...props, children: [_jsx("span", { "aria-hidden": true, className: cn('inline-flex size-row shrink-0 items-center justify-center rounded-chip [&_svg]:size-5', wellTones[tone]), "data-slot": "chat-attachment-icon", children: icon ?? _jsx(Icon, { strokeWidth: 2 }) }), _jsxs("span", { className: "flex min-w-0 flex-col", children: [_jsx(Truncate, { at: truncate, className: "font-medium text-xs", "data-slot": "chat-attachment-name",
|
|
52
|
+
// The extension has its own line, so the name keeps the end it would keep with it.
|
|
53
|
+
end: Math.max(0, truncationTail(parts.base + parts.ext).length - parts.ext.length), children: parts.base }), parts.ext && (_jsx("span", { className: "truncate text-neutral-600 text-xxs", "data-slot": "chat-attachment-ext", children: parts.ext }))] }), onRemove && (_jsx(Button, { "aria-label": label, className: "ml-auto", "data-slot": "chat-attachment-remove", onClick: onRemove, size: "icon-sm", variant: "ghost", children: _jsx(X, { "aria-hidden": true, strokeWidth: 2 }) }))] }));
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* A row of `ChatAttachment`s, 8 apart, wrapping; a record takes a line of its own. In the
|
|
57
|
+
* composer's `attachments` slot it waits 8 above the box; in a thread, right after a message, it
|
|
58
|
+
* hangs 4 under it on the message's side.
|
|
59
|
+
*/
|
|
60
|
+
export const ChatAttachments = ({ variant, align, className, ...props }) => {
|
|
61
|
+
const own = variant ? variant === 'own' : align === 'end';
|
|
62
|
+
return (_jsx("div", { className: cn('flex min-w-0 flex-wrap items-center gap-2', own && 'ml-auto max-w-2/3 justify-end', className), "data-slot": "chat-attachments", "data-variant": own ? 'own' : 'other', ...props }));
|
|
63
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
export type ChatEventProps = ComponentProps<'p'> & {
|
|
3
|
+
time?: ReactNode;
|
|
4
|
+
dateTime?: string;
|
|
5
|
+
};
|
|
6
|
+
/** A quiet, centred system line between messages: "Joan has closed the ticket". */
|
|
7
|
+
export declare const ChatEvent: ({ time, dateTime, className, children, ...props }: ChatEventProps) => import("react").JSX.Element;
|