@tulipfarm/sprout 0.3.0 → 0.4.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/README.md +45 -40
- package/dist/components/accordion.d.ts +2 -2
- package/dist/components/accordion.js +9 -9
- package/dist/components/agent-fanout.d.ts +2 -2
- package/dist/components/agent-fanout.js +65 -87
- package/dist/components/alert-dialog.d.ts +6 -6
- package/dist/components/alert-dialog.js +20 -20
- package/dist/components/alert.d.ts +6 -6
- package/dist/components/alert.js +13 -13
- package/dist/components/aspect-ratio.d.ts +2 -2
- package/dist/components/aspect-ratio.js +2 -2
- package/dist/components/attachment.d.ts +17 -17
- package/dist/components/attachment.js +82 -115
- package/dist/components/avatar.d.ts +10 -10
- package/dist/components/avatar.js +14 -14
- package/dist/components/badge.d.ts +4 -4
- package/dist/components/badge.js +18 -18
- package/dist/components/board.d.ts +107 -0
- package/dist/components/board.js +640 -0
- package/dist/components/brand-icon.d.ts +6 -6
- package/dist/components/brand-icon.js +55 -63
- package/dist/components/breadcrumb.d.ts +11 -11
- package/dist/components/breadcrumb.js +16 -18
- package/dist/components/button-group.d.ts +6 -6
- package/dist/components/button-group.js +14 -14
- package/dist/components/button.d.ts +11 -11
- package/dist/components/button.js +46 -56
- package/dist/components/calendar.d.ts +5 -5
- package/dist/components/calendar.js +44 -53
- package/dist/components/canvas.d.ts +4 -4
- package/dist/components/canvas.js +39 -46
- package/dist/components/card.d.ts +6 -6
- package/dist/components/card.js +17 -17
- package/dist/components/carousel.d.ts +7 -7
- package/dist/components/carousel.js +57 -75
- package/dist/components/chart.d.ts +5 -112
- package/dist/components/chart.js +5 -172
- package/dist/components/chat-confirmation.d.ts +13 -11
- package/dist/components/chat-confirmation.js +32 -38
- package/dist/components/chat-input.d.ts +4 -4
- package/dist/components/chat-input.js +74 -81
- package/dist/components/chat-plan.d.ts +2 -2
- package/dist/components/chat-plan.js +15 -20
- package/dist/components/chat-sources.d.ts +8 -8
- package/dist/components/chat-sources.js +18 -27
- package/dist/components/checkbox.d.ts +1 -1
- package/dist/components/checkbox.js +9 -9
- package/dist/components/choice-list.d.ts +2 -2
- package/dist/components/choice-list.js +16 -18
- package/dist/components/code-block.d.ts +5 -5
- package/dist/components/code-block.js +26 -26
- package/dist/components/collapsible.d.ts +1 -1
- package/dist/components/collapsible.js +7 -11
- package/dist/components/combobox.d.ts +3 -3
- package/dist/components/combobox.js +24 -24
- package/dist/components/command.d.ts +13 -13
- package/dist/components/command.js +61 -73
- package/dist/components/context-menu.d.ts +5 -5
- package/dist/components/context-menu.js +22 -22
- package/dist/components/dialog.d.ts +6 -6
- package/dist/components/dialog.js +23 -28
- package/dist/components/direction.d.ts +1 -1
- package/dist/components/direction.js +1 -1
- package/dist/components/dropdown-menu.d.ts +5 -5
- package/dist/components/dropdown-menu.js +20 -20
- package/dist/components/field.d.ts +11 -11
- package/dist/components/field.js +41 -61
- package/dist/components/file-explorer.d.ts +2 -2
- package/dist/components/file-explorer.js +89 -105
- package/dist/components/file-viewer.d.ts +10 -10
- package/dist/components/file-viewer.js +112 -140
- package/dist/components/form.d.ts +7 -7
- package/dist/components/form.js +24 -28
- package/dist/components/glass-banner.d.ts +3 -3
- package/dist/components/glass-banner.js +21 -24
- package/dist/components/gradient-banner.d.ts +5 -5
- package/dist/components/gradient-banner.js +13 -22
- package/dist/components/hover-card.d.ts +4 -4
- package/dist/components/hover-card.js +6 -6
- package/dist/components/input-group.d.ts +11 -11
- package/dist/components/input-group.js +22 -36
- package/dist/components/input-otp.d.ts +10 -10
- package/dist/components/input-otp.js +13 -15
- package/dist/components/input.d.ts +1 -1
- package/dist/components/input.js +7 -7
- package/dist/components/kbd.d.ts +3 -3
- package/dist/components/kbd.js +5 -5
- package/dist/components/label.d.ts +2 -2
- package/dist/components/label.js +2 -2
- package/dist/components/mention-list.d.ts +3 -3
- package/dist/components/mention-list.js +10 -10
- package/dist/components/menubar.d.ts +6 -6
- package/dist/components/menubar.js +22 -22
- package/dist/components/message-actions.d.ts +2 -2
- package/dist/components/message-actions.js +29 -31
- package/dist/components/message-response.d.ts +3 -3
- package/dist/components/message-response.js +18 -18
- package/dist/components/message-scroller.d.ts +12 -12
- package/dist/components/message-scroller.js +44 -56
- package/dist/components/message.d.ts +11 -11
- package/dist/components/message.js +25 -25
- package/dist/components/navigation-menu.d.ts +2 -2
- package/dist/components/navigation-menu.js +15 -15
- package/dist/components/notice-banner.d.ts +2 -2
- package/dist/components/notice-banner.js +2 -2
- package/dist/components/page-content.d.ts +2 -2
- package/dist/components/page-content.js +2 -2
- package/dist/components/page-header.d.ts +1 -1
- package/dist/components/page-header.js +16 -16
- package/dist/components/pagination.d.ts +9 -9
- package/dist/components/pagination.js +17 -17
- package/dist/components/plan-outline.d.ts +2 -2
- package/dist/components/plan-outline.js +43 -60
- package/dist/components/popover.d.ts +6 -6
- package/dist/components/popover.js +15 -15
- package/dist/components/presence-cursor.d.ts +2 -2
- package/dist/components/presence-cursor.js +3 -3
- package/dist/components/progress.d.ts +1 -1
- package/dist/components/progress.js +8 -8
- package/dist/components/prompt-list.d.ts +3 -3
- package/dist/components/prompt-list.js +6 -6
- package/dist/components/questionnaire.d.ts +19 -19
- package/dist/components/questionnaire.js +183 -242
- package/dist/components/radio-group.d.ts +2 -2
- package/dist/components/radio-group.js +6 -6
- package/dist/components/reasoning-effort.d.ts +3 -3
- package/dist/components/reasoning-effort.js +9 -12
- package/dist/components/record-list.d.ts +66 -0
- package/dist/components/record-list.js +151 -0
- package/dist/components/resizable.d.ts +5 -5
- package/dist/components/resizable.js +76 -102
- package/dist/components/result-card.d.ts +10 -5
- package/dist/components/result-card.js +42 -53
- package/dist/components/result-notice.d.ts +18 -0
- package/dist/components/result-notice.js +29 -0
- package/dist/components/review-card.d.ts +6 -6
- package/dist/components/review-card.js +18 -18
- package/dist/components/rich-text-editor.d.ts +2 -2
- package/dist/components/rich-text-editor.js +56 -72
- package/dist/components/schema-diagram.d.ts +3 -3
- package/dist/components/schema-diagram.js +39 -53
- package/dist/components/scroll-area.d.ts +1 -1
- package/dist/components/scroll-area.js +10 -14
- package/dist/components/search-dialog.d.ts +6 -6
- package/dist/components/search-dialog.js +16 -16
- package/dist/components/search-field.d.ts +1 -1
- package/dist/components/search-field.js +11 -11
- package/dist/components/select.d.ts +3 -3
- package/dist/components/select.js +20 -20
- package/dist/components/selection-slot.d.ts +2 -2
- package/dist/components/selection-slot.js +6 -9
- package/dist/components/separator.d.ts +15 -15
- package/dist/components/separator.js +22 -27
- package/dist/components/settings-list.d.ts +3 -3
- package/dist/components/settings-list.js +5 -5
- package/dist/components/sheet.d.ts +6 -6
- package/dist/components/sheet.js +27 -27
- package/dist/components/sidebar.d.ts +22 -22
- package/dist/components/sidebar.js +57 -58
- package/dist/components/skeleton.d.ts +5 -5
- package/dist/components/skeleton.js +14 -21
- package/dist/components/slider.d.ts +2 -2
- package/dist/components/slider.js +6 -6
- package/dist/components/spinner.d.ts +5 -5
- package/dist/components/spinner.js +22 -26
- package/dist/components/sql-viewer.d.ts +14 -14
- package/dist/components/sql-viewer.js +99 -128
- package/dist/components/state-panel-samples.d.ts +2 -2
- package/dist/components/state-panel-samples.js +209 -245
- package/dist/components/state-panel.d.ts +2 -35
- package/dist/components/state-panel.js +2 -29
- package/dist/components/state-sample.d.ts +7 -7
- package/dist/components/state-sample.js +18 -31
- package/dist/components/switch.d.ts +1 -1
- package/dist/components/switch.js +7 -7
- package/dist/components/table-nuqs.d.ts +2 -2
- package/dist/components/table-nuqs.js +11 -12
- package/dist/components/table.d.ts +4 -4
- package/dist/components/table.js +166 -235
- package/dist/components/tabs.d.ts +2 -2
- package/dist/components/tabs.js +12 -12
- package/dist/components/textarea.d.ts +2 -2
- package/dist/components/textarea.js +6 -8
- package/dist/components/timeline.d.ts +3 -0
- package/dist/components/timeline.js +3 -0
- package/dist/components/toast.d.ts +2 -2
- package/dist/components/toast.js +19 -25
- package/dist/components/toggle-group.d.ts +2 -2
- package/dist/components/toggle-group.js +18 -20
- package/dist/components/toggle.d.ts +2 -2
- package/dist/components/toggle.js +8 -8
- package/dist/components/tool-activity.d.ts +1 -1
- package/dist/components/tool-activity.js +83 -110
- package/dist/components/toolbar-status.d.ts +2 -2
- package/dist/components/toolbar-status.js +7 -7
- package/dist/components/tooltip.d.ts +5 -5
- package/dist/components/tooltip.js +12 -11
- package/dist/components/typed-text.d.ts +2 -2
- package/dist/components/typed-text.js +10 -12
- package/dist/components/view-switcher.d.ts +51 -0
- package/dist/components/view-switcher.js +114 -0
- package/dist/index.d.ts +98 -93
- package/dist/index.js +98 -93
- package/dist/internal/chart-kit.d.ts +142 -0
- package/dist/internal/chart-kit.js +200 -0
- package/dist/internal/charts/bars.d.ts +61 -0
- package/dist/internal/charts/bars.js +86 -0
- package/dist/internal/charts/lines.d.ts +67 -0
- package/dist/internal/charts/lines.js +70 -0
- package/dist/internal/charts/more.d.ts +77 -0
- package/dist/internal/charts/more.js +68 -0
- package/dist/internal/charts/parts.d.ts +54 -0
- package/dist/internal/charts/parts.js +82 -0
- package/dist/internal/charts/timeline-dates.d.ts +38 -0
- package/dist/internal/charts/timeline-dates.js +113 -0
- package/dist/internal/charts/timeline-window.d.ts +31 -0
- package/dist/internal/charts/timeline-window.js +26 -0
- package/dist/internal/charts/timeline.d.ts +72 -0
- package/dist/internal/charts/timeline.js +287 -0
- package/dist/internal/classes.d.ts +1 -1
- package/dist/internal/classes.js +7 -9
- package/dist/internal/code-tokens.d.ts +2 -2
- package/dist/internal/code-tokens.js +12 -12
- package/dist/internal/fieldset.d.ts +1 -1
- package/dist/internal/fieldset.js +6 -6
- package/dist/internal/file-kind.d.ts +1 -1
- package/dist/internal/file-kind.js +43 -51
- package/dist/internal/flow.d.ts +4 -4
- package/dist/internal/flow.js +20 -23
- package/dist/internal/languages.js +999 -999
- package/dist/internal/message-scroller.d.ts +3 -3
- package/dist/internal/message-scroller.js +64 -112
- package/dist/internal/pressable.d.ts +1 -1
- package/dist/internal/pressable.js +7 -7
- package/dist/internal/state-panel.d.ts +35 -0
- package/dist/internal/state-panel.js +22 -0
- package/dist/internal/syntax.d.ts +2 -2
- package/dist/internal/syntax.js +36 -47
- package/dist/styles/accordion.css +3 -5
- package/dist/styles/agent-fanout.css +64 -60
- package/dist/styles/alert-dialog.css +12 -26
- package/dist/styles/alert.css +10 -15
- package/dist/styles/attachment.css +51 -93
- package/dist/styles/avatar.css +17 -24
- package/dist/styles/badge.css +11 -36
- package/dist/styles/board.css +571 -0
- package/dist/styles/brand-icon.css +7 -8
- package/dist/styles/breadcrumb.css +4 -7
- package/dist/styles/button-group.css +8 -14
- package/dist/styles/button.css +22 -27
- package/dist/styles/calendar.css +24 -36
- package/dist/styles/canvas.css +2 -3
- package/dist/styles/card.css +7 -23
- package/dist/styles/carousel.css +11 -12
- package/dist/styles/chart.css +215 -31
- package/dist/styles/chat-input.css +15 -39
- package/dist/styles/chat-plan.css +3 -4
- package/dist/styles/chat-sources.css +3 -6
- package/dist/styles/checkbox.css +11 -25
- package/dist/styles/choice-list.css +17 -31
- package/dist/styles/code-block.css +11 -25
- package/dist/styles/collapsible.css +10 -15
- package/dist/styles/combobox.css +11 -15
- package/dist/styles/command.css +5 -8
- package/dist/styles/context-menu.css +2 -2
- package/dist/styles/dialog.css +5 -16
- package/dist/styles/dropdown-menu.css +2 -2
- package/dist/styles/field.css +15 -21
- package/dist/styles/file-explorer.css +19 -33
- package/dist/styles/file-viewer.css +13 -17
- package/dist/styles/form.css +3 -3
- package/dist/styles/glass-banner.css +12 -47
- package/dist/styles/gradient-banner.css +17 -35
- package/dist/styles/hover-card.css +9 -15
- package/dist/styles/index.css +116 -108
- package/dist/styles/input-group.css +25 -41
- package/dist/styles/input-otp.css +5 -6
- package/dist/styles/input.css +5 -5
- package/dist/styles/kbd.css +1 -1
- package/dist/styles/label.css +9 -30
- package/dist/styles/mention-list.css +6 -8
- package/dist/styles/menubar.css +5 -6
- package/dist/styles/message-actions.css +1 -1
- package/dist/styles/message-response.css +3 -5
- package/dist/styles/message-scroller.css +14 -21
- package/dist/styles/message.css +23 -60
- package/dist/styles/navigation-menu.css +14 -29
- package/dist/styles/notice-banner.css +1 -2
- package/dist/styles/page-header.css +7 -10
- package/dist/styles/pagination.css +1 -4
- package/dist/styles/plan-outline.css +20 -37
- package/dist/styles/popover.css +10 -19
- package/dist/styles/presence-cursor.css +1 -2
- package/dist/styles/progress.css +2 -4
- package/dist/styles/prompt-list.css +6 -17
- package/dist/styles/questionnaire.css +16 -40
- package/dist/styles/radio-group.css +12 -23
- package/dist/styles/reasoning-effort.css +8 -15
- package/dist/styles/record-list.css +243 -0
- package/dist/styles/resizable.css +10 -11
- package/dist/styles/result-card.css +17 -3
- package/dist/styles/result-notice.css +80 -0
- package/dist/styles/review-card.css +2 -3
- package/dist/styles/rich-text-editor.css +1 -2
- package/dist/styles/schema-diagram.css +12 -17
- package/dist/styles/scroll-area.css +8 -10
- package/dist/styles/search-dialog.css +1 -5
- package/dist/styles/search-field.css +1 -2
- package/dist/styles/select.css +7 -7
- package/dist/styles/selection-slot.css +1 -2
- package/dist/styles/separator.css +7 -8
- package/dist/styles/settings-list.css +1 -2
- package/dist/styles/sheet.css +40 -73
- package/dist/styles/sidebar.css +17 -21
- package/dist/styles/skeleton.css +9 -11
- package/dist/styles/slider.css +11 -21
- package/dist/styles/spinner.css +2 -2
- package/dist/styles/sql-viewer.css +29 -29
- package/dist/styles/state-panel.css +8 -9
- package/dist/styles/state-sample.css +20 -33
- package/dist/styles/switch.css +11 -18
- package/dist/styles/table.css +51 -77
- package/dist/styles/tabs.css +12 -16
- package/dist/styles/textarea.css +3 -3
- package/dist/styles/themes/chatgpt.css +11 -23
- package/dist/styles/themes/claude.css +12 -24
- package/dist/styles/themes/cloudflare.css +11 -23
- package/dist/styles/themes/discord.css +11 -23
- package/dist/styles/themes/github.css +11 -23
- package/dist/styles/themes/grok.css +11 -23
- package/dist/styles/themes/linear.css +12 -25
- package/dist/styles/themes/neutral.css +11 -23
- package/dist/styles/themes/notion.css +11 -23
- package/dist/styles/themes/perplexity.css +11 -23
- package/dist/styles/themes/raycast.css +11 -23
- package/dist/styles/themes/spotify.css +11 -23
- package/dist/styles/themes/stripe.css +11 -23
- package/dist/styles/themes/supabase.css +11 -23
- package/dist/styles/themes/tulipfarm.css +9 -10
- package/dist/styles/themes/vercel.css +12 -25
- package/dist/styles/timeline.css +276 -0
- package/dist/styles/toast.css +13 -20
- package/dist/styles/toggle-group.css +17 -23
- package/dist/styles/toggle.css +8 -8
- package/dist/styles/tool-activity.css +7 -13
- package/dist/styles/toolbar-status.css +2 -7
- package/dist/styles/tooltip.css +15 -21
- package/dist/styles/view-switcher.css +279 -0
- package/package.json +21 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import type { ComponentProps } from
|
|
2
|
-
import { useRender } from
|
|
3
|
-
import { brandGlyphs } from
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import { brandGlyphs } from '../internal/brand-glyphs.js';
|
|
4
4
|
export type Brand = keyof typeof brandGlyphs;
|
|
5
5
|
export declare const brandNames: Record<Brand, string>;
|
|
6
6
|
export declare const brandTileSizeNames: readonly ["sm", "md", "lg", "xl", "action"];
|
|
7
7
|
export declare const brandIconSizeNames: readonly ["inline", "glyph", "fill", "sm", "md", "lg", "xl"];
|
|
8
8
|
export type BrandTileSize = (typeof brandTileSizeNames)[number];
|
|
9
9
|
export type BrandIconSize = (typeof brandIconSizeNames)[number];
|
|
10
|
-
export type BrandTileProps = useRender.ComponentProps<
|
|
10
|
+
export type BrandTileProps = useRender.ComponentProps<'span'> & {
|
|
11
11
|
size?: BrandTileSize;
|
|
12
12
|
};
|
|
13
13
|
export declare function BrandTile({ size, render, ref, className, ...props }: BrandTileProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
14
|
-
export interface BrandIconProps extends Omit<ComponentProps<
|
|
14
|
+
export interface BrandIconProps extends Omit<ComponentProps<'span'>, 'children'> {
|
|
15
15
|
brand: Brand;
|
|
16
16
|
size?: BrandIconSize;
|
|
17
17
|
}
|
|
@@ -20,7 +20,7 @@ export interface BrandStackItem {
|
|
|
20
20
|
brand: Brand;
|
|
21
21
|
name: string;
|
|
22
22
|
}
|
|
23
|
-
export interface BrandStackProps extends Omit<ComponentProps<
|
|
23
|
+
export interface BrandStackProps extends Omit<ComponentProps<'span'>, 'children' | 'role'> {
|
|
24
24
|
brands: readonly BrandStackItem[];
|
|
25
25
|
/** Accessible name for the whole stack. Defaults to the brand names. */
|
|
26
26
|
label?: string;
|
|
@@ -1,82 +1,74 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { mergeProps } from
|
|
4
|
-
import { useRender } from
|
|
5
|
-
import { brandGlyphs } from
|
|
6
|
-
import { cn } from
|
|
7
|
-
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger
|
|
3
|
+
import { mergeProps } from '@base-ui/react/merge-props';
|
|
4
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
5
|
+
import { brandGlyphs } from '../internal/brand-glyphs.js';
|
|
6
|
+
import { cn } from '../internal/classes.js';
|
|
7
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './tooltip.js';
|
|
8
8
|
export const brandNames = {
|
|
9
|
-
claude:
|
|
10
|
-
openai:
|
|
11
|
-
deepseek:
|
|
12
|
-
grok:
|
|
13
|
-
kimi:
|
|
14
|
-
gemini:
|
|
15
|
-
mistral:
|
|
16
|
-
meta:
|
|
17
|
-
qwen:
|
|
18
|
-
google:
|
|
19
|
-
gmail:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
slack:
|
|
27
|
-
github:
|
|
28
|
-
jira:
|
|
29
|
-
confluence:
|
|
30
|
-
trello:
|
|
31
|
-
notion:
|
|
32
|
-
hubspot:
|
|
33
|
-
figma:
|
|
34
|
-
microsoft:
|
|
35
|
-
linear:
|
|
36
|
-
stripe:
|
|
37
|
-
airtable:
|
|
38
|
-
asana:
|
|
39
|
-
clickup:
|
|
40
|
-
discord:
|
|
41
|
-
shopify:
|
|
42
|
-
zendesk:
|
|
43
|
-
dropbox:
|
|
44
|
-
gitlab:
|
|
45
|
-
calendly:
|
|
9
|
+
claude: 'Claude',
|
|
10
|
+
openai: 'OpenAI',
|
|
11
|
+
deepseek: 'DeepSeek',
|
|
12
|
+
grok: 'Grok',
|
|
13
|
+
kimi: 'Kimi',
|
|
14
|
+
gemini: 'Gemini',
|
|
15
|
+
mistral: 'Mistral',
|
|
16
|
+
meta: 'Meta',
|
|
17
|
+
qwen: 'Qwen',
|
|
18
|
+
google: 'Google Workspace',
|
|
19
|
+
gmail: 'Gmail',
|
|
20
|
+
'google-calendar': 'Google Calendar',
|
|
21
|
+
'google-drive': 'Google Drive',
|
|
22
|
+
'google-sheets': 'Google Sheets',
|
|
23
|
+
'google-docs': 'Google Docs',
|
|
24
|
+
'google-slides': 'Google Slides',
|
|
25
|
+
'google-forms': 'Google Forms',
|
|
26
|
+
slack: 'Slack',
|
|
27
|
+
github: 'GitHub',
|
|
28
|
+
jira: 'Jira',
|
|
29
|
+
confluence: 'Confluence',
|
|
30
|
+
trello: 'Trello',
|
|
31
|
+
notion: 'Notion',
|
|
32
|
+
hubspot: 'HubSpot',
|
|
33
|
+
figma: 'Figma',
|
|
34
|
+
microsoft: 'Microsoft',
|
|
35
|
+
linear: 'Linear',
|
|
36
|
+
stripe: 'Stripe',
|
|
37
|
+
airtable: 'Airtable',
|
|
38
|
+
asana: 'Asana',
|
|
39
|
+
clickup: 'ClickUp',
|
|
40
|
+
discord: 'Discord',
|
|
41
|
+
shopify: 'Shopify',
|
|
42
|
+
zendesk: 'Zendesk',
|
|
43
|
+
dropbox: 'Dropbox',
|
|
44
|
+
gitlab: 'GitLab',
|
|
45
|
+
calendly: 'Calendly',
|
|
46
46
|
};
|
|
47
|
-
export const brandTileSizeNames = [
|
|
48
|
-
export const brandIconSizeNames = [
|
|
49
|
-
"inline",
|
|
50
|
-
"glyph",
|
|
51
|
-
"fill",
|
|
52
|
-
"sm",
|
|
53
|
-
"md",
|
|
54
|
-
"lg",
|
|
55
|
-
"xl",
|
|
56
|
-
];
|
|
47
|
+
export const brandTileSizeNames = ['sm', 'md', 'lg', 'xl', 'action'];
|
|
48
|
+
export const brandIconSizeNames = ['inline', 'glyph', 'fill', 'sm', 'md', 'lg', 'xl'];
|
|
57
49
|
function Glyph({ brand }) {
|
|
58
50
|
const glyph = brandGlyphs[brand];
|
|
59
|
-
return (_jsx("svg", { viewBox: glyph.viewBox, className: "sprout-brand-glyph", "aria-hidden": "true", focusable: "false", children: glyph.paths.map((path, index) => (_jsx("path", { d: path.d, fill:
|
|
51
|
+
return (_jsx("svg", { viewBox: glyph.viewBox, className: "sprout-brand-glyph", "aria-hidden": "true", focusable: "false", children: glyph.paths.map((path, index) => (_jsx("path", { d: path.d, fill: 'fill' in path ? path.fill : 'currentColor', fillRule: 'evenOdd' in path ? 'evenodd' : undefined, clipRule: 'evenOdd' in path ? 'evenodd' : undefined }, index))) }));
|
|
60
52
|
}
|
|
61
|
-
export function BrandTile({ size =
|
|
53
|
+
export function BrandTile({ size = 'md', render, ref, className, ...props }) {
|
|
62
54
|
return useRender({
|
|
63
|
-
defaultTagName:
|
|
55
|
+
defaultTagName: 'span',
|
|
64
56
|
render,
|
|
65
57
|
ref,
|
|
66
58
|
props: mergeProps({
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
className: cn(
|
|
59
|
+
'data-slot': 'brand-tile',
|
|
60
|
+
'data-size': size,
|
|
61
|
+
className: cn('sprout-brand-tile', className),
|
|
70
62
|
}, props),
|
|
71
63
|
});
|
|
72
64
|
}
|
|
73
|
-
export function BrandIcon({ brand, size =
|
|
74
|
-
if (size ===
|
|
75
|
-
return (_jsx("span", { "data-slot": "brand-icon", "data-brand": brand, "data-size": size, ...props, className: cn(
|
|
65
|
+
export function BrandIcon({ brand, size = 'md', className, ...props }) {
|
|
66
|
+
if (size === 'inline' || size === 'glyph' || size === 'fill')
|
|
67
|
+
return (_jsx("span", { "data-slot": "brand-icon", "data-brand": brand, "data-size": size, ...props, className: cn('sprout-brand-icon', className), children: _jsx(Glyph, { brand: brand }) }));
|
|
76
68
|
return (_jsx(BrandTile, { "data-brand": brand, size: size, ...props, className: className, children: _jsx(Glyph, { brand: brand }) }));
|
|
77
69
|
}
|
|
78
70
|
export function BrandStack({ brands, label, className, ...props }) {
|
|
79
71
|
if (brands.length === 0)
|
|
80
72
|
return null;
|
|
81
|
-
return (_jsx(TooltipProvider, { delay: 200, children: _jsx("span", { "data-slot": "brand-stack", ...props, role: "img", "aria-label": label ?? brands.map(
|
|
73
|
+
return (_jsx(TooltipProvider, { delay: 200, children: _jsx("span", { "data-slot": "brand-stack", ...props, role: "img", "aria-label": label ?? brands.map(item => item.name).join(', '), className: cn('sprout-brand-stack', className), children: brands.map(item => (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { render: _jsx(BrandTile, { size: "sm", "data-brand": item.brand }), children: _jsx(Glyph, { brand: item.brand }) }), _jsx(TooltipContent, { sideOffset: 6, className: "sprout-brand-tooltip", children: item.name })] }, item.brand))) }) }));
|
|
82
74
|
}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import type { ComponentProps } from
|
|
2
|
-
import { useRender } from
|
|
3
|
-
export type BreadcrumbProps = ComponentProps<
|
|
4
|
-
export declare function Breadcrumb({ className,
|
|
5
|
-
export interface BreadcrumbListProps extends ComponentProps<
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
export type BreadcrumbProps = ComponentProps<'nav'>;
|
|
4
|
+
export declare function Breadcrumb({ className, 'aria-label': label, ...props }: BreadcrumbProps): import("react").JSX.Element;
|
|
5
|
+
export interface BreadcrumbListProps extends ComponentProps<'ol'> {
|
|
6
6
|
/** Wrap long paths onto more lines. Set `false` to keep one line and let the current page shrink. */
|
|
7
7
|
wrap?: boolean;
|
|
8
8
|
}
|
|
9
9
|
export declare function BreadcrumbList({ className, wrap, ...props }: BreadcrumbListProps): import("react").JSX.Element;
|
|
10
|
-
export type BreadcrumbItemProps = ComponentProps<
|
|
10
|
+
export type BreadcrumbItemProps = ComponentProps<'li'>;
|
|
11
11
|
export declare function BreadcrumbItem({ className, ...props }: BreadcrumbItemProps): import("react").JSX.Element;
|
|
12
12
|
export interface BreadcrumbLinkState extends Record<string, unknown> {
|
|
13
|
-
slot:
|
|
13
|
+
slot: 'breadcrumb-link';
|
|
14
14
|
}
|
|
15
|
-
export interface BreadcrumbLinkProps extends useRender.ComponentProps<
|
|
15
|
+
export interface BreadcrumbLinkProps extends useRender.ComponentProps<'a', BreadcrumbLinkState> {
|
|
16
16
|
/** Cut a long name to one line with an ellipsis. String names also get a `title`. */
|
|
17
17
|
truncate?: boolean;
|
|
18
18
|
}
|
|
19
19
|
export declare function BreadcrumbLink({ className, render, ref, truncate, children, ...props }: BreadcrumbLinkProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
20
|
-
export interface BreadcrumbPageProps extends ComponentProps<
|
|
20
|
+
export interface BreadcrumbPageProps extends ComponentProps<'span'> {
|
|
21
21
|
/** Cut a long name to one line with an ellipsis. String names also get a `title`. */
|
|
22
22
|
truncate?: boolean;
|
|
23
23
|
}
|
|
24
24
|
export declare function BreadcrumbPage({ className, truncate, children, ...props }: BreadcrumbPageProps): import("react").JSX.Element;
|
|
25
|
-
export type BreadcrumbSeparatorProps = ComponentProps<
|
|
25
|
+
export type BreadcrumbSeparatorProps = ComponentProps<'li'>;
|
|
26
26
|
export declare function BreadcrumbSeparator({ children, className, ...props }: BreadcrumbSeparatorProps): import("react").JSX.Element;
|
|
27
|
-
export type BreadcrumbEllipsisProps = ComponentProps<
|
|
27
|
+
export type BreadcrumbEllipsisProps = ComponentProps<'span'>;
|
|
28
28
|
/** Marks hidden folders. It is hidden from screen readers, so put the reason in a visually hidden sibling. */
|
|
29
29
|
export declare function BreadcrumbEllipsis({ className, ...props }: BreadcrumbEllipsisProps): import("react").JSX.Element;
|
|
@@ -1,44 +1,42 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { mergeProps } from
|
|
3
|
-
import { useRender } from
|
|
4
|
-
import { ChevronRight } from
|
|
5
|
-
import { MoreH } from
|
|
6
|
-
import { cn } from
|
|
7
|
-
export function Breadcrumb({ className,
|
|
8
|
-
return
|
|
2
|
+
import { mergeProps } from '@base-ui/react/merge-props';
|
|
3
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
4
|
+
import { ChevronRight } from 'reicon-react/icons/ChevronRight';
|
|
5
|
+
import { MoreH } from 'reicon-react/icons/MoreH';
|
|
6
|
+
import { cn } from '../internal/classes.js';
|
|
7
|
+
export function Breadcrumb({ className, 'aria-label': label = 'Breadcrumb', ...props }) {
|
|
8
|
+
return _jsx("nav", { "aria-label": label, "data-slot": "breadcrumb", className: cn('sprout-breadcrumb', className), ...props });
|
|
9
9
|
}
|
|
10
10
|
export function BreadcrumbList({ className, wrap = true, ...props }) {
|
|
11
|
-
return (_jsx("ol", { "data-slot": "breadcrumb-list", "data-wrap": wrap ?
|
|
11
|
+
return (_jsx("ol", { "data-slot": "breadcrumb-list", "data-wrap": wrap ? 'true' : 'false', className: cn('sprout-breadcrumb-list', className), ...props }));
|
|
12
12
|
}
|
|
13
13
|
export function BreadcrumbItem({ className, ...props }) {
|
|
14
|
-
return
|
|
14
|
+
return _jsx("li", { "data-slot": "breadcrumb-item", className: cn('sprout-breadcrumb-item', className), ...props });
|
|
15
15
|
}
|
|
16
16
|
function label(children, truncate) {
|
|
17
17
|
if (!truncate)
|
|
18
18
|
return children;
|
|
19
|
-
return (_jsx("span", { "data-slot": "breadcrumb-label", className: "sprout-breadcrumb-label", title: typeof children ===
|
|
20
|
-
? String(children)
|
|
21
|
-
: undefined, children: children }));
|
|
19
|
+
return (_jsx("span", { "data-slot": "breadcrumb-label", className: "sprout-breadcrumb-label", title: typeof children === 'string' || typeof children === 'number' ? String(children) : undefined, children: children }));
|
|
22
20
|
}
|
|
23
21
|
export function BreadcrumbLink({ className, render, ref, truncate, children, ...props }) {
|
|
24
22
|
return useRender({
|
|
25
|
-
defaultTagName:
|
|
23
|
+
defaultTagName: 'a',
|
|
26
24
|
ref,
|
|
27
25
|
render,
|
|
28
26
|
props: mergeProps({
|
|
29
|
-
className: cn(
|
|
27
|
+
className: cn('sprout-breadcrumb-link', className),
|
|
30
28
|
children: label(children, truncate),
|
|
31
29
|
}, props),
|
|
32
|
-
state: { slot:
|
|
30
|
+
state: { slot: 'breadcrumb-link' },
|
|
33
31
|
});
|
|
34
32
|
}
|
|
35
33
|
export function BreadcrumbPage({ className, truncate, children, ...props }) {
|
|
36
|
-
return (_jsx("span", { "data-slot": "breadcrumb-page", role: "link", "aria-disabled": "true", "aria-current": "page", className: cn(
|
|
34
|
+
return (_jsx("span", { "data-slot": "breadcrumb-page", role: "link", "aria-disabled": "true", "aria-current": "page", className: cn('sprout-breadcrumb-page', className), ...props, children: label(children, truncate) }));
|
|
37
35
|
}
|
|
38
36
|
export function BreadcrumbSeparator({ children, className, ...props }) {
|
|
39
|
-
return (_jsx("li", { "data-slot": "breadcrumb-separator", role: "presentation", "aria-hidden": "true", className: cn(
|
|
37
|
+
return (_jsx("li", { "data-slot": "breadcrumb-separator", role: "presentation", "aria-hidden": "true", className: cn('sprout-breadcrumb-separator', className), ...props, children: children ?? _jsx(ChevronRight, {}) }));
|
|
40
38
|
}
|
|
41
39
|
/** Marks hidden folders. It is hidden from screen readers, so put the reason in a visually hidden sibling. */
|
|
42
40
|
export function BreadcrumbEllipsis({ className, ...props }) {
|
|
43
|
-
return (_jsxs("span", { "data-slot": "breadcrumb-ellipsis", role: "presentation", "aria-hidden": "true", className: cn(
|
|
41
|
+
return (_jsxs("span", { "data-slot": "breadcrumb-ellipsis", role: "presentation", "aria-hidden": "true", className: cn('sprout-breadcrumb-ellipsis', className), ...props, children: [_jsx(MoreH, {}), _jsx("span", { className: "sprout-breadcrumb-sr-only", children: "More" })] }));
|
|
44
42
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { ComponentProps } from
|
|
2
|
-
import { useRender } from
|
|
3
|
-
import { type SeparatorLineProps } from
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import { type SeparatorLineProps } from './separator.js';
|
|
4
4
|
export declare const buttonGroupOrientationNames: readonly ["horizontal", "vertical"];
|
|
5
5
|
export type ButtonGroupOrientation = (typeof buttonGroupOrientationNames)[number];
|
|
6
6
|
export interface ButtonGroupVariantOptions {
|
|
7
7
|
orientation?: ButtonGroupOrientation | null;
|
|
8
8
|
className?: string;
|
|
9
9
|
}
|
|
10
|
-
export declare function buttonGroupVariants({ orientation, className
|
|
11
|
-
export interface ButtonGroupProps extends ComponentProps<
|
|
10
|
+
export declare function buttonGroupVariants({ orientation, className }?: ButtonGroupVariantOptions): string;
|
|
11
|
+
export interface ButtonGroupProps extends ComponentProps<'div'> {
|
|
12
12
|
/** `"vertical"` stacks the controls and joins them top to bottom. */
|
|
13
13
|
orientation?: ButtonGroupOrientation | null;
|
|
14
14
|
}
|
|
@@ -17,7 +17,7 @@ export interface ButtonGroupProps extends ComponentProps<"div"> {
|
|
|
17
17
|
* `aria-label` that names what the buttons act on.
|
|
18
18
|
*/
|
|
19
19
|
export declare function ButtonGroup({ className, orientation, ...props }: ButtonGroupProps): import("react").JSX.Element;
|
|
20
|
-
export type ButtonGroupTextProps = useRender.ComponentProps<
|
|
20
|
+
export type ButtonGroupTextProps = useRender.ComponentProps<'div'>;
|
|
21
21
|
/** A muted, non-interactive cell for a label or value inside a group. */
|
|
22
22
|
export declare function ButtonGroupText({ className, render, ref, ...props }: ButtonGroupTextProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
23
23
|
export type ButtonGroupSeparatorProps = SeparatorLineProps;
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { mergeProps } from
|
|
4
|
-
import { useRender } from
|
|
5
|
-
import { cn } from
|
|
6
|
-
import { Separator } from
|
|
7
|
-
export const buttonGroupOrientationNames = [
|
|
8
|
-
export function buttonGroupVariants({ orientation, className
|
|
9
|
-
return cn(
|
|
3
|
+
import { mergeProps } from '@base-ui/react/merge-props';
|
|
4
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
5
|
+
import { cn } from '../internal/classes.js';
|
|
6
|
+
import { Separator } from './separator.js';
|
|
7
|
+
export const buttonGroupOrientationNames = ['horizontal', 'vertical'];
|
|
8
|
+
export function buttonGroupVariants({ orientation, className } = {}) {
|
|
9
|
+
return cn('sprout-button-group', `sprout-button-group-${orientation ?? 'horizontal'}`, className);
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* Joins buttons, text, and separators into one control. Give it an
|
|
13
13
|
* `aria-label` that names what the buttons act on.
|
|
14
14
|
*/
|
|
15
15
|
export function ButtonGroup({ className, orientation, ...props }) {
|
|
16
|
-
return (_jsx("div", { role: "group", "data-slot": "button-group", "data-orientation": orientation ??
|
|
16
|
+
return (_jsx("div", { role: "group", "data-slot": "button-group", "data-orientation": orientation ?? 'horizontal', className: buttonGroupVariants({ orientation, className }), ...props }));
|
|
17
17
|
}
|
|
18
18
|
/** A muted, non-interactive cell for a label or value inside a group. */
|
|
19
19
|
export function ButtonGroupText({ className, render, ref, ...props }) {
|
|
20
20
|
return useRender({
|
|
21
|
-
defaultTagName:
|
|
21
|
+
defaultTagName: 'div',
|
|
22
22
|
ref,
|
|
23
23
|
render,
|
|
24
24
|
props: mergeProps({
|
|
25
|
-
|
|
26
|
-
className: cn(
|
|
25
|
+
'data-slot': 'button-group-text',
|
|
26
|
+
className: cn('sprout-button-group-text', className),
|
|
27
27
|
}, props),
|
|
28
28
|
});
|
|
29
29
|
}
|
|
@@ -31,6 +31,6 @@ export function ButtonGroupText({ className, render, ref, ...props }) {
|
|
|
31
31
|
* A line between grouped controls. It runs across the group, so it is
|
|
32
32
|
* `"vertical"` (the default) in a row and `"horizontal"` in a column.
|
|
33
33
|
*/
|
|
34
|
-
export function ButtonGroupSeparator({ className, orientation =
|
|
35
|
-
return (_jsx(Separator, { "data-slot": "button-group-separator", orientation: orientation, tone: tone, className:
|
|
34
|
+
export function ButtonGroupSeparator({ className, orientation = 'vertical', tone = 'input', ...props }) {
|
|
35
|
+
return (_jsx(Separator, { "data-slot": "button-group-separator", orientation: orientation, tone: tone, className: state => cn('sprout-button-group-separator', typeof className === 'function' ? className(state) : className), ...props }));
|
|
36
36
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Button as BaseButton } from
|
|
2
|
-
import { type ReactElement } from
|
|
1
|
+
import type { Button as BaseButton } from '@base-ui/react/button';
|
|
2
|
+
import { type ReactElement } from 'react';
|
|
3
3
|
export declare const buttonVariantNames: readonly ["default", "outline", "secondary", "ghost", "destructive", "link", "scope"];
|
|
4
4
|
export declare const buttonSizeNames: readonly ["default", "xs", "sm", "lg", "icon", "icon-xs", "icon-sm", "icon-lg", "back", "onboarding", "bud", "bud-labeled", "chat-row", "task-link", "card-title", "result-card", "calendar-title", "calendar", "calendar-icon", "nav", "column-header", "column-header-end", "table-link", "badge"];
|
|
5
5
|
export type ButtonVariant = (typeof buttonVariantNames)[number];
|
|
@@ -9,30 +9,30 @@ export interface ButtonVariantOptions {
|
|
|
9
9
|
size?: ButtonSize | null;
|
|
10
10
|
className?: string;
|
|
11
11
|
}
|
|
12
|
-
export declare function buttonVariants({ variant, size, className
|
|
12
|
+
export declare function buttonVariants({ variant, size, className }?: ButtonVariantOptions): string;
|
|
13
13
|
export type ButtonBlockerFix =
|
|
14
14
|
/** An element id on this page; scrolled into view and focused (or, when it has no tabindex, its first focusable descendant). */
|
|
15
15
|
{
|
|
16
|
-
kind:
|
|
16
|
+
kind: 'jump';
|
|
17
17
|
label: string;
|
|
18
18
|
target: string;
|
|
19
19
|
}
|
|
20
20
|
/** A link element, such as a router `<Link>`, rendered through Button `render`. */
|
|
21
21
|
| {
|
|
22
|
-
kind:
|
|
22
|
+
kind: 'link';
|
|
23
23
|
label: string;
|
|
24
24
|
link: ReactElement;
|
|
25
25
|
} | {
|
|
26
|
-
kind:
|
|
26
|
+
kind: 'action';
|
|
27
27
|
label: string;
|
|
28
28
|
onClick: () => void;
|
|
29
29
|
};
|
|
30
30
|
export type ButtonState = {
|
|
31
|
-
kind:
|
|
31
|
+
kind: 'ready';
|
|
32
32
|
} | {
|
|
33
|
-
kind:
|
|
33
|
+
kind: 'busy';
|
|
34
34
|
} | {
|
|
35
|
-
kind:
|
|
35
|
+
kind: 'blocked';
|
|
36
36
|
reason: string;
|
|
37
37
|
fix?: ButtonBlockerFix | undefined;
|
|
38
38
|
};
|
|
@@ -70,8 +70,8 @@ export declare function jumpTo(target: string | Element): void;
|
|
|
70
70
|
*/
|
|
71
71
|
export declare function useActionControl(state: ButtonState): {
|
|
72
72
|
button: {
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
'aria-describedby'?: string | undefined;
|
|
74
|
+
'aria-busy'?: true | undefined;
|
|
75
75
|
disabled: boolean;
|
|
76
76
|
focusableWhenDisabled: boolean;
|
|
77
77
|
};
|
|
@@ -1,72 +1,62 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useId } from
|
|
4
|
-
import { cn, stateClassName } from
|
|
5
|
-
import { Pressable } from
|
|
6
|
-
import { Spinner } from
|
|
7
|
-
export const buttonVariantNames = [
|
|
8
|
-
"default",
|
|
9
|
-
"outline",
|
|
10
|
-
"secondary",
|
|
11
|
-
"ghost",
|
|
12
|
-
"destructive",
|
|
13
|
-
"link",
|
|
14
|
-
"scope",
|
|
15
|
-
];
|
|
3
|
+
import { useId } from 'react';
|
|
4
|
+
import { cn, stateClassName } from '../internal/classes.js';
|
|
5
|
+
import { Pressable } from '../internal/pressable.js';
|
|
6
|
+
import { Spinner } from './spinner.js';
|
|
7
|
+
export const buttonVariantNames = ['default', 'outline', 'secondary', 'ghost', 'destructive', 'link', 'scope'];
|
|
16
8
|
export const buttonSizeNames = [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
9
|
+
'default',
|
|
10
|
+
'xs',
|
|
11
|
+
'sm',
|
|
12
|
+
'lg',
|
|
13
|
+
'icon',
|
|
14
|
+
'icon-xs',
|
|
15
|
+
'icon-sm',
|
|
16
|
+
'icon-lg',
|
|
17
|
+
'back',
|
|
18
|
+
'onboarding',
|
|
19
|
+
'bud',
|
|
20
|
+
'bud-labeled',
|
|
21
|
+
'chat-row',
|
|
22
|
+
'task-link',
|
|
23
|
+
'card-title',
|
|
24
|
+
'result-card',
|
|
25
|
+
'calendar-title',
|
|
26
|
+
'calendar',
|
|
27
|
+
'calendar-icon',
|
|
28
|
+
'nav',
|
|
29
|
+
'column-header',
|
|
30
|
+
'column-header-end',
|
|
31
|
+
'table-link',
|
|
32
|
+
'badge',
|
|
41
33
|
];
|
|
42
|
-
export function buttonVariants({ variant, size, className
|
|
43
|
-
return cn(
|
|
34
|
+
export function buttonVariants({ variant, size, className } = {}) {
|
|
35
|
+
return cn('sprout-button', `sprout-button-variant-${variant ?? 'default'}`, `sprout-button-size-${size ?? 'default'}`, className);
|
|
44
36
|
}
|
|
45
37
|
export function Button({ state, pendingLabel, ...props }) {
|
|
46
|
-
return state ?
|
|
38
|
+
return state ? _jsx(StatefulButton, { state: state, pendingLabel: pendingLabel, ...props }) : _jsx(ButtonElement, { ...props });
|
|
47
39
|
}
|
|
48
40
|
function ButtonElement({ variant, size, className, ...props }) {
|
|
49
|
-
return (_jsx(Pressable, { "data-slot": "button", "data-variant": variant ??
|
|
41
|
+
return (_jsx(Pressable, { "data-slot": "button", "data-variant": variant ?? 'default', "data-size": size ?? 'default', ...props, className: stateClassName(buttonVariants({ variant, size }), className) }));
|
|
50
42
|
}
|
|
51
43
|
function StatefulButton({ state, pendingLabel, className, children, ...props }) {
|
|
52
44
|
const action = useActionControl(state);
|
|
53
|
-
const pending = state.kind ===
|
|
54
|
-
return (_jsxs("div", { "data-slot": "button-action", "data-state": state.kind, className: cn(
|
|
45
|
+
const pending = state.kind === 'busy' && pendingLabel;
|
|
46
|
+
return (_jsxs("div", { "data-slot": "button-action", "data-state": state.kind, className: cn('sprout-button-action', className), children: [_jsx(ButtonElement, { ...props, ...action.button, disabled: action.button.disabled || props.disabled, children: pending ? (_jsxs(_Fragment, { children: [_jsx(Spinner, { "aria-hidden": "true" }), pendingLabel] })) : (children) }), action.reason] }));
|
|
55
47
|
}
|
|
56
48
|
/** A row of actions that share one busy or blocked state and one reason. */
|
|
57
49
|
export function ActionGroup({ state, actions, className }) {
|
|
58
50
|
const action = useActionControl(state);
|
|
59
|
-
return (_jsxs("div", { "data-slot": "action-group", "data-state": state.kind, className: cn(
|
|
51
|
+
return (_jsxs("div", { "data-slot": "action-group", "data-state": state.kind, className: cn('sprout-action-group', className), children: [_jsx("div", { className: "sprout-action-group-row", children: actions.map(item => (_jsx(Button, { variant: item.variant, onClick: item.onClick, ...action.button, children: item.label }, item.label))) }), action.reason] }));
|
|
60
52
|
}
|
|
61
53
|
const focusable = ':is(a[href], button, input, select, textarea, [tabindex]):not([disabled], [tabindex="-1"], [type="hidden"])';
|
|
62
54
|
export function jumpTo(target) {
|
|
63
|
-
const element = typeof target ===
|
|
55
|
+
const element = typeof target === 'string' ? document.getElementById(target) : target;
|
|
64
56
|
if (!element)
|
|
65
57
|
return;
|
|
66
|
-
const control = element.matches(focusable) || element.hasAttribute(
|
|
67
|
-
|
|
68
|
-
: element.querySelector(focusable);
|
|
69
|
-
(control ?? element).scrollIntoView({ block: "center" });
|
|
58
|
+
const control = element.matches(focusable) || element.hasAttribute('tabindex') ? element : element.querySelector(focusable);
|
|
59
|
+
(control ?? element).scrollIntoView({ block: 'center' });
|
|
70
60
|
if (control instanceof HTMLElement)
|
|
71
61
|
control.focus({ preventScroll: true });
|
|
72
62
|
}
|
|
@@ -78,16 +68,16 @@ export function useActionControl(state) {
|
|
|
78
68
|
const reasonId = useId();
|
|
79
69
|
return {
|
|
80
70
|
button: {
|
|
81
|
-
disabled: state.kind !==
|
|
71
|
+
disabled: state.kind !== 'ready',
|
|
82
72
|
focusableWhenDisabled: true,
|
|
83
|
-
...(state.kind ===
|
|
84
|
-
...(state.kind ===
|
|
73
|
+
...(state.kind === 'busy' && { 'aria-busy': true }),
|
|
74
|
+
...(state.kind === 'blocked' && { 'aria-describedby': reasonId }),
|
|
85
75
|
},
|
|
86
|
-
reason: state.kind ===
|
|
76
|
+
reason: state.kind === 'blocked' ? (_jsxs("p", { "data-slot": "action-reason", className: "sprout-action-reason", children: [_jsx("span", { id: reasonId, children: state.reason }), state.fix && _jsx(FixButton, { fix: state.fix })] })) : null,
|
|
87
77
|
};
|
|
88
78
|
}
|
|
89
79
|
function FixButton({ fix }) {
|
|
90
|
-
if (fix.kind ===
|
|
80
|
+
if (fix.kind === 'link')
|
|
91
81
|
return (_jsx(Button, { variant: "link", size: "xs", nativeButton: false, render: fix.link, children: fix.label }));
|
|
92
|
-
return (_jsx(Button, { variant: "link", size: "xs", onClick: fix.kind ===
|
|
82
|
+
return (_jsx(Button, { variant: "link", size: "xs", onClick: fix.kind === 'jump' ? () => jumpTo(fix.target) : fix.onClick, children: fix.label }));
|
|
93
83
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { type ComponentProps } from
|
|
2
|
-
import { DayPicker, type DayButtonProps } from
|
|
3
|
-
import { type ButtonVariant } from
|
|
4
|
-
export type { DateRange, Matcher } from
|
|
1
|
+
import { type ComponentProps } from 'react';
|
|
2
|
+
import { DayPicker, type DayButtonProps } from 'react-day-picker';
|
|
3
|
+
import { type ButtonVariant } from './button.js';
|
|
4
|
+
export type { DateRange, Matcher } from 'react-day-picker';
|
|
5
5
|
export declare const calendarCaptionLayoutNames: readonly ["label", "dropdown", "dropdown-months", "dropdown-years"];
|
|
6
6
|
export type CalendarCaptionLayout = (typeof calendarCaptionLayoutNames)[number];
|
|
7
7
|
export type CalendarProps = ComponentProps<typeof DayPicker> & {
|
|
8
8
|
/** The Button variant for the previous and next month buttons. Defaults to `ghost`. */
|
|
9
9
|
buttonVariant?: ButtonVariant;
|
|
10
10
|
};
|
|
11
|
-
type DayPickerLocale = ComponentProps<typeof DayPicker>[
|
|
11
|
+
type DayPickerLocale = ComponentProps<typeof DayPicker>['locale'];
|
|
12
12
|
/**
|
|
13
13
|
* A month grid for picking one date, several dates, or a range. It takes every
|
|
14
14
|
* React DayPicker prop, including `mode`, `selected`, `onSelect`,
|