raft-ui 0.0.5 → 0.0.7
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/CHANGELOG.md +5 -0
- package/dist/button-CJqMhTPQ.mjs +621 -0
- package/dist/index-CpGciYPW.d.mts +267 -0
- package/dist/index.d.mts +11 -253
- package/dist/index.mjs +32 -587
- package/{src → dist}/styles.css +0 -2
- package/dist/wip.d.mts +133 -15
- package/dist/wip.mjs +289 -16
- package/package.json +7 -10
- package/dist/styled-props-B3SNekJg.d.mts +0 -16
- package/dist/use-theme-Y_h1DKll.mjs +0 -34
- package/src/components/avatar/avatar.tsx +0 -375
- package/src/components/avatar/index.ts +0 -17
- package/src/components/badge/badge.tsx +0 -393
- package/src/components/badge/index.ts +0 -2
- package/src/components/banner/banner.tsx +0 -269
- package/src/components/banner/index.ts +0 -8
- package/src/components/bottom-sheet/bottom-sheet.tsx +0 -152
- package/src/components/bottom-sheet/index.ts +0 -22
- package/src/components/button/button.tsx +0 -497
- package/src/components/button/index.ts +0 -2
- package/src/components/checkbox/checkbox-indicator.tsx +0 -128
- package/src/components/checkbox/checkbox.tsx +0 -350
- package/src/components/checkbox/index.ts +0 -2
- package/src/components/combobox/combobox.tsx +0 -603
- package/src/components/combobox/index.ts +0 -52
- package/src/components/context-menu/context-menu.tsx +0 -380
- package/src/components/context-menu/index.ts +0 -34
- package/src/components/conversation-preview-card/conversation-preview-card.tsx +0 -336
- package/src/components/conversation-preview-card/index.ts +0 -32
- package/src/components/description-list/description-list.tsx +0 -116
- package/src/components/description-list/index.ts +0 -14
- package/src/components/dropdown-menu/dropdown-menu.tsx +0 -405
- package/src/components/dropdown-menu/index.ts +0 -38
- package/src/components/empty-state/empty-state.tsx +0 -177
- package/src/components/empty-state/index.ts +0 -16
- package/src/components/field/field.tsx +0 -125
- package/src/components/field/index.ts +0 -18
- package/src/components/inline-code/index.ts +0 -2
- package/src/components/inline-code/inline-code.tsx +0 -35
- package/src/components/input/index.ts +0 -2
- package/src/components/input/input.tsx +0 -76
- package/src/components/input-group/index.ts +0 -7
- package/src/components/input-group/input-group.tsx +0 -215
- package/src/components/kbd/index.ts +0 -2
- package/src/components/kbd/kbd.tsx +0 -43
- package/src/components/label/index.ts +0 -7
- package/src/components/label/label.tsx +0 -99
- package/src/components/lightbox/index.ts +0 -24
- package/src/components/lightbox/lightbox.tsx +0 -245
- package/src/components/list-item/index.ts +0 -20
- package/src/components/list-item/list-item.tsx +0 -263
- package/src/components/media-list-item/index.ts +0 -20
- package/src/components/media-list-item/media-list-item.tsx +0 -169
- package/src/components/notification-center/index.ts +0 -39
- package/src/components/notification-center/notification-center.tsx +0 -558
- package/src/components/panel-header/index.ts +0 -22
- package/src/components/panel-header/panel-header.tsx +0 -199
- package/src/components/popover/index.ts +0 -30
- package/src/components/popover/popover.tsx +0 -248
- package/src/components/preview-shell/index.ts +0 -2
- package/src/components/preview-shell/preview-shell.tsx +0 -51
- package/src/components/quoted-message-card/index.ts +0 -36
- package/src/components/quoted-message-card/quoted-message-card.tsx +0 -391
- package/src/components/radio-group/index.ts +0 -6
- package/src/components/radio-group/radio-group.tsx +0 -119
- package/src/components/section-header/index.ts +0 -16
- package/src/components/section-header/section-header.tsx +0 -117
- package/src/components/section-label/index.ts +0 -2
- package/src/components/section-label/section-label.tsx +0 -38
- package/src/components/segmented-control/index.ts +0 -12
- package/src/components/segmented-control/segmented-control.tsx +0 -129
- package/src/components/select/index.ts +0 -40
- package/src/components/select/select.tsx +0 -382
- package/src/components/spinner/index.ts +0 -2
- package/src/components/spinner/spinner.tsx +0 -228
- package/src/components/status/index.ts +0 -2
- package/src/components/status/status.tsx +0 -152
- package/src/components/tabs/index.ts +0 -24
- package/src/components/tabs/tabs.tsx +0 -451
- package/src/components/text/index.ts +0 -2
- package/src/components/text/text.tsx +0 -131
- package/src/components/textarea/index.ts +0 -2
- package/src/components/textarea/textarea.tsx +0 -136
- package/src/components/toggle-group/index.ts +0 -12
- package/src/components/toggle-group/toggle-group.tsx +0 -111
- package/src/components/tooltip/index.ts +0 -14
- package/src/components/tooltip/tooltip.tsx +0 -212
- package/src/index.ts +0 -426
- package/src/legacy/AttentionDot.tsx +0 -28
- package/src/legacy/AvatarListRow.tsx +0 -87
- package/src/legacy/AvatarSlot.tsx +0 -157
- package/src/legacy/Badge.tsx +0 -95
- package/src/legacy/Banner.tsx +0 -74
- package/src/legacy/BottomSheet.tsx +0 -76
- package/src/legacy/CheckMarker.tsx +0 -72
- package/src/legacy/Checkbox.tsx +0 -81
- package/src/legacy/ConversationPreviewCard.tsx +0 -169
- package/src/legacy/DismissBackdrop.tsx +0 -68
- package/src/legacy/EmptyState.tsx +0 -63
- package/src/legacy/ExperimentalBadge.tsx +0 -19
- package/src/legacy/FormField.tsx +0 -106
- package/src/legacy/KeyValueRow.tsx +0 -67
- package/src/legacy/Lightbox.tsx +0 -119
- package/src/legacy/NotificationCenter.tsx +0 -217
- package/src/legacy/PanelHeader.tsx +0 -94
- package/src/legacy/PreviewShell.tsx +0 -40
- package/src/legacy/QuotedMessageCard.tsx +0 -181
- package/src/legacy/ReorderablePanelTabs.tsx +0 -156
- package/src/legacy/SandboxedPreviewFrame.tsx +0 -59
- package/src/legacy/SearchInput.tsx +0 -23
- package/src/legacy/SectionEyebrow.tsx +0 -60
- package/src/legacy/SectionHeader.tsx +0 -68
- package/src/legacy/SegmentedControl.tsx +0 -74
- package/src/legacy/SlugInput.tsx +0 -29
- package/src/legacy/Spinner.tsx +0 -89
- package/src/legacy/StatusDot.tsx +0 -51
- package/src/legacy/SurfaceListItem.tsx +0 -32
- package/src/legacy/Textarea.tsx +0 -137
- package/src/legacy/button.tsx +0 -100
- package/src/legacy/context-menu-divider.tsx +0 -12
- package/src/legacy/menu-item.tsx +0 -66
- package/src/legacy/selection-popover.tsx +0 -212
- package/src/legacy/server-switcher-menu.tsx +0 -203
- package/src/legacy/source.css +0 -240
- package/src/lib/cn.ts +0 -1
- package/src/lib/styled-props.ts +0 -11
- package/src/lib/theme/theme-context.ts +0 -28
- package/src/lib/theme/theme-provider.tsx +0 -181
- package/src/lib/theme/use-theme.ts +0 -12
- package/src/lib/tv.ts +0 -29
- package/src/lib/without-children.ts +0 -6
- package/src/wip.ts +0 -233
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import type { ComponentPropsWithRef } from "react";
|
|
2
|
-
import { tv } from "../../lib/tv.ts";
|
|
3
|
-
import { useThemeFamily } from "../../lib/theme/use-theme.ts";
|
|
4
|
-
import type { WithoutChildren } from "../../lib/without-children.ts";
|
|
5
|
-
|
|
6
|
-
const textarea = tv({
|
|
7
|
-
slots: {
|
|
8
|
-
root: ["block w-full min-h-24 resize-y px-3 py-2 outline-none"],
|
|
9
|
-
},
|
|
10
|
-
variants: {
|
|
11
|
-
theme: {
|
|
12
|
-
brutal: {
|
|
13
|
-
root: [
|
|
14
|
-
"border-2 border-line-strong bg-layer-panel font-heading",
|
|
15
|
-
"shadow-sm focus:shadow-md",
|
|
16
|
-
"aria-invalid:border-brutal-red aria-invalid:bg-brutal-red/5 aria-invalid:shadow-none aria-invalid:ring-2 aria-invalid:ring-brutal-red/60",
|
|
17
|
-
"disabled:cursor-not-allowed disabled:opacity-60 disabled:shadow-none",
|
|
18
|
-
],
|
|
19
|
-
},
|
|
20
|
-
elegant: {
|
|
21
|
-
root: [
|
|
22
|
-
"rounded-md border border-[oklch(0.94_0_0)] bg-layer-field shadow-none",
|
|
23
|
-
"text-sm text-[oklch(0.205_0_0)] transition duration-200 ease-out dark:text-foreground",
|
|
24
|
-
"placeholder:text-foreground-placeholder/70",
|
|
25
|
-
"hover:not-aria-invalid:border-[oklch(0.91_0_0)] hover:shadow-[oklch(0_0_0_/_0)_0px_0px_0px_0px,oklch(0_0_0_/_0)_0px_0px_0px_0px,oklch(0.159_0.016_266.594_/_0.03)_0px_1px_2px_0px]",
|
|
26
|
-
"focus:border-line-strong/25 focus:bg-layer-field",
|
|
27
|
-
"focus-visible:ring-2 focus-visible:ring-line-strong/8",
|
|
28
|
-
"aria-invalid:border-danger-base/45 aria-invalid:hover:border-danger-base/75 aria-invalid:focus-visible:border-danger-base/75 aria-invalid:focus-visible:ring-3 aria-invalid:focus-visible:ring-danger-base/12",
|
|
29
|
-
"disabled:cursor-not-allowed disabled:border-line-subtle/60 disabled:bg-layer-muted/50 disabled:text-foreground-disabled disabled:placeholder:text-foreground-disabled",
|
|
30
|
-
"disabled:hover:border-line-subtle/60 disabled:hover:shadow-none",
|
|
31
|
-
"aria-invalid:disabled:border-line-subtle/60 aria-invalid:disabled:ring-0",
|
|
32
|
-
],
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const textareaGroup = tv({
|
|
39
|
-
slots: {
|
|
40
|
-
root: ["w-full"],
|
|
41
|
-
},
|
|
42
|
-
variants: {
|
|
43
|
-
theme: {
|
|
44
|
-
brutal: {
|
|
45
|
-
root: "flex flex-col items-end gap-1",
|
|
46
|
-
},
|
|
47
|
-
elegant: {
|
|
48
|
-
root: [
|
|
49
|
-
"relative",
|
|
50
|
-
"has-[>[data-slot=textarea-counter]]:[&>[data-slot=textarea]]:scroll-pb-6",
|
|
51
|
-
"has-[>[data-slot=textarea-counter]]:[&>[data-slot=textarea]]:pr-16",
|
|
52
|
-
"[&>[data-slot=textarea-counter]]:pointer-events-none [&>[data-slot=textarea-counter]]:absolute",
|
|
53
|
-
"[&>[data-slot=textarea-counter]]:right-3 [&>[data-slot=textarea-counter]]:bottom-2.5 [&>[data-slot=textarea-counter]]:z-10",
|
|
54
|
-
],
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
const textareaCounter = tv({
|
|
61
|
-
slots: {
|
|
62
|
-
root: ["font-mono text-xs tabular-nums"],
|
|
63
|
-
},
|
|
64
|
-
variants: {
|
|
65
|
-
theme: {
|
|
66
|
-
brutal: {
|
|
67
|
-
root: [
|
|
68
|
-
"text-foreground/50",
|
|
69
|
-
"group-data-[invalid]/field:font-bold group-data-[invalid]/field:text-danger-base",
|
|
70
|
-
],
|
|
71
|
-
},
|
|
72
|
-
elegant: {
|
|
73
|
-
root: [
|
|
74
|
-
"text-[11px] leading-none text-foreground-placeholder/80 transition duration-200 ease-out",
|
|
75
|
-
"group-data-[invalid]/field:font-medium group-data-[invalid]/field:text-danger-base",
|
|
76
|
-
],
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
overLimit: {
|
|
80
|
-
true: {
|
|
81
|
-
root: "text-danger-base",
|
|
82
|
-
},
|
|
83
|
-
false: {
|
|
84
|
-
root: "",
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
defaultVariants: {
|
|
89
|
-
overLimit: false,
|
|
90
|
-
},
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
export type TextareaProps = WithoutChildren<ComponentPropsWithRef<"textarea">>;
|
|
94
|
-
|
|
95
|
-
export type TextareaGroupProps = ComponentPropsWithRef<"div">;
|
|
96
|
-
|
|
97
|
-
export function TextareaGroup({ className, ...props }: TextareaGroupProps) {
|
|
98
|
-
const theme = useThemeFamily();
|
|
99
|
-
const { root } = textareaGroup({ theme });
|
|
100
|
-
|
|
101
|
-
return <div data-slot="textarea-group" className={root({ className })} {...props} />;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export function Textarea({ className, ...props }: TextareaProps) {
|
|
105
|
-
const theme = useThemeFamily();
|
|
106
|
-
const { root } = textarea({ theme });
|
|
107
|
-
|
|
108
|
-
return <textarea data-slot="textarea" className={root({ className })} {...props} />;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export interface TextareaCounterProps extends WithoutChildren<ComponentPropsWithRef<"span">> {
|
|
112
|
-
value?: string;
|
|
113
|
-
count?: number;
|
|
114
|
-
limit: number;
|
|
115
|
-
getLength?: (value: string) => number;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export function TextareaCounter({
|
|
119
|
-
value,
|
|
120
|
-
count,
|
|
121
|
-
limit,
|
|
122
|
-
getLength,
|
|
123
|
-
className,
|
|
124
|
-
...props
|
|
125
|
-
}: TextareaCounterProps) {
|
|
126
|
-
const theme = useThemeFamily();
|
|
127
|
-
const text = value ?? "";
|
|
128
|
-
const length = count ?? getLength?.(text) ?? text.length;
|
|
129
|
-
const overLimit = length > limit;
|
|
130
|
-
const { root } = textareaCounter({ theme, overLimit });
|
|
131
|
-
return (
|
|
132
|
-
<span data-slot="textarea-counter" className={root({ className })} {...props}>
|
|
133
|
-
{length}/{limit}
|
|
134
|
-
</span>
|
|
135
|
-
);
|
|
136
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export {
|
|
2
|
-
ToggleGroup,
|
|
3
|
-
ToggleGroupCount,
|
|
4
|
-
ToggleGroupItem,
|
|
5
|
-
ToggleGroupLabel,
|
|
6
|
-
} from "./toggle-group.tsx";
|
|
7
|
-
export type {
|
|
8
|
-
ToggleGroupCountProps,
|
|
9
|
-
ToggleGroupItemProps,
|
|
10
|
-
ToggleGroupLabelProps,
|
|
11
|
-
ToggleGroupProps,
|
|
12
|
-
} from "./toggle-group.tsx";
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import type { ComponentPropsWithRef } from "react";
|
|
2
|
-
import { Toggle as BaseToggle } from "@base-ui/react/toggle";
|
|
3
|
-
import { ToggleGroup as BaseToggleGroup } from "@base-ui/react/toggle-group";
|
|
4
|
-
import { tv, type VariantProps } from "../../lib/tv.ts";
|
|
5
|
-
import type { StyledProps } from "../../lib/styled-props.ts";
|
|
6
|
-
import { useThemeFamily } from "../../lib/theme/use-theme.ts";
|
|
7
|
-
|
|
8
|
-
const toggleGroup = tv({
|
|
9
|
-
slots: {
|
|
10
|
-
root: ["inline-flex max-w-full flex-wrap items-center gap-1"],
|
|
11
|
-
item: [
|
|
12
|
-
"flex h-7 min-w-0 shrink-0 items-center gap-1 px-2",
|
|
13
|
-
"text-xs font-bold transition-colors",
|
|
14
|
-
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
|
|
15
|
-
],
|
|
16
|
-
label: ["truncate"],
|
|
17
|
-
count: ["font-mono text-[10px] leading-none"],
|
|
18
|
-
},
|
|
19
|
-
variants: {
|
|
20
|
-
theme: {
|
|
21
|
-
brutal: {
|
|
22
|
-
item: [
|
|
23
|
-
"border-2 border-line-strong bg-layer-panel text-foreground-strong",
|
|
24
|
-
"hover:bg-primary-400/30 data-[pressed]:bg-primary-400 data-[pressed]:text-foreground-strong",
|
|
25
|
-
"data-[pressed]:shadow-sm data-[disabled]:cursor-not-allowed",
|
|
26
|
-
],
|
|
27
|
-
count: ["text-foreground/40", "group-data-[pressed]/toggle-group-item:text-foreground/60"],
|
|
28
|
-
},
|
|
29
|
-
// Elegant styling is deferred; see the component TODO.
|
|
30
|
-
elegant: {},
|
|
31
|
-
},
|
|
32
|
-
disabled: {
|
|
33
|
-
true: {
|
|
34
|
-
root: "opacity-50",
|
|
35
|
-
},
|
|
36
|
-
false: {
|
|
37
|
-
root: "",
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
defaultVariants: {
|
|
42
|
-
disabled: false,
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
export type ToggleGroupProps<T extends string = string> = StyledProps<
|
|
47
|
-
Omit<BaseToggleGroup.Props<T>, "defaultValue" | "multiple" | "onValueChange" | "value">
|
|
48
|
-
> &
|
|
49
|
-
Omit<VariantProps<typeof toggleGroup>, "theme"> & {
|
|
50
|
-
value: T;
|
|
51
|
-
onValueChange: (value: T, eventDetails: BaseToggleGroup.ChangeEventDetails) => void;
|
|
52
|
-
ariaLabel?: string;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export function ToggleGroup<T extends string = string>({
|
|
56
|
-
value,
|
|
57
|
-
onValueChange,
|
|
58
|
-
ariaLabel,
|
|
59
|
-
disabled = false,
|
|
60
|
-
className,
|
|
61
|
-
...props
|
|
62
|
-
}: ToggleGroupProps<T>) {
|
|
63
|
-
const { root } = toggleGroup({ disabled });
|
|
64
|
-
return (
|
|
65
|
-
<BaseToggleGroup
|
|
66
|
-
value={[value]}
|
|
67
|
-
onValueChange={(nextValue, eventDetails) => {
|
|
68
|
-
const selectedValue = nextValue[0];
|
|
69
|
-
if (selectedValue) onValueChange(selectedValue, eventDetails);
|
|
70
|
-
}}
|
|
71
|
-
aria-label={ariaLabel}
|
|
72
|
-
disabled={disabled}
|
|
73
|
-
data-slot="toggle-group"
|
|
74
|
-
className={root({ className })}
|
|
75
|
-
{...props}
|
|
76
|
-
/>
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export type ToggleGroupItemProps<T extends string = string> = StyledProps<BaseToggle.Props<T>>;
|
|
81
|
-
|
|
82
|
-
export function ToggleGroupItem<T extends string = string>({
|
|
83
|
-
className,
|
|
84
|
-
...props
|
|
85
|
-
}: ToggleGroupItemProps<T>) {
|
|
86
|
-
const theme = useThemeFamily();
|
|
87
|
-
const { item } = toggleGroup({ theme });
|
|
88
|
-
return (
|
|
89
|
-
<BaseToggle
|
|
90
|
-
type="button"
|
|
91
|
-
data-slot="toggle-group-item"
|
|
92
|
-
className={item({ className: `group/toggle-group-item ${className ?? ""}`.trim() })}
|
|
93
|
-
{...props}
|
|
94
|
-
/>
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export type ToggleGroupLabelProps = ComponentPropsWithRef<"span">;
|
|
99
|
-
|
|
100
|
-
export function ToggleGroupLabel({ className, ...props }: ToggleGroupLabelProps) {
|
|
101
|
-
const { label } = toggleGroup();
|
|
102
|
-
return <span data-slot="toggle-group-label" className={label({ className })} {...props} />;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export type ToggleGroupCountProps = ComponentPropsWithRef<"span">;
|
|
106
|
-
|
|
107
|
-
export function ToggleGroupCount({ className, ...props }: ToggleGroupCountProps) {
|
|
108
|
-
const theme = useThemeFamily();
|
|
109
|
-
const { count } = toggleGroup({ theme });
|
|
110
|
-
return <span data-slot="toggle-group-count" className={count({ className })} {...props} />;
|
|
111
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export {
|
|
2
|
-
Tooltip,
|
|
3
|
-
TooltipContent,
|
|
4
|
-
TooltipPortal,
|
|
5
|
-
TooltipProvider,
|
|
6
|
-
TooltipTrigger,
|
|
7
|
-
} from "./tooltip.tsx";
|
|
8
|
-
export type {
|
|
9
|
-
TooltipContentProps,
|
|
10
|
-
TooltipPortalProps,
|
|
11
|
-
TooltipProps,
|
|
12
|
-
TooltipProviderProps,
|
|
13
|
-
TooltipTriggerProps,
|
|
14
|
-
} from "./tooltip.tsx";
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import { Tooltip as BaseTooltip } from "@base-ui/react/tooltip";
|
|
2
|
-
import type { ComponentProps } from "react";
|
|
3
|
-
import { tv, type VariantProps } from "../../lib/tv.ts";
|
|
4
|
-
import type { StyledProps } from "../../lib/styled-props.ts";
|
|
5
|
-
import { useThemeFamily } from "../../lib/theme/use-theme.ts";
|
|
6
|
-
|
|
7
|
-
const tooltip = tv({
|
|
8
|
-
slots: {
|
|
9
|
-
trigger: ["select-none"],
|
|
10
|
-
positioner: ["isolate z-50 outline-none"],
|
|
11
|
-
content: [
|
|
12
|
-
"relative inline-flex max-w-xs items-center gap-1.5 px-3 py-2",
|
|
13
|
-
"text-[13px] leading-[18px] whitespace-normal",
|
|
14
|
-
"origin-[var(--transform-origin)] outline-none",
|
|
15
|
-
"transition-[opacity,transform] duration-100",
|
|
16
|
-
"data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
|
|
17
|
-
"data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
|
|
18
|
-
"data-[instant]:transition-none",
|
|
19
|
-
"[&>svg]:size-3.5 [&>svg]:shrink-0",
|
|
20
|
-
"has-[[data-slot=kbd]]:py-1.5 has-[[data-slot=kbd]]:pr-1.5",
|
|
21
|
-
"[&_[data-slot=kbd]]:relative [&_[data-slot=kbd]]:z-10",
|
|
22
|
-
"[&_[data-slot=kbd]]:h-4 [&_[data-slot=kbd]]:min-w-4 [&_[data-slot=kbd]]:px-1 [&_[data-slot=kbd]]:py-0",
|
|
23
|
-
"[&_[data-slot=kbd]]:text-[10px] [&_[data-slot=kbd]]:font-semibold [&_[data-slot=kbd]]:leading-none",
|
|
24
|
-
],
|
|
25
|
-
arrow: [
|
|
26
|
-
"pointer-events-none flex",
|
|
27
|
-
"data-[side=top]:bottom-[-6px]",
|
|
28
|
-
"data-[side=bottom]:top-[-6px] data-[side=bottom]:rotate-180",
|
|
29
|
-
"data-[side=left]:right-[-8px] data-[side=left]:-rotate-90",
|
|
30
|
-
"data-[side=right]:left-[-8px] data-[side=right]:rotate-90",
|
|
31
|
-
"data-[side=inline-start]:right-[-8px] data-[side=inline-start]:-rotate-90",
|
|
32
|
-
"data-[side=inline-end]:left-[-8px] data-[side=inline-end]:rotate-90",
|
|
33
|
-
],
|
|
34
|
-
},
|
|
35
|
-
variants: {
|
|
36
|
-
theme: {
|
|
37
|
-
brutal: {
|
|
38
|
-
content: [
|
|
39
|
-
"border-2 border-black bg-white",
|
|
40
|
-
"font-sans font-bold text-black",
|
|
41
|
-
"shadow-none",
|
|
42
|
-
"[&_[data-slot=kbd]]:text-black/60",
|
|
43
|
-
],
|
|
44
|
-
arrow: ["hidden"],
|
|
45
|
-
},
|
|
46
|
-
elegant: {
|
|
47
|
-
content: [
|
|
48
|
-
"rounded-md bg-layer-popover",
|
|
49
|
-
"font-sans text-[13px] font-medium tracking-[-0.005em] text-foreground-strong",
|
|
50
|
-
"shadow-[0_0_0_1px_oklch(0.21_0.006_285_/_0.10),0_1px_1px_oklch(0.21_0.006_285_/_0.04),0_1px_4px_-3px_oklch(0.21_0.006_285_/_0.10)]",
|
|
51
|
-
"[&_[data-slot=kbd]]:bg-foreground-muted/10 [&_[data-slot=kbd]]:text-foreground-muted [&_[data-slot=kbd]]:ring-0",
|
|
52
|
-
],
|
|
53
|
-
arrow: [],
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
variant: {
|
|
57
|
-
default: {},
|
|
58
|
-
inverse: {
|
|
59
|
-
content: [
|
|
60
|
-
"bg-foreground-strong text-foreground-inverse",
|
|
61
|
-
"!shadow-[0_12px_24px_0_oklch(0.21_0.006_285_/_0.045),0_1px_2px_0_oklch(0.21_0.006_285_/_0.035)]",
|
|
62
|
-
"[&_[data-slot=kbd]]:bg-white/10 [&_[data-slot=kbd]]:text-foreground-inverse [&_[data-slot=kbd]]:ring-0",
|
|
63
|
-
],
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
defaultVariants: {
|
|
68
|
-
variant: "default",
|
|
69
|
-
},
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
type TooltipStyleProps = VariantProps<typeof tooltip>;
|
|
73
|
-
|
|
74
|
-
export type TooltipProviderProps = BaseTooltip.Provider.Props;
|
|
75
|
-
|
|
76
|
-
export function TooltipProvider({ delay = 0, ...props }: TooltipProviderProps) {
|
|
77
|
-
return <BaseTooltip.Provider delay={delay} {...props} />;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export type TooltipProps = BaseTooltip.Root.Props;
|
|
81
|
-
|
|
82
|
-
export function Tooltip(props: TooltipProps) {
|
|
83
|
-
return <BaseTooltip.Root {...props} />;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export type TooltipTriggerProps = StyledProps<BaseTooltip.Trigger.Props>;
|
|
87
|
-
|
|
88
|
-
export function TooltipTrigger({ className, ...props }: TooltipTriggerProps) {
|
|
89
|
-
const theme = useThemeFamily();
|
|
90
|
-
const { trigger } = tooltip({ theme });
|
|
91
|
-
return (
|
|
92
|
-
<BaseTooltip.Trigger
|
|
93
|
-
data-slot="tooltip-trigger"
|
|
94
|
-
className={trigger({ className })}
|
|
95
|
-
{...props}
|
|
96
|
-
/>
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export type TooltipPortalProps = BaseTooltip.Portal.Props;
|
|
101
|
-
|
|
102
|
-
export function TooltipPortal(props: TooltipPortalProps) {
|
|
103
|
-
return <BaseTooltip.Portal data-slot="tooltip-portal" {...props} />;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
type TooltipArrowProps = StyledProps<BaseTooltip.Arrow.Props> & Pick<TooltipStyleProps, "variant">;
|
|
107
|
-
|
|
108
|
-
function TooltipArrow({ className, variant, ...props }: TooltipArrowProps) {
|
|
109
|
-
const theme = useThemeFamily();
|
|
110
|
-
const { arrow } = tooltip({ theme, variant });
|
|
111
|
-
return (
|
|
112
|
-
<BaseTooltip.Arrow data-slot="tooltip-arrow" className={arrow({ className })} {...props}>
|
|
113
|
-
<TooltipArrowSvg variant={variant} />
|
|
114
|
-
</BaseTooltip.Arrow>
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function TooltipArrowSvg({
|
|
119
|
-
variant,
|
|
120
|
-
...props
|
|
121
|
-
}: ComponentProps<"svg"> & Pick<TooltipStyleProps, "variant">) {
|
|
122
|
-
const isInverse = variant === "inverse";
|
|
123
|
-
|
|
124
|
-
return (
|
|
125
|
-
<svg width="12" height="6" viewBox="0 0 12 6" fill="none" {...props}>
|
|
126
|
-
<path
|
|
127
|
-
d="M1 0H11L6 5.25Z"
|
|
128
|
-
className={isInverse ? "fill-foreground-strong" : "fill-layer-popover"}
|
|
129
|
-
/>
|
|
130
|
-
<path
|
|
131
|
-
d="M1 0.5L6 5.25L11 0.5"
|
|
132
|
-
className={
|
|
133
|
-
isInverse ? "stroke-[oklch(0_0_0_/_0.18)]" : "stroke-[oklch(0.21_0.006_285_/_0.10)]"
|
|
134
|
-
}
|
|
135
|
-
strokeLinecap="round"
|
|
136
|
-
strokeLinejoin="round"
|
|
137
|
-
vectorEffect="non-scaling-stroke"
|
|
138
|
-
/>
|
|
139
|
-
</svg>
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
export type TooltipContentProps = StyledProps<BaseTooltip.Popup.Props> &
|
|
144
|
-
Pick<
|
|
145
|
-
BaseTooltip.Positioner.Props,
|
|
146
|
-
| "align"
|
|
147
|
-
| "alignOffset"
|
|
148
|
-
| "anchor"
|
|
149
|
-
| "arrowPadding"
|
|
150
|
-
| "collisionAvoidance"
|
|
151
|
-
| "collisionBoundary"
|
|
152
|
-
| "collisionPadding"
|
|
153
|
-
| "disableAnchorTracking"
|
|
154
|
-
| "positionMethod"
|
|
155
|
-
| "side"
|
|
156
|
-
| "sideOffset"
|
|
157
|
-
| "sticky"
|
|
158
|
-
> & {
|
|
159
|
-
portalProps?: TooltipPortalProps;
|
|
160
|
-
} & Pick<TooltipStyleProps, "variant">;
|
|
161
|
-
|
|
162
|
-
export function TooltipContent({
|
|
163
|
-
align = "center",
|
|
164
|
-
alignOffset = 0,
|
|
165
|
-
anchor,
|
|
166
|
-
arrowPadding,
|
|
167
|
-
collisionAvoidance,
|
|
168
|
-
collisionBoundary,
|
|
169
|
-
collisionPadding,
|
|
170
|
-
disableAnchorTracking = false,
|
|
171
|
-
positionMethod = "fixed",
|
|
172
|
-
side = "top",
|
|
173
|
-
sideOffset = 6,
|
|
174
|
-
sticky,
|
|
175
|
-
portalProps,
|
|
176
|
-
variant,
|
|
177
|
-
className,
|
|
178
|
-
children,
|
|
179
|
-
...props
|
|
180
|
-
}: TooltipContentProps) {
|
|
181
|
-
const theme = useThemeFamily();
|
|
182
|
-
const { positioner, content } = tooltip({ theme, variant });
|
|
183
|
-
|
|
184
|
-
return (
|
|
185
|
-
<BaseTooltip.Portal {...portalProps}>
|
|
186
|
-
<BaseTooltip.Positioner
|
|
187
|
-
align={align}
|
|
188
|
-
alignOffset={alignOffset}
|
|
189
|
-
anchor={anchor}
|
|
190
|
-
arrowPadding={arrowPadding}
|
|
191
|
-
collisionAvoidance={collisionAvoidance}
|
|
192
|
-
collisionBoundary={collisionBoundary}
|
|
193
|
-
collisionPadding={collisionPadding}
|
|
194
|
-
disableAnchorTracking={disableAnchorTracking}
|
|
195
|
-
positionMethod={positionMethod}
|
|
196
|
-
side={side}
|
|
197
|
-
sideOffset={sideOffset}
|
|
198
|
-
sticky={sticky}
|
|
199
|
-
className={positioner()}
|
|
200
|
-
>
|
|
201
|
-
<BaseTooltip.Popup
|
|
202
|
-
data-slot="tooltip-content"
|
|
203
|
-
className={content({ className })}
|
|
204
|
-
{...props}
|
|
205
|
-
>
|
|
206
|
-
{children}
|
|
207
|
-
<TooltipArrow variant={variant} />
|
|
208
|
-
</BaseTooltip.Popup>
|
|
209
|
-
</BaseTooltip.Positioner>
|
|
210
|
-
</BaseTooltip.Portal>
|
|
211
|
-
);
|
|
212
|
-
}
|