@zonsh/ui 0.0.0 → 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 +75 -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/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 +188 -5
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
const skeletonShapes = {
|
|
5
|
+
/** A line of text: square ends, 1em tall by default. Set the width per line. */
|
|
6
|
+
text: "h-[1em] rounded-none",
|
|
7
|
+
/** Stands in for an input, select trigger or textarea: 10px corners, 38px tall. */
|
|
8
|
+
field: "min-h-(--control-h) w-full rounded-control",
|
|
9
|
+
/** Stands in for a button: 12px corners, 38px tall. */
|
|
10
|
+
button: "min-h-(--control-h) w-28 rounded-button",
|
|
11
|
+
/** Stands in for a tag, a menu item or a thumbnail: 7px corners. */
|
|
12
|
+
item: "rounded-item",
|
|
13
|
+
/** Stands in for an avatar or an icon button. Set the size. */
|
|
14
|
+
circle: "aspect-square rounded-full",
|
|
15
|
+
/** Stands in for a whole card: 20px corners. */
|
|
16
|
+
card: "rounded-card",
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Skeleton — a placeholder in `--control-surface` that holds the place of content while it
|
|
20
|
+
* loads, with one soft highlight sweeping across it every 1.6s (static under reduced motion).
|
|
21
|
+
*
|
|
22
|
+
* The radius follows what it stands in for: `text` lines are square, `field` is 10px, `button`
|
|
23
|
+
* is 12px, `circle` is round, `card` is 20px. Skeletons are `aria-hidden`; announce loading on
|
|
24
|
+
* the container (`aria-busy`) instead. The rule people break: skeletons that do not match the
|
|
25
|
+
* real layout, so the page jumps when the content arrives.
|
|
26
|
+
*/
|
|
27
|
+
export function Skeleton({ shape = "text", className, ...props }) {
|
|
28
|
+
return (_jsx("div", { "aria-hidden": true, "data-slot": "skeleton", "data-shape": shape, className: cn("block shrink-0", skeletonShapes[shape], className), ...props }));
|
|
29
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Slider as BaseSlider } from "@base-ui/react/slider";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export interface SliderProps<Value extends number | readonly number[] = number | readonly number[]> extends BaseSlider.Root.Props<Value> {
|
|
4
|
+
/** A visible label above the track, associated with every thumb. */
|
|
5
|
+
label?: React.ReactNode;
|
|
6
|
+
/** Show the current value (or "min – max" for a range) in mono beside the label. */
|
|
7
|
+
showValue?: boolean;
|
|
8
|
+
/** Accessible names per thumb — required for range sliders ("Minimum budget", "Maximum budget"). */
|
|
9
|
+
thumbLabels?: string[];
|
|
10
|
+
/**
|
|
11
|
+
* A dragged thumb squashes and stretches like something soft, and wobbles back round when let
|
|
12
|
+
* go. Off by default: the thumb keeps its shape.
|
|
13
|
+
*/
|
|
14
|
+
squash?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Slider — a recessed 6px track with a soft indicator fill and raised 18px thumbs.
|
|
18
|
+
*
|
|
19
|
+
* Pass an array as `value`/`defaultValue` for a range; one thumb is rendered per value. Use a
|
|
20
|
+
* slider when the rough position matters more than the exact number — for exact values use
|
|
21
|
+
* `NumberField`. The rule people break: a range slider without `thumbLabels`, so both thumbs
|
|
22
|
+
* announce the same name.
|
|
23
|
+
*/
|
|
24
|
+
export declare function Slider<Value extends number | readonly number[] = number | readonly number[]>({ label, showValue, thumbLabels, squash, thumbAlignment, className, children, ref, ...props }: SliderProps<Value>): React.JSX.Element;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Slider as BaseSlider } from "@base-ui/react/slider";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { cn, sx } from "../lib/cn.js";
|
|
6
|
+
import { useFormReset } from "../lib/form-reset.js";
|
|
7
|
+
import { mergeRefs } from "../lib/merge-refs.js";
|
|
8
|
+
/* ── Squash and stretch ────────────────────────────────────────────────────── */
|
|
9
|
+
/** How far a thumb stretches at most (0.4 = 40% longer along the track). */
|
|
10
|
+
const MAX_STRETCH = 0.4;
|
|
11
|
+
/** The pinch of a held thumb standing still: already a little wider and flatter under the finger. */
|
|
12
|
+
const HELD_STRETCH = 0.12;
|
|
13
|
+
/**
|
|
14
|
+
* How quickly the stretch answers speed (px/s): it rises fast and eases toward the maximum, so an
|
|
15
|
+
* ordinary drag already squashes — about two thirds of the way at this speed.
|
|
16
|
+
*/
|
|
17
|
+
const SPEED_SCALE = 220;
|
|
18
|
+
/** The spring that pulls the stretch toward its target: stiffness and damping, per second. */
|
|
19
|
+
const STIFFNESS = 420;
|
|
20
|
+
const DAMPING = 22;
|
|
21
|
+
/**
|
|
22
|
+
* A dragged thumb behaves like something soft. Held, it is pinched a little wider and flatter;
|
|
23
|
+
* the faster it moves, the longer and flatter it gets along the track (keeping its area). As it
|
|
24
|
+
* slows it eases back to the pinch, and when it is let go a spring pulls it round again with a
|
|
25
|
+
* small wobble. Driven per frame from the thumb's own movement, so it follows
|
|
26
|
+
* pointer drags, and keyboard steps leave it alone. Only with `squash`; off under reduced motion.
|
|
27
|
+
*/
|
|
28
|
+
function useSquash(control, enabled, mount) {
|
|
29
|
+
React.useEffect(() => {
|
|
30
|
+
const root = control.current;
|
|
31
|
+
if (!enabled || !root)
|
|
32
|
+
return;
|
|
33
|
+
const reduce = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
34
|
+
const bodies = new Map();
|
|
35
|
+
let frame = 0;
|
|
36
|
+
let last = 0;
|
|
37
|
+
const tick = (now) => {
|
|
38
|
+
// A frame's time can be earlier than the pointerdown that started the loop: a step back in
|
|
39
|
+
// time would run the spring backwards until it blows up, so it counts as a frame instead.
|
|
40
|
+
const dt = Math.min(0.05, Math.max(0, (now - last) / 1000)) || 1 / 60;
|
|
41
|
+
last = now;
|
|
42
|
+
let moving = false;
|
|
43
|
+
const thumbs = root.querySelectorAll('[data-slot="slider-thumb"]');
|
|
44
|
+
// Base UI marks every thumb of a range as dragging; the held one is the one it focused.
|
|
45
|
+
const focused = [...thumbs].some((thumb) => thumb.matches(":focus-within"));
|
|
46
|
+
for (const thumb of thumbs) {
|
|
47
|
+
const vertical = thumb.dataset.orientation === "vertical";
|
|
48
|
+
const r = thumb.getBoundingClientRect();
|
|
49
|
+
const pos = vertical ? r.top + r.height / 2 : r.left + r.width / 2;
|
|
50
|
+
let body = bodies.get(thumb);
|
|
51
|
+
if (!body)
|
|
52
|
+
bodies.set(thumb, (body = { pos, speed: 0, stretch: 0, velocity: 0 }));
|
|
53
|
+
const dragging = thumb.hasAttribute("data-dragging") && (!focused || thumb.matches(":focus-within"));
|
|
54
|
+
const raw = dragging ? Math.abs(pos - body.pos) / dt : 0;
|
|
55
|
+
body.pos = pos;
|
|
56
|
+
// Smooth the speed so one uneven pointer event does not jolt the shape.
|
|
57
|
+
body.speed += (raw - body.speed) * 0.35;
|
|
58
|
+
const target = dragging
|
|
59
|
+
? HELD_STRETCH + (MAX_STRETCH - HELD_STRETCH) * (1 - Math.exp(-body.speed / SPEED_SCALE))
|
|
60
|
+
: 0;
|
|
61
|
+
body.velocity += (STIFFNESS * (target - body.stretch) - DAMPING * body.velocity) * dt;
|
|
62
|
+
body.stretch += body.velocity * dt;
|
|
63
|
+
const settled = !dragging && Math.abs(body.stretch) < 0.002 && Math.abs(body.velocity) < 0.02;
|
|
64
|
+
if (settled) {
|
|
65
|
+
body.stretch = body.velocity = body.speed = 0;
|
|
66
|
+
if (thumb.style.scale) {
|
|
67
|
+
thumb.style.removeProperty("scale");
|
|
68
|
+
// Base UI places a thumb at the track's ends (thumbAlignment="edge") from its measured
|
|
69
|
+
// box, scale included, and measures again only when the value or a size changes: let go
|
|
70
|
+
// mid-stretch, it would stay placed for its stretched size, a few px short of the end.
|
|
71
|
+
// A tenth of a pixel of padding, which leaves the box its size, has it measure the thumb
|
|
72
|
+
// at rest. (Less than a layout unit, 1/64px, would change nothing.)
|
|
73
|
+
thumb.style.paddingInlineEnd = "0.1px";
|
|
74
|
+
requestAnimationFrame(() => thumb.style.removeProperty("padding-inline-end"));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
moving = true;
|
|
79
|
+
const along = 1 + body.stretch;
|
|
80
|
+
const across = 1 / along;
|
|
81
|
+
thumb.style.scale = vertical ? `${across} ${along}` : `${along} ${across}`;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
frame = moving ? requestAnimationFrame(tick) : 0;
|
|
85
|
+
};
|
|
86
|
+
const start = () => {
|
|
87
|
+
if (reduce.matches || frame)
|
|
88
|
+
return;
|
|
89
|
+
last = performance.now();
|
|
90
|
+
for (const [thumb, body] of bodies) {
|
|
91
|
+
const r = thumb.getBoundingClientRect();
|
|
92
|
+
body.pos = thumb.dataset.orientation === "vertical" ? r.top + r.height / 2 : r.left + r.width / 2;
|
|
93
|
+
}
|
|
94
|
+
frame = requestAnimationFrame(tick);
|
|
95
|
+
};
|
|
96
|
+
root.addEventListener("pointerdown", start);
|
|
97
|
+
return () => {
|
|
98
|
+
root.removeEventListener("pointerdown", start);
|
|
99
|
+
cancelAnimationFrame(frame);
|
|
100
|
+
for (const thumb of bodies.keys())
|
|
101
|
+
thumb.style.removeProperty("scale");
|
|
102
|
+
};
|
|
103
|
+
// `mount` changes when a form's reset remounts the slider: listen on the new control.
|
|
104
|
+
}, [control, enabled, mount]);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Slider — a recessed 6px track with a soft indicator fill and raised 18px thumbs.
|
|
108
|
+
*
|
|
109
|
+
* Pass an array as `value`/`defaultValue` for a range; one thumb is rendered per value. Use a
|
|
110
|
+
* slider when the rough position matters more than the exact number — for exact values use
|
|
111
|
+
* `NumberField`. The rule people break: a range slider without `thumbLabels`, so both thumbs
|
|
112
|
+
* announce the same name.
|
|
113
|
+
*/
|
|
114
|
+
export function Slider({ label, showValue = false, thumbLabels, squash = false,
|
|
115
|
+
// Thumbs stop at the track's ends instead of hanging half past them, so a box that clips its
|
|
116
|
+
// content (a card, a popover) never cuts one in half.
|
|
117
|
+
thumbAlignment = "edge", className, children, ref, ...props }) {
|
|
118
|
+
const source = props.value ?? props.defaultValue;
|
|
119
|
+
const count = Array.isArray(source) ? source.length : 1;
|
|
120
|
+
const hasHeader = label != null || showValue;
|
|
121
|
+
const control = React.useRef(null);
|
|
122
|
+
// A form's reset remounts it from its defaults (lib/form-reset).
|
|
123
|
+
const [resetKey, formRef] = useFormReset();
|
|
124
|
+
const refs = React.useMemo(() => mergeRefs(formRef, ref), [formRef, ref]);
|
|
125
|
+
useSquash(control, squash, resetKey);
|
|
126
|
+
return (_jsxs(BaseSlider.Root, { ref: refs, "data-slot": "slider", thumbAlignment: thumbAlignment, className: sx("group/slider flex w-full flex-col gap-2 data-[orientation=vertical]:h-full data-[orientation=vertical]:w-auto data-disabled:[&>[data-slot=slider-control]]:opacity-55", className), ...props, children: [hasHeader && (_jsxs("div", { "data-slot": "slider-header", className: "flex items-baseline justify-between gap-4", children: [label != null && (_jsx(BaseSlider.Label, { "data-slot": "slider-label", className: "text-sm leading-snug font-medium text-foreground select-none group-data-disabled/slider:text-foreground-soft", children: label })), showValue && (_jsx(BaseSlider.Value, { "data-slot": "slider-value", className: "ms-auto font-mono text-xs text-muted-foreground tabular-nums group-data-disabled/slider:opacity-55", children: (formatted) => formatted.join(" – ") }))] })), _jsx(BaseSlider.Control, { ref: control, "data-slot": "slider-control", className: "flex w-full touch-none items-center py-2 select-none data-disabled:cursor-not-allowed data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-32 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col data-[orientation=vertical]:px-2 data-[orientation=vertical]:py-0", children: _jsxs(BaseSlider.Track, { "data-slot": "slider-track", className: "relative h-1.5 w-full material-field rounded-full select-none data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5", children: [_jsx(BaseSlider.Indicator, { "data-slot": "slider-indicator", className: "rounded-full bg-foreground-soft select-none" }), Array.from({ length: count }, (_, index) => (_jsx(BaseSlider.Thumb, { index: index, "aria-label": thumbLabels?.[index], "data-slot": "slider-thumb", className: cn("size-[18px] cursor-grab rounded-full bg-control-surface bg-linear-to-b from-control-inner-edge to-transparent select-none", "shadow-thumb", "transition-[background-color,box-shadow] duration-(--duration) ease-brand", "hover:not-data-disabled:bg-control-hover data-dragging:cursor-grabbing",
|
|
127
|
+
// Held, it takes the hover fill; with `squash`, dragged, it squashes and stretches (useSquash).
|
|
128
|
+
"active:not-data-disabled:bg-control-hover data-dragging:bg-control-hover", "has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-0 has-[:focus-visible]:outline-control-focus", "data-disabled:cursor-not-allowed") }, index))), children] }) })] }, resetKey));
|
|
129
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import { Collapsible, type CollapsibleTriggerProps } from "./collapsible.js";
|
|
3
|
+
/**
|
|
4
|
+
* Sources — the pages an answer drew on, folded under a mono trigger ("Used 3 sources").
|
|
5
|
+
* Each `Source` is a row with the site in mono and the page title, opening in a new tab.
|
|
6
|
+
*
|
|
7
|
+
* The rule people break: listing sources the answer did not use. Show what the model actually
|
|
8
|
+
* cited, in the order it cited them.
|
|
9
|
+
*/
|
|
10
|
+
export declare function Sources({ className, ...props }: React.ComponentProps<typeof Collapsible>): React.JSX.Element;
|
|
11
|
+
export interface SourcesTriggerProps extends CollapsibleTriggerProps {
|
|
12
|
+
/** How many sources there are; the default label reads "Used n sources". */
|
|
13
|
+
count: number;
|
|
14
|
+
}
|
|
15
|
+
/** "Used n sources", with a chevron. Children replace the label. */
|
|
16
|
+
export declare function SourcesTrigger({ count, children, ...props }: SourcesTriggerProps): React.JSX.Element;
|
|
17
|
+
/** The list of `Source`s. */
|
|
18
|
+
export declare function SourcesContent({ className, children, ...props }: React.ComponentProps<"ul">): React.JSX.Element;
|
|
19
|
+
export interface SourceProps extends Omit<React.ComponentProps<"a">, "title"> {
|
|
20
|
+
href: string;
|
|
21
|
+
/** The page title. Defaults to the address. */
|
|
22
|
+
title?: React.ReactNode;
|
|
23
|
+
}
|
|
24
|
+
/** One source: the site in mono, the title, and an arrow; it opens in a new tab. */
|
|
25
|
+
export declare function Source({ href, title, className, children, ...props }: SourceProps): React.JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ArrowUpRightIcon } from "lucide-react";
|
|
4
|
+
import { cn, sx } from "../lib/cn.js";
|
|
5
|
+
import { Collapsible, CollapsiblePanel, CollapsibleTrigger, } from "./collapsible.js";
|
|
6
|
+
/**
|
|
7
|
+
* Sources — the pages an answer drew on, folded under a mono trigger ("Used 3 sources").
|
|
8
|
+
* Each `Source` is a row with the site in mono and the page title, opening in a new tab.
|
|
9
|
+
*
|
|
10
|
+
* The rule people break: listing sources the answer did not use. Show what the model actually
|
|
11
|
+
* cited, in the order it cited them.
|
|
12
|
+
*/
|
|
13
|
+
export function Sources({ className, ...props }) {
|
|
14
|
+
return _jsx(Collapsible, { "data-slot": "sources", className: sx("gap-1", className), ...props });
|
|
15
|
+
}
|
|
16
|
+
/** "Used n sources", with a chevron. Children replace the label. */
|
|
17
|
+
export function SourcesTrigger({ count, children, ...props }) {
|
|
18
|
+
return (_jsx(CollapsibleTrigger, { "data-slot": "sources-trigger", ...props, children: children ?? `Used ${count} ${count === 1 ? "source" : "sources"}` }));
|
|
19
|
+
}
|
|
20
|
+
/** The list of `Source`s. */
|
|
21
|
+
export function SourcesContent({ className, children, ...props }) {
|
|
22
|
+
return (_jsx(CollapsiblePanel, { "data-slot": "sources-content", children: _jsx("ul", { className: cn("m-0 flex list-none flex-col gap-0.5 p-0 pt-1", className), ...props, children: children }) }));
|
|
23
|
+
}
|
|
24
|
+
const hostOf = (href) => {
|
|
25
|
+
try {
|
|
26
|
+
return new URL(href).hostname.replace(/^www\./, "");
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return href;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
/** One source: the site in mono, the title, and an arrow; it opens in a new tab. */
|
|
33
|
+
export function Source({ href, title, className, children, ...props }) {
|
|
34
|
+
return (_jsx("li", { "data-slot": "source", children: _jsxs("a", { href: href, target: "_blank", rel: "noopener noreferrer", className: cn("flex min-h-(--control-h-sm) min-w-0 items-center gap-3 rounded-item material-row px-2.5 text-[13px] no-underline focus-ring", className), ...props, children: [_jsx("span", { className: "w-32 shrink-0 truncate font-mono text-[11px] text-muted-foreground", children: hostOf(href) }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: children ?? title ?? href }), _jsx(ArrowUpRightIcon, { "aria-hidden": true, className: "size-3.5 shrink-0 text-muted-foreground" }), _jsx("span", { className: "sr-only", children: "(opens in a new tab)" })] }) }));
|
|
35
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type ComponentProps } from "react";
|
|
2
|
+
declare const spinnerSizes: {
|
|
3
|
+
readonly sm: "size-3 text-[12px]";
|
|
4
|
+
readonly default: "size-4 text-[16px]";
|
|
5
|
+
readonly lg: "size-5 text-[20px]";
|
|
6
|
+
};
|
|
7
|
+
export type SpinnerSize = keyof typeof spinnerSizes;
|
|
8
|
+
export type SpinnerVariant = "ring" | "arc" | "dots" | "bars" | "pulse" | "orbit" | "grid" | "cursor" | "ascii" | "brackets" | "crescent";
|
|
9
|
+
/** Every variant, in gallery order. */
|
|
10
|
+
export declare const SPINNER_VARIANTS: readonly SpinnerVariant[];
|
|
11
|
+
export interface SpinnerProps extends Omit<ComponentProps<"span">, "children"> {
|
|
12
|
+
/**
|
|
13
|
+
* The face. `ring` (default) a turning `LoaderCircle` · `arc` a progress-ring arc that grows
|
|
14
|
+
* and shrinks on a hairline track · `dots` three dots in sequence · `bars` an equaliser ·
|
|
15
|
+
* `pulse` a ring widening from a dot · `orbit` a dot circling a hairline · `grid` a 3×3 wave ·
|
|
16
|
+
* `cursor` a blinking terminal block · `ascii` `| / − \` in Licht Mono · `brackets` the
|
|
17
|
+
* logo's brackets opening and closing · `crescent` a moon waxing and waning.
|
|
18
|
+
*/
|
|
19
|
+
variant?: SpinnerVariant;
|
|
20
|
+
/** `sm` 12px · `default` 16px · `lg` 20px. */
|
|
21
|
+
size?: SpinnerSize;
|
|
22
|
+
/** The accessible name announced for the status. Say what is loading: "Sending message". */
|
|
23
|
+
label?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Spinner — an indeterminate loading indicator in the current ink, with `role="status"` and an
|
|
27
|
+
* accessible name.
|
|
28
|
+
*
|
|
29
|
+
* Eleven faces, all CSS-driven and monochrome: `ring` (default) for controls; `arc`, `dots`,
|
|
30
|
+
* `bars`, `pulse`, `orbit` and `grid` for panels and empty states; `cursor` and `ascii` for
|
|
31
|
+
* mono, technical surfaces; `brackets` and `crescent` as brand moments. Every face stands still
|
|
32
|
+
* under reduced motion. The rule people break: a spinner for work with a known length — use
|
|
33
|
+
* `Progress` when you can say how far along it is.
|
|
34
|
+
*/
|
|
35
|
+
export declare function Spinner({ variant, size, label, className, ...props }: SpinnerProps): import("react").JSX.Element;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { LoaderCircleIcon } from "lucide-react";
|
|
4
|
+
import { useId } from "react";
|
|
5
|
+
import { cn } from "../lib/cn.js";
|
|
6
|
+
import { bracketGeometry } from "../lib/logo-geometry.js";
|
|
7
|
+
const spinnerSizes = {
|
|
8
|
+
sm: "size-3 text-[12px]",
|
|
9
|
+
default: "size-4 text-[16px]",
|
|
10
|
+
lg: "size-5 text-[20px]",
|
|
11
|
+
};
|
|
12
|
+
/** Every variant, in gallery order. */
|
|
13
|
+
export const SPINNER_VARIANTS = [
|
|
14
|
+
"ring",
|
|
15
|
+
"arc",
|
|
16
|
+
"dots",
|
|
17
|
+
"bars",
|
|
18
|
+
"pulse",
|
|
19
|
+
"orbit",
|
|
20
|
+
"grid",
|
|
21
|
+
"cursor",
|
|
22
|
+
"ascii",
|
|
23
|
+
"brackets",
|
|
24
|
+
"crescent",
|
|
25
|
+
];
|
|
26
|
+
/** The four frames of the ASCII spinner. All four are in the Licht Mono latin subset; the minus sign (U+2212) sits on the maths axis, centred, where a hyphen would sit low. */
|
|
27
|
+
const ASCII_FRAMES = ["|", "/", "−", "\\"];
|
|
28
|
+
function Svg({ children, viewBox = "0 0 24 24" }) {
|
|
29
|
+
return (_jsx("svg", { "aria-hidden": true, focusable: "false", viewBox: viewBox, fill: "currentColor", "data-slot": "spinner-art", className: "block size-full overflow-visible", children: children }));
|
|
30
|
+
}
|
|
31
|
+
/* The brackets at a 14-unit height, in a 24-unit square with room to open by 3 units a side. */
|
|
32
|
+
const BR = bracketGeometry(14);
|
|
33
|
+
const BR_X = (24 - (2 * BR.w + BR.gap)) / 2;
|
|
34
|
+
const BR_Y = (24 - BR.h) / 2;
|
|
35
|
+
function Art({ variant, maskId }) {
|
|
36
|
+
switch (variant) {
|
|
37
|
+
case "arc":
|
|
38
|
+
return (_jsxs(Svg, { children: [_jsx("circle", { cx: "12", cy: "12", r: "9", fill: "none", stroke: "currentColor", strokeWidth: "2.5", opacity: "0.2" }), _jsx("circle", { "data-part": "arc", cx: "12", cy: "12", r: "9", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", pathLength: 100 })] }));
|
|
39
|
+
case "dots":
|
|
40
|
+
return (_jsx(Svg, { children: [4.5, 12, 19.5].map((cx) => (_jsx("circle", { "data-part": "dot", cx: cx, cy: "12", r: "2.5" }, cx))) }));
|
|
41
|
+
case "bars":
|
|
42
|
+
return (_jsx(Svg, { children: [3, 8.5, 14, 19.5].map((x) => (_jsx("rect", { "data-part": "bar", x: x, y: "4", width: "2.5", height: "16", rx: "0.5" }, x))) }));
|
|
43
|
+
case "pulse":
|
|
44
|
+
return (_jsxs(Svg, { children: [_jsx("circle", { "data-part": "ripple", cx: "12", cy: "12", r: "10", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }), _jsx("circle", { "data-part": "ripple", cx: "12", cy: "12", r: "10", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }), _jsx("circle", { cx: "12", cy: "12", r: "3" })] }));
|
|
45
|
+
case "orbit":
|
|
46
|
+
return (_jsxs(Svg, { children: [_jsx("circle", { cx: "12", cy: "12", r: "9", fill: "none", stroke: "currentColor", strokeWidth: "1.5", opacity: "0.25" }), _jsx("g", { "data-part": "satellite", children: _jsx("circle", { cx: "12", cy: "3", r: "3" }) })] }));
|
|
47
|
+
case "grid":
|
|
48
|
+
return (_jsx(Svg, { children: [0, 1, 2].flatMap((row) => [0, 1, 2].map((col) => (_jsx("rect", { "data-part": "cell", x: 2 + col * 7.5, y: 2 + row * 7.5, width: "5", height: "5", rx: "0.75", style: { animationDelay: `${(row + col) * 0.1}s` } }, `${row}${col}`)))) }));
|
|
49
|
+
case "cursor":
|
|
50
|
+
return (_jsx(Svg, { children: _jsx("rect", { "data-part": "caret", x: "7.5", y: "3", width: "9", height: "18" }) }));
|
|
51
|
+
case "brackets":
|
|
52
|
+
return (_jsx(Svg, { children: _jsxs("g", { transform: `translate(${BR_X} ${BR_Y})`, children: [_jsx("g", { "data-part": "bracket-left", children: BR.left.map(([x, y, w, h]) => (_jsx("rect", { x: x, y: y, width: w, height: h }, `${x},${y}`))) }), _jsx("g", { transform: `translate(${BR.w + BR.gap} 0)`, children: _jsx("g", { "data-part": "bracket-right", children: BR.right.map(([x, y, w, h]) => (_jsx("rect", { x: x, y: y, width: w, height: h }, `${x},${y}`))) }) })] }) }));
|
|
53
|
+
case "crescent":
|
|
54
|
+
return (_jsxs(Svg, { children: [_jsx("defs", { children: _jsxs("mask", { id: maskId, maskUnits: "userSpaceOnUse", x: "0", y: "0", width: "24", height: "24", children: [_jsx("rect", { width: "24", height: "24", fill: "white" }), _jsx("circle", { "data-part": "shadow", cx: "12", cy: "12", r: "9.5", fill: "black" })] }) }), _jsxs("g", { transform: "rotate(-14 12 12)", children: [_jsx("circle", { cx: "12", cy: "12", r: "9", fill: "none", stroke: "currentColor", strokeWidth: "1", opacity: "0.3" }), _jsx("circle", { cx: "12", cy: "12", r: "9", mask: `url(#${maskId})` })] })] }));
|
|
55
|
+
default:
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Spinner — an indeterminate loading indicator in the current ink, with `role="status"` and an
|
|
61
|
+
* accessible name.
|
|
62
|
+
*
|
|
63
|
+
* Eleven faces, all CSS-driven and monochrome: `ring` (default) for controls; `arc`, `dots`,
|
|
64
|
+
* `bars`, `pulse`, `orbit` and `grid` for panels and empty states; `cursor` and `ascii` for
|
|
65
|
+
* mono, technical surfaces; `brackets` and `crescent` as brand moments. Every face stands still
|
|
66
|
+
* under reduced motion. The rule people break: a spinner for work with a known length — use
|
|
67
|
+
* `Progress` when you can say how far along it is.
|
|
68
|
+
*/
|
|
69
|
+
export function Spinner({ variant = "ring", size = "default", label = "Loading", className, ...props }) {
|
|
70
|
+
const maskId = `ep-spinner-${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`;
|
|
71
|
+
return (_jsx("span", { role: "status", "aria-label": label, "data-slot": "spinner", "data-variant": variant, "data-size": size, className: cn("inline-flex shrink-0 items-center justify-center align-middle text-current", spinnerSizes[size], className), ...props, children: variant === "ring" ? (_jsx(LoaderCircleIcon, { "aria-hidden": true, className: "size-full animate-spin motion-reduce:animate-none" })) : variant === "ascii" ? (_jsxs("span", { "aria-hidden": true, className: "block h-[1em] w-[1ch] overflow-hidden text-center font-mono leading-none", children: [_jsx("span", { "data-slot": "spinner-frames", className: "flex flex-col motion-reduce:hidden", children: ASCII_FRAMES.map((frame) => (_jsx("span", { className: "block h-[1em]", children: frame }, frame))) }), _jsx("span", { className: "hidden h-[1em] motion-reduce:block", children: "\u2026" })] })) : (_jsx(Art, { variant: variant, maskId: maskId })) }));
|
|
72
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import { type ButtonProps } from "./button.js";
|
|
3
|
+
/**
|
|
4
|
+
* Suggestions — a row of prompts to start from or follow up with, as small raised buttons that
|
|
5
|
+
* wrap onto the next line. Picking one usually sends it, or fills the prompt bar.
|
|
6
|
+
*
|
|
7
|
+
* The rule people break: more than four. Suggestions are a nudge, not a menu; and write them as
|
|
8
|
+
* the person would ask, not as feature names.
|
|
9
|
+
*/
|
|
10
|
+
export declare function Suggestions({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
11
|
+
export interface SuggestionProps extends Omit<ButtonProps, "onClick" | "children" | "variant" | "size"> {
|
|
12
|
+
/** The prompt, as the person would write it. */
|
|
13
|
+
suggestion: string;
|
|
14
|
+
/** Called with the suggestion when it is picked. */
|
|
15
|
+
onClick?: (suggestion: string) => void;
|
|
16
|
+
/** A shorter label than the prompt, when it needs one. */
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
}
|
|
19
|
+
/** One suggested prompt: a 30px raised button. */
|
|
20
|
+
export declare function Suggestion({ suggestion, onClick, children, className, ...props }: SuggestionProps): React.JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
import { Button } from "./button.js";
|
|
5
|
+
/**
|
|
6
|
+
* Suggestions — a row of prompts to start from or follow up with, as small raised buttons that
|
|
7
|
+
* wrap onto the next line. Picking one usually sends it, or fills the prompt bar.
|
|
8
|
+
*
|
|
9
|
+
* The rule people break: more than four. Suggestions are a nudge, not a menu; and write them as
|
|
10
|
+
* the person would ask, not as feature names.
|
|
11
|
+
*/
|
|
12
|
+
export function Suggestions({ className, ...props }) {
|
|
13
|
+
return _jsx("div", { "data-slot": "suggestions", className: cn("flex flex-wrap gap-2", className), ...props });
|
|
14
|
+
}
|
|
15
|
+
/** One suggested prompt: a 30px raised button. */
|
|
16
|
+
export function Suggestion({ suggestion, onClick, children, className, ...props }) {
|
|
17
|
+
return (_jsx(Button, { "data-slot": "suggestion", type: "button", variant: "secondary", size: "sm", onClick: () => onClick?.(suggestion), className: cn("max-w-full font-normal", className), ...props, children: _jsx("span", { className: "truncate", children: children ?? suggestion }) }));
|
|
18
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Switch as BaseSwitch } from "@base-ui/react/switch";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export interface SwitchProps extends BaseSwitch.Root.Props {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Switch — a setting that takes effect immediately: a recessed track with a raised round thumb.
|
|
7
|
+
* On, the track takes the primary fill. Hover stretches the thumb, a press stretches it further,
|
|
8
|
+
* and it slides across (size and travel live in parts/controls.css).
|
|
9
|
+
*
|
|
10
|
+
* Use a switch when flipping it changes something right away (notifications, a preview mode).
|
|
11
|
+
* The rule people break: using a switch inside a form that still needs "Save" — that is a
|
|
12
|
+
* `Checkbox`. Always pair it with a visible label (`<FieldLabel><Switch />Label</FieldLabel>`).
|
|
13
|
+
*/
|
|
14
|
+
export declare function Switch({ className, ref, ...props }: SwitchProps): React.JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Switch as BaseSwitch } from "@base-ui/react/switch";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { sx } from "../lib/cn.js";
|
|
6
|
+
import { useFormReset } from "../lib/form-reset.js";
|
|
7
|
+
import { mergeRefs } from "../lib/merge-refs.js";
|
|
8
|
+
/**
|
|
9
|
+
* Switch — a setting that takes effect immediately: a recessed track with a raised round thumb.
|
|
10
|
+
* On, the track takes the primary fill. Hover stretches the thumb, a press stretches it further,
|
|
11
|
+
* and it slides across (size and travel live in parts/controls.css).
|
|
12
|
+
*
|
|
13
|
+
* Use a switch when flipping it changes something right away (notifications, a preview mode).
|
|
14
|
+
* The rule people break: using a switch inside a form that still needs "Save" — that is a
|
|
15
|
+
* `Checkbox`. Always pair it with a visible label (`<FieldLabel><Switch />Label</FieldLabel>`).
|
|
16
|
+
*/
|
|
17
|
+
export function Switch({ className, ref, ...props }) {
|
|
18
|
+
// A form's reset remounts it from its defaults (lib/form-reset).
|
|
19
|
+
const [resetKey, formRef] = useFormReset();
|
|
20
|
+
const refs = React.useMemo(() => mergeRefs(formRef, ref), [formRef, ref]);
|
|
21
|
+
return (_jsx(BaseSwitch.Root, { ref: refs, "data-slot": "switch", className: sx([
|
|
22
|
+
"relative inline-flex h-[22px] w-[38px] shrink-0 material-field cursor-pointer items-center rounded-full p-px",
|
|
23
|
+
"data-checked:border-transparent data-checked:bg-primary data-checked:bg-none data-checked:shadow-checked",
|
|
24
|
+
"data-readonly:cursor-default",
|
|
25
|
+
], className), ...props, children: _jsx(BaseSwitch.Thumb, { "data-slot": "switch-thumb", className: "pointer-events-none block rounded-full bg-(--control-thumb) bg-linear-to-b from-control-inner-edge to-transparent shadow-thumb data-checked:bg-(--control-thumb-on)" }) }, resetKey));
|
|
26
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface TableProps extends React.ComponentProps<"table"> {
|
|
3
|
+
/** 30px rows for data-heavy screens (admin, dashboards). Default rows are 46px. */
|
|
4
|
+
dense?: boolean;
|
|
5
|
+
/**
|
|
6
|
+
* `card` (default): the table as an object, a 20px card. `plain`: the same table without the
|
|
7
|
+
* card — no edge, corners, shadow or ground — across the full width of its column. Always
|
|
8
|
+
* `plain` inside a `Card`, a `Dialog` or a `Drawer`: never a card in a card.
|
|
9
|
+
*/
|
|
10
|
+
variant?: "card" | "plain";
|
|
11
|
+
/** Props for the container that wraps and scrolls the table (the card, unless `plain`). */
|
|
12
|
+
containerProps?: React.ComponentProps<"div">;
|
|
13
|
+
/**
|
|
14
|
+
* Fit the columns to the container's width. When the widest title no longer fits on one line,
|
|
15
|
+
* columns step out one at a time by their `TableHead`'s `priority` — or, with `inline`, move
|
|
16
|
+
* into the title cell, right after the title — and every cell glides to its new place.
|
|
17
|
+
*/
|
|
18
|
+
fit?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Table — tabular data as an **object**: a 20px card in the `surface-card` material that
|
|
22
|
+
* scrolls horizontally when the columns do not fit. Rows are separated by hairlines and take
|
|
23
|
+
* a subtle `--control-hover` on hover; headers are eyebrows; numbers are mono and tabular.
|
|
24
|
+
*
|
|
25
|
+
* The card's padding is carried by the cells so rules and hover run edge to edge — do not
|
|
26
|
+
* pad the table at the call site. `variant="plain"` is the same table without the card, for
|
|
27
|
+
* tables that are part of the page rather than an object on it. The rule people break: zebra
|
|
28
|
+
* stripes, vertical rules or a second border around the table. Hairlines between rows are the whole grid.
|
|
29
|
+
*
|
|
30
|
+
* With `fit`, the columns follow the **container's** width instead of scrolling: see `fit`.
|
|
31
|
+
*/
|
|
32
|
+
export declare function Table({ fit, ...props }: TableProps): React.JSX.Element;
|
|
33
|
+
export declare function TableHeader({ className, ...props }: React.ComponentProps<"thead">): React.JSX.Element;
|
|
34
|
+
export declare function TableBody({ className, ...props }: React.ComponentProps<"tbody">): React.JSX.Element;
|
|
35
|
+
export declare function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">): React.JSX.Element;
|
|
36
|
+
/**
|
|
37
|
+
* A row. Mark a selected row with `aria-selected` / `data-selected`.
|
|
38
|
+
*
|
|
39
|
+
* In a fitting table its cells follow the header's columns by position — give it one cell per
|
|
40
|
+
* column, as direct children — and it draws them where the layout says: in their own column,
|
|
41
|
+
* inline after the title, or only for screen readers.
|
|
42
|
+
*/
|
|
43
|
+
export declare function TableRow({ className, children, ref, ...props }: React.ComponentProps<"tr">): React.JSX.Element;
|
|
44
|
+
export interface TableHeadProps extends Omit<React.ComponentProps<"th">, "align" | "width"> {
|
|
45
|
+
/** Right-align a numeric column's header (and, with `fit`, its cells). */
|
|
46
|
+
numeric?: boolean;
|
|
47
|
+
/** `end` right-aligns the column without setting it in mono — people, dates. Defaults by `numeric`. */
|
|
48
|
+
align?: "start" | "end";
|
|
49
|
+
/** The column's width: a CSS length, or with `fit` a grid track (`auto`, `6rem`, `minmax(…)`). */
|
|
50
|
+
width?: string;
|
|
51
|
+
/**
|
|
52
|
+
* With `fit`: when the titles no longer fit on one line, columns step out one at a time,
|
|
53
|
+
* lowest `priority` first (on a tie, the later column first). A column with no `priority`,
|
|
54
|
+
* `inline` or `minWidth` never steps out.
|
|
55
|
+
*/
|
|
56
|
+
priority?: number;
|
|
57
|
+
/** With `fit`: when the column steps out, show its cells inline after the title instead of hiding them. */
|
|
58
|
+
inline?: boolean;
|
|
59
|
+
/** With `fit`: below this container width (rem) the column steps out even if it would still fit. */
|
|
60
|
+
minWidth?: number;
|
|
61
|
+
/** With `fit`: the column that names each row and never steps out. Defaults to the first column. */
|
|
62
|
+
titleColumn?: boolean;
|
|
63
|
+
}
|
|
64
|
+
/** A column header, set as an eyebrow: 12px mono, uppercase, 0.18em tracking, muted. */
|
|
65
|
+
export declare function TableHead({ numeric, align, width, priority, inline, minWidth, titleColumn, className, style, ...props }: TableHeadProps): React.JSX.Element;
|
|
66
|
+
export interface TableCellProps extends React.ComponentProps<"td"> {
|
|
67
|
+
/** Numbers, amounts, dates and IDs: Licht Mono, tabular figures, right-aligned. */
|
|
68
|
+
numeric?: boolean;
|
|
69
|
+
}
|
|
70
|
+
export declare function TableCell({ numeric, className, ...props }: TableCellProps): React.JSX.Element;
|
|
71
|
+
export interface TableGroupProps extends React.ComponentProps<"tbody"> {
|
|
72
|
+
/** Controlled open state. */
|
|
73
|
+
open?: boolean;
|
|
74
|
+
/** Open at first. Defaults to `true`. */
|
|
75
|
+
defaultOpen?: boolean;
|
|
76
|
+
/** Called when the group header's trigger opens or closes the group. */
|
|
77
|
+
onOpenChange?: (open: boolean) => void;
|
|
78
|
+
/** Let the header open and close the group. Defaults to `true`. */
|
|
79
|
+
collapsible?: boolean;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* TableGroup — one group of rows: a `<tbody>` that starts with a `TableGroupHeader` and holds
|
|
83
|
+
* ordinary `TableRow`s. Use several in place of a single `TableBody`.
|
|
84
|
+
*
|
|
85
|
+
* Groups answer "which rows belong together" (by status, by owner, by month). The rule people
|
|
86
|
+
* break: grouping by something every row shares, or into groups of one. If most groups would
|
|
87
|
+
* hold a single row, sort the column instead.
|
|
88
|
+
*/
|
|
89
|
+
export declare function TableGroup({ open: openProp, defaultOpen, onOpenChange, collapsible, className, ...props }: TableGroupProps): React.JSX.Element;
|
|
90
|
+
export interface TableGroupHeaderProps extends Omit<React.ComponentProps<"tr">, "children"> {
|
|
91
|
+
/** The group's label: the shared value ("Running"), or a `Tag` for a status. */
|
|
92
|
+
children: React.ReactNode;
|
|
93
|
+
/** A 16px lucide icon before the label. */
|
|
94
|
+
icon?: React.ReactNode;
|
|
95
|
+
/** How many rows the group holds, shown in mono after the label. */
|
|
96
|
+
count?: React.ReactNode;
|
|
97
|
+
/** A short mono summary at the end of the row, e.g. a total. */
|
|
98
|
+
summary?: React.ReactNode;
|
|
99
|
+
/** Columns the header spans. Pass the table's column count. Defaults to 100. */
|
|
100
|
+
colSpan?: number;
|
|
101
|
+
/** Stick to the top of the table's scroll area while the group's rows scroll under it. */
|
|
102
|
+
sticky?: boolean;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* The first row of a `TableGroup`: a full-width band with the label, a mono count and an
|
|
106
|
+
* optional summary. When the group is collapsible the label is a button with a chevron that
|
|
107
|
+
* opens and closes the group (`aria-expanded`).
|
|
108
|
+
*
|
|
109
|
+
* `sticky` pins the header to the top of the table card while its rows scroll — give the
|
|
110
|
+
* card a height (`containerProps={{ className: "max-h-96" }}`) so the card itself scrolls.
|
|
111
|
+
*/
|
|
112
|
+
export declare function TableGroupHeader({ icon, count, summary, colSpan, sticky, className, children, ref, ...props }: TableGroupHeaderProps): React.JSX.Element;
|
|
113
|
+
export interface TableVirtualGroup<TRow> {
|
|
114
|
+
/** Stable and unique among the groups. */
|
|
115
|
+
key: React.Key;
|
|
116
|
+
/** The group's first row: a `TableGroupHeader`. */
|
|
117
|
+
header: React.ReactNode;
|
|
118
|
+
rows: readonly TRow[];
|
|
119
|
+
/** Controlled open state. */
|
|
120
|
+
open?: boolean;
|
|
121
|
+
/** Open at first. Defaults to `true`. */
|
|
122
|
+
defaultOpen?: boolean;
|
|
123
|
+
/** Called when the header's trigger opens or closes the group. */
|
|
124
|
+
onOpenChange?: (open: boolean) => void;
|
|
125
|
+
/** Let the header open and close the group. Defaults to `true`. */
|
|
126
|
+
collapsible?: boolean;
|
|
127
|
+
}
|
|
128
|
+
export interface TableVirtualBodyProps<TRow> {
|
|
129
|
+
/** The rows, for a body without groups. */
|
|
130
|
+
rows?: readonly TRow[];
|
|
131
|
+
/** Groups of rows, in place of `rows`. Each opens with its header; a closed one keeps only it. */
|
|
132
|
+
groups?: readonly TableVirtualGroup<TRow>[];
|
|
133
|
+
/**
|
|
134
|
+
* Renders one row: a `TableRow` with its cells. `index` is the row's place in `rows` (or in its
|
|
135
|
+
* group), and -1 for one of `sizeRows` that is in neither.
|
|
136
|
+
*/
|
|
137
|
+
renderRow: (row: TRow, index: number) => React.ReactNode;
|
|
138
|
+
/** A stable key per row, such as its id: a row keeps its element and measured height when rows sort. Defaults to the index. */
|
|
139
|
+
getRowKey?: (row: TRow, index: number) => React.Key;
|
|
140
|
+
/**
|
|
141
|
+
* The rows that size the columns. They are rendered out of view, so columns keep their width
|
|
142
|
+
* while the other rows scroll in and out. Defaults to the two rows with the longest value in each
|
|
143
|
+
* field, and the two longest in all.
|
|
144
|
+
*/
|
|
145
|
+
sizeRows?: readonly TRow[];
|
|
146
|
+
/** Rows rendered beyond each edge of the view. Defaults to 8. */
|
|
147
|
+
overscan?: number;
|
|
148
|
+
/** When it changes, a table scrolled past its first row scrolls back to it: pass the search text. */
|
|
149
|
+
scrollResetKey?: unknown;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* TableVirtualBody — the body of a table with thousands of rows, in place of `TableBody` (or the
|
|
153
|
+
* `TableGroup`s): it renders only the rows in view and a few beyond, and the space of the others,
|
|
154
|
+
* as the table's own box or the page scrolls. Pass the rows and how to render one; the rows can be
|
|
155
|
+
* grouped, and work in every Table mode (`dense`, `fit`, sticky group headers).
|
|
156
|
+
*
|
|
157
|
+
* Use it from a few hundred rows on. The rule people break: reaching for it for a page of rows —
|
|
158
|
+
* rows that are not rendered can't be found with the browser's search or printed.
|
|
159
|
+
*/
|
|
160
|
+
export declare function TableVirtualBody<TRow>({ rows, groups, renderRow, getRowKey, sizeRows, overscan, scrollResetKey, }: TableVirtualBodyProps<TRow>): React.JSX.Element;
|
|
161
|
+
/** A short description of the table, under it. Prefer it over a heading inside the card. */
|
|
162
|
+
export declare function TableCaption({ className, ...props }: React.ComponentProps<"caption">): React.JSX.Element;
|