@dub/ui 0.0.8 → 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.
Files changed (134) hide show
  1. package/README.md +11 -0
  2. package/dist/accordion.d.mts +9 -0
  3. package/dist/accordion.mjs +1 -1
  4. package/dist/avatar.d.mts +15 -0
  5. package/dist/avatar.mjs +1 -1
  6. package/dist/background.d.mts +5 -0
  7. package/dist/background.mjs +1 -1
  8. package/dist/badge.d.mts +12 -0
  9. package/dist/badge.mjs +1 -1
  10. package/dist/button.d.mts +13 -0
  11. package/dist/button.mjs +1 -1
  12. package/dist/chunk-3Y5WGFFC.mjs +2 -0
  13. package/dist/chunk-4Y22ZONT.mjs +2 -0
  14. package/dist/chunk-B7YPSVHM.mjs +2 -0
  15. package/dist/chunk-BCILXFZH.mjs +2 -0
  16. package/dist/chunk-BZY4AURF.mjs +2 -0
  17. package/dist/chunk-HZBYDQAF.mjs +2 -0
  18. package/dist/chunk-IMRGY4OW.mjs +2 -0
  19. package/dist/chunk-JF4XLNZS.mjs +2 -0
  20. package/dist/chunk-OIIHWZYP.mjs +2 -0
  21. package/dist/chunk-S32PKYSI.mjs +8 -0
  22. package/dist/chunk-XG3NPZVV.mjs +2 -0
  23. package/dist/copy-button.d.mts +8 -0
  24. package/dist/copy-button.mjs +1 -1
  25. package/dist/footer.d.mts +5 -0
  26. package/dist/footer.mjs +1 -1
  27. package/dist/form.d.mts +14 -0
  28. package/dist/form.mjs +1 -1
  29. package/dist/icon-menu.d.mts +10 -0
  30. package/dist/icon-menu.mjs +1 -1
  31. package/dist/icons/copy.d.mts +7 -0
  32. package/dist/icons/copy.mjs +1 -1
  33. package/dist/icons/expanding-arrow.d.mts +7 -0
  34. package/dist/icons/expanding-arrow.mjs +1 -1
  35. package/dist/icons/facebook.d.mts +8 -0
  36. package/dist/icons/facebook.mjs +1 -1
  37. package/dist/icons/github.d.mts +7 -0
  38. package/dist/icons/github.mjs +1 -1
  39. package/dist/icons/google.d.mts +7 -0
  40. package/dist/icons/google.mjs +1 -1
  41. package/dist/icons/index.d.mts +17 -0
  42. package/dist/icons/index.mjs +1 -1
  43. package/dist/icons/linkedin.d.mts +8 -0
  44. package/dist/icons/linkedin.mjs +1 -1
  45. package/dist/icons/loading-circle.d.mts +7 -0
  46. package/dist/icons/loading-circle.mjs +1 -1
  47. package/dist/icons/loading-dots.d.mts +5 -0
  48. package/dist/icons/loading-dots.mjs +1 -1
  49. package/dist/icons/loading-spinner.d.mts +7 -0
  50. package/dist/icons/loading-spinner.mjs +1 -1
  51. package/dist/icons/logo.d.mts +7 -0
  52. package/dist/icons/logo.mjs +1 -1
  53. package/dist/icons/logotype.d.mts +7 -0
  54. package/dist/icons/logotype.mjs +1 -1
  55. package/dist/icons/magic.d.mts +7 -0
  56. package/dist/icons/magic.mjs +1 -1
  57. package/dist/icons/photo.d.mts +7 -0
  58. package/dist/icons/photo.mjs +1 -1
  59. package/dist/icons/tick.d.mts +7 -0
  60. package/dist/icons/tick.mjs +1 -1
  61. package/dist/icons/twitter.d.mts +7 -0
  62. package/dist/icons/twitter.mjs +1 -1
  63. package/dist/icons/unsplash.d.mts +7 -0
  64. package/dist/icons/unsplash.mjs +1 -1
  65. package/dist/index.d.mts +69 -0
  66. package/dist/index.mjs +1 -1
  67. package/dist/link-preview.d.mts +7 -0
  68. package/dist/link-preview.mjs +1 -1
  69. package/dist/max-width-wrapper.d.mts +9 -0
  70. package/dist/max-width-wrapper.mjs +1 -1
  71. package/dist/modal.d.mts +14 -0
  72. package/dist/modal.mjs +1 -1
  73. package/dist/nav-mobile.d.mts +5 -0
  74. package/dist/nav-mobile.mjs +1 -1
  75. package/dist/nav.d.mts +9 -0
  76. package/dist/nav.mjs +1 -1
  77. package/dist/popover.d.mts +13 -0
  78. package/dist/popover.mjs +1 -1
  79. package/dist/switch.d.mts +14 -0
  80. package/dist/switch.mjs +1 -1
  81. package/dist/tab-select.d.mts +9 -0
  82. package/dist/tab-select.mjs +1 -1
  83. package/dist/tooltip.d.mts +32 -0
  84. package/dist/tooltip.mjs +1 -1
  85. package/package.json +13 -14
  86. package/.turbo/turbo-build.log +0 -123
  87. package/postcss.config.js +0 -9
  88. package/src/accordion.tsx +0 -60
  89. package/src/avatar.tsx +0 -47
  90. package/src/background.tsx +0 -71
  91. package/src/badge.tsx +0 -33
  92. package/src/button.tsx +0 -60
  93. package/src/content.ts +0 -34
  94. package/src/copy-button.tsx +0 -39
  95. package/src/footer.tsx +0 -204
  96. package/src/form.tsx +0 -77
  97. package/src/hooks/index.ts +0 -5
  98. package/src/hooks/use-current-anchor.ts +0 -65
  99. package/src/hooks/use-intersection-observer.ts +0 -41
  100. package/src/hooks/use-local-storage.ts +0 -24
  101. package/src/hooks/use-media-query.ts +0 -46
  102. package/src/hooks/use-scroll.ts +0 -21
  103. package/src/icon-menu.tsx +0 -15
  104. package/src/icons/copy.tsx +0 -18
  105. package/src/icons/expanding-arrow.tsx +0 -39
  106. package/src/icons/facebook.tsx +0 -23
  107. package/src/icons/github.tsx +0 -14
  108. package/src/icons/google.tsx +0 -12
  109. package/src/icons/index.tsx +0 -23
  110. package/src/icons/linkedin.tsx +0 -22
  111. package/src/icons/loading-circle.tsx +0 -25
  112. package/src/icons/loading-dots.tsx +0 -21
  113. package/src/icons/loading-spinner.tsx +0 -34
  114. package/src/icons/logo.tsx +0 -29
  115. package/src/icons/logotype.tsx +0 -51
  116. package/src/icons/magic.tsx +0 -30
  117. package/src/icons/photo.tsx +0 -20
  118. package/src/icons/tick.tsx +0 -18
  119. package/src/icons/twitter.tsx +0 -31
  120. package/src/icons/unsplash.tsx +0 -17
  121. package/src/index.tsx +0 -35
  122. package/src/link-preview.tsx +0 -111
  123. package/src/max-width-wrapper.tsx +0 -21
  124. package/src/modal.tsx +0 -102
  125. package/src/nav-mobile.tsx +0 -108
  126. package/src/nav.tsx +0 -205
  127. package/src/popover.tsx +0 -61
  128. package/src/styles.css +0 -3
  129. package/src/switch.tsx +0 -60
  130. package/src/tab-select.tsx +0 -27
  131. package/src/tooltip.tsx +0 -184
  132. package/tailwind.config.ts +0 -9
  133. package/tsconfig.json +0 -5
  134. 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={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
- }
@@ -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
@@ -1,5 +0,0 @@
1
- {
2
- "extends": "tsconfig/react-library.json",
3
- "include": ["."],
4
- "exclude": ["dist", "build", "node_modules"]
5
- }
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
- }));