@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,130 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Button as BaseButton } from "@base-ui/react/button";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { sx } from "../lib/cn.js";
|
|
6
|
+
import { useCollapsible } from "../lib/collapse-row.js";
|
|
7
|
+
import { mergeRefs } from "../lib/merge-refs.js";
|
|
8
|
+
/* The raised material fills a trigger whose popup is open; a disabled button explaining itself with
|
|
9
|
+
a tooltip stays at rest instead. */
|
|
10
|
+
const variants = {
|
|
11
|
+
/** The layered primary. One per view — the action that carries the page. */
|
|
12
|
+
primary: "material-primary",
|
|
13
|
+
/** Raised quiet surface. Every other action. */
|
|
14
|
+
secondary: "material-raised data-disabled:data-popup-open:bg-control-surface",
|
|
15
|
+
/** Flat until hovered, then raised. Toolbars and dense rows. */
|
|
16
|
+
ghost: "material-row",
|
|
17
|
+
/** Inline text action with the brand underline. */
|
|
18
|
+
link: "link h-auto min-h-0 rounded-none px-0 font-normal",
|
|
19
|
+
/** Raised surface with destructive ink. Use only for irreversible actions. */
|
|
20
|
+
destructive: "material-raised text-destructive data-disabled:data-popup-open:bg-control-surface",
|
|
21
|
+
};
|
|
22
|
+
const sizes = {
|
|
23
|
+
sm: "min-h-(--control-h-sm) gap-1.5 px-3 text-[13px]",
|
|
24
|
+
default: "min-h-(--control-h) gap-2 px-4 text-sm",
|
|
25
|
+
lg: "min-h-(--control-h-lg) gap-2 px-5 text-[15px]",
|
|
26
|
+
icon: "size-(--icon-button) rounded-full p-0",
|
|
27
|
+
"icon-sm": "size-(--control-h-sm) rounded-full p-0",
|
|
28
|
+
};
|
|
29
|
+
/*
|
|
30
|
+
* A collapsible button carries the icon–label gap inside its label (--button-gap), so nothing
|
|
31
|
+
* of it is left once the label folds away. Folded, its padding and corners make a circle as
|
|
32
|
+
* tall as the button (parts/controls.css), moving on the material's --material-motion slot.
|
|
33
|
+
*/
|
|
34
|
+
const collapsibleGaps = {
|
|
35
|
+
sm: "[--button-gap:--spacing(1.5)]",
|
|
36
|
+
default: "[--button-gap:--spacing(2)]",
|
|
37
|
+
lg: "[--button-gap:--spacing(2)]",
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* For `expandable="icon"`: icons (and other elements) go into a column that opens on hover; the
|
|
41
|
+
* text stays as it is.
|
|
42
|
+
*/
|
|
43
|
+
function withIcon(children) {
|
|
44
|
+
const parts = React.Children.toArray(children);
|
|
45
|
+
const firstText = parts.findIndex((part) => typeof part === "string" || typeof part === "number");
|
|
46
|
+
return parts.map((part, index) => typeof part === "string" || typeof part === "number" ? (part) : (_jsx("span", { "data-slot": "button-icon", "data-before-label": firstText === -1 || index < firstText ? "" : undefined, children: _jsx("span", { children: part }) }, index)));
|
|
47
|
+
}
|
|
48
|
+
const isText = (part) => typeof part === "string" || typeof part === "number";
|
|
49
|
+
/**
|
|
50
|
+
* Text children (a run of them, as `Save {count} items`) become one label that ends in "…" when
|
|
51
|
+
* the button is narrower than it; it stays the accessible name in full. Icons, a Kbd and other
|
|
52
|
+
* elements stay as they are, at their size. White space between elements is left out, as a flex
|
|
53
|
+
* row leaves it out.
|
|
54
|
+
*/
|
|
55
|
+
function withText(children) {
|
|
56
|
+
const parts = React.Children.toArray(children);
|
|
57
|
+
if (!parts.some(isText))
|
|
58
|
+
return children;
|
|
59
|
+
const out = [];
|
|
60
|
+
let run = "";
|
|
61
|
+
const flush = () => {
|
|
62
|
+
if (run.trim())
|
|
63
|
+
out.push(_jsx("span", { "data-slot": "button-text", className: "min-w-0 overflow-x-clip text-ellipsis", children: run }, `text-${out.length}`));
|
|
64
|
+
run = "";
|
|
65
|
+
};
|
|
66
|
+
for (const part of parts) {
|
|
67
|
+
if (isText(part))
|
|
68
|
+
run += part;
|
|
69
|
+
else {
|
|
70
|
+
flush();
|
|
71
|
+
out.push(part);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
flush();
|
|
75
|
+
return out;
|
|
76
|
+
}
|
|
77
|
+
/** Text children become the label that folds away; icons and other elements stay as they are. */
|
|
78
|
+
function withLabel(children) {
|
|
79
|
+
const parts = React.Children.toArray(children);
|
|
80
|
+
const iconFirst = parts.findIndex((part) => React.isValidElement(part)) <
|
|
81
|
+
parts.findIndex((part) => typeof part === "string" || typeof part === "number");
|
|
82
|
+
return parts.map((part, index) => typeof part === "string" || typeof part === "number" ? (_jsx("span", { "data-slot": "button-label", "data-after-icon": iconFirst ? "" : undefined, children: _jsx("span", { children: part }) }, index)) : (part));
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Button — Base UI `Button` in the zon material.
|
|
86
|
+
*
|
|
87
|
+
* Heights come from `min-height`, never padding: 30 dense · 38 default · 46 prominent.
|
|
88
|
+
* Icon sizes are circular and must have an `aria-label`. `collapsible` lets a button with an
|
|
89
|
+
* icon and a label fold to a round icon button when its row is too tight; `expandable` rests
|
|
90
|
+
* as that icon button and unfolds on hover or focus.
|
|
91
|
+
* Use `render={<a href="…" />}` with `nativeButton={false}` for links styled as buttons.
|
|
92
|
+
*/
|
|
93
|
+
export function Button({ variant = "primary", size = "default", collapsible = false, expandable = false, className, children, ref, ...props }) {
|
|
94
|
+
const own = React.useRef(null);
|
|
95
|
+
const foldable = size !== "icon" && size !== "icon-sm";
|
|
96
|
+
const expands = !foldable || !expandable ? null : expandable === "icon" ? "icon" : "label";
|
|
97
|
+
const canExpand = expands === "label";
|
|
98
|
+
const canCollapse = collapsible && foldable && !expands;
|
|
99
|
+
const { collapsed, ready } = useCollapsible(own, canCollapse);
|
|
100
|
+
// An expandable button rests folded; hover and focus unfold it in CSS (parts/controls.css).
|
|
101
|
+
const folds = canCollapse || canExpand || expands === "icon";
|
|
102
|
+
const labelled = foldable && !folds && React.Children.toArray(children).some(isText);
|
|
103
|
+
const refs = React.useMemo(() => mergeRefs(own, ref), [ref]);
|
|
104
|
+
// A link drawn as a button stays a link: Base UI gives every non-<button> element
|
|
105
|
+
// role="button", which would announce navigation as an action.
|
|
106
|
+
const link = React.isValidElement(props.render) && props.render.type === "a" && !("role" in props);
|
|
107
|
+
return (_jsx(BaseButton, { ...(link ? { role: undefined } : {}), "data-slot": "button", "data-variant": variant, "data-size": size, "data-collapsible": canCollapse ? "" : undefined, "data-collapsed": collapsed || canExpand ? "" : undefined, "data-expandable": expands ?? undefined, "data-collapse-instant": canCollapse && !ready ? "" : undefined, ref: refs, className: sx([
|
|
108
|
+
"inline-flex cursor-pointer items-center justify-center rounded-button font-body leading-none font-medium whitespace-nowrap focus-ring select-none",
|
|
109
|
+
// Only a natively disabled button ignores the pointer. One that stays focusable while
|
|
110
|
+
// disabled (`focusableWhenDisabled`, a link) still takes hover, so a tooltip can say
|
|
111
|
+
// why; Base UI keeps its clicks inert.
|
|
112
|
+
"disabled:pointer-events-none data-disabled:cursor-not-allowed data-disabled:opacity-50",
|
|
113
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
114
|
+
// A button with a text label never grows past its container: the text ends in "…"
|
|
115
|
+
// instead (withText). In a row it keeps its full width while a neighbour can give way —
|
|
116
|
+
// a title that wraps, a field — and is cut only when its label alone is wider than the
|
|
117
|
+
// row; add `min-w-0` to let it shrink with its neighbours. An icon button (or a square
|
|
118
|
+
// segment holding only an icon) keeps its size, and a folding one its width, since it
|
|
119
|
+
// folds instead (lib/collapse-row).
|
|
120
|
+
labelled ? "max-w-full" : "shrink-0",
|
|
121
|
+
sizes[size],
|
|
122
|
+
folds && [
|
|
123
|
+
"gap-0 data-collapse-instant:transition-none!",
|
|
124
|
+
// The fold's padding and corners; an expandable button waits out its hover intent first.
|
|
125
|
+
"[--material-motion:padding_calc(var(--duration)*2)_var(--ease)_var(--expand-delay,0s),border-radius_calc(var(--duration)*2)_var(--ease)_var(--expand-delay,0s)]",
|
|
126
|
+
collapsibleGaps[size],
|
|
127
|
+
],
|
|
128
|
+
variants[variant],
|
|
129
|
+
], className), ...props, children: expands === "icon" ? withIcon(children) : folds ? withLabel(children) : withText(children) }));
|
|
130
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { DayPicker } from "react-day-picker";
|
|
3
|
+
export type { DateRange, DayPickerLocale as CalendarLocale, Matcher as CalendarMatcher, } from "react-day-picker";
|
|
4
|
+
export type CalendarProps = React.ComponentProps<typeof DayPicker> & {
|
|
5
|
+
/**
|
|
6
|
+
* How the month and year dropdowns of `captionLayout="dropdown"` are drawn. `native` (the
|
|
7
|
+
* default) is a dense `NativeSelect`: the platform's own picker, best on phones. `custom` is
|
|
8
|
+
* our `Select`: a menu-material popup that opens on the current value, matching the page.
|
|
9
|
+
*/
|
|
10
|
+
dropdown?: "native" | "custom";
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Calendar — react-day-picker v10 in the zon material. The month caption is set in Licht,
|
|
14
|
+
* weekdays are 11px mono eyebrows and days are 38px cells with 7px corners and Licht Sans tabular
|
|
15
|
+
* figures. Hovering a day lifts it like a row; the selected day takes the layered primary
|
|
16
|
+
* fill; a range's middle days sit on the hover fill with their inner corners collapsed.
|
|
17
|
+
*
|
|
18
|
+
* Supports `mode="single" | "multiple" | "range"`, `captionLayout="dropdown"` (with
|
|
19
|
+
* `dropdown="native" | "custom"` for a `NativeSelect` or our `Select`), `locale`
|
|
20
|
+
* (pass a locale from `react-day-picker/locale` for translated labels) and `weekStartsOn`.
|
|
21
|
+
* Inside a right-to-left `DirectionProvider` it runs right to left — the grid, the arrows and the
|
|
22
|
+
* arrow keys — also in a DatePicker's popover, which is rendered outside the page's `dir`.
|
|
23
|
+
* The rule people break: using a calendar to enter a date of birth — type it in an `Input`,
|
|
24
|
+
* or at least use `captionLayout="dropdown"` so nobody clicks back forty years.
|
|
25
|
+
*/
|
|
26
|
+
export declare function Calendar({ showOutsideDays, className, classNames, components, dropdown, dir, formatters, labels, ...props }: CalendarProps): React.JSX.Element;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useDirection } from "@base-ui/react/direction-provider";
|
|
4
|
+
import { Field as BaseField } from "@base-ui/react/field";
|
|
5
|
+
import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon } from "lucide-react";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { DateLib, DayPicker, getDefaultClassNames, labelDayButton, } from "react-day-picker";
|
|
8
|
+
import { cn } from "../lib/cn.js";
|
|
9
|
+
import { NativeSelect } from "./native-select.js";
|
|
10
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./select.js";
|
|
11
|
+
/** The root's classes go through `className`, so a consumer's `className` can override them. */
|
|
12
|
+
const rootClassName = "relative w-fit p-3 font-body text-foreground";
|
|
13
|
+
/** Our classes per DayPicker part. Day and day-button states live in `styles/parts/inputs.css`. */
|
|
14
|
+
const calendarClassNames = {
|
|
15
|
+
// Months sit side by side while they fit the room the calendar has, and stack top-down when
|
|
16
|
+
// they do not — in a phone, a side panel or a narrow column alike, not only on narrow screens.
|
|
17
|
+
months: "relative flex flex-wrap justify-center gap-6",
|
|
18
|
+
month: "relative flex flex-col gap-2",
|
|
19
|
+
nav: "pointer-events-none absolute inset-x-0 top-0 z-10 flex h-(--control-h) items-center justify-between",
|
|
20
|
+
// The arrows travel with their months (navLayout "around"): previous on the first month's
|
|
21
|
+
// caption, next on the last one's, so stacked months keep each arrow beside its month.
|
|
22
|
+
button_previous: "pointer-events-auto absolute start-0 top-1 z-10 inline-flex size-(--control-h-sm) cursor-pointer items-center justify-center rounded-full material-row text-muted-foreground focus-ring aria-disabled:pointer-events-none aria-disabled:opacity-40",
|
|
23
|
+
button_next: "pointer-events-auto absolute end-0 top-1 z-10 inline-flex size-(--control-h-sm) cursor-pointer items-center justify-center rounded-full material-row text-muted-foreground focus-ring aria-disabled:pointer-events-none aria-disabled:opacity-40",
|
|
24
|
+
chevron: "size-4",
|
|
25
|
+
month_caption: "flex h-(--control-h) items-center justify-center px-8",
|
|
26
|
+
caption_label: "font-heading text-xl leading-none font-light tracking-[-0.02em] text-foreground select-none",
|
|
27
|
+
dropdowns: "flex items-center justify-center gap-1.5",
|
|
28
|
+
month_grid: "border-separate border-spacing-x-0 border-spacing-y-0.5",
|
|
29
|
+
weekdays: "",
|
|
30
|
+
// Tracked capitals suit scripts with letter case. The others (Arabic, Hebrew, Persian, CJK …)
|
|
31
|
+
// keep their own letters, untracked: tracking pulls joined letters apart.
|
|
32
|
+
weekday: "h-8 w-(--control-h) p-0 text-center align-middle font-mono text-[11px] leading-none font-normal tracking-[0.12em] text-muted-foreground uppercase select-none data-caseless:tracking-normal data-caseless:normal-case",
|
|
33
|
+
week_number_header: "h-8 w-8 p-0",
|
|
34
|
+
week_number: "w-8 p-0 text-center align-middle font-mono text-[11px] text-muted-foreground tabular-nums select-none",
|
|
35
|
+
week: "",
|
|
36
|
+
day: "",
|
|
37
|
+
day_button: "",
|
|
38
|
+
footer: "pt-3 text-[13px] leading-normal text-muted-foreground",
|
|
39
|
+
};
|
|
40
|
+
function mergeClassNames(custom) {
|
|
41
|
+
const defaults = getDefaultClassNames();
|
|
42
|
+
const merged = {};
|
|
43
|
+
for (const key of Object.keys(defaults)) {
|
|
44
|
+
merged[key] = key === "root" ? defaults.root : cn(defaults[key], calendarClassNames[key], custom?.[key]);
|
|
45
|
+
}
|
|
46
|
+
return merged;
|
|
47
|
+
}
|
|
48
|
+
function CalendarRoot({ rootRef, className, ...props }) {
|
|
49
|
+
return _jsx("div", { ref: rootRef, "data-slot": "calendar", className: className, ...props });
|
|
50
|
+
}
|
|
51
|
+
function CalendarChevron({ orientation = "left", className, size: _size, disabled: _disabled, ...props }) {
|
|
52
|
+
const Icon = orientation === "left"
|
|
53
|
+
? ChevronLeftIcon
|
|
54
|
+
: orientation === "right"
|
|
55
|
+
? ChevronRightIcon
|
|
56
|
+
: orientation === "up"
|
|
57
|
+
? ChevronUpIcon
|
|
58
|
+
: ChevronDownIcon;
|
|
59
|
+
return _jsx(Icon, { "aria-hidden": true, className: cn("size-4", className), ...props });
|
|
60
|
+
}
|
|
61
|
+
/** Weekday names in a script with letter case: Latin, Greek, Cyrillic, Armenian. */
|
|
62
|
+
const CASED_SCRIPT = /[\p{Script=Latin}\p{Script=Greek}\p{Script=Cyrillic}\p{Script=Armenian}]/u;
|
|
63
|
+
/** A weekday header tells the calendar that its name doesn't fit the column. */
|
|
64
|
+
const WeekdayTooWideContext = React.createContext(null);
|
|
65
|
+
/** The narrow weekday names ("S", "ح"): for a column too narrow for the short ones ("Su", "أحد"). */
|
|
66
|
+
function formatNarrowWeekday(weekday, options, dateLib) {
|
|
67
|
+
return (dateLib ?? new DateLib(options)).format(weekday, "ccccc");
|
|
68
|
+
}
|
|
69
|
+
function CalendarWeekday({ children, ...props }) {
|
|
70
|
+
const ref = React.useRef(null);
|
|
71
|
+
const tooWide = React.useContext(WeekdayTooWideContext);
|
|
72
|
+
const text = typeof children === "string" ? children : "";
|
|
73
|
+
React.useLayoutEffect(() => {
|
|
74
|
+
const th = ref.current;
|
|
75
|
+
if (!th || !tooWide || !text)
|
|
76
|
+
return;
|
|
77
|
+
const measure = () => {
|
|
78
|
+
const column = th.getBoundingClientRect().width;
|
|
79
|
+
// Not laid out yet (a hidden tab, a closed popover kept mounted): measured once it is.
|
|
80
|
+
if (!column)
|
|
81
|
+
return false;
|
|
82
|
+
const range = document.createRange();
|
|
83
|
+
range.selectNodeContents(th);
|
|
84
|
+
// A name wider than its column widens it: it fits when it leaves 2px or more either side.
|
|
85
|
+
if (range.getBoundingClientRect().width > column - 4)
|
|
86
|
+
tooWide();
|
|
87
|
+
return true;
|
|
88
|
+
};
|
|
89
|
+
if (measure())
|
|
90
|
+
return;
|
|
91
|
+
const observer = new ResizeObserver(() => {
|
|
92
|
+
if (measure())
|
|
93
|
+
observer.disconnect();
|
|
94
|
+
});
|
|
95
|
+
observer.observe(th);
|
|
96
|
+
return () => observer.disconnect();
|
|
97
|
+
}, [text, tooWide]);
|
|
98
|
+
return (_jsx("th", { ref: ref, "data-caseless": (text && !CASED_SCRIPT.test(text)) || undefined, ...props, children: children }));
|
|
99
|
+
}
|
|
100
|
+
function CalendarDay({ day: _day, modifiers, className, ...props }) {
|
|
101
|
+
return (_jsx("td", { "data-slot": "calendar-day", "data-range-start": modifiers.range_start || undefined, "data-range-middle": modifiers.range_middle || undefined, "data-range-end": modifiers.range_end || undefined, className: className, ...props }));
|
|
102
|
+
}
|
|
103
|
+
function CalendarDayButton({ day: _day, modifiers, className, ...props }) {
|
|
104
|
+
const ref = React.useRef(null);
|
|
105
|
+
React.useEffect(() => {
|
|
106
|
+
if (modifiers.focused)
|
|
107
|
+
ref.current?.focus();
|
|
108
|
+
}, [modifiers.focused]);
|
|
109
|
+
const inRange = modifiers.range_start || modifiers.range_middle || modifiers.range_end;
|
|
110
|
+
return (_jsx("button", { ref: ref, "data-slot": "calendar-day-button", "data-selected-single": (modifiers.selected && !inRange) || undefined, "data-range-start": modifiers.range_start || undefined, "data-range-middle": modifiers.range_middle || undefined, "data-range-end": modifiers.range_end || undefined, "data-today": modifiers.today || undefined, "data-outside": modifiers.outside || undefined, "data-disabled": modifiers.disabled || undefined, className: className, ...props }));
|
|
111
|
+
}
|
|
112
|
+
/** Month and year dropdowns: our `NativeSelect` at 30px, isolated from any surrounding `Field`. */
|
|
113
|
+
function CalendarNativeDropdown({ options, className, size: _size, ...props }) {
|
|
114
|
+
return (_jsx(BaseField.Root, { "data-slot": "calendar-dropdown", className: "flex", children: _jsx(NativeSelect, { size: "sm", wrapperClassName: "w-auto", className: className, ...props, children: options?.map((option) => (_jsx("option", { value: option.value, disabled: option.disabled, children: option.label }, option.value))) }) }));
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Month and year dropdowns as our `Select` at 30px, isolated from any surrounding `Field`.
|
|
118
|
+
* DayPicker hands us a `<select>` change handler, so a picked value is passed back in the
|
|
119
|
+
* shape it reads (`event.target.value`).
|
|
120
|
+
*/
|
|
121
|
+
function CalendarSelectDropdown({ options = [], value, onChange, disabled, className, "aria-label": ariaLabel, }) {
|
|
122
|
+
const items = React.useMemo(() => options.map((option) => ({ value: String(option.value), label: option.label })), [options]);
|
|
123
|
+
return (_jsx(BaseField.Root, { "data-slot": "calendar-dropdown", className: "flex", children: _jsxs(Select, { items: items, value: value === undefined ? null : String(value), disabled: disabled, onValueChange: (next) => {
|
|
124
|
+
if (next == null)
|
|
125
|
+
return;
|
|
126
|
+
onChange?.({ target: { value: next } });
|
|
127
|
+
}, children: [_jsx(SelectTrigger, { size: "sm", "aria-label": ariaLabel, className: cn("w-auto min-w-0 tabular-nums", className), children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { positioner: { alignItemWithTrigger: true }, children: options.map((option) => (_jsx(SelectItem, { value: String(option.value), disabled: option.disabled, className: "tabular-nums", children: option.label }, option.value))) })] }) }));
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* A day's name with its number as the grid draws it — "Friday, October 16, 2026", not "16th" — so
|
|
131
|
+
* the "16" on the button is part of what it is called, for voice control (WCAG 2.5.3). Wraps the
|
|
132
|
+
* locale's own label, translated "Today" and "selected" included.
|
|
133
|
+
*/
|
|
134
|
+
function plainDayNumber(locale) {
|
|
135
|
+
const own = locale?.labels?.labelDayButton;
|
|
136
|
+
const label = typeof own === "function" ? own : typeof own === "string" ? () => own : labelDayButton;
|
|
137
|
+
return (date, modifiers, options, dateLib) => {
|
|
138
|
+
const text = label(date, modifiers, options, dateLib);
|
|
139
|
+
const day = String(date.getDate());
|
|
140
|
+
return text.replace(new RegExp(`\\b${day}(?:st|nd|rd|th)\\b`), day);
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Calendar — react-day-picker v10 in the zon material. The month caption is set in Licht,
|
|
145
|
+
* weekdays are 11px mono eyebrows and days are 38px cells with 7px corners and Licht Sans tabular
|
|
146
|
+
* figures. Hovering a day lifts it like a row; the selected day takes the layered primary
|
|
147
|
+
* fill; a range's middle days sit on the hover fill with their inner corners collapsed.
|
|
148
|
+
*
|
|
149
|
+
* Supports `mode="single" | "multiple" | "range"`, `captionLayout="dropdown"` (with
|
|
150
|
+
* `dropdown="native" | "custom"` for a `NativeSelect` or our `Select`), `locale`
|
|
151
|
+
* (pass a locale from `react-day-picker/locale` for translated labels) and `weekStartsOn`.
|
|
152
|
+
* Inside a right-to-left `DirectionProvider` it runs right to left — the grid, the arrows and the
|
|
153
|
+
* arrow keys — also in a DatePicker's popover, which is rendered outside the page's `dir`.
|
|
154
|
+
* The rule people break: using a calendar to enter a date of birth — type it in an `Input`,
|
|
155
|
+
* or at least use `captionLayout="dropdown"` so nobody clicks back forty years.
|
|
156
|
+
*/
|
|
157
|
+
export function Calendar({ showOutsideDays = true, className, classNames, components, dropdown = "native", dir, formatters, labels, ...props }) {
|
|
158
|
+
const direction = useDirection();
|
|
159
|
+
const dayLabel = React.useMemo(() => plainDayNumber(props.locale), [props.locale]);
|
|
160
|
+
/*
|
|
161
|
+
* Weekday names too wide for their column — Arabic's short names are whole words — give way to
|
|
162
|
+
* the narrow ones, per locale. Measured before the first paint; your own weekday formatter is
|
|
163
|
+
* left alone.
|
|
164
|
+
*/
|
|
165
|
+
const localeCode = props.locale?.code ?? "";
|
|
166
|
+
const [narrowFor, setNarrowFor] = React.useState(null);
|
|
167
|
+
const ownFormatter = !!formatters?.formatWeekdayName;
|
|
168
|
+
const tooWide = React.useCallback(() => setNarrowFor(localeCode), [localeCode]);
|
|
169
|
+
const narrow = narrowFor === localeCode && !ownFormatter;
|
|
170
|
+
return (_jsx(WeekdayTooWideContext.Provider, { value: ownFormatter ? null : tooWide, children: _jsx(DayPicker, { navLayout: "around", dir: dir ?? (direction === "rtl" ? "rtl" : undefined), showOutsideDays: showOutsideDays, className: cn(rootClassName, classNames?.root, className), classNames: mergeClassNames(classNames), formatters: narrow ? { ...formatters, formatWeekdayName: formatNarrowWeekday } : formatters, labels: { ...labels, labelDayButton: labels?.labelDayButton ?? dayLabel }, components: {
|
|
171
|
+
Root: CalendarRoot,
|
|
172
|
+
Chevron: CalendarChevron,
|
|
173
|
+
Day: CalendarDay,
|
|
174
|
+
DayButton: CalendarDayButton,
|
|
175
|
+
Weekday: CalendarWeekday,
|
|
176
|
+
Dropdown: dropdown === "custom" ? CalendarSelectDropdown : CalendarNativeDropdown,
|
|
177
|
+
...components,
|
|
178
|
+
}, ...props }) }));
|
|
179
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
declare const cardVariants: {
|
|
4
|
+
/** An object on the page: the card material, 20px corners, the system's only drop shadow. */
|
|
5
|
+
readonly default: "surface-card";
|
|
6
|
+
/** A part of the page: the same material, square, no shadow, the card's padding. */
|
|
7
|
+
readonly square: "rounded-none surface-container p-[var(--card-padding,24px)] sm:p-[var(--card-padding,32px)] md:p-[var(--card-padding,40px)]";
|
|
8
|
+
/** No box: no border, no ground, no shadow — a top hairline and whitespace. */
|
|
9
|
+
readonly plain: "border-t border-border/60 pt-6 pb-8";
|
|
10
|
+
};
|
|
11
|
+
export type CardVariant = keyof typeof cardVariants;
|
|
12
|
+
export interface CardProps extends useRender.ComponentProps<"div"> {
|
|
13
|
+
/**
|
|
14
|
+
* `default`: an object, a 20px card with the soft shadow. `square`: a part of the page, the same
|
|
15
|
+
* material with square corners and no shadow. `plain`: no box at all, a top hairline and space.
|
|
16
|
+
*/
|
|
17
|
+
variant?: CardVariant;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Card — a group of content in one of three kinds. `default` is an **object** sitting *on* the
|
|
21
|
+
* page (a quote, a pricing option, a form panel): `surface-card` material, 20px radius, the
|
|
22
|
+
* system's only drop shadow, and responsive 24/32/40px padding that belongs to the card — never
|
|
23
|
+
* pad it at the call site. `square` is a **part of** the page (a section panel, a specimen sheet,
|
|
24
|
+
* a cover): the same material, square, no shadow. `plain` is **no box**: a top hairline and
|
|
25
|
+
* whitespace, for features, steps and principles laid out in a grid.
|
|
26
|
+
*
|
|
27
|
+
* Could it be picked up and moved somewhere else on its own? Yes → `default`. No → `square`.
|
|
28
|
+
* Would a rule and whitespace do? → `plain`, before either. The rule people break: wrapping
|
|
29
|
+
* content in a card because it feels tidier, or rounding a part of the page.
|
|
30
|
+
*/
|
|
31
|
+
export declare function Card({ variant, render, ref, className, ...props }: CardProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
32
|
+
/** Title + description stack at the top of a card. */
|
|
33
|
+
export declare function CardHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
34
|
+
/** The card's heading, in Licht. Renders an `<h3>`; use `render` for another level. */
|
|
35
|
+
export declare function CardTitle({ render, ref, className, ...props }: useRender.ComponentProps<"h3">): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
36
|
+
/** Supporting copy under the title. */
|
|
37
|
+
export declare function CardDescription({ className, ...props }: React.ComponentProps<"p">): React.JSX.Element;
|
|
38
|
+
/** The card's body. */
|
|
39
|
+
export declare function CardContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
40
|
+
/** Actions or meta at the bottom of a card. One primary at most. */
|
|
41
|
+
export declare function CardFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { cn } from "../lib/cn.js";
|
|
6
|
+
/*
|
|
7
|
+
* Which kind? Ask first whether a hairline rule and whitespace would do: that is `plain`. Then
|
|
8
|
+
* whether the thing could be picked up and moved somewhere else on its own — a quote, a pricing
|
|
9
|
+
* option, a form panel: that is a card, `default` (20px, the one soft drop shadow). A section
|
|
10
|
+
* panel, a specimen sheet, a page cover could not: it is part of the page, `square` (no radius,
|
|
11
|
+
* no shadow). When unsure, prefer square — and before either, plain. Boxing every group
|
|
12
|
+
* flattens the hierarchy.
|
|
13
|
+
*/
|
|
14
|
+
const cardVariants = {
|
|
15
|
+
/** An object on the page: the card material, 20px corners, the system's only drop shadow. */
|
|
16
|
+
default: "surface-card",
|
|
17
|
+
/** A part of the page: the same material, square, no shadow, the card's padding. */
|
|
18
|
+
square: "rounded-none surface-container p-[var(--card-padding,24px)] sm:p-[var(--card-padding,32px)] md:p-[var(--card-padding,40px)]",
|
|
19
|
+
/** No box: no border, no ground, no shadow — a top hairline and whitespace. */
|
|
20
|
+
plain: "border-t border-border/60 pt-6 pb-8",
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Card — a group of content in one of three kinds. `default` is an **object** sitting *on* the
|
|
24
|
+
* page (a quote, a pricing option, a form panel): `surface-card` material, 20px radius, the
|
|
25
|
+
* system's only drop shadow, and responsive 24/32/40px padding that belongs to the card — never
|
|
26
|
+
* pad it at the call site. `square` is a **part of** the page (a section panel, a specimen sheet,
|
|
27
|
+
* a cover): the same material, square, no shadow. `plain` is **no box**: a top hairline and
|
|
28
|
+
* whitespace, for features, steps and principles laid out in a grid.
|
|
29
|
+
*
|
|
30
|
+
* Could it be picked up and moved somewhere else on its own? Yes → `default`. No → `square`.
|
|
31
|
+
* Would a rule and whitespace do? → `plain`, before either. The rule people break: wrapping
|
|
32
|
+
* content in a card because it feels tidier, or rounding a part of the page.
|
|
33
|
+
*/
|
|
34
|
+
export function Card({ variant = "default", render, ref, className, ...props }) {
|
|
35
|
+
return useRender({
|
|
36
|
+
defaultTagName: "div",
|
|
37
|
+
render,
|
|
38
|
+
ref,
|
|
39
|
+
props: {
|
|
40
|
+
"data-slot": "card",
|
|
41
|
+
"data-variant": variant,
|
|
42
|
+
...props,
|
|
43
|
+
className: cn("flex flex-col gap-6 text-card-foreground", cardVariants[variant], className),
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/** Title + description stack at the top of a card. */
|
|
48
|
+
export function CardHeader({ className, ...props }) {
|
|
49
|
+
return _jsx("div", { "data-slot": "card-header", className: cn("flex flex-col gap-2", className), ...props });
|
|
50
|
+
}
|
|
51
|
+
/** The card's heading, in Licht. Renders an `<h3>`; use `render` for another level. */
|
|
52
|
+
export function CardTitle({ render, ref, className, ...props }) {
|
|
53
|
+
return useRender({
|
|
54
|
+
defaultTagName: "h3",
|
|
55
|
+
render,
|
|
56
|
+
ref,
|
|
57
|
+
props: {
|
|
58
|
+
"data-slot": "card-title",
|
|
59
|
+
...props,
|
|
60
|
+
// A long word with no break (a name, a URL) wraps instead of running past the card.
|
|
61
|
+
className: cn("m-0 display text-[24px] leading-[1.1] [overflow-wrap:anywhere] text-foreground sm:text-[28px]", className),
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/** Supporting copy under the title. */
|
|
66
|
+
export function CardDescription({ className, ...props }) {
|
|
67
|
+
return (_jsx("p", { "data-slot": "card-description", className: cn("m-0 text-[15px] leading-relaxed [overflow-wrap:anywhere] text-muted-foreground", className), ...props }));
|
|
68
|
+
}
|
|
69
|
+
/** The card's body. */
|
|
70
|
+
export function CardContent({ className, ...props }) {
|
|
71
|
+
return (_jsx("div", { "data-slot": "card-content", className: cn("text-[15px] leading-relaxed text-foreground-soft", className), ...props }));
|
|
72
|
+
}
|
|
73
|
+
/** Actions or meta at the bottom of a card. One primary at most. */
|
|
74
|
+
export function CardFooter({ className, ...props }) {
|
|
75
|
+
return (_jsx("div", { "data-slot": "card-footer", className: cn("mt-auto flex flex-wrap items-center gap-3", className), ...props }));
|
|
76
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import useEmblaCarousel, { type UseEmblaCarouselType } from "embla-carousel-react";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { type ButtonProps } from "./button.js";
|
|
4
|
+
export interface CarouselMessages {
|
|
5
|
+
/** What screen readers call the carousel region. */
|
|
6
|
+
carousel: string;
|
|
7
|
+
/** What screen readers call each slide. */
|
|
8
|
+
slide: string;
|
|
9
|
+
previous: string;
|
|
10
|
+
next: string;
|
|
11
|
+
/** Each tick of `CarouselDots`, by its 1-based slide number. */
|
|
12
|
+
goTo: (slide: number, total: number) => string;
|
|
13
|
+
/** Read between the numbers of the "01 / 07" index: "1 of 7". */
|
|
14
|
+
of: string;
|
|
15
|
+
}
|
|
16
|
+
declare module "./locale" {
|
|
17
|
+
interface Messages {
|
|
18
|
+
carousel: CarouselMessages;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** The Embla instance, for `setApi` and `useCarousel().api`. */
|
|
22
|
+
export type CarouselApi = UseEmblaCarouselType[1];
|
|
23
|
+
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
|
|
24
|
+
/** Embla options (`align`, `loop`, `slidesToScroll`, `dragFree`, `startIndex` …). */
|
|
25
|
+
export type CarouselOptions = UseCarouselParameters[0];
|
|
26
|
+
/** Embla plugins (autoplay, class names, wheel gestures …). */
|
|
27
|
+
export type CarouselPlugin = UseCarouselParameters[1];
|
|
28
|
+
export type CarouselOrientation = "horizontal" | "vertical";
|
|
29
|
+
interface CarouselContextValue {
|
|
30
|
+
carouselRef: ReturnType<typeof useEmblaCarousel>[0];
|
|
31
|
+
api: CarouselApi;
|
|
32
|
+
orientation: CarouselOrientation;
|
|
33
|
+
/** Index of the selected snap (0-based). */
|
|
34
|
+
selectedIndex: number;
|
|
35
|
+
/** Number of snaps — the number of positions, not always the number of slides. */
|
|
36
|
+
snapCount: number;
|
|
37
|
+
canScrollPrev: boolean;
|
|
38
|
+
canScrollNext: boolean;
|
|
39
|
+
scrollPrev: () => void;
|
|
40
|
+
scrollNext: () => void;
|
|
41
|
+
scrollTo: (index: number) => void;
|
|
42
|
+
/** True under `prefers-reduced-motion`: every programmatic scroll jumps instead of gliding. */
|
|
43
|
+
reducedMotion: boolean;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* useCarousel — the carousel's state and controls, for building your own counter or buttons
|
|
47
|
+
* inside a `Carousel`: `selectedIndex`, `snapCount`, `canScrollPrev`, `scrollNext()`, `api` …
|
|
48
|
+
*/
|
|
49
|
+
export declare function useCarousel(): CarouselContextValue;
|
|
50
|
+
export interface CarouselProps extends React.ComponentProps<"div"> {
|
|
51
|
+
/** `horizontal` slides left/right; `vertical` slides up/down and needs a height on `CarouselContent`. */
|
|
52
|
+
orientation?: CarouselOrientation;
|
|
53
|
+
/** Embla options. `loop: true` wraps from the last slide to the first. */
|
|
54
|
+
opts?: CarouselOptions;
|
|
55
|
+
/** Embla plugins. */
|
|
56
|
+
plugins?: CarouselPlugin;
|
|
57
|
+
/** Receives the Embla instance once it is ready. */
|
|
58
|
+
setApi?: (api: CarouselApi) => void;
|
|
59
|
+
/** Accessible name of the carousel region, e.g. "Spec sheets". */
|
|
60
|
+
"aria-label"?: string;
|
|
61
|
+
/** The words its parts read out; a LocaleProvider sets them for every Carousel. */
|
|
62
|
+
labels?: Partial<CarouselMessages>;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Carousel — a row of slides moved one at a time: a wall of spec sheets, a series of
|
|
66
|
+
* illustrations, the steps of a short walkthrough. Built on Embla: drag, swipe, loop and
|
|
67
|
+
* arrow keys work out of the box; under reduced motion every move is instant.
|
|
68
|
+
*
|
|
69
|
+
* Controls are the brand's, not generic dots: `CarouselPrevious` / `CarouselNext` are circular
|
|
70
|
+
* secondary icon buttons and `CarouselDots` is a rail of hairline ticks (or a mono "01 / 07").
|
|
71
|
+
* Place them yourself — usually on one row under the slides.
|
|
72
|
+
*
|
|
73
|
+
* The rule people break: hiding content people need inside it. A carousel shows one thing at a
|
|
74
|
+
* time; anything that must be compared or read in full belongs on the page as a grid or list.
|
|
75
|
+
*/
|
|
76
|
+
export declare function Carousel({ orientation, opts, plugins, setApi, className, children, onKeyDownCapture, labels, ...props }: CarouselProps): React.JSX.Element;
|
|
77
|
+
export interface CarouselContentProps extends React.ComponentProps<"div"> {
|
|
78
|
+
/** Class for the clipping viewport (set a height here for a vertical carousel). */
|
|
79
|
+
viewportClassName?: string;
|
|
80
|
+
}
|
|
81
|
+
/** The clipping viewport and the moving track. Slides go inside as `CarouselItem`s. */
|
|
82
|
+
export declare function CarouselContent({ viewportClassName, className, ...props }: CarouselContentProps): React.JSX.Element;
|
|
83
|
+
/**
|
|
84
|
+
* One slide. Full width by default; set a basis for several per view (`basis-1/2`, `md:basis-1/3`).
|
|
85
|
+
* The 16px gutter between slides is built in.
|
|
86
|
+
*/
|
|
87
|
+
export declare function CarouselItem({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
88
|
+
export interface CarouselButtonProps extends ButtonProps {
|
|
89
|
+
}
|
|
90
|
+
/** The previous button: a circular secondary icon button. Disabled at the first slide unless looping. */
|
|
91
|
+
export declare function CarouselPrevious({ variant, size, className, children, onClick, ...props }: CarouselButtonProps): React.JSX.Element;
|
|
92
|
+
/** The next button: a circular secondary icon button. Disabled at the last slide unless looping. */
|
|
93
|
+
export declare function CarouselNext({ variant, size, className, children, onClick, ...props }: CarouselButtonProps): React.JSX.Element;
|
|
94
|
+
export interface CarouselDotsProps extends React.ComponentProps<"div"> {
|
|
95
|
+
/**
|
|
96
|
+
* `ticks` — a rail of hairline ticks like `ProcessSteps`; the current one is long and in
|
|
97
|
+
* foreground ink, and every tick is a button. `index` — a mono "01 / 07" counter.
|
|
98
|
+
*/
|
|
99
|
+
variant?: "ticks" | "index";
|
|
100
|
+
/** Accessible name for the tick buttons; receives the 1-based slide number. Default: `labels.goTo`. */
|
|
101
|
+
getLabel?: (slide: number, total: number) => string;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Where you are in the carousel, in the brand's vocabulary: hairline ticks (each one jumps to its
|
|
105
|
+
* slide) or a mono "01 / 07" index. Never round dots. The long tick moves with the slides, so a
|
|
106
|
+
* drag or a glide hands it from one tick to the next rather than switching it at the start.
|
|
107
|
+
*/
|
|
108
|
+
export declare function CarouselDots({ variant, getLabel: getLabelProp, className, ...props }: CarouselDotsProps): React.JSX.Element;
|
|
109
|
+
export {};
|