@surflane/ui 0.9.0 → 0.10.1
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 +4 -4
- package/dist/accordion.d.ts +33 -17
- package/dist/accordion.js +10 -11
- package/dist/alert-dialog.d.ts +8 -4
- package/dist/alert-dialog.js +3 -4
- package/dist/app-shell.d.ts +81 -44
- package/dist/app-shell.js +67 -29
- package/dist/autocomplete.d.ts +117 -61
- package/dist/autocomplete.js +8 -8
- package/dist/avatar.d.ts +34 -17
- package/dist/avatar.js +8 -9
- package/dist/badge.d.ts +6 -10
- package/dist/badge.js +5 -6
- package/dist/bottom-navigation.d.ts +11 -41
- package/dist/bottom-navigation.js +9 -10
- package/dist/breadcrumbs.d.ts +21 -5
- package/dist/breadcrumbs.js +12 -14
- package/dist/button.d.ts +15 -8
- package/dist/button.js +8 -9
- package/dist/card.d.ts +610 -35
- package/dist/card.js +12 -12
- package/dist/chart.d.ts +9 -32
- package/dist/chart.js +65 -26
- package/dist/checkbox-group.d.ts +4 -1
- package/dist/checkbox-group.js +3 -4
- package/dist/checkbox.d.ts +13 -4
- package/dist/checkbox.js +6 -6
- package/dist/choice-label.d.ts +3 -11
- package/dist/choice-label.js +4 -4
- package/dist/class-names.d.ts +6 -0
- package/dist/class-names.js +18 -0
- package/dist/code.d.ts +13 -10
- package/dist/code.js +8 -5
- package/dist/collapsible.d.ts +25 -12
- package/dist/collapsible.js +7 -8
- package/dist/combobox.d.ts +145 -73
- package/dist/combobox.js +27 -27
- package/dist/context-menu.d.ts +106 -54
- package/dist/context-menu.js +4 -5
- package/dist/css/accordion.css +1 -1
- package/dist/css/alert-dialog.css +2 -2
- package/dist/css/all.css +7 -5
- package/dist/css/app-shell.css +1 -1
- package/dist/css/autocomplete.css +1 -1
- package/dist/css/avatar.css +2 -2
- package/dist/css/badge.css +2 -2
- package/dist/css/bottom-navigation.css +1 -1
- package/dist/css/breadcrumbs.css +3 -3
- package/dist/css/button.css +1 -1
- package/dist/css/card.css +3 -3
- package/dist/css/chart.css +2 -2
- package/dist/css/checkbox-group.css +1 -1
- package/dist/css/checkbox.css +1 -1
- package/dist/css/choice-label.css +1 -1
- package/dist/css/code.css +2 -2
- package/dist/css/collapsible.css +1 -1
- package/dist/css/combobox.css +1 -1
- package/dist/css/context-menu.css +1 -1
- package/dist/css/date-picker.css +1 -1
- package/dist/css/dialog.css +2 -2
- package/dist/css/drawer.css +2 -2
- package/dist/css/empty-state.css +2 -2
- package/dist/css/field.css +1 -1
- package/dist/css/fieldset.css +1 -1
- package/dist/css/file-upload.css +2 -2
- package/dist/css/filter-bar.css +1 -1
- package/dist/css/form.css +1 -1
- package/dist/css/icon.css +1 -1
- package/dist/css/inline-message.css +2 -2
- package/dist/css/input.css +1 -1
- package/dist/css/layout.css +2 -2
- package/dist/css/link.css +2 -2
- package/dist/css/list.css +2 -2
- package/dist/css/markdown.css +4 -4
- package/dist/css/menu.css +1 -1
- package/dist/css/menubar.css +1 -1
- package/dist/css/meter.css +1 -1
- package/dist/css/native-select.css +1 -1
- package/dist/css/navigation-menu.css +1 -1
- package/dist/css/number-field.css +1 -1
- package/dist/css/otp-field.css +1 -1
- package/dist/css/page-header.css +3 -3
- package/dist/css/pagination.css +2 -2
- package/dist/css/popover.css +1 -1
- package/dist/css/preview-card.css +2 -2
- package/dist/css/progress.css +1 -1
- package/dist/css/radio-group.css +1 -1
- package/dist/css/rules/accordion.css +5 -5
- package/dist/css/rules/alert-dialog.css +9 -9
- package/dist/css/rules/app-shell.css +274 -82
- package/dist/css/rules/avatar.css +7 -7
- package/dist/css/rules/badge.css +6 -6
- package/dist/css/rules/bar.css +11 -11
- package/dist/css/rules/base.css +30 -30
- package/dist/css/rules/bottom-navigation.css +57 -56
- package/dist/css/rules/breadcrumbs.css +2 -2
- package/dist/css/rules/button.css +66 -65
- package/dist/css/rules/card.css +3 -3
- package/dist/css/rules/chart.css +134 -124
- package/dist/css/rules/checkbox.css +5 -5
- package/dist/css/rules/choice-label.css +19 -18
- package/dist/css/rules/choice.css +65 -60
- package/dist/css/rules/code.css +2 -2
- package/dist/css/rules/collapsible.css +2 -2
- package/dist/css/rules/combobox.css +87 -83
- package/dist/css/rules/context-menu.css +1 -1
- package/dist/css/rules/date-picker.css +150 -144
- package/dist/css/rules/dialog.css +85 -79
- package/dist/css/rules/disclosure.css +49 -47
- package/dist/css/rules/drawer.css +6 -6
- package/dist/css/rules/empty-state.css +2 -2
- package/dist/css/rules/field-control.css +51 -42
- package/dist/css/rules/field.css +26 -24
- package/dist/css/rules/fieldset.css +10 -8
- package/dist/css/rules/file-upload.css +73 -72
- package/dist/css/rules/filter-bar.css +19 -18
- package/dist/css/rules/form.css +3 -3
- package/dist/css/rules/gauge.css +22 -22
- package/dist/css/rules/icon.css +16 -11
- package/dist/css/rules/inline-message.css +3 -3
- package/dist/css/rules/input-group.css +50 -43
- package/dist/css/rules/input.css +11 -11
- package/dist/css/rules/item.css +7 -7
- package/dist/css/rules/link.css +2 -2
- package/dist/css/rules/list.css +3 -3
- package/dist/css/rules/markdown.css +27 -27
- package/dist/css/rules/menu.css +45 -42
- package/dist/css/rules/menubar.css +6 -6
- package/dist/css/rules/navigation-menu.css +69 -66
- package/dist/css/rules/number-field.css +22 -21
- package/dist/css/rules/otp-field.css +28 -27
- package/dist/css/rules/panel.css +105 -100
- package/dist/css/rules/popover.css +23 -20
- package/dist/css/rules/popup.css +15 -14
- package/dist/css/rules/preview-card.css +20 -19
- package/dist/css/rules/progress.css +3 -3
- package/dist/css/rules/radio-group.css +8 -8
- package/dist/css/rules/scroll-area.css +50 -39
- package/dist/css/rules/select.css +39 -36
- package/dist/css/rules/sizing.css +119 -116
- package/dist/css/rules/skeleton.css +18 -11
- package/dist/css/rules/slider.css +43 -43
- package/dist/css/rules/sparkline.css +21 -21
- package/dist/css/rules/spinner.css +9 -9
- package/dist/css/rules/stat.css +32 -32
- package/dist/css/rules/switch.css +28 -21
- package/dist/css/rules/syntax-highlighter.css +37 -36
- package/dist/css/rules/table.css +10 -10
- package/dist/css/rules/tabs.css +53 -52
- package/dist/css/rules/textarea.css +9 -7
- package/dist/css/rules/toast.css +94 -90
- package/dist/css/rules/toggle.css +12 -12
- package/dist/css/rules/toolbar.css +27 -27
- package/dist/css/rules/tooltip.css +14 -14
- package/dist/css/rules/tree.css +38 -38
- package/dist/css/scroll-area.css +1 -1
- package/dist/css/select.css +1 -1
- package/dist/css/separator.css +2 -2
- package/dist/css/sheet.css +2 -2
- package/dist/css/sizing.css +1 -1
- package/dist/css/skeleton.css +1 -1
- package/dist/css/slider.css +1 -1
- package/dist/css/sparkline.css +1 -1
- package/dist/css/spinner.css +1 -1
- package/dist/css/stat.css +1 -1
- package/dist/css/styles.css +17 -17
- package/dist/css/switch.css +1 -1
- package/dist/css/syntax-highlighter.css +1 -1
- package/dist/css/table.css +2 -2
- package/dist/css/tabs.css +1 -1
- package/dist/css/textarea.css +1 -1
- package/dist/css/toast.css +1 -1
- package/dist/css/toggle-group.css +1 -1
- package/dist/css/toggle.css +1 -1
- package/dist/css/toolbar.css +1 -1
- package/dist/css/tooltip.css +1 -1
- package/dist/css/tree.css +1 -1
- package/dist/css/typography.css +2 -2
- package/dist/date-picker.js +28 -8
- package/dist/dialog.d.ts +20 -8
- package/dist/dialog.js +11 -12
- package/dist/drawer.d.ts +12 -4
- package/dist/drawer.js +5 -5
- package/dist/element-part.d.ts +8 -0
- package/dist/element-part.js +21 -0
- package/dist/empty-state.d.ts +602 -24
- package/dist/empty-state.js +9 -9
- package/dist/field.d.ts +60 -36
- package/dist/field.js +6 -6
- package/dist/fieldset.d.ts +19 -11
- package/dist/fieldset.js +2 -2
- package/dist/file-upload.d.ts +8 -23
- package/dist/file-upload.js +23 -16
- package/dist/filter-bar.d.ts +30 -10
- package/dist/filter-bar.js +16 -18
- package/dist/form.js +1 -1
- package/dist/icon.d.ts +9 -2
- package/dist/icon.js +6 -6
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -3
- package/dist/inline-message.d.ts +51 -27
- package/dist/inline-message.js +10 -11
- package/dist/input.d.ts +4 -2
- package/dist/input.js +3 -4
- package/dist/layout.d.ts +24 -12
- package/dist/layout.js +27 -27
- package/dist/link.d.ts +3 -1
- package/dist/link.js +3 -4
- package/dist/list.d.ts +43 -27
- package/dist/list.js +12 -13
- package/dist/markdown.d.ts +14 -6
- package/dist/markdown.js +28 -11
- package/dist/menu.d.ts +113 -57
- package/dist/menu.js +24 -25
- package/dist/menubar.d.ts +5 -3
- package/dist/menubar.js +1 -1
- package/dist/meter.d.ts +46 -26
- package/dist/meter.js +5 -5
- package/dist/native-select.d.ts +4 -2
- package/dist/native-select.js +2 -2
- package/dist/navigation-menu.d.ts +76 -40
- package/dist/navigation-menu.js +15 -16
- package/dist/number-field.d.ts +44 -19
- package/dist/number-field.js +12 -13
- package/dist/otp-field.d.ts +26 -9
- package/dist/otp-field.js +10 -11
- package/dist/page-header.js +3 -4
- package/dist/pagination.d.ts +11 -8
- package/dist/pagination.js +4 -5
- package/dist/panel.d.ts +3 -1
- package/dist/panel.js +5 -6
- package/dist/parts.d.ts +5 -7
- package/dist/parts.js +8 -16
- package/dist/popover.d.ts +20 -12
- package/dist/popover.js +3 -3
- package/dist/preview-card.d.ts +22 -10
- package/dist/preview-card.js +7 -8
- package/dist/progress.d.ts +46 -26
- package/dist/progress.js +5 -5
- package/dist/radio-group.d.ts +16 -8
- package/dist/radio-group.js +5 -5
- package/dist/scroll-area.d.ts +4 -2
- package/dist/scroll-area.js +6 -6
- package/dist/select.d.ts +3 -1
- package/dist/select.js +5 -5
- package/dist/separator.d.ts +5 -2
- package/dist/separator.js +3 -4
- package/dist/sheet.d.ts +12 -4
- package/dist/sheet.js +5 -5
- package/dist/size.d.ts +7 -0
- package/dist/size.js +9 -0
- package/dist/sizing.d.ts +8 -3
- package/dist/sizing.js +8 -10
- package/dist/skeleton.d.ts +3 -3
- package/dist/skeleton.js +4 -6
- package/dist/slider.d.ts +55 -31
- package/dist/slider.js +7 -7
- package/dist/sparkline.d.ts +5 -20
- package/dist/sparkline.js +5 -7
- package/dist/spinner.d.ts +4 -6
- package/dist/spinner.js +7 -8
- package/dist/stat.d.ts +34 -42
- package/dist/stat.js +9 -10
- package/dist/status.js +0 -1
- package/dist/switch.d.ts +17 -8
- package/dist/switch.js +4 -5
- package/dist/syntax-engine.js +9 -1
- package/dist/syntax-highlighter.d.ts +3 -7
- package/dist/syntax-highlighter.js +4 -4
- package/dist/syntax-highlighting.js +2 -2
- package/dist/table.d.ts +111 -75
- package/dist/table.js +32 -33
- package/dist/tabs.d.ts +46 -26
- package/dist/tabs.js +5 -5
- package/dist/textarea.d.ts +4 -2
- package/dist/textarea.js +3 -4
- package/dist/toast.d.ts +76 -42
- package/dist/toast.js +28 -28
- package/dist/toggle-group.js +1 -1
- package/dist/toggle.js +1 -1
- package/dist/tone-transition.d.ts +1 -1
- package/dist/tone-transition.js +9 -8
- package/dist/toolbar.d.ts +55 -31
- package/dist/toolbar.js +6 -6
- package/dist/tooltip.d.ts +4 -1
- package/dist/tooltip.js +2 -2
- package/dist/tree.d.ts +12 -1
- package/dist/tree.js +13 -9
- package/dist/typography.d.ts +3 -1
- package/dist/typography.js +6 -8
- package/package.json +6 -5
package/dist/toast.d.ts
CHANGED
|
@@ -8,55 +8,87 @@ export type ToastViewportProps = React.ComponentPropsWithoutRef<typeof BaseToast
|
|
|
8
8
|
layout?: 'stack' | 'list' | 'anchored';
|
|
9
9
|
};
|
|
10
10
|
export declare const Toast: {
|
|
11
|
-
Root:
|
|
11
|
+
Root: ({ tone, className, ref, ...props }: ToastRootProps & {
|
|
12
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
13
|
+
}) => React.JSX.Element;
|
|
14
|
+
Icon: ({ tone, children, className, ref, ...props }: React.ComponentPropsWithoutRef<"span"> & {
|
|
12
15
|
tone?: StatusTone;
|
|
13
|
-
} &
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
size?: import("./
|
|
27
|
-
} &
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} & React.RefAttributes<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
16
|
+
} & {
|
|
17
|
+
ref?: React.Ref<HTMLSpanElement>;
|
|
18
|
+
}) => React.JSX.Element;
|
|
19
|
+
Close: ({ className, children, ref, ...props }: React.ComponentPropsWithoutRef<typeof BaseToast.Close> & {
|
|
20
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
21
|
+
}) => React.JSX.Element;
|
|
22
|
+
Action: ({ className, ref, ...props }: React.ComponentPropsWithoutRef<typeof BaseToast.Action> & {
|
|
23
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
24
|
+
}) => React.JSX.Element;
|
|
25
|
+
Viewport: ({ layout, className, ref, ...props }: ToastViewportProps & {
|
|
26
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
27
|
+
}) => React.JSX.Element;
|
|
28
|
+
Content: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/toast").ToastContentProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
|
|
29
|
+
size?: import("./size.js").ComponentSize;
|
|
30
|
+
} & {
|
|
31
|
+
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
32
|
+
}) => React.JSX.Element;
|
|
33
|
+
Title: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/toast").ToastTitleProps, "ref"> & React.RefAttributes<HTMLHeadingElement>, "ref">, "size"> & {
|
|
34
|
+
size?: import("./size.js").ComponentSize;
|
|
35
|
+
} & {
|
|
36
|
+
ref?: React.Ref<HTMLHeadingElement> | undefined;
|
|
37
|
+
}) => React.JSX.Element;
|
|
38
|
+
Description: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/toast").ToastDescriptionProps, "ref"> & React.RefAttributes<HTMLParagraphElement>, "ref">, "size"> & {
|
|
39
|
+
size?: import("./size.js").ComponentSize;
|
|
40
|
+
} & {
|
|
41
|
+
ref?: React.Ref<HTMLParagraphElement> | undefined;
|
|
42
|
+
}) => React.JSX.Element;
|
|
43
|
+
Text: ({ ref, ...props }: Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "size"> & {
|
|
44
|
+
size?: import("./size.js").ComponentSize;
|
|
45
|
+
} & {
|
|
46
|
+
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
47
|
+
}) => React.JSX.Element;
|
|
48
|
+
Positioner: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/toast").ToastPositionerProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
|
|
49
|
+
size?: import("./size.js").ComponentSize;
|
|
50
|
+
} & {
|
|
51
|
+
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
52
|
+
}) => React.JSX.Element;
|
|
37
53
|
Provider: React.FC<import("@base-ui/react/toast").ToastProviderProps>;
|
|
38
54
|
Portal: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/toast").ToastPortalProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
39
55
|
Arrow: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/toast").ToastArrowProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
40
56
|
useToastManager: typeof BaseToast.useToastManager;
|
|
41
57
|
createToastManager: typeof BaseToast.createToastManager;
|
|
42
58
|
};
|
|
43
|
-
export declare const ToastAction:
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
size?: import("./
|
|
49
|
-
} &
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
size?: import("./
|
|
53
|
-
} &
|
|
54
|
-
|
|
55
|
-
} & React.RefAttributes<HTMLDivElement>>,
|
|
59
|
+
export declare const ToastAction: ({ className, ref, ...props }: React.ComponentPropsWithoutRef<typeof BaseToast.Action> & {
|
|
60
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
61
|
+
}) => React.JSX.Element, ToastArrow: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/toast").ToastArrowProps, "ref"> & React.RefAttributes<HTMLDivElement>>, ToastClose: ({ className, children, ref, ...props }: React.ComponentPropsWithoutRef<typeof BaseToast.Close> & {
|
|
62
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
63
|
+
}) => React.JSX.Element, ToastContent: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/toast").ToastContentProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
|
|
64
|
+
size?: import("./size.js").ComponentSize;
|
|
65
|
+
} & {
|
|
66
|
+
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
67
|
+
}) => React.JSX.Element, ToastDescription: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/toast").ToastDescriptionProps, "ref"> & React.RefAttributes<HTMLParagraphElement>, "ref">, "size"> & {
|
|
68
|
+
size?: import("./size.js").ComponentSize;
|
|
69
|
+
} & {
|
|
70
|
+
ref?: React.Ref<HTMLParagraphElement> | undefined;
|
|
71
|
+
}) => React.JSX.Element, ToastPortal: React.ForwardRefExoticComponent<Omit<import("@base-ui/react/toast").ToastPortalProps, "ref"> & React.RefAttributes<HTMLDivElement>>, ToastPositioner: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/toast").ToastPositionerProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
|
|
72
|
+
size?: import("./size.js").ComponentSize;
|
|
73
|
+
} & {
|
|
74
|
+
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
75
|
+
}) => React.JSX.Element, ToastProvider: React.FC<import("@base-ui/react/toast").ToastProviderProps>, ToastRoot: ({ tone, className, ref, ...props }: ToastRootProps & {
|
|
76
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
77
|
+
}) => React.JSX.Element, ToastTitle: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/toast").ToastTitleProps, "ref"> & React.RefAttributes<HTMLHeadingElement>, "ref">, "size"> & {
|
|
78
|
+
size?: import("./size.js").ComponentSize;
|
|
79
|
+
} & {
|
|
80
|
+
ref?: React.Ref<HTMLHeadingElement> | undefined;
|
|
81
|
+
}) => React.JSX.Element, ToastViewport: ({ layout, className, ref, ...props }: ToastViewportProps & {
|
|
82
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
83
|
+
}) => React.JSX.Element, ToastIcon: ({ tone, children, className, ref, ...props }: React.ComponentPropsWithoutRef<"span"> & {
|
|
56
84
|
tone?: StatusTone;
|
|
57
|
-
} &
|
|
58
|
-
|
|
59
|
-
}
|
|
85
|
+
} & {
|
|
86
|
+
ref?: React.Ref<HTMLSpanElement>;
|
|
87
|
+
}) => React.JSX.Element, ToastText: ({ ref, ...props }: Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "size"> & {
|
|
88
|
+
size?: import("./size.js").ComponentSize;
|
|
89
|
+
} & {
|
|
90
|
+
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
91
|
+
}) => React.JSX.Element;
|
|
60
92
|
/** What a toast() call takes besides its title. */
|
|
61
93
|
export type ToastOptions = Omit<ToastManagerAddOptions<object>, 'title' | 'type'> & {
|
|
62
94
|
/** A button in the toast, such as Undo. Shorthand for actionProps. */
|
|
@@ -106,10 +138,12 @@ export type ToasterProps = Omit<ToastViewportProps, 'children'> & {
|
|
|
106
138
|
timeout?: number;
|
|
107
139
|
/** The notifications region's name. */
|
|
108
140
|
label?: string;
|
|
141
|
+
/** Each toast's close button name. */
|
|
142
|
+
closeLabel?: string;
|
|
109
143
|
/** Directions a toast can be swiped away in. */
|
|
110
144
|
swipeDirection?: React.ComponentPropsWithoutRef<typeof BaseToast.Root>['swipeDirection'];
|
|
111
145
|
};
|
|
112
146
|
/** Renders a helper's toasts: the provider, the region and each toast. Put one in the
|
|
113
147
|
* app, then call toast() from anywhere. */
|
|
114
|
-
export declare function Toaster({ toast: helper, limit, timeout, label, swipeDirection, ...props }: ToasterProps): React.JSX.Element;
|
|
148
|
+
export declare function Toaster({ toast: helper, limit, timeout, label, closeLabel, swipeDirection, ...props }: ToasterProps): React.JSX.Element;
|
|
115
149
|
export {};
|
package/dist/toast.js
CHANGED
|
@@ -7,20 +7,20 @@ 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');
|
|
10
|
-
const Root =
|
|
11
|
-
return (_jsx(ToneContext.Provider, { value: tone, children: _jsx(BaseToast.Root, { ...props, ref: ref, "data-tone": tone, className: skin('
|
|
12
|
-
}
|
|
13
|
-
const ToneIcon =
|
|
10
|
+
const Root = function Root({ tone = 'neutral', className, ref, ...props }) {
|
|
11
|
+
return (_jsx(ToneContext.Provider, { value: tone, children: _jsx(BaseToast.Root, { ...props, ref: ref, "data-tone": tone, className: skin('surf-toast', className) }) }));
|
|
12
|
+
};
|
|
13
|
+
const ToneIcon = function ToastIcon({ tone, children, className, ref, ...props }) {
|
|
14
14
|
const inherited = React.useContext(ToneContext);
|
|
15
|
-
return (_jsx("span", { ...props, ref: ref, "aria-hidden": 'true', className: cx('
|
|
16
|
-
}
|
|
17
|
-
const Close =
|
|
18
|
-
return (_jsx(BaseToast.Close, { "aria-label": 'Dismiss notification', "aria-hidden": false, "data-variant": 'ghost', "data-size": 'icon-
|
|
19
|
-
}
|
|
20
|
-
const Action =
|
|
21
|
-
return (_jsx(BaseToast.Action, { "data-variant": 'outline', "data-size": 'small', "data-ui-size": 'small', ...props, ref: ref, className: skin('
|
|
22
|
-
}
|
|
23
|
-
const Viewport =
|
|
15
|
+
return (_jsx("span", { ...props, ref: ref, "aria-hidden": 'true', className: cx('surf-toast-icon', className), children: children ?? _jsx(StatusIcon, { tone: tone ?? inherited }) }));
|
|
16
|
+
};
|
|
17
|
+
const Close = function Close({ className, children, ref, ...props }) {
|
|
18
|
+
return (_jsx(BaseToast.Close, { "aria-label": 'Dismiss notification', "aria-hidden": false, "data-variant": 'ghost', "data-size": 'icon-small', "data-ui-size": 'small', ...props, ref: ref, className: skin('surf-button surf-toast-close', className), children: children ?? _jsx(Icon, { name: 'close' }) }));
|
|
19
|
+
};
|
|
20
|
+
const Action = function Action({ className, ref, ...props }) {
|
|
21
|
+
return (_jsx(BaseToast.Action, { "data-variant": 'outline', "data-size": 'small', "data-ui-size": 'small', ...props, ref: ref, className: skin('surf-button surf-toast-action', className) }));
|
|
22
|
+
};
|
|
23
|
+
const Viewport = function Viewport({ layout = 'stack', className, ref, ...props }) {
|
|
24
24
|
const viewportRef = React.useRef(null);
|
|
25
25
|
React.useLayoutEffect(() => {
|
|
26
26
|
const viewport = viewportRef.current;
|
|
@@ -28,7 +28,7 @@ const Viewport = /* @__PURE__ */ React.forwardRef(function Viewport({ layout = '
|
|
|
28
28
|
return;
|
|
29
29
|
const resize = new ResizeObserver(update);
|
|
30
30
|
function update() {
|
|
31
|
-
const cards = Array.from(viewport.querySelectorAll('.
|
|
31
|
+
const cards = Array.from(viewport.querySelectorAll('.surf-toast:not([data-limited])'));
|
|
32
32
|
const gap = parseFloat(getComputedStyle(viewport).rowGap) || 0;
|
|
33
33
|
const height = cards.reduce((sum, card) => {
|
|
34
34
|
const natural = parseFloat(getComputedStyle(card).getPropertyValue('--toast-height'));
|
|
@@ -41,15 +41,15 @@ const Viewport = /* @__PURE__ */ React.forwardRef(function Viewport({ layout = '
|
|
|
41
41
|
const overflowing = height + 48 > window.innerHeight;
|
|
42
42
|
viewport.toggleAttribute('data-stack-overflow', overflowing);
|
|
43
43
|
const value = `${height}px`;
|
|
44
|
-
if (viewport.style.getPropertyValue('--toast-stack-height') !== value)
|
|
45
|
-
viewport.style.setProperty('--toast-stack-height', value);
|
|
44
|
+
if (viewport.style.getPropertyValue('--surf-toast-stack-height') !== value)
|
|
45
|
+
viewport.style.setProperty('--surf-toast-stack-height', value);
|
|
46
46
|
if (overflowing && (!wasOverflow || pinned))
|
|
47
47
|
viewport.scrollTop = viewport.scrollHeight;
|
|
48
48
|
}
|
|
49
49
|
function refresh() {
|
|
50
50
|
resize.disconnect();
|
|
51
51
|
viewport
|
|
52
|
-
.querySelectorAll('.
|
|
52
|
+
.querySelectorAll('.surf-toast:not([data-limited])')
|
|
53
53
|
.forEach((card) => resize.observe(card));
|
|
54
54
|
update();
|
|
55
55
|
}
|
|
@@ -81,8 +81,8 @@ const Viewport = /* @__PURE__ */ React.forwardRef(function Viewport({ layout = '
|
|
|
81
81
|
ref(element);
|
|
82
82
|
else if (ref)
|
|
83
83
|
ref.current = element;
|
|
84
|
-
}, "data-layout": layout, "data-ui-size": scheme, className: skin('
|
|
85
|
-
}
|
|
84
|
+
}, "data-layout": layout, "data-ui-size": scheme, className: skin('surf-toast-viewport', className) }));
|
|
85
|
+
};
|
|
86
86
|
export const Toast = {
|
|
87
87
|
...BaseToast,
|
|
88
88
|
Root,
|
|
@@ -90,11 +90,11 @@ export const Toast = {
|
|
|
90
90
|
Close,
|
|
91
91
|
Action,
|
|
92
92
|
Viewport,
|
|
93
|
-
Content: /* @__PURE__ */ part(BaseToast.Content, '
|
|
94
|
-
Title: /* @__PURE__ */ part(BaseToast.Title, '
|
|
95
|
-
Description: /* @__PURE__ */ part(BaseToast.Description, '
|
|
96
|
-
Text: /* @__PURE__ */ part('div', '
|
|
97
|
-
Positioner: /* @__PURE__ */ part(BaseToast.Positioner, '
|
|
93
|
+
Content: /* @__PURE__ */ part(BaseToast.Content, 'surf-toast-content'),
|
|
94
|
+
Title: /* @__PURE__ */ part(BaseToast.Title, 'surf-toast-title'),
|
|
95
|
+
Description: /* @__PURE__ */ part(BaseToast.Description, 'surf-toast-description'),
|
|
96
|
+
Text: /* @__PURE__ */ part('div', 'surf-toast-text'),
|
|
97
|
+
Positioner: /* @__PURE__ */ part(BaseToast.Positioner, 'surf-positioner', { portal: true }),
|
|
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;
|
|
@@ -160,12 +160,12 @@ export function createToaster() {
|
|
|
160
160
|
/** The shared toast helper: call toast.success('Saved') anywhere, with one Toaster
|
|
161
161
|
* in the app. */
|
|
162
162
|
export const toast = /* @__PURE__ */ createToaster();
|
|
163
|
-
function ToastList({ swipeDirection }) {
|
|
163
|
+
function ToastList({ swipeDirection, closeLabel, }) {
|
|
164
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)));
|
|
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, { "aria-label": closeLabel })] }) }, item.id)));
|
|
166
166
|
}
|
|
167
167
|
/** Renders a helper's toasts: the provider, the region and each toast. Put one in the
|
|
168
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 }) }) }) }));
|
|
169
|
+
export function Toaster({ toast: helper = toast, limit = 3, timeout = 5000, label = 'Notifications', closeLabel = 'Dismiss notification', 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, closeLabel: closeLabel }) }) }) }));
|
|
171
171
|
}
|
package/dist/toggle-group.js
CHANGED
|
@@ -3,5 +3,5 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { ToggleGroup as BaseToggleGroup } from '@base-ui/react/toggle-group';
|
|
4
4
|
import { skin } from './parts.js';
|
|
5
5
|
export function ToggleGroup({ className, ref, ...props }) {
|
|
6
|
-
return (_jsx(BaseToggleGroup, { ...props, ref: ref, className: skin('
|
|
6
|
+
return (_jsx(BaseToggleGroup, { ...props, ref: ref, className: skin('surf-toggle-group', className) }));
|
|
7
7
|
}
|
package/dist/toggle.js
CHANGED
|
@@ -5,5 +5,5 @@ import { Toggle as BaseToggle } from '@base-ui/react/toggle';
|
|
|
5
5
|
import { sizeName, skin } from './parts.js';
|
|
6
6
|
export function Toggle({ className, size, ref, ...props }) {
|
|
7
7
|
const scheme = useComponentSize(size === 'icon' ? undefined : size);
|
|
8
|
-
return (_jsx(BaseToggle, { ...props, ref: ref, className: skin('
|
|
8
|
+
return (_jsx(BaseToggle, { ...props, ref: ref, className: skin('surf-button surf-toggle', className), "data-size": sizeName(size), "data-ui-size": scheme }));
|
|
9
9
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
/** Animate a scalar so the color-mix expression, not a browser's default
|
|
3
3
|
* color interpolation space, determines every intermediate status color. */
|
|
4
|
-
export declare function useToneTransition<Element extends HTMLElement>(tone: string, forwardedRef: React.
|
|
4
|
+
export declare function useToneTransition<Element extends HTMLElement>(tone: string, forwardedRef: React.Ref<Element> | undefined): React.RefObject<Element | null>;
|
package/dist/tone-transition.js
CHANGED
|
@@ -18,8 +18,8 @@ export function useToneTransition(tone, forwardedRef) {
|
|
|
18
18
|
const element = ref.current;
|
|
19
19
|
element?.removeAttribute('data-status-transition');
|
|
20
20
|
for (let i = 0; i < 3; i++) {
|
|
21
|
-
element?.style.removeProperty(`--
|
|
22
|
-
element?.style.removeProperty(`--
|
|
21
|
+
element?.style.removeProperty(`--surf-status-from-${i}`);
|
|
22
|
+
element?.style.removeProperty(`--surf-status-to-${i}`);
|
|
23
23
|
}
|
|
24
24
|
}, []);
|
|
25
25
|
React.useLayoutEffect(() => {
|
|
@@ -39,18 +39,19 @@ export function useToneTransition(tone, forwardedRef) {
|
|
|
39
39
|
document.documentElement.hasAttribute('data-theme-switching'))
|
|
40
40
|
return;
|
|
41
41
|
const durationToken = getComputedStyle(element)
|
|
42
|
-
.getPropertyValue('--motion-feedback')
|
|
42
|
+
.getPropertyValue('--surf-motion-feedback')
|
|
43
43
|
.trim();
|
|
44
44
|
const duration = parseFloat(durationToken) * (durationToken.endsWith('ms') ? 1 : 1000);
|
|
45
45
|
if (!Number.isFinite(duration) || duration <= 0)
|
|
46
46
|
return;
|
|
47
|
-
from.forEach((value, i) => element.style.setProperty(`--
|
|
48
|
-
to.forEach((value, i) => element.style.setProperty(`--
|
|
47
|
+
from.forEach((value, i) => element.style.setProperty(`--surf-status-from-${i}`, value));
|
|
48
|
+
to.forEach((value, i) => element.style.setProperty(`--surf-status-to-${i}`, value));
|
|
49
49
|
element.setAttribute('data-status-transition', '');
|
|
50
|
-
animation.current = element.animate([{ '--
|
|
50
|
+
animation.current = element.animate([{ '--surf-status-progress': '0' }, { '--surf-status-progress': '1' }], {
|
|
51
51
|
duration,
|
|
52
|
-
easing: getComputedStyle(element)
|
|
53
|
-
'ease-out'
|
|
52
|
+
easing: getComputedStyle(element)
|
|
53
|
+
.getPropertyValue('--surf-ease-out')
|
|
54
|
+
.trim() || 'ease-out',
|
|
54
55
|
});
|
|
55
56
|
animation.current.onfinish = clear;
|
|
56
57
|
}, [tone, clear]);
|
package/dist/toolbar.d.ts
CHANGED
|
@@ -1,34 +1,58 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
export declare const Toolbar: {
|
|
3
|
-
Root:
|
|
4
|
-
size?: import("./
|
|
5
|
-
} &
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} & React.RefAttributes<HTMLDivElement
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
size?: import("./
|
|
20
|
-
} &
|
|
3
|
+
Root: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/toolbar").ToolbarRootProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
|
|
4
|
+
size?: import("./size.js").ComponentSize;
|
|
5
|
+
} & {
|
|
6
|
+
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
7
|
+
}) => React.JSX.Element;
|
|
8
|
+
Group: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/toolbar").ToolbarGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
|
|
9
|
+
size?: import("./size.js").ComponentSize;
|
|
10
|
+
} & {
|
|
11
|
+
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
12
|
+
}) => React.JSX.Element;
|
|
13
|
+
Button: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/toolbar").ToolbarButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>, "ref">, "size"> & {
|
|
14
|
+
size?: import("./size.js").ComponentSize;
|
|
15
|
+
} & {
|
|
16
|
+
ref?: React.Ref<HTMLButtonElement> | undefined;
|
|
17
|
+
}) => React.JSX.Element;
|
|
18
|
+
Link: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/toolbar").ToolbarLinkProps, "ref"> & React.RefAttributes<HTMLAnchorElement>, "ref">, "size"> & {
|
|
19
|
+
size?: import("./size.js").ComponentSize;
|
|
20
|
+
} & {
|
|
21
|
+
ref?: React.Ref<HTMLAnchorElement> | undefined;
|
|
22
|
+
}) => React.JSX.Element;
|
|
23
|
+
Input: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/toolbar").ToolbarInputProps, "ref"> & React.RefAttributes<HTMLInputElement>, "ref">, "size"> & {
|
|
24
|
+
size?: import("./size.js").ComponentSize;
|
|
25
|
+
} & {
|
|
26
|
+
ref?: React.Ref<HTMLInputElement> | undefined;
|
|
27
|
+
}) => React.JSX.Element;
|
|
28
|
+
Separator: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/toolbar").ToolbarSeparatorProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
|
|
29
|
+
size?: import("./size.js").ComponentSize;
|
|
30
|
+
} & {
|
|
31
|
+
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
32
|
+
}) => React.JSX.Element;
|
|
21
33
|
};
|
|
22
|
-
export declare const ToolbarButton:
|
|
23
|
-
size?: import("./
|
|
24
|
-
} &
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
size?: import("./
|
|
28
|
-
} &
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
size?: import("./
|
|
32
|
-
} &
|
|
33
|
-
|
|
34
|
-
} & React.RefAttributes<
|
|
34
|
+
export declare const ToolbarButton: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/toolbar").ToolbarButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>, "ref">, "size"> & {
|
|
35
|
+
size?: import("./size.js").ComponentSize;
|
|
36
|
+
} & {
|
|
37
|
+
ref?: React.Ref<HTMLButtonElement> | undefined;
|
|
38
|
+
}) => React.JSX.Element, ToolbarGroup: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/toolbar").ToolbarGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
|
|
39
|
+
size?: import("./size.js").ComponentSize;
|
|
40
|
+
} & {
|
|
41
|
+
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
42
|
+
}) => React.JSX.Element, ToolbarInput: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/toolbar").ToolbarInputProps, "ref"> & React.RefAttributes<HTMLInputElement>, "ref">, "size"> & {
|
|
43
|
+
size?: import("./size.js").ComponentSize;
|
|
44
|
+
} & {
|
|
45
|
+
ref?: React.Ref<HTMLInputElement> | undefined;
|
|
46
|
+
}) => React.JSX.Element, ToolbarLink: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/toolbar").ToolbarLinkProps, "ref"> & React.RefAttributes<HTMLAnchorElement>, "ref">, "size"> & {
|
|
47
|
+
size?: import("./size.js").ComponentSize;
|
|
48
|
+
} & {
|
|
49
|
+
ref?: React.Ref<HTMLAnchorElement> | undefined;
|
|
50
|
+
}) => React.JSX.Element, ToolbarRoot: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/toolbar").ToolbarRootProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
|
|
51
|
+
size?: import("./size.js").ComponentSize;
|
|
52
|
+
} & {
|
|
53
|
+
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
54
|
+
}) => React.JSX.Element, ToolbarSeparator: ({ ref, ...props }: Omit<Omit<Omit<import("@base-ui/react/toolbar").ToolbarSeparatorProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref">, "size"> & {
|
|
55
|
+
size?: import("./size.js").ComponentSize;
|
|
56
|
+
} & {
|
|
57
|
+
ref?: React.Ref<HTMLDivElement> | undefined;
|
|
58
|
+
}) => React.JSX.Element;
|
package/dist/toolbar.js
CHANGED
|
@@ -3,12 +3,12 @@ import { Toolbar as BaseToolbar } from '@base-ui/react/toolbar';
|
|
|
3
3
|
import { part } from './parts.js';
|
|
4
4
|
export const Toolbar = {
|
|
5
5
|
...BaseToolbar,
|
|
6
|
-
Root: /* @__PURE__ */ part(BaseToolbar.Root, '
|
|
7
|
-
Group: /* @__PURE__ */ part(BaseToolbar.Group, '
|
|
8
|
-
Button: /* @__PURE__ */ part(BaseToolbar.Button, '
|
|
9
|
-
Link: /* @__PURE__ */ part(BaseToolbar.Link, '
|
|
10
|
-
Input: /* @__PURE__ */ part(BaseToolbar.Input, '
|
|
11
|
-
Separator: /* @__PURE__ */ part(BaseToolbar.Separator, '
|
|
6
|
+
Root: /* @__PURE__ */ part(BaseToolbar.Root, 'surf-toolbar'),
|
|
7
|
+
Group: /* @__PURE__ */ part(BaseToolbar.Group, 'surf-toolbar-group'),
|
|
8
|
+
Button: /* @__PURE__ */ part(BaseToolbar.Button, 'surf-button surf-toolbar-button'),
|
|
9
|
+
Link: /* @__PURE__ */ part(BaseToolbar.Link, 'surf-button surf-toolbar-link'),
|
|
10
|
+
Input: /* @__PURE__ */ part(BaseToolbar.Input, 'surf-input surf-toolbar-input'),
|
|
11
|
+
Separator: /* @__PURE__ */ part(BaseToolbar.Separator, 'surf-toolbar-separator'),
|
|
12
12
|
};
|
|
13
13
|
// Flat names for React Server Components, which cannot dot into client exports.
|
|
14
14
|
export const { Button: ToolbarButton, Group: ToolbarGroup, Input: ToolbarInput, Link: ToolbarLink, Root: ToolbarRoot, Separator: ToolbarSeparator, } = Toolbar;
|
package/dist/tooltip.d.ts
CHANGED
|
@@ -12,7 +12,10 @@ export type TooltipProps = {
|
|
|
12
12
|
/** A keyboard shortcut for the same action, such as '⌘B', set apart after the
|
|
13
13
|
* label. */
|
|
14
14
|
shortcut?: string;
|
|
15
|
+
/** Keeps the tooltip from opening while the trigger stays as it is. */
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
/** @deprecated Use `disabled`. Removed in a later minor. */
|
|
15
18
|
enabled?: boolean;
|
|
16
19
|
children: React.ReactElement;
|
|
17
20
|
} & 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;
|
|
21
|
+
export declare function Tooltip({ label, shortcut, disabled, 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, shortcut, enabled = true, side = 'right', align, sideOffset = 10, children, }) {
|
|
8
|
+
export function Tooltip({ label, shortcut, disabled = false, enabled = true, side = 'right', align, sideOffset = 10, children, }) {
|
|
9
9
|
const scheme = useComponentSize();
|
|
10
10
|
// Disabling keeps the trigger mounted, so turning the tooltip on or off never
|
|
11
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: '
|
|
12
|
+
return (_jsxs(BaseTooltip.Root, { disabled: disabled || !enabled, children: [_jsx(BaseTooltip.Trigger, { render: children }), _jsx(BaseTooltip.Portal, { children: _jsx(BaseTooltip.Positioner, { side: side, align: align, sideOffset: sideOffset, collisionPadding: 8, className: 'surf-positioner surf-tooltip-positioner', children: _jsxs(BaseTooltip.Popup, { className: 'surf-tooltip', "data-ui-size": scheme, children: [label, shortcut && (_jsx("kbd", { className: 'surf-tooltip-shortcut', children: shortcut }))] }) }) })] }));
|
|
13
13
|
}
|
package/dist/tree.d.ts
CHANGED
|
@@ -6,6 +6,15 @@ export type TreeNode = {
|
|
|
6
6
|
children?: readonly TreeNode[];
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
};
|
|
9
|
+
export type TreeLabels = {
|
|
10
|
+
/** A folder's toggle while it is collapsed, then expanded. */
|
|
11
|
+
expand: (label: string) => string;
|
|
12
|
+
collapse: (label: string) => string;
|
|
13
|
+
/** The scroll region around the tree, given the tree's label. */
|
|
14
|
+
scrollArea: (label: string) => string;
|
|
15
|
+
/** Shown when there are no nodes. */
|
|
16
|
+
empty: string;
|
|
17
|
+
};
|
|
9
18
|
export type TreeProps = {
|
|
10
19
|
nodes: readonly TreeNode[];
|
|
11
20
|
label: string;
|
|
@@ -20,9 +29,11 @@ export type TreeProps = {
|
|
|
20
29
|
rowHeight?: number;
|
|
21
30
|
size?: ComponentSize;
|
|
22
31
|
virtualized?: boolean;
|
|
32
|
+
labels?: Partial<TreeLabels>;
|
|
33
|
+
/** @deprecated Use `labels.empty`. Removed in a later minor. */
|
|
23
34
|
emptyLabel?: string;
|
|
24
35
|
dir?: 'ltr' | 'rtl';
|
|
25
36
|
className?: string;
|
|
26
37
|
};
|
|
27
38
|
/** Loaded, immutable hierarchy. Remote loading, permission checks and mutations remain caller-owned. */
|
|
28
|
-
export declare function Tree({ nodes, label, expandedIds, defaultExpandedIds, onExpandedIdsChange, selectedIds, defaultSelectedIds, onSelectedIdsChange, selectionMode, height, rowHeight: explicitRowHeight, size, virtualized, emptyLabel, dir, className, }: TreeProps): React.JSX.Element;
|
|
39
|
+
export declare function Tree({ nodes, label, expandedIds, defaultExpandedIds, onExpandedIdsChange, selectedIds, defaultSelectedIds, onSelectedIdsChange, selectionMode, height, rowHeight: explicitRowHeight, size, virtualized, labels, emptyLabel, dir, className, }: TreeProps): React.JSX.Element;
|
package/dist/tree.js
CHANGED
|
@@ -11,7 +11,7 @@ import { ScrollArea } from './scroll-area.js';
|
|
|
11
11
|
import { cx } from './parts.js';
|
|
12
12
|
const normalize = (text) => text.normalize('NFKC').toLocaleLowerCase();
|
|
13
13
|
/** Loaded, immutable hierarchy. Remote loading, permission checks and mutations remain caller-owned. */
|
|
14
|
-
export function Tree({ nodes, label, expandedIds, defaultExpandedIds = [], onExpandedIdsChange, selectedIds, defaultSelectedIds = [], onSelectedIdsChange, selectionMode = 'single', height = 320, rowHeight: explicitRowHeight, size, virtualized = true, emptyLabel
|
|
14
|
+
export function Tree({ nodes, label, expandedIds, defaultExpandedIds = [], onExpandedIdsChange, selectedIds, defaultSelectedIds = [], onSelectedIdsChange, selectionMode = 'single', height = 320, rowHeight: explicitRowHeight, size, virtualized = true, labels, emptyLabel, dir, className, }) {
|
|
15
15
|
const scheme = useComponentSize(size);
|
|
16
16
|
const touchFloor = React.useSyncExternalStore((listener) => {
|
|
17
17
|
const query = matchMedia('(max-width: 760px), (pointer: coarse)');
|
|
@@ -273,10 +273,10 @@ export function Tree({ nodes, label, expandedIds, defaultExpandedIds = [], onExp
|
|
|
273
273
|
.getVirtualItems()
|
|
274
274
|
.map((row) => ({ index: row.index, start: row.start }))
|
|
275
275
|
: items.map((_, index) => ({ index, start: index * rowHeight }));
|
|
276
|
-
return (_jsx(ScrollArea, { orientation: 'vertical', label: `${label} scroll area`, tabIndex: -1, ref: viewport, scrollChain: 'contain', rootClassName: cx('
|
|
276
|
+
return (_jsx(ScrollArea, { orientation: 'vertical', label: labels?.scrollArea?.(label) ?? `${label} scroll area`, tabIndex: -1, ref: viewport, scrollChain: 'contain', rootClassName: cx('surf-tree-scroll', className), dir: dir, rootStyle: { blockSize: height, direction: dir }, className: 'surf-tree-viewport', children: items.length ? (_jsx("div", { ...containerProps, ref: (element) => {
|
|
277
277
|
container.current = element;
|
|
278
278
|
containerProps.ref(element);
|
|
279
|
-
}, dir: dir, className: '
|
|
279
|
+
}, dir: dir, className: 'surf-tree', "data-ui-size": scheme, "aria-multiselectable": selectionMode === 'multiple' || undefined, onKeyDown: keydown, onFocusCapture: () => {
|
|
280
280
|
focusWithin.current = true;
|
|
281
281
|
}, onBlurCapture: (event) => {
|
|
282
282
|
if (event.relatedTarget &&
|
|
@@ -290,7 +290,7 @@ export function Tree({ nodes, label, expandedIds, defaultExpandedIds = [], onExp
|
|
|
290
290
|
: items.length * rowHeight,
|
|
291
291
|
}, children: rows.map(({ index, start }) => {
|
|
292
292
|
const item = items[index], node = item.getItemData(), props = item.getProps();
|
|
293
|
-
return (_createElement("div", { ...props, key: item.getId(), className: '
|
|
293
|
+
return (_createElement("div", { ...props, key: item.getId(), className: 'surf-tree-item', "data-tree-id": node.id, "aria-disabled": node.disabled || undefined, "aria-selected": node.disabled ? undefined : selected.includes(node.id), title: node.label, onFocus: () => item.setFocused(), onClick: (event) => {
|
|
294
294
|
focusItem(item);
|
|
295
295
|
select(item, event.shiftKey);
|
|
296
296
|
}, style: {
|
|
@@ -298,16 +298,20 @@ export function Tree({ nodes, label, expandedIds, defaultExpandedIds = [], onExp
|
|
|
298
298
|
insetInline: 0,
|
|
299
299
|
top: start,
|
|
300
300
|
blockSize: rowHeight,
|
|
301
|
-
paddingInlineStart: `calc(var(--space-2) + ${Math.min(item.getItemMeta().level, 8)} * var(--space-4))`,
|
|
301
|
+
paddingInlineStart: `calc(var(--surf-space-2) + ${Math.min(item.getItemMeta().level, 8)} * var(--surf-space-4))`,
|
|
302
302
|
} },
|
|
303
|
-
item.isFolder() ? (_jsx("button", { type: 'button', className: '
|
|
303
|
+
item.isFolder() ? (_jsx("button", { type: 'button', className: 'surf-tree-toggle', tabIndex: -1, disabled: node.disabled, "aria-label": item.isExpanded()
|
|
304
|
+
? (labels?.collapse?.(node.label) ??
|
|
305
|
+
`Collapse ${node.label}`)
|
|
306
|
+
: (labels?.expand?.(node.label) ??
|
|
307
|
+
`Expand ${node.label}`), onClick: (event) => {
|
|
304
308
|
event.stopPropagation();
|
|
305
309
|
focusItem(item);
|
|
306
310
|
if (item.isExpanded())
|
|
307
311
|
item.collapse();
|
|
308
312
|
else
|
|
309
313
|
item.expand();
|
|
310
|
-
}, children: _jsx(Icon, { name: 'chevron-forward', "data-expanded": item.isExpanded() || undefined }) })) : (_jsx("span", { className: '
|
|
311
|
-
_jsx("span", { className: '
|
|
312
|
-
}) })) : (_jsx("div", { role: 'status', className: '
|
|
314
|
+
}, children: _jsx(Icon, { name: 'chevron-forward', "data-expanded": item.isExpanded() || undefined }) })) : (_jsx("span", { className: 'surf-tree-leaf', "aria-hidden": 'true' })),
|
|
315
|
+
_jsx("span", { className: 'surf-tree-label', children: node.label })));
|
|
316
|
+
}) })) : (_jsx("div", { role: 'status', className: 'surf-tree-empty', children: labels?.empty ?? emptyLabel ?? 'No items.' })) }));
|
|
313
317
|
}
|
package/dist/typography.d.ts
CHANGED
|
@@ -9,4 +9,6 @@ export declare function Text({ as: Tag, variant, color, weight, className, ...pr
|
|
|
9
9
|
color?: 'primary' | 'secondary' | 'muted';
|
|
10
10
|
weight?: 'regular' | 'medium';
|
|
11
11
|
}): React.JSX.Element;
|
|
12
|
-
export declare const Prose: React.
|
|
12
|
+
export declare const Prose: ({ className, ref, ...props }: React.ComponentProps<"div"> & {
|
|
13
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
14
|
+
}) => React.JSX.Element;
|
package/dist/typography.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
'use client';
|
|
2
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
4
|
-
import { cx } from './parts.js';
|
|
2
|
+
import { cx } from './class-names.js';
|
|
5
3
|
export function Heading({ level = 2, size = 'section', className, ...props }) {
|
|
6
4
|
const Tag = `h${level}`;
|
|
7
|
-
return (_jsx(Tag, { ...props, className: cx('
|
|
5
|
+
return (_jsx(Tag, { ...props, className: cx('surf-heading', className), "data-size": size }));
|
|
8
6
|
}
|
|
9
7
|
export function Text({ as: Tag = 'p', variant = 'body', color = 'primary', weight = 'regular', className, ...props }) {
|
|
10
|
-
return (_jsx(Tag, { ...props, className: cx('
|
|
8
|
+
return (_jsx(Tag, { ...props, className: cx('surf-text', className), "data-variant": variant, "data-color": color, "data-weight": weight }));
|
|
11
9
|
}
|
|
12
|
-
export const Prose =
|
|
13
|
-
return _jsx("div", { ...props, ref: ref, className: cx('
|
|
14
|
-
}
|
|
10
|
+
export const Prose = function Prose({ className, ref, ...props }) {
|
|
11
|
+
return _jsx("div", { ...props, ref: ref, className: cx('surf-prose', className) });
|
|
12
|
+
};
|