@dub/ui 0.0.8 → 0.0.10
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/README.md +11 -0
- package/dist/accordion.d.mts +9 -0
- package/dist/accordion.mjs +1 -1
- package/dist/avatar.d.mts +15 -0
- package/dist/avatar.mjs +1 -1
- package/dist/background.d.mts +5 -0
- package/dist/background.mjs +1 -1
- package/dist/badge.d.mts +12 -0
- package/dist/badge.mjs +1 -1
- package/dist/button.d.mts +13 -0
- package/dist/button.mjs +1 -1
- package/dist/chunk-2FLE5ENB.mjs +2 -0
- package/dist/chunk-2K4UXZ2O.mjs +2 -0
- package/dist/chunk-34KNHUS2.mjs +8 -0
- package/dist/chunk-3BKA5UEZ.mjs +2 -0
- package/dist/chunk-3P45QYZN.mjs +3 -0
- package/dist/chunk-3Y5WGFFC.mjs +2 -0
- package/dist/chunk-4GBYDO2W.mjs +2 -0
- package/dist/chunk-4SI5X5GP.mjs +2 -0
- package/dist/chunk-4Y22ZONT.mjs +2 -0
- package/dist/chunk-ALFYYHAX.mjs +2 -0
- package/dist/chunk-AYEBTJIP.mjs +2 -0
- package/dist/chunk-B7YPSVHM.mjs +2 -0
- package/dist/chunk-BCILXFZH.mjs +2 -0
- package/dist/chunk-BPS3E7K6.mjs +2 -0
- package/dist/chunk-BZY4AURF.mjs +2 -0
- package/dist/chunk-C36I25XS.mjs +2 -0
- package/dist/chunk-DL45ZZDE.mjs +2 -0
- package/dist/chunk-FO6VIUXZ.mjs +2 -0
- package/dist/chunk-FRGZUJQA.mjs +2 -0
- package/dist/chunk-HVUZJJ5O.mjs +2 -0
- package/dist/chunk-HZBYDQAF.mjs +2 -0
- package/dist/chunk-IMRGY4OW.mjs +2 -0
- package/dist/chunk-J2NIO4NV.mjs +2 -0
- package/dist/chunk-JF4XLNZS.mjs +2 -0
- package/dist/chunk-KPHCANWX.mjs +2 -0
- package/dist/chunk-LMXROOMK.mjs +2 -0
- package/dist/chunk-MQPIKWNS.mjs +2 -0
- package/dist/chunk-N3JNQNDM.mjs +2 -0
- package/dist/chunk-NKUXJNX4.mjs +2 -0
- package/dist/chunk-OIIHWZYP.mjs +2 -0
- package/dist/chunk-OYLESSIG.mjs +2 -0
- package/dist/chunk-PG4Y6KIL.mjs +2 -0
- package/dist/chunk-PKQIORD7.mjs +2 -0
- package/dist/chunk-PRHSFG2M.mjs +2 -0
- package/dist/chunk-RNKR6YN2.mjs +2 -0
- package/dist/chunk-S32PKYSI.mjs +8 -0
- package/dist/chunk-TL4MBWLU.mjs +2 -0
- package/dist/chunk-WPUTXRJH.mjs +2 -0
- package/dist/chunk-WRYK2ZBF.mjs +2 -0
- package/dist/chunk-X4ANTLIN.mjs +2 -0
- package/dist/chunk-XG3NPZVV.mjs +2 -0
- package/dist/chunk-XQPGNFHA.mjs +2 -0
- package/dist/chunk-XRF5F4ZR.mjs +2 -0
- package/dist/chunk-XW75EZ3L.mjs +2 -0
- package/dist/copy-button.d.mts +8 -0
- package/dist/copy-button.mjs +1 -1
- package/dist/footer.d.mts +5 -0
- package/dist/footer.mjs +1 -1
- package/dist/form.d.mts +14 -0
- package/dist/form.mjs +1 -1
- package/dist/icon-menu.d.mts +10 -0
- package/dist/icon-menu.mjs +1 -1
- package/dist/icons/copy.d.mts +7 -0
- package/dist/icons/copy.mjs +1 -1
- package/dist/icons/expanding-arrow.d.mts +7 -0
- package/dist/icons/expanding-arrow.mjs +1 -1
- package/dist/icons/facebook.d.mts +8 -0
- package/dist/icons/facebook.mjs +1 -1
- package/dist/icons/github.d.mts +7 -0
- package/dist/icons/github.mjs +1 -1
- package/dist/icons/google.d.mts +7 -0
- package/dist/icons/google.mjs +1 -1
- package/dist/icons/index.d.mts +17 -0
- package/dist/icons/index.mjs +1 -1
- package/dist/icons/linkedin.d.mts +8 -0
- package/dist/icons/linkedin.mjs +1 -1
- package/dist/icons/loading-circle.d.mts +7 -0
- package/dist/icons/loading-circle.mjs +1 -1
- package/dist/icons/loading-dots.d.mts +5 -0
- package/dist/icons/loading-dots.mjs +1 -1
- package/dist/icons/loading-spinner.d.mts +7 -0
- package/dist/icons/loading-spinner.mjs +1 -1
- package/dist/icons/logo.d.mts +7 -0
- package/dist/icons/logo.mjs +1 -1
- package/dist/icons/logotype.d.mts +7 -0
- package/dist/icons/logotype.mjs +1 -1
- package/dist/icons/magic.d.mts +7 -0
- package/dist/icons/magic.mjs +1 -1
- package/dist/icons/photo.d.mts +7 -0
- package/dist/icons/photo.mjs +1 -1
- package/dist/icons/tick.d.mts +7 -0
- package/dist/icons/tick.mjs +1 -1
- package/dist/icons/twitter.d.mts +7 -0
- package/dist/icons/twitter.mjs +1 -1
- package/dist/icons/unsplash.d.mts +7 -0
- package/dist/icons/unsplash.mjs +1 -1
- package/dist/index.d.mts +69 -0
- package/dist/index.mjs +1 -1
- package/dist/link-preview.d.mts +7 -0
- package/dist/link-preview.mjs +1 -1
- package/dist/max-width-wrapper.d.mts +9 -0
- package/dist/max-width-wrapper.mjs +1 -1
- package/dist/modal.d.mts +14 -0
- package/dist/modal.mjs +1 -1
- package/dist/nav-mobile.d.mts +5 -0
- package/dist/nav-mobile.mjs +1 -1
- package/dist/nav.d.mts +9 -0
- package/dist/nav.mjs +1 -1
- package/dist/popover.d.mts +13 -0
- package/dist/popover.mjs +1 -1
- package/dist/switch.d.mts +14 -0
- package/dist/switch.mjs +1 -1
- package/dist/tab-select.d.mts +9 -0
- package/dist/tab-select.mjs +1 -1
- package/dist/tooltip.d.mts +32 -0
- package/dist/tooltip.mjs +1 -1
- package/package.json +13 -14
- package/.turbo/turbo-build.log +0 -123
- package/postcss.config.js +0 -9
- package/src/accordion.tsx +0 -60
- package/src/avatar.tsx +0 -47
- package/src/background.tsx +0 -71
- package/src/badge.tsx +0 -33
- package/src/button.tsx +0 -60
- package/src/content.ts +0 -34
- package/src/copy-button.tsx +0 -39
- package/src/footer.tsx +0 -204
- package/src/form.tsx +0 -77
- package/src/hooks/index.ts +0 -5
- package/src/hooks/use-current-anchor.ts +0 -65
- package/src/hooks/use-intersection-observer.ts +0 -41
- package/src/hooks/use-local-storage.ts +0 -24
- package/src/hooks/use-media-query.ts +0 -46
- package/src/hooks/use-scroll.ts +0 -21
- package/src/icon-menu.tsx +0 -15
- package/src/icons/copy.tsx +0 -18
- package/src/icons/expanding-arrow.tsx +0 -39
- package/src/icons/facebook.tsx +0 -23
- package/src/icons/github.tsx +0 -14
- package/src/icons/google.tsx +0 -12
- package/src/icons/index.tsx +0 -23
- package/src/icons/linkedin.tsx +0 -22
- package/src/icons/loading-circle.tsx +0 -25
- package/src/icons/loading-dots.tsx +0 -21
- package/src/icons/loading-spinner.tsx +0 -34
- package/src/icons/logo.tsx +0 -29
- package/src/icons/logotype.tsx +0 -51
- package/src/icons/magic.tsx +0 -30
- package/src/icons/photo.tsx +0 -20
- package/src/icons/tick.tsx +0 -18
- package/src/icons/twitter.tsx +0 -31
- package/src/icons/unsplash.tsx +0 -17
- package/src/index.tsx +0 -35
- package/src/link-preview.tsx +0 -111
- package/src/max-width-wrapper.tsx +0 -21
- package/src/modal.tsx +0 -102
- package/src/nav-mobile.tsx +0 -108
- package/src/nav.tsx +0 -205
- package/src/popover.tsx +0 -61
- package/src/styles.css +0 -3
- package/src/switch.tsx +0 -60
- package/src/tab-select.tsx +0 -27
- package/src/tooltip.tsx +0 -184
- package/tailwind.config.ts +0 -9
- package/tsconfig.json +0 -5
- package/tsup.config.ts +0 -15
package/src/nav.tsx
DELETED
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { APP_DOMAIN, SHOW_BACKGROUND_SEGMENTS, cn } from "@dub/utils";
|
|
4
|
-
import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu";
|
|
5
|
-
import va from "@vercel/analytics";
|
|
6
|
-
import { ChevronDown } from "lucide-react";
|
|
7
|
-
import Link from "next/link";
|
|
8
|
-
import { useParams, useSelectedLayoutSegment } from "next/navigation";
|
|
9
|
-
import { FEATURES_LIST } from "./content";
|
|
10
|
-
import { useScroll } from "./hooks";
|
|
11
|
-
import { LogoType } from "./icons";
|
|
12
|
-
import { MaxWidthWrapper } from "./max-width-wrapper";
|
|
13
|
-
|
|
14
|
-
export const navItems = [
|
|
15
|
-
{
|
|
16
|
-
name: "Customers",
|
|
17
|
-
slug: "customers",
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
name: "Changelog",
|
|
21
|
-
slug: "changelog",
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
name: "Help",
|
|
25
|
-
slug: "help",
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
name: "Pricing",
|
|
29
|
-
slug: "pricing",
|
|
30
|
-
},
|
|
31
|
-
];
|
|
32
|
-
|
|
33
|
-
export function Nav() {
|
|
34
|
-
const { domain = "dub.co" } = useParams() as { domain: string };
|
|
35
|
-
const scrolled = useScroll(80);
|
|
36
|
-
const selectedLayout = useSelectedLayoutSegment();
|
|
37
|
-
const helpCenter = selectedLayout === "help";
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<div
|
|
41
|
-
className={cn(`sticky inset-x-0 top-0 z-30 w-full transition-all`, {
|
|
42
|
-
"border-b border-gray-200 bg-white/75 backdrop-blur-lg": scrolled,
|
|
43
|
-
"border-b border-gray-200 bg-white":
|
|
44
|
-
selectedLayout && !SHOW_BACKGROUND_SEGMENTS.includes(selectedLayout),
|
|
45
|
-
})}
|
|
46
|
-
>
|
|
47
|
-
<MaxWidthWrapper
|
|
48
|
-
{...(helpCenter && {
|
|
49
|
-
className: "max-w-screen-lg",
|
|
50
|
-
})}
|
|
51
|
-
>
|
|
52
|
-
<div className="flex h-14 items-center justify-between">
|
|
53
|
-
<div className="flex items-center space-x-4">
|
|
54
|
-
<Link
|
|
55
|
-
href={domain === "dub.co" ? "/" : `https://dub.co`}
|
|
56
|
-
{...(domain !== "dub.co" && {
|
|
57
|
-
onClick: () => {
|
|
58
|
-
va.track("Referred from custom domain", {
|
|
59
|
-
domain,
|
|
60
|
-
medium: "logo",
|
|
61
|
-
});
|
|
62
|
-
},
|
|
63
|
-
})}
|
|
64
|
-
>
|
|
65
|
-
<LogoType />
|
|
66
|
-
</Link>
|
|
67
|
-
{helpCenter ? (
|
|
68
|
-
<div className="flex items-center">
|
|
69
|
-
<div className="mr-3 h-5 border-l-2 border-gray-400" />
|
|
70
|
-
<Link
|
|
71
|
-
href="/help"
|
|
72
|
-
className="font-display text-lg font-bold text-gray-700"
|
|
73
|
-
>
|
|
74
|
-
Help Center
|
|
75
|
-
</Link>
|
|
76
|
-
</div>
|
|
77
|
-
) : (
|
|
78
|
-
<NavigationMenuPrimitive.Root
|
|
79
|
-
delayDuration={0}
|
|
80
|
-
className="relative hidden lg:block"
|
|
81
|
-
>
|
|
82
|
-
<NavigationMenuPrimitive.List className="flex flex-row space-x-2 p-4">
|
|
83
|
-
<NavigationMenuPrimitive.Item>
|
|
84
|
-
<NavigationMenuPrimitive.Trigger className="group flex items-center space-x-2 rounded-md px-3 py-2 text-sm font-medium hover:bg-gray-100 focus:outline-none">
|
|
85
|
-
<p
|
|
86
|
-
className={cn(
|
|
87
|
-
"text-sm font-medium text-gray-500 transition-colors ease-out group-hover:text-black",
|
|
88
|
-
{
|
|
89
|
-
"text-black": selectedLayout === "features",
|
|
90
|
-
},
|
|
91
|
-
)}
|
|
92
|
-
>
|
|
93
|
-
Features
|
|
94
|
-
</p>
|
|
95
|
-
<ChevronDown className="h-4 w-4 transition-all group-data-[state=open]:rotate-180" />
|
|
96
|
-
</NavigationMenuPrimitive.Trigger>
|
|
97
|
-
|
|
98
|
-
<NavigationMenuPrimitive.Content>
|
|
99
|
-
<div className="grid w-[32rem] grid-cols-2 gap-1 p-3">
|
|
100
|
-
{FEATURES_LIST.map(
|
|
101
|
-
({ slug, icon: Icon, title, shortTitle }) => (
|
|
102
|
-
<Link
|
|
103
|
-
key={slug}
|
|
104
|
-
href={
|
|
105
|
-
domain === "dub.co"
|
|
106
|
-
? `/features/${slug}`
|
|
107
|
-
: `https://dub.co/features/${slug}`
|
|
108
|
-
}
|
|
109
|
-
{...(domain !== "dub.co" && {
|
|
110
|
-
onClick: () => {
|
|
111
|
-
va.track("Referred from custom domain", {
|
|
112
|
-
domain,
|
|
113
|
-
medium: `navbar item (features/${slug})`,
|
|
114
|
-
});
|
|
115
|
-
},
|
|
116
|
-
})}
|
|
117
|
-
className="rounded-lg p-3 transition-colors hover:bg-gray-100 active:bg-gray-200"
|
|
118
|
-
>
|
|
119
|
-
<div className="flex items-center space-x-2">
|
|
120
|
-
<Icon className="h-4 w-4 text-gray-700" />
|
|
121
|
-
<p className="text-sm font-medium text-gray-700">
|
|
122
|
-
{shortTitle}
|
|
123
|
-
</p>
|
|
124
|
-
</div>
|
|
125
|
-
<p className="mt-1 line-clamp-1 text-sm text-gray-500">
|
|
126
|
-
{title}
|
|
127
|
-
</p>
|
|
128
|
-
</Link>
|
|
129
|
-
),
|
|
130
|
-
)}
|
|
131
|
-
</div>
|
|
132
|
-
</NavigationMenuPrimitive.Content>
|
|
133
|
-
</NavigationMenuPrimitive.Item>
|
|
134
|
-
|
|
135
|
-
{navItems.map(({ name, slug }) => (
|
|
136
|
-
<NavigationMenuPrimitive.Item key={slug} asChild>
|
|
137
|
-
<Link
|
|
138
|
-
id={`nav-${slug}`}
|
|
139
|
-
key={slug}
|
|
140
|
-
href={
|
|
141
|
-
domain === "dub.co"
|
|
142
|
-
? `/${slug}`
|
|
143
|
-
: `https://dub.co/${slug}`
|
|
144
|
-
}
|
|
145
|
-
{...(domain !== "dub.co" && {
|
|
146
|
-
onClick: () => {
|
|
147
|
-
va.track("Referred from custom domain", {
|
|
148
|
-
domain,
|
|
149
|
-
medium: `navbar item (${slug})`,
|
|
150
|
-
});
|
|
151
|
-
},
|
|
152
|
-
})}
|
|
153
|
-
className={cn(
|
|
154
|
-
"rounded-md px-3 py-2 text-sm font-medium text-gray-500 transition-colors ease-out hover:text-black",
|
|
155
|
-
{
|
|
156
|
-
"text-black": selectedLayout === slug,
|
|
157
|
-
},
|
|
158
|
-
)}
|
|
159
|
-
>
|
|
160
|
-
{name}
|
|
161
|
-
</Link>
|
|
162
|
-
</NavigationMenuPrimitive.Item>
|
|
163
|
-
))}
|
|
164
|
-
</NavigationMenuPrimitive.List>
|
|
165
|
-
|
|
166
|
-
<NavigationMenuPrimitive.Viewport className="data-[state=closed]:animate-scale-out-content data-[state=open]:animate-scale-in-content absolute left-0 top-full flex w-[var(--radix-navigation-menu-viewport-width)] origin-[top_center] justify-start rounded-lg border border-gray-200 bg-white shadow-lg" />
|
|
167
|
-
</NavigationMenuPrimitive.Root>
|
|
168
|
-
)}
|
|
169
|
-
</div>
|
|
170
|
-
|
|
171
|
-
<div className="hidden lg:block">
|
|
172
|
-
<Link
|
|
173
|
-
href={`${APP_DOMAIN}/login`}
|
|
174
|
-
{...(domain !== "dub.co" && {
|
|
175
|
-
onClick: () => {
|
|
176
|
-
va.track("Referred from custom domain", {
|
|
177
|
-
domain,
|
|
178
|
-
medium: `navbar item (login)`,
|
|
179
|
-
});
|
|
180
|
-
},
|
|
181
|
-
})}
|
|
182
|
-
className="animate-fade-in rounded-full px-4 py-1.5 text-sm font-medium text-gray-500 transition-colors ease-out hover:text-black"
|
|
183
|
-
>
|
|
184
|
-
Log in
|
|
185
|
-
</Link>
|
|
186
|
-
<Link
|
|
187
|
-
href={`${APP_DOMAIN}/register`}
|
|
188
|
-
{...(domain !== "dub.co" && {
|
|
189
|
-
onClick: () => {
|
|
190
|
-
va.track("Referred from custom domain", {
|
|
191
|
-
domain,
|
|
192
|
-
medium: `navbar item (signup)`,
|
|
193
|
-
});
|
|
194
|
-
},
|
|
195
|
-
})}
|
|
196
|
-
className="animate-fade-in rounded-full border border-black bg-black px-4 py-1.5 text-sm text-white transition-all hover:bg-white hover:text-black"
|
|
197
|
-
>
|
|
198
|
-
Sign Up
|
|
199
|
-
</Link>
|
|
200
|
-
</div>
|
|
201
|
-
</div>
|
|
202
|
-
</MaxWidthWrapper>
|
|
203
|
-
</div>
|
|
204
|
-
);
|
|
205
|
-
}
|
package/src/popover.tsx
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
4
|
-
import { Dispatch, ReactNode, SetStateAction } from "react";
|
|
5
|
-
import { Drawer } from "vaul";
|
|
6
|
-
import { useMediaQuery } from "./hooks";
|
|
7
|
-
|
|
8
|
-
export function Popover({
|
|
9
|
-
children,
|
|
10
|
-
content,
|
|
11
|
-
align = "center",
|
|
12
|
-
openPopover,
|
|
13
|
-
setOpenPopover,
|
|
14
|
-
mobileOnly,
|
|
15
|
-
}: {
|
|
16
|
-
children: ReactNode;
|
|
17
|
-
content: ReactNode | string;
|
|
18
|
-
align?: "center" | "start" | "end";
|
|
19
|
-
openPopover: boolean;
|
|
20
|
-
setOpenPopover: Dispatch<SetStateAction<boolean>>;
|
|
21
|
-
mobileOnly?: boolean;
|
|
22
|
-
}) {
|
|
23
|
-
const { isMobile } = useMediaQuery();
|
|
24
|
-
|
|
25
|
-
if (mobileOnly || isMobile) {
|
|
26
|
-
return (
|
|
27
|
-
<Drawer.Root open={openPopover} onOpenChange={setOpenPopover}>
|
|
28
|
-
<div className="sm:hidden">{children}</div>
|
|
29
|
-
<Drawer.Overlay className="fixed inset-0 z-40 bg-gray-100 bg-opacity-10 backdrop-blur" />
|
|
30
|
-
<Drawer.Portal>
|
|
31
|
-
<Drawer.Content className="fixed bottom-0 left-0 right-0 z-50 mt-24 rounded-t-[10px] border-t border-gray-200 bg-white">
|
|
32
|
-
<div className="sticky top-0 z-20 flex w-full items-center justify-center rounded-t-[10px] bg-inherit">
|
|
33
|
-
<div className="my-3 h-1 w-12 rounded-full bg-gray-300" />
|
|
34
|
-
</div>
|
|
35
|
-
<div className="flex min-h-[150px] w-full items-center justify-center overflow-hidden bg-white pb-8 align-middle shadow-xl">
|
|
36
|
-
{content}
|
|
37
|
-
</div>
|
|
38
|
-
</Drawer.Content>
|
|
39
|
-
<Drawer.Overlay />
|
|
40
|
-
</Drawer.Portal>
|
|
41
|
-
</Drawer.Root>
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<PopoverPrimitive.Root open={openPopover} onOpenChange={setOpenPopover}>
|
|
47
|
-
<PopoverPrimitive.Trigger className="sm:inline-flex" asChild>
|
|
48
|
-
{children}
|
|
49
|
-
</PopoverPrimitive.Trigger>
|
|
50
|
-
<PopoverPrimitive.Portal>
|
|
51
|
-
<PopoverPrimitive.Content
|
|
52
|
-
sideOffset={8}
|
|
53
|
-
align={align}
|
|
54
|
-
className="animate-slide-up-fade z-50 items-center rounded-md border border-gray-200 bg-white drop-shadow-lg sm:block"
|
|
55
|
-
>
|
|
56
|
-
{content}
|
|
57
|
-
</PopoverPrimitive.Content>
|
|
58
|
-
</PopoverPrimitive.Portal>
|
|
59
|
-
</PopoverPrimitive.Root>
|
|
60
|
-
);
|
|
61
|
-
}
|
package/src/styles.css
DELETED
package/src/switch.tsx
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { cn } from "@dub/utils";
|
|
4
|
-
import * as SwitchPrimitive from "@radix-ui/react-switch";
|
|
5
|
-
import { Dispatch, ReactNode, SetStateAction } from "react";
|
|
6
|
-
import { Tooltip } from "./tooltip";
|
|
7
|
-
|
|
8
|
-
export function Switch({
|
|
9
|
-
fn,
|
|
10
|
-
trackDimensions,
|
|
11
|
-
thumbDimensions,
|
|
12
|
-
thumbTranslate,
|
|
13
|
-
checked = true,
|
|
14
|
-
disabled = false,
|
|
15
|
-
disabledTooltip,
|
|
16
|
-
}: {
|
|
17
|
-
fn: Dispatch<SetStateAction<boolean>> | (() => void);
|
|
18
|
-
trackDimensions?: string;
|
|
19
|
-
thumbDimensions?: string;
|
|
20
|
-
thumbTranslate?: string;
|
|
21
|
-
checked?: boolean;
|
|
22
|
-
disabled?: boolean;
|
|
23
|
-
disabledTooltip?: string | ReactNode;
|
|
24
|
-
}) {
|
|
25
|
-
if (disabledTooltip) {
|
|
26
|
-
return (
|
|
27
|
-
<Tooltip content={disabledTooltip}>
|
|
28
|
-
<div className="radix-state-checked:bg-gray-300 relative inline-flex h-4 w-8 flex-shrink-0 cursor-not-allowed rounded-full border-2 border-transparent bg-gray-200">
|
|
29
|
-
<div className="h-3 w-3 transform rounded-full bg-white shadow-lg" />
|
|
30
|
-
</div>
|
|
31
|
-
</Tooltip>
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<SwitchPrimitive.Root
|
|
37
|
-
checked={checked}
|
|
38
|
-
name="switch"
|
|
39
|
-
onCheckedChange={(checked) => fn(checked)}
|
|
40
|
-
disabled={disabled}
|
|
41
|
-
className={cn(
|
|
42
|
-
disabled
|
|
43
|
-
? "cursor-not-allowed bg-gray-300"
|
|
44
|
-
: "radix-state-checked:bg-blue-500 radix-state-unchecked:bg-gray-200 cursor-pointer focus:outline-none focus-visible:ring focus-visible:ring-blue-500 focus-visible:ring-opacity-75",
|
|
45
|
-
"relative inline-flex h-4 w-8 flex-shrink-0 rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out",
|
|
46
|
-
trackDimensions,
|
|
47
|
-
)}
|
|
48
|
-
>
|
|
49
|
-
<SwitchPrimitive.Thumb
|
|
50
|
-
className={cn(
|
|
51
|
-
`radix-state-checked:${thumbTranslate}`,
|
|
52
|
-
"radix-state-unchecked:translate-x-0",
|
|
53
|
-
`pointer-events-none h-3 w-3 translate-x-4 transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out`,
|
|
54
|
-
thumbDimensions,
|
|
55
|
-
thumbTranslate,
|
|
56
|
-
)}
|
|
57
|
-
/>
|
|
58
|
-
</SwitchPrimitive.Root>
|
|
59
|
-
);
|
|
60
|
-
}
|
package/src/tab-select.tsx
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export function TabSelect({
|
|
2
|
-
options,
|
|
3
|
-
selected,
|
|
4
|
-
selectAction,
|
|
5
|
-
}: {
|
|
6
|
-
options: string[];
|
|
7
|
-
selected: string;
|
|
8
|
-
selectAction: (option: string) => void;
|
|
9
|
-
}) {
|
|
10
|
-
return (
|
|
11
|
-
<div className="relative inline-flex items-center space-x-3">
|
|
12
|
-
{options.map((option) => (
|
|
13
|
-
<button
|
|
14
|
-
key={option}
|
|
15
|
-
className={`${
|
|
16
|
-
option === selected
|
|
17
|
-
? "bg-gray-200 text-gray-800"
|
|
18
|
-
: "bg-gray-50 text-gray-600 hover:bg-gray-100"
|
|
19
|
-
} rounded-md px-2 py-1 text-sm font-medium capitalize transition-all duration-75 active:scale-90 sm:px-3`}
|
|
20
|
-
onClick={() => selectAction(option)}
|
|
21
|
-
>
|
|
22
|
-
{option}
|
|
23
|
-
</button>
|
|
24
|
-
))}
|
|
25
|
-
</div>
|
|
26
|
-
);
|
|
27
|
-
}
|
package/src/tooltip.tsx
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { nFormatter, timeAgo } from "@dub/utils";
|
|
4
|
-
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
5
|
-
import { HelpCircle } from "lucide-react";
|
|
6
|
-
import Link from "next/link";
|
|
7
|
-
import { ReactNode } from "react";
|
|
8
|
-
import { Drawer } from "vaul";
|
|
9
|
-
import { useMediaQuery } from "./hooks";
|
|
10
|
-
|
|
11
|
-
export function Tooltip({
|
|
12
|
-
children,
|
|
13
|
-
content,
|
|
14
|
-
fullWidth,
|
|
15
|
-
}: {
|
|
16
|
-
children: ReactNode;
|
|
17
|
-
content: ReactNode | string;
|
|
18
|
-
fullWidth?: boolean;
|
|
19
|
-
}) {
|
|
20
|
-
const { isMobile } = useMediaQuery();
|
|
21
|
-
|
|
22
|
-
if (isMobile) {
|
|
23
|
-
return (
|
|
24
|
-
<Drawer.Root>
|
|
25
|
-
<Drawer.Trigger
|
|
26
|
-
className={`${fullWidth ? "w-full" : "inline-flex"} md:hidden`}
|
|
27
|
-
onClick={(e) => {
|
|
28
|
-
e.stopPropagation();
|
|
29
|
-
}}
|
|
30
|
-
>
|
|
31
|
-
{children}
|
|
32
|
-
</Drawer.Trigger>
|
|
33
|
-
<Drawer.Overlay className="fixed inset-0 z-40 bg-gray-100 bg-opacity-10 backdrop-blur" />
|
|
34
|
-
<Drawer.Portal>
|
|
35
|
-
<Drawer.Content className="fixed bottom-0 left-0 right-0 z-50 mt-24 rounded-t-[10px] border-t border-gray-200 bg-white">
|
|
36
|
-
<div className="sticky top-0 z-20 flex w-full items-center justify-center rounded-t-[10px] bg-inherit">
|
|
37
|
-
<div className="my-3 h-1 w-12 rounded-full bg-gray-300" />
|
|
38
|
-
</div>
|
|
39
|
-
<div className="flex min-h-[150px] w-full items-center justify-center overflow-hidden bg-white align-middle shadow-xl">
|
|
40
|
-
{typeof content === "string" ? (
|
|
41
|
-
<span className="block text-center text-sm text-gray-700">
|
|
42
|
-
{content}
|
|
43
|
-
</span>
|
|
44
|
-
) : (
|
|
45
|
-
content
|
|
46
|
-
)}
|
|
47
|
-
</div>
|
|
48
|
-
</Drawer.Content>
|
|
49
|
-
<Drawer.Overlay />
|
|
50
|
-
</Drawer.Portal>
|
|
51
|
-
</Drawer.Root>
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
return (
|
|
55
|
-
<TooltipPrimitive.Provider delayDuration={100}>
|
|
56
|
-
<TooltipPrimitive.Root>
|
|
57
|
-
<TooltipPrimitive.Trigger className="md:inline-flex" asChild>
|
|
58
|
-
{children}
|
|
59
|
-
</TooltipPrimitive.Trigger>
|
|
60
|
-
{/*
|
|
61
|
-
We don't use TooltipPrimitive.Portal here because for some reason it
|
|
62
|
-
prevents you from selecting the contents of a tooltip when used inside a modal
|
|
63
|
-
*/}
|
|
64
|
-
<TooltipPrimitive.Content
|
|
65
|
-
sideOffset={8}
|
|
66
|
-
side="top"
|
|
67
|
-
className="animate-slide-up-fade z-[99] items-center overflow-hidden rounded-md border border-gray-200 bg-white shadow-md md:block"
|
|
68
|
-
>
|
|
69
|
-
{typeof content === "string" ? (
|
|
70
|
-
<div className="block max-w-xs px-4 py-2 text-center text-sm text-gray-700">
|
|
71
|
-
{content}
|
|
72
|
-
</div>
|
|
73
|
-
) : (
|
|
74
|
-
content
|
|
75
|
-
)}
|
|
76
|
-
</TooltipPrimitive.Content>
|
|
77
|
-
</TooltipPrimitive.Root>
|
|
78
|
-
</TooltipPrimitive.Provider>
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export function TooltipContent({
|
|
83
|
-
title,
|
|
84
|
-
cta,
|
|
85
|
-
href,
|
|
86
|
-
target,
|
|
87
|
-
onClick,
|
|
88
|
-
}: {
|
|
89
|
-
title: string;
|
|
90
|
-
cta?: string;
|
|
91
|
-
href?: string;
|
|
92
|
-
target?: string;
|
|
93
|
-
onClick?: () => void;
|
|
94
|
-
}) {
|
|
95
|
-
return (
|
|
96
|
-
<div className="flex flex-col items-center space-y-3 p-4 text-center md:max-w-xs">
|
|
97
|
-
<p className="text-sm text-gray-700">{title}</p>
|
|
98
|
-
{cta &&
|
|
99
|
-
(href ? (
|
|
100
|
-
<Link
|
|
101
|
-
href={href}
|
|
102
|
-
{...(target ? { target } : {})}
|
|
103
|
-
className="mt-4 w-full rounded-md border border-black bg-black px-3 py-1.5 text-center text-sm text-white transition-all hover:bg-white hover:text-black"
|
|
104
|
-
>
|
|
105
|
-
{cta}
|
|
106
|
-
</Link>
|
|
107
|
-
) : onClick ? (
|
|
108
|
-
<button
|
|
109
|
-
type="button"
|
|
110
|
-
className="mt-4 w-full rounded-md border border-black bg-black px-3 py-1.5 text-center text-sm text-white transition-all hover:bg-white hover:text-black"
|
|
111
|
-
onClick={onClick}
|
|
112
|
-
>
|
|
113
|
-
{cta}
|
|
114
|
-
</button>
|
|
115
|
-
) : null)}
|
|
116
|
-
</div>
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export function SimpleTooltipContent({
|
|
121
|
-
title,
|
|
122
|
-
cta,
|
|
123
|
-
href,
|
|
124
|
-
}: {
|
|
125
|
-
title: string;
|
|
126
|
-
cta: string;
|
|
127
|
-
href: string;
|
|
128
|
-
}) {
|
|
129
|
-
return (
|
|
130
|
-
<div className="max-w-xs px-4 py-2 text-center text-sm text-gray-700">
|
|
131
|
-
{title}{" "}
|
|
132
|
-
<a
|
|
133
|
-
href={href}
|
|
134
|
-
target="_blank"
|
|
135
|
-
rel="noopener noreferrer"
|
|
136
|
-
className="inline-flex text-gray-500 underline underline-offset-4 hover:text-gray-800"
|
|
137
|
-
>
|
|
138
|
-
{cta}
|
|
139
|
-
</a>
|
|
140
|
-
</div>
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export function InfoTooltip({ content }: { content: ReactNode | string }) {
|
|
145
|
-
return (
|
|
146
|
-
<Tooltip content={content}>
|
|
147
|
-
<HelpCircle className="h-4 w-4 text-gray-500" />
|
|
148
|
-
</Tooltip>
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export function NumberTooltip({
|
|
153
|
-
value,
|
|
154
|
-
unit = "total clicks",
|
|
155
|
-
children,
|
|
156
|
-
lastClicked,
|
|
157
|
-
}: {
|
|
158
|
-
value?: number | null;
|
|
159
|
-
unit?: string;
|
|
160
|
-
children: ReactNode;
|
|
161
|
-
lastClicked?: Date | null;
|
|
162
|
-
}) {
|
|
163
|
-
if ((!value || value < 1000) && !lastClicked) {
|
|
164
|
-
return children;
|
|
165
|
-
}
|
|
166
|
-
return (
|
|
167
|
-
<Tooltip
|
|
168
|
-
content={
|
|
169
|
-
<div className="block max-w-xs px-4 py-2 text-center text-sm text-gray-700">
|
|
170
|
-
<p className="text-sm font-semibold text-gray-700">
|
|
171
|
-
{nFormatter(value || 0, { full: true })} {unit}
|
|
172
|
-
</p>
|
|
173
|
-
{lastClicked && (
|
|
174
|
-
<p className="mt-1 text-xs text-gray-500">
|
|
175
|
-
Last clicked {timeAgo(lastClicked, { withAgo: true })}
|
|
176
|
-
</p>
|
|
177
|
-
)}
|
|
178
|
-
</div>
|
|
179
|
-
}
|
|
180
|
-
>
|
|
181
|
-
{children}
|
|
182
|
-
</Tooltip>
|
|
183
|
-
);
|
|
184
|
-
}
|
package/tailwind.config.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// tailwind config is required for editor support
|
|
2
|
-
import sharedConfig from "@dub/tailwind-config/tailwind.config.ts";
|
|
3
|
-
import type { Config } from "tailwindcss";
|
|
4
|
-
|
|
5
|
-
const config: Pick<Config, "presets"> = {
|
|
6
|
-
presets: [sharedConfig],
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export default config;
|
package/tsconfig.json
DELETED
package/tsup.config.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { defineConfig, Options } from "tsup";
|
|
2
|
-
|
|
3
|
-
export default defineConfig((options: Options) => ({
|
|
4
|
-
entry: ["src/**/*.tsx"],
|
|
5
|
-
format: ["esm"],
|
|
6
|
-
esbuildOptions(options) {
|
|
7
|
-
options.banner = {
|
|
8
|
-
js: '"use client"',
|
|
9
|
-
};
|
|
10
|
-
},
|
|
11
|
-
dts: true,
|
|
12
|
-
minify: true,
|
|
13
|
-
external: ["react"],
|
|
14
|
-
...options,
|
|
15
|
-
}));
|