@tulipfarm/sprout 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 +183 -2
- package/dist/components/accordion.d.ts +28 -0
- package/dist/components/accordion.js +26 -0
- package/dist/components/alert-dialog.d.ts +60 -0
- package/dist/components/alert-dialog.js +69 -0
- package/dist/components/alert.d.ts +30 -0
- package/dist/components/alert.js +35 -0
- package/dist/components/aspect-ratio.d.ts +7 -0
- package/dist/components/aspect-ratio.js +6 -0
- package/dist/components/attachment.d.ts +118 -0
- package/dist/components/attachment.js +285 -0
- package/dist/components/avatar.d.ts +32 -0
- package/dist/components/avatar.js +73 -0
- package/dist/components/badge.d.ts +21 -0
- package/dist/components/badge.js +27 -0
- package/dist/components/brand-icon.d.ts +28 -0
- package/dist/components/brand-icon.js +82 -0
- package/dist/components/breadcrumb.d.ts +29 -0
- package/dist/components/breadcrumb.js +44 -0
- package/dist/components/button-group.d.ts +28 -0
- package/dist/components/button-group.js +36 -0
- package/dist/components/button.d.ts +79 -0
- package/dist/components/button.js +93 -0
- package/dist/components/calendar.d.ts +27 -0
- package/dist/components/calendar.js +107 -0
- package/dist/components/canvas.d.ts +78 -0
- package/dist/components/canvas.js +180 -0
- package/dist/components/card.d.ts +43 -0
- package/dist/components/card.js +42 -0
- package/dist/components/carousel.d.ts +57 -0
- package/dist/components/carousel.js +422 -0
- package/dist/components/chart.d.ts +112 -0
- package/dist/components/chart.js +172 -0
- package/dist/components/chat-confirmation.d.ts +42 -0
- package/dist/components/chat-confirmation.js +62 -0
- package/dist/components/chat-input.d.ts +94 -0
- package/dist/components/chat-input.js +279 -0
- package/dist/components/chat-plan.d.ts +21 -0
- package/dist/components/chat-plan.js +35 -0
- package/dist/components/chat-sources.d.ts +64 -0
- package/dist/components/chat-sources.js +66 -0
- package/dist/components/checkbox.d.ts +16 -0
- package/dist/components/checkbox.js +17 -0
- package/dist/components/choice-list.d.ts +53 -0
- package/dist/components/choice-list.js +36 -0
- package/dist/components/code-block.d.ts +35 -0
- package/dist/components/code-block.js +64 -0
- package/dist/components/collapsible.d.ts +24 -0
- package/dist/components/collapsible.js +27 -0
- package/dist/components/combobox.d.ts +95 -0
- package/dist/components/combobox.js +106 -0
- package/dist/components/command.d.ts +94 -0
- package/dist/components/command.js +414 -0
- package/dist/components/context-menu.d.ts +57 -0
- package/dist/components/context-menu.js +60 -0
- package/dist/components/dialog.d.ts +60 -0
- package/dist/components/dialog.js +79 -0
- package/dist/components/direction.d.ts +6 -0
- package/dist/components/direction.js +6 -0
- package/dist/components/dropdown-menu.d.ts +62 -0
- package/dist/components/dropdown-menu.js +59 -0
- package/dist/components/field.d.ts +117 -0
- package/dist/components/field.js +150 -0
- package/dist/components/file-explorer.d.ts +27 -0
- package/dist/components/file-explorer.js +300 -0
- package/dist/components/file-viewer.d.ts +137 -0
- package/dist/components/file-viewer.js +400 -0
- package/dist/components/form.d.ts +87 -0
- package/dist/components/form.js +55 -0
- package/dist/components/glass-banner.d.ts +27 -0
- package/dist/components/glass-banner.js +116 -0
- package/dist/components/gradient-banner.d.ts +37 -0
- package/dist/components/gradient-banner.js +43 -0
- package/dist/components/hover-card.d.ts +27 -0
- package/dist/components/hover-card.js +26 -0
- package/dist/components/input-group.d.ts +68 -0
- package/dist/components/input-group.js +88 -0
- package/dist/components/input-otp.d.ts +38 -0
- package/dist/components/input-otp.js +43 -0
- package/dist/components/input.d.ts +16 -0
- package/dist/components/input.js +18 -0
- package/dist/components/kbd.d.ts +12 -0
- package/dist/components/kbd.js +11 -0
- package/dist/components/label.d.ts +8 -0
- package/dist/components/label.js +10 -0
- package/dist/components/mention-list.d.ts +54 -0
- package/dist/components/mention-list.js +31 -0
- package/dist/components/menubar.d.ts +64 -0
- package/dist/components/menubar.js +68 -0
- package/dist/components/message-actions.d.ts +34 -0
- package/dist/components/message-actions.js +68 -0
- package/dist/components/message-response.d.ts +20 -0
- package/dist/components/message-response.js +46 -0
- package/dist/components/message-scroller.d.ts +71 -0
- package/dist/components/message-scroller.js +217 -0
- package/dist/components/message.d.ts +49 -0
- package/dist/components/message.js +59 -0
- package/dist/components/navigation-menu.d.ts +45 -0
- package/dist/components/navigation-menu.js +54 -0
- package/dist/components/notice-banner.d.ts +14 -0
- package/dist/components/notice-banner.js +11 -0
- package/dist/components/page-content.d.ts +7 -0
- package/dist/components/page-content.js +9 -0
- package/dist/components/page-header.d.ts +37 -0
- package/dist/components/page-header.js +53 -0
- package/dist/components/pagination.d.ts +29 -0
- package/dist/components/pagination.js +29 -0
- package/dist/components/plan-outline.d.ts +60 -0
- package/dist/components/plan-outline.js +108 -0
- package/dist/components/popover.d.ts +34 -0
- package/dist/components/popover.js +35 -0
- package/dist/components/progress.d.ts +27 -0
- package/dist/components/progress.js +35 -0
- package/dist/components/prompt-list.d.ts +23 -0
- package/dist/components/prompt-list.js +11 -0
- package/dist/components/questionnaire.d.ts +148 -0
- package/dist/components/questionnaire.js +1002 -0
- package/dist/components/radio-group.d.ts +16 -0
- package/dist/components/radio-group.js +21 -0
- package/dist/components/reasoning-effort.d.ts +24 -0
- package/dist/components/reasoning-effort.js +269 -0
- package/dist/components/resizable.d.ts +67 -0
- package/dist/components/resizable.js +536 -0
- package/dist/components/result-card.d.ts +58 -0
- package/dist/components/result-card.js +88 -0
- package/dist/components/review-card.d.ts +62 -0
- package/dist/components/review-card.js +49 -0
- package/dist/components/rich-text-editor.d.ts +51 -0
- package/dist/components/rich-text-editor.js +248 -0
- package/dist/components/schema-diagram.d.ts +52 -0
- package/dist/components/schema-diagram.js +226 -0
- package/dist/components/scroll-area.d.ts +22 -0
- package/dist/components/scroll-area.js +19 -0
- package/dist/components/search-dialog.d.ts +103 -0
- package/dist/components/search-dialog.js +65 -0
- package/dist/components/search-field.d.ts +17 -0
- package/dist/components/search-field.js +27 -0
- package/dist/components/select.d.ts +57 -0
- package/dist/components/select.js +57 -0
- package/dist/components/selection-slot.d.ts +18 -0
- package/dist/components/selection-slot.js +53 -0
- package/dist/components/separator.d.ts +48 -0
- package/dist/components/separator.js +54 -0
- package/dist/components/settings-list.d.ts +26 -0
- package/dist/components/settings-list.js +17 -0
- package/dist/components/sheet.d.ts +70 -0
- package/dist/components/sheet.js +77 -0
- package/dist/components/sidebar.d.ts +70 -0
- package/dist/components/sidebar.js +187 -0
- package/dist/components/skeleton.d.ts +31 -0
- package/dist/components/skeleton.js +32 -0
- package/dist/components/slider.d.ts +17 -0
- package/dist/components/slider.js +24 -0
- package/dist/components/spinner.d.ts +37 -0
- package/dist/components/spinner.js +43 -0
- package/dist/components/state-panel-samples.d.ts +25 -0
- package/dist/components/state-panel-samples.js +423 -0
- package/dist/components/state-panel.d.ts +35 -0
- package/dist/components/state-panel.js +29 -0
- package/dist/components/state-sample.d.ts +63 -0
- package/dist/components/state-sample.js +42 -0
- package/dist/components/switch.d.ts +12 -0
- package/dist/components/switch.js +14 -0
- package/dist/components/table-nuqs.d.ts +16 -0
- package/dist/components/table-nuqs.js +59 -0
- package/dist/components/table.d.ts +120 -0
- package/dist/components/table.js +663 -0
- package/dist/components/tabs.d.ts +37 -0
- package/dist/components/tabs.js +36 -0
- package/dist/components/textarea.d.ts +18 -0
- package/dist/components/textarea.js +19 -0
- package/dist/components/toast.d.ts +45 -0
- package/dist/components/toast.js +83 -0
- package/dist/components/toggle-group.d.ts +30 -0
- package/dist/components/toggle-group.js +39 -0
- package/dist/components/toggle.d.ts +27 -0
- package/dist/components/toggle.js +21 -0
- package/dist/components/tool-activity.d.ts +79 -0
- package/dist/components/tool-activity.js +226 -0
- package/dist/components/toolbar-status.d.ts +21 -0
- package/dist/components/toolbar-status.js +14 -0
- package/dist/components/tooltip.d.ts +31 -0
- package/dist/components/tooltip.js +99 -0
- package/dist/components/typed-text.d.ts +17 -0
- package/dist/components/typed-text.js +56 -0
- package/dist/index.d.ts +90 -0
- package/dist/index.js +90 -0
- package/dist/internal/brand-glyphs.d.ts +370 -0
- package/dist/internal/brand-glyphs.js +262 -0
- package/dist/internal/classes.d.ts +3 -0
- package/dist/internal/classes.js +20 -0
- package/dist/internal/code-tokens.d.ts +4 -0
- package/dist/internal/code-tokens.js +34 -0
- package/dist/internal/fieldset.d.ts +6 -0
- package/dist/internal/fieldset.js +38 -0
- package/dist/internal/file-kind.d.ts +4 -0
- package/dist/internal/file-kind.js +62 -0
- package/dist/internal/languages.d.ts +7 -0
- package/dist/internal/languages.js +1010 -0
- package/dist/internal/message-scroller.d.ts +102 -0
- package/dist/internal/message-scroller.js +637 -0
- package/dist/internal/pressable.d.ts +2 -0
- package/dist/internal/pressable.js +29 -0
- package/dist/internal/syntax.d.ts +14 -0
- package/dist/internal/syntax.js +137 -0
- package/dist/styles/accordion.css +102 -0
- package/dist/styles/alert-dialog.css +198 -0
- package/dist/styles/alert.css +149 -0
- package/dist/styles/aspect-ratio.css +8 -0
- package/dist/styles/attachment.css +700 -0
- package/dist/styles/avatar.css +186 -0
- package/dist/styles/badge.css +178 -0
- package/dist/styles/brand-icon.css +104 -0
- package/dist/styles/breadcrumb.css +121 -0
- package/dist/styles/button-group.css +113 -0
- package/dist/styles/button.css +380 -0
- package/dist/styles/calendar.css +295 -0
- package/dist/styles/canvas.css +313 -0
- package/dist/styles/card.css +146 -0
- package/dist/styles/carousel.css +107 -0
- package/dist/styles/chart.css +227 -0
- package/dist/styles/chat-confirmation.css +29 -0
- package/dist/styles/chat-input.css +240 -0
- package/dist/styles/chat-plan.css +109 -0
- package/dist/styles/chat-sources.css +191 -0
- package/dist/styles/checkbox.css +122 -0
- package/dist/styles/choice-list.css +343 -0
- package/dist/styles/code-block.css +211 -0
- package/dist/styles/collapsible.css +72 -0
- package/dist/styles/combobox.css +347 -0
- package/dist/styles/command.css +233 -0
- package/dist/styles/context-menu.css +151 -0
- package/dist/styles/dialog.css +237 -0
- package/dist/styles/dropdown-menu.css +150 -0
- package/dist/styles/field.css +340 -0
- package/dist/styles/file-explorer.css +517 -0
- package/dist/styles/file-viewer.css +375 -0
- package/dist/styles/form.css +155 -0
- package/dist/styles/glass-banner.css +308 -0
- package/dist/styles/gradient-banner.css +256 -0
- package/dist/styles/hover-card.css +95 -0
- package/dist/styles/index.css +268 -0
- package/dist/styles/input-group.css +285 -0
- package/dist/styles/input-otp.css +138 -0
- package/dist/styles/input.css +98 -0
- package/dist/styles/kbd.css +59 -0
- package/dist/styles/label.css +89 -0
- package/dist/styles/mention-list.css +166 -0
- package/dist/styles/menubar.css +226 -0
- package/dist/styles/message-actions.css +83 -0
- package/dist/styles/message-response.css +176 -0
- package/dist/styles/message-scroller.css +136 -0
- package/dist/styles/message.css +310 -0
- package/dist/styles/navigation-menu.css +291 -0
- package/dist/styles/notice-banner.css +68 -0
- package/dist/styles/page-content.css +21 -0
- package/dist/styles/page-header.css +156 -0
- package/dist/styles/pagination.css +72 -0
- package/dist/styles/plan-outline.css +393 -0
- package/dist/styles/popover.css +140 -0
- package/dist/styles/progress.css +93 -0
- package/dist/styles/prompt-list.css +165 -0
- package/dist/styles/questionnaire.css +308 -0
- package/dist/styles/radio-group.css +119 -0
- package/dist/styles/reasoning-effort.css +157 -0
- package/dist/styles/resizable.css +108 -0
- package/dist/styles/result-card.css +215 -0
- package/dist/styles/review-card.css +235 -0
- package/dist/styles/rich-text-editor.css +169 -0
- package/dist/styles/schema-diagram.css +419 -0
- package/dist/styles/scroll-area.css +77 -0
- package/dist/styles/search-dialog.css +280 -0
- package/dist/styles/search-field.css +17 -0
- package/dist/styles/select.css +285 -0
- package/dist/styles/selection-slot.css +31 -0
- package/dist/styles/separator.css +206 -0
- package/dist/styles/settings-list.css +81 -0
- package/dist/styles/sheet.css +361 -0
- package/dist/styles/sidebar.css +363 -0
- package/dist/styles/skeleton.css +80 -0
- package/dist/styles/slider.css +142 -0
- package/dist/styles/spinner.css +39 -0
- package/dist/styles/state-panel-samples.css +41 -0
- package/dist/styles/state-panel.css +173 -0
- package/dist/styles/state-sample.css +285 -0
- package/dist/styles/switch.css +128 -0
- package/dist/styles/table.css +604 -0
- package/dist/styles/tabs.css +223 -0
- package/dist/styles/textarea.css +77 -0
- package/dist/styles/themes/chatgpt.css +125 -0
- package/dist/styles/themes/claude.css +125 -0
- package/dist/styles/themes/cloudflare.css +125 -0
- package/dist/styles/themes/discord.css +125 -0
- package/dist/styles/themes/github.css +125 -0
- package/dist/styles/themes/grok.css +125 -0
- package/dist/styles/themes/linear.css +126 -0
- package/dist/styles/themes/neutral.css +125 -0
- package/dist/styles/themes/notion.css +125 -0
- package/dist/styles/themes/perplexity.css +125 -0
- package/dist/styles/themes/raycast.css +125 -0
- package/dist/styles/themes/spotify.css +125 -0
- package/dist/styles/themes/stripe.css +125 -0
- package/dist/styles/themes/supabase.css +125 -0
- package/dist/styles/themes/tulipfarm.css +115 -0
- package/dist/styles/themes/vercel.css +126 -0
- package/dist/styles/toast.css +197 -0
- package/dist/styles/toggle-group.css +161 -0
- package/dist/styles/toggle.css +119 -0
- package/dist/styles/tool-activity.css +396 -0
- package/dist/styles/toolbar-status.css +52 -0
- package/dist/styles/tooltip.css +122 -0
- package/dist/styles/typed-text.css +17 -0
- package/package.json +452 -4
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { codeLanguageAliases, codeLanguageFilenames, } from "./languages.js";
|
|
2
|
+
const plain = new Set(["text", "txt", "plain", "plaintext"]);
|
|
3
|
+
/** The Shiki language for a file name, from its whole name or its extension. */
|
|
4
|
+
export function languageForFilename(name) {
|
|
5
|
+
const base = (name.split(/[\\/]/).at(-1) ?? "").toLowerCase();
|
|
6
|
+
const whole = codeLanguageFilenames[base];
|
|
7
|
+
if (whole)
|
|
8
|
+
return whole;
|
|
9
|
+
if (base.startsWith(".env."))
|
|
10
|
+
return "dotenv";
|
|
11
|
+
const dot = base.lastIndexOf(".");
|
|
12
|
+
return dot < 0 ? null : (codeLanguageAliases[base.slice(dot + 1)] ?? null);
|
|
13
|
+
}
|
|
14
|
+
/** Resolves a language name or alias, falling back to the file name. `null` means plain text. */
|
|
15
|
+
export function resolveCodeLanguage(language, filename) {
|
|
16
|
+
const key = language?.trim().toLowerCase();
|
|
17
|
+
if (key && plain.has(key))
|
|
18
|
+
return null;
|
|
19
|
+
const named = key ? codeLanguageAliases[key] : undefined;
|
|
20
|
+
return named ?? (filename ? languageForFilename(filename) : null);
|
|
21
|
+
}
|
|
22
|
+
/** Longer code renders as plain text, so one huge file cannot freeze the page. */
|
|
23
|
+
export const maxHighlightedLength = 200_000;
|
|
24
|
+
const role = (name) => `var(--sprout-syntax-token-${name})`;
|
|
25
|
+
// Shiki's CSS-variables theme leaves prose markup in the foreground color, so Markdown and diffs read as plain text.
|
|
26
|
+
const markupRules = [
|
|
27
|
+
{
|
|
28
|
+
scope: [
|
|
29
|
+
"markup.heading",
|
|
30
|
+
"entity.name.section",
|
|
31
|
+
"punctuation.definition.heading",
|
|
32
|
+
],
|
|
33
|
+
settings: { foreground: role("heading"), fontStyle: "bold" },
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
scope: [
|
|
37
|
+
"punctuation.definition.list.begin",
|
|
38
|
+
"beginning.punctuation.definition.list",
|
|
39
|
+
"punctuation.definition.list",
|
|
40
|
+
],
|
|
41
|
+
settings: { foreground: role("constant") },
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
scope: [
|
|
45
|
+
"punctuation.definition.bold",
|
|
46
|
+
"punctuation.definition.italic",
|
|
47
|
+
"punctuation.definition.strikethrough",
|
|
48
|
+
"punctuation.definition.quote.begin",
|
|
49
|
+
"meta.separator",
|
|
50
|
+
],
|
|
51
|
+
settings: { foreground: role("punctuation") },
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
scope: ["markup.quote"],
|
|
55
|
+
settings: { foreground: role("comment"), fontStyle: "italic" },
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
scope: ["markup.inline.raw", "markup.fenced_code", "markup.raw"],
|
|
59
|
+
settings: { foreground: role("string") },
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
scope: ["fenced_code.block.language"],
|
|
63
|
+
settings: { foreground: role("keyword") },
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
scope: ["markup.inserted", "punctuation.definition.inserted"],
|
|
67
|
+
settings: { foreground: role("inserted") },
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
scope: ["markup.deleted", "punctuation.definition.deleted"],
|
|
71
|
+
settings: { foreground: role("deleted") },
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
scope: [
|
|
75
|
+
"meta.diff.range",
|
|
76
|
+
"punctuation.definition.range.diff",
|
|
77
|
+
"meta.diff.header",
|
|
78
|
+
],
|
|
79
|
+
settings: { foreground: role("keyword") },
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
let highlighter;
|
|
83
|
+
let starting;
|
|
84
|
+
const loading = new Map();
|
|
85
|
+
function start() {
|
|
86
|
+
starting ??= Promise.all([
|
|
87
|
+
import("shiki/core"),
|
|
88
|
+
import("shiki/engine/javascript"),
|
|
89
|
+
]).then(async ([{ createHighlighterCore, createCssVariablesTheme }, { createJavaScriptRegexEngine },]) => {
|
|
90
|
+
const theme = createCssVariablesTheme({
|
|
91
|
+
name: "sprout",
|
|
92
|
+
variablePrefix: "--sprout-syntax-",
|
|
93
|
+
fontStyle: true,
|
|
94
|
+
});
|
|
95
|
+
theme.tokenColors = [...(theme.tokenColors ?? []), ...markupRules];
|
|
96
|
+
highlighter = await createHighlighterCore({
|
|
97
|
+
themes: [theme],
|
|
98
|
+
langs: [],
|
|
99
|
+
engine: createJavaScriptRegexEngine({ forgiving: true }),
|
|
100
|
+
});
|
|
101
|
+
return highlighter;
|
|
102
|
+
});
|
|
103
|
+
return starting;
|
|
104
|
+
}
|
|
105
|
+
export function loadCodeLanguage(language) {
|
|
106
|
+
let loaded = loading.get(language);
|
|
107
|
+
if (!loaded) {
|
|
108
|
+
loaded = Promise.all([start(), import("shiki/langs")]).then(([core, { bundledLanguages }]) => core.loadLanguage(bundledLanguages[language]));
|
|
109
|
+
loading.set(language, loaded);
|
|
110
|
+
loaded.catch(() => loading.delete(language));
|
|
111
|
+
}
|
|
112
|
+
return loaded;
|
|
113
|
+
}
|
|
114
|
+
/** Languages a file needs beyond its own, such as the fences inside Markdown. */
|
|
115
|
+
export function embeddedLanguages(code, language) {
|
|
116
|
+
if (language !== "markdown" && language !== "mdx")
|
|
117
|
+
return [];
|
|
118
|
+
const found = new Set();
|
|
119
|
+
for (const [, name] of code.matchAll(/^\s*(?:```|~~~)\s*([\w#+.-]+)/gm)) {
|
|
120
|
+
const fence = resolveCodeLanguage(name);
|
|
121
|
+
if (fence)
|
|
122
|
+
found.add(fence);
|
|
123
|
+
}
|
|
124
|
+
return [...found];
|
|
125
|
+
}
|
|
126
|
+
export function isLanguageReady(language) {
|
|
127
|
+
return highlighter?.getLoadedLanguages().includes(language) ?? false;
|
|
128
|
+
}
|
|
129
|
+
/** Tokens when the language is already loaded, otherwise `null`. */
|
|
130
|
+
export function codeTokens(code, language) {
|
|
131
|
+
if (!highlighter || !isLanguageReady(language))
|
|
132
|
+
return null;
|
|
133
|
+
return highlighter.codeToTokensBase(code, {
|
|
134
|
+
lang: language,
|
|
135
|
+
theme: "sprout",
|
|
136
|
+
});
|
|
137
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.sprout-accordion {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
width: 100%;
|
|
6
|
+
}
|
|
7
|
+
.sprout-accordion-item:not(:last-child) {
|
|
8
|
+
border-bottom: 1px solid var(--sprout-line);
|
|
9
|
+
}
|
|
10
|
+
.sprout-accordion-header {
|
|
11
|
+
display: flex;
|
|
12
|
+
margin: 0;
|
|
13
|
+
font: inherit;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.sprout-accordion-trigger {
|
|
17
|
+
position: relative;
|
|
18
|
+
display: flex;
|
|
19
|
+
flex: 1 1 0%;
|
|
20
|
+
min-width: 0;
|
|
21
|
+
align-items: flex-start;
|
|
22
|
+
justify-content: space-between;
|
|
23
|
+
gap: 0.75rem;
|
|
24
|
+
padding: 0.625rem 0;
|
|
25
|
+
border: 1px solid transparent;
|
|
26
|
+
border-radius: var(--sprout-radius-control);
|
|
27
|
+
background: transparent;
|
|
28
|
+
color: inherit;
|
|
29
|
+
font: inherit;
|
|
30
|
+
font-size: var(--sprout-text-sm);
|
|
31
|
+
font-weight: 500;
|
|
32
|
+
line-height: 1.25rem;
|
|
33
|
+
text-align: left;
|
|
34
|
+
text-underline-offset: 3px;
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
outline: none;
|
|
37
|
+
-webkit-tap-highlight-color: transparent;
|
|
38
|
+
}
|
|
39
|
+
.sprout-accordion-trigger-default:hover {
|
|
40
|
+
text-decoration-line: underline;
|
|
41
|
+
}
|
|
42
|
+
.sprout-accordion-trigger:focus-visible {
|
|
43
|
+
outline: var(--sprout-focus-width) solid var(--sprout-focus-ring);
|
|
44
|
+
outline-offset: 0;
|
|
45
|
+
}
|
|
46
|
+
.sprout-accordion-trigger[data-disabled] {
|
|
47
|
+
cursor: not-allowed;
|
|
48
|
+
opacity: 0.5;
|
|
49
|
+
text-decoration-line: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.sprout-accordion-trigger-icon {
|
|
53
|
+
flex-shrink: 0;
|
|
54
|
+
width: 1rem;
|
|
55
|
+
height: 1rem;
|
|
56
|
+
margin-top: 0.125rem;
|
|
57
|
+
margin-left: auto;
|
|
58
|
+
color: var(--sprout-muted);
|
|
59
|
+
pointer-events: none;
|
|
60
|
+
}
|
|
61
|
+
.sprout-accordion-trigger[data-panel-open] > .sprout-accordion-trigger-icon {
|
|
62
|
+
transform: rotate(180deg);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.sprout-accordion-content {
|
|
66
|
+
height: var(--accordion-panel-height);
|
|
67
|
+
overflow: hidden;
|
|
68
|
+
font-size: var(--sprout-text-sm);
|
|
69
|
+
line-height: 1.25rem;
|
|
70
|
+
}
|
|
71
|
+
.sprout-accordion-content[hidden]:not([hidden="until-found"]) {
|
|
72
|
+
display: none;
|
|
73
|
+
}
|
|
74
|
+
.sprout-accordion-content[data-starting-style],
|
|
75
|
+
.sprout-accordion-content[data-ending-style] {
|
|
76
|
+
height: 0;
|
|
77
|
+
}
|
|
78
|
+
.sprout-accordion-content-inner {
|
|
79
|
+
padding-bottom: 0.625rem;
|
|
80
|
+
}
|
|
81
|
+
.sprout-accordion-content-inner a {
|
|
82
|
+
text-decoration-line: underline;
|
|
83
|
+
text-underline-offset: 3px;
|
|
84
|
+
}
|
|
85
|
+
.sprout-accordion-content-inner a:hover {
|
|
86
|
+
color: var(--sprout-text);
|
|
87
|
+
}
|
|
88
|
+
.sprout-accordion-content-inner p:not(:last-child) {
|
|
89
|
+
margin-bottom: 1rem;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
93
|
+
.sprout-accordion-trigger-icon {
|
|
94
|
+
transition: transform var(--sprout-motion-fast, 120ms)
|
|
95
|
+
var(--sprout-motion-ease, ease-out);
|
|
96
|
+
}
|
|
97
|
+
.sprout-accordion-content {
|
|
98
|
+
transition: height var(--sprout-motion-normal, 180ms)
|
|
99
|
+
var(--sprout-motion-ease, ease-out);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.sprout-alert-dialog-overlay {
|
|
3
|
+
position: fixed;
|
|
4
|
+
inset: 0;
|
|
5
|
+
z-index: 50;
|
|
6
|
+
isolation: isolate;
|
|
7
|
+
background: var(--sprout-overlay);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.sprout-alert-dialog-content {
|
|
11
|
+
--sprout-alert-dialog-padding: 16px;
|
|
12
|
+
position: fixed;
|
|
13
|
+
top: 50%;
|
|
14
|
+
left: 50%;
|
|
15
|
+
z-index: 50;
|
|
16
|
+
display: grid;
|
|
17
|
+
gap: 16px;
|
|
18
|
+
box-sizing: border-box;
|
|
19
|
+
width: 100%;
|
|
20
|
+
min-width: 0;
|
|
21
|
+
max-width: min(20rem, calc(100% - 2rem));
|
|
22
|
+
max-height: calc(100dvh - 2rem);
|
|
23
|
+
padding: var(--sprout-alert-dialog-padding);
|
|
24
|
+
translate: -50% -50%;
|
|
25
|
+
border: 1px solid var(--sprout-line);
|
|
26
|
+
border-radius: calc(var(--sprout-radius-panel) + 4px);
|
|
27
|
+
background: var(--sprout-surface);
|
|
28
|
+
color: var(--sprout-text);
|
|
29
|
+
box-shadow: var(--sprout-shadow-overlay);
|
|
30
|
+
font-family: inherit;
|
|
31
|
+
font-size: var(--sprout-text-sm);
|
|
32
|
+
line-height: 1.25rem;
|
|
33
|
+
overflow-y: auto;
|
|
34
|
+
overscroll-behavior: contain;
|
|
35
|
+
overflow-wrap: break-word;
|
|
36
|
+
outline: none;
|
|
37
|
+
}
|
|
38
|
+
.sprout-alert-dialog-content > p {
|
|
39
|
+
margin: 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.sprout-alert-dialog-header {
|
|
43
|
+
display: grid;
|
|
44
|
+
grid-template-rows: auto 1fr;
|
|
45
|
+
justify-items: center;
|
|
46
|
+
gap: 6px;
|
|
47
|
+
min-width: 0;
|
|
48
|
+
text-align: center;
|
|
49
|
+
}
|
|
50
|
+
.sprout-alert-dialog-header:has(> .sprout-alert-dialog-media) {
|
|
51
|
+
grid-template-rows: auto auto 1fr;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.sprout-alert-dialog-media {
|
|
55
|
+
display: inline-flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
width: 40px;
|
|
59
|
+
height: 40px;
|
|
60
|
+
margin-bottom: 8px;
|
|
61
|
+
border-radius: var(--sprout-radius-control);
|
|
62
|
+
background: var(--sprout-secondary);
|
|
63
|
+
color: var(--sprout-text);
|
|
64
|
+
}
|
|
65
|
+
.sprout-alert-dialog-media > svg:not([class*="size-"]) {
|
|
66
|
+
width: 24px;
|
|
67
|
+
height: 24px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.sprout-alert-dialog-title {
|
|
71
|
+
margin: 0;
|
|
72
|
+
min-width: 0;
|
|
73
|
+
font-size: var(--sprout-text-base);
|
|
74
|
+
font-weight: 550;
|
|
75
|
+
line-height: 1.375rem;
|
|
76
|
+
letter-spacing: -0.005em;
|
|
77
|
+
overflow-wrap: anywhere;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.sprout-alert-dialog-description {
|
|
81
|
+
margin: 0;
|
|
82
|
+
min-width: 0;
|
|
83
|
+
color: var(--sprout-muted);
|
|
84
|
+
font-size: var(--sprout-text-sm);
|
|
85
|
+
line-height: 1.25rem;
|
|
86
|
+
text-wrap: pretty;
|
|
87
|
+
}
|
|
88
|
+
/* Title and description placed straight in the content read as one header. */
|
|
89
|
+
.sprout-alert-dialog-content
|
|
90
|
+
> .sprout-alert-dialog-title
|
|
91
|
+
+ .sprout-alert-dialog-description {
|
|
92
|
+
margin-top: -10px;
|
|
93
|
+
}
|
|
94
|
+
.sprout-alert-dialog-description a:not([data-slot]) {
|
|
95
|
+
border-radius: 2px;
|
|
96
|
+
color: inherit;
|
|
97
|
+
text-decoration: underline;
|
|
98
|
+
text-underline-offset: 3px;
|
|
99
|
+
}
|
|
100
|
+
.sprout-alert-dialog-description a:not([data-slot]):focus-visible {
|
|
101
|
+
outline: var(--sprout-focus-width) solid var(--sprout-focus-ring);
|
|
102
|
+
outline-offset: 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.sprout-alert-dialog-footer {
|
|
106
|
+
display: flex;
|
|
107
|
+
flex-direction: column-reverse;
|
|
108
|
+
gap: 8px;
|
|
109
|
+
margin: 0 calc(var(--sprout-alert-dialog-padding) * -1)
|
|
110
|
+
calc(var(--sprout-alert-dialog-padding) * -1);
|
|
111
|
+
padding: 12px 16px;
|
|
112
|
+
border-top: 1px solid var(--sprout-line);
|
|
113
|
+
border-end-start-radius: inherit;
|
|
114
|
+
border-end-end-radius: inherit;
|
|
115
|
+
background: color-mix(
|
|
116
|
+
in oklab,
|
|
117
|
+
var(--sprout-canvas) 70%,
|
|
118
|
+
var(--sprout-surface)
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
.sprout-alert-dialog-content[data-size="sm"] > .sprout-alert-dialog-footer {
|
|
122
|
+
display: grid;
|
|
123
|
+
grid-auto-columns: minmax(0, 1fr);
|
|
124
|
+
grid-auto-flow: column;
|
|
125
|
+
}
|
|
126
|
+
.sprout-alert-dialog-content[data-size="sm"]
|
|
127
|
+
> .sprout-alert-dialog-footer
|
|
128
|
+
> .sprout-button {
|
|
129
|
+
min-width: 0;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
@media (min-width: 40rem) {
|
|
133
|
+
.sprout-alert-dialog-content[data-size="default"] {
|
|
134
|
+
max-width: 24rem;
|
|
135
|
+
}
|
|
136
|
+
.sprout-alert-dialog-content[data-size="default"]
|
|
137
|
+
> .sprout-alert-dialog-header {
|
|
138
|
+
justify-items: start;
|
|
139
|
+
text-align: start;
|
|
140
|
+
}
|
|
141
|
+
.sprout-alert-dialog-content[data-size="default"]
|
|
142
|
+
> .sprout-alert-dialog-header:has(> .sprout-alert-dialog-media) {
|
|
143
|
+
grid-template-columns: auto minmax(0, 1fr);
|
|
144
|
+
grid-template-rows: auto 1fr;
|
|
145
|
+
column-gap: 16px;
|
|
146
|
+
}
|
|
147
|
+
.sprout-alert-dialog-content[data-size="default"]
|
|
148
|
+
> .sprout-alert-dialog-header
|
|
149
|
+
> .sprout-alert-dialog-media {
|
|
150
|
+
grid-row: span 2;
|
|
151
|
+
margin-bottom: 0;
|
|
152
|
+
}
|
|
153
|
+
.sprout-alert-dialog-content[data-size="default"]
|
|
154
|
+
> .sprout-alert-dialog-header:has(> .sprout-alert-dialog-media)
|
|
155
|
+
> :not(.sprout-alert-dialog-media) {
|
|
156
|
+
grid-column-start: 2;
|
|
157
|
+
}
|
|
158
|
+
.sprout-alert-dialog-content[data-size="default"]
|
|
159
|
+
> .sprout-alert-dialog-footer {
|
|
160
|
+
flex-direction: row;
|
|
161
|
+
flex-wrap: wrap;
|
|
162
|
+
justify-content: flex-end;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
@media (hover: hover) {
|
|
167
|
+
.sprout-alert-dialog-description a:not([data-slot]):hover {
|
|
168
|
+
color: var(--sprout-text);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
173
|
+
.sprout-alert-dialog-overlay {
|
|
174
|
+
transition: opacity var(--sprout-motion-normal) var(--sprout-motion-ease);
|
|
175
|
+
}
|
|
176
|
+
.sprout-alert-dialog-overlay[data-starting-style],
|
|
177
|
+
.sprout-alert-dialog-overlay[data-ending-style] {
|
|
178
|
+
opacity: 0;
|
|
179
|
+
}
|
|
180
|
+
.sprout-alert-dialog-content {
|
|
181
|
+
transition:
|
|
182
|
+
opacity var(--sprout-motion-normal) var(--sprout-motion-ease),
|
|
183
|
+
scale var(--sprout-motion-normal) var(--sprout-motion-ease);
|
|
184
|
+
}
|
|
185
|
+
.sprout-alert-dialog-content[data-ending-style],
|
|
186
|
+
.sprout-alert-dialog-overlay[data-ending-style] {
|
|
187
|
+
transition-duration: var(--sprout-motion-fast);
|
|
188
|
+
}
|
|
189
|
+
.sprout-alert-dialog-content[data-starting-style],
|
|
190
|
+
.sprout-alert-dialog-content[data-ending-style] {
|
|
191
|
+
opacity: 0;
|
|
192
|
+
scale: 0.96;
|
|
193
|
+
}
|
|
194
|
+
.sprout-alert-dialog-description a:not([data-slot]) {
|
|
195
|
+
transition: color var(--sprout-motion-fast) ease-out;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.sprout-alert {
|
|
3
|
+
position: relative;
|
|
4
|
+
display: grid;
|
|
5
|
+
grid-template-columns: minmax(0, 1fr);
|
|
6
|
+
align-items: start;
|
|
7
|
+
justify-items: stretch;
|
|
8
|
+
row-gap: 2px;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
width: 100%;
|
|
11
|
+
min-width: 0;
|
|
12
|
+
padding: 8px 10px;
|
|
13
|
+
border: 1px solid var(--sprout-line);
|
|
14
|
+
border-radius: calc(var(--sprout-radius-control) + 2px);
|
|
15
|
+
background: var(--sprout-surface);
|
|
16
|
+
color: var(--sprout-text);
|
|
17
|
+
font-family: inherit;
|
|
18
|
+
font-size: var(--sprout-text-sm);
|
|
19
|
+
line-height: 1.25rem;
|
|
20
|
+
text-align: start;
|
|
21
|
+
overflow-wrap: break-word;
|
|
22
|
+
}
|
|
23
|
+
.sprout-alert:has(> [data-slot="alert-action"]) {
|
|
24
|
+
padding-inline-end: 4.5rem;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.sprout-alert:has(> svg) {
|
|
28
|
+
grid-template-columns: auto minmax(0, 1fr);
|
|
29
|
+
column-gap: 8px;
|
|
30
|
+
}
|
|
31
|
+
.sprout-alert > svg {
|
|
32
|
+
grid-row: span 2;
|
|
33
|
+
translate: 0 2px;
|
|
34
|
+
color: currentColor;
|
|
35
|
+
flex-shrink: 0;
|
|
36
|
+
pointer-events: none;
|
|
37
|
+
}
|
|
38
|
+
.sprout-alert > svg:not([class*="size-"]) {
|
|
39
|
+
width: 16px;
|
|
40
|
+
height: 16px;
|
|
41
|
+
}
|
|
42
|
+
.sprout-alert:has(> svg) > :not(svg, [data-slot="alert-action"]) {
|
|
43
|
+
grid-column-start: 2;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.sprout-alert > :is(p, pre) {
|
|
47
|
+
margin: 0;
|
|
48
|
+
}
|
|
49
|
+
.sprout-alert > [data-slot="button"] {
|
|
50
|
+
justify-self: start;
|
|
51
|
+
margin-top: 6px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.sprout-alert-title {
|
|
55
|
+
min-width: 0;
|
|
56
|
+
font-weight: 500;
|
|
57
|
+
}
|
|
58
|
+
.sprout-alert-description {
|
|
59
|
+
min-width: 0;
|
|
60
|
+
font-size: var(--sprout-text-sm);
|
|
61
|
+
line-height: 1.25rem;
|
|
62
|
+
color: var(--sprout-muted);
|
|
63
|
+
text-wrap: balance;
|
|
64
|
+
}
|
|
65
|
+
.sprout-alert-description p {
|
|
66
|
+
margin: 0;
|
|
67
|
+
}
|
|
68
|
+
.sprout-alert-description p:not(:last-child) {
|
|
69
|
+
margin-bottom: 1rem;
|
|
70
|
+
}
|
|
71
|
+
.sprout-alert-description > [data-slot="button"]:not([data-variant="link"]) {
|
|
72
|
+
display: flex;
|
|
73
|
+
width: fit-content;
|
|
74
|
+
margin-top: 8px;
|
|
75
|
+
}
|
|
76
|
+
.sprout-alert-description > [data-slot="button"][data-variant="link"] {
|
|
77
|
+
height: auto;
|
|
78
|
+
margin-inline-start: 4px;
|
|
79
|
+
padding: 0;
|
|
80
|
+
vertical-align: baseline;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
:is(.sprout-alert-title, .sprout-alert-description) a:not([data-slot]) {
|
|
84
|
+
border-radius: 2px;
|
|
85
|
+
color: inherit;
|
|
86
|
+
text-decoration: underline;
|
|
87
|
+
text-underline-offset: 3px;
|
|
88
|
+
}
|
|
89
|
+
:is(.sprout-alert-title, .sprout-alert-description)
|
|
90
|
+
a:not([data-slot]):focus-visible {
|
|
91
|
+
outline: var(--sprout-focus-width) solid var(--sprout-focus-ring);
|
|
92
|
+
outline-offset: 0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.sprout-alert-action {
|
|
96
|
+
position: absolute;
|
|
97
|
+
top: 8px;
|
|
98
|
+
right: 8px;
|
|
99
|
+
}
|
|
100
|
+
.sprout-alert-action:dir(rtl) {
|
|
101
|
+
right: auto;
|
|
102
|
+
left: 8px;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.sprout-alert-destructive {
|
|
106
|
+
color: var(--sprout-danger);
|
|
107
|
+
}
|
|
108
|
+
.sprout-alert-destructive > .sprout-alert-description {
|
|
109
|
+
color: color-mix(in oklab, var(--sprout-danger) 90%, var(--sprout-surface));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
@media (hover: hover) {
|
|
113
|
+
:is(.sprout-alert-title, .sprout-alert-description)
|
|
114
|
+
a:not([data-slot]):hover {
|
|
115
|
+
color: var(--sprout-text);
|
|
116
|
+
}
|
|
117
|
+
.sprout-alert-destructive
|
|
118
|
+
:is(.sprout-alert-title, .sprout-alert-description)
|
|
119
|
+
a:not([data-slot]):hover {
|
|
120
|
+
color: var(--sprout-danger-hover);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
@media (min-width: 48rem) {
|
|
125
|
+
.sprout-alert-description {
|
|
126
|
+
text-wrap: pretty;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
131
|
+
.sprout-alert {
|
|
132
|
+
animation: sprout-alert-in var(--sprout-motion-normal, 180ms)
|
|
133
|
+
var(--sprout-motion-ease, ease) both;
|
|
134
|
+
transition:
|
|
135
|
+
color var(--sprout-motion-fast) ease-out,
|
|
136
|
+
border-color var(--sprout-motion-fast) ease-out;
|
|
137
|
+
}
|
|
138
|
+
:is(.sprout-alert-title, .sprout-alert-description) a:not([data-slot]) {
|
|
139
|
+
transition: color var(--sprout-motion-fast) ease-out;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
@keyframes sprout-alert-in {
|
|
145
|
+
from {
|
|
146
|
+
opacity: 0;
|
|
147
|
+
translate: 0 -2px;
|
|
148
|
+
}
|
|
149
|
+
}
|