@xerobi/ui 0.1.0 → 0.1.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/dist/components/alert-dialog/alert-dialog.js +2 -2
- package/dist/components/clipboard-text/clipboard-text.d.ts +15 -0
- package/dist/components/clipboard-text/clipboard-text.js +58 -0
- package/dist/components/clipboard-text/index.d.ts +1 -0
- package/dist/components/clipboard-text/index.js +1 -0
- package/dist/components/dialog/dialog.js +2 -2
- package/dist/components/index.d.ts +7 -1
- package/dist/components/index.js +7 -1
- package/dist/components/inline-copy-text/index.d.ts +1 -0
- package/dist/components/inline-copy-text/index.js +1 -0
- package/dist/components/inline-copy-text/inline-copy-text.d.ts +35 -0
- package/dist/components/inline-copy-text/inline-copy-text.js +66 -0
- package/dist/components/navigation-progress/index.d.ts +1 -0
- package/dist/components/navigation-progress/index.js +1 -0
- package/dist/components/navigation-progress/navigation-progress.d.ts +10 -0
- package/dist/components/navigation-progress/navigation-progress.js +59 -0
- package/dist/components/sensitive-input/index.d.ts +1 -0
- package/dist/components/sensitive-input/index.js +1 -0
- package/dist/components/sensitive-input/sensitive-input.d.ts +14 -0
- package/dist/components/sensitive-input/sensitive-input.js +175 -0
- package/dist/components/sheet/sheet.js +1 -1
- package/dist/components/spinner/spinner.js +2 -2
- package/dist/components/switch/switch.d.ts +53 -2
- package/dist/components/switch/switch.js +47 -3
- package/dist/components/toast/index.d.ts +1 -0
- package/dist/components/toast/index.js +1 -0
- package/dist/components/toast/toast.d.ts +90 -0
- package/dist/components/toast/toast.js +137 -0
- package/dist/components/toolbar/index.d.ts +1 -0
- package/dist/components/toolbar/index.js +1 -0
- package/dist/components/toolbar/toolbar.d.ts +18 -0
- package/dist/components/toolbar/toolbar.js +53 -0
- package/dist/components/tooltip/tooltip.d.ts +50 -3
- package/dist/components/tooltip/tooltip.js +39 -7
- package/dist/components/xerobi-logo/index.d.ts +1 -0
- package/dist/components/xerobi-logo/index.js +1 -0
- package/dist/components/xerobi-logo/xerobi-logo.d.ts +60 -0
- package/dist/components/xerobi-logo/xerobi-logo.js +88 -0
- package/dist/styles/globals.css +36 -1
- package/docs/compliance-report.md +1 -1
- package/docs/publishing.md +1 -1
- package/package.json +29 -5
- package/dist/components/snackbar/classes.d.ts +0 -18
- package/dist/components/snackbar/classes.js +0 -19
- package/dist/components/snackbar/index.d.ts +0 -3
- package/dist/components/snackbar/index.js +0 -3
- package/dist/components/snackbar/snackbar.d.ts +0 -8
- package/dist/components/snackbar/snackbar.js +0 -39
- package/dist/styles/snackbar.css +0 -68
|
@@ -1,8 +1,59 @@
|
|
|
1
1
|
import { Switch as SwitchPrimitive } from "@base-ui/react/switch";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
2
3
|
type SwitchColor = "primary" | "secondary" | "info" | "success" | "warning" | "error" | "inherit";
|
|
3
|
-
|
|
4
|
+
type SwitchProps = Omit<SwitchPrimitive.Root.Props, "color" | "children"> & {
|
|
4
5
|
size?: "sm" | "default";
|
|
5
6
|
color?: SwitchColor;
|
|
7
|
+
/** Label content — when provided, wraps the switch in a Field */
|
|
8
|
+
label?: ReactNode;
|
|
9
|
+
/** Tooltip content displayed next to the label */
|
|
10
|
+
labelTooltip?: ReactNode;
|
|
11
|
+
/** When explicitly false, shows "(optional)" after the label */
|
|
12
|
+
required?: boolean;
|
|
13
|
+
/** When true (default), switch appears before label */
|
|
14
|
+
controlFirst?: boolean;
|
|
15
|
+
/** Shows a busy indicator on the switch */
|
|
16
|
+
transitioning?: boolean;
|
|
17
|
+
};
|
|
18
|
+
type SwitchItemProps = Omit<SwitchPrimitive.Root.Props, "color" | "children"> & {
|
|
19
|
+
size?: "sm" | "default";
|
|
20
|
+
color?: SwitchColor;
|
|
21
|
+
/** Label text displayed next to the switch */
|
|
22
|
+
label: string;
|
|
23
|
+
/** Additional class names for the wrapping <label> */
|
|
24
|
+
className?: string;
|
|
25
|
+
/** Shows a busy indicator on the switch */
|
|
26
|
+
transitioning?: boolean;
|
|
27
|
+
};
|
|
28
|
+
declare function SwitchLegend({ children, className, }: {
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
className?: string;
|
|
6
31
|
}): import("react").JSX.Element;
|
|
32
|
+
declare namespace SwitchLegend {
|
|
33
|
+
var displayName: string;
|
|
34
|
+
}
|
|
35
|
+
type SwitchGroupProps = {
|
|
36
|
+
/** Legend text — omit to use <Switch.Legend> as a child instead */
|
|
37
|
+
legend?: string;
|
|
38
|
+
children: ReactNode;
|
|
39
|
+
/** Error message shown below the group */
|
|
40
|
+
error?: string;
|
|
41
|
+
/** Helper text shown below the group */
|
|
42
|
+
description?: ReactNode;
|
|
43
|
+
/** Disables all switches in the group */
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
/** When true (default), switch appears before label */
|
|
46
|
+
controlFirst?: boolean;
|
|
47
|
+
className?: string;
|
|
48
|
+
};
|
|
49
|
+
declare function SwitchGroup({ legend, children, error, description, disabled, controlFirst, className, }: SwitchGroupProps): import("react").JSX.Element;
|
|
50
|
+
declare namespace SwitchGroup {
|
|
51
|
+
var displayName: string;
|
|
52
|
+
}
|
|
53
|
+
declare const Switch: import("react").ForwardRefExoticComponent<Omit<SwitchProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>> & {
|
|
54
|
+
Item: import("react").ForwardRefExoticComponent<Omit<SwitchItemProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
55
|
+
Group: typeof SwitchGroup;
|
|
56
|
+
Legend: typeof SwitchLegend;
|
|
57
|
+
};
|
|
7
58
|
export { Switch };
|
|
8
|
-
export type { SwitchColor };
|
|
59
|
+
export type { SwitchColor, SwitchProps, SwitchItemProps, SwitchGroupProps };
|
|
@@ -1,6 +1,8 @@
|
|
|
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 { Switch as SwitchPrimitive } from "@base-ui/react/switch";
|
|
4
|
+
import { Fieldset } from "@base-ui/react/fieldset";
|
|
5
|
+
import { createContext, forwardRef, useContext, } from "react";
|
|
4
6
|
import { cn } from "cn";
|
|
5
7
|
const checkedTrack = {
|
|
6
8
|
primary: "data-checked:bg-primary",
|
|
@@ -11,7 +13,49 @@ const checkedTrack = {
|
|
|
11
13
|
error: "data-checked:bg-error",
|
|
12
14
|
inherit: "data-checked:bg-text-primary",
|
|
13
15
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
// Context for passing controlFirst from Group to Items
|
|
17
|
+
const SwitchGroupContext = /* @__PURE__ */ createContext({
|
|
18
|
+
controlFirst: true,
|
|
19
|
+
});
|
|
20
|
+
const SwitchRoot = /* @__PURE__ */ forwardRef(({ className, size = "default", color = "primary", label, labelTooltip, required, controlFirst = true, transitioning, ...props }, ref) => {
|
|
21
|
+
const ariaLabelFallback = typeof label === "string" ? label : "Switch";
|
|
22
|
+
const switchControl = (_jsx(SwitchPrimitive.Root, { ref: ref, "data-slot": "switch", "data-size": size, "aria-busy": transitioning || undefined, "aria-label": props["aria-label"] ?? (!label ? ariaLabelFallback : undefined), className: cn("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent bg-grey-500/48 transition-colors outline-none after:absolute after:-inset-x-2 after:-inset-y-2 focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:ring-3 aria-invalid:ring-error/20 data-[size=default]:h-5 data-[size=default]:w-[34px] data-[size=sm]:h-4 data-[size=sm]:w-7 data-disabled:cursor-not-allowed data-disabled:opacity-48", checkedTrack[color], className), ...props, children: _jsx(SwitchPrimitive.Thumb, { "data-slot": "switch-thumb", className: cn("pointer-events-none block rounded-full bg-white shadow-z1 ring-0 transition-transform", "group-data-[size=default]/switch:size-3.5 group-data-[size=default]/switch:translate-x-[2px] group-data-[size=default]/switch:data-checked:translate-x-[17px]", "group-data-[size=sm]/switch:size-2.5 group-data-[size=sm]/switch:translate-x-[2px] group-data-[size=sm]/switch:data-checked:translate-x-[15px]", color === "inherit" && "dark:data-checked:bg-grey-800") }) }));
|
|
23
|
+
// If no label, return bare switch (for standalone use)
|
|
24
|
+
if (!label) {
|
|
25
|
+
return switchControl;
|
|
26
|
+
}
|
|
27
|
+
// Wrap in a Field-like label row
|
|
28
|
+
return (_jsx(Field, { label: label, labelTooltip: labelTooltip, required: required, controlFirst: controlFirst, children: switchControl }));
|
|
29
|
+
});
|
|
30
|
+
SwitchRoot.displayName = "Switch";
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
// Minimal internal Field wrapper (replace with your existing Field component)
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
function Field({ label, labelTooltip, required, controlFirst, children, }) {
|
|
35
|
+
return (_jsxs("label", { className: cn("inline-flex items-center gap-2", !controlFirst && "flex-row-reverse justify-end"), children: [children, _jsxs("span", { className: "inline-flex items-center gap-1 text-sm font-medium text-text-primary", children: [label, required === false && (_jsx("span", { className: "text-text-secondary", children: "(optional)" })), labelTooltip && (_jsx("span", { title: typeof labelTooltip === "string" ? labelTooltip : undefined, className: "cursor-help text-text-secondary", children: "\u24D8" }))] })] }));
|
|
16
36
|
}
|
|
37
|
+
const SwitchItem = /* @__PURE__ */ forwardRef(({ className, size = "default", color = "primary", label, transitioning, disabled, ...props }, ref) => {
|
|
38
|
+
const { controlFirst } = useContext(SwitchGroupContext);
|
|
39
|
+
return (_jsxs("label", { className: cn("relative m-0 inline-flex items-center gap-2", !controlFirst && "flex-row-reverse justify-end", disabled ? "cursor-not-allowed opacity-48" : "cursor-pointer", className), children: [_jsx(SwitchPrimitive.Root, { ref: ref, "data-slot": "switch", "data-size": size, disabled: disabled, "aria-busy": transitioning || undefined, className: cn("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent bg-grey-500/48 transition-colors outline-none after:absolute after:-inset-x-2 after:-inset-y-2 focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:ring-3 aria-invalid:ring-error/20 data-[size=default]:h-5 data-[size=default]:w-[34px] data-[size=sm]:h-4 data-[size=sm]:w-7 data-disabled:cursor-not-allowed data-disabled:opacity-48", checkedTrack[color]), ...props, children: _jsx(SwitchPrimitive.Thumb, { "data-slot": "switch-thumb", className: cn("pointer-events-none block rounded-full bg-white shadow-z1 ring-0 transition-transform", "group-data-[size=default]/switch:size-3.5 group-data-[size=default]/switch:translate-x-[2px] group-data-[size=default]/switch:data-checked:translate-x-[17px]", "group-data-[size=sm]/switch:size-2.5 group-data-[size=sm]/switch:translate-x-[2px] group-data-[size=sm]/switch:data-checked:translate-x-[15px]", color === "inherit" && "dark:data-checked:bg-grey-800") }) }), _jsx("span", { className: "text-sm font-medium text-text-primary", children: label })] }));
|
|
40
|
+
});
|
|
41
|
+
SwitchItem.displayName = "Switch.Item";
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
// Switch.Legend (composable legend for Switch.Group)
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
function SwitchLegend({ children, className, }) {
|
|
46
|
+
return (_jsx(Fieldset.Legend, { className: cn("text-sm font-medium text-text-primary", className), children: children }));
|
|
47
|
+
}
|
|
48
|
+
SwitchLegend.displayName = "Switch.Legend";
|
|
49
|
+
function SwitchGroup({ legend, children, error, description, disabled, controlFirst = true, className, }) {
|
|
50
|
+
return (_jsx(SwitchGroupContext.Provider, { value: { controlFirst }, children: _jsxs(Fieldset.Root, { className: cn("flex flex-col gap-4", className), disabled: disabled, children: [legend && (_jsx(Fieldset.Legend, { className: "text-sm font-medium text-text-primary", children: legend })), _jsx("div", { className: "flex flex-col gap-2", children: children }), error && _jsx("p", { className: "text-sm text-error", children: error }), description && (_jsx("p", { className: "text-sm leading-snug text-pretty text-text-secondary", children: description }))] }) }));
|
|
51
|
+
}
|
|
52
|
+
SwitchGroup.displayName = "Switch.Group";
|
|
53
|
+
// ---------------------------------------------------------------------------
|
|
54
|
+
// Compound export
|
|
55
|
+
// ---------------------------------------------------------------------------
|
|
56
|
+
const Switch = Object.assign(SwitchRoot, {
|
|
57
|
+
Item: SwitchItem,
|
|
58
|
+
Group: SwitchGroup,
|
|
59
|
+
Legend: SwitchLegend,
|
|
60
|
+
});
|
|
17
61
|
export { Switch };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./toast.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./toast.js";
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { type ToastManagerAddOptions, type ToastManagerUpdateOptions, type ToastObject } from "@base-ui/react/toast";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
import { type ButtonProps } from "../button/index.js";
|
|
4
|
+
export declare const TOAST_VARIANTS: {
|
|
5
|
+
readonly default: {
|
|
6
|
+
readonly classes: "xui-paper border-zinc-200 dark:bg-zinc-950 dark:border-zinc-800 text-zinc-900 dark:text-zinc-50";
|
|
7
|
+
readonly icon: null;
|
|
8
|
+
readonly iconColor: "";
|
|
9
|
+
readonly closeColor: "text-zinc-400 hover:text-zinc-900";
|
|
10
|
+
};
|
|
11
|
+
readonly success: {
|
|
12
|
+
readonly classes: "bg-white border-zinc-200 dark:bg-zinc-950 dark:border-zinc-800";
|
|
13
|
+
readonly icon: import("lucide-react").LucideIcon;
|
|
14
|
+
readonly iconColor: "text-green-500";
|
|
15
|
+
readonly closeColor: "text-green-600 hover:text-green-700";
|
|
16
|
+
};
|
|
17
|
+
readonly error: {
|
|
18
|
+
readonly classes: "bg-white border-zinc-200 dark:bg-zinc-950 dark:border-zinc-800";
|
|
19
|
+
readonly icon: import("lucide-react").LucideIcon;
|
|
20
|
+
readonly iconColor: "text-red-500";
|
|
21
|
+
readonly closeColor: "text-red-600 hover:text-red-700";
|
|
22
|
+
};
|
|
23
|
+
readonly warning: {
|
|
24
|
+
readonly classes: "bg-white border-zinc-200 dark:bg-zinc-950 dark:border-zinc-800";
|
|
25
|
+
readonly icon: import("lucide-react").LucideIcon;
|
|
26
|
+
readonly iconColor: "text-amber-500";
|
|
27
|
+
readonly closeColor: "text-amber-600 hover:text-amber-700";
|
|
28
|
+
};
|
|
29
|
+
readonly info: {
|
|
30
|
+
readonly classes: "bg-white border-zinc-200 dark:bg-zinc-950 dark:border-zinc-800";
|
|
31
|
+
readonly icon: import("lucide-react").LucideIcon;
|
|
32
|
+
readonly iconColor: "text-blue-500";
|
|
33
|
+
readonly closeColor: "text-blue-600 hover:text-blue-700";
|
|
34
|
+
};
|
|
35
|
+
readonly loading: {
|
|
36
|
+
readonly classes: "bg-white border-zinc-200 dark:bg-zinc-950 dark:border-zinc-800";
|
|
37
|
+
readonly icon: import("lucide-react").LucideIcon;
|
|
38
|
+
readonly iconColor: "text-zinc-500 animate-spin";
|
|
39
|
+
readonly closeColor: "text-zinc-400 hover:text-zinc-900";
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export type ToastVariant = keyof typeof TOAST_VARIANTS;
|
|
43
|
+
export declare function toastVariants({ variant }?: {
|
|
44
|
+
variant?: ToastVariant;
|
|
45
|
+
}): string;
|
|
46
|
+
export type ToastyOptions<Data extends object = object> = ToastObject<Data> & {
|
|
47
|
+
variant?: ToastVariant;
|
|
48
|
+
content?: React.ReactNode;
|
|
49
|
+
actions?: Array<ButtonProps>;
|
|
50
|
+
bump?: boolean;
|
|
51
|
+
};
|
|
52
|
+
export interface ToastyProps {
|
|
53
|
+
children: React.ReactNode;
|
|
54
|
+
container?: HTMLElement | null;
|
|
55
|
+
toastManager?: ReturnType<typeof createToastyManager>;
|
|
56
|
+
}
|
|
57
|
+
export declare const useToasty: () => {
|
|
58
|
+
toasts: Array<ToastyOptions>;
|
|
59
|
+
add: (<T extends any = any>(options: ToastManagerAddOptions<T>) => string) & ((options: ToastManagerAddOptions<any> & {
|
|
60
|
+
variant?: ToastVariant;
|
|
61
|
+
bump?: boolean;
|
|
62
|
+
}) => any);
|
|
63
|
+
close: (toastId?: string) => void;
|
|
64
|
+
update: (<T extends any = any>(toastId: string, options: ToastManagerUpdateOptions<T> | ((prevToast: ToastObject<T>) => ToastManagerUpdateOptions<T>)) => void) & ((id: string, options: (ToastManagerUpdateOptions<any> & {
|
|
65
|
+
variant?: ToastVariant;
|
|
66
|
+
bump?: boolean;
|
|
67
|
+
}) | ((prev: any) => any)) => any);
|
|
68
|
+
promise: (<Value, T extends any = any>(promise: Promise<Value>, options: import("@base-ui/react").ToastManagerPromiseOptions<Value, T>) => Promise<Value>) & (<T>(promise: Promise<T>, options: {
|
|
69
|
+
loading: ToastManagerAddOptions<any>;
|
|
70
|
+
success: ToastManagerAddOptions<any> | ((data: T) => ToastManagerAddOptions<any>);
|
|
71
|
+
error: ToastManagerAddOptions<any> | ((err: Error) => ToastManagerAddOptions<any>);
|
|
72
|
+
}) => any);
|
|
73
|
+
};
|
|
74
|
+
export declare const createToastyManager: () => import("@base-ui/react").ToastManager<any> & {
|
|
75
|
+
add: (options: ToastManagerAddOptions<any> & {
|
|
76
|
+
variant?: ToastVariant;
|
|
77
|
+
bump?: boolean;
|
|
78
|
+
}) => any;
|
|
79
|
+
update: (id: string, options: (ToastManagerUpdateOptions<any> & {
|
|
80
|
+
variant?: ToastVariant;
|
|
81
|
+
bump?: boolean;
|
|
82
|
+
}) | ((prev: any) => any)) => any;
|
|
83
|
+
promise: <T>(promise: Promise<T>, options: {
|
|
84
|
+
loading: ToastManagerAddOptions<any>;
|
|
85
|
+
success: ToastManagerAddOptions<any> | ((data: T) => ToastManagerAddOptions<any>);
|
|
86
|
+
error: ToastManagerAddOptions<any> | ((err: Error) => ToastManagerAddOptions<any>);
|
|
87
|
+
}) => any;
|
|
88
|
+
};
|
|
89
|
+
export declare function Toasty({ children, container, toastManager }: ToastyProps): React.JSX.Element;
|
|
90
|
+
export declare const ToastProvider: typeof Toasty;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Toast, } from "@base-ui/react/toast";
|
|
4
|
+
import { useDirection } from "@base-ui/react/direction-provider";
|
|
5
|
+
import { CheckCircle2, Info, AlertTriangle, XCircle, X, Loader, } from "lucide-react";
|
|
6
|
+
import { cn } from "cn"; // Replace with your utility path
|
|
7
|
+
import { Button } from "../button/index.js";
|
|
8
|
+
/* ------------------------------------------------------------------ */
|
|
9
|
+
/* Variants & Styling */
|
|
10
|
+
/* ------------------------------------------------------------------ */
|
|
11
|
+
export const TOAST_VARIANTS = {
|
|
12
|
+
default: {
|
|
13
|
+
classes: "xui-paper border-zinc-200 dark:bg-zinc-950 dark:border-zinc-800 text-zinc-900 dark:text-zinc-50",
|
|
14
|
+
icon: null,
|
|
15
|
+
iconColor: "",
|
|
16
|
+
closeColor: "text-zinc-400 hover:text-zinc-900",
|
|
17
|
+
},
|
|
18
|
+
success: {
|
|
19
|
+
classes: "bg-white border-zinc-200 dark:bg-zinc-950 dark:border-zinc-800",
|
|
20
|
+
icon: CheckCircle2,
|
|
21
|
+
iconColor: "text-green-500",
|
|
22
|
+
closeColor: "text-green-600 hover:text-green-700",
|
|
23
|
+
},
|
|
24
|
+
error: {
|
|
25
|
+
classes: "bg-white border-zinc-200 dark:bg-zinc-950 dark:border-zinc-800",
|
|
26
|
+
icon: XCircle,
|
|
27
|
+
iconColor: "text-red-500",
|
|
28
|
+
closeColor: "text-red-600 hover:text-red-700",
|
|
29
|
+
},
|
|
30
|
+
warning: {
|
|
31
|
+
classes: "bg-white border-zinc-200 dark:bg-zinc-950 dark:border-zinc-800",
|
|
32
|
+
icon: AlertTriangle,
|
|
33
|
+
iconColor: "text-amber-500",
|
|
34
|
+
closeColor: "text-amber-600 hover:text-amber-700",
|
|
35
|
+
},
|
|
36
|
+
info: {
|
|
37
|
+
classes: "bg-white border-zinc-200 dark:bg-zinc-950 dark:border-zinc-800",
|
|
38
|
+
icon: Info,
|
|
39
|
+
iconColor: "text-blue-500",
|
|
40
|
+
closeColor: "text-blue-600 hover:text-blue-700",
|
|
41
|
+
},
|
|
42
|
+
loading: {
|
|
43
|
+
classes: "bg-white border-zinc-200 dark:bg-zinc-950 dark:border-zinc-800",
|
|
44
|
+
icon: Loader,
|
|
45
|
+
iconColor: "text-zinc-500 animate-spin",
|
|
46
|
+
closeColor: "text-zinc-400 hover:text-zinc-900",
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
export function toastVariants({ variant = "default" } = {}) {
|
|
50
|
+
return cn("rounded-xl border p-4 shadow-lg ring-1 ring-black/5 dark:ring-white/10", TOAST_VARIANTS[variant].classes);
|
|
51
|
+
}
|
|
52
|
+
const AUTO_BUMP = Symbol("toast-auto-bump");
|
|
53
|
+
function withBump(options, autoBump) {
|
|
54
|
+
return { ...options, bump: options.bump, [AUTO_BUMP]: autoBump };
|
|
55
|
+
}
|
|
56
|
+
/* ------------------------------------------------------------------ */
|
|
57
|
+
/* Manager Wrappers */
|
|
58
|
+
/* ------------------------------------------------------------------ */
|
|
59
|
+
function wrapManager(manager) {
|
|
60
|
+
return {
|
|
61
|
+
...manager,
|
|
62
|
+
add: (options) => {
|
|
63
|
+
const existing = options.id ? manager.toasts?.find((t) => t.id === options.id) : undefined;
|
|
64
|
+
if (existing) {
|
|
65
|
+
if (existing.transitionStatus !== "ending") {
|
|
66
|
+
const updateOpts = options.timeout !== undefined ? { timeout: options.timeout } : {};
|
|
67
|
+
manager.update(existing.id, withBump(updateOpts, true));
|
|
68
|
+
}
|
|
69
|
+
return existing.id;
|
|
70
|
+
}
|
|
71
|
+
return manager.add(withBump(options, true));
|
|
72
|
+
},
|
|
73
|
+
update: (id, options) => {
|
|
74
|
+
return manager.update(id, typeof options === "function"
|
|
75
|
+
? (prev) => withBump(options(prev), false)
|
|
76
|
+
: withBump(options, false));
|
|
77
|
+
},
|
|
78
|
+
promise: (promise, options) => {
|
|
79
|
+
const { success, error, loading } = options;
|
|
80
|
+
// FIX: Cast loading to `any` so TypeScript allows us to append the `variant` property
|
|
81
|
+
const loadingWithVariant = { ...loading, variant: loading.variant || "loading" };
|
|
82
|
+
return manager.promise(promise, {
|
|
83
|
+
loading: withBump(loadingWithVariant, false),
|
|
84
|
+
success: typeof success === "function"
|
|
85
|
+
? (data) => withBump(success(data), false)
|
|
86
|
+
: withBump(success, false),
|
|
87
|
+
error: typeof error === "function"
|
|
88
|
+
? (err) => withBump(error(err), false)
|
|
89
|
+
: withBump(error, false),
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
export const useToasty = () => {
|
|
95
|
+
const manager = Toast.useToastManager();
|
|
96
|
+
return {
|
|
97
|
+
...wrapManager(manager),
|
|
98
|
+
toasts: manager.toasts,
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
export const createToastyManager = () => {
|
|
102
|
+
return wrapManager(Toast.createToastManager());
|
|
103
|
+
};
|
|
104
|
+
/* ------------------------------------------------------------------ */
|
|
105
|
+
/* Provider */
|
|
106
|
+
/* ------------------------------------------------------------------ */
|
|
107
|
+
export function Toasty({ children, container, toastManager }) {
|
|
108
|
+
return (_jsxs(Toast.Provider, { toastManager: toastManager, children: [children, _jsx(Toast.Portal, { container: container, children: _jsx(Toast.Viewport, { className: "fixed top-4 right-4 z-50 mx-auto flex w-[calc(100%-2rem)] sm:top-8 sm:right-8 sm:w-[380px]", children: _jsx(ToastList, {}) }) })] }));
|
|
109
|
+
}
|
|
110
|
+
export const ToastProvider = Toasty;
|
|
111
|
+
/* ------------------------------------------------------------------ */
|
|
112
|
+
/* Internal Components */
|
|
113
|
+
/* ------------------------------------------------------------------ */
|
|
114
|
+
function getBumpAnimation(toast) {
|
|
115
|
+
const updateKey = toast.updateKey ?? 0;
|
|
116
|
+
const shouldBump = toast.bump === true || (toast.bump !== false && toast[AUTO_BUMP] === true && updateKey > 0);
|
|
117
|
+
return shouldBump && (updateKey % 2 === 0 ? "animate-bump-alt" : "animate-bump");
|
|
118
|
+
}
|
|
119
|
+
function useSwipeDirection() {
|
|
120
|
+
const dir = useDirection();
|
|
121
|
+
return dir === "rtl" ? ["up", "left"] : ["up", "right"];
|
|
122
|
+
}
|
|
123
|
+
function ToastList() {
|
|
124
|
+
const { toasts } = useToasty();
|
|
125
|
+
const swipeDir = useSwipeDirection();
|
|
126
|
+
return toasts.map((toast) => (_jsx(Toast.Root, { toast: toast, swipeDirection: [...swipeDir], className: cn(
|
|
127
|
+
// FIX 3: Changed absolute bottom-0 to top-0, and flipped the offset math
|
|
128
|
+
"absolute top-0 right-0 left-auto z-[calc(1000-var(--toast-index))] m-0 h-[var(--height)] w-full origin-top select-none rounded-xl motion-reduce:[transition-property:opacity]", "[--gap:0.75rem] [--height:var(--toast-frontmost-height,var(--toast-height))] [--offset-y:calc(var(--toast-offset-y)*1+calc(var(--toast-index)*var(--gap)*1)+var(--toast-swipe-movement-y))] [--peek:0.75rem] [--scale:calc(max(0,1-(var(--toast-index)*0.1)))] [--shrink:calc(1-var(--scale))]", "[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)+(var(--toast-index)*var(--peek))+(var(--shrink)*var(--height))))_scale(var(--scale))] [transition:transform_0.5s_cubic-bezier(0.22,1,0.36,1),opacity_0.5s,height_0.15s]", "after:absolute after:bottom-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']", "data-[ending-style]:opacity-0 data-[expanded]:h-[var(--toast-height)] data-[expanded]:[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--offset-y)))] data-[limited]:opacity-0 data-[starting-style]:[transform:translateY(-150%)]", "data-[ending-style]:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))] data-[expanded]:data-[ending-style]:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]", "data-[ending-style]:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))] data-[expanded]:data-[ending-style]:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))]", "data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))] data-[expanded]:data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]", "[&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateY(-150%)]"), children: _jsx("div", { className: cn("relative h-full w-full", toastVariants({ variant: toast.variant }), getBumpAnimation(toast)), children: _jsxs(Toast.Content, { className: "isolate flex flex-col gap-1 pe-6 transition-opacity [transition-duration:250ms] data-[behind]:pointer-events-none data-[behind]:opacity-0 data-[expanded]:pointer-events-auto data-[expanded]:opacity-100", children: [toast.content ?? (_jsxs("div", { className: "flex items-start gap-3", children: [_jsx(ToastIcon, { variant: toast.variant }), _jsxs("div", { className: "flex flex-col gap-1 overflow-hidden", children: [_jsx(Toast.Title, { className: "text-sm font-semibold" }), _jsx(Toast.Description, { className: "text-sm text-zinc-500 dark:text-zinc-400" }), !!toast.actions && (_jsx("div", { className: "mt-2 flex min-w-0 flex-nowrap gap-2 overflow-x-auto p-px", children: toast.actions.map((actionProps, idx) => (_jsx(Button, { color: "primary", ...actionProps }, idx))) }))] })] })), _jsx(Toast.Close, { "aria-label": "Close", render: _jsx(Button, { variant: "ghost", size: "sm", "aria-label": "Close", className: cn("absolute right-2 top-2 size-6 rounded-md hover:bg-zinc-100 dark:hover:bg-zinc-800", toast.variant && TOAST_VARIANTS[toast.variant]?.closeColor), children: _jsx(X, { className: "size-4" }) }) })] }) }) }, toast.id)));
|
|
129
|
+
}
|
|
130
|
+
function ToastIcon({ variant }) {
|
|
131
|
+
if (!variant || variant === "default")
|
|
132
|
+
return null;
|
|
133
|
+
const Icon = TOAST_VARIANTS[variant].icon;
|
|
134
|
+
if (!Icon)
|
|
135
|
+
return null;
|
|
136
|
+
return _jsx(Icon, { className: cn("mt-0.5 size-4 shrink-0", TOAST_VARIANTS[variant].iconColor) });
|
|
137
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./toolbar.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./toolbar.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Toolbar as ToolbarBase } from "@base-ui/react/toolbar";
|
|
3
|
+
import type { InputProps } from "@base-ui/react/input";
|
|
4
|
+
import { type ButtonProps } from "../button/index.js";
|
|
5
|
+
import { InputGroup } from "../input-group/index.js";
|
|
6
|
+
export interface ToolbarProps extends Omit<ToolbarBase.Root.Props, "children"> {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export type ToolbarButtonProps = Omit<ButtonProps, "size" | "variant"> & Pick<ToolbarBase.Button.Props, "focusableWhenDisabled">;
|
|
10
|
+
export type ToolbarInputProps = Omit<InputProps, "size" | "variant" | "label" | "labelTooltip" | "description" | "hideLabel" | "error" | "passwordManagerIgnore" | "render"> & {
|
|
11
|
+
focusableWhenDisabled?: ToolbarBase.Input.Props["focusableWhenDisabled"];
|
|
12
|
+
};
|
|
13
|
+
export type ToolbarInputGroupProps = Omit<React.ComponentPropsWithoutRef<typeof InputGroup>, "size">;
|
|
14
|
+
export declare const Toolbar: React.ForwardRefExoticComponent<Omit<ToolbarProps, "ref"> & React.RefAttributes<HTMLDivElement>> & {
|
|
15
|
+
Button: React.ForwardRefExoticComponent<Omit<ToolbarButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
16
|
+
Input: React.ForwardRefExoticComponent<Omit<ToolbarInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
17
|
+
InputGroup: React.ForwardRefExoticComponent<ToolbarInputGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
18
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Toolbar as ToolbarBase } from "@base-ui/react/toolbar";
|
|
5
|
+
import { cn } from "cn";
|
|
6
|
+
import { Button } from "../button/index.js";
|
|
7
|
+
import { Input } from "../input/index.js";
|
|
8
|
+
import { InputGroup } from "../input-group/index.js";
|
|
9
|
+
const TOOLBAR_CONTROL_STYLES = cn("relative min-w-0 rounded-none border-0 bg-transparent shadow-none ring-0", "focus-within:z-10 focus:z-10 focus-visible:z-10 has-[:focus-visible]:z-10");
|
|
10
|
+
const Root = /* @__PURE__ */ React.forwardRef(({ children, className, ...props }, ref) => {
|
|
11
|
+
return (_jsx(ToolbarBase.Root, { ref: ref, className: cn("inline-flex w-fit items-stretch rounded-lg bg-white shadow-sm ring-1 ring-zinc-200 dark:bg-zinc-950 dark:ring-zinc-800", "[&>*:first-child]:rounded-l-lg [&>*:not([aria-hidden='true']):not([type='hidden']):not(:has(~_:not([aria-hidden='true']):not([type='hidden'])))]:rounded-r-lg", "[&>*:not([aria-hidden='true']):not(:first-child)]:border-l [&>*:not([aria-hidden='true']):not(:first-child)]:border-zinc-200 dark:[&>*:not([aria-hidden='true']):not(:first-child)]:border-zinc-800", className), ...props, children: children }));
|
|
12
|
+
});
|
|
13
|
+
Root.displayName = "Toolbar";
|
|
14
|
+
const ButtonItem = /* @__PURE__ */ React.forwardRef(({ children, className, disabled, loading, type, ...props }, ref) => {
|
|
15
|
+
return (_jsx(ToolbarBase.Button, { ref: ref, disabled: loading || disabled, className: cn(className, TOOLBAR_CONTROL_STYLES), render: _jsx(Button, { variant: "ghost", size: "sm", disabled: disabled, loading: loading, type: type ?? "button", ...props }), ...props, children: children }));
|
|
16
|
+
});
|
|
17
|
+
ButtonItem.displayName = "Toolbar.Button";
|
|
18
|
+
const InputItem = /* @__PURE__ */ React.forwardRef(({ className, style, ...props }, ref) => {
|
|
19
|
+
// FIX: Change parameter type from InputState to any
|
|
20
|
+
const resolvedClassName = (state) => typeof className === "function"
|
|
21
|
+
? cn(className(state), TOOLBAR_CONTROL_STYLES)
|
|
22
|
+
: cn(className, TOOLBAR_CONTROL_STYLES);
|
|
23
|
+
// FIX: Change parameter type from InputState to any
|
|
24
|
+
const resolvedStyle = (state) => typeof style === "function" ? style(state) : style;
|
|
25
|
+
return (_jsx(ToolbarBase.Input, { ref: ref, render: (rootProps, state) => {
|
|
26
|
+
return (_jsx(Input, { ...rootProps, className: resolvedClassName(state), style: resolvedStyle(state), ...props }));
|
|
27
|
+
}, ...props }));
|
|
28
|
+
});
|
|
29
|
+
InputItem.displayName = "Toolbar.Input";
|
|
30
|
+
// FIX 2: Changed the forwarded ref type from HTMLElement to HTMLDivElement
|
|
31
|
+
// to match what your InputGroup component expects.
|
|
32
|
+
const InputGroupItem = /* @__PURE__ */ React.forwardRef(({ children, className, ...props }, ref) => {
|
|
33
|
+
const ariaLabel = props["aria-label"];
|
|
34
|
+
const ariaLabelledBy = props["aria-labelledby"];
|
|
35
|
+
// FIX 3: Explicitly type the child props to avoid 'unknown' errors
|
|
36
|
+
const toolbarChildren = React.Children.map(children, (child) => {
|
|
37
|
+
if (!React.isValidElement(child) ||
|
|
38
|
+
child.type?.displayName !== "InputGroup.Input") {
|
|
39
|
+
return child;
|
|
40
|
+
}
|
|
41
|
+
return (_jsx(ToolbarBase.Input, { "aria-label": child.props["aria-label"] ?? ariaLabel, "aria-labelledby": child.props["aria-labelledby"] ?? ariaLabelledBy, render: React.cloneElement(child) }));
|
|
42
|
+
});
|
|
43
|
+
return (_jsx(InputGroup, { ref: ref, className: cn(TOOLBAR_CONTROL_STYLES, className), ...props, children: toolbarChildren }));
|
|
44
|
+
});
|
|
45
|
+
InputGroupItem.displayName = "Toolbar.InputGroup";
|
|
46
|
+
/* ------------------------------------------------------------------ */
|
|
47
|
+
/* Compound Export */
|
|
48
|
+
/* ------------------------------------------------------------------ */
|
|
49
|
+
export const Toolbar = Object.assign(Root, {
|
|
50
|
+
Button: ButtonItem,
|
|
51
|
+
Input: InputItem,
|
|
52
|
+
InputGroup: InputGroupItem,
|
|
53
|
+
});
|
|
@@ -1,6 +1,53 @@
|
|
|
1
1
|
import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
2
3
|
declare function TooltipProvider({ delay, ...props }: TooltipPrimitive.Provider.Props): import("react").JSX.Element;
|
|
3
|
-
declare function Tooltip({ ...props }: TooltipPrimitive.Root.Props): import("react").JSX.Element;
|
|
4
4
|
declare function TooltipTrigger({ ...props }: TooltipPrimitive.Trigger.Props): import("react").JSX.Element;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Arrow with three paths for correct border rendering in light AND dark modes.
|
|
7
|
+
*
|
|
8
|
+
* 1. fill-current → main arrow body, inherits text color (white in light, grey-700 in dark)
|
|
9
|
+
* 2. fill-transparent → outer stroke (invisible in our current flat design)
|
|
10
|
+
* 3. fill-transparent → inner stroke (invisible in our current flat design)
|
|
11
|
+
*/
|
|
12
|
+
declare function ArrowSvg(props: React.ComponentProps<"svg">): import("react").JSX.Element;
|
|
13
|
+
type TooltipContentProps = TooltipPrimitive.Popup.Props & Pick<TooltipPrimitive.Positioner.Props, "align" | "alignOffset" | "side" | "sideOffset"> & {
|
|
14
|
+
withArrow?: boolean;
|
|
15
|
+
container?: HTMLElement | null;
|
|
16
|
+
};
|
|
17
|
+
declare function TooltipContent({ className, side, sideOffset, align, alignOffset, withArrow, container, children, ...props }: TooltipContentProps): import("react").JSX.Element;
|
|
18
|
+
type TooltipAlign = "start" | "center" | "end";
|
|
19
|
+
type TooltipSide = "top" | "bottom" | "left" | "right";
|
|
20
|
+
type TooltipProps = Omit<TooltipPrimitive.Root.Props, "children"> & {
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
content?: ReactNode;
|
|
23
|
+
side?: TooltipSide;
|
|
24
|
+
align?: TooltipAlign;
|
|
25
|
+
sideOffset?: TooltipPrimitive.Positioner.Props["sideOffset"];
|
|
26
|
+
alignOffset?: number;
|
|
27
|
+
withArrow?: boolean;
|
|
28
|
+
container?: HTMLElement | null;
|
|
29
|
+
className?: string;
|
|
30
|
+
render?: TooltipPrimitive.Trigger.Props["render"];
|
|
31
|
+
/** @deprecated Use `render` instead. */
|
|
32
|
+
asChild?: boolean;
|
|
33
|
+
delay?: number;
|
|
34
|
+
closeDelay?: number;
|
|
35
|
+
};
|
|
36
|
+
declare const Tooltip: import("react").ForwardRefExoticComponent<Omit<TooltipPrimitive.Root.Props<unknown>, "children"> & {
|
|
37
|
+
children?: ReactNode;
|
|
38
|
+
content?: ReactNode;
|
|
39
|
+
side?: TooltipSide;
|
|
40
|
+
align?: TooltipAlign;
|
|
41
|
+
sideOffset?: TooltipPrimitive.Positioner.Props["sideOffset"];
|
|
42
|
+
alignOffset?: number;
|
|
43
|
+
withArrow?: boolean;
|
|
44
|
+
container?: HTMLElement | null;
|
|
45
|
+
className?: string;
|
|
46
|
+
render?: TooltipPrimitive.Trigger.Props["render"];
|
|
47
|
+
/** @deprecated Use `render` instead. */
|
|
48
|
+
asChild?: boolean;
|
|
49
|
+
delay?: number;
|
|
50
|
+
closeDelay?: number;
|
|
51
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
52
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, ArrowSvg, };
|
|
53
|
+
export type { TooltipProps, TooltipContentProps, TooltipSide, TooltipAlign };
|
|
@@ -1,17 +1,49 @@
|
|
|
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 { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
|
|
4
|
+
import { forwardRef, } from "react";
|
|
4
5
|
import { cn } from "cn";
|
|
6
|
+
/* ------------------------------------------------------------------ */
|
|
7
|
+
/* Provider */
|
|
8
|
+
/* ------------------------------------------------------------------ */
|
|
5
9
|
function TooltipProvider({ delay = 0, ...props }) {
|
|
6
10
|
return (_jsx(TooltipPrimitive.Provider, { "data-slot": "tooltip-provider", delay: delay, ...props }));
|
|
7
11
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
/* ------------------------------------------------------------------ */
|
|
13
|
+
/* Primitive trigger (kept for manual composition) */
|
|
14
|
+
/* ------------------------------------------------------------------ */
|
|
11
15
|
function TooltipTrigger({ ...props }) {
|
|
12
16
|
return _jsx(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
13
17
|
}
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
/* ------------------------------------------------------------------ */
|
|
19
|
+
/* Arrow SVG */
|
|
20
|
+
/* ------------------------------------------------------------------ */
|
|
21
|
+
/**
|
|
22
|
+
* Arrow with three paths for correct border rendering in light AND dark modes.
|
|
23
|
+
*
|
|
24
|
+
* 1. fill-current → main arrow body, inherits text color (white in light, grey-700 in dark)
|
|
25
|
+
* 2. fill-transparent → outer stroke (invisible in our current flat design)
|
|
26
|
+
* 3. fill-transparent → inner stroke (invisible in our current flat design)
|
|
27
|
+
*/
|
|
28
|
+
function ArrowSvg(props) {
|
|
29
|
+
return (_jsxs("svg", { width: "20", height: "10", viewBox: "0 0 20 10", fill: "none", ...props, children: [_jsx("path", { d: "M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z", className: "fill-grey-800 dark:fill-grey-700" }), _jsx("path", { d: "M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z", className: "fill-transparent" }), _jsx("path", { d: "M10.3333 3.34539L5.47654 7.71648C4.55842 8.54279 3.36693 9 2.13172 9H0V8H2.13172C3.11989 8 4.07308 7.63423 4.80758 6.97318L9.66437 2.60207C10.0447 2.25979 10.622 2.2598 11.0023 2.60207L15.8591 6.97318C16.5936 7.63423 17.5468 8 18.5349 8H20V9H18.5349C17.2998 9 16.1083 8.54278 15.1901 7.71648L10.3333 3.34539Z", className: "fill-transparent" })] }));
|
|
30
|
+
}
|
|
31
|
+
function TooltipContent({ className, side = "top", sideOffset = 8, align = "center", alignOffset = 0, withArrow = true, container, children, ...props }) {
|
|
32
|
+
const resolvedSideOffset = withArrow && typeof sideOffset === "number" ? sideOffset + 2 : sideOffset;
|
|
33
|
+
return (_jsx(TooltipPrimitive.Portal, { container: container, children: _jsx(TooltipPrimitive.Positioner, { align: align, alignOffset: alignOffset, side: side, sideOffset: resolvedSideOffset, className: "isolate z-tooltip max-w-[var(--available-width)]", children: _jsxs(TooltipPrimitive.Popup, { "data-slot": "tooltip-content", className: cn("z-tooltip inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-sm bg-grey-800 px-2 py-1 text-xs font-semibold text-white dark:bg-grey-700", "has-data-[slot=kbd]:pr-1.5 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-tooltip **:data-[slot=kbd]:rounded-sm", "data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", "data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className), ...props, children: [withArrow && (_jsx(TooltipPrimitive.Arrow, { className: cn("flex", "data-[side=bottom]:top-[-6px]", "data-[side=left]:right-[-11px] data-[side=left]:rotate-90", "data-[side=right]:left-[-11px] data-[side=right]:-rotate-90", "data-[side=top]:bottom-[-6px] data-[side=top]:rotate-180"), children: _jsx(ArrowSvg, {}) })), children] }) }) }));
|
|
16
34
|
}
|
|
17
|
-
|
|
35
|
+
const Tooltip = /* @__PURE__ */ forwardRef(function Tooltip({ content, children, side = "top", align, sideOffset, alignOffset, withArrow = true, container, className, render, asChild, delay, closeDelay, ...props }, ref) {
|
|
36
|
+
if (content !== undefined) {
|
|
37
|
+
const resolvedRender = render ??
|
|
38
|
+
(asChild
|
|
39
|
+
? children
|
|
40
|
+
: undefined);
|
|
41
|
+
const shouldUseRender = resolvedRender !== undefined;
|
|
42
|
+
const triggerTabIndex = !shouldUseRender && props.disabled ? -1 : undefined;
|
|
43
|
+
return (_jsxs(TooltipPrimitive.Root, { ...props, children: [_jsx(TooltipPrimitive.Trigger, { delay: delay, closeDelay: closeDelay, tabIndex: triggerTabIndex, render: resolvedRender, className: cn(!shouldUseRender &&
|
|
44
|
+
"m-0 inline-flex h-auto min-h-0 items-center border-none bg-transparent p-0 shadow-none", "cursor-default", className), children: asChild ? undefined : children }), _jsx(TooltipContent, { side: side, align: align, sideOffset: sideOffset, alignOffset: alignOffset, withArrow: withArrow, container: container, ref: ref, children: content })] }));
|
|
45
|
+
}
|
|
46
|
+
return (_jsx(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props, children: children }));
|
|
47
|
+
});
|
|
48
|
+
Tooltip.displayName = "Tooltip";
|
|
49
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, ArrowSvg, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./xerobi-logo.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./xerobi-logo.js";
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export declare const XEROBI_LOGO_VARIANTS: {
|
|
2
|
+
readonly variant: {
|
|
3
|
+
readonly glyph: {
|
|
4
|
+
readonly description: "X glyph only (logomark)";
|
|
5
|
+
};
|
|
6
|
+
readonly full: {
|
|
7
|
+
readonly description: "Full logo with X glyph and wordmark stacked";
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
readonly color: {
|
|
11
|
+
readonly color: {
|
|
12
|
+
readonly description: "Brand colors";
|
|
13
|
+
};
|
|
14
|
+
readonly black: {
|
|
15
|
+
readonly description: "Solid black logo";
|
|
16
|
+
};
|
|
17
|
+
readonly white: {
|
|
18
|
+
readonly description: "Solid white logo (for dark backgrounds)";
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export declare const XEROBI_LOGO_DEFAULT_VARIANTS: {
|
|
23
|
+
readonly variant: "full";
|
|
24
|
+
readonly color: "color";
|
|
25
|
+
};
|
|
26
|
+
export type XerobiLogoVariant = keyof typeof XEROBI_LOGO_VARIANTS.variant;
|
|
27
|
+
export type XerobiLogoColor = keyof typeof XEROBI_LOGO_VARIANTS.color;
|
|
28
|
+
export interface XerobiLogoProps extends React.SVGAttributes<SVGSVGElement> {
|
|
29
|
+
/**
|
|
30
|
+
* Logo variant
|
|
31
|
+
* - `glyph`: X icon only
|
|
32
|
+
* - `full`: X icon with "XEROBI" wordmark
|
|
33
|
+
* @default "full"
|
|
34
|
+
*/
|
|
35
|
+
variant?: XerobiLogoVariant;
|
|
36
|
+
/**
|
|
37
|
+
* Color scheme
|
|
38
|
+
* @default "color"
|
|
39
|
+
*/
|
|
40
|
+
color?: XerobiLogoColor;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Xerobi logo component.
|
|
44
|
+
*/
|
|
45
|
+
export declare const XerobiLogo: import("react").ForwardRefExoticComponent<XerobiLogoProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
46
|
+
export interface PoweredByXerobiProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
47
|
+
color?: XerobiLogoColor;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* "Powered by Xerobi" badge component.
|
|
51
|
+
*/
|
|
52
|
+
export declare const PoweredByXerobi: import("react").ForwardRefExoticComponent<PoweredByXerobiProps & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
53
|
+
export interface GenerateXerobiLogoSvgOptions {
|
|
54
|
+
variant?: XerobiLogoVariant;
|
|
55
|
+
color?: XerobiLogoColor;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Generates SVG markup string for the Xerobi logo.
|
|
59
|
+
*/
|
|
60
|
+
export declare function generateXerobiLogoSvg(options?: GenerateXerobiLogoSvgOptions): string;
|