@dub/ui 0.0.7 → 0.0.9
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-3Y5WGFFC.mjs +2 -0
- package/dist/chunk-4Y22ZONT.mjs +2 -0
- package/dist/chunk-B7YPSVHM.mjs +2 -0
- package/dist/chunk-BCILXFZH.mjs +2 -0
- package/dist/chunk-BIFPQJQ5.mjs +2 -0
- package/dist/chunk-BZY4AURF.mjs +2 -0
- package/dist/chunk-CMCBEA3Q.mjs +2 -0
- package/dist/chunk-HZBYDQAF.mjs +2 -0
- package/dist/chunk-IMRGY4OW.mjs +2 -0
- package/dist/chunk-JF4XLNZS.mjs +2 -0
- package/dist/chunk-MRCUHGHS.mjs +2 -0
- package/dist/chunk-OCYEAVPN.mjs +2 -0
- package/dist/chunk-OIIHWZYP.mjs +2 -0
- package/dist/chunk-S32PKYSI.mjs +8 -0
- package/dist/chunk-XG3NPZVV.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/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={0}>
|
|
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
|
-
}));
|