@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,173 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { Menu as MenuPrimitive } from '@base-ui/react/menu';
|
|
4
|
+
import { mergeProps } from '@base-ui/react/merge-props';
|
|
5
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
6
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
7
|
+
import { ChevronRight, ChevronsUpDown, Ellipsis, House } from 'lucide-react';
|
|
8
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
9
|
+
import { cn } from '../lib/cn';
|
|
10
|
+
import { focusRing } from './button';
|
|
11
|
+
import {
|
|
12
|
+
DropdownMenu,
|
|
13
|
+
DropdownMenuContent,
|
|
14
|
+
type DropdownMenuContentProps,
|
|
15
|
+
DropdownMenuTrigger,
|
|
16
|
+
} from './dropdown-menu';
|
|
17
|
+
|
|
18
|
+
/** Header-bar trail from the app shell and the analytics top bars. */
|
|
19
|
+
export const Breadcrumb = ({
|
|
20
|
+
'aria-label': ariaLabel = 'Breadcrumb',
|
|
21
|
+
...props
|
|
22
|
+
}: ComponentProps<'nav'>) => <nav aria-label={ariaLabel} data-slot="breadcrumb" {...props} />;
|
|
23
|
+
|
|
24
|
+
// One line, always: a trail that wraps would push the header bar's height. The page truncates first.
|
|
25
|
+
// In a compact shell (a phone) the trail keeps only where you are and the page above it: home and
|
|
26
|
+
// the crumbs before the parent hide, the last three items being the parent, its chevron and the page.
|
|
27
|
+
export const breadcrumbListVariants = cva(
|
|
28
|
+
'flex min-w-0 items-center gap-2 text-neutral-600 @max-shell-compact/shell:[&>li:not(:nth-last-child(-n+3))]:hidden',
|
|
29
|
+
{
|
|
30
|
+
variants: {
|
|
31
|
+
size: {
|
|
32
|
+
md: 'font-normal text-xs leading-4',
|
|
33
|
+
// The 2024 and 2025 product headers set the trail a size up, in medium.
|
|
34
|
+
lg: 'font-medium text-sm',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
defaultVariants: {
|
|
38
|
+
size: 'md',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
export type BreadcrumbListProps = ComponentProps<'ol'> &
|
|
44
|
+
VariantProps<typeof breadcrumbListVariants>;
|
|
45
|
+
|
|
46
|
+
export const BreadcrumbList = ({ size, className, ...props }: BreadcrumbListProps) => (
|
|
47
|
+
<ol
|
|
48
|
+
className={cn(breadcrumbListVariants({ size }), className)}
|
|
49
|
+
data-slot="breadcrumb-list"
|
|
50
|
+
{...props}
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
export const BreadcrumbItem = ({ className, ...props }: ComponentProps<'li'>) => (
|
|
55
|
+
<li
|
|
56
|
+
className={cn(
|
|
57
|
+
// Links keep their width; only the current page gives way when the bar is short.
|
|
58
|
+
'inline-flex shrink-0 items-center gap-2 has-data-[slot=breadcrumb-page]:min-w-0 has-data-[slot=breadcrumb-page]:shrink',
|
|
59
|
+
className,
|
|
60
|
+
)}
|
|
61
|
+
data-slot="breadcrumb-item"
|
|
62
|
+
{...props}
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
export type BreadcrumbLinkProps = useRender.ComponentProps<'a'>;
|
|
67
|
+
|
|
68
|
+
/** Pass `render={<Link to="…" />}` to use the router's own link. */
|
|
69
|
+
export const BreadcrumbLink = ({ render, ref, className, ...props }: BreadcrumbLinkProps) =>
|
|
70
|
+
useRender({
|
|
71
|
+
defaultTagName: 'a',
|
|
72
|
+
render,
|
|
73
|
+
ref,
|
|
74
|
+
// State keys become data attributes, so this sets data-slot="breadcrumb-link".
|
|
75
|
+
state: { slot: 'breadcrumb-link' },
|
|
76
|
+
props: mergeProps<'a'>(
|
|
77
|
+
{
|
|
78
|
+
className: cn(
|
|
79
|
+
'rounded-chip text-neutral-600 transition-colors duration-150 hover:text-neutral-950',
|
|
80
|
+
focusRing,
|
|
81
|
+
className,
|
|
82
|
+
),
|
|
83
|
+
},
|
|
84
|
+
props,
|
|
85
|
+
),
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
export const BreadcrumbPage = ({ className, ...props }: ComponentProps<'span'>) => (
|
|
89
|
+
<span
|
|
90
|
+
aria-current="page"
|
|
91
|
+
className={cn('min-w-0 truncate text-neutral-950', className)}
|
|
92
|
+
data-slot="breadcrumb-page"
|
|
93
|
+
{...props}
|
|
94
|
+
/>
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
export const BreadcrumbSeparator = ({ className, children, ...props }: ComponentProps<'li'>) => (
|
|
98
|
+
<li
|
|
99
|
+
aria-hidden
|
|
100
|
+
className={cn('inline-flex text-neutral-400 [&_svg]:size-4', className)}
|
|
101
|
+
data-slot="breadcrumb-separator"
|
|
102
|
+
role="presentation"
|
|
103
|
+
{...props}
|
|
104
|
+
>
|
|
105
|
+
{children ?? <ChevronRight strokeWidth={2} />}
|
|
106
|
+
</li>
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
export type BreadcrumbMenuProps = Omit<MenuPrimitive.Root.Props, 'children'> & {
|
|
110
|
+
/**
|
|
111
|
+
* The crumb's text, for a switcher ("Northwind ⌄") that moves to a sibling: another workspace,
|
|
112
|
+
* project or report. Left out, the trigger is an ellipsis for the pages a long trail hides.
|
|
113
|
+
*/
|
|
114
|
+
label?: ReactNode;
|
|
115
|
+
/** Names the ellipsis; a labelled switcher is named by its label. */
|
|
116
|
+
'aria-label'?: string;
|
|
117
|
+
/** DropdownMenuItems: the hidden pages, or the siblings to switch to. */
|
|
118
|
+
children: ReactNode;
|
|
119
|
+
/** Where the menu is portalled; the body by default. */
|
|
120
|
+
container?: DropdownMenuContentProps['container'];
|
|
121
|
+
className?: string;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* A crumb that opens a menu. With a `label` it switches between siblings; without, it is the "…"
|
|
126
|
+
* that stands in for the middle of a long trail, so the bar keeps where you came from and where
|
|
127
|
+
* you are, and the rest is one click away.
|
|
128
|
+
*/
|
|
129
|
+
export const BreadcrumbMenu = ({
|
|
130
|
+
label,
|
|
131
|
+
'aria-label': ariaLabel,
|
|
132
|
+
children,
|
|
133
|
+
container,
|
|
134
|
+
className,
|
|
135
|
+
...props
|
|
136
|
+
}: BreadcrumbMenuProps) => (
|
|
137
|
+
<DropdownMenu {...props}>
|
|
138
|
+
<DropdownMenuTrigger
|
|
139
|
+
aria-label={label ? undefined : (ariaLabel ?? 'Show hidden pages')}
|
|
140
|
+
className={cn(
|
|
141
|
+
// Pulled out by its padding, so its text lines up with the crumbs beside it.
|
|
142
|
+
'-mx-1.5 inline-flex h-control-sm shrink-0 cursor-pointer items-center gap-1 rounded-chip px-1.5 text-neutral-600',
|
|
143
|
+
'transition-[background-color,color] duration-150 hover:bg-neutral-950/5 hover:text-neutral-950',
|
|
144
|
+
'data-popup-open:bg-selected data-popup-open:text-neutral-950 [&_svg]:size-4 [&_svg]:shrink-0',
|
|
145
|
+
focusRing,
|
|
146
|
+
className,
|
|
147
|
+
)}
|
|
148
|
+
data-slot="breadcrumb-menu"
|
|
149
|
+
>
|
|
150
|
+
{label ?? <Ellipsis strokeWidth={2} />}
|
|
151
|
+
{label && <ChevronsUpDown className="text-neutral-400" strokeWidth={2} />}
|
|
152
|
+
</DropdownMenuTrigger>
|
|
153
|
+
<DropdownMenuContent align="start" className="min-w-menu-wide" container={container}>
|
|
154
|
+
{children}
|
|
155
|
+
</DropdownMenuContent>
|
|
156
|
+
</DropdownMenu>
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
/** House icon that stands in for the root crumb; wrap it in a BreadcrumbLink to make it a link. */
|
|
160
|
+
export const BreadcrumbHome = ({
|
|
161
|
+
'aria-label': ariaLabel = 'Home',
|
|
162
|
+
className,
|
|
163
|
+
...props
|
|
164
|
+
}: ComponentProps<typeof House>) => (
|
|
165
|
+
<House
|
|
166
|
+
aria-label={ariaLabel}
|
|
167
|
+
className={cn('size-4 shrink-0 text-neutral-400', className)}
|
|
168
|
+
data-slot="breadcrumb-home"
|
|
169
|
+
role="img"
|
|
170
|
+
strokeWidth={2}
|
|
171
|
+
{...props}
|
|
172
|
+
/>
|
|
173
|
+
);
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { mergeProps } from '@base-ui/react/merge-props';
|
|
4
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
5
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
6
|
+
import { Children, isValidElement, type MouseEvent, type ReactNode } from 'react';
|
|
7
|
+
import { cn } from '../lib/cn';
|
|
8
|
+
import { Spinner } from './spinner';
|
|
9
|
+
|
|
10
|
+
export const focusRing =
|
|
11
|
+
'outline-none focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-focus focus-visible:outline-offset-2';
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
* A finger needs about 44px to land on, and a 28 or 34px square is drawn for a mouse. On a coarse
|
|
15
|
+
* pointer an invisible 44px square is centred over the control, so the target grows and nothing
|
|
16
|
+
* round it moves. The control is positioned so the square centres on it; a caller's `absolute`
|
|
17
|
+
* replaces that through cn(). For small controls that use no ::after of their own.
|
|
18
|
+
*/
|
|
19
|
+
export const touchTarget =
|
|
20
|
+
"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-['']";
|
|
21
|
+
|
|
22
|
+
export const buttonVariants = cva(
|
|
23
|
+
[
|
|
24
|
+
'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',
|
|
25
|
+
// Gives a little under the press, so a click is felt; still under reduced motion.
|
|
26
|
+
'active:scale-[0.97] motion-reduce:active:scale-100',
|
|
27
|
+
'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',
|
|
28
|
+
focusRing,
|
|
29
|
+
],
|
|
30
|
+
{
|
|
31
|
+
variants: {
|
|
32
|
+
variant: {
|
|
33
|
+
primary: [
|
|
34
|
+
'bg-action text-on-action shadow-action [background-image:var(--action-gradient)]',
|
|
35
|
+
'hover:bg-action-hover hover:[background-image:none]',
|
|
36
|
+
],
|
|
37
|
+
secondary:
|
|
38
|
+
// Its hover is the 5% ink wash over whatever fill the theme gives controls.
|
|
39
|
+
'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))]',
|
|
40
|
+
ghost: 'text-neutral-600 hover:bg-neutral-950/5 hover:text-neutral-800',
|
|
41
|
+
// For AI actions beside the primary one: the theme's wash, no shadow. Hover mixes the
|
|
42
|
+
// wash towards its own text colour, so it deepens in every theme and in dark mode.
|
|
43
|
+
tint: 'bg-tint text-tint-fg hover:bg-[color-mix(in_oklab,var(--color-tint),var(--color-tint-fg)_8%)]',
|
|
44
|
+
},
|
|
45
|
+
size: {
|
|
46
|
+
// The control row: level with a small input, select or segmented control beside it.
|
|
47
|
+
// An icon's end sits a step tighter than a label's, so the whole reads centred.
|
|
48
|
+
md: 'h-control rounded-control px-4 data-[icon=both]:px-3 data-[icon=leading]:pl-3 data-[icon=trailing]:pr-3',
|
|
49
|
+
// The field row: level with a medium input, and the height of the dock's action.
|
|
50
|
+
lg: 'h-control-lg rounded-control px-4 [--spacing-icon:var(--spacing-icon-lg)]',
|
|
51
|
+
icon: ['size-control rounded-control', touchTarget],
|
|
52
|
+
'icon-sm': ['size-control-sm rounded-chip', touchTarget],
|
|
53
|
+
},
|
|
54
|
+
shape: {
|
|
55
|
+
default: '',
|
|
56
|
+
// One corner a height: a round button keeps the control's corner, so it sits with the rest.
|
|
57
|
+
pill: 'rounded-control',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
defaultVariants: {
|
|
61
|
+
variant: 'primary',
|
|
62
|
+
size: 'md',
|
|
63
|
+
shape: 'default',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
/** Which ends of a label hold an element (an icon, a spinner) rather than text. */
|
|
69
|
+
const iconEnds = (children: ReactNode, loading: boolean) => {
|
|
70
|
+
const items = Children.toArray(children);
|
|
71
|
+
const leading = loading || isValidElement(items[0]);
|
|
72
|
+
const trailing = items.length > 1 && isValidElement(items[items.length - 1]);
|
|
73
|
+
if (leading && trailing) return 'both';
|
|
74
|
+
if (leading) return 'leading';
|
|
75
|
+
if (trailing) return 'trailing';
|
|
76
|
+
return undefined;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export type ButtonProps = useRender.ComponentProps<'button'> &
|
|
80
|
+
VariantProps<typeof buttonVariants> & {
|
|
81
|
+
/**
|
|
82
|
+
* Busy with what it started: a spinner leads the label (or takes an icon button's place) and
|
|
83
|
+
* clicks are held off. It stays at full strength, unlike disabled, since it is working.
|
|
84
|
+
*/
|
|
85
|
+
loading?: boolean;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* One label size (13px medium) at both heights; size only changes padding, so
|
|
90
|
+
* a button sits level with the input beside it: md with a small one, lg with a
|
|
91
|
+
* medium one. Icons sit at 16px either side. Pass `render={<a href="…" />}`
|
|
92
|
+
* to draw a link as a button.
|
|
93
|
+
*/
|
|
94
|
+
export const Button = ({
|
|
95
|
+
variant,
|
|
96
|
+
size,
|
|
97
|
+
shape,
|
|
98
|
+
loading = false,
|
|
99
|
+
render,
|
|
100
|
+
ref,
|
|
101
|
+
className,
|
|
102
|
+
type = 'button',
|
|
103
|
+
children,
|
|
104
|
+
...props
|
|
105
|
+
}: ButtonProps) => {
|
|
106
|
+
const iconOnly = size === 'icon' || size === 'icon-sm';
|
|
107
|
+
|
|
108
|
+
// While loading, a click, Enter or Space does nothing and a submit button sends no form; the
|
|
109
|
+
// button keeps focus, so the keyboard does not lose its place while the work finishes.
|
|
110
|
+
const holdOff = (
|
|
111
|
+
event: MouseEvent<HTMLButtonElement> & { preventBaseUIHandler?: () => void },
|
|
112
|
+
) => {
|
|
113
|
+
event.preventDefault();
|
|
114
|
+
event.preventBaseUIHandler?.();
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
return useRender({
|
|
118
|
+
defaultTagName: 'button',
|
|
119
|
+
render,
|
|
120
|
+
ref,
|
|
121
|
+
// State keys become data attributes, so this sets data-slot="button", data-size, data-loading and
|
|
122
|
+
// data-icon; a part that holds a button (a table cell) can fit it by its size.
|
|
123
|
+
state: {
|
|
124
|
+
slot: 'button',
|
|
125
|
+
size: size ?? 'md',
|
|
126
|
+
loading,
|
|
127
|
+
icon: iconOnly ? undefined : iconEnds(children, loading),
|
|
128
|
+
},
|
|
129
|
+
props: mergeProps<'button'>(
|
|
130
|
+
{
|
|
131
|
+
className: cn(
|
|
132
|
+
buttonVariants({ variant, size, shape }),
|
|
133
|
+
loading && 'pointer-events-none',
|
|
134
|
+
className,
|
|
135
|
+
),
|
|
136
|
+
// A link or other element passed through render keeps its own semantics.
|
|
137
|
+
type: render ? undefined : type,
|
|
138
|
+
'aria-busy': loading || undefined,
|
|
139
|
+
children: loading ? (
|
|
140
|
+
iconOnly ? (
|
|
141
|
+
<Spinner className="size-icon" />
|
|
142
|
+
) : (
|
|
143
|
+
<>
|
|
144
|
+
<Spinner className="size-icon" />
|
|
145
|
+
{children}
|
|
146
|
+
</>
|
|
147
|
+
)
|
|
148
|
+
) : (
|
|
149
|
+
children
|
|
150
|
+
),
|
|
151
|
+
},
|
|
152
|
+
props,
|
|
153
|
+
// Merged last, so its handler runs before the caller's and stops it.
|
|
154
|
+
loading ? { onClick: holdOff } : undefined,
|
|
155
|
+
),
|
|
156
|
+
});
|
|
157
|
+
};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { ChevronDown, ChevronLeft, ChevronRight } from 'lucide-react';
|
|
4
|
+
import { type ComponentProps, useEffect, useRef } from 'react';
|
|
5
|
+
import {
|
|
6
|
+
type ChevronProps,
|
|
7
|
+
type DayButtonProps,
|
|
8
|
+
DayPicker,
|
|
9
|
+
type DayProps,
|
|
10
|
+
type RootProps,
|
|
11
|
+
} from 'react-day-picker';
|
|
12
|
+
import { enGB } from 'react-day-picker/locale';
|
|
13
|
+
import { cn } from '../lib/cn';
|
|
14
|
+
import { buttonVariants, focusRing } from './button';
|
|
15
|
+
|
|
16
|
+
export type CalendarProps = ComponentProps<typeof DayPicker>;
|
|
17
|
+
|
|
18
|
+
/*
|
|
19
|
+
* The cell is a td and the day a 32px button inside it. A range is drawn on the cells, so the strip
|
|
20
|
+
* runs unbroken between days while each button keeps its own corners; the ends of a range fill only
|
|
21
|
+
* the inner half of their cell, so the strip starts under the middle of the action-coloured day.
|
|
22
|
+
*/
|
|
23
|
+
const CalendarDay = ({ day: _day, modifiers, className, ...props }: DayProps) => {
|
|
24
|
+
const { range_start: start, range_end: end, range_middle: middle, hidden } = modifiers;
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<td
|
|
28
|
+
className={cn(
|
|
29
|
+
'p-0 text-center',
|
|
30
|
+
!hidden && [
|
|
31
|
+
// Of-type, not first/last child: with week numbers on, a th opens each row.
|
|
32
|
+
middle && 'bg-tint first-of-type:rounded-l-item last-of-type:rounded-r-item',
|
|
33
|
+
start &&
|
|
34
|
+
!end &&
|
|
35
|
+
'bg-linear-to-r from-50% from-transparent to-50% to-tint last-of-type:bg-none',
|
|
36
|
+
end &&
|
|
37
|
+
!start &&
|
|
38
|
+
'bg-linear-to-l from-50% from-transparent to-50% to-tint first-of-type:bg-none',
|
|
39
|
+
],
|
|
40
|
+
// DayPicker's own classes for the cell: classNames.day and any modifiersClassNames.
|
|
41
|
+
className,
|
|
42
|
+
)}
|
|
43
|
+
data-slot="calendar-day"
|
|
44
|
+
{...props}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const dayButtonClass = [
|
|
50
|
+
'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',
|
|
51
|
+
'hover:bg-neutral-950/5 hover:text-neutral-950',
|
|
52
|
+
// Neighbouring days sit flush, so the focused one is lifted above them to keep its ring whole.
|
|
53
|
+
'focus-visible:z-10',
|
|
54
|
+
focusRing,
|
|
55
|
+
// Today is marked quietly: a medium weight and a dot that takes the text colour, whatever the fill.
|
|
56
|
+
// The colour only on a plain day: on the action fill or the tint it would beat their own text colour.
|
|
57
|
+
'data-today:font-medium data-today:not-data-chosen:not-data-range-middle:text-neutral-950',
|
|
58
|
+
'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',
|
|
59
|
+
'data-outside:text-neutral-400',
|
|
60
|
+
'data-range-middle:text-tint-fg data-range-middle:hover:bg-neutral-950/5',
|
|
61
|
+
// The chosen day, and both ends of a range, take the one action colour.
|
|
62
|
+
'data-chosen:bg-action data-chosen:text-on-action data-chosen:shadow-action data-chosen:[background-image:var(--action-gradient)]',
|
|
63
|
+
'data-chosen:hover:bg-action-hover data-chosen:hover:text-on-action data-chosen:hover:[background-image:none]',
|
|
64
|
+
// DayPicker keeps the focused disabled day focusable through aria-disabled instead of disabled.
|
|
65
|
+
'disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50',
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
const CalendarDayButton = ({ day, modifiers, className, ...props }: DayButtonProps) => {
|
|
69
|
+
const ref = useRef<HTMLButtonElement>(null);
|
|
70
|
+
|
|
71
|
+
// DayPicker moves focus by flagging a day; the button has to take it, as the stock one does.
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (modifiers.focused) ref.current?.focus();
|
|
74
|
+
}, [modifiers.focused]);
|
|
75
|
+
|
|
76
|
+
const chosen = modifiers.selected && !modifiers.range_middle ? true : undefined;
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<button
|
|
80
|
+
className={cn(dayButtonClass, className)}
|
|
81
|
+
data-chosen={chosen}
|
|
82
|
+
data-outside={day.outside || undefined}
|
|
83
|
+
data-range-middle={modifiers.range_middle || undefined}
|
|
84
|
+
data-slot="calendar-day-button"
|
|
85
|
+
data-today={modifiers.today || undefined}
|
|
86
|
+
ref={ref}
|
|
87
|
+
{...props}
|
|
88
|
+
/>
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const CalendarChevron = ({ className, orientation, disabled: _disabled }: ChevronProps) => {
|
|
93
|
+
const Icon =
|
|
94
|
+
orientation === 'left' ? ChevronLeft : orientation === 'right' ? ChevronRight : ChevronDown;
|
|
95
|
+
return <Icon aria-hidden className={cn('size-4', className)} strokeWidth={2} />;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const CalendarRoot = ({ rootRef, className, ...props }: RootProps) => (
|
|
99
|
+
<div className={className} data-slot="calendar" ref={rootRef} {...props} />
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
/** A month grid for picking a day or a range, on react-day-picker; weeks start on Monday (en-GB). */
|
|
103
|
+
export const Calendar = ({
|
|
104
|
+
className,
|
|
105
|
+
classNames,
|
|
106
|
+
components,
|
|
107
|
+
locale = enGB,
|
|
108
|
+
showOutsideDays = true,
|
|
109
|
+
...props
|
|
110
|
+
}: CalendarProps) => (
|
|
111
|
+
<DayPicker
|
|
112
|
+
className={cn('relative w-fit text-xs', className)}
|
|
113
|
+
classNames={{
|
|
114
|
+
months: 'flex gap-6',
|
|
115
|
+
month: 'flex flex-col gap-3',
|
|
116
|
+
// One bar over all months: previous on the far left, next on the far right, level with the captions.
|
|
117
|
+
nav: 'pointer-events-none absolute inset-x-0 top-0 z-10 flex h-control-sm items-center justify-between',
|
|
118
|
+
button_previous: cn(
|
|
119
|
+
buttonVariants({ variant: 'ghost', size: 'icon-sm' }),
|
|
120
|
+
'pointer-events-auto',
|
|
121
|
+
),
|
|
122
|
+
button_next: cn(
|
|
123
|
+
buttonVariants({ variant: 'ghost', size: 'icon-sm' }),
|
|
124
|
+
'pointer-events-auto',
|
|
125
|
+
),
|
|
126
|
+
month_caption: 'flex h-control-sm items-center justify-center px-8',
|
|
127
|
+
caption_label:
|
|
128
|
+
'flex select-none items-center gap-1 font-medium text-neutral-950 text-sm [&_svg]:text-neutral-600',
|
|
129
|
+
dropdowns: 'flex items-center gap-1.5',
|
|
130
|
+
dropdown_root:
|
|
131
|
+
'relative rounded-chip has-focus-visible:outline-2 has-focus-visible:outline-focus has-focus-visible:outline-offset-2',
|
|
132
|
+
// The native select sits invisibly over the label, so the platform's own picker opens.
|
|
133
|
+
dropdown: 'absolute inset-0 cursor-pointer opacity-0',
|
|
134
|
+
// Separate borders let the rows breathe while a range strip still runs across each week.
|
|
135
|
+
month_grid: 'border-separate border-spacing-x-0 border-spacing-y-0.5',
|
|
136
|
+
weekday: 'h-control-sm w-cell select-none p-0 font-normal text-neutral-600 text-xxs',
|
|
137
|
+
week_number_header: 'w-cell select-none font-normal text-neutral-600 text-xxs',
|
|
138
|
+
week_number: 'w-cell select-none text-center text-neutral-600 text-xxs tabular-nums',
|
|
139
|
+
footer: 'pt-3 text-neutral-600 text-xs',
|
|
140
|
+
hidden: 'invisible',
|
|
141
|
+
...classNames,
|
|
142
|
+
}}
|
|
143
|
+
components={{
|
|
144
|
+
Root: CalendarRoot,
|
|
145
|
+
Chevron: CalendarChevron,
|
|
146
|
+
Day: CalendarDay,
|
|
147
|
+
DayButton: CalendarDayButton,
|
|
148
|
+
...components,
|
|
149
|
+
}}
|
|
150
|
+
locale={locale}
|
|
151
|
+
showOutsideDays={showOutsideDays}
|
|
152
|
+
{...props}
|
|
153
|
+
/>
|
|
154
|
+
);
|