@zonsh/ui 0.0.0 → 0.4.1
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 +43 -0
- package/README.md +81 -1
- package/assets/illustrations/drawing/bracket-construction-dark.svg +77 -0
- package/assets/illustrations/drawing/bracket-construction-filled-dark.svg +50 -0
- package/assets/illustrations/drawing/bracket-construction-filled.svg +50 -0
- package/assets/illustrations/drawing/bracket-construction.svg +77 -0
- package/assets/illustrations/drawing/crescent-dark.svg +28 -0
- package/assets/illustrations/drawing/crescent-guides-dark.svg +33 -0
- package/assets/illustrations/drawing/crescent-guides.svg +33 -0
- package/assets/illustrations/drawing/crescent.svg +28 -0
- package/assets/illustrations/drawing/eclipse-dark.svg +187 -0
- package/assets/illustrations/drawing/eclipse-guides-dark.svg +191 -0
- package/assets/illustrations/drawing/eclipse-guides.svg +191 -0
- package/assets/illustrations/drawing/eclipse.svg +187 -0
- package/assets/illustrations/drawing/elevation-guides-dark.svg +31 -0
- package/assets/illustrations/drawing/elevation-guides-plain-dark.svg +9 -0
- package/assets/illustrations/drawing/elevation-guides-plain.svg +9 -0
- package/assets/illustrations/drawing/elevation-guides.svg +31 -0
- package/assets/illustrations/drawing/horizon-dark.svg +30 -0
- package/assets/illustrations/drawing/horizon.svg +30 -0
- package/assets/illustrations/drawing/nib-study-dark.svg +107 -0
- package/assets/illustrations/drawing/nib-study-plain-dark.svg +93 -0
- package/assets/illustrations/drawing/nib-study-plain.svg +93 -0
- package/assets/illustrations/drawing/nib-study.svg +107 -0
- package/assets/illustrations/editorial/assistant-640.webp +0 -0
- package/assets/illustrations/editorial/assistant.webp +0 -0
- package/assets/illustrations/editorial/automation-640.webp +0 -0
- package/assets/illustrations/editorial/automation.webp +0 -0
- package/assets/illustrations/editorial/bracket-left-640.webp +0 -0
- package/assets/illustrations/editorial/bracket-left.webp +0 -0
- package/assets/illustrations/editorial/bracket-right-640.webp +0 -0
- package/assets/illustrations/editorial/bracket-right.webp +0 -0
- package/assets/illustrations/editorial/custom-software-640.webp +0 -0
- package/assets/illustrations/editorial/custom-software.webp +0 -0
- package/assets/illustrations/editorial/digitalization-640.webp +0 -0
- package/assets/illustrations/editorial/digitalization.webp +0 -0
- package/assets/illustrations/editorial/integration-640.webp +0 -0
- package/assets/illustrations/editorial/integration.webp +0 -0
- package/assets/illustrations/editorial/problem-640.webp +0 -0
- package/assets/illustrations/editorial/problem.webp +0 -0
- package/assets/illustrations/editorial/process-analysis-640.webp +0 -0
- package/assets/illustrations/editorial/process-analysis.webp +0 -0
- package/assets/illustrations/editorial/process-concept-640.webp +0 -0
- package/assets/illustrations/editorial/process-concept.webp +0 -0
- package/assets/illustrations/editorial/process-development-640.webp +0 -0
- package/assets/illustrations/editorial/process-development.webp +0 -0
- package/assets/illustrations/editorial/process-discovery-640.webp +0 -0
- package/assets/illustrations/editorial/process-discovery.webp +0 -0
- package/assets/illustrations/editorial/process-maintenance-640.webp +0 -0
- package/assets/illustrations/editorial/process-maintenance.webp +0 -0
- package/assets/illustrations/editorial/process-prototype-640.webp +0 -0
- package/assets/illustrations/editorial/process-prototype.webp +0 -0
- package/assets/illustrations/editorial/process-testing-640.webp +0 -0
- package/assets/illustrations/editorial/process-testing.webp +0 -0
- package/assets/illustrations/iso/automation-dark.svg +6 -0
- package/assets/illustrations/iso/automation.svg +6 -0
- package/assets/illustrations/iso/bar-chart-dark.svg +6 -0
- package/assets/illustrations/iso/bar-chart.svg +6 -0
- package/assets/illustrations/iso/brackets-classic-dark.svg +6 -0
- package/assets/illustrations/iso/brackets-classic.svg +6 -0
- package/assets/illustrations/iso/brackets-dark.svg +6 -0
- package/assets/illustrations/iso/brackets.svg +6 -0
- package/assets/illustrations/iso/city-dark.svg +6 -0
- package/assets/illustrations/iso/city.svg +6 -0
- package/assets/illustrations/iso/conveyor-dark.svg +6 -0
- package/assets/illustrations/iso/conveyor.svg +6 -0
- package/assets/illustrations/iso/database-dark.svg +6 -0
- package/assets/illustrations/iso/database.svg +6 -0
- package/assets/illustrations/iso/documents-dark.svg +6 -0
- package/assets/illustrations/iso/documents.svg +6 -0
- package/assets/illustrations/iso/inbox-dark.svg +6 -0
- package/assets/illustrations/iso/inbox.svg +6 -0
- package/assets/illustrations/iso/laptop-dark.svg +6 -0
- package/assets/illustrations/iso/laptop.svg +6 -0
- package/assets/illustrations/iso/monitor-dark.svg +6 -0
- package/assets/illustrations/iso/monitor.svg +6 -0
- package/assets/illustrations/iso/pipeline-dark.svg +6 -0
- package/assets/illustrations/iso/pipeline.svg +6 -0
- package/assets/illustrations/iso/platform-dark.svg +6 -0
- package/assets/illustrations/iso/platform.svg +6 -0
- package/assets/illustrations/iso/server-dark.svg +6 -0
- package/assets/illustrations/iso/server.svg +6 -0
- package/assets/illustrations/iso/spreadsheet-dark.svg +6 -0
- package/assets/illustrations/iso/spreadsheet.svg +6 -0
- package/assets/illustrations/iso/timeline-dark.svg +6 -0
- package/assets/illustrations/iso/timeline.svg +6 -0
- package/assets/illustrations/sheet/construction.svg +115 -0
- package/assets/illustrations/sheet/crescent.svg +40 -0
- package/assets/illustrations/sheet/limb.svg +42 -0
- package/assets/illustrations/sheet/stress-axis.svg +119 -0
- package/assets/illustrations/sheet/totality.svg +215 -0
- package/assets/illustrations/sheet/vertical-metrics.svg +43 -0
- package/assets/logo-left.svg +1 -0
- package/assets/logo-right.svg +1 -0
- package/assets/logo.svg +1 -0
- package/dist/components/_overlay.d.ts +47 -0
- package/dist/components/_overlay.js +59 -0
- package/dist/components/accordion.d.ts +32 -0
- package/dist/components/accordion.js +39 -0
- package/dist/components/alert-dialog.d.ts +45 -0
- package/dist/components/alert-dialog.js +56 -0
- package/dist/components/alert.d.ts +35 -0
- package/dist/components/alert.js +42 -0
- package/dist/components/ascii-field.d.ts +34 -0
- package/dist/components/ascii-field.js +410 -0
- package/dist/components/aspect-ratio.d.ts +14 -0
- package/dist/components/aspect-ratio.js +17 -0
- package/dist/components/avatar.d.ts +42 -0
- package/dist/components/avatar.js +55 -0
- package/dist/components/badge.d.ts +70 -0
- package/dist/components/badge.js +62 -0
- package/dist/components/bottom-nav.d.ts +86 -0
- package/dist/components/bottom-nav.js +175 -0
- package/dist/components/breadcrumb.d.ts +31 -0
- package/dist/components/breadcrumb.js +37 -0
- package/dist/components/button-group.d.ts +30 -0
- package/dist/components/button-group.js +47 -0
- package/dist/components/button.d.ts +53 -0
- package/dist/components/button.js +130 -0
- package/dist/components/calendar.d.ts +26 -0
- package/dist/components/calendar.js +179 -0
- package/dist/components/card.d.ts +42 -0
- package/dist/components/card.js +76 -0
- package/dist/components/carousel.d.ts +109 -0
- package/dist/components/carousel.js +231 -0
- package/dist/components/chart.d.ts +189 -0
- package/dist/components/chart.js +323 -0
- package/dist/components/checkbox.d.ts +23 -0
- package/dist/components/checkbox.js +43 -0
- package/dist/components/code-block.d.ts +55 -0
- package/dist/components/code-block.js +100 -0
- package/dist/components/collapsible.d.ts +20 -0
- package/dist/components/collapsible.js +32 -0
- package/dist/components/color-picker.d.ts +107 -0
- package/dist/components/color-picker.js +428 -0
- package/dist/components/combobox.d.ts +99 -0
- package/dist/components/combobox.js +172 -0
- package/dist/components/command.d.ts +132 -0
- package/dist/components/command.js +257 -0
- package/dist/components/context-menu.d.ts +29 -0
- package/dist/components/context-menu.js +35 -0
- package/dist/components/conversation.d.ts +36 -0
- package/dist/components/conversation.js +303 -0
- package/dist/components/copy-button.d.ts +55 -0
- package/dist/components/copy-button.js +133 -0
- package/dist/components/data-table.d.ts +235 -0
- package/dist/components/data-table.js +655 -0
- package/dist/components/date-picker.d.ts +160 -0
- package/dist/components/date-picker.js +338 -0
- package/dist/components/dialog.d.ts +57 -0
- package/dist/components/dialog.js +95 -0
- package/dist/components/direction.d.ts +16 -0
- package/dist/components/direction.js +18 -0
- package/dist/components/drawer.d.ts +69 -0
- package/dist/components/drawer.js +79 -0
- package/dist/components/empty.d.ts +31 -0
- package/dist/components/empty.js +50 -0
- package/dist/components/feature-list.d.ts +54 -0
- package/dist/components/feature-list.js +43 -0
- package/dist/components/field.d.ts +34 -0
- package/dist/components/field.js +81 -0
- package/dist/components/file-drop.d.ts +77 -0
- package/dist/components/file-drop.js +258 -0
- package/dist/components/filter-bar.d.ts +153 -0
- package/dist/components/filter-bar.js +334 -0
- package/dist/components/form.d.ts +35 -0
- package/dist/components/form.js +56 -0
- package/dist/components/graph.d.ts +146 -0
- package/dist/components/graph.js +825 -0
- package/dist/components/illustration.d.ts +85 -0
- package/dist/components/illustration.js +165 -0
- package/dist/components/input-group.d.ts +138 -0
- package/dist/components/input-group.js +312 -0
- package/dist/components/input.d.ts +16 -0
- package/dist/components/input.js +25 -0
- package/dist/components/item.d.ts +64 -0
- package/dist/components/item.js +116 -0
- package/dist/components/kbd.d.ts +50 -0
- package/dist/components/kbd.js +45 -0
- package/dist/components/label.d.ts +12 -0
- package/dist/components/label.js +24 -0
- package/dist/components/layout.d.ts +136 -0
- package/dist/components/layout.js +162 -0
- package/dist/components/lightbox.d.ts +100 -0
- package/dist/components/lightbox.js +439 -0
- package/dist/components/locale.d.ts +44 -0
- package/dist/components/locale.js +37 -0
- package/dist/components/logo.d.ts +54 -0
- package/dist/components/logo.js +96 -0
- package/dist/components/menu.d.ts +60 -0
- package/dist/components/menu.js +140 -0
- package/dist/components/menubar.d.ts +62 -0
- package/dist/components/menubar.js +223 -0
- package/dist/components/message.d.ts +42 -0
- package/dist/components/message.js +59 -0
- package/dist/components/meter.d.ts +31 -0
- package/dist/components/meter.js +27 -0
- package/dist/components/money-input.d.ts +80 -0
- package/dist/components/money-input.js +253 -0
- package/dist/components/native-select.d.ts +26 -0
- package/dist/components/native-select.js +35 -0
- package/dist/components/navigation-menu.d.ts +42 -0
- package/dist/components/navigation-menu.js +97 -0
- package/dist/components/number-field.d.ts +55 -0
- package/dist/components/number-field.js +164 -0
- package/dist/components/otp-field.d.ts +48 -0
- package/dist/components/otp-field.js +102 -0
- package/dist/components/pagination.d.ts +37 -0
- package/dist/components/pagination.js +81 -0
- package/dist/components/pdf-viewer.d.ts +134 -0
- package/dist/components/pdf-viewer.js +996 -0
- package/dist/components/phone-input.d.ts +79 -0
- package/dist/components/phone-input.js +282 -0
- package/dist/components/popover.d.ts +33 -0
- package/dist/components/popover.js +48 -0
- package/dist/components/preview-card.d.ts +25 -0
- package/dist/components/preview-card.js +22 -0
- package/dist/components/progress.d.ts +27 -0
- package/dist/components/progress.js +25 -0
- package/dist/components/prompt-input.d.ts +156 -0
- package/dist/components/prompt-input.js +415 -0
- package/dist/components/quote.d.ts +22 -0
- package/dist/components/quote.js +15 -0
- package/dist/components/radio-group.d.ts +18 -0
- package/dist/components/radio-group.js +34 -0
- package/dist/components/rating.d.ts +73 -0
- package/dist/components/rating.js +124 -0
- package/dist/components/reasoning.d.ts +46 -0
- package/dist/components/reasoning.js +73 -0
- package/dist/components/resizable.d.ts +47 -0
- package/dist/components/resizable.js +44 -0
- package/dist/components/response.d.ts +41 -0
- package/dist/components/response.js +566 -0
- package/dist/components/scroll-area.d.ts +33 -0
- package/dist/components/scroll-area.js +31 -0
- package/dist/components/select.d.ts +35 -0
- package/dist/components/select.js +71 -0
- package/dist/components/separator.d.ts +14 -0
- package/dist/components/separator.js +17 -0
- package/dist/components/sidebar.d.ts +163 -0
- package/dist/components/sidebar.js +505 -0
- package/dist/components/site-header.d.ts +93 -0
- package/dist/components/site-header.js +121 -0
- package/dist/components/skeleton.d.ts +31 -0
- package/dist/components/skeleton.js +29 -0
- package/dist/components/slider.d.ts +24 -0
- package/dist/components/slider.js +131 -0
- package/dist/components/sortable.d.ts +178 -0
- package/dist/components/sortable.js +1258 -0
- package/dist/components/sources.d.ts +40 -0
- package/dist/components/sources.js +42 -0
- package/dist/components/spinner.d.ts +48 -0
- package/dist/components/spinner.js +75 -0
- package/dist/components/stat.d.ts +91 -0
- package/dist/components/stat.js +141 -0
- package/dist/components/stepper.d.ts +71 -0
- package/dist/components/stepper.js +101 -0
- package/dist/components/suggestions.d.ts +20 -0
- package/dist/components/suggestions.js +18 -0
- package/dist/components/switch.d.ts +14 -0
- package/dist/components/switch.js +26 -0
- package/dist/components/table.d.ts +172 -0
- package/dist/components/table.js +895 -0
- package/dist/components/tabs.d.ts +25 -0
- package/dist/components/tabs.js +162 -0
- package/dist/components/tag.d.ts +41 -0
- package/dist/components/tag.js +88 -0
- package/dist/components/tags-input.d.ts +56 -0
- package/dist/components/tags-input.js +271 -0
- package/dist/components/textarea.d.ts +13 -0
- package/dist/components/textarea.js +16 -0
- package/dist/components/theme.d.ts +55 -0
- package/dist/components/theme.js +120 -0
- package/dist/components/time-field.d.ts +70 -0
- package/dist/components/time-field.js +450 -0
- package/dist/components/timeline.d.ts +92 -0
- package/dist/components/timeline.js +108 -0
- package/dist/components/tippy.d.ts +48 -0
- package/dist/components/tippy.js +648 -0
- package/dist/components/toast.d.ts +88 -0
- package/dist/components/toast.js +205 -0
- package/dist/components/toggle-group.d.ts +41 -0
- package/dist/components/toggle-group.js +140 -0
- package/dist/components/toggle.d.ts +23 -0
- package/dist/components/toggle.js +35 -0
- package/dist/components/tool-call.d.ts +63 -0
- package/dist/components/tool-call.js +68 -0
- package/dist/components/toolbar.d.ts +17 -0
- package/dist/components/toolbar.js +39 -0
- package/dist/components/tooltip.d.ts +42 -0
- package/dist/components/tooltip.js +47 -0
- package/dist/components/tour.d.ts +127 -0
- package/dist/components/tour.js +648 -0
- package/dist/components/tree.d.ts +75 -0
- package/dist/components/tree.js +649 -0
- package/dist/components/typography.d.ts +134 -0
- package/dist/components/typography.js +176 -0
- package/dist/components/video-player.d.ts +284 -0
- package/dist/components/video-player.js +1392 -0
- package/dist/illustration.d.ts +2 -0
- package/dist/illustration.js +7 -0
- package/dist/index.d.ts +93 -0
- package/dist/index.js +94 -0
- package/dist/lib/cn.d.ts +20 -0
- package/dist/lib/cn.js +38 -0
- package/dist/lib/code-highlight.d.ts +18 -0
- package/dist/lib/code-highlight.js +174 -0
- package/dist/lib/code-theme.d.ts +19 -0
- package/dist/lib/code-theme.js +140 -0
- package/dist/lib/collapse-row.d.ts +9 -0
- package/dist/lib/collapse-row.js +129 -0
- package/dist/lib/digit-roll.d.ts +21 -0
- package/dist/lib/digit-roll.js +31 -0
- package/dist/lib/editorial-assets.d.ts +16 -0
- package/dist/lib/editorial-assets.js +56 -0
- package/dist/lib/field-errors.d.ts +28 -0
- package/dist/lib/field-errors.js +24 -0
- package/dist/lib/field-value.d.ts +13 -0
- package/dist/lib/field-value.js +44 -0
- package/dist/lib/figure/catalog.d.ts +127 -0
- package/dist/lib/figure/catalog.js +130 -0
- package/dist/lib/figure/figures/automation.d.ts +7 -0
- package/dist/lib/figure/figures/automation.js +143 -0
- package/dist/lib/figure/figures/bar-chart.d.ts +7 -0
- package/dist/lib/figure/figures/bar-chart.js +99 -0
- package/dist/lib/figure/figures/brackets-classic.d.ts +11 -0
- package/dist/lib/figure/figures/brackets-classic.js +170 -0
- package/dist/lib/figure/figures/brackets.d.ts +8 -0
- package/dist/lib/figure/figures/brackets.js +84 -0
- package/dist/lib/figure/figures/city.d.ts +7 -0
- package/dist/lib/figure/figures/city.js +93 -0
- package/dist/lib/figure/figures/conveyor.d.ts +7 -0
- package/dist/lib/figure/figures/conveyor.js +97 -0
- package/dist/lib/figure/figures/database.d.ts +7 -0
- package/dist/lib/figure/figures/database.js +65 -0
- package/dist/lib/figure/figures/documents.d.ts +7 -0
- package/dist/lib/figure/figures/documents.js +83 -0
- package/dist/lib/figure/figures/inbox.d.ts +7 -0
- package/dist/lib/figure/figures/inbox.js +92 -0
- package/dist/lib/figure/figures/laptop.d.ts +7 -0
- package/dist/lib/figure/figures/laptop.js +67 -0
- package/dist/lib/figure/figures/monitor.d.ts +7 -0
- package/dist/lib/figure/figures/monitor.js +59 -0
- package/dist/lib/figure/figures/pipeline.d.ts +8 -0
- package/dist/lib/figure/figures/pipeline.js +117 -0
- package/dist/lib/figure/figures/platform.d.ts +7 -0
- package/dist/lib/figure/figures/platform.js +117 -0
- package/dist/lib/figure/figures/server.d.ts +7 -0
- package/dist/lib/figure/figures/server.js +115 -0
- package/dist/lib/figure/figures/spreadsheet.d.ts +7 -0
- package/dist/lib/figure/figures/spreadsheet.js +87 -0
- package/dist/lib/figure/figures/timeline.d.ts +7 -0
- package/dist/lib/figure/figures/timeline.js +65 -0
- package/dist/lib/figure/kernel.d.ts +152 -0
- package/dist/lib/figure/kernel.js +576 -0
- package/dist/lib/figure/parts.d.ts +42 -0
- package/dist/lib/figure/parts.js +126 -0
- package/dist/lib/form-reset.d.ts +11 -0
- package/dist/lib/form-reset.js +22 -0
- package/dist/lib/glide.d.ts +53 -0
- package/dist/lib/glide.js +138 -0
- package/dist/lib/graph-layout.d.ts +58 -0
- package/dist/lib/graph-layout.js +209 -0
- package/dist/lib/illustration-drawings.d.ts +89 -0
- package/dist/lib/illustration-drawings.js +539 -0
- package/dist/lib/illustration-info.d.ts +37 -0
- package/dist/lib/illustration-info.js +22 -0
- package/dist/lib/illustration-library.d.ts +87 -0
- package/dist/lib/illustration-library.js +352 -0
- package/dist/lib/logo-geometry.d.ts +29 -0
- package/dist/lib/logo-geometry.js +67 -0
- package/dist/lib/markdown-guard.d.ts +16 -0
- package/dist/lib/markdown-guard.js +123 -0
- package/dist/lib/merge-refs.d.ts +10 -0
- package/dist/lib/merge-refs.js +26 -0
- package/dist/lib/money.d.ts +73 -0
- package/dist/lib/money.js +343 -0
- package/dist/lib/motion.d.ts +6 -0
- package/dist/lib/motion.js +12 -0
- package/dist/lib/pdf-worker.d.ts +1 -0
- package/dist/lib/pdf-worker.js +6 -0
- package/dist/lib/pdf.d.ts +19 -0
- package/dist/lib/pdf.js +58 -0
- package/dist/lib/phone-countries.d.ts +1 -0
- package/dist/lib/phone-countries.js +281 -0
- package/dist/lib/phone.d.ts +90 -0
- package/dist/lib/phone.js +286 -0
- package/dist/lib/platform.d.ts +38 -0
- package/dist/lib/platform.js +75 -0
- package/dist/lib/room.d.ts +25 -0
- package/dist/lib/room.js +46 -0
- package/dist/lib/row-index.d.ts +15 -0
- package/dist/lib/row-index.js +136 -0
- package/dist/lib/table-fit.d.ts +143 -0
- package/dist/lib/table-fit.js +596 -0
- package/dist/lib/theme-script.d.ts +31 -0
- package/dist/lib/theme-script.js +49 -0
- package/dist/lib/tippy/pixels.d.ts +47 -0
- package/dist/lib/tippy/pixels.js +187 -0
- package/dist/lib/tippy/sprite.d.ts +86 -0
- package/dist/lib/tippy/sprite.js +753 -0
- package/dist/messages/de.d.ts +12 -0
- package/dist/messages/de.js +326 -0
- package/dist/styles/expressive.css +203 -0
- package/dist/styles/fonts.css +145 -0
- package/dist/styles/index.css +207 -0
- package/dist/styles/material.css +317 -0
- package/dist/styles/parts/ai.css +361 -0
- package/dist/styles/parts/brand.css +75 -0
- package/dist/styles/parts/controls.css +774 -0
- package/dist/styles/parts/data.css +222 -0
- package/dist/styles/parts/editorial.css +120 -0
- package/dist/styles/parts/feedback.css +340 -0
- package/dist/styles/parts/foundations.css +166 -0
- package/dist/styles/parts/graph.css +214 -0
- package/dist/styles/parts/inputs.css +261 -0
- package/dist/styles/parts/isometric.css +124 -0
- package/dist/styles/parts/navigation.css +424 -0
- package/dist/styles/parts/overlays.css +250 -0
- package/dist/styles/parts/pdf.css +154 -0
- package/dist/styles/parts/react-flow.css +519 -0
- package/dist/styles/tokens.css +299 -0
- package/dist/vite.d.ts +66 -0
- package/dist/vite.js +29 -0
- package/package.json +183 -5
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
import { cn } from "../lib/cn.js";
|
|
5
|
+
import { bracketGeometry, useDevicePixelRatio } from "../lib/logo-geometry.js";
|
|
6
|
+
/*
|
|
7
|
+
* The zon mark is the crescent from zon.sh/logo.svg: the moon less an offset circle, flat and in
|
|
8
|
+
* one colour, its opening turned 14°. It is drawn in --logo, the ink on light grounds and the
|
|
9
|
+
* light on dark ones.
|
|
10
|
+
*
|
|
11
|
+
* The brackets (LogoLeft, LogoRight) are kept as art: ../lib/logo-geometry holds their exact
|
|
12
|
+
* rectangles, snapped to whole device pixels.
|
|
13
|
+
*/
|
|
14
|
+
/** Space between the mark and the wordmark, as a fraction of the mark's height. */
|
|
15
|
+
const GAP = 0.42;
|
|
16
|
+
/** Wordmark size relative to the mark. Licht, trimmed to its x-height, centred on the moon. */
|
|
17
|
+
const WORDMARK = 1.12;
|
|
18
|
+
/**
|
|
19
|
+
* The crescent in its 32-unit canvas: the moon (radius 12, centred) less a circle of radius 9.312
|
|
20
|
+
* moved 2.812 toward the opening, so the light is 5.5 wide at its widest and the opening 30°, all
|
|
21
|
+
* turned 14°. The moon spans 4–28 on both axes, which is the mark's box.
|
|
22
|
+
*/
|
|
23
|
+
const CRESCENT = "M16.209 4.002A12 12 0 1 1 10.182 5.505A9.312 9.312 0 1 0 16.209 4.002Z";
|
|
24
|
+
const px = (n) => Math.round(n * 1000) / 1000;
|
|
25
|
+
const labelled = (label) => (label ? { role: "img", "aria-label": label } : { "aria-hidden": true });
|
|
26
|
+
/**
|
|
27
|
+
* LogoMark — the zon mark: a crescent moon, flat and in one colour, its opening turned 14°. It
|
|
28
|
+
* takes `--logo`: the ink on a light ground, the light on a dark one.
|
|
29
|
+
*
|
|
30
|
+
* `size` is the moon's height. Start at 16px and leave a quarter of its height clear around it.
|
|
31
|
+
* The rule people break: recolouring it, or rotating it further. Pass `size`; never set width and
|
|
32
|
+
* height independently.
|
|
33
|
+
*/
|
|
34
|
+
export function LogoMark({ size = 24, label, className, ...props }) {
|
|
35
|
+
return (_jsx("svg", { "data-slot": "logo-mark", xmlns: "http://www.w3.org/2000/svg", viewBox: "4 4 24 24", width: px(size), height: px(size), fill: "var(--logo)", focusable: "false", ...labelled(label), className: cn("block shrink-0", className), ...props, children: _jsx("path", { d: CRESCENT }) }));
|
|
36
|
+
}
|
|
37
|
+
function Bracket({ slot, w, h, rects, label, className, ...props }) {
|
|
38
|
+
return (_jsx("svg", { "data-slot": slot, xmlns: "http://www.w3.org/2000/svg", viewBox: `0 0 ${px(w)} ${px(h)}`, width: px(w), height: px(h), fill: "currentColor", shapeRendering: "crispEdges", focusable: "false", ...labelled(label), className: cn("block shrink-0", className), ...props, children: rects.map(([x, y, rw, rh]) => (_jsx("rect", { x: px(x), y: px(y), width: px(rw), height: px(rh) }, `${x},${y},${rw}`))) }));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* LogoLeft — the left bracket, kept as art (the Spinner's `brackets` face and the bracket
|
|
42
|
+
* illustrations draw on it). Identical in height, stroke and baseline to `LogoRight` at the same
|
|
43
|
+
* `size`, in `currentColor`.
|
|
44
|
+
*/
|
|
45
|
+
export function LogoLeft({ size = 24, ...props }) {
|
|
46
|
+
const g = bracketGeometry(size, useDevicePixelRatio());
|
|
47
|
+
return _jsx(Bracket, { slot: "logo-left", w: g.w, h: g.h, rects: g.left, ...props });
|
|
48
|
+
}
|
|
49
|
+
/** LogoRight — the right bracket, kept as art. Identical in height, stroke and baseline to `LogoLeft`. */
|
|
50
|
+
export function LogoRight({ size = 24, ...props }) {
|
|
51
|
+
const g = bracketGeometry(size, useDevicePixelRatio());
|
|
52
|
+
return _jsx(Bracket, { slot: "logo-right", w: g.w, h: g.h, rects: g.right, ...props });
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Logo — the lockup: the zon mark and the wordmark **zon** in Licht Light. With `href` it renders a
|
|
56
|
+
* link; pass `render` to use a router link instead.
|
|
57
|
+
*
|
|
58
|
+
* `variant="compact"` is the header logo: the mark only, the name sliding out on hover and focus,
|
|
59
|
+
* or while `open` is set. The name stays in the accessibility tree in both variants. With
|
|
60
|
+
* `product`, the wordmark names the product: "zon/ui".
|
|
61
|
+
* The rule people break: setting the wordmark bold, or in mono. It is Licht Light, as every headline.
|
|
62
|
+
*/
|
|
63
|
+
export function Logo({ variant = "default", size = 20, product, open = false, render, ref, className, style, ...props }) {
|
|
64
|
+
const compact = variant === "compact";
|
|
65
|
+
const vars = { "--logo-gap": `${px(size * GAP)}px`, ...style };
|
|
66
|
+
const reveal = "duration-[calc(var(--duration)*1.6)] ease-(--ease) motion-reduce:transition-none";
|
|
67
|
+
const children = (_jsxs(_Fragment, { children: [_jsx(LogoMark, { size: size }), _jsx("span", { "data-slot": "logo-wordmark-track", className: cn("grid", compact
|
|
68
|
+
? [
|
|
69
|
+
"grid-cols-[0fr] transition-[grid-template-columns,padding]",
|
|
70
|
+
"group-hover/logo:grid-cols-[1fr] group-hover/logo:ps-(--logo-gap)",
|
|
71
|
+
"group-focus-visible/logo:grid-cols-[1fr] group-focus-visible/logo:ps-(--logo-gap)",
|
|
72
|
+
"group-data-open/logo:grid-cols-[1fr] group-data-open/logo:ps-(--logo-gap)",
|
|
73
|
+
reveal,
|
|
74
|
+
]
|
|
75
|
+
: "grid-cols-[1fr] ps-(--logo-gap)"), children: _jsx("span", { className: "min-w-0 overflow-x-clip", children: _jsx("span", { "data-slot": "logo-wordmark", className: cn(
|
|
76
|
+
// Licht Light, like every headline. Trimmed to its x-height, so the lowercase
|
|
77
|
+
// letters sit centred on the moon.
|
|
78
|
+
"block font-heading leading-none font-light tracking-[-0.02em] whitespace-nowrap [text-box:trim-both_ex_alphabetic]", compact && [
|
|
79
|
+
"opacity-0 transition-opacity group-hover/logo:opacity-100 group-focus-visible/logo:opacity-100 group-data-open/logo:opacity-100",
|
|
80
|
+
reveal,
|
|
81
|
+
]), style: { fontSize: `${px(size * WORDMARK)}px` }, children: product ? `zon/${product}` : "zon" }) }) })] }));
|
|
82
|
+
return useRender({
|
|
83
|
+
defaultTagName: props.href ? "a" : "span",
|
|
84
|
+
render,
|
|
85
|
+
ref,
|
|
86
|
+
props: {
|
|
87
|
+
...props,
|
|
88
|
+
"data-slot": "logo",
|
|
89
|
+
"data-variant": variant,
|
|
90
|
+
"data-open": compact && open ? "" : undefined,
|
|
91
|
+
className: cn("group/logo inline-flex shrink-0 items-center text-foreground no-underline focus-ring select-none", className),
|
|
92
|
+
style: vars,
|
|
93
|
+
children,
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Menu as BaseMenu } from "@base-ui/react/menu";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { type MenuFrameProps } from "./_overlay.js";
|
|
4
|
+
/**
|
|
5
|
+
* Menu — a list of actions opened from a button: "Rename", "Duplicate", "Delete project".
|
|
6
|
+
* Menu material at 12px, items at 7px and 38px tall, the highlighted item raised like `SelectItem`.
|
|
7
|
+
*
|
|
8
|
+
* The rule people break: using a menu to pick a value. A menu *does* things; to choose a value
|
|
9
|
+
* use `Select` (or `MenuRadioGroup` when the choice is a view setting next to other actions).
|
|
10
|
+
*/
|
|
11
|
+
export declare function Menu(props: BaseMenu.Root.Props): React.JSX.Element;
|
|
12
|
+
/** Opens the menu. Compose with a button: `render={<Button variant="secondary" />}`. */
|
|
13
|
+
export declare function MenuTrigger({ ref, ...props }: BaseMenu.Trigger.Props): React.JSX.Element;
|
|
14
|
+
export type MenuContentProps = Omit<MenuFrameProps, "slot">;
|
|
15
|
+
/** Portal + Positioner + Popup. Opens below the trigger, aligned to its start edge. */
|
|
16
|
+
export declare function MenuContent({ align, sideOffset, ...props }: MenuContentProps): React.JSX.Element;
|
|
17
|
+
declare const itemVariants: {
|
|
18
|
+
readonly default: "";
|
|
19
|
+
/** Destructive ink for irreversible actions. Stays monochrome on the surface. */
|
|
20
|
+
readonly destructive: "text-destructive data-highlighted:text-destructive [&>svg]:text-destructive data-highlighted:[&>svg]:text-destructive";
|
|
21
|
+
};
|
|
22
|
+
export type MenuItemVariant = keyof typeof itemVariants;
|
|
23
|
+
export interface MenuItemProps extends BaseMenu.Item.Props {
|
|
24
|
+
variant?: MenuItemVariant;
|
|
25
|
+
}
|
|
26
|
+
/** One action. Put a 16px lucide icon first and a `MenuShortcut` last if it has one. */
|
|
27
|
+
export declare function MenuItem({ variant, className, ...props }: MenuItemProps): React.JSX.Element;
|
|
28
|
+
/** A menu item that is a link. Use for navigation so middle-click and "open in new tab" work. */
|
|
29
|
+
export declare function MenuLinkItem({ className, ...props }: BaseMenu.LinkItem.Props): React.JSX.Element;
|
|
30
|
+
/** A toggle inside a menu ("Show grid"). The check sits at the trailing edge, like `SelectItem`. */
|
|
31
|
+
export declare function MenuCheckboxItem({ className, children, ...props }: BaseMenu.CheckboxItem.Props): React.JSX.Element;
|
|
32
|
+
/**
|
|
33
|
+
* Groups `MenuRadioItem`s that share one value (`value` / `onValueChange`). The group draws one
|
|
34
|
+
* dot, which glides up or down to the option picked; it appears in place when the menu opens.
|
|
35
|
+
*/
|
|
36
|
+
export declare function MenuRadioGroup({ className, children, ref, ...props }: BaseMenu.RadioGroup.Props): React.JSX.Element;
|
|
37
|
+
/** One option of a `MenuRadioGroup`. The group's dot sits at the current option's trailing edge. */
|
|
38
|
+
export declare function MenuRadioItem({ className, children, ...props }: BaseMenu.RadioItem.Props): React.JSX.Element;
|
|
39
|
+
/** Groups related items so assistive tech announces them together. Label it with `MenuGroupLabel`. */
|
|
40
|
+
export declare function MenuGroup(props: BaseMenu.Group.Props): React.JSX.Element;
|
|
41
|
+
/** An eyebrow above a group: 11px mono, uppercase, tracked. */
|
|
42
|
+
export declare function MenuGroupLabel({ className, ...props }: BaseMenu.GroupLabel.Props): React.JSX.Element;
|
|
43
|
+
/** A hairline between groups of items. */
|
|
44
|
+
export declare function MenuSeparator({ className, ...props }: BaseMenu.Separator.Props): React.JSX.Element;
|
|
45
|
+
/** A keyboard hint at the trailing edge of an item: mono, muted. Decorative — wire the keys yourself. */
|
|
46
|
+
export interface MenuShortcutProps extends React.ComponentProps<"span"> {
|
|
47
|
+
/**
|
|
48
|
+
* The shortcut as keys, written for the device: `["mod", "D"]` reads ⌘D on Apple devices and
|
|
49
|
+
* Ctrl+D elsewhere, and is hidden on a touch-only phone or tablet. Or pass the text as children.
|
|
50
|
+
*/
|
|
51
|
+
keys?: string[];
|
|
52
|
+
}
|
|
53
|
+
export declare function MenuShortcut({ keys, className, children, ...props }: MenuShortcutProps): React.JSX.Element | null;
|
|
54
|
+
/** A nested menu. Holds a `MenuSubTrigger` and a `MenuSubContent`. */
|
|
55
|
+
export declare const MenuSub: typeof BaseMenu.SubmenuRoot;
|
|
56
|
+
/** The item that opens a submenu; shows a chevron and stays raised while its submenu is open. */
|
|
57
|
+
export declare function MenuSubTrigger({ className, children, ...props }: BaseMenu.SubmenuTrigger.Props): React.JSX.Element;
|
|
58
|
+
/** The submenu popup. Opens to the inline end, its first item level with the trigger. */
|
|
59
|
+
export declare function MenuSubContent({ sideOffset, alignOffset, ...props }: MenuContentProps): React.JSX.Element;
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Menu as BaseMenu } from "@base-ui/react/menu";
|
|
4
|
+
import { CheckIcon, ChevronRightIcon } from "lucide-react";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { cn, sx, triggerSlot } from "../lib/cn.js";
|
|
7
|
+
import { mergeRefs } from "../lib/merge-refs.js";
|
|
8
|
+
import { formatShortcut, useShortcutKeys } from "../lib/platform.js";
|
|
9
|
+
import { TriggerRoomContext, useTriggerRoom } from "../lib/room.js";
|
|
10
|
+
import { MenuFrame } from "./_overlay.js";
|
|
11
|
+
import { useKeyNames } from "./kbd.js";
|
|
12
|
+
/**
|
|
13
|
+
* Menu — a list of actions opened from a button: "Rename", "Duplicate", "Delete project".
|
|
14
|
+
* Menu material at 12px, items at 7px and 38px tall, the highlighted item raised like `SelectItem`.
|
|
15
|
+
*
|
|
16
|
+
* The rule people break: using a menu to pick a value. A menu *does* things; to choose a value
|
|
17
|
+
* use `Select` (or `MenuRadioGroup` when the choice is a view setting next to other actions).
|
|
18
|
+
*/
|
|
19
|
+
export function Menu(props) {
|
|
20
|
+
// The trigger registers here, so the menu and its submenus keep inside the trigger's room.
|
|
21
|
+
const room = useTriggerRoom();
|
|
22
|
+
return (_jsx(TriggerRoomContext.Provider, { value: room, children: _jsx(BaseMenu.Root, { ...props }) }));
|
|
23
|
+
}
|
|
24
|
+
/** Opens the menu. Compose with a button: `render={<Button variant="secondary" />}`. */
|
|
25
|
+
export function MenuTrigger({ ref, ...props }) {
|
|
26
|
+
const setTrigger = React.useContext(TriggerRoomContext)?.setTrigger;
|
|
27
|
+
const refs = React.useMemo(() => mergeRefs(setTrigger, ref), [setTrigger, ref]);
|
|
28
|
+
return _jsx(BaseMenu.Trigger, { ref: refs, ...triggerSlot("menu-trigger", props.render), ...props });
|
|
29
|
+
}
|
|
30
|
+
/** Portal + Positioner + Popup. Opens below the trigger, aligned to its start edge. */
|
|
31
|
+
export function MenuContent({ align = "start", sideOffset = 6, ...props }) {
|
|
32
|
+
return _jsx(MenuFrame, { slot: "menu-content", align: align, sideOffset: sideOffset, ...props });
|
|
33
|
+
}
|
|
34
|
+
/* ── Items ─────────────────────────────────────────────────────────────────── */
|
|
35
|
+
/**
|
|
36
|
+
* Shared item geometry: 38px min height, 7px radius, raised fill + inner edge when highlighted. A
|
|
37
|
+
* word too long for the menu (a URL, a file name) breaks instead of running under the check.
|
|
38
|
+
*/
|
|
39
|
+
const menuItemClass = cn("relative flex min-h-(--control-h) cursor-pointer items-center gap-2.5 rounded-item border border-transparent px-2.5 text-sm [overflow-wrap:anywhere] text-foreground-soft outline-none select-none", "data-highlighted:border-control-inner-edge data-highlighted:bg-control-hover data-highlighted:text-foreground data-highlighted:shadow-highlight", "data-disabled:pointer-events-none data-disabled:opacity-50", "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&>svg]:text-muted-foreground data-highlighted:[&>svg]:text-foreground");
|
|
40
|
+
const itemVariants = {
|
|
41
|
+
default: "",
|
|
42
|
+
/** Destructive ink for irreversible actions. Stays monochrome on the surface. */
|
|
43
|
+
destructive: "text-destructive data-highlighted:text-destructive [&>svg]:text-destructive data-highlighted:[&>svg]:text-destructive",
|
|
44
|
+
};
|
|
45
|
+
/** One action. Put a 16px lucide icon first and a `MenuShortcut` last if it has one. */
|
|
46
|
+
export function MenuItem({ variant = "default", className, ...props }) {
|
|
47
|
+
return (_jsx(BaseMenu.Item, { "data-slot": "menu-item", "data-variant": variant, className: sx([menuItemClass, itemVariants[variant]], className), ...props }));
|
|
48
|
+
}
|
|
49
|
+
/** A menu item that is a link. Use for navigation so middle-click and "open in new tab" work. */
|
|
50
|
+
export function MenuLinkItem({ className, ...props }) {
|
|
51
|
+
return _jsx(BaseMenu.LinkItem, { "data-slot": "menu-link-item", className: sx(menuItemClass, className), ...props });
|
|
52
|
+
}
|
|
53
|
+
/** A toggle inside a menu ("Show grid"). The check sits at the trailing edge, like `SelectItem`. */
|
|
54
|
+
export function MenuCheckboxItem({ className, children, ...props }) {
|
|
55
|
+
return (_jsxs(BaseMenu.CheckboxItem, { "data-slot": "menu-checkbox-item", className: sx([menuItemClass, "pe-2"], className), ...props, children: [_jsx("span", { className: "flex min-w-0 flex-1 items-center gap-2.5", children: children }), _jsx(BaseMenu.CheckboxItemIndicator, { "data-slot": "menu-checkbox-indicator", className: "flex text-foreground", children: _jsx(CheckIcon, { className: "size-4" }) })] }));
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Groups `MenuRadioItem`s that share one value (`value` / `onValueChange`). The group draws one
|
|
59
|
+
* dot, which glides up or down to the option picked; it appears in place when the menu opens.
|
|
60
|
+
*/
|
|
61
|
+
export function MenuRadioGroup({ className, children, ref, ...props }) {
|
|
62
|
+
const own = React.useRef(null);
|
|
63
|
+
const refs = React.useMemo(() => mergeRefs(own, ref), [ref]);
|
|
64
|
+
const [dot, setDot] = React.useState(null);
|
|
65
|
+
React.useLayoutEffect(() => {
|
|
66
|
+
const group = own.current;
|
|
67
|
+
if (!group)
|
|
68
|
+
return;
|
|
69
|
+
const place = () => {
|
|
70
|
+
// Any checked option: a menubar re-slots its items, the mark stays the same.
|
|
71
|
+
const mark = group.querySelector('[data-checked] > [data-slot="menu-radio-mark"]');
|
|
72
|
+
// A kept-mounted menu that is closed has nothing to measure: no dot until it shows, and then
|
|
73
|
+
// the dot lands in place.
|
|
74
|
+
if (!mark || !group.offsetParent)
|
|
75
|
+
return setDot(null);
|
|
76
|
+
// Layout offsets, not client rects: the popup opens with a scale (popup-motion), and a rect
|
|
77
|
+
// measured mid-open would put the dot off sideways. Offsets ignore transforms, so x stays put
|
|
78
|
+
// and only y moves between options.
|
|
79
|
+
let x = mark.offsetWidth / 2;
|
|
80
|
+
let y = mark.offsetHeight / 2;
|
|
81
|
+
for (let el = mark; el && el !== group; el = el.offsetParent) {
|
|
82
|
+
x += el.offsetLeft;
|
|
83
|
+
y += el.offsetTop;
|
|
84
|
+
}
|
|
85
|
+
// The first placement lands in place; later ones glide.
|
|
86
|
+
setDot((prev) => (prev && prev.x === x && prev.y === y ? prev : { x, y, glide: prev != null }));
|
|
87
|
+
};
|
|
88
|
+
place();
|
|
89
|
+
// A pick changes the items' data-checked; uncontrolled groups re-render only inside Base UI.
|
|
90
|
+
const observer = new MutationObserver(place);
|
|
91
|
+
observer.observe(group, { subtree: true, attributeFilter: ["data-checked"] });
|
|
92
|
+
// The menu showing, or options added or removed, resizes the group.
|
|
93
|
+
const resize = new ResizeObserver(place);
|
|
94
|
+
resize.observe(group);
|
|
95
|
+
return () => {
|
|
96
|
+
observer.disconnect();
|
|
97
|
+
resize.disconnect();
|
|
98
|
+
};
|
|
99
|
+
}, []);
|
|
100
|
+
return (_jsxs(BaseMenu.RadioGroup, { ref: refs, "data-slot": "menu-radio-group", className: sx("relative", className), ...props, children: [children, dot && (_jsx("span", { "aria-hidden": true, "data-slot": "menu-radio-dot", className: cn("pointer-events-none absolute top-0 left-0 -mt-[3px] -ml-[3px] size-1.5 rounded-full bg-foreground", dot.glide && "transition-transform duration-[calc(var(--duration)*1.6)] ease-(--ease)"), style: { transform: `translate(${dot.x}px, ${dot.y}px)` } }))] }));
|
|
101
|
+
}
|
|
102
|
+
/** One option of a `MenuRadioGroup`. The group's dot sits at the current option's trailing edge. */
|
|
103
|
+
export function MenuRadioItem({ className, children, ...props }) {
|
|
104
|
+
return (_jsxs(BaseMenu.RadioItem, { "data-slot": "menu-radio-item", className: sx([menuItemClass, "pe-2"], className), ...props, children: [_jsx("span", { className: "flex min-w-0 flex-1 items-center gap-2.5", children: children }), _jsx("span", { "data-slot": "menu-radio-mark", "aria-hidden": true, className: "flex size-4 shrink-0" })] }));
|
|
105
|
+
}
|
|
106
|
+
/** Groups related items so assistive tech announces them together. Label it with `MenuGroupLabel`. */
|
|
107
|
+
export function MenuGroup(props) {
|
|
108
|
+
return _jsx(BaseMenu.Group, { "data-slot": "menu-group", ...props });
|
|
109
|
+
}
|
|
110
|
+
/** An eyebrow above a group: 11px mono, uppercase, tracked. */
|
|
111
|
+
export function MenuGroupLabel({ className, ...props }) {
|
|
112
|
+
return (_jsx(BaseMenu.GroupLabel, { "data-slot": "menu-group-label", className: sx("px-2.5 pt-2.5 pb-1.5 eyebrow text-[11px] [overflow-wrap:anywhere] select-none", className), ...props }));
|
|
113
|
+
}
|
|
114
|
+
/** A hairline between groups of items. */
|
|
115
|
+
export function MenuSeparator({ className, ...props }) {
|
|
116
|
+
return (_jsx(BaseMenu.Separator, { "data-slot": "menu-separator", className: sx("-mx-1 my-1 h-px bg-border", className), ...props }));
|
|
117
|
+
}
|
|
118
|
+
export function MenuShortcut({ keys, className, children, ...props }) {
|
|
119
|
+
const { mod, hasKeyboard } = useShortcutKeys();
|
|
120
|
+
const names = useKeyNames();
|
|
121
|
+
if (keys && !hasKeyboard)
|
|
122
|
+
return null;
|
|
123
|
+
return (_jsx("span", { "data-slot": "menu-shortcut", "aria-hidden": true, className: cn(
|
|
124
|
+
// Its own text decides its direction: ⌘D stays ⌘D in a right-to-left menu.
|
|
125
|
+
"ms-auto ps-4 font-mono text-xs tracking-normal whitespace-nowrap text-muted-foreground [unicode-bidi:plaintext]", className), ...props, children: keys ? formatShortcut(keys, mod, names) : children }));
|
|
126
|
+
}
|
|
127
|
+
/* ── Submenus ──────────────────────────────────────────────────────────────── */
|
|
128
|
+
/** A nested menu. Holds a `MenuSubTrigger` and a `MenuSubContent`. */
|
|
129
|
+
export const MenuSub = BaseMenu.SubmenuRoot;
|
|
130
|
+
/** The item that opens a submenu; shows a chevron and stays raised while its submenu is open. */
|
|
131
|
+
export function MenuSubTrigger({ className, children, ...props }) {
|
|
132
|
+
return (_jsxs(BaseMenu.SubmenuTrigger, { "data-slot": "menu-sub-trigger", className: sx([
|
|
133
|
+
menuItemClass,
|
|
134
|
+
"pe-2 data-popup-open:border-control-inner-edge data-popup-open:bg-control-hover data-popup-open:text-foreground",
|
|
135
|
+
], className), ...props, children: [children, _jsx(ChevronRightIcon, { "aria-hidden": true, className: "ms-auto size-4 text-muted-foreground rtl:rotate-180" })] }));
|
|
136
|
+
}
|
|
137
|
+
/** The submenu popup. Opens to the inline end, its first item level with the trigger. */
|
|
138
|
+
export function MenuSubContent({ sideOffset = 2, alignOffset = -5, ...props }) {
|
|
139
|
+
return _jsx(MenuFrame, { slot: "menu-sub-content", sideOffset: sideOffset, alignOffset: alignOffset, ...props });
|
|
140
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Menu as BaseMenu } from "@base-ui/react/menu";
|
|
2
|
+
import { Menubar as BaseMenubar } from "@base-ui/react/menubar";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Menu, type MenuContentProps, type MenuItemProps, type MenuShortcutProps } from "./menu.js";
|
|
5
|
+
/**
|
|
6
|
+
* Menubar — the application menu bar of a desktop-style tool: "File", "Edit", "View".
|
|
7
|
+
*
|
|
8
|
+
* A dense 38px bar on the region material (12px corners) holding 30px triggers that are flat at
|
|
9
|
+
* rest; hover brightens a label. The open menu's trigger is raised by one highlight that glides
|
|
10
|
+
* along the bar as you move between menus. Once one menu is open, moving the pointer or the arrow keys across the bar opens its
|
|
11
|
+
* neighbours, and one shared menu surface glides and resizes from the old menu to the new one
|
|
12
|
+
* while the new items fade in — the way `NavigationMenu` moves between panels. The menus are the
|
|
13
|
+
* `Menu` popup and items, unchanged.
|
|
14
|
+
*
|
|
15
|
+
* The rule people break: putting a menubar on a marketing or content page. It belongs to
|
|
16
|
+
* editors and dashboards; site navigation is `SiteHeader` or `NavigationMenu`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function Menubar({ className, children, ref, ...props }: MenubarProps): React.JSX.Element;
|
|
19
|
+
export interface MenubarProps extends BaseMenubar.Props {
|
|
20
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* One menu in the bar. Holds a `MenubarTrigger` and a `MenubarContent`. The `Menu` root, so its
|
|
24
|
+
* popup and submenus keep inside the trigger's room.
|
|
25
|
+
*/
|
|
26
|
+
export declare const MenubarMenu: typeof Menu;
|
|
27
|
+
/**
|
|
28
|
+
* The bar button that opens a menu: 30px, 13px Licht Sans, 7px corners. Flat at rest and hover only
|
|
29
|
+
* brightens its label; while its menu is open the bar's gliding highlight raises it, so the open
|
|
30
|
+
* menu always points back to its trigger.
|
|
31
|
+
*/
|
|
32
|
+
export declare function MenubarTrigger({ className, ref, ...props }: BaseMenu.Trigger.Props): React.JSX.Element;
|
|
33
|
+
export type MenubarContentProps = MenuContentProps;
|
|
34
|
+
/**
|
|
35
|
+
* Portal + Positioner + Popup: the `Menu` popup, opening below the bar (to the inline end in a
|
|
36
|
+
* vertical bar), aligned to the trigger's start edge.
|
|
37
|
+
*/
|
|
38
|
+
export declare function MenubarContent({ align, sideOffset, ...props }: MenubarContentProps): React.JSX.Element;
|
|
39
|
+
/** One action. Same as `MenuItem`: a 16px icon first, a `MenubarShortcut` last. */
|
|
40
|
+
export declare function MenubarItem(props: MenuItemProps): React.JSX.Element;
|
|
41
|
+
/** An item that is a real link. Same as `MenuLinkItem`. */
|
|
42
|
+
export declare function MenubarLinkItem(props: BaseMenu.LinkItem.Props): React.JSX.Element;
|
|
43
|
+
/** A toggle ("Show rulers") with its check at the trailing edge. Same as `MenuCheckboxItem`. */
|
|
44
|
+
export declare function MenubarCheckboxItem(props: BaseMenu.CheckboxItem.Props): React.JSX.Element;
|
|
45
|
+
/** Groups `MenubarRadioItem`s that share one value. Same as `MenuRadioGroup`. */
|
|
46
|
+
export declare function MenubarRadioGroup(props: BaseMenu.RadioGroup.Props): React.JSX.Element;
|
|
47
|
+
/** One option of a `MenubarRadioGroup`. Same as `MenuRadioItem`. */
|
|
48
|
+
export declare function MenubarRadioItem(props: BaseMenu.RadioItem.Props): React.JSX.Element;
|
|
49
|
+
/** Groups related items. Label it with `MenubarGroupLabel`. */
|
|
50
|
+
export declare function MenubarGroup(props: BaseMenu.Group.Props): React.JSX.Element;
|
|
51
|
+
/** The mono eyebrow above a group. Same as `MenuGroupLabel`. */
|
|
52
|
+
export declare function MenubarGroupLabel(props: BaseMenu.GroupLabel.Props): React.JSX.Element;
|
|
53
|
+
/** A hairline between groups of items. */
|
|
54
|
+
export declare function MenubarSeparator(props: BaseMenu.Separator.Props): React.JSX.Element;
|
|
55
|
+
/** A mono keyboard hint at the trailing edge of an item. Decorative — wire the keys yourself. */
|
|
56
|
+
export declare function MenubarShortcut(props: MenuShortcutProps): React.JSX.Element;
|
|
57
|
+
/** A nested menu inside a menubar menu. Holds a `MenubarSubTrigger` and a `MenubarSubContent`. */
|
|
58
|
+
export declare const MenubarSub: typeof BaseMenu.SubmenuRoot;
|
|
59
|
+
/** The item that opens a submenu. Same as `MenuSubTrigger`. */
|
|
60
|
+
export declare function MenubarSubTrigger(props: BaseMenu.SubmenuTrigger.Props): React.JSX.Element;
|
|
61
|
+
/** The submenu popup. Same as `MenuSubContent`. */
|
|
62
|
+
export declare function MenubarSubContent(props: MenuContentProps): React.JSX.Element;
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Menu as BaseMenu } from "@base-ui/react/menu";
|
|
4
|
+
import { Menubar as BaseMenubar } from "@base-ui/react/menubar";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { createPortal } from "react-dom";
|
|
7
|
+
import { cn, sx, triggerSlot } from "../lib/cn.js";
|
|
8
|
+
import { cssDuration } from "../lib/motion.js";
|
|
9
|
+
import { glideMotion, glideStyle, useGlide, useMergedRef } from "../lib/glide.js";
|
|
10
|
+
import { mergeRefs } from "../lib/merge-refs.js";
|
|
11
|
+
import { TriggerRoomContext } from "../lib/room.js";
|
|
12
|
+
import { MenuFrame } from "./_overlay.js";
|
|
13
|
+
import { Menu, MenuCheckboxItem, MenuGroup, MenuGroupLabel, MenuItem, MenuLinkItem, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuShortcut, MenuSubContent, MenuSubTrigger, } from "./menu.js";
|
|
14
|
+
/**
|
|
15
|
+
* Menubar — the application menu bar of a desktop-style tool: "File", "Edit", "View".
|
|
16
|
+
*
|
|
17
|
+
* A dense 38px bar on the region material (12px corners) holding 30px triggers that are flat at
|
|
18
|
+
* rest; hover brightens a label. The open menu's trigger is raised by one highlight that glides
|
|
19
|
+
* along the bar as you move between menus. Once one menu is open, moving the pointer or the arrow keys across the bar opens its
|
|
20
|
+
* neighbours, and one shared menu surface glides and resizes from the old menu to the new one
|
|
21
|
+
* while the new items fade in — the way `NavigationMenu` moves between panels. The menus are the
|
|
22
|
+
* `Menu` popup and items, unchanged.
|
|
23
|
+
*
|
|
24
|
+
* The rule people break: putting a menubar on a marketing or content page. It belongs to
|
|
25
|
+
* editors and dashboards; site navigation is `SiteHeader` or `NavigationMenu`.
|
|
26
|
+
*/
|
|
27
|
+
export function Menubar({ className, children, ref, ...props }) {
|
|
28
|
+
const [rootRef, setRootRef] = useMergedRef(ref);
|
|
29
|
+
const glide = useGlide(rootRef, findOpen, {
|
|
30
|
+
attributes: ["data-popup-open"],
|
|
31
|
+
items: TRIGGER,
|
|
32
|
+
linger: 140,
|
|
33
|
+
});
|
|
34
|
+
const [surfaceRef, surface] = useMenuSurface();
|
|
35
|
+
const [mounted, setMounted] = React.useState(false);
|
|
36
|
+
React.useEffect(() => setMounted(true), []);
|
|
37
|
+
return (_jsxs(MenubarSurfaceContext.Provider, { value: surface, children: [_jsxs(BaseMenubar, { ref: setRootRef, "data-slot": "menubar", "data-glide": glide.visible ? "" : undefined, className: sx("group/menubar relative inline-flex w-fit items-center gap-0.5 rounded-button p-[3px] surface-container data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch", className), ...props, children: [_jsx("span", { "aria-hidden": true, "data-slot": "menubar-indicator", "data-visible": glide.visible ? "" : undefined, "data-instant": glide.instant ? "" : undefined, className: cn(glideMotion, "rounded-item border border-transparent bg-control-hover bg-linear-to-b from-control-inner-edge to-transparent shadow-raised"), style: glideStyle(glide) }), children] }), mounted &&
|
|
38
|
+
createPortal(_jsx("div", { ref: surfaceRef, "aria-hidden": true, "data-slot": "menubar-surface", className: "pointer-events-none fixed top-0 left-0 z-49 rounded-button material-menu opacity-0 transition-opacity duration-(--duration) ease-brand data-switching:transition-[opacity,translate,width,height] data-switching:duration-[var(--duration),calc(var(--duration)*2),calc(var(--duration)*2),calc(var(--duration)*2)] data-visible:opacity-100" }), document.body)] }));
|
|
39
|
+
}
|
|
40
|
+
const TRIGGER = '[data-slot="menubar-trigger"]';
|
|
41
|
+
/** The highlight marks the open menu only; hover alone just brightens a trigger's label. */
|
|
42
|
+
const findOpen = (root) => root.querySelector(`${TRIGGER}[data-popup-open]`);
|
|
43
|
+
/** How long the surface waits for the next menu before it fades (ms). */
|
|
44
|
+
const HOLD = 90;
|
|
45
|
+
const MenubarSurfaceContext = React.createContext(null);
|
|
46
|
+
/**
|
|
47
|
+
* The bar's menus share one surface, like NavigationMenu's viewport. Each menubar popup drops its
|
|
48
|
+
* own material (`data-surface`) and this fixed element, carrying the menu material, follows the
|
|
49
|
+
* open popup every frame. Opening and closing it simply tracks the popup's own motion; moving to a
|
|
50
|
+
* neighbouring menu turns on `data-switching`, so position and size glide over 2 × --duration —
|
|
51
|
+
* CSS transitions start from wherever they are, which keeps quick back-and-forth smooth — while
|
|
52
|
+
* the new items fade in. Reduced motion sets --duration to 0, so it jumps.
|
|
53
|
+
*/
|
|
54
|
+
function useMenuSurface() {
|
|
55
|
+
const surfaceRef = React.useRef(null);
|
|
56
|
+
const controller = React.useMemo(() => {
|
|
57
|
+
let active = null;
|
|
58
|
+
const popups = new Set();
|
|
59
|
+
let lostAt = 0;
|
|
60
|
+
let frame = 0;
|
|
61
|
+
let settle = 0;
|
|
62
|
+
const follow = () => {
|
|
63
|
+
frame = 0;
|
|
64
|
+
const surface = surfaceRef.current;
|
|
65
|
+
if (!surface)
|
|
66
|
+
return;
|
|
67
|
+
if (!active || !active.isConnected || active.hasAttribute("data-ending-style")) {
|
|
68
|
+
// Moving fast, the old menu can leave a frame or two before the next arrives: hold the
|
|
69
|
+
// surface briefly so the next menu glides from here instead of snapping in.
|
|
70
|
+
if (active && surface.hasAttribute("data-visible")) {
|
|
71
|
+
lostAt ||= performance.now();
|
|
72
|
+
if (performance.now() - lostAt < HOLD) {
|
|
73
|
+
frame = requestAnimationFrame(follow);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
lostAt = 0;
|
|
78
|
+
surface.removeAttribute("data-visible");
|
|
79
|
+
if (active?.isConnected)
|
|
80
|
+
frame = requestAnimationFrame(follow);
|
|
81
|
+
else
|
|
82
|
+
active = null;
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
lostAt = 0;
|
|
86
|
+
const r = active.getBoundingClientRect();
|
|
87
|
+
surface.style.translate = `${r.left}px ${r.top}px`;
|
|
88
|
+
surface.style.width = `${r.width}px`;
|
|
89
|
+
surface.style.height = `${r.height}px`;
|
|
90
|
+
surface.setAttribute("data-visible", "");
|
|
91
|
+
frame = requestAnimationFrame(follow);
|
|
92
|
+
};
|
|
93
|
+
return {
|
|
94
|
+
open(popup) {
|
|
95
|
+
const surface = surfaceRef.current;
|
|
96
|
+
popup.setAttribute("data-surface", "");
|
|
97
|
+
// Refs re-attach on re-render: the same popup again changes nothing.
|
|
98
|
+
if (popup === active) {
|
|
99
|
+
if (!frame)
|
|
100
|
+
frame = requestAnimationFrame(follow);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const switching = !!surface?.hasAttribute("data-visible") && !!active && active !== popup;
|
|
104
|
+
// Only the newest menu shows its items. The others may still be fading out on the
|
|
105
|
+
// transparent surface; moving fast, their text would overlap the new menu's.
|
|
106
|
+
for (const other of popups) {
|
|
107
|
+
if (!other.isConnected)
|
|
108
|
+
popups.delete(other);
|
|
109
|
+
else if (other !== popup)
|
|
110
|
+
other.style.visibility = "hidden";
|
|
111
|
+
}
|
|
112
|
+
popups.add(popup);
|
|
113
|
+
popup.style.visibility = "";
|
|
114
|
+
active = popup;
|
|
115
|
+
lostAt = 0;
|
|
116
|
+
if (surface && switching) {
|
|
117
|
+
const duration = cssDuration(surface) * 2;
|
|
118
|
+
surface.setAttribute("data-switching", "");
|
|
119
|
+
clearTimeout(settle);
|
|
120
|
+
settle = window.setTimeout(() => surface.removeAttribute("data-switching"), duration + 60);
|
|
121
|
+
if (duration > 0) {
|
|
122
|
+
popup.animate([{ opacity: 0 }, { opacity: 1 }], {
|
|
123
|
+
duration: duration * 0.6,
|
|
124
|
+
delay: duration * 0.15,
|
|
125
|
+
easing: "ease-out",
|
|
126
|
+
fill: "backwards",
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
// Base UI positions the popup in a layout effect after it mounts: measure from the next frame.
|
|
131
|
+
if (!frame)
|
|
132
|
+
frame = requestAnimationFrame(follow);
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
}, []);
|
|
136
|
+
return [surfaceRef, controller];
|
|
137
|
+
}
|
|
138
|
+
/** Hands a menubar popup to the bar's shared surface while it is mounted. */
|
|
139
|
+
function useSurfacePopup() {
|
|
140
|
+
const surface = React.useContext(MenubarSurfaceContext);
|
|
141
|
+
return React.useCallback((node) => {
|
|
142
|
+
if (surface && node)
|
|
143
|
+
surface.open(node);
|
|
144
|
+
}, [surface]);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* One menu in the bar. Holds a `MenubarTrigger` and a `MenubarContent`. The `Menu` root, so its
|
|
148
|
+
* popup and submenus keep inside the trigger's room.
|
|
149
|
+
*/
|
|
150
|
+
export const MenubarMenu = Menu;
|
|
151
|
+
/**
|
|
152
|
+
* The bar button that opens a menu: 30px, 13px Licht Sans, 7px corners. Flat at rest and hover only
|
|
153
|
+
* brightens its label; while its menu is open the bar's gliding highlight raises it, so the open
|
|
154
|
+
* menu always points back to its trigger.
|
|
155
|
+
*/
|
|
156
|
+
export function MenubarTrigger({ className, ref, ...props }) {
|
|
157
|
+
const setTrigger = React.useContext(TriggerRoomContext)?.setTrigger;
|
|
158
|
+
const refs = React.useMemo(() => mergeRefs(setTrigger, ref), [setTrigger, ref]);
|
|
159
|
+
return (_jsx(BaseMenu.Trigger, { ref: refs, "data-slot": "menubar-trigger", className: sx([
|
|
160
|
+
"relative inline-flex min-h-(--control-h-sm) shrink-0 cursor-pointer items-center gap-1.5 rounded-item border border-transparent px-3 font-body text-[13px] leading-none whitespace-nowrap text-foreground-soft focus-ring transition-colors duration-(--duration) ease-brand select-none",
|
|
161
|
+
"hover:text-foreground data-popup-open:text-foreground",
|
|
162
|
+
// Until the bar's highlight has measured, the open trigger raises itself.
|
|
163
|
+
"data-popup-open:bg-control-hover data-popup-open:bg-linear-to-b data-popup-open:from-control-inner-edge data-popup-open:to-transparent data-popup-open:shadow-raised",
|
|
164
|
+
"group-data-glide/menubar:data-popup-open:bg-transparent group-data-glide/menubar:data-popup-open:bg-none group-data-glide/menubar:data-popup-open:shadow-none",
|
|
165
|
+
"data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
166
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
167
|
+
], className), ...props }));
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Portal + Positioner + Popup: the `Menu` popup, opening below the bar (to the inline end in a
|
|
171
|
+
* vertical bar), aligned to the trigger's start edge.
|
|
172
|
+
*/
|
|
173
|
+
export function MenubarContent({ align = "start", sideOffset = 8, ...props }) {
|
|
174
|
+
const surfaceRef = useSurfacePopup();
|
|
175
|
+
return (_jsx(MenuFrame, { ref: surfaceRef, slot: "menubar-content", align: align, sideOffset: sideOffset, ...props }));
|
|
176
|
+
}
|
|
177
|
+
/* ── Items: the Menu items, re-slotted so a menubar is addressable on its own ── */
|
|
178
|
+
/** One action. Same as `MenuItem`: a 16px icon first, a `MenubarShortcut` last. */
|
|
179
|
+
export function MenubarItem(props) {
|
|
180
|
+
return _jsx(MenuItem, { "data-slot": "menubar-item", ...props });
|
|
181
|
+
}
|
|
182
|
+
/** An item that is a real link. Same as `MenuLinkItem`. */
|
|
183
|
+
export function MenubarLinkItem(props) {
|
|
184
|
+
return _jsx(MenuLinkItem, { "data-slot": "menubar-link-item", ...props });
|
|
185
|
+
}
|
|
186
|
+
/** A toggle ("Show rulers") with its check at the trailing edge. Same as `MenuCheckboxItem`. */
|
|
187
|
+
export function MenubarCheckboxItem(props) {
|
|
188
|
+
return _jsx(MenuCheckboxItem, { "data-slot": "menubar-checkbox-item", ...props });
|
|
189
|
+
}
|
|
190
|
+
/** Groups `MenubarRadioItem`s that share one value. Same as `MenuRadioGroup`. */
|
|
191
|
+
export function MenubarRadioGroup(props) {
|
|
192
|
+
return _jsx(MenuRadioGroup, { "data-slot": "menubar-radio-group", ...props });
|
|
193
|
+
}
|
|
194
|
+
/** One option of a `MenubarRadioGroup`. Same as `MenuRadioItem`. */
|
|
195
|
+
export function MenubarRadioItem(props) {
|
|
196
|
+
return _jsx(MenuRadioItem, { "data-slot": "menubar-radio-item", ...props });
|
|
197
|
+
}
|
|
198
|
+
/** Groups related items. Label it with `MenubarGroupLabel`. */
|
|
199
|
+
export function MenubarGroup(props) {
|
|
200
|
+
return _jsx(MenuGroup, { "data-slot": "menubar-group", ...props });
|
|
201
|
+
}
|
|
202
|
+
/** The mono eyebrow above a group. Same as `MenuGroupLabel`. */
|
|
203
|
+
export function MenubarGroupLabel(props) {
|
|
204
|
+
return _jsx(MenuGroupLabel, { "data-slot": "menubar-group-label", ...props });
|
|
205
|
+
}
|
|
206
|
+
/** A hairline between groups of items. */
|
|
207
|
+
export function MenubarSeparator(props) {
|
|
208
|
+
return _jsx(MenuSeparator, { "data-slot": "menubar-separator", ...props });
|
|
209
|
+
}
|
|
210
|
+
/** A mono keyboard hint at the trailing edge of an item. Decorative — wire the keys yourself. */
|
|
211
|
+
export function MenubarShortcut(props) {
|
|
212
|
+
return _jsx(MenuShortcut, { "data-slot": "menubar-shortcut", ...props });
|
|
213
|
+
}
|
|
214
|
+
/** A nested menu inside a menubar menu. Holds a `MenubarSubTrigger` and a `MenubarSubContent`. */
|
|
215
|
+
export const MenubarSub = BaseMenu.SubmenuRoot;
|
|
216
|
+
/** The item that opens a submenu. Same as `MenuSubTrigger`. */
|
|
217
|
+
export function MenubarSubTrigger(props) {
|
|
218
|
+
return _jsx(MenuSubTrigger, { ...triggerSlot("menubar-sub-trigger", props.render), ...props });
|
|
219
|
+
}
|
|
220
|
+
/** The submenu popup. Same as `MenuSubContent`. */
|
|
221
|
+
export function MenubarSubContent(props) {
|
|
222
|
+
return _jsx(MenuSubContent, { "data-slot": "menubar-sub-content", ...props });
|
|
223
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type AvatarProps } from "./avatar.js";
|
|
3
|
+
import { type ButtonProps } from "./button.js";
|
|
4
|
+
/** Who wrote a message. */
|
|
5
|
+
export type MessageFrom = "user" | "assistant";
|
|
6
|
+
export interface MessageProps extends React.ComponentProps<"div"> {
|
|
7
|
+
from: MessageFrom;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Message — one turn in an AI conversation. A **user** message sits at the end — on the right,
|
|
11
|
+
* on the left in a right-to-left page — in a 20px card, sized to its text; an **assistant**
|
|
12
|
+
* message runs full width on the page, with no bubble, so long answers read like a document.
|
|
13
|
+
*
|
|
14
|
+
* Compose `MessageAvatar` (optional), `MessageContent` and `MessageActions`. The rule people
|
|
15
|
+
* break: putting the assistant in a bubble too — the reply is the content, not a quote.
|
|
16
|
+
*/
|
|
17
|
+
export declare function Message({ from, className, ...props }: MessageProps): React.JSX.Element;
|
|
18
|
+
/**
|
|
19
|
+
* The author's picture: an `Avatar` (a name gives mono initials), or any 32px mark as children —
|
|
20
|
+
* the assistant is often a `LogoMark` on a raised key.
|
|
21
|
+
*/
|
|
22
|
+
export declare function MessageAvatar({ className, children, ...props }: AvatarProps & {
|
|
23
|
+
children?: React.ReactNode;
|
|
24
|
+
}): React.JSX.Element;
|
|
25
|
+
/**
|
|
26
|
+
* The message body and, below it, its actions. User text sits in a card at most 80% wide;
|
|
27
|
+
* assistant content takes the full width (put a `Response` in it for markdown).
|
|
28
|
+
*/
|
|
29
|
+
export declare function MessageContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
30
|
+
/**
|
|
31
|
+
* Plain message text, kept as written: line breaks stay, long words wrap. In a user message it
|
|
32
|
+
* is the card; in an assistant message it is a paragraph.
|
|
33
|
+
*/
|
|
34
|
+
export declare function MessageText({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
35
|
+
/** A row of `MessageAction`s under the content: copy, retry, rate. */
|
|
36
|
+
export declare function MessageActions({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
37
|
+
export interface MessageActionProps extends Omit<ButtonProps, "variant" | "size"> {
|
|
38
|
+
/** The action's name: the tooltip and the accessible name. */
|
|
39
|
+
label: string;
|
|
40
|
+
}
|
|
41
|
+
/** One action under a message: a 30px ghost icon button with a tooltip. */
|
|
42
|
+
export declare function MessageAction({ label, className, children, ...props }: MessageActionProps): React.JSX.Element;
|