@surflane/ui 0.5.0 → 0.7.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 +1 -1
- package/dist/app-shell.d.ts +44 -3
- package/dist/app-shell.js +81 -8
- package/dist/bottom-navigation.d.ts +66 -0
- package/dist/bottom-navigation.js +36 -0
- package/dist/chart.d.ts +16 -0
- package/dist/chart.js +103 -48
- package/dist/css/accordion.css +11 -0
- package/dist/css/alert-dialog.css +11 -0
- package/{src → dist/css}/all.css +1 -1
- package/dist/css/app-shell.css +12 -0
- package/dist/css/autocomplete.css +15 -0
- package/dist/css/avatar.css +10 -0
- package/dist/css/badge.css +10 -0
- package/dist/css/bottom-navigation.css +8 -0
- package/dist/css/breadcrumbs.css +12 -0
- package/dist/css/button.css +8 -0
- package/dist/css/card.css +11 -0
- package/dist/css/chart.css +13 -0
- package/dist/css/checkbox-group.css +9 -0
- package/dist/css/checkbox.css +9 -0
- package/dist/css/choice-label.css +9 -0
- package/dist/css/code.css +13 -0
- package/dist/css/collapsible.css +11 -0
- package/dist/css/combobox.css +14 -0
- package/dist/css/context-menu.css +15 -0
- package/dist/css/date-picker.css +12 -0
- package/dist/css/dialog.css +10 -0
- package/dist/css/drawer.css +11 -0
- package/dist/css/empty-state.css +9 -0
- package/dist/css/field.css +10 -0
- package/dist/css/fieldset.css +8 -0
- package/dist/css/file-upload.css +17 -0
- package/dist/css/filter-bar.css +8 -0
- package/dist/css/form.css +8 -0
- package/dist/css/icon.css +8 -0
- package/dist/css/inline-message.css +10 -0
- package/dist/css/input.css +9 -0
- package/dist/css/layout.css +9 -0
- package/dist/css/link.css +9 -0
- package/dist/css/list.css +9 -0
- package/dist/css/markdown.css +18 -0
- package/dist/css/menu.css +14 -0
- package/dist/css/menubar.css +9 -0
- package/dist/css/meter.css +9 -0
- package/dist/css/native-select.css +13 -0
- package/dist/css/navigation-menu.css +11 -0
- package/dist/css/number-field.css +11 -0
- package/dist/css/otp-field.css +10 -0
- package/dist/css/page-header.css +11 -0
- package/dist/css/pagination.css +11 -0
- package/dist/css/popover.css +9 -0
- package/dist/css/preview-card.css +11 -0
- package/dist/css/progress.css +9 -0
- package/dist/css/radio-group.css +9 -0
- package/dist/css/rules/accordion.css +21 -0
- package/dist/css/rules/alert-dialog.css +23 -0
- package/dist/css/rules/app-shell.css +227 -0
- package/dist/css/rules/autocomplete.css +3 -0
- package/dist/css/rules/avatar.css +17 -0
- package/dist/css/rules/badge.css +17 -0
- package/dist/css/rules/bar.css +38 -0
- package/dist/css/rules/base.css +46 -0
- package/dist/css/rules/bottom-navigation.css +142 -0
- package/dist/css/rules/breadcrumbs.css +9 -0
- package/dist/css/rules/button.css +131 -0
- package/dist/css/rules/card.css +10 -0
- package/dist/css/rules/chart.css +264 -0
- package/dist/css/rules/checkbox-group.css +3 -0
- package/dist/css/rules/checkbox.css +25 -0
- package/dist/css/rules/choice-label.css +52 -0
- package/dist/css/rules/choice.css +104 -0
- package/dist/css/rules/code.css +9 -0
- package/dist/css/rules/collapsible.css +12 -0
- package/dist/css/rules/combobox.css +177 -0
- package/dist/css/rules/context-menu.css +9 -0
- package/dist/css/rules/date-picker.css +301 -0
- package/dist/css/rules/dialog.css +160 -0
- package/dist/css/rules/disclosure.css +107 -0
- package/dist/css/rules/drawer.css +18 -0
- package/dist/css/rules/empty-state.css +9 -0
- package/dist/css/rules/field-control.css +70 -0
- package/dist/css/rules/field.css +56 -0
- package/dist/css/rules/fieldset.css +23 -0
- package/dist/css/rules/file-upload.css +156 -0
- package/dist/css/rules/filter-bar.css +56 -0
- package/dist/css/rules/form.css +15 -0
- package/dist/css/rules/gauge.css +61 -0
- package/dist/css/rules/icon.css +27 -0
- package/dist/css/rules/inline-message.css +10 -0
- package/dist/css/rules/input-group.css +69 -0
- package/dist/css/rules/input.css +33 -0
- package/dist/css/rules/item.css +14 -0
- package/dist/css/rules/layout.css +3 -0
- package/dist/css/rules/link.css +9 -0
- package/dist/css/rules/list.css +10 -0
- package/dist/css/rules/markdown.css +63 -0
- package/dist/css/rules/menu.css +97 -0
- package/dist/css/rules/menubar.css +18 -0
- package/dist/css/rules/meter.css +3 -0
- package/dist/css/rules/native-select.css +3 -0
- package/dist/css/rules/navigation-menu.css +159 -0
- package/dist/css/rules/number-field.css +55 -0
- package/dist/css/rules/otp-field.css +68 -0
- package/dist/css/rules/page-header.css +3 -0
- package/dist/css/rules/pagination.css +3 -0
- package/dist/css/rules/panel.css +221 -0
- package/dist/css/rules/popover.css +41 -0
- package/dist/css/rules/popup.css +27 -0
- package/dist/css/rules/preview-card.css +60 -0
- package/dist/css/rules/progress.css +14 -0
- package/dist/css/rules/radio-group.css +26 -0
- package/dist/css/rules/scroll-area.css +101 -0
- package/dist/css/rules/select.css +88 -0
- package/dist/css/rules/separator.css +3 -0
- package/dist/css/rules/sheet.css +3 -0
- package/dist/css/rules/sizing.css +140 -0
- package/dist/css/rules/skeleton.css +41 -0
- package/dist/css/rules/slider.css +123 -0
- package/dist/css/rules/sparkline.css +52 -0
- package/dist/css/rules/spinner.css +38 -0
- package/dist/css/rules/stat.css +59 -0
- package/dist/css/rules/switch.css +50 -0
- package/dist/css/rules/syntax-highlighter.css +82 -0
- package/dist/css/rules/table.css +28 -0
- package/dist/css/rules/tabs.css +126 -0
- package/dist/css/rules/textarea.css +21 -0
- package/dist/css/rules/toast.css +247 -0
- package/dist/css/rules/toggle-group.css +3 -0
- package/dist/css/rules/toggle.css +27 -0
- package/dist/css/rules/toolbar.css +62 -0
- package/dist/css/rules/tooltip.css +38 -0
- package/dist/css/rules/tree.css +98 -0
- package/dist/css/rules/typography.css +3 -0
- package/dist/css/scroll-area.css +8 -0
- package/dist/css/select.css +12 -0
- package/dist/css/separator.css +9 -0
- package/dist/css/sheet.css +11 -0
- package/dist/css/sizing.css +7 -0
- package/dist/css/skeleton.css +8 -0
- package/dist/css/slider.css +8 -0
- package/dist/css/sparkline.css +8 -0
- package/dist/css/spinner.css +8 -0
- package/dist/css/stat.css +9 -0
- package/dist/css/styles.css +100 -0
- package/dist/css/switch.css +9 -0
- package/dist/css/syntax-highlighter.css +9 -0
- package/dist/css/table.css +12 -0
- package/dist/css/tabs.css +8 -0
- package/dist/css/textarea.css +10 -0
- package/dist/css/toast.css +11 -0
- package/dist/css/toggle-group.css +9 -0
- package/dist/css/toggle.css +10 -0
- package/dist/css/toolbar.css +12 -0
- package/dist/css/tooltip.css +9 -0
- package/dist/css/tree.css +10 -0
- package/dist/css/typography.css +9 -0
- package/dist/format.d.ts +25 -0
- package/dist/format.js +42 -0
- package/dist/icon.d.ts +1 -0
- package/dist/icon.js +1 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.js +6 -2
- package/dist/sparkline.d.ts +41 -0
- package/dist/sparkline.js +50 -0
- package/dist/stat.d.ts +59 -0
- package/dist/stat.js +26 -0
- package/dist/status.d.ts +1 -1
- package/dist/status.js +1 -0
- package/dist/toast.d.ts +57 -1
- package/dist/toast.js +73 -2
- package/dist/tooltip.d.ts +9 -3
- package/dist/tooltip.js +4 -4
- package/package.json +90 -7
- package/src/styles.css +0 -3948
package/dist/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export { ChoiceLabel, type ChoiceLabelProps } from './choice-label.js';
|
|
|
23
23
|
export { Popover, PopoverArrow, PopoverBackdrop, PopoverClose, PopoverDescription, PopoverHandle, PopoverPopup, PopoverPortal, PopoverPositioner, PopoverRoot, PopoverTitle, PopoverTrigger, PopoverViewport, PopoverContent, } from './popover.js';
|
|
24
24
|
export { Menu, MenuArrow, MenuBackdrop, MenuCheckboxItem, MenuCheckboxItemIndicator, MenuClear, MenuEmpty, MenuFilterProvider, MenuGroup, MenuGroupLabel, MenuHandle, MenuInput, MenuItem, MenuLinkItem, MenuList, MenuPopup, MenuPortal, MenuPositioner, MenuRadioGroup, MenuRadioItem, MenuRadioItemIndicator, MenuRoot, MenuSeparator, MenuSubmenuRoot, MenuSubmenuTrigger, MenuTrigger, MenuViewport, MenuContent, } from './menu.js';
|
|
25
25
|
export { ContextMenu, ContextMenuArrow, ContextMenuBackdrop, ContextMenuCheckboxItem, ContextMenuCheckboxItemIndicator, ContextMenuGroup, ContextMenuGroupLabel, ContextMenuItem, ContextMenuLinkItem, ContextMenuPopup, ContextMenuPortal, ContextMenuPositioner, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuRadioItemIndicator, ContextMenuRoot, ContextMenuSeparator, ContextMenuSubmenuRoot, ContextMenuSubmenuTrigger, ContextMenuTrigger, ContextMenuContent, } from './context-menu.js';
|
|
26
|
-
export { Tooltip, TooltipProvider } from './tooltip.js';
|
|
26
|
+
export { Tooltip, TooltipProvider, type TooltipProps } from './tooltip.js';
|
|
27
27
|
export { PreviewCard, PreviewCardArrow, PreviewCardBackdrop, PreviewCardHandle, PreviewCardPopup, PreviewCardPortal, PreviewCardPositioner, PreviewCardRoot, PreviewCardTrigger, PreviewCardViewport, PreviewCardContent, } from './preview-card.js';
|
|
28
28
|
export { Dialog, DialogBackdrop, DialogClose, DialogDescription, DialogHandle, DialogPopup, DialogPortal, DialogRoot, DialogTitle, DialogTrigger, DialogViewport, DialogContent, DialogHeader, DialogBody, DialogFooter, DialogCloseButton, } from './dialog.js';
|
|
29
29
|
export { AlertDialog, AlertDialogBackdrop, AlertDialogClose, AlertDialogDescription, AlertDialogHandle, AlertDialogPopup, AlertDialogPortal, AlertDialogRoot, AlertDialogTitle, AlertDialogTrigger, AlertDialogViewport, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, } from './alert-dialog.js';
|
|
@@ -37,6 +37,7 @@ export { Menubar } from './menubar.js';
|
|
|
37
37
|
export { Link, type LinkProps } from './link.js';
|
|
38
38
|
export { Breadcrumbs, BreadcrumbsRoot, BreadcrumbsList, BreadcrumbsItem, BreadcrumbsLink, BreadcrumbsSeparator, BreadcrumbsCurrent, } from './breadcrumbs.js';
|
|
39
39
|
export { Pagination, type PaginationProps } from './pagination.js';
|
|
40
|
+
export { BottomNavigation, BottomNavigationRoot, BottomNavigationItem, type BottomNavigationRootProps, type BottomNavigationItemProps, } from './bottom-navigation.js';
|
|
40
41
|
export { Avatar, AvatarFallback, AvatarImage, AvatarRoot, AvatarStatus, } from './avatar.js';
|
|
41
42
|
export { Badge, StatusBadge, type BadgeProps, type StatusTone, } from './badge.js';
|
|
42
43
|
export { Card, CardRoot, CardHeader, CardTitle, CardDescription, CardBody, CardFooter, } from './card.js';
|
|
@@ -44,21 +45,24 @@ export { Table, TableContainer, TableRoot, TableCaption, TableHead, TableBody, T
|
|
|
44
45
|
export { CodeBlock, type CodeBlockProps } from './code.js';
|
|
45
46
|
export { SyntaxHighlighter, syntaxLanguages, type SyntaxHighlighterProps, } from './syntax-highlighter.js';
|
|
46
47
|
export { List, ListRoot, ListItem, ListContent, ListTitle, ListDescription, ListActions, } from './list.js';
|
|
48
|
+
export { Stat, StatRoot, StatLabel, StatValue, StatChange, StatCaption, type StatChangeProps, type StatDirection, } from './stat.js';
|
|
49
|
+
export { Sparkline, type SparklineProps, type SparklineTrend, } from './sparkline.js';
|
|
47
50
|
export { ScrollArea } from './scroll-area.js';
|
|
48
51
|
export { Separator } from './separator.js';
|
|
49
52
|
export { Progress, ProgressIndicator, ProgressLabel, ProgressRoot, ProgressTrack, ProgressValue, } from './progress.js';
|
|
50
53
|
export { Meter, MeterIndicator, MeterLabel, MeterRoot, MeterTrack, MeterValue, } from './meter.js';
|
|
51
|
-
export { Toast, type ToastRootProps, type ToastViewportProps, ToastAction, ToastArrow, ToastClose, ToastContent, ToastDescription, ToastPortal, ToastPositioner, ToastProvider, ToastRoot, ToastTitle, ToastViewport, ToastIcon, ToastText, } from './toast.js';
|
|
54
|
+
export { Toast, type ToastRootProps, type ToastViewportProps, ToastAction, ToastArrow, ToastClose, ToastContent, ToastDescription, ToastPortal, ToastPositioner, ToastProvider, ToastRoot, ToastTitle, ToastViewport, ToastIcon, ToastText, toast, createToaster, Toaster, type ToastOptions, type ToastStep, type ToastHelper, type ToasterProps, } from './toast.js';
|
|
52
55
|
export { InlineMessage, InlineMessageRoot, InlineMessageIcon, InlineMessageContent, InlineMessageTitle, InlineMessageDescription, InlineMessageActions, } from './inline-message.js';
|
|
53
56
|
export { Spinner, type SpinnerProps } from './spinner.js';
|
|
54
57
|
export { Skeleton, type SkeletonProps } from './skeleton.js';
|
|
55
58
|
export { EmptyState, EmptyStateRoot, EmptyStateIcon, EmptyStateTitle, EmptyStateDescription, EmptyStateActions, } from './empty-state.js';
|
|
56
59
|
export { Container, Stack, Inline, Grid, GridItem, Surface, type SurfaceKind, type Space, } from './layout.js';
|
|
57
60
|
export { Heading, Text, Prose } from './typography.js';
|
|
61
|
+
export { formatNumber, formatCurrency, formatPercent, missingValue, type NumberFormatOptions, } from './format.js';
|
|
58
62
|
export { Icon, iconNames, type IconName, type IconProps } from './icon.js';
|
|
59
63
|
export { SizeProvider, type ComponentSize, type ComponentSizeAlias, } from './sizing.js';
|
|
60
64
|
export { DirectionProvider } from '@base-ui/react/direction-provider';
|
|
61
65
|
export { Slot } from './slot.js';
|
|
62
|
-
export { AppShell, AppShellRoot, AppShellHeader, AppShellSidebar, AppShellContent, AppShellPage, AppShellFooter, AppShellLabel, AppShellLink, } from './app-shell.js';
|
|
66
|
+
export { AppShell, AppShellRoot, AppShellHeader, AppShellSidebar, AppShellSidebarToggle, type AppShellRootProps, type AppShellSidebarToggleProps, AppShellContent, AppShellPage, AppShellFooter, AppShellLabel, AppShellLink, } from './app-shell.js';
|
|
63
67
|
export { PageHeader } from './page-header.js';
|
|
64
68
|
export { FilterBar, FilterBarRoot, FilterBarControls, FilterBarField, FilterBarActions, FilterBarSummary, } from './filter-bar.js';
|
package/dist/index.js
CHANGED
|
@@ -47,6 +47,7 @@ export { Menubar } from './menubar.js';
|
|
|
47
47
|
export { Link } from './link.js';
|
|
48
48
|
export { Breadcrumbs, BreadcrumbsRoot, BreadcrumbsList, BreadcrumbsItem, BreadcrumbsLink, BreadcrumbsSeparator, BreadcrumbsCurrent, } from './breadcrumbs.js';
|
|
49
49
|
export { Pagination } from './pagination.js';
|
|
50
|
+
export { BottomNavigation, BottomNavigationRoot, BottomNavigationItem, } from './bottom-navigation.js';
|
|
50
51
|
// Data display
|
|
51
52
|
export { Avatar, AvatarFallback, AvatarImage, AvatarRoot, AvatarStatus, } from './avatar.js';
|
|
52
53
|
export { Badge, StatusBadge, } from './badge.js';
|
|
@@ -55,13 +56,15 @@ export { Table, TableContainer, TableRoot, TableCaption, TableHead, TableBody, T
|
|
|
55
56
|
export { CodeBlock } from './code.js';
|
|
56
57
|
export { SyntaxHighlighter, syntaxLanguages, } from './syntax-highlighter.js';
|
|
57
58
|
export { List, ListRoot, ListItem, ListContent, ListTitle, ListDescription, ListActions, } from './list.js';
|
|
59
|
+
export { Stat, StatRoot, StatLabel, StatValue, StatChange, StatCaption, } from './stat.js';
|
|
60
|
+
export { Sparkline, } from './sparkline.js';
|
|
58
61
|
// Structure
|
|
59
62
|
export { ScrollArea } from './scroll-area.js';
|
|
60
63
|
export { Separator } from './separator.js';
|
|
61
64
|
// Feedback
|
|
62
65
|
export { Progress, ProgressIndicator, ProgressLabel, ProgressRoot, ProgressTrack, ProgressValue, } from './progress.js';
|
|
63
66
|
export { Meter, MeterIndicator, MeterLabel, MeterRoot, MeterTrack, MeterValue, } from './meter.js';
|
|
64
|
-
export { Toast, ToastAction, ToastArrow, ToastClose, ToastContent, ToastDescription, ToastPortal, ToastPositioner, ToastProvider, ToastRoot, ToastTitle, ToastViewport, ToastIcon, ToastText, } from './toast.js';
|
|
67
|
+
export { Toast, ToastAction, ToastArrow, ToastClose, ToastContent, ToastDescription, ToastPortal, ToastPositioner, ToastProvider, ToastRoot, ToastTitle, ToastViewport, ToastIcon, ToastText, toast, createToaster, Toaster, } from './toast.js';
|
|
65
68
|
export { InlineMessage, InlineMessageRoot, InlineMessageIcon, InlineMessageContent, InlineMessageTitle, InlineMessageDescription, InlineMessageActions, } from './inline-message.js';
|
|
66
69
|
export { Spinner } from './spinner.js';
|
|
67
70
|
export { Skeleton } from './skeleton.js';
|
|
@@ -69,11 +72,12 @@ export { EmptyState, EmptyStateRoot, EmptyStateIcon, EmptyStateTitle, EmptyState
|
|
|
69
72
|
// Foundations
|
|
70
73
|
export { Container, Stack, Inline, Grid, GridItem, Surface, } from './layout.js';
|
|
71
74
|
export { Heading, Text, Prose } from './typography.js';
|
|
75
|
+
export { formatNumber, formatCurrency, formatPercent, missingValue, } from './format.js';
|
|
72
76
|
export { Icon, iconNames } from './icon.js';
|
|
73
77
|
export { SizeProvider, } from './sizing.js';
|
|
74
78
|
export { DirectionProvider } from '@base-ui/react/direction-provider';
|
|
75
79
|
export { Slot } from './slot.js';
|
|
76
80
|
// Patterns
|
|
77
|
-
export { AppShell, AppShellRoot, AppShellHeader, AppShellSidebar, AppShellContent, AppShellPage, AppShellFooter, AppShellLabel, AppShellLink, } from './app-shell.js';
|
|
81
|
+
export { AppShell, AppShellRoot, AppShellHeader, AppShellSidebar, AppShellSidebarToggle, AppShellContent, AppShellPage, AppShellFooter, AppShellLabel, AppShellLink, } from './app-shell.js';
|
|
78
82
|
export { PageHeader } from './page-header.js';
|
|
79
83
|
export { FilterBar, FilterBarRoot, FilterBarControls, FilterBarField, FilterBarActions, FilterBarSummary, } from './filter-bar.js';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ComponentSizeAlias } from './sizing.js';
|
|
3
|
+
export type SparklineTrend = 'auto' | 'up' | 'down' | 'flat' | 'neutral';
|
|
4
|
+
export type SparklineProps = Omit<React.ComponentPropsWithoutRef<'svg'>, 'children' | 'role' | 'aria-label'> & {
|
|
5
|
+
/** Values in order. A missing value leaves a gap. */
|
|
6
|
+
data: readonly (number | null | undefined)[];
|
|
7
|
+
/** What the line shows and how it moved, such as "KOSPI, 30 days, up 2.3%". The
|
|
8
|
+
* line is an image; this is its name. */
|
|
9
|
+
label: string;
|
|
10
|
+
/** 24, 32 or 48px tall. Set --sparkline-height for another height. */
|
|
11
|
+
size?: ComponentSizeAlias;
|
|
12
|
+
/** A reference line: a value, the first value, or none. */
|
|
13
|
+
baseline?: number | 'first' | 'none';
|
|
14
|
+
/** Marks the last value with a dot. */
|
|
15
|
+
marker?: boolean;
|
|
16
|
+
/** The line's color. auto compares the last value with the baseline, or with the
|
|
17
|
+
* first value when there is none. */
|
|
18
|
+
trend?: SparklineTrend;
|
|
19
|
+
/** For measures where a fall is good: the colors swap. */
|
|
20
|
+
lowerIsBetter?: boolean;
|
|
21
|
+
};
|
|
22
|
+
/** A small trend line for cards and table cells: no axes, legend or tooltip. Use Chart
|
|
23
|
+
* when people need to read values. */
|
|
24
|
+
export declare const Sparkline: React.ForwardRefExoticComponent<Omit<Omit<React.SVGProps<SVGSVGElement>, "ref">, "children" | "role" | "aria-label"> & {
|
|
25
|
+
/** Values in order. A missing value leaves a gap. */
|
|
26
|
+
data: readonly (number | null | undefined)[];
|
|
27
|
+
/** What the line shows and how it moved, such as "KOSPI, 30 days, up 2.3%". The
|
|
28
|
+
* line is an image; this is its name. */
|
|
29
|
+
label: string;
|
|
30
|
+
/** 24, 32 or 48px tall. Set --sparkline-height for another height. */
|
|
31
|
+
size?: ComponentSizeAlias;
|
|
32
|
+
/** A reference line: a value, the first value, or none. */
|
|
33
|
+
baseline?: number | "first" | "none";
|
|
34
|
+
/** Marks the last value with a dot. */
|
|
35
|
+
marker?: boolean;
|
|
36
|
+
/** The line's color. auto compares the last value with the baseline, or with the
|
|
37
|
+
* first value when there is none. */
|
|
38
|
+
trend?: SparklineTrend;
|
|
39
|
+
/** For measures where a fall is good: the colors swap. */
|
|
40
|
+
lowerIsBetter?: boolean;
|
|
41
|
+
} & React.RefAttributes<SVGSVGElement>>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { cx, sizeName } from './parts.js';
|
|
5
|
+
const finite = (value) => typeof value === 'number' && Number.isFinite(value);
|
|
6
|
+
/** A small trend line for cards and table cells: no axes, legend or tooltip. Use Chart
|
|
7
|
+
* when people need to read values. */
|
|
8
|
+
export const Sparkline = /* @__PURE__ */ React.forwardRef(function Sparkline({ data, label, size, baseline = 'none', marker = true, trend = 'auto', lowerIsBetter = false, className, ...props }, ref) {
|
|
9
|
+
const values = data.filter(finite);
|
|
10
|
+
const first = values[0];
|
|
11
|
+
const last = values[values.length - 1];
|
|
12
|
+
const reference = baseline === 'first' ? first : baseline === 'none' ? undefined : baseline;
|
|
13
|
+
const bounds = finite(reference) ? [...values, reference] : values;
|
|
14
|
+
const min = Math.min(...bounds);
|
|
15
|
+
const max = Math.max(...bounds);
|
|
16
|
+
const span = max - min || 1;
|
|
17
|
+
// The line keeps clear of the edges by a tenth of the height.
|
|
18
|
+
const y = (value) => 95 - ((value - min) / span) * 90;
|
|
19
|
+
const x = (index) => data.length > 1 ? (index / (data.length - 1)) * 100 : 50;
|
|
20
|
+
let path = '';
|
|
21
|
+
let pen = false;
|
|
22
|
+
data.forEach((value, index) => {
|
|
23
|
+
if (!finite(value))
|
|
24
|
+
return void (pen = false);
|
|
25
|
+
path += `${pen ? 'L' : 'M'}${x(index)} ${y(value)}`;
|
|
26
|
+
pen = true;
|
|
27
|
+
});
|
|
28
|
+
const from = finite(reference) ? reference : first;
|
|
29
|
+
const way = trend !== 'auto'
|
|
30
|
+
? trend
|
|
31
|
+
: !finite(last) || !finite(from)
|
|
32
|
+
? 'neutral'
|
|
33
|
+
: last > from
|
|
34
|
+
? 'up'
|
|
35
|
+
: last < from
|
|
36
|
+
? 'down'
|
|
37
|
+
: 'flat';
|
|
38
|
+
const tone = lowerIsBetter && way === 'up'
|
|
39
|
+
? 'down'
|
|
40
|
+
: lowerIsBetter && way === 'down'
|
|
41
|
+
? 'up'
|
|
42
|
+
: way;
|
|
43
|
+
let end = data.length - 1;
|
|
44
|
+
while (end >= 0 && !finite(data[end]))
|
|
45
|
+
end--;
|
|
46
|
+
return (_jsxs("svg", { ...props, ref: ref, role: 'img', "aria-label": label, className: cx('pui-sparkline', className), "data-size": sizeName(size), "data-tone": tone, viewBox: '0 0 100 100', preserveAspectRatio: 'none', focusable: 'false', children: [finite(reference) && (_jsx("path", { className: 'pui-sparkline-baseline', d: `M0 ${y(reference)}H100`, vectorEffect: 'non-scaling-stroke' })), _jsx("path", { className: 'pui-sparkline-line', d: path, vectorEffect: 'non-scaling-stroke' }), marker && end >= 0 && (
|
|
47
|
+
// A zero-length segment with a round cap stays a circle however the
|
|
48
|
+
// line stretches.
|
|
49
|
+
_jsx("path", { className: 'pui-sparkline-marker', d: `M${x(end)} ${y(data[end])}h0`, vectorEffect: 'non-scaling-stroke' }))] }));
|
|
50
|
+
});
|
package/dist/stat.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type StatDirection = 'up' | 'down' | 'flat';
|
|
3
|
+
export type StatChangeProps = Omit<React.ComponentPropsWithoutRef<'dd'>, 'children'> & {
|
|
4
|
+
/** The change, such as 0.023 for 2.3%. Its sign sets the direction. */
|
|
5
|
+
value: number;
|
|
6
|
+
/** Text for the change. Defaults to a signed percentage of `value`. */
|
|
7
|
+
format?: (value: number) => React.ReactNode;
|
|
8
|
+
/** Overrides the direction the sign gives. */
|
|
9
|
+
direction?: StatDirection;
|
|
10
|
+
/** For measures where a fall is good, such as latency: the colors swap, the arrow
|
|
11
|
+
* still points the way the value moved. */
|
|
12
|
+
lowerIsBetter?: boolean;
|
|
13
|
+
};
|
|
14
|
+
/** A key figure: what it measures, its value, how it moved and what it covers. Renders
|
|
15
|
+
* a description list, so the label names the value for assistive technology. */
|
|
16
|
+
export declare const Stat: {
|
|
17
|
+
Root: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDListElement>, HTMLDListElement>, "ref">, "size"> & {
|
|
18
|
+
size?: import("./sizing.js").ComponentSize;
|
|
19
|
+
} & React.RefAttributes<HTMLDListElement>>;
|
|
20
|
+
Label: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref">, "size"> & {
|
|
21
|
+
size?: import("./sizing.js").ComponentSize;
|
|
22
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
23
|
+
Value: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref">, "size"> & {
|
|
24
|
+
size?: import("./sizing.js").ComponentSize;
|
|
25
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
26
|
+
Change: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref">, "children"> & {
|
|
27
|
+
/** The change, such as 0.023 for 2.3%. Its sign sets the direction. */
|
|
28
|
+
value: number;
|
|
29
|
+
/** Text for the change. Defaults to a signed percentage of `value`. */
|
|
30
|
+
format?: (value: number) => React.ReactNode;
|
|
31
|
+
/** Overrides the direction the sign gives. */
|
|
32
|
+
direction?: StatDirection;
|
|
33
|
+
/** For measures where a fall is good, such as latency: the colors swap, the arrow
|
|
34
|
+
* still points the way the value moved. */
|
|
35
|
+
lowerIsBetter?: boolean;
|
|
36
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
37
|
+
Caption: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref">, "size"> & {
|
|
38
|
+
size?: import("./sizing.js").ComponentSize;
|
|
39
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
40
|
+
};
|
|
41
|
+
export declare const StatRoot: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDListElement>, HTMLDListElement>, "ref">, "size"> & {
|
|
42
|
+
size?: import("./sizing.js").ComponentSize;
|
|
43
|
+
} & React.RefAttributes<HTMLDListElement>>, StatLabel: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref">, "size"> & {
|
|
44
|
+
size?: import("./sizing.js").ComponentSize;
|
|
45
|
+
} & React.RefAttributes<HTMLElement>>, StatValue: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref">, "size"> & {
|
|
46
|
+
size?: import("./sizing.js").ComponentSize;
|
|
47
|
+
} & React.RefAttributes<HTMLElement>>, StatChange: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref">, "children"> & {
|
|
48
|
+
/** The change, such as 0.023 for 2.3%. Its sign sets the direction. */
|
|
49
|
+
value: number;
|
|
50
|
+
/** Text for the change. Defaults to a signed percentage of `value`. */
|
|
51
|
+
format?: (value: number) => React.ReactNode;
|
|
52
|
+
/** Overrides the direction the sign gives. */
|
|
53
|
+
direction?: StatDirection;
|
|
54
|
+
/** For measures where a fall is good, such as latency: the colors swap, the arrow
|
|
55
|
+
* still points the way the value moved. */
|
|
56
|
+
lowerIsBetter?: boolean;
|
|
57
|
+
} & React.RefAttributes<HTMLElement>>, StatCaption: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref">, "size"> & {
|
|
58
|
+
size?: import("./sizing.js").ComponentSize;
|
|
59
|
+
} & React.RefAttributes<HTMLElement>>;
|
package/dist/stat.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Icon } from './icon.js';
|
|
5
|
+
import { part, cx } from './parts.js';
|
|
6
|
+
import { formatPercent } from './format.js';
|
|
7
|
+
const signed = (value) => formatPercent(value, { signed: true });
|
|
8
|
+
const arrows = { up: 'arrow-up', down: 'arrow-down', flat: 'minus' };
|
|
9
|
+
/** A change against an earlier value: an arrow, a signed figure and its direction's
|
|
10
|
+
* color. The sign and the arrow carry the direction, so color is never alone. */
|
|
11
|
+
const ChangePart = /* @__PURE__ */ React.forwardRef(function StatChange({ value, format = signed, direction, lowerIsBetter, className, ...props }, ref) {
|
|
12
|
+
const way = direction ?? (value > 0 ? 'up' : value < 0 ? 'down' : 'flat');
|
|
13
|
+
const tone = way === 'flat' || !lowerIsBetter ? way : way === 'up' ? 'down' : 'up';
|
|
14
|
+
return (_jsxs("dd", { ...props, ref: ref, "data-direction": way, "data-tone": tone, className: cx('pui-stat-change', className), children: [_jsx(Icon, { name: arrows[way] }), format(value)] }));
|
|
15
|
+
});
|
|
16
|
+
/** A key figure: what it measures, its value, how it moved and what it covers. Renders
|
|
17
|
+
* a description list, so the label names the value for assistive technology. */
|
|
18
|
+
export const Stat = {
|
|
19
|
+
Root: /* @__PURE__ */ part('dl', 'pui-stat'),
|
|
20
|
+
Label: /* @__PURE__ */ part('dt', 'pui-stat-label'),
|
|
21
|
+
Value: /* @__PURE__ */ part('dd', 'pui-stat-value'),
|
|
22
|
+
Change: ChangePart,
|
|
23
|
+
Caption: /* @__PURE__ */ part('dd', 'pui-stat-caption'),
|
|
24
|
+
};
|
|
25
|
+
// Flat names for React Server Components, which cannot dot into client exports.
|
|
26
|
+
export const { Root: StatRoot, Label: StatLabel, Value: StatValue, Change: StatChange, Caption: StatCaption, } = Stat;
|
package/dist/status.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type StatusTone = 'neutral' | 'success' | 'danger' | 'caution' | 'progress';
|
|
1
|
+
export type StatusTone = 'neutral' | 'info' | 'success' | 'danger' | 'caution' | 'progress';
|
|
2
2
|
export declare function StatusIcon({ tone }: {
|
|
3
3
|
tone: StatusTone;
|
|
4
4
|
}): import("react").JSX.Element;
|
package/dist/status.js
CHANGED
package/dist/toast.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Toast as BaseToast } from '@base-ui/react/toast';
|
|
2
|
+
import { Toast as BaseToast, type ToastManager, type ToastManagerAddOptions } from '@base-ui/react/toast';
|
|
3
3
|
import { type StatusTone } from './status.js';
|
|
4
4
|
export type ToastRootProps = React.ComponentPropsWithoutRef<typeof BaseToast.Root> & {
|
|
5
5
|
tone?: StatusTone;
|
|
@@ -57,3 +57,59 @@ export declare const ToastAction: React.ForwardRefExoticComponent<Omit<Omit<impo
|
|
|
57
57
|
} & React.RefAttributes<HTMLSpanElement>>, ToastText: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "size"> & {
|
|
58
58
|
size?: import("./sizing.js").ComponentSize;
|
|
59
59
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
60
|
+
/** What a toast() call takes besides its title. */
|
|
61
|
+
export type ToastOptions = Omit<ToastManagerAddOptions<object>, 'title' | 'type'> & {
|
|
62
|
+
/** A button in the toast, such as Undo. Shorthand for actionProps. */
|
|
63
|
+
action?: {
|
|
64
|
+
label: React.ReactNode;
|
|
65
|
+
onClick: () => void;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
/** A promise step or an update: the options, with the title among them. */
|
|
69
|
+
export type ToastStep = ToastOptions & {
|
|
70
|
+
title?: React.ReactNode;
|
|
71
|
+
};
|
|
72
|
+
type PromiseStep<Value> = React.ReactNode | ToastStep | ((value: Value) => React.ReactNode | ToastStep);
|
|
73
|
+
export type ToastHelper = {
|
|
74
|
+
/** A neutral toast. Returns its ID, which update and dismiss take. */
|
|
75
|
+
(title: React.ReactNode, options?: ToastOptions): string;
|
|
76
|
+
info: (title: React.ReactNode, options?: ToastOptions) => string;
|
|
77
|
+
success: (title: React.ReactNode, options?: ToastOptions) => string;
|
|
78
|
+
warning: (title: React.ReactNode, options?: ToastOptions) => string;
|
|
79
|
+
error: (title: React.ReactNode, options?: ToastOptions) => string;
|
|
80
|
+
/** Stays until updated or dismissed. */
|
|
81
|
+
loading: (title: React.ReactNode, options?: ToastOptions) => string;
|
|
82
|
+
/** A loading toast that turns into success or error when the promise settles. */
|
|
83
|
+
promise: <Value>(promise: Promise<Value>, steps: {
|
|
84
|
+
loading: React.ReactNode | ToastStep;
|
|
85
|
+
success: PromiseStep<Value>;
|
|
86
|
+
error: PromiseStep<unknown>;
|
|
87
|
+
}) => Promise<Value>;
|
|
88
|
+
update: (id: string, options: ToastStep) => void;
|
|
89
|
+
/** Closes one toast, or every toast without an ID. */
|
|
90
|
+
dismiss: (id?: string) => void;
|
|
91
|
+
/** The Base UI manager the Toaster reads. */
|
|
92
|
+
manager: ToastManager;
|
|
93
|
+
};
|
|
94
|
+
/** A toast helper with a manager of its own. Use the shared `toast` unless a region
|
|
95
|
+
* needs separate notifications. */
|
|
96
|
+
export declare function createToaster(): ToastHelper;
|
|
97
|
+
/** The shared toast helper: call toast.success('Saved') anywhere, with one Toaster
|
|
98
|
+
* in the app. */
|
|
99
|
+
export declare const toast: ToastHelper;
|
|
100
|
+
export type ToasterProps = Omit<ToastViewportProps, 'children'> & {
|
|
101
|
+
/** The helper whose toasts this renders. */
|
|
102
|
+
toast?: ToastHelper;
|
|
103
|
+
/** How many toasts stay visible; older ones wait. */
|
|
104
|
+
limit?: number;
|
|
105
|
+
/** Milliseconds before a toast closes, unless it sets its own. */
|
|
106
|
+
timeout?: number;
|
|
107
|
+
/** The notifications region's name. */
|
|
108
|
+
label?: string;
|
|
109
|
+
/** Directions a toast can be swiped away in. */
|
|
110
|
+
swipeDirection?: React.ComponentPropsWithoutRef<typeof BaseToast.Root>['swipeDirection'];
|
|
111
|
+
};
|
|
112
|
+
/** Renders a helper's toasts: the provider, the region and each toast. Put one in the
|
|
113
|
+
* app, then call toast() from anywhere. */
|
|
114
|
+
export declare function Toaster({ toast: helper, limit, timeout, label, swipeDirection, ...props }: ToasterProps): React.JSX.Element;
|
|
115
|
+
export {};
|
package/dist/toast.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { Icon } from './icon.js';
|
|
5
5
|
import { useComponentSize } from './sizing.js';
|
|
6
|
-
import { Toast as BaseToast } from '@base-ui/react/toast';
|
|
6
|
+
import { Toast as BaseToast, } from '@base-ui/react/toast';
|
|
7
7
|
import { part, skin, cx } from './parts.js';
|
|
8
8
|
import { StatusIcon } from './status.js';
|
|
9
9
|
const ToneContext = /* @__PURE__ */ React.createContext('neutral');
|
|
@@ -98,3 +98,74 @@ export const Toast = {
|
|
|
98
98
|
};
|
|
99
99
|
// Flat names for React Server Components, which cannot dot into client exports.
|
|
100
100
|
export const { Action: ToastAction, Arrow: ToastArrow, Close: ToastClose, Content: ToastContent, Description: ToastDescription, Portal: ToastPortal, Positioner: ToastPositioner, Provider: ToastProvider, Root: ToastRoot, Title: ToastTitle, Viewport: ToastViewport, Icon: ToastIcon, Text: ToastText, } = Toast;
|
|
101
|
+
// Event names, as other toast libraries call them, and the tones they show.
|
|
102
|
+
const tones = {
|
|
103
|
+
info: 'info',
|
|
104
|
+
success: 'success',
|
|
105
|
+
warning: 'caution',
|
|
106
|
+
caution: 'caution',
|
|
107
|
+
error: 'danger',
|
|
108
|
+
danger: 'danger',
|
|
109
|
+
loading: 'progress',
|
|
110
|
+
progress: 'progress',
|
|
111
|
+
};
|
|
112
|
+
const isOptions = (value) => typeof value === 'object' &&
|
|
113
|
+
value !== null &&
|
|
114
|
+
!React.isValidElement(value) &&
|
|
115
|
+
!Array.isArray(value);
|
|
116
|
+
function settle({ action, actionProps, ...rest }, type) {
|
|
117
|
+
return {
|
|
118
|
+
...rest,
|
|
119
|
+
...(type ? { type } : {}),
|
|
120
|
+
actionProps: action
|
|
121
|
+
? { ...actionProps, children: action.label, onClick: action.onClick }
|
|
122
|
+
: actionProps,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
const step = (value, type, timeout) => settle(isOptions(value)
|
|
126
|
+
? { ...(timeout === undefined ? {} : { timeout }), ...value }
|
|
127
|
+
: {
|
|
128
|
+
title: value,
|
|
129
|
+
...(timeout === undefined ? {} : { timeout }),
|
|
130
|
+
}, type);
|
|
131
|
+
/** A toast helper with a manager of its own. Use the shared `toast` unless a region
|
|
132
|
+
* needs separate notifications. */
|
|
133
|
+
export function createToaster() {
|
|
134
|
+
const manager = BaseToast.createToastManager();
|
|
135
|
+
const add = (type, timeout) => (title, options = {}) => manager.add({
|
|
136
|
+
...(timeout === undefined ? {} : { timeout }),
|
|
137
|
+
...settle(options, type),
|
|
138
|
+
title,
|
|
139
|
+
});
|
|
140
|
+
return Object.assign(add(), {
|
|
141
|
+
info: add('info'),
|
|
142
|
+
success: add('success'),
|
|
143
|
+
warning: add('warning'),
|
|
144
|
+
error: add('error'),
|
|
145
|
+
loading: add('loading', 0),
|
|
146
|
+
promise: (promise, steps) => manager.promise(promise, {
|
|
147
|
+
loading: step(steps.loading, 'loading', 0),
|
|
148
|
+
success: (value) => step(typeof steps.success === 'function'
|
|
149
|
+
? steps.success(value)
|
|
150
|
+
: steps.success, 'success'),
|
|
151
|
+
error: (error) => step(typeof steps.error === 'function'
|
|
152
|
+
? steps.error(error)
|
|
153
|
+
: steps.error, 'error', 0),
|
|
154
|
+
}),
|
|
155
|
+
update: (id, options) => manager.update(id, settle(options)),
|
|
156
|
+
dismiss: (id) => manager.close(id),
|
|
157
|
+
manager,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
/** The shared toast helper: call toast.success('Saved') anywhere, with one Toaster
|
|
161
|
+
* in the app. */
|
|
162
|
+
export const toast = /* @__PURE__ */ createToaster();
|
|
163
|
+
function ToastList({ swipeDirection }) {
|
|
164
|
+
const { toasts } = BaseToast.useToastManager();
|
|
165
|
+
return toasts.map((item) => (_jsx(Root, { toast: item, tone: tones[item.type ?? ''] ?? 'neutral', swipeDirection: swipeDirection, children: _jsxs(Toast.Content, { children: [_jsx(ToneIcon, {}), _jsxs(Toast.Text, { children: [_jsx(Toast.Title, {}), _jsx(Toast.Description, {}), _jsx(Action, {})] }), _jsx(Close, {})] }) }, item.id)));
|
|
166
|
+
}
|
|
167
|
+
/** Renders a helper's toasts: the provider, the region and each toast. Put one in the
|
|
168
|
+
* app, then call toast() from anywhere. */
|
|
169
|
+
export function Toaster({ toast: helper = toast, limit = 3, timeout = 5000, label = 'Notifications', swipeDirection, ...props }) {
|
|
170
|
+
return (_jsx(BaseToast.Provider, { toastManager: helper.manager, limit: limit, timeout: timeout, children: _jsx(BaseToast.Portal, { children: _jsx(Viewport, { "aria-label": label, ...props, children: _jsx(ToastList, { swipeDirection: swipeDirection }) }) }) }));
|
|
171
|
+
}
|
package/dist/tooltip.d.ts
CHANGED
|
@@ -5,8 +5,14 @@ export declare function TooltipProvider({ delayDuration, skipDelayDuration, chil
|
|
|
5
5
|
skipDelayDuration?: number;
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
}): React.JSX.Element;
|
|
8
|
-
export
|
|
9
|
-
|
|
8
|
+
export type TooltipProps = {
|
|
9
|
+
/** What the trigger does, in a few words. It may hold an icon or emphasis, but
|
|
10
|
+
* nothing interactive: a tooltip never takes focus. */
|
|
11
|
+
label: React.ReactNode;
|
|
12
|
+
/** A keyboard shortcut for the same action, such as '⌘B', set apart after the
|
|
13
|
+
* label. */
|
|
14
|
+
shortcut?: string;
|
|
10
15
|
enabled?: boolean;
|
|
11
16
|
children: React.ReactElement;
|
|
12
|
-
} & Pick<React.ComponentPropsWithoutRef<typeof BaseTooltip.Positioner>, 'side' | 'align' | 'sideOffset'
|
|
17
|
+
} & Pick<React.ComponentPropsWithoutRef<typeof BaseTooltip.Positioner>, 'side' | 'align' | 'sideOffset'>;
|
|
18
|
+
export declare function Tooltip({ label, shortcut, enabled, side, align, sideOffset, children, }: TooltipProps): React.JSX.Element;
|
package/dist/tooltip.js
CHANGED
|
@@ -5,9 +5,9 @@ import { Tooltip as BaseTooltip } from '@base-ui/react/tooltip';
|
|
|
5
5
|
export function TooltipProvider({ delayDuration = 150, skipDelayDuration = 300, children, }) {
|
|
6
6
|
return (_jsx(BaseTooltip.Provider, { delay: delayDuration, closeDelay: 0, timeout: skipDelayDuration, children: children }));
|
|
7
7
|
}
|
|
8
|
-
export function Tooltip({ label, enabled = true, side = 'right', align, sideOffset = 10, children, }) {
|
|
8
|
+
export function Tooltip({ label, shortcut, enabled = true, side = 'right', align, sideOffset = 10, children, }) {
|
|
9
9
|
const scheme = useComponentSize();
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return (_jsxs(BaseTooltip.Root, { children: [_jsx(BaseTooltip.Trigger, { render: children }), _jsx(BaseTooltip.Portal, { children: _jsx(BaseTooltip.Positioner, { side: side, align: align, sideOffset: sideOffset, collisionPadding: 8, className: 'pui-positioner pui-tooltip-positioner', children:
|
|
10
|
+
// Disabling keeps the trigger mounted, so turning the tooltip on or off never
|
|
11
|
+
// moves focus.
|
|
12
|
+
return (_jsxs(BaseTooltip.Root, { disabled: !enabled, children: [_jsx(BaseTooltip.Trigger, { render: children }), _jsx(BaseTooltip.Portal, { children: _jsx(BaseTooltip.Positioner, { side: side, align: align, sideOffset: sideOffset, collisionPadding: 8, className: 'pui-positioner pui-tooltip-positioner', children: _jsxs(BaseTooltip.Popup, { className: 'pui-tooltip', "data-ui-size": scheme, children: [label, shortcut && _jsx("kbd", { className: 'pui-tooltip-shortcut', children: shortcut })] }) }) })] }));
|
|
13
13
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@surflane/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Surflane React components built on Base UI, with data, chart, code and Markdown components.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design-system",
|
|
@@ -28,8 +28,6 @@
|
|
|
28
28
|
],
|
|
29
29
|
"files": [
|
|
30
30
|
"dist",
|
|
31
|
-
"src/styles.css",
|
|
32
|
-
"src/all.css",
|
|
33
31
|
"LICENSE-MIT",
|
|
34
32
|
"LICENSE-APACHE"
|
|
35
33
|
],
|
|
@@ -38,8 +36,77 @@
|
|
|
38
36
|
"types": "./dist/index.d.ts",
|
|
39
37
|
"import": "./dist/index.js"
|
|
40
38
|
},
|
|
41
|
-
"./styles.css": "./
|
|
42
|
-
"./all.css": "./
|
|
39
|
+
"./styles.css": "./dist/css/styles.css",
|
|
40
|
+
"./all.css": "./dist/css/all.css",
|
|
41
|
+
"./button.css": "./dist/css/button.css",
|
|
42
|
+
"./toolbar.css": "./dist/css/toolbar.css",
|
|
43
|
+
"./input.css": "./dist/css/input.css",
|
|
44
|
+
"./select.css": "./dist/css/select.css",
|
|
45
|
+
"./native-select.css": "./dist/css/native-select.css",
|
|
46
|
+
"./field.css": "./dist/css/field.css",
|
|
47
|
+
"./fieldset.css": "./dist/css/fieldset.css",
|
|
48
|
+
"./form.css": "./dist/css/form.css",
|
|
49
|
+
"./textarea.css": "./dist/css/textarea.css",
|
|
50
|
+
"./combobox.css": "./dist/css/combobox.css",
|
|
51
|
+
"./autocomplete.css": "./dist/css/autocomplete.css",
|
|
52
|
+
"./number-field.css": "./dist/css/number-field.css",
|
|
53
|
+
"./slider.css": "./dist/css/slider.css",
|
|
54
|
+
"./otp-field.css": "./dist/css/otp-field.css",
|
|
55
|
+
"./date-picker.css": "./dist/css/date-picker.css",
|
|
56
|
+
"./file-upload.css": "./dist/css/file-upload.css",
|
|
57
|
+
"./checkbox.css": "./dist/css/checkbox.css",
|
|
58
|
+
"./checkbox-group.css": "./dist/css/checkbox-group.css",
|
|
59
|
+
"./radio-group.css": "./dist/css/radio-group.css",
|
|
60
|
+
"./switch.css": "./dist/css/switch.css",
|
|
61
|
+
"./toggle.css": "./dist/css/toggle.css",
|
|
62
|
+
"./toggle-group.css": "./dist/css/toggle-group.css",
|
|
63
|
+
"./choice-label.css": "./dist/css/choice-label.css",
|
|
64
|
+
"./popover.css": "./dist/css/popover.css",
|
|
65
|
+
"./menu.css": "./dist/css/menu.css",
|
|
66
|
+
"./context-menu.css": "./dist/css/context-menu.css",
|
|
67
|
+
"./tooltip.css": "./dist/css/tooltip.css",
|
|
68
|
+
"./preview-card.css": "./dist/css/preview-card.css",
|
|
69
|
+
"./dialog.css": "./dist/css/dialog.css",
|
|
70
|
+
"./alert-dialog.css": "./dist/css/alert-dialog.css",
|
|
71
|
+
"./sheet.css": "./dist/css/sheet.css",
|
|
72
|
+
"./drawer.css": "./dist/css/drawer.css",
|
|
73
|
+
"./tabs.css": "./dist/css/tabs.css",
|
|
74
|
+
"./accordion.css": "./dist/css/accordion.css",
|
|
75
|
+
"./collapsible.css": "./dist/css/collapsible.css",
|
|
76
|
+
"./navigation-menu.css": "./dist/css/navigation-menu.css",
|
|
77
|
+
"./menubar.css": "./dist/css/menubar.css",
|
|
78
|
+
"./link.css": "./dist/css/link.css",
|
|
79
|
+
"./breadcrumbs.css": "./dist/css/breadcrumbs.css",
|
|
80
|
+
"./pagination.css": "./dist/css/pagination.css",
|
|
81
|
+
"./bottom-navigation.css": "./dist/css/bottom-navigation.css",
|
|
82
|
+
"./avatar.css": "./dist/css/avatar.css",
|
|
83
|
+
"./badge.css": "./dist/css/badge.css",
|
|
84
|
+
"./card.css": "./dist/css/card.css",
|
|
85
|
+
"./table.css": "./dist/css/table.css",
|
|
86
|
+
"./code.css": "./dist/css/code.css",
|
|
87
|
+
"./syntax-highlighter.css": "./dist/css/syntax-highlighter.css",
|
|
88
|
+
"./markdown.css": "./dist/css/markdown.css",
|
|
89
|
+
"./list.css": "./dist/css/list.css",
|
|
90
|
+
"./stat.css": "./dist/css/stat.css",
|
|
91
|
+
"./sparkline.css": "./dist/css/sparkline.css",
|
|
92
|
+
"./tree.css": "./dist/css/tree.css",
|
|
93
|
+
"./chart.css": "./dist/css/chart.css",
|
|
94
|
+
"./scroll-area.css": "./dist/css/scroll-area.css",
|
|
95
|
+
"./separator.css": "./dist/css/separator.css",
|
|
96
|
+
"./progress.css": "./dist/css/progress.css",
|
|
97
|
+
"./meter.css": "./dist/css/meter.css",
|
|
98
|
+
"./toast.css": "./dist/css/toast.css",
|
|
99
|
+
"./inline-message.css": "./dist/css/inline-message.css",
|
|
100
|
+
"./spinner.css": "./dist/css/spinner.css",
|
|
101
|
+
"./skeleton.css": "./dist/css/skeleton.css",
|
|
102
|
+
"./empty-state.css": "./dist/css/empty-state.css",
|
|
103
|
+
"./layout.css": "./dist/css/layout.css",
|
|
104
|
+
"./typography.css": "./dist/css/typography.css",
|
|
105
|
+
"./icon.css": "./dist/css/icon.css",
|
|
106
|
+
"./sizing.css": "./dist/css/sizing.css",
|
|
107
|
+
"./app-shell.css": "./dist/css/app-shell.css",
|
|
108
|
+
"./page-header.css": "./dist/css/page-header.css",
|
|
109
|
+
"./filter-bar.css": "./dist/css/filter-bar.css",
|
|
43
110
|
"./button": {
|
|
44
111
|
"types": "./dist/button.d.ts",
|
|
45
112
|
"import": "./dist/button.js"
|
|
@@ -200,6 +267,10 @@
|
|
|
200
267
|
"types": "./dist/pagination.d.ts",
|
|
201
268
|
"import": "./dist/pagination.js"
|
|
202
269
|
},
|
|
270
|
+
"./bottom-navigation": {
|
|
271
|
+
"types": "./dist/bottom-navigation.d.ts",
|
|
272
|
+
"import": "./dist/bottom-navigation.js"
|
|
273
|
+
},
|
|
203
274
|
"./avatar": {
|
|
204
275
|
"types": "./dist/avatar.d.ts",
|
|
205
276
|
"import": "./dist/avatar.js"
|
|
@@ -236,6 +307,14 @@
|
|
|
236
307
|
"types": "./dist/list.d.ts",
|
|
237
308
|
"import": "./dist/list.js"
|
|
238
309
|
},
|
|
310
|
+
"./stat": {
|
|
311
|
+
"types": "./dist/stat.d.ts",
|
|
312
|
+
"import": "./dist/stat.js"
|
|
313
|
+
},
|
|
314
|
+
"./sparkline": {
|
|
315
|
+
"types": "./dist/sparkline.d.ts",
|
|
316
|
+
"import": "./dist/sparkline.js"
|
|
317
|
+
},
|
|
239
318
|
"./tree": {
|
|
240
319
|
"types": "./dist/tree.d.ts",
|
|
241
320
|
"import": "./dist/tree.js"
|
|
@@ -300,6 +379,10 @@
|
|
|
300
379
|
"types": "./dist/slot.d.ts",
|
|
301
380
|
"import": "./dist/slot.js"
|
|
302
381
|
},
|
|
382
|
+
"./format": {
|
|
383
|
+
"types": "./dist/format.d.ts",
|
|
384
|
+
"import": "./dist/format.js"
|
|
385
|
+
},
|
|
303
386
|
"./app-shell": {
|
|
304
387
|
"types": "./dist/app-shell.d.ts",
|
|
305
388
|
"import": "./dist/app-shell.js"
|
|
@@ -315,7 +398,7 @@
|
|
|
315
398
|
"./package.json": "./package.json"
|
|
316
399
|
},
|
|
317
400
|
"scripts": {
|
|
318
|
-
"build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsc -p tsconfig.json",
|
|
401
|
+
"build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsc -p tsconfig.json && node ../../scripts/build-styles.mjs",
|
|
319
402
|
"prepack": "npm run build"
|
|
320
403
|
},
|
|
321
404
|
"dependencies": {
|
|
@@ -324,7 +407,7 @@
|
|
|
324
407
|
"peerDependencies": {
|
|
325
408
|
"@headless-tree/core": "^1.8.0",
|
|
326
409
|
"@headless-tree/react": "^1.8.0",
|
|
327
|
-
"@surflane/design-tokens": "^0.
|
|
410
|
+
"@surflane/design-tokens": "^0.7.0",
|
|
328
411
|
"@tanstack/react-virtual": "^3.14.21",
|
|
329
412
|
"react": "^19.0.0",
|
|
330
413
|
"react-aria-components": "^1.22.1",
|