@dust-tt/sparkle 0.2.254 → 0.2.255
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/cjs/index.js +3872 -449
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/BarHeader.js +3 -3
- package/dist/esm/components/BarHeader.js.map +1 -1
- package/dist/esm/components/Breadcrumbs.js +1 -1
- package/dist/esm/components/Breadcrumbs.js.map +1 -1
- package/dist/esm/components/Button.d.ts +5 -3
- package/dist/esm/components/Button.d.ts.map +1 -1
- package/dist/esm/components/Button.js +11 -3
- package/dist/esm/components/Button.js.map +1 -1
- package/dist/esm/components/Citation.d.ts.map +1 -1
- package/dist/esm/components/Citation.js +1 -1
- package/dist/esm/components/Citation.js.map +1 -1
- package/dist/esm/components/DataTable.d.ts.map +1 -1
- package/dist/esm/components/DataTable.js +1 -2
- package/dist/esm/components/DataTable.js.map +1 -1
- package/dist/esm/components/Dialog.d.ts +2 -1
- package/dist/esm/components/Dialog.d.ts.map +1 -1
- package/dist/esm/components/Dialog.js.map +1 -1
- package/dist/esm/components/DropdownMenu.d.ts +2 -2
- package/dist/esm/components/DropdownMenu.d.ts.map +1 -1
- package/dist/esm/components/DropdownMenu.js +8 -5
- package/dist/esm/components/DropdownMenu.js.map +1 -1
- package/dist/esm/components/ElementDialog.d.ts +1 -1
- package/dist/esm/components/ElementDialog.d.ts.map +1 -1
- package/dist/esm/components/ElementDialog.js +2 -2
- package/dist/esm/components/ElementDialog.js.map +1 -1
- package/dist/esm/components/IconButton.d.ts +2 -2
- package/dist/esm/components/IconButton.d.ts.map +1 -1
- package/dist/esm/components/IconButton.js +2 -2
- package/dist/esm/components/IconButton.js.map +1 -1
- package/dist/esm/components/IconToggleButton.d.ts +2 -2
- package/dist/esm/components/IconToggleButton.d.ts.map +1 -1
- package/dist/esm/components/IconToggleButton.js +2 -2
- package/dist/esm/components/IconToggleButton.js.map +1 -1
- package/dist/esm/components/Input.js.map +1 -1
- package/dist/esm/components/Searchbar.d.ts.map +1 -1
- package/dist/esm/components/Searchbar.js.map +1 -1
- package/dist/esm/components/Tab.js +1 -1
- package/dist/esm/components/Tab.js.map +1 -1
- package/dist/esm/components/Tooltip.d.ts +13 -7
- package/dist/esm/components/Tooltip.d.ts.map +1 -1
- package/dist/esm/components/Tooltip.js +18 -42
- package/dist/esm/components/Tooltip.js.map +1 -1
- package/dist/esm/components/index.d.ts +1 -1
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/stories/Button.stories.d.ts +2 -0
- package/dist/esm/stories/Button.stories.d.ts.map +1 -1
- package/dist/esm/stories/Button.stories.js +14 -3
- package/dist/esm/stories/Button.stories.js.map +1 -1
- package/dist/esm/stories/Citation.stories.js +1 -1
- package/dist/esm/stories/Citation.stories.js.map +1 -1
- package/dist/esm/stories/DataTable.stories.d.ts.map +1 -1
- package/dist/esm/stories/DataTable.stories.js.map +1 -1
- package/dist/esm/stories/Dialog.stories.d.ts.map +1 -1
- package/dist/esm/stories/Dialog.stories.js +1 -1
- package/dist/esm/stories/Dialog.stories.js.map +1 -1
- package/dist/esm/stories/DropdownMenu.stories.d.ts.map +1 -1
- package/dist/esm/stories/DropdownMenu.stories.js +2 -2
- package/dist/esm/stories/DropdownMenu.stories.js.map +1 -1
- package/dist/esm/stories/IconButton.stories.js +3 -3
- package/dist/esm/stories/IconButton.stories.js.map +1 -1
- package/dist/esm/stories/TextArea.stories.d.ts.map +1 -1
- package/dist/esm/stories/TextArea.stories.js +18 -3
- package/dist/esm/stories/TextArea.stories.js.map +1 -1
- package/dist/esm/stories/Tooltip.stories.d.ts +3 -8
- package/dist/esm/stories/Tooltip.stories.d.ts.map +1 -1
- package/dist/esm/stories/Tooltip.stories.js +10 -23
- package/dist/esm/stories/Tooltip.stories.js.map +1 -1
- package/dist/esm/stories/Tree.stories.js.map +1 -1
- package/dist/sparkle.css +0 -68
- package/package.json +3 -1
- package/src/components/BarHeader.tsx +0 -3
- package/src/components/Breadcrumbs.tsx +2 -2
- package/src/components/Button.tsx +16 -14
- package/src/components/Citation.tsx +1 -7
- package/src/components/DataTable.tsx +11 -8
- package/src/components/Dialog.tsx +4 -4
- package/src/components/DropdownMenu.tsx +41 -31
- package/src/components/ElementDialog.tsx +4 -1
- package/src/components/IconButton.tsx +8 -6
- package/src/components/IconToggleButton.tsx +8 -6
- package/src/components/Input.tsx +1 -1
- package/src/components/Searchbar.tsx +2 -4
- package/src/components/Tab.tsx +1 -1
- package/src/components/Tooltip.tsx +48 -78
- package/src/components/index.ts +7 -1
- package/src/stories/Button.stories.tsx +47 -3
- package/src/stories/Citation.stories.tsx +1 -1
- package/src/stories/DataTable.stories.tsx +3 -1
- package/src/stories/Dialog.stories.tsx +1 -0
- package/src/stories/DropdownMenu.stories.tsx +6 -3
- package/src/stories/IconButton.stories.tsx +3 -3
- package/src/stories/TextArea.stories.tsx +19 -4
- package/src/stories/Tooltip.stories.tsx +31 -50
- package/src/stories/Tree.stories.tsx +1 -1
|
@@ -22,7 +22,7 @@ import { classNames } from "@sparkle/lib/utils";
|
|
|
22
22
|
|
|
23
23
|
import { Icon } from "./Icon";
|
|
24
24
|
import { Item as StandardItem, LinkProps } from "./Item";
|
|
25
|
-
import { Tooltip
|
|
25
|
+
import { Tooltip } from "./Tooltip";
|
|
26
26
|
|
|
27
27
|
const ButtonRefContext =
|
|
28
28
|
React.createContext<MutableRefObject<HTMLButtonElement | null> | null>(null);
|
|
@@ -98,7 +98,7 @@ export interface DropdownButtonProps {
|
|
|
98
98
|
type?: "menu" | "submenu" | "select";
|
|
99
99
|
size?: "sm" | "md";
|
|
100
100
|
tooltip?: string;
|
|
101
|
-
tooltipPosition?:
|
|
101
|
+
tooltipPosition?: React.ComponentProps<typeof Tooltip>["side"];
|
|
102
102
|
icon?: ComponentType;
|
|
103
103
|
className?: string;
|
|
104
104
|
disabled?: boolean;
|
|
@@ -116,7 +116,7 @@ DropdownMenu.Button = forwardRef<HTMLButtonElement, DropdownButtonProps>(
|
|
|
116
116
|
tooltip,
|
|
117
117
|
icon,
|
|
118
118
|
children,
|
|
119
|
-
tooltipPosition = "
|
|
119
|
+
tooltipPosition = "top",
|
|
120
120
|
className = "",
|
|
121
121
|
disabled = false,
|
|
122
122
|
onClick,
|
|
@@ -178,9 +178,11 @@ DropdownMenu.Button = forwardRef<HTMLButtonElement, DropdownButtonProps>(
|
|
|
178
178
|
onClick={(e) => e.stopPropagation()}
|
|
179
179
|
>
|
|
180
180
|
{tooltip ? (
|
|
181
|
-
<Tooltip
|
|
182
|
-
{children}
|
|
183
|
-
|
|
181
|
+
<Tooltip
|
|
182
|
+
trigger={children}
|
|
183
|
+
label={tooltip}
|
|
184
|
+
side={tooltipPosition}
|
|
185
|
+
/>
|
|
184
186
|
) : (
|
|
185
187
|
children
|
|
186
188
|
)}
|
|
@@ -198,31 +200,39 @@ DropdownMenu.Button = forwardRef<HTMLButtonElement, DropdownButtonProps>(
|
|
|
198
200
|
return (
|
|
199
201
|
<>
|
|
200
202
|
{tooltip ? (
|
|
201
|
-
<Tooltip
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
203
|
+
<Tooltip
|
|
204
|
+
trigger={
|
|
205
|
+
<Menu.Button
|
|
206
|
+
disabled={disabled}
|
|
207
|
+
ref={aggregatedRef}
|
|
208
|
+
className={classNames(
|
|
209
|
+
disabled ? "s-cursor-default" : "s-cursor-pointer",
|
|
210
|
+
className,
|
|
211
|
+
"s-group/dm s-flex s-justify-items-center s-text-sm s-font-medium focus:s-outline-none focus:s-ring-0",
|
|
212
|
+
label
|
|
213
|
+
? size === "md"
|
|
214
|
+
? "s-gap-2"
|
|
215
|
+
: "s-gap-1.5"
|
|
216
|
+
: "s-gap-0.5"
|
|
217
|
+
)}
|
|
218
|
+
onClick={(e) => {
|
|
219
|
+
e.stopPropagation();
|
|
220
|
+
if (onClick) {
|
|
221
|
+
onClick();
|
|
222
|
+
}
|
|
223
|
+
}}
|
|
224
|
+
>
|
|
225
|
+
<Icon visual={icon} size={size} className={finalIconClasses} />
|
|
226
|
+
<Icon
|
|
227
|
+
visual={chevronIcon}
|
|
228
|
+
size={size === "sm" ? "xs" : "sm"}
|
|
229
|
+
className={finalChevronClasses}
|
|
230
|
+
/>
|
|
231
|
+
</Menu.Button>
|
|
232
|
+
}
|
|
233
|
+
label={tooltip}
|
|
234
|
+
side={tooltipPosition}
|
|
235
|
+
/>
|
|
226
236
|
) : (
|
|
227
237
|
<Menu.Button
|
|
228
238
|
disabled={disabled}
|
|
@@ -17,6 +17,7 @@ export function ElementDialog<T>({
|
|
|
17
17
|
closeDialogFn,
|
|
18
18
|
onValidate,
|
|
19
19
|
onCancel,
|
|
20
|
+
children,
|
|
20
21
|
...props
|
|
21
22
|
}: ElementDialogProps<T>) {
|
|
22
23
|
const [isClosingTransition, setIsClosingTransition] = useState(false);
|
|
@@ -33,6 +34,8 @@ export function ElementDialog<T>({
|
|
|
33
34
|
onCancel={() => onCancel(transitionOnClose)}
|
|
34
35
|
onValidate={() => onValidate(transitionOnClose)}
|
|
35
36
|
{...props}
|
|
36
|
-
|
|
37
|
+
>
|
|
38
|
+
{children}
|
|
39
|
+
</Dialog>
|
|
37
40
|
);
|
|
38
41
|
}
|
|
@@ -3,14 +3,14 @@ import React, { ComponentType, MouseEventHandler } from "react";
|
|
|
3
3
|
import { classNames } from "@sparkle/lib/utils";
|
|
4
4
|
|
|
5
5
|
import { Icon, IconProps } from "./Icon";
|
|
6
|
-
import { Tooltip
|
|
6
|
+
import { Tooltip } from "./Tooltip";
|
|
7
7
|
|
|
8
8
|
type IconButtonProps = {
|
|
9
9
|
variant?: "primary" | "warning" | "secondary" | "tertiary" | "white";
|
|
10
10
|
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
11
11
|
size?: "xs" | "sm" | "md";
|
|
12
12
|
tooltip?: string;
|
|
13
|
-
tooltipPosition?:
|
|
13
|
+
tooltipPosition?: React.ComponentProps<typeof Tooltip>["side"];
|
|
14
14
|
icon?: ComponentType;
|
|
15
15
|
className?: string;
|
|
16
16
|
disabled?: boolean;
|
|
@@ -87,7 +87,7 @@ export function IconButton({
|
|
|
87
87
|
onClick,
|
|
88
88
|
disabled = false,
|
|
89
89
|
tooltip,
|
|
90
|
-
tooltipPosition = "
|
|
90
|
+
tooltipPosition = "top",
|
|
91
91
|
icon,
|
|
92
92
|
className = "",
|
|
93
93
|
size = "sm",
|
|
@@ -117,9 +117,11 @@ export function IconButton({
|
|
|
117
117
|
);
|
|
118
118
|
|
|
119
119
|
return tooltip ? (
|
|
120
|
-
<Tooltip
|
|
121
|
-
{IconButtonContent}
|
|
122
|
-
|
|
120
|
+
<Tooltip
|
|
121
|
+
trigger={IconButtonContent}
|
|
122
|
+
label={tooltip}
|
|
123
|
+
side={tooltipPosition}
|
|
124
|
+
/>
|
|
123
125
|
) : (
|
|
124
126
|
IconButtonContent
|
|
125
127
|
);
|
|
@@ -3,14 +3,14 @@ import React, { ComponentType, MouseEventHandler } from "react";
|
|
|
3
3
|
import { classNames } from "@sparkle/lib/utils";
|
|
4
4
|
|
|
5
5
|
import { Icon, IconProps } from "./Icon";
|
|
6
|
-
import { Tooltip
|
|
6
|
+
import { Tooltip } from "./Tooltip";
|
|
7
7
|
|
|
8
8
|
type IconToggleButtonProps = {
|
|
9
9
|
variant?: "secondary" | "tertiary";
|
|
10
10
|
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
11
11
|
size?: "xs" | "sm" | "md";
|
|
12
12
|
tooltip?: string;
|
|
13
|
-
tooltipPosition?:
|
|
13
|
+
tooltipPosition?: React.ComponentProps<typeof Tooltip>["side"];
|
|
14
14
|
icon: ComponentType;
|
|
15
15
|
iconSelected?: ComponentType;
|
|
16
16
|
className?: string;
|
|
@@ -57,7 +57,7 @@ export function IconToggleButton({
|
|
|
57
57
|
onClick,
|
|
58
58
|
disabled = false,
|
|
59
59
|
tooltip,
|
|
60
|
-
tooltipPosition = "
|
|
60
|
+
tooltipPosition = "top",
|
|
61
61
|
icon,
|
|
62
62
|
iconSelected,
|
|
63
63
|
className = "",
|
|
@@ -105,9 +105,11 @@ export function IconToggleButton({
|
|
|
105
105
|
);
|
|
106
106
|
|
|
107
107
|
return tooltip ? (
|
|
108
|
-
<Tooltip
|
|
109
|
-
{IconButtonToggleContent}
|
|
110
|
-
|
|
108
|
+
<Tooltip
|
|
109
|
+
trigger={IconButtonToggleContent}
|
|
110
|
+
label={tooltip}
|
|
111
|
+
side={tooltipPosition}
|
|
112
|
+
/>
|
|
111
113
|
) : (
|
|
112
114
|
IconButtonToggleContent
|
|
113
115
|
);
|
package/src/components/Input.tsx
CHANGED
|
@@ -26,11 +26,9 @@ type SearchbarProps = {
|
|
|
26
26
|
size?: "xs" | "sm" | "md";
|
|
27
27
|
disabled?: boolean;
|
|
28
28
|
className?: string;
|
|
29
|
-
}
|
|
29
|
+
};
|
|
30
30
|
|
|
31
|
-
export const Searchbar = forwardRef<
|
|
32
|
-
HTMLInputElement, SearchbarProps
|
|
33
|
-
>(
|
|
31
|
+
export const Searchbar = forwardRef<HTMLInputElement, SearchbarProps>(
|
|
34
32
|
(
|
|
35
33
|
{
|
|
36
34
|
placeholder,
|
package/src/components/Tab.tsx
CHANGED
|
@@ -199,7 +199,7 @@ export function Tab<E>({
|
|
|
199
199
|
tab.label ? (
|
|
200
200
|
<React.Fragment key={`tab-${i}`}>
|
|
201
201
|
<div className={tabSizingClasses[tab.sizing ?? "hug"]}>
|
|
202
|
-
<Tooltip label={tab.label}
|
|
202
|
+
<Tooltip trigger={content} label={tab.label} />
|
|
203
203
|
</div>
|
|
204
204
|
{tab.hasSeparator && (
|
|
205
205
|
<div className="s-flex s-h-full s-grow" key={`sep-${i}`} />
|
|
@@ -1,86 +1,56 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
2
|
+
import * as React from "react";
|
|
2
3
|
|
|
3
4
|
import { classNames } from "@sparkle/lib/utils";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const TooltipProvider = TooltipPrimitive.Provider;
|
|
7
|
+
|
|
8
|
+
const TooltipRoot = TooltipPrimitive.Root;
|
|
9
|
+
|
|
10
|
+
const TooltipTrigger = TooltipPrimitive.Trigger;
|
|
11
|
+
|
|
12
|
+
interface TooltipContentProps
|
|
13
|
+
extends React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> {}
|
|
14
|
+
|
|
15
|
+
const TooltipContent = React.forwardRef<
|
|
16
|
+
React.ElementRef<typeof TooltipPrimitive.Content>,
|
|
17
|
+
TooltipContentProps
|
|
18
|
+
>(({ className, sideOffset = 4, ...props }, ref) => (
|
|
19
|
+
<TooltipPrimitive.Content
|
|
20
|
+
ref={ref}
|
|
21
|
+
sideOffset={sideOffset}
|
|
22
|
+
className={classNames(
|
|
23
|
+
"s-bg-primary-50 s-text-primary-700 s-z-50 s-max-w-xs s-overflow-hidden s-rounded-md s-border s-bg-white s-px-3 s-py-1.5 s-text-sm s-shadow-md",
|
|
24
|
+
"s-animate-in s-fade-in-0 s-zoom-in-95",
|
|
25
|
+
"data-[state=closed]:s-animate-out data-[state=closed]:s-fade-out-0 data-[state=closed]:s-zoom-out-95 data-[side=bottom]:s-slide-in-from-top-2 data-[side=left]:s-slide-in-from-right-2 data-[side=right]:s-slide-in-from-left-2 data-[side=top]:s-slide-in-from-bottom-2",
|
|
26
|
+
className || ""
|
|
27
|
+
)}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
));
|
|
31
|
+
|
|
32
|
+
interface TooltipProps extends TooltipContentProps {
|
|
33
|
+
trigger: React.ReactNode;
|
|
34
|
+
label: React.ReactNode;
|
|
10
35
|
}
|
|
11
36
|
|
|
12
|
-
|
|
13
|
-
children,
|
|
14
|
-
label,
|
|
15
|
-
position = "above",
|
|
16
|
-
contentChildren,
|
|
17
|
-
}: TooltipProps) {
|
|
18
|
-
const [isHovered, setIsHovered] = useState(false);
|
|
19
|
-
const [timerId, setTimerId] = useState<number | null>(null);
|
|
20
|
-
const [isTouchDevice, setIsTouchDevice] = useState(false);
|
|
21
|
-
|
|
22
|
-
const handleMouseOver = () => {
|
|
23
|
-
const id = window.setTimeout(() => {
|
|
24
|
-
setIsHovered(true);
|
|
25
|
-
}, 600);
|
|
26
|
-
setTimerId(id);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const handleMouseLeave = () => {
|
|
30
|
-
if (timerId !== null) {
|
|
31
|
-
clearTimeout(timerId);
|
|
32
|
-
}
|
|
33
|
-
setIsHovered(false);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
38
|
-
return () => {
|
|
39
|
-
if (timerId) {
|
|
40
|
-
window.clearTimeout(timerId);
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
}, [timerId]);
|
|
44
|
-
|
|
45
|
-
if (isTouchDevice) {
|
|
46
|
-
return <>{children}</>;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const baseClasses = classNames(
|
|
50
|
-
"s-absolute s-z-10 s-px-3 s-py-2 s-text-sm s-rounded-xl s-border s-shadow-md s-transition-all s-duration-500 s-ease-out s-transform",
|
|
51
|
-
"s-border-structure-100 dark:s-border-structure-50-dark s-bg-structure-0 dark:s-bg-structure-100-dark s-text-element-700 dark:s-text-element-600-dark"
|
|
52
|
-
);
|
|
53
|
-
const hiddenClasses = "s-translate-y-2 s-opacity-0 s-pointer-events-none"; // Added s-pointer-events-none
|
|
54
|
-
const visibleClasses = "-s-translate-y-0 s-opacity-100";
|
|
55
|
-
const hiddenOnMobileClasses = "s-hidden sm:s-block";
|
|
56
|
-
const tooltipCenterClasses = "s-left-1/2 -s-translate-x-1/2";
|
|
57
|
-
const tooltipPositionClasses =
|
|
58
|
-
position === "above" ? "s-bottom-full s-mb-2" : "s-top-full s-mt-2";
|
|
59
|
-
|
|
60
|
-
// if tooltip text is too long we need to wrap it
|
|
61
|
-
const labelLength = label?.length || 0;
|
|
62
|
-
const labelClasses = labelLength > 80 ? "s-w-[38em]" : "s-whitespace-nowrap";
|
|
63
|
-
|
|
37
|
+
function Tooltip({ trigger, label, ...props }: TooltipProps) {
|
|
64
38
|
return (
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
<div
|
|
72
|
-
className={classNames(
|
|
73
|
-
`${isHovered ? visibleClasses : hiddenClasses}`,
|
|
74
|
-
baseClasses,
|
|
75
|
-
hiddenOnMobileClasses,
|
|
76
|
-
tooltipPositionClasses,
|
|
77
|
-
tooltipCenterClasses,
|
|
78
|
-
contentChildren ? "" : labelClasses
|
|
79
|
-
)}
|
|
80
|
-
onAnimationEnd={() => setIsHovered(false)}
|
|
81
|
-
>
|
|
82
|
-
{contentChildren || label}
|
|
83
|
-
</div>
|
|
84
|
-
</div>
|
|
39
|
+
<TooltipProvider>
|
|
40
|
+
<TooltipRoot>
|
|
41
|
+
<TooltipTrigger>{trigger}</TooltipTrigger>
|
|
42
|
+
<TooltipContent {...props}>{label}</TooltipContent>
|
|
43
|
+
</TooltipRoot>
|
|
44
|
+
</TooltipProvider>
|
|
85
45
|
);
|
|
86
46
|
}
|
|
47
|
+
|
|
48
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
49
|
+
|
|
50
|
+
export {
|
|
51
|
+
Tooltip,
|
|
52
|
+
TooltipContent,
|
|
53
|
+
TooltipProvider,
|
|
54
|
+
TooltipRoot,
|
|
55
|
+
TooltipTrigger,
|
|
56
|
+
};
|
package/src/components/index.ts
CHANGED
|
@@ -43,6 +43,12 @@ export { SliderToggle } from "./SliderToggle";
|
|
|
43
43
|
export { default as Spinner } from "./Spinner";
|
|
44
44
|
export { Tab } from "./Tab";
|
|
45
45
|
export { TextArea } from "./TextArea";
|
|
46
|
-
export {
|
|
46
|
+
export {
|
|
47
|
+
Tooltip,
|
|
48
|
+
TooltipContent,
|
|
49
|
+
TooltipProvider,
|
|
50
|
+
TooltipRoot,
|
|
51
|
+
TooltipTrigger,
|
|
52
|
+
} from "./Tooltip";
|
|
47
53
|
export { Tree } from "./Tree";
|
|
48
54
|
export { ZoomableImageCitationWrapper } from "./ZoomableImageCitationWrapper";
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
2
|
import React from "react";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
Button,
|
|
6
|
+
Cog6ToothIcon,
|
|
7
|
+
Tooltip,
|
|
8
|
+
TooltipContent,
|
|
9
|
+
TooltipProvider,
|
|
10
|
+
TooltipRoot,
|
|
11
|
+
TooltipTrigger,
|
|
12
|
+
} from "../index_with_tw_base";
|
|
5
13
|
|
|
6
14
|
const meta = {
|
|
7
15
|
title: "Primitives/Button",
|
|
@@ -564,6 +572,42 @@ export const ButtonSelectExamples = () => (
|
|
|
564
572
|
</div>
|
|
565
573
|
);
|
|
566
574
|
|
|
575
|
+
export const ButtonWithTooltipManualInstantiation = () => {
|
|
576
|
+
return (
|
|
577
|
+
<TooltipProvider>
|
|
578
|
+
<TooltipRoot>
|
|
579
|
+
<TooltipTrigger>
|
|
580
|
+
<Button
|
|
581
|
+
labelVisible={true}
|
|
582
|
+
label="New conversation"
|
|
583
|
+
icon={Cog6ToothIcon}
|
|
584
|
+
hasMagnifying={false}
|
|
585
|
+
/>
|
|
586
|
+
</TooltipTrigger>
|
|
587
|
+
<TooltipContent>
|
|
588
|
+
<p>Hello</p>
|
|
589
|
+
</TooltipContent>
|
|
590
|
+
</TooltipRoot>
|
|
591
|
+
</TooltipProvider>
|
|
592
|
+
);
|
|
593
|
+
};
|
|
594
|
+
|
|
595
|
+
export const ButtonWithTooltip = () => {
|
|
596
|
+
return (
|
|
597
|
+
<Tooltip
|
|
598
|
+
trigger={
|
|
599
|
+
<Button
|
|
600
|
+
labelVisible={true}
|
|
601
|
+
label="New conversation"
|
|
602
|
+
icon={Cog6ToothIcon}
|
|
603
|
+
hasMagnifying={false}
|
|
604
|
+
/>
|
|
605
|
+
}
|
|
606
|
+
label={"Hello"}
|
|
607
|
+
/>
|
|
608
|
+
);
|
|
609
|
+
};
|
|
610
|
+
|
|
567
611
|
export const Primary: Story = {
|
|
568
612
|
args: {
|
|
569
613
|
variant: "primary",
|
|
@@ -622,7 +666,7 @@ export const IconOnlyPlusTooltip: Story = {
|
|
|
622
666
|
labelVisible: false,
|
|
623
667
|
icon: Cog6ToothIcon,
|
|
624
668
|
disabled: false,
|
|
625
|
-
tooltipPosition: "
|
|
669
|
+
tooltipPosition: "bottom",
|
|
626
670
|
},
|
|
627
671
|
};
|
|
628
672
|
|
|
@@ -634,7 +678,7 @@ export const IconOnlyNoTooltip: Story = {
|
|
|
634
678
|
labelVisible: false,
|
|
635
679
|
icon: Cog6ToothIcon,
|
|
636
680
|
disabled: false,
|
|
637
|
-
tooltipPosition: "
|
|
681
|
+
tooltipPosition: "bottom",
|
|
638
682
|
disabledTooltip: true,
|
|
639
683
|
},
|
|
640
684
|
};
|
|
@@ -133,7 +133,7 @@ export const CitationsExample = () => (
|
|
|
133
133
|
type="google_drive"
|
|
134
134
|
index="3"
|
|
135
135
|
href="https://www.google.com"
|
|
136
|
-
description="Write a 120 character description of the citation here to be displayed in the citation list."
|
|
136
|
+
description="Write a 120 character description of the citation here to be displayed in the citation list. Write a 120 character description of the citation here to be displayed in the citation list. Write a 120 character description of the citation here to be displayed in the citation list."
|
|
137
137
|
isBlinking={true}
|
|
138
138
|
/>
|
|
139
139
|
<Citation
|
|
@@ -161,7 +161,9 @@ const columns: ColumnDef<Data>[] = [
|
|
|
161
161
|
width: "100px",
|
|
162
162
|
},
|
|
163
163
|
cell: (info) => (
|
|
164
|
-
<DataTable.CellContentWithCopy>
|
|
164
|
+
<DataTable.CellContentWithCopy>
|
|
165
|
+
{info.row.original.addedBy}
|
|
166
|
+
</DataTable.CellContentWithCopy>
|
|
165
167
|
),
|
|
166
168
|
},
|
|
167
169
|
{
|
|
@@ -48,7 +48,10 @@ export const DropdownExample = () => {
|
|
|
48
48
|
<div className="s-flex s-gap-6">
|
|
49
49
|
<div className="s-text-sm">Action</div>
|
|
50
50
|
<DropdownMenu>
|
|
51
|
-
<DropdownMenu.Button
|
|
51
|
+
<DropdownMenu.Button
|
|
52
|
+
label="Action"
|
|
53
|
+
onClick={() => console.log("CLICK")}
|
|
54
|
+
/>
|
|
52
55
|
<DropdownMenu.Items width={220}>
|
|
53
56
|
<DropdownMenu.SectionHeader label="Edition" />
|
|
54
57
|
<DropdownMenu.Item
|
|
@@ -311,7 +314,7 @@ export const DropdownExample = () => {
|
|
|
311
314
|
<DropdownMenu.Button
|
|
312
315
|
icon={ChatBubbleBottomCenterTextIcon}
|
|
313
316
|
tooltip="Moonlab"
|
|
314
|
-
tooltipPosition="
|
|
317
|
+
tooltipPosition="bottom"
|
|
315
318
|
/>
|
|
316
319
|
<DropdownMenu.Items origin="topLeft" width={120}>
|
|
317
320
|
<DropdownMenu.Item label="item 1 is longish" link={{ href: "#" }} />
|
|
@@ -355,7 +358,7 @@ export const DropdownExample = () => {
|
|
|
355
358
|
<DropdownMenu.Button
|
|
356
359
|
icon={ChatBubbleBottomCenterTextIcon}
|
|
357
360
|
tooltip="Moonlab"
|
|
358
|
-
tooltipPosition="
|
|
361
|
+
tooltipPosition="bottom"
|
|
359
362
|
/>
|
|
360
363
|
<DropdownMenu.Items origin="topLeft">
|
|
361
364
|
<DropdownMenu.Item label="item 1" link={{ href: "#" }} />
|
|
@@ -22,7 +22,7 @@ export const IconButtonWithTooltip: Story = {
|
|
|
22
22
|
args: {
|
|
23
23
|
variant: "primary",
|
|
24
24
|
tooltip: "Your settings",
|
|
25
|
-
tooltipPosition: "
|
|
25
|
+
tooltipPosition: "bottom",
|
|
26
26
|
icon: Cog6ToothIcon,
|
|
27
27
|
},
|
|
28
28
|
};
|
|
@@ -31,7 +31,7 @@ export const IconButtonSecondary: Story = {
|
|
|
31
31
|
args: {
|
|
32
32
|
variant: "secondary",
|
|
33
33
|
tooltip: "This a secondary IconButton",
|
|
34
|
-
tooltipPosition: "
|
|
34
|
+
tooltipPosition: "bottom",
|
|
35
35
|
icon: Cog6ToothIcon,
|
|
36
36
|
},
|
|
37
37
|
};
|
|
@@ -40,7 +40,7 @@ export const IconButtonTertiary: Story = {
|
|
|
40
40
|
args: {
|
|
41
41
|
variant: "tertiary",
|
|
42
42
|
tooltip: "This a tertiary IconButton",
|
|
43
|
-
tooltipPosition: "
|
|
43
|
+
tooltipPosition: "bottom",
|
|
44
44
|
icon: Cog6ToothIcon,
|
|
45
45
|
},
|
|
46
46
|
};
|
|
@@ -23,8 +23,13 @@ export const TextAreaExample = () => {
|
|
|
23
23
|
<TextArea
|
|
24
24
|
placeholder="placeholder"
|
|
25
25
|
onChange={(e) => {
|
|
26
|
-
console.log(e.target.value)
|
|
27
|
-
setTextValues([
|
|
26
|
+
console.log(e.target.value);
|
|
27
|
+
setTextValues([
|
|
28
|
+
e.target.value,
|
|
29
|
+
textValues[1],
|
|
30
|
+
textValues[2],
|
|
31
|
+
textValues[3],
|
|
32
|
+
]);
|
|
28
33
|
}}
|
|
29
34
|
minRows={2}
|
|
30
35
|
defaultValue={textValues[0]}
|
|
@@ -34,7 +39,12 @@ export const TextAreaExample = () => {
|
|
|
34
39
|
defaultValue={textValues[1]}
|
|
35
40
|
error={"errored because blah"}
|
|
36
41
|
onChange={(e) =>
|
|
37
|
-
setTextValues([
|
|
42
|
+
setTextValues([
|
|
43
|
+
textValues[0],
|
|
44
|
+
e.target.value,
|
|
45
|
+
textValues[2],
|
|
46
|
+
textValues[3],
|
|
47
|
+
])
|
|
38
48
|
}
|
|
39
49
|
showErrorLabel
|
|
40
50
|
/>
|
|
@@ -42,7 +52,12 @@ export const TextAreaExample = () => {
|
|
|
42
52
|
placeholder="placeholder"
|
|
43
53
|
defaultValue={textValues[2]}
|
|
44
54
|
onChange={(e) =>
|
|
45
|
-
setTextValues([
|
|
55
|
+
setTextValues([
|
|
56
|
+
textValues[0],
|
|
57
|
+
textValues[1],
|
|
58
|
+
e.target.value,
|
|
59
|
+
textValues[3],
|
|
60
|
+
])
|
|
46
61
|
}
|
|
47
62
|
error={"errored because blah"}
|
|
48
63
|
/>
|