@spear-ai/spectral 1.4.2 → 1.4.4
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/Accordion.d.ts +7 -7
- package/dist/Accordion.js +53 -51
- package/dist/Alert/AlertBase.js +7 -7
- package/dist/Alert.js +1 -1
- package/dist/Avatar.d.ts +2 -2
- package/dist/Avatar.js +46 -46
- package/dist/Badge.js +3 -3
- package/dist/Button.js +22 -15
- package/dist/ButtonGroup/ButtonGroupButton.d.ts +1 -1
- package/dist/ButtonGroup/ButtonGroupButton.js +10 -10
- package/dist/ButtonGroup.d.ts +8 -5
- package/dist/ButtonGroup.js +23 -15
- package/dist/ButtonIcon.d.ts +1 -1
- package/dist/ButtonIcon.js +5 -5
- package/dist/Card.d.ts +2 -7
- package/dist/Card.js +9 -20
- package/dist/Checkbox/CheckboxBase.d.ts +6 -6
- package/dist/Checkbox/CheckboxBase.js +65 -63
- package/dist/Checkbox.js +16 -14
- package/dist/DataCard.d.ts +11 -0
- package/dist/DataCard.js +18 -0
- package/dist/Dialog/DialogBase.d.ts +37 -25
- package/dist/Dialog/DialogBase.js +130 -104
- package/dist/Dialog.d.ts +8 -8
- package/dist/Dialog.js +46 -36
- package/dist/Drawer.js +17 -17
- package/dist/HoverCard.d.ts +4 -4
- package/dist/HoverCard.js +34 -33
- package/dist/Input.js +58 -58
- package/dist/InputOTP.d.ts +1 -1
- package/dist/InputOTP.js +113 -112
- package/dist/MultiSelect/MultiSelectBase.d.ts +16 -16
- package/dist/MultiSelect/MultiSelectBase.js +236 -177
- package/dist/MultiSelect/MutiSelect.d.ts +6 -4
- package/dist/MultiSelect/MutiSelect.js +13 -12
- package/dist/Popover.js +2 -1
- package/dist/RadioButtonGroup/RadioButtonGroupBase.js +18 -17
- package/dist/RadioGroup.js +5 -3
- package/dist/Select.js +70 -51
- package/dist/Slider.js +8 -4
- package/dist/Switch/SwitchBase.d.ts +6 -6
- package/dist/Switch/SwitchBase.js +39 -38
- package/dist/Switch.js +17 -16
- package/dist/Tabs/TabsBase.js +40 -25
- package/dist/Tabs.js +18 -21
- package/dist/Textarea.d.ts +1 -0
- package/dist/Textarea.js +33 -33
- package/dist/Toggle.js +4 -4
- package/dist/ToggleGroup/ToggleGroupBase.d.ts +7 -7
- package/dist/ToggleGroup/ToggleGroupBase.js +64 -64
- package/dist/ToggleGroup.js +19 -17
- package/dist/Tooltip/TooltipBase.d.ts +8 -8
- package/dist/Tooltip/TooltipBase.js +76 -74
- package/dist/Tooltip.d.ts +1 -1
- package/dist/Tooltip.js +12 -11
- package/dist/Tray.d.ts +1 -1
- package/dist/Tray.js +4910 -117
- package/dist/primitives/input.js +4 -4
- package/dist/primitives/select.d.ts +11 -11
- package/dist/primitives/select.d.ts.map +1 -1
- package/dist/primitives/select.js +28 -21
- package/dist/styles/base-colors.css +12 -12
- package/dist/styles/main.css +1 -1
- package/dist/utils/{refs.d.ts → createForwardRef.d.ts} +1 -1
- package/dist/utils/createForwardRef.d.ts.map +1 -0
- package/dist/utils/formFieldUtils.d.ts +22 -18
- package/dist/utils/formFieldUtils.d.ts.map +1 -1
- package/dist/utils/formFieldUtils.js +46 -46
- package/package.json +9 -3
- package/dist/analyzer/list.yml.webp +0 -0
- package/dist/analyzer/network.webp +0 -0
- package/dist/analyzer/sunburst.webp +0 -0
- package/dist/analyzer/visual.webp +0 -0
- package/dist/auth-background.json +0 -90
- package/dist/favicon-invert.svg +0 -5
- package/dist/favicon.svg +0 -5
- package/dist/features/AuthCard/AuthCard.d.ts +0 -3
- package/dist/features/AuthCard/AuthCard.d.ts.map +0 -1
- package/dist/features/AuthCard/AuthToggle.d.ts +0 -9
- package/dist/features/AuthCard/AuthToggle.d.ts.map +0 -1
- package/dist/features/AuthCard/AuthToggle.js +0 -20
- package/dist/features/AuthCard/ForgotPasswordEmailForm.d.ts +0 -11
- package/dist/features/AuthCard/ForgotPasswordEmailForm.d.ts.map +0 -1
- package/dist/features/AuthCard/ForgotPasswordEmailForm.js +0 -86
- package/dist/features/AuthCard/ForgotPasswordResetForm.d.ts +0 -11
- package/dist/features/AuthCard/ForgotPasswordResetForm.d.ts.map +0 -1
- package/dist/features/AuthCard/ForgotPasswordResetForm.js +0 -21
- package/dist/features/AuthCard/OTPInput.d.ts +0 -12
- package/dist/features/AuthCard/OTPInput.d.ts.map +0 -1
- package/dist/features/AuthCard/OTPInput.js +0 -12
- package/dist/features/AuthCard/PasswordInput.d.ts +0 -13
- package/dist/features/AuthCard/PasswordInput.d.ts.map +0 -1
- package/dist/features/AuthCard/PasswordInput.js +0 -93
- package/dist/features/AuthCard/SignInForm.d.ts +0 -9
- package/dist/features/AuthCard/SignInForm.d.ts.map +0 -1
- package/dist/features/AuthCard/SignInForm.js +0 -86
- package/dist/features/AuthCard/SignUpForm.d.ts +0 -8
- package/dist/features/AuthCard/SignUpForm.d.ts.map +0 -1
- package/dist/features/AuthCard/SignUpForm.js +0 -100
- package/dist/features/AuthCard.js +0 -202
- package/dist/features/ClearDialog/ClearDialog.d.ts +0 -2
- package/dist/features/ClearDialog/ClearDialog.d.ts.map +0 -1
- package/dist/features/ClearDialog.js +0 -31
- package/dist/features/LabelingToolbar/LabelingToolbar.d.ts +0 -8
- package/dist/features/LabelingToolbar/LabelingToolbar.d.ts.map +0 -1
- package/dist/features/LabelingToolbar.js +0 -13
- package/dist/features/LabelingTools/LabelingTools.d.ts +0 -2
- package/dist/features/LabelingTools/LabelingTools.d.ts.map +0 -1
- package/dist/features/LabelingTools.js +0 -134
- package/dist/features/SensorMetadata/SensorMetadata.d.ts +0 -2
- package/dist/features/SensorMetadata/SensorMetadata.d.ts.map +0 -1
- package/dist/features/SensorMetadata.js +0 -117
- package/dist/features/SettingsPopover/SettingsPopover.d.ts +0 -2
- package/dist/features/SettingsPopover/SettingsPopover.d.ts.map +0 -1
- package/dist/features/SettingsPopover.js +0 -204
- package/dist/index-BIpuW_o8.js +0 -146
- package/dist/linear-cursor-small.png +0 -0
- package/dist/loader-circle-CdRVlFhN.js +0 -11
- package/dist/logo/wordmark-dark-side-by-side.svg +0 -6
- package/dist/logo/wordmark-light-side-by-side.svg +0 -6
- package/dist/message-alert-matte-glass-gradient.webp +0 -0
- package/dist/proxy-C9AqCss6.js +0 -4670
- package/dist/speech-bubble-fluid-glass-gradient.webp +0 -0
- package/dist/themes/grayscale-theme.webp +0 -0
- package/dist/themes/green-black-theme.webp +0 -0
- package/dist/themes/reverse-grayscale-theme.webp +0 -0
- package/dist/themes/viridis-theme.webp +0 -0
- package/dist/utils/refs.d.ts.map +0 -1
- package/dist/x-Dl66o_vF.js +0 -14
- /package/dist/utils/{refs.js → createForwardRef.js} +0 -0
package/dist/ToggleGroup.js
CHANGED
|
@@ -1,47 +1,49 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "./styles/main.css";
|
|
3
|
-
import { jsx as
|
|
4
|
-
import { ToggleGroupItemBase as p, ToggleGroupBase as
|
|
5
|
-
import { toggleVariants as
|
|
6
|
-
import { cn as
|
|
3
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
4
|
+
import { ToggleGroupItemBase as p, ToggleGroupBase as m } from "./ToggleGroup/ToggleGroupBase.js";
|
|
5
|
+
import { toggleVariants as f } from "./Toggle.js";
|
|
6
|
+
import { cn as g } from "./utils/twUtils.js";
|
|
7
7
|
import { createContext as c, forwardRef as v, useContext as b } from "react";
|
|
8
|
-
const
|
|
8
|
+
const n = c({
|
|
9
9
|
size: "default",
|
|
10
10
|
variant: "default",
|
|
11
11
|
layout: "default"
|
|
12
|
-
}), w = ({ className:
|
|
13
|
-
|
|
12
|
+
}), w = ({ className: d, variant: e, size: o, layout: a, children: l, ...r }) => /* @__PURE__ */ u(
|
|
13
|
+
m,
|
|
14
14
|
{
|
|
15
15
|
"data-slot": "toggle-group",
|
|
16
|
+
"data-testid": "spectral-toggle-group",
|
|
16
17
|
"data-variant": e,
|
|
17
18
|
"data-size": o,
|
|
18
19
|
"data-layout": a,
|
|
19
|
-
className:
|
|
20
|
+
className: g(
|
|
20
21
|
"group/toggle-group [&[data-variant='outline']]:bg-toggle-group-bg flex h-fit w-fit [&[data-layout='expanded']]:w-full items-center rounded-md [&_button:first-of-type]:rounded-l-md [&_button:last-of-type]:rounded-r-md [&[data-variant='outline']]:gap-0.25",
|
|
21
|
-
|
|
22
|
+
d
|
|
22
23
|
),
|
|
23
24
|
...r,
|
|
24
|
-
children: /* @__PURE__ */
|
|
25
|
+
children: /* @__PURE__ */ u(n.Provider, { value: { variant: e, size: o, layout: a }, children: l })
|
|
25
26
|
}
|
|
26
|
-
), h = v(({ className:
|
|
27
|
-
const t = b(
|
|
28
|
-
return /* @__PURE__ */
|
|
27
|
+
), h = v(({ className: d, children: e, variant: o, size: a, value: l, layout: r, ...i }, s) => {
|
|
28
|
+
const t = b(n);
|
|
29
|
+
return /* @__PURE__ */ u(
|
|
29
30
|
p,
|
|
30
31
|
{
|
|
31
32
|
ref: s,
|
|
32
33
|
"data-slot": "toggle-group-item",
|
|
34
|
+
"data-testid": "spectral-toggle-group-item",
|
|
33
35
|
"data-variant": t.variant || o,
|
|
34
36
|
"data-size": t.size || a,
|
|
35
37
|
"data-layout": t.layout || r,
|
|
36
|
-
value:
|
|
37
|
-
className:
|
|
38
|
-
|
|
38
|
+
value: l,
|
|
39
|
+
className: g(
|
|
40
|
+
f({
|
|
39
41
|
variant: t.variant || o,
|
|
40
42
|
size: t.size || a,
|
|
41
43
|
layout: t.layout || r
|
|
42
44
|
}),
|
|
43
45
|
"group data-[variant=outline]:border-togglegroup-border rounded-none shadow-none focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0",
|
|
44
|
-
|
|
46
|
+
d
|
|
45
47
|
),
|
|
46
48
|
...i,
|
|
47
49
|
children: e
|
|
@@ -4,8 +4,8 @@ type Align = 'start' | 'center' | 'end';
|
|
|
4
4
|
export type TooltipProviderProps = {
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
delayDuration?: number;
|
|
7
|
-
skipDelayDuration?: number;
|
|
8
7
|
disableHoverableContent?: boolean;
|
|
8
|
+
skipDelayDuration?: number;
|
|
9
9
|
};
|
|
10
10
|
export declare const TooltipProviderBase: import('react').ForwardRefExoticComponent<TooltipProviderProps & import('react').RefAttributes<HTMLElement>>;
|
|
11
11
|
export type TooltipRootProps = {
|
|
@@ -20,7 +20,7 @@ export type TooltipRootProps = {
|
|
|
20
20
|
side?: Side;
|
|
21
21
|
sideOffset?: number;
|
|
22
22
|
};
|
|
23
|
-
export declare const TooltipRootBase: ({
|
|
23
|
+
export declare const TooltipRootBase: ({ align, alignOffset, avoidCollisions, children, defaultOpen, delayDuration, onOpenChange, open: openProp, side, sideOffset }: TooltipRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
24
|
export type TooltipTriggerProps = ComponentPropsWithoutRef<'button'> & {
|
|
25
25
|
asChild?: boolean;
|
|
26
26
|
};
|
|
@@ -28,24 +28,24 @@ export declare const TooltipTriggerBase: import('react').ForwardRefExoticCompone
|
|
|
28
28
|
asChild?: boolean;
|
|
29
29
|
} & import('react').RefAttributes<HTMLElement>>;
|
|
30
30
|
export type TooltipContentProps = ComponentPropsWithoutRef<'div'> & {
|
|
31
|
-
forceMount?: boolean;
|
|
32
|
-
container?: Element | DocumentFragment | null | undefined;
|
|
33
31
|
arrowPadding?: number;
|
|
32
|
+
container?: Element | DocumentFragment | null | undefined;
|
|
33
|
+
forceMount?: boolean;
|
|
34
34
|
variant?: 'default' | 'outline';
|
|
35
35
|
};
|
|
36
36
|
export declare const TooltipContentBase: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
37
|
-
forceMount?: boolean;
|
|
38
|
-
container?: Element | DocumentFragment | null | undefined;
|
|
39
37
|
arrowPadding?: number;
|
|
38
|
+
container?: Element | DocumentFragment | null | undefined;
|
|
39
|
+
forceMount?: boolean;
|
|
40
40
|
variant?: "default" | "outline";
|
|
41
41
|
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
42
42
|
export type TooltipArrowProps = ComponentPropsWithoutRef<'div'> & {
|
|
43
|
-
width?: number;
|
|
44
43
|
height?: number;
|
|
44
|
+
width?: number;
|
|
45
45
|
};
|
|
46
46
|
export declare const TooltipArrowBase: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
47
|
-
width?: number;
|
|
48
47
|
height?: number;
|
|
48
|
+
width?: number;
|
|
49
49
|
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
50
50
|
export {};
|
|
51
51
|
//# sourceMappingURL=TooltipBase.d.ts.map
|
|
@@ -1,54 +1,54 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../styles/main.css";
|
|
3
3
|
import { jsx as D } from "react/jsx-runtime";
|
|
4
|
-
import { createForwardedRef as N } from "../utils/
|
|
4
|
+
import { createForwardedRef as N } from "../utils/createForwardRef.js";
|
|
5
5
|
import { cn as z } from "../utils/twUtils.js";
|
|
6
6
|
import { createContext as X, forwardRef as L, useMemo as Y, useRef as E, useEffect as k, useCallback as g, useState as I, useContext as M, useId as A } from "react";
|
|
7
7
|
import { createPortal as S } from "react-dom";
|
|
8
|
-
const F = X(null), V = L(function({ children: a, delayDuration:
|
|
9
|
-
const c = Y(() => ({ delayDuration:
|
|
8
|
+
const F = X(null), V = L(function({ children: a, delayDuration: d = 700, disableHoverableContent: l = !1, skipDelayDuration: p = 300 }) {
|
|
9
|
+
const c = Y(() => ({ delayDuration: d, skipDelayDuration: p, disableHoverableContent: l }), [d, p, l]);
|
|
10
10
|
return /* @__PURE__ */ D(F.Provider, { value: c, children: a });
|
|
11
|
-
}), K = X(null), Z = ({
|
|
11
|
+
}), K = X(null), Z = ({ align: u = "center", alignOffset: a = 0, avoidCollisions: d = !0, children: l, defaultOpen: p, delayDuration: c, onOpenChange: f, open: v, side: h = "top", sideOffset: t = 0 }) => {
|
|
12
12
|
const r = M(F) ?? {
|
|
13
13
|
delayDuration: 700,
|
|
14
14
|
skipDelayDuration: 300,
|
|
15
15
|
disableHoverableContent: !1
|
|
16
|
-
},
|
|
16
|
+
}, w = {
|
|
17
17
|
...r,
|
|
18
|
-
delayDuration:
|
|
19
|
-
}, [e, o] = I(!!
|
|
18
|
+
delayDuration: c ?? r.delayDuration
|
|
19
|
+
}, [e, o] = I(!!p), i = typeof v == "boolean", m = i ? v : e, y = g(
|
|
20
20
|
(x) => {
|
|
21
|
-
i || o(x),
|
|
21
|
+
i || o(x), f?.(x);
|
|
22
22
|
},
|
|
23
|
-
[i,
|
|
23
|
+
[i, f]
|
|
24
24
|
), T = E(null), b = A(), C = Y(
|
|
25
25
|
() => ({
|
|
26
|
-
|
|
27
|
-
setOpen: v,
|
|
28
|
-
triggerRef: T,
|
|
26
|
+
arrowPadding: 4,
|
|
29
27
|
contentId: b,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
open: m,
|
|
29
|
+
options: { side: h, align: u, sideOffset: t, alignOffset: a, avoidCollisions: d },
|
|
30
|
+
provider: w,
|
|
31
|
+
setOpen: y,
|
|
32
|
+
triggerRef: T
|
|
33
33
|
}),
|
|
34
|
-
[
|
|
34
|
+
[m, y, h, u, t, a, d, w]
|
|
35
35
|
);
|
|
36
|
-
return /* @__PURE__ */ D(K.Provider, { value: C, children:
|
|
37
|
-
}, _ = L(function({ asChild: a, onPointerEnter:
|
|
38
|
-
const t = H(), { provider: r } = t,
|
|
36
|
+
return /* @__PURE__ */ D(K.Provider, { value: C, children: l });
|
|
37
|
+
}, _ = L(function({ asChild: a, onPointerEnter: d, onPointerLeave: l, onFocus: p, onBlur: c, onKeyDown: f, ...v }, h) {
|
|
38
|
+
const t = H(), { provider: r } = t, w = N(t.triggerRef, h), e = E(null), o = E(null), i = E(0), m = () => {
|
|
39
39
|
e.current && window.clearTimeout(e.current), o.current && window.clearTimeout(o.current), e.current = null, o.current = null;
|
|
40
40
|
};
|
|
41
|
-
k(() => () =>
|
|
42
|
-
const
|
|
41
|
+
k(() => () => m(), []);
|
|
42
|
+
const y = g(() => {
|
|
43
43
|
const O = Date.now() - i.current < r.skipDelayDuration ? 0 : r.delayDuration;
|
|
44
44
|
e.current = window.setTimeout(() => t.setOpen(!0), O);
|
|
45
45
|
}, [r.skipDelayDuration, r.delayDuration, t.setOpen]), T = g(() => {
|
|
46
|
-
|
|
46
|
+
m(), t.setOpen(!1), i.current = Date.now();
|
|
47
47
|
}, [t.setOpen]), b = g(
|
|
48
48
|
(s) => {
|
|
49
|
-
|
|
49
|
+
d?.(s), (s.pointerType === "mouse" || s.pointerType === "pen") && y();
|
|
50
50
|
},
|
|
51
|
-
[
|
|
51
|
+
[d, y]
|
|
52
52
|
), C = g(
|
|
53
53
|
(s) => {
|
|
54
54
|
l?.(s), (s.pointerType === "mouse" || s.pointerType === "pen") && (o.current = window.setTimeout(() => t.setOpen(!1), 0));
|
|
@@ -56,9 +56,9 @@ const F = X(null), V = L(function({ children: a, delayDuration: u = 700, skipDel
|
|
|
56
56
|
[l, t.setOpen]
|
|
57
57
|
), x = g(
|
|
58
58
|
(s) => {
|
|
59
|
-
|
|
59
|
+
p?.(s), y();
|
|
60
60
|
},
|
|
61
|
-
[
|
|
61
|
+
[p, y]
|
|
62
62
|
), B = g(
|
|
63
63
|
(s) => {
|
|
64
64
|
c?.(s), T();
|
|
@@ -70,18 +70,18 @@ const F = X(null), V = L(function({ children: a, delayDuration: u = 700, skipDel
|
|
|
70
70
|
},
|
|
71
71
|
[f, T]
|
|
72
72
|
);
|
|
73
|
-
return /* @__PURE__ */ D(a ? "span" : "button", {
|
|
74
|
-
}), tt = L(function({
|
|
75
|
-
const e = H(), [o, i] = I(null), [
|
|
73
|
+
return /* @__PURE__ */ D(a ? "span" : "button", { "aria-describedby": t.open ? t.contentId : void 0, onBlur: B, onFocus: x, onKeyDown: P, onPointerEnter: b, onPointerLeave: C, ref: w, ...v });
|
|
74
|
+
}), tt = L(function({ arrowPadding: a = 4, children: d, className: l, container: p, forceMount: c, onPointerEnter: f, onPointerLeave: v, style: h, variant: t = "default", ...r }, w) {
|
|
75
|
+
const e = H(), [o, i] = I(null), [m, y] = I(null), T = g(
|
|
76
76
|
(n) => {
|
|
77
|
-
i(n), typeof
|
|
77
|
+
i(n), typeof w == "function" ? w(n) : w && "current" in w && (w.current = n);
|
|
78
78
|
},
|
|
79
|
-
[
|
|
79
|
+
[w]
|
|
80
80
|
), b = g(() => {
|
|
81
81
|
if (!e.triggerRef.current || !o) return;
|
|
82
|
-
const n = j(e.triggerRef.current, o, { ...e.options, arrowPadding:
|
|
83
|
-
|
|
84
|
-
}, [o, e.triggerRef, e.options,
|
|
82
|
+
const n = j(e.triggerRef.current, o, { ...e.options, arrowPadding: a });
|
|
83
|
+
y(n);
|
|
84
|
+
}, [o, e.triggerRef, e.options, a]);
|
|
85
85
|
k(() => {
|
|
86
86
|
if (!e.open) return;
|
|
87
87
|
b();
|
|
@@ -98,82 +98,84 @@ const F = X(null), V = L(function({ children: a, delayDuration: u = 700, skipDel
|
|
|
98
98
|
}, [e.open, e.setOpen]);
|
|
99
99
|
const C = g(
|
|
100
100
|
(n) => {
|
|
101
|
-
|
|
101
|
+
f?.(n), e.provider.disableHoverableContent || e.setOpen(!0);
|
|
102
102
|
},
|
|
103
|
-
[
|
|
103
|
+
[f, e.provider.disableHoverableContent, e.setOpen]
|
|
104
104
|
), x = g(
|
|
105
105
|
(n) => {
|
|
106
|
-
|
|
106
|
+
v?.(n), e.provider.disableHoverableContent || e.setOpen(!1);
|
|
107
107
|
},
|
|
108
|
-
[
|
|
109
|
-
), B = e.open ||
|
|
108
|
+
[v, e.provider.disableHoverableContent, e.setOpen]
|
|
109
|
+
), B = e.open || c ? /* @__PURE__ */ D(
|
|
110
110
|
"div",
|
|
111
111
|
{
|
|
112
|
-
|
|
113
|
-
ref: T,
|
|
114
|
-
id: e.contentId,
|
|
115
|
-
role: "tooltip",
|
|
112
|
+
className: l,
|
|
116
113
|
"data-state": e.open ? "open" : "closed",
|
|
114
|
+
"data-testid": "spectral-tooltip-content",
|
|
117
115
|
"data-variant": t,
|
|
118
|
-
|
|
116
|
+
id: e.contentId,
|
|
117
|
+
onPointerEnter: C,
|
|
118
|
+
onPointerLeave: x,
|
|
119
|
+
ref: T,
|
|
120
|
+
role: "tooltip",
|
|
119
121
|
style: {
|
|
120
122
|
position: "fixed",
|
|
121
|
-
left:
|
|
122
|
-
top:
|
|
123
|
-
transformOrigin:
|
|
124
|
-
...
|
|
123
|
+
left: m?.x ?? -9999,
|
|
124
|
+
top: m?.y ?? -9999,
|
|
125
|
+
transformOrigin: m ? $(m.placing) : void 0,
|
|
126
|
+
...h
|
|
125
127
|
},
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
children: y
|
|
128
|
+
...r,
|
|
129
|
+
children: d
|
|
129
130
|
}
|
|
130
|
-
) : null, P = typeof document < "u" ?
|
|
131
|
+
) : null, P = typeof document < "u" ? p ?? document.body : null;
|
|
131
132
|
return P ? S(B, P) : null;
|
|
132
|
-
}), et = L(function({ width: a = 16, height:
|
|
133
|
-
const
|
|
133
|
+
}), et = L(function({ width: a = 16, height: d = 16, className: l, style: p, ...c }, f) {
|
|
134
|
+
const v = H();
|
|
134
135
|
return /* @__PURE__ */ D(
|
|
135
136
|
"div",
|
|
136
137
|
{
|
|
137
|
-
...c,
|
|
138
|
-
ref: f,
|
|
139
138
|
"aria-hidden": !0,
|
|
140
139
|
className: z("pointer-events-none", l),
|
|
140
|
+
"data-arrow": !0,
|
|
141
|
+
"data-testid": "spectral-tooltip-arrow",
|
|
142
|
+
"data-side": v.options.side,
|
|
143
|
+
ref: f,
|
|
141
144
|
style: {
|
|
142
145
|
width: a,
|
|
143
|
-
height:
|
|
144
|
-
...
|
|
146
|
+
height: d,
|
|
147
|
+
...p
|
|
145
148
|
},
|
|
146
|
-
|
|
147
|
-
"data-side": y.options.side
|
|
149
|
+
...c
|
|
148
150
|
}
|
|
149
151
|
);
|
|
150
152
|
});
|
|
151
153
|
function H() {
|
|
152
|
-
const
|
|
153
|
-
if (!
|
|
154
|
-
return
|
|
154
|
+
const u = M(K);
|
|
155
|
+
if (!u) throw new Error("Tooltip components must be used within <Tooltip>");
|
|
156
|
+
return u;
|
|
155
157
|
}
|
|
156
158
|
const U = {
|
|
157
|
-
top: "bottom center",
|
|
158
159
|
bottom: "top center",
|
|
159
160
|
left: "center right",
|
|
160
|
-
right: "center left"
|
|
161
|
+
right: "center left",
|
|
162
|
+
top: "bottom center"
|
|
161
163
|
};
|
|
162
|
-
function $(
|
|
163
|
-
return U[
|
|
164
|
+
function $(u) {
|
|
165
|
+
return U[u];
|
|
164
166
|
}
|
|
165
|
-
function R(
|
|
166
|
-
return Math.max(a, Math.min(
|
|
167
|
+
function R(u, a, d) {
|
|
168
|
+
return Math.max(a, Math.min(d, u));
|
|
167
169
|
}
|
|
168
|
-
function j(
|
|
169
|
-
const { side: l, align:
|
|
170
|
+
function j(u, a, d) {
|
|
171
|
+
const { side: l, align: p, sideOffset: c, alignOffset: f, avoidCollisions: v, arrowPadding: h } = d, t = u.getBoundingClientRect(), r = a.getBoundingClientRect(), w = window.innerWidth, e = window.innerHeight;
|
|
170
172
|
let o = 0, i = 0;
|
|
171
|
-
const
|
|
173
|
+
const m = t.left + t.width / 2 - r.width / 2, y = t.left, T = t.right - r.width, b = t.top + t.height / 2 - r.height / 2, C = t.top, x = t.bottom - r.height, B = p === "start" ? y : p === "end" ? T : m, P = p === "start" ? C : p === "end" ? x : b;
|
|
172
174
|
l === "top" ? (o = B + f, i = t.top - r.height - c) : l === "bottom" ? (o = B + f, i = t.bottom + c) : l === "left" ? (o = t.left - r.width - c, i = P + f) : (o = t.right + c, i = P + f);
|
|
173
175
|
let n = l;
|
|
174
|
-
|
|
176
|
+
v && (l === "top" && i < 0 ? (n = "bottom", i = t.bottom + c) : l === "bottom" && i + r.height > e ? (n = "top", i = t.top - r.height - c) : l === "left" && o < 0 ? (n = "right", o = t.right + c) : l === "right" && o + r.width > w && (n = "left", o = t.left - r.width - c));
|
|
175
177
|
let s = t.left + t.width / 2, O = t.top + t.height / 2;
|
|
176
|
-
return n === "top" && (O = i + r.height, s = R(t.left + t.width / 2, o +
|
|
178
|
+
return n === "top" && (O = i + r.height, s = R(t.left + t.width / 2, o + h, o + r.width - h)), n === "bottom" && (O = i, s = R(t.left + t.width / 2, o + h, o + r.width - h)), n === "left" && (s = o + r.width, O = R(t.top + t.height / 2, i + h, i + r.height - h)), n === "right" && (s = o, O = R(t.top + t.height / 2, i + h, i + r.height - h)), a.style.setProperty("--arrow-x", `${s - o}px`), a.style.setProperty("--arrow-y", `${O - i}px`), a.dataset.side = n, { x: o, y: i, placing: n, arrowX: s, arrowY: O };
|
|
177
179
|
}
|
|
178
180
|
export {
|
|
179
181
|
et as TooltipArrowBase,
|
package/dist/Tooltip.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
|
3
3
|
export declare const TooltipProvider: ({ delayDuration, ...props }: ComponentProps<typeof TooltipPrimitive.Provider>) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export declare const Tooltip: ({ ...props }: ComponentProps<typeof TooltipPrimitive.Root>) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
export declare const TooltipTrigger: ({ ...props }: ComponentProps<typeof TooltipPrimitive.Trigger>) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
export declare const TooltipContent: ({ className,
|
|
6
|
+
export declare const TooltipContent: ({ children, className, showArrow, sideOffset, ...props }: ComponentProps<typeof TooltipPrimitive.Content> & {
|
|
7
7
|
showArrow?: boolean;
|
|
8
8
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
//# sourceMappingURL=Tooltip.d.ts.map
|
package/dist/Tooltip.js
CHANGED
|
@@ -319,29 +319,30 @@ function be(e) {
|
|
|
319
319
|
return t.pop(), o.length === 1 && t.length === 1 && o[0].x === t[0].x && o[0].y === t[0].y ? o : o.concat(t);
|
|
320
320
|
}
|
|
321
321
|
var we = z, Pe = $, Ee = B, Re = U, _e = V, Oe = X;
|
|
322
|
-
const De = ({ delayDuration: e = 0, ...o }) => /* @__PURE__ */ u(we, { "data-slot": "tooltip-provider", delayDuration: e, ...o }), Ge = ({ ...e }) => /* @__PURE__ */ u(De, { children: /* @__PURE__ */ u(Pe, { "data-slot": "tooltip", ...e }) }), je = ({ ...e }) => /* @__PURE__ */ u(Ee, { "data-slot": "tooltip-trigger", ...e }), Fe = ({
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
322
|
+
const De = ({ delayDuration: e = 0, ...o }) => /* @__PURE__ */ u(we, { "data-slot": "tooltip-provider", delayDuration: e, ...o }), Ge = ({ ...e }) => /* @__PURE__ */ u(De, { children: /* @__PURE__ */ u(Pe, { "data-slot": "tooltip", "data-testid": "spectral-tooltip", ...e }) }), je = ({ ...e }) => /* @__PURE__ */ u(Ee, { "data-slot": "tooltip-trigger", "data-testid": "spectral-tooltip-trigger", ...e }), Fe = ({
|
|
323
|
+
children: e,
|
|
324
|
+
className: o,
|
|
325
|
+
showArrow: t = !1,
|
|
326
|
+
sideOffset: r = 0,
|
|
327
327
|
...n
|
|
328
|
-
}) => /* @__PURE__ */ u(Re, { children: /* @__PURE__ */ H(
|
|
328
|
+
}) => /* @__PURE__ */ u(Re, { "data-slot": "tooltip-portal", "data-testid": "spectral-tooltip-portal", children: /* @__PURE__ */ H(
|
|
329
329
|
_e,
|
|
330
330
|
{
|
|
331
|
-
"data-slot": "tooltip-content",
|
|
332
|
-
sideOffset: t,
|
|
333
331
|
className: ie(
|
|
334
332
|
"bg-tooltip-bg text-text-primary pointer-events-auto z-50 w-fit rounded-md px-3 py-1.5 text-xs shadow-lg will-change-transform outline-none select-none",
|
|
335
333
|
"data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
|
|
336
334
|
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
337
335
|
"data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2",
|
|
338
336
|
"data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
339
|
-
|
|
337
|
+
o
|
|
340
338
|
),
|
|
339
|
+
"data-slot": "tooltip-content",
|
|
340
|
+
"data-testid": "spectral-tooltip-content",
|
|
341
|
+
sideOffset: r,
|
|
341
342
|
...n,
|
|
342
343
|
children: [
|
|
343
|
-
|
|
344
|
-
|
|
344
|
+
e,
|
|
345
|
+
t && /* @__PURE__ */ u(Oe, { className: "bg-tooltip-arrow fill-tooltip-arrow z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })
|
|
345
346
|
]
|
|
346
347
|
}
|
|
347
348
|
) });
|
package/dist/Tray.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
2
2
|
import { ComponentPropsWithoutRef, ForwardRefExoticComponent, ReactNode, RefAttributes } from 'react';
|
|
3
3
|
import { Drawer as TrayBase } from 'vaul';
|
|
4
4
|
declare const TrayContentVariants: (props?: ({
|
|
5
|
-
size?: "sm" | "
|
|
5
|
+
size?: "sm" | "md" | "lg" | "full" | null | undefined;
|
|
6
6
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
7
|
export type TrayBaseProps = ComponentPropsWithoutRef<typeof TrayBase.Root> & {
|
|
8
8
|
size?: 'sm' | 'md' | 'lg' | 'full';
|