@zonsh/ui 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +76 -2
- 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/breadcrumb.d.ts +22 -0
- package/dist/components/breadcrumb.js +32 -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 +164 -0
- package/dist/components/card.d.ts +42 -0
- package/dist/components/card.js +76 -0
- package/dist/components/carousel.d.ts +90 -0
- package/dist/components/carousel.js +213 -0
- package/dist/components/chart.d.ts +180 -0
- package/dist/components/chart.js +286 -0
- package/dist/components/checkbox.d.ts +23 -0
- package/dist/components/checkbox.js +43 -0
- package/dist/components/code-block.d.ts +45 -0
- package/dist/components/code-block.js +58 -0
- package/dist/components/code-highlight.d.ts +13 -0
- package/dist/components/code-highlight.js +107 -0
- package/dist/components/collapsible.d.ts +20 -0
- package/dist/components/collapsible.js +32 -0
- package/dist/components/color-picker.d.ts +85 -0
- package/dist/components/color-picker.js +407 -0
- package/dist/components/combobox.d.ts +81 -0
- package/dist/components/combobox.js +100 -0
- package/dist/components/command.d.ts +112 -0
- package/dist/components/command.js +212 -0
- package/dist/components/context-menu.d.ts +29 -0
- package/dist/components/context-menu.js +35 -0
- package/dist/components/conversation.d.ts +27 -0
- package/dist/components/conversation.js +293 -0
- package/dist/components/copy-button.d.ts +46 -0
- package/dist/components/copy-button.js +118 -0
- package/dist/components/data-table.d.ts +175 -0
- package/dist/components/data-table.js +302 -0
- package/dist/components/date-picker.d.ts +91 -0
- package/dist/components/date-picker.js +207 -0
- package/dist/components/dialog.d.ts +48 -0
- package/dist/components/dialog.js +92 -0
- package/dist/components/direction.d.ts +16 -0
- package/dist/components/direction.js +18 -0
- package/dist/components/drawer.d.ts +60 -0
- package/dist/components/drawer.js +76 -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 +15 -0
- package/dist/components/field.js +36 -0
- package/dist/components/file-drop.d.ts +55 -0
- package/dist/components/file-drop.js +197 -0
- package/dist/components/filter-bar.d.ts +106 -0
- package/dist/components/filter-bar.js +296 -0
- package/dist/components/form.d.ts +33 -0
- package/dist/components/form.js +34 -0
- package/dist/components/graph.d.ts +105 -0
- package/dist/components/graph.js +786 -0
- package/dist/components/illustration.d.ts +85 -0
- package/dist/components/illustration.js +165 -0
- package/dist/components/input-group.d.ts +127 -0
- package/dist/components/input-group.js +292 -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 +33 -0
- package/dist/components/kbd.js +38 -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/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 +138 -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 +56 -0
- package/dist/components/meter.d.ts +31 -0
- package/dist/components/meter.js +25 -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 +36 -0
- package/dist/components/number-field.js +153 -0
- package/dist/components/otp-field.d.ts +35 -0
- package/dist/components/otp-field.js +94 -0
- package/dist/components/pagination.d.ts +31 -0
- package/dist/components/pagination.js +70 -0
- package/dist/components/pdf-viewer.d.ts +69 -0
- package/dist/components/pdf-viewer.js +929 -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 +23 -0
- package/dist/components/prompt-input.d.ts +131 -0
- package/dist/components/prompt-input.js +403 -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/reasoning.d.ts +31 -0
- package/dist/components/reasoning.js +70 -0
- package/dist/components/resizable.d.ts +38 -0
- package/dist/components/resizable.js +41 -0
- package/dist/components/response.d.ts +30 -0
- package/dist/components/response.js +538 -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 +60 -0
- package/dist/components/separator.d.ts +14 -0
- package/dist/components/separator.js +17 -0
- package/dist/components/sidebar.d.ts +147 -0
- package/dist/components/sidebar.js +489 -0
- package/dist/components/site-header.d.ts +59 -0
- package/dist/components/site-header.js +67 -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 +129 -0
- package/dist/components/sources.d.ts +25 -0
- package/dist/components/sources.js +35 -0
- package/dist/components/spinner.d.ts +36 -0
- package/dist/components/spinner.js +72 -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 +162 -0
- package/dist/components/table.js +758 -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 +40 -0
- package/dist/components/tags-input.js +239 -0
- package/dist/components/textarea.d.ts +13 -0
- package/dist/components/textarea.js +16 -0
- package/dist/components/theme.d.ts +41 -0
- package/dist/components/theme.js +112 -0
- package/dist/components/time-field.d.ts +51 -0
- package/dist/components/time-field.js +437 -0
- package/dist/components/timeline.d.ts +76 -0
- package/dist/components/timeline.js +99 -0
- package/dist/components/toast.d.ts +72 -0
- package/dist/components/toast.js +196 -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 +52 -0
- package/dist/components/tool-call.js +57 -0
- package/dist/components/toolbar.d.ts +17 -0
- package/dist/components/toolbar.js +34 -0
- package/dist/components/tooltip.d.ts +42 -0
- package/dist/components/tooltip.js +47 -0
- package/dist/components/tree.d.ts +75 -0
- package/dist/components/tree.js +636 -0
- package/dist/components/typography.d.ts +134 -0
- package/dist/components/typography.js +176 -0
- package/dist/components/video-player.d.ts +276 -0
- package/dist/components/video-player.js +1352 -0
- package/dist/components/whiteboard.d.ts +80 -0
- package/dist/components/whiteboard.js +389 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.js +86 -0
- package/dist/lib/cn.d.ts +20 -0
- package/dist/lib/cn.js +38 -0
- package/dist/lib/code-highlight.d.ts +31 -0
- package/dist/lib/code-highlight.js +24 -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/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 +200 -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/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/platform.d.ts +33 -0
- package/dist/lib/platform.js +68 -0
- package/dist/lib/room.d.ts +25 -0
- package/dist/lib/room.js +46 -0
- package/dist/lib/table-fit.d.ts +143 -0
- package/dist/lib/table-fit.js +577 -0
- package/dist/lib/theme-script.d.ts +18 -0
- package/dist/lib/theme-script.js +29 -0
- package/dist/styles/expressive.css +188 -0
- package/dist/styles/fonts.css +145 -0
- package/dist/styles/index.css +206 -0
- package/dist/styles/material.css +313 -0
- package/dist/styles/parts/ai.css +360 -0
- package/dist/styles/parts/brand.css +75 -0
- package/dist/styles/parts/controls.css +725 -0
- package/dist/styles/parts/data.css +222 -0
- package/dist/styles/parts/editorial.css +120 -0
- package/dist/styles/parts/feedback.css +273 -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 +232 -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/parts/whiteboard.css +855 -0
- package/dist/styles/tokens.css +290 -0
- package/dist/vite.d.ts +116 -0
- package/dist/vite.js +129 -0
- package/package.json +189 -3
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Dialog as BaseDialog } from "@base-ui/react/dialog";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Dialog — a focused task on top of the page: a short form, a decision, a detail view.
|
|
5
|
+
* A dialog is an *object*, so its popup takes the card geometry (20px, the card material).
|
|
6
|
+
*
|
|
7
|
+
* Compose `DialogTrigger` → `DialogContent` → `DialogHeader` / `DialogBody` / `DialogFooter`.
|
|
8
|
+
* The rule people break: using a dialog for content that deserves a page. Keep it short; for a
|
|
9
|
+
* confirmation use `AlertDialog`, for a panel with gestures use `Drawer`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const Dialog: <Payload>(props: BaseDialog.Root.Props<Payload>) => React.JSX.Element;
|
|
12
|
+
/** Opens the dialog. Compose with a button: `render={<Button variant="secondary" />}`. */
|
|
13
|
+
export declare function DialogTrigger(props: BaseDialog.Trigger.Props): React.JSX.Element;
|
|
14
|
+
declare const dialogSizes: {
|
|
15
|
+
readonly sm: "max-w-[26rem]";
|
|
16
|
+
readonly default: "max-w-[32rem]";
|
|
17
|
+
readonly lg: "max-w-[44rem]";
|
|
18
|
+
readonly xl: "max-w-[56rem]";
|
|
19
|
+
};
|
|
20
|
+
export type DialogSize = keyof typeof dialogSizes;
|
|
21
|
+
export interface DialogContentProps extends BaseDialog.Popup.Props {
|
|
22
|
+
/** Max width: `sm` 416px · `default` 512px · `lg` 704px · `xl` 896px. Always full width minus 16px gutters on mobile. */
|
|
23
|
+
size?: DialogSize;
|
|
24
|
+
/** Render the circular close button in the top-right corner. */
|
|
25
|
+
showCloseButton?: boolean;
|
|
26
|
+
/** Accessible name of the close button. */
|
|
27
|
+
closeLabel?: string;
|
|
28
|
+
/** Props for the portal (e.g. `container`, `keepMounted`). */
|
|
29
|
+
portal?: Omit<BaseDialog.Portal.Props, "children">;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The dialog itself: Portal + Backdrop + Viewport + Popup. Enters and exits with opacity and a
|
|
33
|
+
* 0.97 scale; the viewport keeps a 16px gutter on every side so it never touches the screen edge.
|
|
34
|
+
*/
|
|
35
|
+
export declare function DialogContent({ size, showCloseButton, closeLabel, portal, className, children, dir, ...props }: DialogContentProps): React.JSX.Element;
|
|
36
|
+
/** Title + description block. Leaves room at the end for the close button. */
|
|
37
|
+
export declare function DialogHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
38
|
+
/** The dialog's name, in Licht 300 at 26px. Lead with the outcome: "Rename this project". */
|
|
39
|
+
export declare function DialogTitle({ className, ...props }: BaseDialog.Title.Props): React.JSX.Element;
|
|
40
|
+
/** One or two specific sentences under the title. */
|
|
41
|
+
export declare function DialogDescription({ className, ...props }: BaseDialog.Description.Props): React.JSX.Element;
|
|
42
|
+
/** The scrollable middle. Header and footer stay put while long content scrolls here. */
|
|
43
|
+
export declare function DialogBody({ className, ref, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
44
|
+
/** Actions, right-aligned on desktop, stacked full-width on mobile (primary on top). */
|
|
45
|
+
export declare function DialogFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
46
|
+
/** Closes the dialog. Compose with a button: `render={<Button variant="secondary" />}`. */
|
|
47
|
+
export declare function DialogClose(props: BaseDialog.Close.Props): React.JSX.Element;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Dialog as BaseDialog } from "@base-ui/react/dialog";
|
|
4
|
+
import { XIcon } 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 { overlayBackdrop, overlayCard, overlayCloseButton, overlayDescription, overlayFooter, overlayHeader, overlayTitle, usePopupDir, } from "./_overlay.js";
|
|
9
|
+
/**
|
|
10
|
+
* Dialog — a focused task on top of the page: a short form, a decision, a detail view.
|
|
11
|
+
* A dialog is an *object*, so its popup takes the card geometry (20px, the card material).
|
|
12
|
+
*
|
|
13
|
+
* Compose `DialogTrigger` → `DialogContent` → `DialogHeader` / `DialogBody` / `DialogFooter`.
|
|
14
|
+
* The rule people break: using a dialog for content that deserves a page. Keep it short; for a
|
|
15
|
+
* confirmation use `AlertDialog`, for a panel with gestures use `Drawer`.
|
|
16
|
+
*/
|
|
17
|
+
export const Dialog = BaseDialog.Root;
|
|
18
|
+
/** Opens the dialog. Compose with a button: `render={<Button variant="secondary" />}`. */
|
|
19
|
+
export function DialogTrigger(props) {
|
|
20
|
+
return _jsx(BaseDialog.Trigger, { ...triggerSlot("dialog-trigger", props.render), ...props });
|
|
21
|
+
}
|
|
22
|
+
const dialogSizes = {
|
|
23
|
+
sm: "max-w-[26rem]",
|
|
24
|
+
default: "max-w-[32rem]",
|
|
25
|
+
lg: "max-w-[44rem]",
|
|
26
|
+
xl: "max-w-[56rem]",
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The dialog itself: Portal + Backdrop + Viewport + Popup. Enters and exits with opacity and a
|
|
30
|
+
* 0.97 scale; the viewport keeps a 16px gutter on every side so it never touches the screen edge.
|
|
31
|
+
*/
|
|
32
|
+
export function DialogContent({ size = "default", showCloseButton = true, closeLabel = "Close", portal, className, children, dir, ...props }) {
|
|
33
|
+
const popupDir = usePopupDir(dir);
|
|
34
|
+
return (_jsxs(BaseDialog.Portal, { ...portal, children: [_jsx(BaseDialog.Backdrop, { "data-slot": "dialog-backdrop", className: overlayBackdrop }), _jsx(BaseDialog.Viewport, { "data-slot": "dialog-viewport", className: "fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6", children: _jsxs(BaseDialog.Popup, { "data-slot": "dialog-content", "data-size": size, dir: popupDir, className: sx([
|
|
35
|
+
"relative flex max-h-full w-full min-w-0 flex-col gap-6 overflow-hidden rounded-card p-6 font-body outline-none sm:p-8",
|
|
36
|
+
overlayCard,
|
|
37
|
+
"popup-motion",
|
|
38
|
+
dialogSizes[size],
|
|
39
|
+
], className), ...props, children: [children, showCloseButton && (_jsx(BaseDialog.Close, { "data-slot": "dialog-close-button", "aria-label": closeLabel, className: overlayCloseButton, children: _jsx(XIcon, { "aria-hidden": true }) }))] }) })] }));
|
|
40
|
+
}
|
|
41
|
+
/** Title + description block. Leaves room at the end for the close button. */
|
|
42
|
+
export function DialogHeader({ className, ...props }) {
|
|
43
|
+
return _jsx("div", { "data-slot": "dialog-header", className: cn(overlayHeader, "pe-10", className), ...props });
|
|
44
|
+
}
|
|
45
|
+
/** The dialog's name, in Licht 300 at 26px. Lead with the outcome: "Rename this project". */
|
|
46
|
+
export function DialogTitle({ className, ...props }) {
|
|
47
|
+
return _jsx(BaseDialog.Title, { "data-slot": "dialog-title", className: sx(overlayTitle, className), ...props });
|
|
48
|
+
}
|
|
49
|
+
/** One or two specific sentences under the title. */
|
|
50
|
+
export function DialogDescription({ className, ...props }) {
|
|
51
|
+
return (_jsx(BaseDialog.Description, { "data-slot": "dialog-description", className: sx(overlayDescription, className), ...props }));
|
|
52
|
+
}
|
|
53
|
+
/** The scrollable middle. Header and footer stay put while long content scrolls here. */
|
|
54
|
+
export function DialogBody({ className, ref, ...props }) {
|
|
55
|
+
const own = React.useRef(null);
|
|
56
|
+
const refs = React.useMemo(() => mergeRefs(own, ref), [ref]);
|
|
57
|
+
// While it scrolls, the body is a tab stop, so the keyboard can scroll text that holds nothing
|
|
58
|
+
// focusable (Safari doesn't make a scrolling region focusable on its own).
|
|
59
|
+
const [scrolls, setScrolls] = React.useState(false);
|
|
60
|
+
React.useEffect(() => {
|
|
61
|
+
const body = own.current;
|
|
62
|
+
if (!body)
|
|
63
|
+
return;
|
|
64
|
+
const check = () => setScrolls(body.scrollHeight > body.clientHeight + 1);
|
|
65
|
+
const resize = new ResizeObserver(check);
|
|
66
|
+
const observe = () => {
|
|
67
|
+
resize.disconnect();
|
|
68
|
+
resize.observe(body);
|
|
69
|
+
for (const child of body.children)
|
|
70
|
+
resize.observe(child);
|
|
71
|
+
};
|
|
72
|
+
const mutations = new MutationObserver(() => {
|
|
73
|
+
observe();
|
|
74
|
+
check();
|
|
75
|
+
});
|
|
76
|
+
mutations.observe(body, { childList: true });
|
|
77
|
+
observe();
|
|
78
|
+
return () => {
|
|
79
|
+
resize.disconnect();
|
|
80
|
+
mutations.disconnect();
|
|
81
|
+
};
|
|
82
|
+
}, []);
|
|
83
|
+
return (_jsx("div", { ref: refs, "data-slot": "dialog-body", tabIndex: scrolls ? 0 : undefined, className: cn("-mx-6 -my-0.5 min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-0.5 text-[15px] leading-relaxed break-words text-foreground-soft focus-ring sm:-mx-8 sm:px-8", className), ...props }));
|
|
84
|
+
}
|
|
85
|
+
/** Actions, right-aligned on desktop, stacked full-width on mobile (primary on top). */
|
|
86
|
+
export function DialogFooter({ className, ...props }) {
|
|
87
|
+
return _jsx("div", { "data-slot": "dialog-footer", className: cn(overlayFooter, className), ...props });
|
|
88
|
+
}
|
|
89
|
+
/** Closes the dialog. Compose with a button: `render={<Button variant="secondary" />}`. */
|
|
90
|
+
export function DialogClose(props) {
|
|
91
|
+
return _jsx(BaseDialog.Close, { "data-slot": "dialog-close", ...props });
|
|
92
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DirectionProvider as BaseDirectionProvider, useDirection } from "@base-ui/react/direction-provider";
|
|
2
|
+
export { useDirection };
|
|
3
|
+
export type TextDirection = "ltr" | "rtl";
|
|
4
|
+
export type DirectionProviderProps = BaseDirectionProvider.Props;
|
|
5
|
+
/**
|
|
6
|
+
* DirectionProvider — tells every Base UI component inside it which way text runs, so keyboard
|
|
7
|
+
* navigation, slider drag and popup alignment follow right-to-left scripts (Arabic, Hebrew,
|
|
8
|
+
* Persian).
|
|
9
|
+
*
|
|
10
|
+
* It changes behaviour, not layout. The rule people break: setting the provider without `dir`.
|
|
11
|
+
* Put `dir="rtl"` on `<html>` (or on the element wrapping the RTL region) as well, so CSS
|
|
12
|
+
* logical properties and text alignment flip with it. Popups portalled outside the `dir` element
|
|
13
|
+
* (menus, dialogs, toasts …) take the direction from the provider themselves. Read the current
|
|
14
|
+
* value with `useDirection()` — for your own portalled content.
|
|
15
|
+
*/
|
|
16
|
+
export declare function DirectionProvider(props: DirectionProviderProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { DirectionProvider as BaseDirectionProvider, useDirection } from "@base-ui/react/direction-provider";
|
|
4
|
+
export { useDirection };
|
|
5
|
+
/**
|
|
6
|
+
* DirectionProvider — tells every Base UI component inside it which way text runs, so keyboard
|
|
7
|
+
* navigation, slider drag and popup alignment follow right-to-left scripts (Arabic, Hebrew,
|
|
8
|
+
* Persian).
|
|
9
|
+
*
|
|
10
|
+
* It changes behaviour, not layout. The rule people break: setting the provider without `dir`.
|
|
11
|
+
* Put `dir="rtl"` on `<html>` (or on the element wrapping the RTL region) as well, so CSS
|
|
12
|
+
* logical properties and text alignment flip with it. Popups portalled outside the `dir` element
|
|
13
|
+
* (menus, dialogs, toasts …) take the direction from the provider themselves. Read the current
|
|
14
|
+
* value with `useDirection()` — for your own portalled content.
|
|
15
|
+
*/
|
|
16
|
+
export function DirectionProvider(props) {
|
|
17
|
+
return _jsx(BaseDirectionProvider, { ...props });
|
|
18
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Drawer as BaseDrawer } from "@base-ui/react/drawer";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export type DrawerSide = "bottom" | "right" | "left";
|
|
4
|
+
export interface DrawerProps extends BaseDrawer.Root.Props {
|
|
5
|
+
/**
|
|
6
|
+
* Where the drawer lives. `bottom` is a sheet (mobile; grab handle, top corners at 20px);
|
|
7
|
+
* `right` / `left` are side panels with a square edge against the viewport.
|
|
8
|
+
* Sets the swipe-to-dismiss direction unless `swipeDirection` is passed.
|
|
9
|
+
*/
|
|
10
|
+
side?: DrawerSide;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Drawer — a panel that slides in from an edge and can be swiped away. Bottom sheets for mobile
|
|
14
|
+
* tasks, side panels for filters, settings or detail views next to the page.
|
|
15
|
+
*
|
|
16
|
+
* Supports Base UI snap points (`snapPoints`, `snapPoint`, `onSnapPointChange`) on bottom sheets.
|
|
17
|
+
* The rule people break: reaching for a drawer when nothing needs a gesture. A centred task with
|
|
18
|
+
* no swipe is a `Dialog`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function Drawer({ side, ...props }: DrawerProps): React.JSX.Element;
|
|
21
|
+
/** Opens the drawer. Compose with a button: `render={<Button variant="secondary" />}`. */
|
|
22
|
+
export declare function DrawerTrigger(props: BaseDrawer.Trigger.Props): React.JSX.Element;
|
|
23
|
+
export type DrawerSize = "default" | "full";
|
|
24
|
+
export interface DrawerContentProps extends BaseDrawer.Popup.Props {
|
|
25
|
+
/**
|
|
26
|
+
* Bottom sheets only. `default` is a centred sheet up to 672px wide; `full` spans the whole
|
|
27
|
+
* width of the viewport, edge to edge. Both grow with their content up to the viewport minus a
|
|
28
|
+
* 24px top gap.
|
|
29
|
+
*/
|
|
30
|
+
size?: DrawerSize;
|
|
31
|
+
/**
|
|
32
|
+
* Bottom sheets only: always take the full available height and scroll the body. Needed for
|
|
33
|
+
* `snapPoints`, which snap within a fixed height.
|
|
34
|
+
*/
|
|
35
|
+
fullHeight?: boolean;
|
|
36
|
+
/** Render the circular close button in the top-right corner. */
|
|
37
|
+
showCloseButton?: boolean;
|
|
38
|
+
/** Accessible name of the close button. */
|
|
39
|
+
closeLabel?: string;
|
|
40
|
+
/** Show the grab handle. Defaults to `true` on bottom sheets. */
|
|
41
|
+
showHandle?: boolean;
|
|
42
|
+
/** Props for the portal (e.g. `container`, `keepMounted`). */
|
|
43
|
+
portal?: Omit<BaseDrawer.Portal.Props, "children">;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Portal + Backdrop + Viewport + Popup + body. The popup follows the pointer 1:1 while swiping
|
|
47
|
+
* (Base UI writes the drag into an inline transform and `--drawer-swipe-movement-*`), rests on
|
|
48
|
+
* `--drawer-snap-point-offset`, and the backdrop fades with `--drawer-swipe-progress`. With touch
|
|
49
|
+
* the whole sheet drags; with a mouse, everything except controls and a scrolling body does, so
|
|
50
|
+
* text there stays selectable. Motion lives in `styles/parts/overlays.css`.
|
|
51
|
+
*/
|
|
52
|
+
export declare function DrawerContent({ size, fullHeight, showCloseButton, closeLabel, showHandle, portal, className, children, dir, ...props }: DrawerContentProps): React.JSX.Element;
|
|
53
|
+
/** Title + description block. Leaves room at the end for the close button. */
|
|
54
|
+
export declare function DrawerHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
55
|
+
export declare function DrawerTitle({ className, ...props }: BaseDrawer.Title.Props): React.JSX.Element;
|
|
56
|
+
export declare function DrawerDescription({ className, ...props }: BaseDrawer.Description.Props): React.JSX.Element;
|
|
57
|
+
/** Actions. Pinned to the bottom of a side panel; stacked full-width on mobile. */
|
|
58
|
+
export declare function DrawerFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
59
|
+
/** Closes the drawer. Compose with a button: `render={<Button variant="secondary" />}`. */
|
|
60
|
+
export declare function DrawerClose(props: BaseDrawer.Close.Props): React.JSX.Element;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Drawer as BaseDrawer } from "@base-ui/react/drawer";
|
|
4
|
+
import { XIcon } from "lucide-react";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { cn, sx, triggerSlot } from "../lib/cn.js";
|
|
7
|
+
import { overlayCard, overlayCloseButton, overlayDescription, overlayFooter, overlayHeader, overlayTitle, usePopupDir, } from "./_overlay.js";
|
|
8
|
+
const swipeDirection = { bottom: "down", right: "right", left: "left" };
|
|
9
|
+
const DrawerSideContext = React.createContext("bottom");
|
|
10
|
+
/**
|
|
11
|
+
* Drawer — a panel that slides in from an edge and can be swiped away. Bottom sheets for mobile
|
|
12
|
+
* tasks, side panels for filters, settings or detail views next to the page.
|
|
13
|
+
*
|
|
14
|
+
* Supports Base UI snap points (`snapPoints`, `snapPoint`, `onSnapPointChange`) on bottom sheets.
|
|
15
|
+
* The rule people break: reaching for a drawer when nothing needs a gesture. A centred task with
|
|
16
|
+
* no swipe is a `Dialog`.
|
|
17
|
+
*/
|
|
18
|
+
export function Drawer({ side = "bottom", ...props }) {
|
|
19
|
+
return (_jsx(DrawerSideContext.Provider, { value: side, children: _jsx(BaseDrawer.Root, { swipeDirection: swipeDirection[side], ...props }) }));
|
|
20
|
+
}
|
|
21
|
+
/** Opens the drawer. Compose with a button: `render={<Button variant="secondary" />}`. */
|
|
22
|
+
export function DrawerTrigger(props) {
|
|
23
|
+
return _jsx(BaseDrawer.Trigger, { ...triggerSlot("drawer-trigger", props.render), ...props });
|
|
24
|
+
}
|
|
25
|
+
const viewportBySide = {
|
|
26
|
+
bottom: "items-end justify-center",
|
|
27
|
+
right: "items-stretch",
|
|
28
|
+
left: "items-stretch",
|
|
29
|
+
};
|
|
30
|
+
const popupBySide = {
|
|
31
|
+
// A bottom sheet never covers the top 24px (plus the safe area), so the backdrop stays reachable.
|
|
32
|
+
bottom: "w-full max-w-2xl max-h-[calc(100dvh-1.5rem-env(safe-area-inset-top,0px))] rounded-t-card border-b-0",
|
|
33
|
+
// The sides are the screen's, also on a right-to-left page: a margin, not the flex end, puts them there.
|
|
34
|
+
right: "ml-auto h-full w-[min(26rem,calc(100vw-3rem))] rounded-l-card border-y-0 border-r-0",
|
|
35
|
+
left: "mr-auto h-full w-[min(26rem,calc(100vw-3rem))] rounded-r-card border-y-0 border-l-0",
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Portal + Backdrop + Viewport + Popup + body. The popup follows the pointer 1:1 while swiping
|
|
39
|
+
* (Base UI writes the drag into an inline transform and `--drawer-swipe-movement-*`), rests on
|
|
40
|
+
* `--drawer-snap-point-offset`, and the backdrop fades with `--drawer-swipe-progress`. With touch
|
|
41
|
+
* the whole sheet drags; with a mouse, everything except controls and a scrolling body does, so
|
|
42
|
+
* text there stays selectable. Motion lives in `styles/parts/overlays.css`.
|
|
43
|
+
*/
|
|
44
|
+
export function DrawerContent({ size = "default", fullHeight = false, showCloseButton = true, closeLabel = "Close", showHandle, portal, className, children, dir, ...props }) {
|
|
45
|
+
const side = React.useContext(DrawerSideContext);
|
|
46
|
+
const popupDir = usePopupDir(dir);
|
|
47
|
+
const handle = showHandle ?? side === "bottom";
|
|
48
|
+
return (_jsxs(BaseDrawer.Portal, { ...portal, children: [_jsx(BaseDrawer.Backdrop, { "data-slot": "drawer-backdrop", className: "fixed inset-0 z-50 min-h-dvh bg-black/40 supports-[-webkit-touch-callout:none]:absolute dark:bg-black/60" }), _jsx(BaseDrawer.Viewport, { "data-slot": "drawer-viewport", className: cn("fixed inset-0 z-50 flex", viewportBySide[side]), children: _jsxs(BaseDrawer.Popup, { "data-slot": "drawer-content", "data-side": side, "data-size": side === "bottom" ? size : undefined, "data-full-height": side === "bottom" && fullHeight ? "" : undefined, dir: popupDir, className: sx([
|
|
49
|
+
"relative flex flex-col font-body outline-none",
|
|
50
|
+
overlayCard,
|
|
51
|
+
popupBySide[side],
|
|
52
|
+
side === "bottom" && size === "full" && "max-w-none border-x-0",
|
|
53
|
+
side === "bottom" && fullHeight && "h-[calc(100dvh-1.5rem-env(safe-area-inset-top,0px))]",
|
|
54
|
+
], className), ...props, children: [handle && (_jsx("div", { "data-slot": "drawer-handle-area", className: "flex h-7 shrink-0 cursor-grab justify-center pt-3 in-data-swiping:cursor-grabbing", children: _jsx("div", { "data-slot": "drawer-handle", "aria-hidden": true, className: "h-1 w-10 rounded-full bg-field-edge" }) })), _jsx("div", { "data-slot": "drawer-body", className: cn(
|
|
55
|
+
// Its children keep their height and the body scrolls: shrunk to fit, a table or a
|
|
56
|
+
// code block (anything that scrolls itself) would fold down to nothing.
|
|
57
|
+
"flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto overscroll-contain p-6 break-words *:shrink-0 sm:p-8", side === "bottom" && "pb-[calc(1.5rem+env(safe-area-inset-bottom,0px))]", handle && "pt-2 sm:pt-3"), children: children }), showCloseButton && (_jsx(BaseDrawer.Close, { "data-slot": "drawer-close-button", "aria-label": closeLabel, className: overlayCloseButton, children: _jsx(XIcon, { "aria-hidden": true }) }))] }) })] }));
|
|
58
|
+
}
|
|
59
|
+
/** Title + description block. Leaves room at the end for the close button. */
|
|
60
|
+
export function DrawerHeader({ className, ...props }) {
|
|
61
|
+
return _jsx("div", { "data-slot": "drawer-header", className: cn(overlayHeader, "pe-10", className), ...props });
|
|
62
|
+
}
|
|
63
|
+
export function DrawerTitle({ className, ...props }) {
|
|
64
|
+
return _jsx(BaseDrawer.Title, { "data-slot": "drawer-title", className: sx(overlayTitle, className), ...props });
|
|
65
|
+
}
|
|
66
|
+
export function DrawerDescription({ className, ...props }) {
|
|
67
|
+
return (_jsx(BaseDrawer.Description, { "data-slot": "drawer-description", className: sx(overlayDescription, className), ...props }));
|
|
68
|
+
}
|
|
69
|
+
/** Actions. Pinned to the bottom of a side panel; stacked full-width on mobile. */
|
|
70
|
+
export function DrawerFooter({ className, ...props }) {
|
|
71
|
+
return _jsx("div", { "data-slot": "drawer-footer", className: cn(overlayFooter, "mt-auto", className), ...props });
|
|
72
|
+
}
|
|
73
|
+
/** Closes the drawer. Compose with a button: `render={<Button variant="secondary" />}`. */
|
|
74
|
+
export function DrawerClose(props) {
|
|
75
|
+
return _jsx(BaseDrawer.Close, { "data-slot": "drawer-close", ...props });
|
|
76
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
2
|
+
import type * as React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Empty — the empty state for a list, a search with no results or a dashboard before its
|
|
5
|
+
* first data. Centred, generous and calm: a media well, a Licht title, one or two sentences
|
|
6
|
+
* that say what goes here and how to add it, and the actions that fix it.
|
|
7
|
+
*
|
|
8
|
+
* Empty has no box of its own; it sits inside whatever was going to hold the content (a
|
|
9
|
+
* `Card`, a table, a panel). The rule people break: a cheerful headline with no
|
|
10
|
+
* next step. Say what is missing and offer the one action that fills it.
|
|
11
|
+
*/
|
|
12
|
+
export declare function Empty({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
13
|
+
declare const emptyMediaVariants: {
|
|
14
|
+
/** A raised 46px circular well holding a 20px lucide icon. */
|
|
15
|
+
readonly icon: "mb-3 inline-flex size-(--control-h-lg) shrink-0 items-center justify-center rounded-full text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-5 bg-control-surface bg-linear-to-b from-control-inner-edge to-transparent shadow-raised";
|
|
16
|
+
/** A bare slot for an `<Illustration>` from the library: a drawing or an editorial image. */
|
|
17
|
+
readonly illustration: "mb-4 flex w-full max-w-[220px] items-center justify-center text-foreground [&>*]:max-w-full";
|
|
18
|
+
};
|
|
19
|
+
export type EmptyMediaVariant = keyof typeof emptyMediaVariants;
|
|
20
|
+
export interface EmptyMediaProps extends React.ComponentProps<"div"> {
|
|
21
|
+
variant?: EmptyMediaVariant;
|
|
22
|
+
}
|
|
23
|
+
/** The picture at the top: an icon well (`icon`, default) or an illustration slot. Decorative. */
|
|
24
|
+
export declare function EmptyMedia({ variant, className, ...props }: EmptyMediaProps): React.JSX.Element;
|
|
25
|
+
/** The empty state's heading in Licht. Renders an `<h3>`; use `render` for another level. */
|
|
26
|
+
export declare function EmptyTitle({ render, ref, className, ...props }: useRender.ComponentProps<"h3">): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
27
|
+
/** One or two sentences: what belongs here and how to add it. Links take the brand underline. */
|
|
28
|
+
export declare function EmptyDescription({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
29
|
+
/** The actions that fill the empty state — at most one primary, the rest secondary or ghost. */
|
|
30
|
+
export declare function EmptyActions({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
import { cn } from "../lib/cn.js";
|
|
5
|
+
/** The static raised key surface (no hover — the well is not a control). */
|
|
6
|
+
const raisedWell = "bg-control-surface bg-linear-to-b from-control-inner-edge to-transparent shadow-raised";
|
|
7
|
+
/**
|
|
8
|
+
* Empty — the empty state for a list, a search with no results or a dashboard before its
|
|
9
|
+
* first data. Centred, generous and calm: a media well, a Licht title, one or two sentences
|
|
10
|
+
* that say what goes here and how to add it, and the actions that fix it.
|
|
11
|
+
*
|
|
12
|
+
* Empty has no box of its own; it sits inside whatever was going to hold the content (a
|
|
13
|
+
* `Card`, a table, a panel). The rule people break: a cheerful headline with no
|
|
14
|
+
* next step. Say what is missing and offer the one action that fills it.
|
|
15
|
+
*/
|
|
16
|
+
export function Empty({ className, ...props }) {
|
|
17
|
+
return (_jsx("div", { "data-slot": "empty", className: cn("flex w-full min-w-0 flex-col items-center justify-center gap-3 px-6 py-12 text-center text-balance md:py-16", className), ...props }));
|
|
18
|
+
}
|
|
19
|
+
const emptyMediaVariants = {
|
|
20
|
+
/** A raised 46px circular well holding a 20px lucide icon. */
|
|
21
|
+
icon: `mb-3 inline-flex size-(--control-h-lg) shrink-0 items-center justify-center rounded-full text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-5 ${raisedWell}`,
|
|
22
|
+
/** A bare slot for an `<Illustration>` from the library: a drawing or an editorial image. */
|
|
23
|
+
illustration: "mb-4 flex w-full max-w-[220px] items-center justify-center text-foreground [&>*]:max-w-full",
|
|
24
|
+
};
|
|
25
|
+
/** The picture at the top: an icon well (`icon`, default) or an illustration slot. Decorative. */
|
|
26
|
+
export function EmptyMedia({ variant = "icon", className, ...props }) {
|
|
27
|
+
return (_jsx("div", { "aria-hidden": true, "data-slot": "empty-media", "data-variant": variant, className: cn(emptyMediaVariants[variant], className), ...props }));
|
|
28
|
+
}
|
|
29
|
+
/** The empty state's heading in Licht. Renders an `<h3>`; use `render` for another level. */
|
|
30
|
+
export function EmptyTitle({ render, ref, className, ...props }) {
|
|
31
|
+
return useRender({
|
|
32
|
+
defaultTagName: "h3",
|
|
33
|
+
render,
|
|
34
|
+
ref,
|
|
35
|
+
props: {
|
|
36
|
+
"data-slot": "empty-title",
|
|
37
|
+
...props,
|
|
38
|
+
// A long word with no break (a pasted query, a URL) wraps instead of running past the card.
|
|
39
|
+
className: cn("m-0 max-w-full display text-[24px] leading-[1.1] [overflow-wrap:anywhere] text-foreground sm:text-[28px]", className),
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/** One or two sentences: what belongs here and how to add it. Links take the brand underline. */
|
|
44
|
+
export function EmptyDescription({ className, ...props }) {
|
|
45
|
+
return (_jsx("div", { "data-slot": "empty-description", className: cn("max-w-[min(46ch,100%)] text-[15px] leading-relaxed [overflow-wrap:anywhere] text-muted-foreground [&_a]:link [&_p]:m-0 [&_p+p]:mt-2", className), ...props }));
|
|
46
|
+
}
|
|
47
|
+
/** The actions that fill the empty state — at most one primary, the rest secondary or ghost. */
|
|
48
|
+
export function EmptyActions({ className, ...props }) {
|
|
49
|
+
return (_jsx("div", { "data-slot": "empty-actions", className: cn("mt-4 flex flex-wrap items-center justify-center gap-3", className), ...props }));
|
|
50
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
2
|
+
export interface FeatureListProps extends ComponentProps<"ul"> {
|
|
3
|
+
/** Columns at full width. Always one column on small screens. */
|
|
4
|
+
columns?: 1 | 2 | 3;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* FeatureList — the brand's feature grid, which is not a box: a grid of items, each a top
|
|
8
|
+
* hairline with generous padding, a mono index, an optional icon, a title and a body.
|
|
9
|
+
*
|
|
10
|
+
* Use it for features, principles and capabilities: three to six parallel ideas.
|
|
11
|
+
*
|
|
12
|
+
* The rule people break: putting a background, border or radius around the items. The top
|
|
13
|
+
* rule and whitespace carry the structure; boxing them flattens the page.
|
|
14
|
+
*/
|
|
15
|
+
export declare function FeatureList({ columns, className, ...props }: FeatureListProps): import("react").JSX.Element;
|
|
16
|
+
export interface FeatureItemProps extends Omit<ComponentProps<"li">, "title"> {
|
|
17
|
+
/** Mono index, e.g. `01`. */
|
|
18
|
+
index?: ReactNode;
|
|
19
|
+
/** A 20px lucide icon. Decorative: it is hidden from assistive tech. */
|
|
20
|
+
icon?: ReactNode;
|
|
21
|
+
/** The title. */
|
|
22
|
+
title: ReactNode;
|
|
23
|
+
/** `body` — Licht Sans 17–18px medium (default). `heading` — Licht, for editorial lists. */
|
|
24
|
+
titleFont?: "body" | "heading";
|
|
25
|
+
/** Heading level of the title. */
|
|
26
|
+
titleAs?: "h2" | "h3" | "h4" | "p";
|
|
27
|
+
/** `children` is the body copy, in foreground-soft. Callouts may follow it. */
|
|
28
|
+
children?: ReactNode;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* FeatureItem — one item of a `FeatureList`: top hairline, mono index, optional icon,
|
|
32
|
+
* title and body.
|
|
33
|
+
*/
|
|
34
|
+
export declare function FeatureItem({ index, icon, title, titleFont, titleAs: Title, className, children, ...props }: FeatureItemProps): import("react").JSX.Element;
|
|
35
|
+
export interface FeatureCalloutListProps extends ComponentProps<"ul"> {
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* FeatureCalloutList — a stack of `FeatureCallout` lines, inside a `FeatureItem` body or on
|
|
39
|
+
* its own, like the zon.sh problem list.
|
|
40
|
+
*/
|
|
41
|
+
export declare function FeatureCalloutList({ className, ...props }: FeatureCalloutListProps): import("react").JSX.Element;
|
|
42
|
+
export interface FeatureCalloutProps extends ComponentProps<"li"> {
|
|
43
|
+
/** A small lucide icon before the key. Decorative. */
|
|
44
|
+
icon?: ReactNode;
|
|
45
|
+
/** The mono bold key, e.g. `Scalable systems`. */
|
|
46
|
+
label: ReactNode;
|
|
47
|
+
/** `children` is the line after the em dash. */
|
|
48
|
+
children?: ReactNode;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* FeatureCallout — one line prefixed by a small icon and a mono bold key:
|
|
52
|
+
* "Fast search — Find any note by a word inside it, as you type."
|
|
53
|
+
*/
|
|
54
|
+
export declare function FeatureCallout({ icon, label, className, children, ...props }: FeatureCalloutProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
const columnClasses = {
|
|
5
|
+
1: "grid-cols-1",
|
|
6
|
+
2: "grid-cols-1 md:grid-cols-2",
|
|
7
|
+
3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3",
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* FeatureList — the brand's feature grid, which is not a box: a grid of items, each a top
|
|
11
|
+
* hairline with generous padding, a mono index, an optional icon, a title and a body.
|
|
12
|
+
*
|
|
13
|
+
* Use it for features, principles and capabilities: three to six parallel ideas.
|
|
14
|
+
*
|
|
15
|
+
* The rule people break: putting a background, border or radius around the items. The top
|
|
16
|
+
* rule and whitespace carry the structure; boxing them flattens the page.
|
|
17
|
+
*/
|
|
18
|
+
export function FeatureList({ columns = 3, className, ...props }) {
|
|
19
|
+
return (_jsx("ul", { "data-slot": "feature-list", "data-columns": columns, className: cn("m-0 grid w-full list-none gap-x-10 p-0 break-words lg:gap-x-12", columnClasses[columns], className), ...props }));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* FeatureItem — one item of a `FeatureList`: top hairline, mono index, optional icon,
|
|
23
|
+
* title and body.
|
|
24
|
+
*/
|
|
25
|
+
export function FeatureItem({ index, icon, title, titleFont = "body", titleAs: Title = "h3", className, children, ...props }) {
|
|
26
|
+
return (_jsxs("li", { "data-slot": "feature-item", className: cn("flex flex-col border-t border-border pt-6 pb-10 sm:pt-7 sm:pb-12", className), ...props, children: [index != null || icon != null ? (_jsxs("div", { className: "mb-8 flex items-center justify-between gap-4 sm:mb-10", children: [_jsx("span", { "data-slot": "feature-item-index", className: "font-mono text-xs leading-none tracking-[0.08em] text-muted-foreground tabular-nums", children: index }), icon != null ? (_jsx("span", { "data-slot": "feature-item-icon", "aria-hidden": true, className: "text-foreground-soft [&_svg]:size-5 [&_svg]:shrink-0", children: icon })) : null] })) : null, _jsx(Title, { "data-slot": "feature-item-title", className: cn("m-0 text-foreground", titleFont === "heading"
|
|
27
|
+
? "font-heading text-[24px] leading-[1.15] font-light tracking-[-0.02em] sm:text-[26px]"
|
|
28
|
+
: "font-body text-[17px] leading-snug font-medium tracking-normal sm:text-[18px]"), children: title }), children != null ? (_jsx("div", { "data-slot": "feature-item-body", className: "mt-3 flex flex-col gap-4 text-[16px] leading-relaxed text-foreground-soft [&>p]:m-0", children: children })) : null] }));
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* FeatureCalloutList — a stack of `FeatureCallout` lines, inside a `FeatureItem` body or on
|
|
32
|
+
* its own, like the zon.sh problem list.
|
|
33
|
+
*/
|
|
34
|
+
export function FeatureCalloutList({ className, ...props }) {
|
|
35
|
+
return (_jsx("ul", { "data-slot": "feature-callout-list", className: cn("m-0 flex list-none flex-col gap-3 p-0 break-words", className), ...props }));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* FeatureCallout — one line prefixed by a small icon and a mono bold key:
|
|
39
|
+
* "Fast search — Find any note by a word inside it, as you type."
|
|
40
|
+
*/
|
|
41
|
+
export function FeatureCallout({ icon, label, className, children, ...props }) {
|
|
42
|
+
return (_jsxs("li", { "data-slot": "feature-callout", className: cn("flex items-start gap-3 text-[15px] leading-relaxed text-foreground-soft", className), ...props, children: [icon != null ? (_jsx("span", { "aria-hidden": true, className: "mt-[0.3em] text-foreground [&_svg]:size-4 [&_svg]:shrink-0", children: icon })) : null, _jsxs("span", { className: "min-w-0", children: [_jsx("strong", { className: "font-mono text-[13px] font-semibold tracking-[0.02em] text-foreground", children: label }), children != null ? _jsxs(_Fragment, { children: [" \u2014 ", children] }) : null] })] }));
|
|
43
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Field as BaseField } from "@base-ui/react/field";
|
|
2
|
+
import { Fieldset as BaseFieldset } from "@base-ui/react/fieldset";
|
|
3
|
+
/**
|
|
4
|
+
* Field — groups a label, a control, a description and validation.
|
|
5
|
+
* Every control needs a visible label. Errors use destructive ink *plus* a message.
|
|
6
|
+
*/
|
|
7
|
+
export declare function Field({ className, ...props }: BaseField.Root.Props): import("react").JSX.Element;
|
|
8
|
+
export declare function FieldLabel({ className, ...props }: BaseField.Label.Props): import("react").JSX.Element;
|
|
9
|
+
export declare function FieldDescription({ className, ...props }: BaseField.Description.Props): import("react").JSX.Element;
|
|
10
|
+
export declare function FieldError({ className, ...props }: BaseField.Error.Props): import("react").JSX.Element;
|
|
11
|
+
/** A labelled group of fields (radio groups, checkbox groups, address blocks). */
|
|
12
|
+
export declare function Fieldset({ className, ...props }: BaseFieldset.Root.Props): import("react").JSX.Element;
|
|
13
|
+
export declare function FieldsetLegend({ className, ...props }: BaseFieldset.Legend.Props): import("react").JSX.Element;
|
|
14
|
+
export declare const FieldItem: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").FieldItemProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
15
|
+
export declare const FieldValidity: import("react").FC<import("@base-ui/react").FieldValidityProps>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Field as BaseField } from "@base-ui/react/field";
|
|
4
|
+
import { Fieldset as BaseFieldset } from "@base-ui/react/fieldset";
|
|
5
|
+
import { sx } from "../lib/cn.js";
|
|
6
|
+
/**
|
|
7
|
+
* Field — groups a label, a control, a description and validation.
|
|
8
|
+
* Every control needs a visible label. Errors use destructive ink *plus* a message.
|
|
9
|
+
*/
|
|
10
|
+
export function Field({ className, ...props }) {
|
|
11
|
+
return _jsx(BaseField.Root, { "data-slot": "field", className: sx("flex flex-col gap-2", className), ...props });
|
|
12
|
+
}
|
|
13
|
+
export function FieldLabel({ className, ...props }) {
|
|
14
|
+
return (_jsx(BaseField.Label, { "data-slot": "field-label", className: sx([
|
|
15
|
+
// A long unbroken word (a URL, a German compound) wraps rather than leaving the column.
|
|
16
|
+
"text-sm leading-snug font-medium [overflow-wrap:anywhere] text-foreground select-none data-disabled:opacity-55",
|
|
17
|
+
// A label wrapping a checkbox, radio or switch lays the control out beside its text.
|
|
18
|
+
"has-[[data-slot=checkbox],[data-slot=radio]]:flex has-[[data-slot=checkbox],[data-slot=radio]]:cursor-pointer has-[[data-slot=checkbox],[data-slot=radio]]:items-start has-[[data-slot=checkbox],[data-slot=radio]]:gap-2.5 has-[[data-slot=checkbox],[data-slot=radio]]:font-normal",
|
|
19
|
+
"has-data-[slot=switch]:flex has-data-[slot=switch]:cursor-pointer has-data-[slot=switch]:items-center has-data-[slot=switch]:gap-3 has-data-[slot=switch]:font-normal",
|
|
20
|
+
], className), ...props }));
|
|
21
|
+
}
|
|
22
|
+
export function FieldDescription({ className, ...props }) {
|
|
23
|
+
return (_jsx(BaseField.Description, { "data-slot": "field-description", className: sx("text-[13px] leading-normal text-muted-foreground", className), ...props }));
|
|
24
|
+
}
|
|
25
|
+
export function FieldError({ className, ...props }) {
|
|
26
|
+
return (_jsx(BaseField.Error, { "data-slot": "field-error", className: sx("text-[13px] leading-normal text-destructive", className), ...props }));
|
|
27
|
+
}
|
|
28
|
+
/** A labelled group of fields (radio groups, checkbox groups, address blocks). */
|
|
29
|
+
export function Fieldset({ className, ...props }) {
|
|
30
|
+
return (_jsx(BaseFieldset.Root, { "data-slot": "fieldset", className: sx("flex flex-col gap-4 border-0 p-0", className), ...props }));
|
|
31
|
+
}
|
|
32
|
+
export function FieldsetLegend({ className, ...props }) {
|
|
33
|
+
return (_jsx(BaseFieldset.Legend, { "data-slot": "fieldset-legend", className: sx("mb-1 eyebrow", className), ...props }));
|
|
34
|
+
}
|
|
35
|
+
export const FieldItem = BaseField.Item;
|
|
36
|
+
export const FieldValidity = BaseField.Validity;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/** A file that was not taken, and why. */
|
|
3
|
+
export interface FileDropRejection {
|
|
4
|
+
file: File;
|
|
5
|
+
reason: "type" | "size" | "count";
|
|
6
|
+
}
|
|
7
|
+
export interface FileDropProps extends Omit<React.ComponentProps<"div">, "onDrop" | "title"> {
|
|
8
|
+
/** Called with the files taken from a drop, the file picker or a paste. */
|
|
9
|
+
onFiles: (files: File[]) => void;
|
|
10
|
+
/** Called with the files that did not match `accept`, were over `maxSize`, or past one when `multiple` is off. */
|
|
11
|
+
onReject?: (rejected: FileDropRejection[]) => void;
|
|
12
|
+
/** The types to take, as on a file input: `"image/*,.pdf"`. Default: any file. */
|
|
13
|
+
accept?: string;
|
|
14
|
+
/** Take several files at once. Default `true`. */
|
|
15
|
+
multiple?: boolean;
|
|
16
|
+
/** The largest file to take, in bytes. */
|
|
17
|
+
maxSize?: number;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
/** The first line. Default "Drop files here" ("Drop a file here" when `multiple` is off). */
|
|
20
|
+
title?: React.ReactNode;
|
|
21
|
+
/** The line under it. Default: how else to add files — click, or paste. */
|
|
22
|
+
description?: React.ReactNode;
|
|
23
|
+
/** A mono line at the bottom, for what is accepted: "PNG, JPG or PDF · up to 10 MB". */
|
|
24
|
+
hint?: React.ReactNode;
|
|
25
|
+
/** Replace the content of the zone entirely. */
|
|
26
|
+
children?: React.ReactNode;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* FileDrop — a place to add files, three ways: drop one or more on it, click it (or press Enter or
|
|
30
|
+
* Space) to choose them in the file picker, or paste them with ⌘V / Ctrl+V while it is focused or
|
|
31
|
+
* under the pointer. A recessed field with a dashed edge and a raised upload well; the edge takes
|
|
32
|
+
* the focus colour while files are dragged over it. It checks `accept`, `maxSize` and `multiple`
|
|
33
|
+
* the same way for all three, and hands what it takes to `onFiles` — show them with
|
|
34
|
+
* `FileDropItem`s.
|
|
35
|
+
*
|
|
36
|
+
* The rule people break: a zone that only takes drops. Dragging needs a mouse and a file manager
|
|
37
|
+
* beside the page; clicking and pasting are how most people add a file.
|
|
38
|
+
*/
|
|
39
|
+
export declare function FileDrop({ onFiles, onReject, accept, multiple, maxSize, disabled, title, description, hint, children, className, onKeyDown, onClick, onDragEnter, onDragOver, onDragLeave, onPointerEnter, onPointerLeave, ...props }: FileDropProps): React.JSX.Element;
|
|
40
|
+
/** A size in bytes, as people read it: 840 B, 12 KB, 3.4 MB. */
|
|
41
|
+
export declare function formatFileSize(bytes: number): string;
|
|
42
|
+
export interface FileDropItemProps extends Omit<React.ComponentProps<"div">, "children"> {
|
|
43
|
+
/** The file. Images show a thumbnail; other files an icon. */
|
|
44
|
+
file: File;
|
|
45
|
+
/** Shows a remove button. */
|
|
46
|
+
onRemove?: () => void;
|
|
47
|
+
/** Accessible name of the remove button. Default `Remove <file name>`. */
|
|
48
|
+
removeLabel?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* FileDropItem — one file added through a `FileDrop`: a thumbnail for an image (an icon for
|
|
52
|
+
* anything else), the name, its size in mono, and a remove button. Outlined 12px rows; stack
|
|
53
|
+
* them in a list under the zone.
|
|
54
|
+
*/
|
|
55
|
+
export declare function FileDropItem({ file, onRemove, removeLabel, className, ...props }: FileDropItemProps): React.JSX.Element;
|