@dust-tt/sparkle 0.2.254 → 0.2.256
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 +3883 -451
- 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/Tree.js +1 -1
- package/dist/esm/components/Tree.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/icons/solid/Dot.d.ts +5 -0
- package/dist/esm/icons/solid/Dot.d.ts.map +1 -0
- package/dist/esm/icons/solid/Dot.js +6 -0
- package/dist/esm/icons/solid/Dot.js.map +1 -0
- package/dist/esm/icons/solid/MagnifyingGlass.d.ts.map +1 -1
- package/dist/esm/icons/solid/MagnifyingGlass.js +2 -1
- package/dist/esm/icons/solid/MagnifyingGlass.js.map +1 -1
- package/dist/esm/icons/solid/index.d.ts +1 -0
- package/dist/esm/icons/solid/index.d.ts.map +1 -1
- package/dist/esm/icons/solid/index.js +1 -0
- package/dist/esm/icons/solid/index.js.map +1 -1
- package/dist/esm/icons/src/solid/dot.svg +3 -0
- package/dist/esm/icons/src/solid/magnifying-glass.svg +2 -1
- package/dist/esm/icons/src/stroke/dot.svg +3 -0
- package/dist/esm/icons/stroke/Dot.d.ts +5 -0
- package/dist/esm/icons/stroke/Dot.d.ts.map +1 -0
- package/dist/esm/icons/stroke/Dot.js +6 -0
- package/dist/esm/icons/stroke/Dot.js.map +1 -0
- package/dist/esm/icons/stroke/index.d.ts +1 -0
- package/dist/esm/icons/stroke/index.d.ts.map +1 -1
- package/dist/esm/icons/stroke/index.js +1 -0
- package/dist/esm/icons/stroke/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.d.ts.map +1 -1
- package/dist/esm/stories/Tree.stories.js +4 -3
- package/dist/esm/stories/Tree.stories.js.map +1 -1
- package/dist/sparkle.css +98 -68
- package/package.json +4 -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/Tree.tsx +5 -1
- package/src/components/index.ts +7 -1
- package/src/icons/solid/Dot.tsx +15 -0
- package/src/icons/solid/MagnifyingGlass.tsx +7 -1
- package/src/icons/solid/index.ts +1 -0
- package/src/icons/src/solid/dot.svg +3 -0
- package/src/icons/src/solid/magnifying-glass.svg +2 -1
- package/src/icons/src/stroke/dot.svg +3 -0
- package/src/icons/stroke/Dot.tsx +20 -0
- package/src/icons/stroke/index.ts +1 -0
- 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 +12 -2
|
@@ -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/Tree.tsx
CHANGED
|
@@ -222,5 +222,9 @@ interface TreeEmptyProps {
|
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
Tree.Empty = function ({ label }: TreeEmptyProps) {
|
|
225
|
-
return
|
|
225
|
+
return (
|
|
226
|
+
<div className="s-py-1 s-pl-6 s-text-sm s-font-medium s-text-element-700">
|
|
227
|
+
{label}
|
|
228
|
+
</div>
|
|
229
|
+
);
|
|
226
230
|
};
|
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";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SVGProps } from "react";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
const SvgDot = (props: SVGProps<SVGSVGElement>) => (
|
|
4
|
+
<svg
|
|
5
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
6
|
+
width="1em"
|
|
7
|
+
height="1em"
|
|
8
|
+
fill="none"
|
|
9
|
+
viewBox="0 0 24 24"
|
|
10
|
+
{...props}
|
|
11
|
+
>
|
|
12
|
+
<path fill="currentColor" d="M12 16a4 4 0 1 0 0-8 4 4 0 0 0 0 8Z" />
|
|
13
|
+
</svg>
|
|
14
|
+
);
|
|
15
|
+
export default SvgDot;
|
|
@@ -11,7 +11,13 @@ const SvgMagnifyingGlass = (props: SVGProps<SVGSVGElement>) => (
|
|
|
11
11
|
>
|
|
12
12
|
<path
|
|
13
13
|
fill="currentColor"
|
|
14
|
-
|
|
14
|
+
fillRule="evenodd"
|
|
15
|
+
d="M17.364 17.364A9 9 0 1 1 4.636 4.636a9 9 0 0 1 12.728 12.728Zm-2.121-2.121a6 6 0 1 1-8.486-8.485 6 6 0 0 1 8.486 8.485Z"
|
|
16
|
+
clipRule="evenodd"
|
|
17
|
+
/>
|
|
18
|
+
<path
|
|
19
|
+
fill="currentColor"
|
|
20
|
+
d="m22.374 20.253-3.535-3.535-2.121 2.12 3.535 3.536 2.121-2.121Z"
|
|
15
21
|
/>
|
|
16
22
|
</svg>
|
|
17
23
|
);
|
package/src/icons/solid/index.ts
CHANGED
|
@@ -48,6 +48,7 @@ export { default as DocumentDuplicateIcon } from "./DocumentDuplicate";
|
|
|
48
48
|
export { default as DocumentPileIcon } from "./DocumentPile";
|
|
49
49
|
export { default as DocumentPlusIcon } from "./DocumentPlus";
|
|
50
50
|
export { default as DocumentTextIcon } from "./DocumentText";
|
|
51
|
+
export { default as DotIcon } from "./Dot";
|
|
51
52
|
export { default as DustIcon } from "./Dust";
|
|
52
53
|
export { default as EmotionLaughIcon } from "./EmotionLaugh";
|
|
53
54
|
export { default as EqualizerIcon } from "./Equalizer";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M17.364 17.364C13.8492 20.8787 8.15075 20.8787 4.63604 17.364C1.12133 13.8492 1.12132 8.15076 4.63604 4.63604C8.15076 1.12132 13.8492 1.12133 17.364 4.63604C20.8787 8.15075 20.8787 13.8492 17.364 17.364ZM15.2426 15.2426C12.8995 17.5858 9.10051 17.5858 6.75736 15.2426C4.4142 12.8995 4.41421 9.1005 6.75736 6.75736C9.1005 4.41421 12.8995 4.4142 15.2426 6.75736C17.5858 9.10051 17.5858 12.8995 15.2426 15.2426Z" fill="#020617"/>
|
|
3
|
+
<path d="M22.3744 20.253L18.8388 16.7175L16.7175 18.8388L20.253 22.3744L22.3744 20.253Z" fill="#020617"/>
|
|
3
4
|
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 14C13.1046 14 14 13.1046 14 12C14 10.8954 13.1046 10 12 10C10.8954 10 10 10.8954 10 12C10 13.1046 10.8954 14 12 14ZM16 12C16 14.2091 14.2091 16 12 16C9.79086 16 8 14.2091 8 12C8 9.79086 9.79086 8 12 8C14.2091 8 16 9.79086 16 12Z" fill="#020617"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SVGProps } from "react";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
const SvgDot = (props: SVGProps<SVGSVGElement>) => (
|
|
4
|
+
<svg
|
|
5
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
6
|
+
width="1em"
|
|
7
|
+
height="1em"
|
|
8
|
+
fill="none"
|
|
9
|
+
viewBox="0 0 24 24"
|
|
10
|
+
{...props}
|
|
11
|
+
>
|
|
12
|
+
<path
|
|
13
|
+
fill="currentColor"
|
|
14
|
+
fillRule="evenodd"
|
|
15
|
+
d="M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm4-2a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z"
|
|
16
|
+
clipRule="evenodd"
|
|
17
|
+
/>
|
|
18
|
+
</svg>
|
|
19
|
+
);
|
|
20
|
+
export default SvgDot;
|
|
@@ -48,6 +48,7 @@ export { default as DocumentDuplicateStrokeIcon } from "./DocumentDuplicate";
|
|
|
48
48
|
export { default as DocumentPileStrokeIcon } from "./DocumentPile";
|
|
49
49
|
export { default as DocumentPlusStrokeIcon } from "./DocumentPlus";
|
|
50
50
|
export { default as DocumentTextStrokeIcon } from "./DocumentText";
|
|
51
|
+
export { default as DotStrokeIcon } from "./Dot";
|
|
51
52
|
export { default as DustStrokeIcon } from "./Dust";
|
|
52
53
|
export { default as EmotionLaughStrokeIcon } from "./EmotionLaugh";
|
|
53
54
|
export { default as EqualizerStrokeIcon } from "./Equalizer";
|
|
@@ -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
|
/>
|
|
@@ -1,62 +1,43 @@
|
|
|
1
|
-
import type { Meta
|
|
1
|
+
import type { Meta } from "@storybook/react";
|
|
2
2
|
import React from "react";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
Icon,
|
|
6
|
+
RobotIcon,
|
|
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/Tooltip",
|
|
8
|
-
component:
|
|
9
|
-
} satisfies Meta<typeof
|
|
16
|
+
component: TooltipProvider,
|
|
17
|
+
} satisfies Meta<typeof TooltipProvider>;
|
|
10
18
|
|
|
11
19
|
export default meta;
|
|
12
|
-
type Story = StoryObj<typeof meta>;
|
|
13
20
|
|
|
14
|
-
export const
|
|
15
|
-
|
|
16
|
-
label: "This is a tooltip",
|
|
17
|
-
children: "Hover me",
|
|
18
|
-
position: "above",
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const TooltipBelow: Story = {
|
|
23
|
-
args: {
|
|
24
|
-
label: "This is a tooltip",
|
|
25
|
-
children: "Hover me",
|
|
26
|
-
position: "below",
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const ToolTipWithContent = () => (
|
|
31
|
-
<div className="s-pl-32">
|
|
32
|
-
<Tooltip
|
|
33
|
-
contentChildren={
|
|
34
|
-
<div className="s-w-64">
|
|
35
|
-
<div className="s-flex s-flex-col s-gap-y-2 s-break-words">
|
|
36
|
-
<div className="s-flex s-font-semibold">
|
|
37
|
-
This is a more complex tooltip:
|
|
38
|
-
</div>
|
|
39
|
-
<div className="s-flex s-flex-wrap s-break-words">
|
|
40
|
-
It has some content that is long here and describes something
|
|
41
|
-
about the content associated with this.
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
}
|
|
46
|
-
position="below"
|
|
47
|
-
>
|
|
48
|
-
Hover me
|
|
49
|
-
</Tooltip>
|
|
50
|
-
</div>
|
|
21
|
+
export const TooltipExample = () => (
|
|
22
|
+
<Tooltip trigger={<div>Hover</div>} label={<p>Add to library</p>} />
|
|
51
23
|
);
|
|
52
24
|
|
|
53
|
-
export const
|
|
54
|
-
<
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
25
|
+
export const TooltipWithManual = () => (
|
|
26
|
+
<TooltipProvider delayDuration={800} skipDelayDuration={500}>
|
|
27
|
+
<TooltipRoot
|
|
28
|
+
onOpenChange={(open: boolean) => {
|
|
29
|
+
console.log(`Is open: ${open}`);
|
|
30
|
+
}}
|
|
58
31
|
>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
32
|
+
<TooltipTrigger>
|
|
33
|
+
<Icon visual={RobotIcon} size="xs" />
|
|
34
|
+
</TooltipTrigger>
|
|
35
|
+
<TooltipContent side="right" sideOffset={50}>
|
|
36
|
+
This is a tooltip with a very long label that should wrap onto multiple
|
|
37
|
+
lines. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non
|
|
38
|
+
risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec,
|
|
39
|
+
ultricies sed, dolor.
|
|
40
|
+
</TooltipContent>
|
|
41
|
+
</TooltipRoot>
|
|
42
|
+
</TooltipProvider>
|
|
62
43
|
);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Meta } from "@storybook/react";
|
|
2
2
|
import React from "react";
|
|
3
3
|
|
|
4
|
-
import { DustIcon } from "@sparkle/icons/solid";
|
|
5
4
|
import {
|
|
6
5
|
DriveLogo,
|
|
7
6
|
IntercomLogo,
|
|
@@ -15,6 +14,7 @@ import {
|
|
|
15
14
|
CloudArrowDownIcon,
|
|
16
15
|
Cog6ToothIcon,
|
|
17
16
|
DocumentIcon,
|
|
17
|
+
DustIcon,
|
|
18
18
|
EyeIcon,
|
|
19
19
|
FolderIcon,
|
|
20
20
|
IconButton,
|
|
@@ -89,7 +89,17 @@ export const TreeExample = () => {
|
|
|
89
89
|
visual={FolderIcon}
|
|
90
90
|
collapsed={false}
|
|
91
91
|
>
|
|
92
|
-
<Tree.
|
|
92
|
+
<Tree.Item
|
|
93
|
+
label="Item 3"
|
|
94
|
+
type="leaf"
|
|
95
|
+
visual={DocumentIcon}
|
|
96
|
+
/>
|
|
97
|
+
<Tree.Item
|
|
98
|
+
label="Item 3"
|
|
99
|
+
type="leaf"
|
|
100
|
+
visual={DocumentIcon}
|
|
101
|
+
/>
|
|
102
|
+
<Tree.Empty label="(+ 4 items)" />
|
|
93
103
|
</Tree.Item>
|
|
94
104
|
</Tree>
|
|
95
105
|
</Tree.Item>
|