@dust-tt/sparkle 0.2.501 → 0.2.503-rc-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/cjs/index.js +1 -1
- package/dist/esm/components/AnchoredPopover.d.ts +13 -0
- package/dist/esm/components/AnchoredPopover.d.ts.map +1 -0
- package/dist/esm/components/AnchoredPopover.js +54 -0
- package/dist/esm/components/AnchoredPopover.js.map +1 -0
- package/dist/esm/components/AnimatedText.d.ts +1 -1
- package/dist/esm/components/Breadcrumbs.d.ts.map +1 -1
- package/dist/esm/components/Breadcrumbs.js +6 -1
- package/dist/esm/components/Breadcrumbs.js.map +1 -1
- package/dist/esm/components/Button.d.ts +2 -0
- package/dist/esm/components/Button.d.ts.map +1 -1
- package/dist/esm/components/Button.js +1 -1
- package/dist/esm/components/Button.js.map +1 -1
- package/dist/esm/components/Dropdown.d.ts +1 -1
- package/dist/esm/components/Popover.d.ts +2 -1
- package/dist/esm/components/Popover.d.ts.map +1 -1
- package/dist/esm/components/Popover.js +3 -2
- package/dist/esm/components/Popover.js.map +1 -1
- package/dist/esm/components/RadioGroup.js +3 -3
- package/dist/esm/components/Resizable.d.ts +1 -1
- package/dist/esm/components/Tabs.d.ts +1 -1
- package/dist/esm/components/index.d.ts +2 -2
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/components/index.js +2 -2
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/stories/AnchoredPopover.stories.d.ts +14 -0
- package/dist/esm/stories/AnchoredPopover.stories.d.ts.map +1 -0
- package/dist/esm/stories/AnchoredPopover.stories.js +69 -0
- package/dist/esm/stories/AnchoredPopover.stories.js.map +1 -0
- package/dist/esm/stories/Breadcrumbs.stories.d.ts.map +1 -1
- package/dist/esm/stories/Breadcrumbs.stories.js +2 -0
- package/dist/esm/stories/Breadcrumbs.stories.js.map +1 -1
- package/dist/esm/stories/Chip.stories.d.ts +3 -3
- package/dist/sparkle.css +8 -127
- package/package.json +1 -1
- package/src/components/AnchoredPopover.tsx +98 -0
- package/src/components/Breadcrumbs.tsx +14 -1
- package/src/components/Button.tsx +1 -1
- package/src/components/Popover.tsx +10 -4
- package/src/components/RadioGroup.tsx +3 -3
- package/src/components/index.ts +2 -7
- package/src/stories/AnchoredPopover.stories.tsx +115 -0
- package/src/stories/Breadcrumbs.stories.tsx +3 -0
- package/dist/esm/components/TourGuide.d.ts +0 -39
- package/dist/esm/components/TourGuide.d.ts.map +0 -1
- package/dist/esm/components/TourGuide.js +0 -145
- package/dist/esm/components/TourGuide.js.map +0 -1
- package/dist/esm/stories/TourGuide.stories.d.ts +0 -4
- package/dist/esm/stories/TourGuide.stories.d.ts.map +0 -1
- package/dist/esm/stories/TourGuide.stories.js +0 -133
- package/dist/esm/stories/TourGuide.stories.js.map +0 -1
- package/src/components/TourGuide.tsx +0 -316
- package/src/stories/TourGuide.stories.tsx +0 -472
package/dist/sparkle.css
CHANGED
|
@@ -973,10 +973,6 @@ select {
|
|
|
973
973
|
bottom: 0.75rem;
|
|
974
974
|
}
|
|
975
975
|
|
|
976
|
-
.s-bottom-6 {
|
|
977
|
-
bottom: 1.5rem;
|
|
978
|
-
}
|
|
979
|
-
|
|
980
976
|
.s-bottom-\[14\%\] {
|
|
981
977
|
bottom: 14%;
|
|
982
978
|
}
|
|
@@ -997,14 +993,6 @@ select {
|
|
|
997
993
|
left: 0.5rem;
|
|
998
994
|
}
|
|
999
995
|
|
|
1000
|
-
.s-left-3 {
|
|
1001
|
-
left: 0.75rem;
|
|
1002
|
-
}
|
|
1003
|
-
|
|
1004
|
-
.s-left-6 {
|
|
1005
|
-
left: 1.5rem;
|
|
1006
|
-
}
|
|
1007
|
-
|
|
1008
996
|
.s-left-\[50\%\] {
|
|
1009
997
|
left: 50%;
|
|
1010
998
|
}
|
|
@@ -1029,10 +1017,6 @@ select {
|
|
|
1029
1017
|
right: 0.75rem;
|
|
1030
1018
|
}
|
|
1031
1019
|
|
|
1032
|
-
.s-right-6 {
|
|
1033
|
-
right: 1.5rem;
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
1020
|
.s-top-0 {
|
|
1037
1021
|
top: 0px;
|
|
1038
1022
|
}
|
|
@@ -1057,10 +1041,6 @@ select {
|
|
|
1057
1041
|
top: 0.75rem;
|
|
1058
1042
|
}
|
|
1059
1043
|
|
|
1060
|
-
.s-top-6 {
|
|
1061
|
-
top: 1.5rem;
|
|
1062
|
-
}
|
|
1063
|
-
|
|
1064
1044
|
.s-top-\[50\%\] {
|
|
1065
1045
|
top: 50%;
|
|
1066
1046
|
}
|
|
@@ -1303,10 +1283,6 @@ select {
|
|
|
1303
1283
|
aspect-ratio: 1 / 1;
|
|
1304
1284
|
}
|
|
1305
1285
|
|
|
1306
|
-
.s-aspect-video {
|
|
1307
|
-
aspect-ratio: 16 / 9;
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
1286
|
.s-h-0 {
|
|
1311
1287
|
height: 0px;
|
|
1312
1288
|
}
|
|
@@ -1379,6 +1355,10 @@ select {
|
|
|
1379
1355
|
height: 11rem;
|
|
1380
1356
|
}
|
|
1381
1357
|
|
|
1358
|
+
.s-h-48 {
|
|
1359
|
+
height: 12rem;
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1382
1362
|
.s-h-5 {
|
|
1383
1363
|
height: 1.25rem;
|
|
1384
1364
|
}
|
|
@@ -1427,18 +1407,10 @@ select {
|
|
|
1427
1407
|
height: 200px;
|
|
1428
1408
|
}
|
|
1429
1409
|
|
|
1430
|
-
.s-h-\[240px\] {
|
|
1431
|
-
height: 240px;
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
1410
|
.s-h-\[30\%\] {
|
|
1435
1411
|
height: 30%;
|
|
1436
1412
|
}
|
|
1437
1413
|
|
|
1438
|
-
.s-h-\[32px\] {
|
|
1439
|
-
height: 32px;
|
|
1440
|
-
}
|
|
1441
|
-
|
|
1442
1414
|
.s-h-\[340px\] {
|
|
1443
1415
|
height: 340px;
|
|
1444
1416
|
}
|
|
@@ -1520,10 +1492,6 @@ select {
|
|
|
1520
1492
|
min-height: 100%;
|
|
1521
1493
|
}
|
|
1522
1494
|
|
|
1523
|
-
.s-min-h-screen {
|
|
1524
|
-
min-height: 100vh;
|
|
1525
|
-
}
|
|
1526
|
-
|
|
1527
1495
|
.s-w-0 {
|
|
1528
1496
|
width: 0px;
|
|
1529
1497
|
}
|
|
@@ -1680,18 +1648,14 @@ select {
|
|
|
1680
1648
|
width: 380px;
|
|
1681
1649
|
}
|
|
1682
1650
|
|
|
1683
|
-
.s-w-\[3px\] {
|
|
1684
|
-
width: 3px;
|
|
1685
|
-
}
|
|
1686
|
-
|
|
1687
|
-
.s-w-\[420px\] {
|
|
1688
|
-
width: 420px;
|
|
1689
|
-
}
|
|
1690
|
-
|
|
1691
1651
|
.s-w-\[48px\] {
|
|
1692
1652
|
width: 48px;
|
|
1693
1653
|
}
|
|
1694
1654
|
|
|
1655
|
+
.s-w-\[600px\] {
|
|
1656
|
+
width: 600px;
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1695
1659
|
.s-w-\[70\%\] {
|
|
1696
1660
|
width: 70%;
|
|
1697
1661
|
}
|
|
@@ -1920,28 +1884,6 @@ select {
|
|
|
1920
1884
|
animation: s-breathing 3s infinite ease-in-out;
|
|
1921
1885
|
}
|
|
1922
1886
|
|
|
1923
|
-
@keyframes s-cursor-blink {
|
|
1924
|
-
0% {
|
|
1925
|
-
opacity: 1;
|
|
1926
|
-
}
|
|
1927
|
-
|
|
1928
|
-
60% {
|
|
1929
|
-
opacity: 1;
|
|
1930
|
-
}
|
|
1931
|
-
|
|
1932
|
-
70% {
|
|
1933
|
-
opacity: 0;
|
|
1934
|
-
}
|
|
1935
|
-
|
|
1936
|
-
100% {
|
|
1937
|
-
opacity: 0;
|
|
1938
|
-
}
|
|
1939
|
-
}
|
|
1940
|
-
|
|
1941
|
-
.s-animate-cursor-blink {
|
|
1942
|
-
animation: s-cursor-blink 0.9s infinite;;
|
|
1943
|
-
}
|
|
1944
|
-
|
|
1945
1887
|
@keyframes s-pulse {
|
|
1946
1888
|
50% {
|
|
1947
1889
|
opacity: .5;
|
|
@@ -2062,14 +2004,6 @@ select {
|
|
|
2062
2004
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
2063
2005
|
}
|
|
2064
2006
|
|
|
2065
|
-
.s-grid-cols-4 {
|
|
2066
|
-
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
2067
|
-
}
|
|
2068
|
-
|
|
2069
|
-
.s-grid-cols-6 {
|
|
2070
|
-
grid-template-columns: repeat(6, minmax(0, 1fr));
|
|
2071
|
-
}
|
|
2072
|
-
|
|
2073
2007
|
.s-grid-cols-8 {
|
|
2074
2008
|
grid-template-columns: repeat(8, minmax(0, 1fr));
|
|
2075
2009
|
}
|
|
@@ -2567,11 +2501,6 @@ select {
|
|
|
2567
2501
|
border-color: rgb(122 198 255 / var(--tw-border-opacity));
|
|
2568
2502
|
}
|
|
2569
2503
|
|
|
2570
|
-
.s-border-highlight-400 {
|
|
2571
|
-
--tw-border-opacity: 1;
|
|
2572
|
-
border-color: rgb(75 171 255 / var(--tw-border-opacity));
|
|
2573
|
-
}
|
|
2574
|
-
|
|
2575
2504
|
.s-border-info-100 {
|
|
2576
2505
|
--tw-border-opacity: 1;
|
|
2577
2506
|
border-color: rgb(255 239 168 / var(--tw-border-opacity));
|
|
@@ -2855,26 +2784,6 @@ select {
|
|
|
2855
2784
|
background-color: rgb(255 226 98 / var(--tw-bg-opacity));
|
|
2856
2785
|
}
|
|
2857
2786
|
|
|
2858
|
-
.s-bg-brand-support-blue {
|
|
2859
|
-
--tw-bg-opacity: 1;
|
|
2860
|
-
background-color: rgb(233 247 255 / var(--tw-bg-opacity));
|
|
2861
|
-
}
|
|
2862
|
-
|
|
2863
|
-
.s-bg-brand-support-golden {
|
|
2864
|
-
--tw-bg-opacity: 1;
|
|
2865
|
-
background-color: rgb(255 250 224 / var(--tw-bg-opacity));
|
|
2866
|
-
}
|
|
2867
|
-
|
|
2868
|
-
.s-bg-brand-support-green {
|
|
2869
|
-
--tw-bg-opacity: 1;
|
|
2870
|
-
background-color: rgb(254 255 240 / var(--tw-bg-opacity));
|
|
2871
|
-
}
|
|
2872
|
-
|
|
2873
|
-
.s-bg-brand-support-rose {
|
|
2874
|
-
--tw-bg-opacity: 1;
|
|
2875
|
-
background-color: rgb(254 242 242 / var(--tw-bg-opacity));
|
|
2876
|
-
}
|
|
2877
|
-
|
|
2878
2787
|
.s-bg-brand-tea-green {
|
|
2879
2788
|
--tw-bg-opacity: 1;
|
|
2880
2789
|
background-color: rgb(226 247 140 / var(--tw-bg-opacity));
|
|
@@ -2935,11 +2844,6 @@ select {
|
|
|
2935
2844
|
background-color: rgb(4 20 10 / var(--tw-bg-opacity));
|
|
2936
2845
|
}
|
|
2937
2846
|
|
|
2938
|
-
.s-bg-foreground {
|
|
2939
|
-
--tw-bg-opacity: 1;
|
|
2940
|
-
background-color: rgb(17 20 24 / var(--tw-bg-opacity));
|
|
2941
|
-
}
|
|
2942
|
-
|
|
2943
2847
|
.s-bg-golden-100 {
|
|
2944
2848
|
--tw-bg-opacity: 1;
|
|
2945
2849
|
background-color: rgb(255 239 168 / var(--tw-bg-opacity));
|
|
@@ -4299,10 +4203,6 @@ select {
|
|
|
4299
4203
|
padding-right: 0.75rem;
|
|
4300
4204
|
}
|
|
4301
4205
|
|
|
4302
|
-
.s-pr-5 {
|
|
4303
|
-
padding-right: 1.25rem;
|
|
4304
|
-
}
|
|
4305
|
-
|
|
4306
4206
|
.s-pr-8 {
|
|
4307
4207
|
padding-right: 2rem;
|
|
4308
4208
|
}
|
|
@@ -5086,10 +4986,6 @@ select {
|
|
|
5086
4986
|
--tw-ring-color: rgb(122 198 255 / var(--tw-ring-opacity));
|
|
5087
4987
|
}
|
|
5088
4988
|
|
|
5089
|
-
.s-ring-highlight-400\/30 {
|
|
5090
|
-
--tw-ring-color: rgb(75 171 255 / 0.3);
|
|
5091
|
-
}
|
|
5092
|
-
|
|
5093
4989
|
.s-ring-highlight\/0 {
|
|
5094
4990
|
--tw-ring-color: rgb(28 145 255 / 0);
|
|
5095
4991
|
}
|
|
@@ -5498,16 +5394,6 @@ select {
|
|
|
5498
5394
|
border-color: rgb(223 224 226 / var(--tw-border-opacity));
|
|
5499
5395
|
}
|
|
5500
5396
|
|
|
5501
|
-
.hover\:s-bg-blue-100:hover {
|
|
5502
|
-
--tw-bg-opacity: 1;
|
|
5503
|
-
background-color: rgb(202 235 255 / var(--tw-bg-opacity));
|
|
5504
|
-
}
|
|
5505
|
-
|
|
5506
|
-
.hover\:s-bg-green-100:hover {
|
|
5507
|
-
--tw-bg-opacity: 1;
|
|
5508
|
-
background-color: rgb(240 251 189 / var(--tw-bg-opacity));
|
|
5509
|
-
}
|
|
5510
|
-
|
|
5511
5397
|
.hover\:s-bg-highlight-300:hover {
|
|
5512
5398
|
--tw-bg-opacity: 1;
|
|
5513
5399
|
background-color: rgb(122 198 255 / var(--tw-bg-opacity));
|
|
@@ -5556,11 +5442,6 @@ select {
|
|
|
5556
5442
|
background-color: rgb(84 93 108 / var(--tw-bg-opacity));
|
|
5557
5443
|
}
|
|
5558
5444
|
|
|
5559
|
-
.hover\:s-bg-red-100:hover {
|
|
5560
|
-
--tw-bg-opacity: 1;
|
|
5561
|
-
background-color: rgb(248 206 199 / var(--tw-bg-opacity));
|
|
5562
|
-
}
|
|
5563
|
-
|
|
5564
5445
|
.hover\:s-bg-warning-50:hover {
|
|
5565
5446
|
--tw-bg-opacity: 1;
|
|
5566
5447
|
background-color: rgb(255 241 247 / var(--tw-bg-opacity));
|
package/package.json
CHANGED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
PopoverAnchor,
|
|
5
|
+
PopoverContent,
|
|
6
|
+
PopoverRoot,
|
|
7
|
+
} from "@sparkle/components/Popover";
|
|
8
|
+
|
|
9
|
+
interface AnchoredPopoverProps {
|
|
10
|
+
open: boolean;
|
|
11
|
+
anchorRef?: React.RefObject<HTMLElement>;
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
align?: "start" | "center" | "end";
|
|
14
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
15
|
+
sideOffset?: number;
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function AnchoredPopover({
|
|
20
|
+
open,
|
|
21
|
+
anchorRef,
|
|
22
|
+
children,
|
|
23
|
+
align = "center",
|
|
24
|
+
side = "bottom",
|
|
25
|
+
sideOffset = 4,
|
|
26
|
+
className,
|
|
27
|
+
}: AnchoredPopoverProps) {
|
|
28
|
+
const [position, setPosition] = useState({
|
|
29
|
+
top: "50%",
|
|
30
|
+
left: "50%",
|
|
31
|
+
width: "0px",
|
|
32
|
+
height: "0px",
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (!open) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const updatePosition = () => {
|
|
41
|
+
if (!anchorRef?.current) {
|
|
42
|
+
setPosition({
|
|
43
|
+
top: "50%",
|
|
44
|
+
left: "50%",
|
|
45
|
+
width: "0px",
|
|
46
|
+
height: "0px",
|
|
47
|
+
});
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const rect = anchorRef.current.getBoundingClientRect();
|
|
52
|
+
setPosition({
|
|
53
|
+
top: `${rect.top}px`,
|
|
54
|
+
left: `${rect.left}px`,
|
|
55
|
+
width: `${rect.width}px`,
|
|
56
|
+
height: `${rect.height}px`,
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
updatePosition();
|
|
61
|
+
|
|
62
|
+
const resizeObserver = new ResizeObserver(updatePosition);
|
|
63
|
+
if (anchorRef?.current) {
|
|
64
|
+
resizeObserver.observe(anchorRef.current);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
window.addEventListener("scroll", updatePosition, true);
|
|
68
|
+
|
|
69
|
+
return () => {
|
|
70
|
+
resizeObserver.disconnect();
|
|
71
|
+
window.removeEventListener("scroll", updatePosition, true);
|
|
72
|
+
};
|
|
73
|
+
}, [open, anchorRef]);
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<PopoverRoot open={open} modal={false}>
|
|
77
|
+
<PopoverAnchor
|
|
78
|
+
className="s-fixed s-transition-all s-duration-300 s-ease-in-out"
|
|
79
|
+
style={{
|
|
80
|
+
top: position.top,
|
|
81
|
+
left: position.left,
|
|
82
|
+
width: position.width,
|
|
83
|
+
height: position.height,
|
|
84
|
+
}}
|
|
85
|
+
/>
|
|
86
|
+
<PopoverContent
|
|
87
|
+
align={align}
|
|
88
|
+
side={side}
|
|
89
|
+
sideOffset={sideOffset}
|
|
90
|
+
className={className}
|
|
91
|
+
onOpenAutoFocus={(e) => e.preventDefault()}
|
|
92
|
+
mountPortal={false}
|
|
93
|
+
>
|
|
94
|
+
{children}
|
|
95
|
+
</PopoverContent>
|
|
96
|
+
</PopoverRoot>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ComponentType } from "react";
|
|
2
2
|
import React from "react";
|
|
3
3
|
|
|
4
|
-
import { Button } from "@sparkle/components/Button";
|
|
4
|
+
import { Button, ICON_SIZE_MAP } from "@sparkle/components/Button";
|
|
5
5
|
import {
|
|
6
6
|
DropdownMenu,
|
|
7
7
|
DropdownMenuContent,
|
|
@@ -133,6 +133,19 @@ function BreadcrumbItem({
|
|
|
133
133
|
);
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
if (item.icon) {
|
|
137
|
+
return (
|
|
138
|
+
<div className="s-shrink0 s-label-sm s-inline-flex s-h-9 s-items-center s-gap-2 s-border s-border-border/0 s-px-3">
|
|
139
|
+
<Icon
|
|
140
|
+
visual={item.icon}
|
|
141
|
+
size={ICON_SIZE_MAP[size]}
|
|
142
|
+
className={cn("-s-mx-0.5")}
|
|
143
|
+
/>
|
|
144
|
+
<div className={cn("", commonClassName)}>{item.label}</div>
|
|
145
|
+
</div>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
136
149
|
return (
|
|
137
150
|
<div className={cn("s-px-2 s-py-1.5", commonClassName)}>{item.label}</div>
|
|
138
151
|
);
|
|
@@ -171,7 +171,7 @@ MetaButton.displayName = "MetaButton";
|
|
|
171
171
|
type IconSizeType = "xs" | "sm" | "md";
|
|
172
172
|
type CounterSizeType = "xs" | "sm" | "md";
|
|
173
173
|
|
|
174
|
-
const ICON_SIZE_MAP: Record<ButtonSizeType, IconSizeType> = {
|
|
174
|
+
export const ICON_SIZE_MAP: Record<ButtonSizeType, IconSizeType> = {
|
|
175
175
|
xmini: "xs",
|
|
176
176
|
mini: "sm",
|
|
177
177
|
xs: "xs",
|
|
@@ -5,10 +5,9 @@ import { useEffect, useState } from "react";
|
|
|
5
5
|
import { cn } from "@sparkle/lib/utils";
|
|
6
6
|
|
|
7
7
|
const PopoverRoot = PopoverPrimitive.Root;
|
|
8
|
-
|
|
9
8
|
const PopoverTrigger = PopoverPrimitive.Trigger;
|
|
10
|
-
|
|
11
9
|
const PopoverPortal = PopoverPrimitive.Portal;
|
|
10
|
+
const PopoverAnchor = PopoverPrimitive.Anchor;
|
|
12
11
|
|
|
13
12
|
interface PopoverContentProps
|
|
14
13
|
extends React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> {
|
|
@@ -68,7 +67,7 @@ const PopoverContent = React.forwardRef<
|
|
|
68
67
|
const defaultContainer = dialogElements[dialogElements.length - 1];
|
|
69
68
|
setContainer(defaultContainer);
|
|
70
69
|
}
|
|
71
|
-
}, []);
|
|
70
|
+
}, [mountPortal, container]);
|
|
72
71
|
|
|
73
72
|
return mountPortal ? (
|
|
74
73
|
<PopoverPrimitive.Portal container={container}>
|
|
@@ -102,4 +101,11 @@ function Popover({
|
|
|
102
101
|
|
|
103
102
|
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
104
103
|
|
|
105
|
-
export {
|
|
104
|
+
export {
|
|
105
|
+
Popover,
|
|
106
|
+
PopoverAnchor,
|
|
107
|
+
PopoverContent,
|
|
108
|
+
PopoverPortal,
|
|
109
|
+
PopoverRoot,
|
|
110
|
+
PopoverTrigger,
|
|
111
|
+
};
|
|
@@ -106,7 +106,7 @@ const RadioGroupItem = React.forwardRef<
|
|
|
106
106
|
);
|
|
107
107
|
|
|
108
108
|
const wrappedItem = (
|
|
109
|
-
<div className="s-flex s-items-center s-gap-2
|
|
109
|
+
<div className="s-flex s-w-full s-items-center s-gap-2">
|
|
110
110
|
{tooltipMessage ? (
|
|
111
111
|
<Tooltip trigger={item} label={tooltipMessage} />
|
|
112
112
|
) : (
|
|
@@ -165,12 +165,12 @@ const RadioGroupCustomItem = React.forwardRef<
|
|
|
165
165
|
return (
|
|
166
166
|
<div
|
|
167
167
|
className={cn(
|
|
168
|
-
"s-flex s-
|
|
168
|
+
"s-flex s-w-full s-flex-col",
|
|
169
169
|
className,
|
|
170
170
|
`s-items-${iconPosition}`
|
|
171
171
|
)}
|
|
172
172
|
>
|
|
173
|
-
<div className="s-flex s-items-center s-gap-2
|
|
173
|
+
<div className="s-flex s-w-full s-items-center s-gap-2">
|
|
174
174
|
{item}
|
|
175
175
|
{customItem}
|
|
176
176
|
</div>
|
package/src/components/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { AnchoredPopover } from "./AnchoredPopover";
|
|
1
2
|
export { AnimatedText } from "./AnimatedText";
|
|
2
3
|
export { AspectRatio } from "./AspectRatio";
|
|
3
4
|
export {
|
|
@@ -104,6 +105,7 @@ export { Pagination } from "./Pagination";
|
|
|
104
105
|
export { ColorPicker, IconPicker } from "./Picker";
|
|
105
106
|
export {
|
|
106
107
|
Popover,
|
|
108
|
+
PopoverAnchor,
|
|
107
109
|
PopoverContent,
|
|
108
110
|
PopoverPortal,
|
|
109
111
|
PopoverRoot,
|
|
@@ -147,13 +149,6 @@ export {
|
|
|
147
149
|
TooltipRoot,
|
|
148
150
|
TooltipTrigger,
|
|
149
151
|
} from "./Tooltip";
|
|
150
|
-
export {
|
|
151
|
-
TourGuide,
|
|
152
|
-
TourGuideCard,
|
|
153
|
-
TourGuideCardContent,
|
|
154
|
-
TourGuideCardTitle,
|
|
155
|
-
TourGuideCardVisual,
|
|
156
|
-
} from "./TourGuide";
|
|
157
152
|
export { Tree } from "./Tree";
|
|
158
153
|
export { TypingAnimation } from "./TypingAnimation";
|
|
159
154
|
export { ValueCard } from "./ValueCard";
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import React, { useRef, useState } from "react";
|
|
3
|
+
|
|
4
|
+
import { AnchoredPopover } from "@sparkle/components/AnchoredPopover";
|
|
5
|
+
import { Button } from "@sparkle/components/Button";
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: "Components/AnchoredPopover",
|
|
9
|
+
component: AnchoredPopover,
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: "centered",
|
|
12
|
+
},
|
|
13
|
+
tags: ["autodocs"],
|
|
14
|
+
} satisfies Meta<typeof AnchoredPopover>;
|
|
15
|
+
|
|
16
|
+
export default meta;
|
|
17
|
+
type Story = StoryObj<typeof meta>;
|
|
18
|
+
|
|
19
|
+
const ExampleWrapper = ({ children }: { children: React.ReactNode }) => (
|
|
20
|
+
<div className="s-flex s-h-[400px] s-w-[600px] s-items-center s-justify-center s-gap-8">
|
|
21
|
+
{children}
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const MultipleAnchorsExample = () => {
|
|
26
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
27
|
+
const [activeRef, setActiveRef] =
|
|
28
|
+
useState<React.RefObject<HTMLButtonElement>>();
|
|
29
|
+
const topRef = useRef<HTMLButtonElement>(null);
|
|
30
|
+
const rightRef = useRef<HTMLButtonElement>(null);
|
|
31
|
+
const bottomRef = useRef<HTMLButtonElement>(null);
|
|
32
|
+
const leftRef = useRef<HTMLButtonElement>(null);
|
|
33
|
+
|
|
34
|
+
const handleClick = (ref: React.RefObject<HTMLButtonElement>) => {
|
|
35
|
+
setActiveRef(ref);
|
|
36
|
+
setIsOpen(true);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<ExampleWrapper>
|
|
41
|
+
<div className="s-relative s-flex s-h-48 s-w-48 s-flex-col s-items-center s-justify-center">
|
|
42
|
+
<div className="s-absolute s-left-1/2 s-top-0 s--translate-x-1/2">
|
|
43
|
+
<Button
|
|
44
|
+
ref={topRef}
|
|
45
|
+
label="Top"
|
|
46
|
+
onClick={() => handleClick(topRef)}
|
|
47
|
+
size="sm"
|
|
48
|
+
/>
|
|
49
|
+
</div>
|
|
50
|
+
<div className="s-absolute s-right-0 s-top-1/2 s--translate-y-1/2">
|
|
51
|
+
<Button
|
|
52
|
+
ref={rightRef}
|
|
53
|
+
label="Right"
|
|
54
|
+
onClick={() => handleClick(rightRef)}
|
|
55
|
+
size="sm"
|
|
56
|
+
/>
|
|
57
|
+
</div>
|
|
58
|
+
<div className="s-absolute s-bottom-0 s-left-1/2 s--translate-x-1/2">
|
|
59
|
+
<Button
|
|
60
|
+
ref={bottomRef}
|
|
61
|
+
label="Bottom"
|
|
62
|
+
onClick={() => handleClick(bottomRef)}
|
|
63
|
+
size="sm"
|
|
64
|
+
/>
|
|
65
|
+
</div>
|
|
66
|
+
<div className="s-absolute s-left-0 s-top-1/2 s--translate-y-1/2">
|
|
67
|
+
<Button
|
|
68
|
+
ref={leftRef}
|
|
69
|
+
label="Left"
|
|
70
|
+
onClick={() => handleClick(leftRef)}
|
|
71
|
+
size="sm"
|
|
72
|
+
/>
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
<AnchoredPopover
|
|
76
|
+
open={isOpen}
|
|
77
|
+
anchorRef={activeRef}
|
|
78
|
+
side={
|
|
79
|
+
activeRef === topRef
|
|
80
|
+
? "top"
|
|
81
|
+
: activeRef === rightRef
|
|
82
|
+
? "right"
|
|
83
|
+
: activeRef === bottomRef
|
|
84
|
+
? "bottom"
|
|
85
|
+
: "left"
|
|
86
|
+
}
|
|
87
|
+
className="s-w-40 s-p-4"
|
|
88
|
+
>
|
|
89
|
+
<div className="s-text-sm">
|
|
90
|
+
This popover is anchored to the{" "}
|
|
91
|
+
{activeRef === topRef
|
|
92
|
+
? "top"
|
|
93
|
+
: activeRef === rightRef
|
|
94
|
+
? "right"
|
|
95
|
+
: activeRef === bottomRef
|
|
96
|
+
? "bottom"
|
|
97
|
+
: "left"}{" "}
|
|
98
|
+
button.
|
|
99
|
+
</div>
|
|
100
|
+
</AnchoredPopover>
|
|
101
|
+
</div>
|
|
102
|
+
</ExampleWrapper>
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export const Example: Story = {
|
|
107
|
+
args: {
|
|
108
|
+
open: true,
|
|
109
|
+
side: "bottom",
|
|
110
|
+
align: "center",
|
|
111
|
+
sideOffset: 4,
|
|
112
|
+
children: <div>Popover content</div>,
|
|
113
|
+
},
|
|
114
|
+
render: () => <MultipleAnchorsExample />,
|
|
115
|
+
};
|
|
@@ -27,6 +27,8 @@ type BreadcrumbsExampleProps = {
|
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
export const BreadcrumbsExample = (args: BreadcrumbsExampleProps) => {
|
|
30
|
+
const items0 = [{ label: "Home", icon: HomeIcon }];
|
|
31
|
+
|
|
30
32
|
const items1 = [
|
|
31
33
|
{ label: "Home", href: "#", icon: HomeIcon },
|
|
32
34
|
{ label: "Spaces", onClick: () => alert("Spaces clicked!") },
|
|
@@ -80,6 +82,7 @@ export const BreadcrumbsExample = (args: BreadcrumbsExampleProps) => {
|
|
|
80
82
|
|
|
81
83
|
return (
|
|
82
84
|
<div className="s-flex s-flex-col s-gap-4 s-pb-8">
|
|
85
|
+
<Breadcrumbs items={items0} {...args} />
|
|
83
86
|
<Breadcrumbs items={items1} {...args} />
|
|
84
87
|
<Breadcrumbs items={items2} {...args} />
|
|
85
88
|
<Breadcrumbs items={items4} {...args} />
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
interface TourGuideCardProps {
|
|
3
|
-
anchorRef?: React.RefObject<HTMLDivElement>;
|
|
4
|
-
title?: string;
|
|
5
|
-
content?: React.ReactNode;
|
|
6
|
-
visual?: React.ReactNode;
|
|
7
|
-
onNext?: () => void;
|
|
8
|
-
onDismiss?: () => void;
|
|
9
|
-
isLastStep?: boolean;
|
|
10
|
-
className?: string;
|
|
11
|
-
children?: React.ReactNode;
|
|
12
|
-
asPopover?: boolean;
|
|
13
|
-
align?: "start" | "center" | "end";
|
|
14
|
-
side?: "top" | "right" | "bottom" | "left";
|
|
15
|
-
sideOffset?: number;
|
|
16
|
-
currentIndex?: number;
|
|
17
|
-
totalCards?: number;
|
|
18
|
-
}
|
|
19
|
-
export declare const TourGuideCardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
20
|
-
export declare const TourGuideCardContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
21
|
-
export declare const TourGuideCardVisual: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
22
|
-
interface TourGuideCardActionsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
23
|
-
currentIndex: number;
|
|
24
|
-
totalCards: number;
|
|
25
|
-
onNext?: () => void;
|
|
26
|
-
onDismiss?: () => void;
|
|
27
|
-
}
|
|
28
|
-
export declare const TourGuideCardActions: React.ForwardRefExoticComponent<TourGuideCardActionsProps & React.RefAttributes<HTMLDivElement>>;
|
|
29
|
-
export declare const TourGuideCard: React.ForwardRefExoticComponent<TourGuideCardProps & React.RefAttributes<HTMLDivElement>>;
|
|
30
|
-
export interface TourGuideProps {
|
|
31
|
-
children: React.ReactNode;
|
|
32
|
-
autoStart?: boolean;
|
|
33
|
-
onStart?: () => void;
|
|
34
|
-
onEnd?: () => void;
|
|
35
|
-
onDismiss?: () => void;
|
|
36
|
-
}
|
|
37
|
-
export declare function TourGuide({ children, autoStart, onStart, onEnd, onDismiss, }: TourGuideProps): React.JSX.Element | null;
|
|
38
|
-
export {};
|
|
39
|
-
//# sourceMappingURL=TourGuide.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TourGuide.d.ts","sourceRoot":"","sources":["../../../src/components/TourGuide.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAKnD,UAAU,kBAAkB;IAC1B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACnC,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,kBAAkB,6GAW7B,CAAC;AAGH,eAAO,MAAM,oBAAoB,6GAc/B,CAAC;AAGH,eAAO,MAAM,mBAAmB,6GAc9B,CAAC;AAGH,UAAU,yBACR,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC5C,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,eAAO,MAAM,oBAAoB,kGAyDhC,CAAC;AAGF,eAAO,MAAM,aAAa,2FAsCzB,CAAC;AAGF,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,SAAgB,EAChB,OAAO,EACP,KAAK,EACL,SAAS,GACV,EAAE,cAAc,4BAwHhB"}
|