Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

improved Accordion UI, added UTM builder

Steven Tey0bda0754e141
diff --git a/components/app/modals/add-edit-link-modal/advanced-settings.tsx b/components/app/modals/add-edit-link-modal/advanced-settings.tsx
index df346193df..4c10d1e39b 100644
--- a/components/app/modals/add-edit-link-modal/advanced-settings.tsx
+++ b/components/app/modals/add-edit-link-modal/advanced-settings.tsx
@@ -1,14 +1,20 @@
-import { Dispatch, SetStateAction, useCallback, useState } from "react";
-import TextareaAutosize from "react-textarea-autosize";
-import BlurImage from "@/components/shared/blur-image";
-import {
- ChevronRight,
- LoadingCircle,
- UploadCloud,
-} from "@/components/shared/icons";
+import { Dispatch, SetStateAction, useMemo, useState } from "react";
+import * as AccordionPrimitive from "@radix-ui/react-accordion";
+import { motion } from "framer-motion";
+import { CheckCircleFill, ChevronRight } from "@/components/shared/icons";
import { LinkProps } from "@/lib/types";
-import { getDateTimeLocal } from "@/lib/utils";
+import { getParamsFromURL } from "@/lib/utils";
+import ExpirationSection from "./expiration-section";
import OGSection from "./og-section";
+import PasswordSection from "./password-section";
+import UTMSection from "./utm-section";
+
+export const AnimationSettings = {
+ initial: { height: 0 },
+ animate: { height: "auto" },
+ exit: { height: 0 },
+ transition: { duration: 0.2, bounce: 0 },
+};
export default function AdvancedSettings({
data,
@@ -19,14 +25,18 @@ export default function AdvancedSettings({
}) {
const [expanded, setExpanded] = useState(false);
- const { password, expiresAt } = data;
+ const { url, title, description, image, password, expiresAt } = data;
+
+ const { utm_source, utm_medium, utm_campaign } = useMemo(() => {
+ return getParamsFromURL(url);
+ }, [url]);
return (
<div>
<div className="sm:px-16 px-4">
<button
type="button"
- className="flex items-center"
+ className="flex items-center space-x-2"
onClick={() => setExpanded(!expanded)}
>
<ChevronRight
@@ -39,61 +49,111 @@ export default function AdvancedSettings({
</div>
{expanded && (
- <div className="mt-4 grid gap-5 bg-white border-t border-b border-gray-200 sm:px-16 px-4 py-8">
- {/* OG Tags Section */}
- <OGSection {...{ data, setData }} />
+ <motion.div key="accordion-root" {...AnimationSettings}>
+ <AccordionPrimitive.Root
+ type="single"
+ collapsible={true}
+ className="mt-4 grid bg-white border-t border-b border-gray-200 px-2 sm:px-8 py-8"
+ >
+ {/* UTM Builder Section */}
+ <AccordionPrimitive.Item
+ value="utm"
+ className="border border-gray-200 rounded-t-lg py-3"
+ >
+ <AccordionPrimitive.Header className="px-5">
+ <AccordionPrimitive.Trigger className="group focus:outline-black flex w-full items-center justify-between space-x-2 bg-white py-2 text-left dark:bg-gray-800">
+ <div className="flex items-center justify-start space-x-2 h-6">
+ <ChevronRight className="h-5 w-5 shrink-0 text-gray-700 ease-in-out dark:text-gray-400 group-radix-state-open:rotate-90 transition-all" />
+ <span className="text-sm font-medium text-gray-900 dark:text-gray-100">
+ UTM Builder
+ </span>
+ </div>
+ {utm_source && utm_medium && utm_campaign && (
+ <CheckCircleFill className="h-6 w-6 text-black" />
+ )}
+ </AccordionPrimitive.Trigger>
+ </AccordionPrimitive.Header>
+ <AccordionPrimitive.Content>
+ <UTMSection {...{ data, setData }} />
+ </AccordionPrimitive.Content>
+ </AccordionPrimitive.Item>
+
+ {/* Password Protection */}
+ <AccordionPrimitive.Item
+ value="password"
+ className="border border-gray-200 border-t-0 px-5 py-3"
+ >
+ <AccordionPrimitive.Header>
+ <AccordionPrimitive.Trigger className="group focus:outline-black flex w-full items-center justify-between space-x-2 bg-white py-2 text-left dark:bg-gray-800">
+ <div className="flex items-center justify-start space-x-2 h-6">
+ <ChevronRight className="h-5 w-5 shrink-0 text-gray-700 ease-in-out dark:text-gray-400 group-radix-state-open:rotate-90 transition-all" />
+ <span className="text-sm font-medium text-gray-900 dark:text-gray-100">
+ Password Protection
+ </span>
+ </div>
+ {password && (
+ <CheckCircleFill className="h-6 w-6 text-black" />
+ )}
+ </AccordionPrimitive.Trigger>
+ </AccordionPrimitive.Header>
+ <AccordionPrimitive.Content>
+ <PasswordSection {...{ data, setData }} />
+ </AccordionPrimitive.Content>
+ </AccordionPrimitive.Item>
- {/* Password Protection */}
- <div>
- <label
- htmlFor="password"
- className="block text-sm font-medium text-gray-700"
+ {/* Expiration Date */}
+ <AccordionPrimitive.Item
+ value="expire"
+ className="border border-gray-200 border-t-0 border-b-0 px-5 py-3"
>
- Password Protection
- </label>
- <div className="flex mt-1 rounded-md shadow-sm">
- <input
- name="password"
- id="password"
- type="password"
- className="border-gray-300 text-gray-900 placeholder-gray-300 focus:border-gray-500 focus:ring-gray-500 block w-full rounded-md focus:outline-none sm:text-sm"
- value={password}
- onChange={(e) => {
- setData({ ...data, password: e.target.value });
- }}
- aria-invalid="true"
- />
- </div>
- </div>
+ <AccordionPrimitive.Header>
+ <AccordionPrimitive.Trigger className="group focus:outline-black flex w-full items-center justify-between space-x-2 bg-white py-2 text-left dark:bg-gray-800">
+ <div className="flex items-center justify-start space-x-2 h-6">
+ <ChevronRight className="h-5 w-5 shrink-0 text-gray-700 ease-in-out dark:text-gray-400 group-radix-state-open:rotate-90 transition-all" />
+ <span className="text-sm font-medium text-gray-900 dark:text-gray-100">
+ Expiration Date
+ </span>
+ {expiresAt &&
+ new Date().getTime() > new Date(expiresAt).getTime() && (
+ <span className="bg-amber-500 px-2 py-0.5 text-xs text-white uppercase">
+ Expired
+ </span>
+ )}
+ </div>
+ {expiresAt && (
+ <CheckCircleFill className="h-6 w-6 text-black" />
+ )}
+ </AccordionPrimitive.Trigger>
+ </AccordionPrimitive.Header>
+ <AccordionPrimitive.Content>
+ <ExpirationSection {...{ data, setData }} />
+ </AccordionPrimitive.Content>
+ </AccordionPrimitive.Item>
- {/* Expire Link */}
- <div>
- <label
- htmlFor="expiresAt"
- className="flex justify-between text-sm font-medium text-gray-700"
+ {/* OG Tags Section */}
+ <AccordionPrimitive.Item
+ value="og"
+ className="border border-gray-200 rounded-b-lg px-5 py-3"
>
- <p>Auto-expire Link</p>
- {expiresAt &&
- new Date().getTime() > new Date(expiresAt).getTime() && (
- <span className="bg-amber-500 px-2 py-0.5 text-xs text-white uppercase">
- Expired
- </span>
- )}
- </label>
- <input
- type="datetime-local"
- id="expiresAt"
- name="expiresAt"
- min={getDateTimeLocal()}
- value={expiresAt ? getDateTimeLocal(expiresAt) : ""}
- step="60" // need to add step to prevent weird date bug (https://stackoverflow.com/q/19284193/10639526)
- onChange={(e) => {
- setData({ ...data, expiresAt: new Date(e.target.value) });
- }}
- className="flex space-x-2 justify-center items-center mt-1 rounded-md shadow-sm border border-gray-300 text-gray-500 hover:border-gray-800 px-3 py-2 w-full focus:outline-none sm:text-sm transition-all"
- />
- </div>
- </div>
+ <AccordionPrimitive.Header>
+ <AccordionPrimitive.Trigger className="group focus:outline-black flex w-full items-center justify-between space-x-2 bg-white py-2 text-left dark:bg-gray-800">
+ <div className="flex items-center justify-start space-x-2 h-6">
+ <ChevronRight className="h-5 w-5 shrink-0 text-gray-700 ease-in-out dark:text-gray-400 group-radix-state-open:rotate-90 transition-all" />
+ <span className="text-sm font-medium text-gray-900 dark:text-gray-100">
+ Custom OG Tags
+ </span>
+ </div>
+ {title && description && image && (
+ <CheckCircleFill className="h-6 w-6 text-black" />
+ )}
+ </AccordionPrimitive.Trigger>
+ </AccordionPrimitive.Header>
+ <AccordionPrimitive.Content>
+ <OGSection {...{ data, setData }} />
+ </AccordionPrimitive.Content>
+ </AccordionPrimitive.Item>
+ </AccordionPrimitive.Root>
+ </motion.div>
)}
</div>
);
diff --git a/components/app/modals/add-edit-link-modal/expiration-section.tsx b/components/app/modals/add-edit-link-modal/expiration-section.tsx
new file mode 100644
index 0000000000..64d3f57fd3
--- /dev/null
+++ b/components/app/modals/add-edit-link-modal/expiration-section.tsx
@@ -0,0 +1,47 @@
+import { Dispatch, SetStateAction } from "react";
+import { motion } from "framer-motion";
+import { X } from "@/components/shared/icons";
+import { LinkProps } from "@/lib/types";
+import { getDateTimeLocal } from "@/lib/utils";
+import { AnimationSettings } from "./advanced-settings";
+
+export default function ExpireSection({
+ data,
+ setData,
+}: {
+ data: LinkProps;
+ setData: Dispatch<SetStateAction<LinkProps>>;
+}) {
+ const { expiresAt } = data;
+ return (
+ <motion.div key="expire" {...AnimationSettings}>
+ <div>
+ <label htmlFor="expiresAt" className="block my-2 text-sm text-gray-500">
+ Automatically expires your link at a given date and time. Your link
+ will be disabled but the data will still be kept.
+ </label>
+ <div className="flex space-x-2 mb-3">
+ <input
+ type="datetime-local"
+ id="expiresAt"
+ name="expiresAt"
+ min={getDateTimeLocal()}
+ value={expiresAt ? getDateTimeLocal(expiresAt) : ""}
+ step="60" // need to add step to prevent weird date bug (https://stackoverflow.com/q/19284193/10639526)
+ onChange={(e) => {
+ setData({ ...data, expiresAt: new Date(e.target.value) });
+ }}
+ className="flex space-x-2 justify-center items-center rounded-md shadow-sm border border-gray-300 text-gray-500 hover:border-gray-800 px-3 py-2 w-full focus:outline-none sm:text-sm transition-all"
+ />
+ <button
+ onClick={() => setData({ ...data, expiresAt: null })}
+ type="button"
+ className="group rounded-md border w-10 h-10 flex justify-center items-center text-gray-500 hover:text-gray-800 hover:border-gray-800 focus:outline-none transition-all"
+ >
+ <X className="text-gray-400 w-4 h-4 group-hover:text-black transition-all" />
+ </button>
+ </div>
+ </div>
+ </motion.div>
+ );
+}
diff --git a/components/app/modals/add-edit-link-modal/index.tsx b/components/app/modals/add-edit-link-modal/index.tsx
index de20cbcf7f..6348c7b41b 100644
--- a/components/app/modals/add-edit-link-modal/index.tsx
+++ b/components/app/modals/add-edit-link-modal/index.tsx
@@ -53,12 +53,6 @@ function AddEditLinkModal({
description: null,
image: null,
- utm_source: null,
- utm_medium: null,
- utm_campaign: null,
- utm_term: null,
- utm_content: null,
-
clicks: 0,
userId: "",
createdAt: new Date(),
diff --git a/components/app/modals/add-edit-link-modal/og-section.tsx b/components/app/modals/add-edit-link-modal/og-section.tsx
index da7b231738..7f59a63f5a 100644
--- a/components/app/modals/add-edit-link-modal/og-section.tsx
+++ b/components/app/modals/add-edit-link-modal/og-section.tsx
@@ -1,8 +1,10 @@
import { Dispatch, SetStateAction, useCallback, useState } from "react";
+import { motion } from "framer-motion";
import TextareaAutosize from "react-textarea-autosize";
import BlurImage from "@/components/shared/blur-image";
import { LoadingCircle, UploadCloud } from "@/components/shared/icons";
import { LinkProps } from "@/lib/types";
+import { AnimationSettings } from "./advanced-settings";
export default function OGSection({
data,
@@ -11,7 +13,6 @@ export default function OGSection({
data: LinkProps;
setData: Dispatch<SetStateAction<LinkProps>>;
}) {
- const [expanded, setExpanded] = useState(false);
const [generatingTitle, setGeneratingTitle] = useState(false);
const [generatingDescription, setGeneratingDescription] = useState(false);
@@ -51,8 +52,15 @@ export default function OGSection({
[setData],
);
return (
- <>
- <div>
+ <motion.div key="og" className="grid gap-5" {...AnimationSettings}>
+ <p className="block mt-2 text-sm text-gray-500 px-5">
+ If you use custom OG tags,{" "}
+ <span className="font-semibold text-black">
+ be sure to set all 3 tags
+ </span>
+ , or the default tags of the target URL will be used.
+ </p>
+ <div className="border-t border-gray-200 px-5 pt-5 pb-2.5">
<div className="flex justify-between items-center">
<label
htmlFor="title"
@@ -80,7 +88,7 @@ export default function OGSection({
id="title"
minRows={3}
className="border-gray-300 text-gray-900 placeholder-gray-300 focus:border-gray-500 focus:ring-gray-500 pr-10 block w-full rounded-md focus:outline-none sm:text-sm"
- placeholder="Dub - an open-source link shortener SaaS with built-in analytics + free custom domains."
+ placeholder="Dub - Open Source Bitly Alternative"
value={title}
onChange={(e) => {
setData({ ...data, title: e.target.value });
@@ -89,7 +97,8 @@ export default function OGSection({
/>
</div>
</div>
- <div>
+
+ <div className="border-t border-gray-200 px-5 pt-5 pb-2.5">
<div className="flex justify-between items-center">
<label
htmlFor="description"
@@ -131,7 +140,7 @@ export default function OGSection({
</div>
</div>
- <div>
+ <div className="border-t border-gray-200 px-5 pt-5 pb-2.5">
<p className="block text-sm font-medium text-gray-700">OG Image</p>
<label
htmlFor="image"
@@ -173,6 +182,6 @@ export default function OGSection({
/>
</div>
</div>
- </>
+ </motion.div>
);
}
diff --git a/components/app/modals/add-edit-link-modal/password-section.tsx b/components/app/modals/add-edit-link-modal/password-section.tsx
new file mode 100644
index 0000000000..c00746633e
--- /dev/null
+++ b/components/app/modals/add-edit-link-modal/password-section.tsx
@@ -0,0 +1,35 @@
+import { Dispatch, SetStateAction } from "react";
+import { motion } from "framer-motion";
+import { LinkProps } from "@/lib/types";
+import { AnimationSettings } from "./advanced-settings";
+
+export default function PasswordSection({
+ data,
+ setData,
+}: {
+ data: LinkProps;
+ setData: Dispatch<SetStateAction<LinkProps>>;
+}) {
+ const { password } = data;
+ return (
+ <motion.div key="password" {...AnimationSettings}>
+ <label htmlFor="password" className="block my-2 text-sm text-gray-500">
+ Protect your links with a password. Users will need to enter the
+ password to access the link.
+ </label>
+ <div className="flex rounded-md shadow-sm mb-3">
+ <input
+ name="password"
+ id="password"
+ type="password"
+ className="border-gray-300 text-gray-900 placeholder-gray-300 focus:border-gray-500 focus:ring-gray-500 block w-full rounded-md focus:outline-none sm:text-sm"
+ value={password}
+ onChange={(e) => {
+ setData({ ...data, password: e.target.value });
+ }}
+ aria-invalid="true"
+ />
+ </div>
+ </motion.div>
+ );
+}
diff --git a/components/app/modals/add-edit-link-modal/utm-section.tsx b/components/app/modals/add-edit-link-modal/utm-section.tsx
new file mode 100644
index 0000000000..8d651f9082
--- /dev/null
+++ b/components/app/modals/add-edit-link-modal/utm-section.tsx
@@ -0,0 +1,78 @@
+import { Dispatch, SetStateAction, useMemo } from "react";
+import { motion } from "framer-motion";
+import TextareaAutosize from "react-textarea-autosize";
+import { LinkProps } from "@/lib/types";
+import { constructURLFromUTMParams, getParamsFromURL } from "@/lib/utils";
+import { AnimationSettings } from "./advanced-settings";
+
+const paramsMetadata = [
+ { display: "Source", key: "utm_source", examples: "twitter, facebook" },
+ { display: "Medium", key: "utm_medium", examples: "social, email" },
+ { display: "Campaign", key: "utm_campaign", examples: "summer_sale" },
+ { display: "Term", key: "utm_term", examples: "blue_shoes" },
+ { display: "Content", key: "utm_content", examples: "logolink" },
+];
+
+export default function UTMSection({
+ data,
+ setData,
+}: {
+ data: LinkProps;
+ setData: Dispatch<SetStateAction<LinkProps>>;
+}) {
+ const { url } = data;
+ const isValidUrl = useMemo(() => {
+ try {
+ new URL(url);
+ return true;
+ } catch (e) {
+ return false;
+ }
+ }, [url]);
+
+ const params = useMemo(() => {
+ return getParamsFromURL(url);
+ }, [url]);
+
+ return (
+ <motion.div key="og" className="grid gap-5" {...AnimationSettings}>
+ <p className="block mt-2 text-sm text-gray-500 px-5">
+ If you use custom OG tags,{" "}
+ <span className="font-semibold text-black">
+ be sure to set the source, medium, and campaign
+ </span>
+ .
+ </p>
+ <div className="border-t border-gray-200 px-5 pt-5 pb-2.5 grid gap-3">
+ {paramsMetadata.map(({ display, key, examples }) => (
+ <div key={key} className="relative flex mt-1 rounded-md shadow-sm">
+ <span className="flex justify-center items-center rounded-l-md border border-r-0 border-gray-300 bg-gray-50 w-40 text-gray-500 sm:text-sm whitespace-nowrap">
+ {display}
+ </span>
+ <input
+ type="text"
+ name={key}
+ id={key}
+ required
+ disabled={!isValidUrl}
+ className={`${
+ isValidUrl ? "" : "cursor-not-allowed bg-gray-100"
+ } border-gray-300 text-gray-900 placeholder-gray-300 focus:border-gray-500 focus:ring-gray-500 block w-full rounded-r-md focus:outline-none sm:text-sm`}
+ placeholder={examples}
+ value={params[key]}
+ onChange={(e) => {
+ setData({
+ ...data,
+ url: constructURLFromUTMParams(url, {
+ ...params,
+ [key]: e.target.value,
+ }),
+ });
+ }}
+ />
+ </div>
+ ))}
+ </div>
+ </motion.div>
+ );
+}
diff --git a/components/shared/modal.tsx b/components/shared/modal.tsx
index b21194eb9e..02e1719e4c 100644
--- a/components/shared/modal.tsx
+++ b/components/shared/modal.tsx
@@ -99,7 +99,7 @@ export default function Modal({
initial={{ scale: 0.95 }}
animate={{ scale: 1 }}
exit={{ scale: 0.95 }}
- onClick={(e) => {
+ onMouseDown={(e) => {
if (desktopModalRef.current === e.target) closeModal();
}}
>
diff --git a/lib/api/links.ts b/lib/api/links.ts
index 9c8c9ea7ca..52b12515c6 100644
--- a/lib/api/links.ts
+++ b/lib/api/links.ts
@@ -3,6 +3,7 @@ import { DEFAULT_REDIRECTS, RESERVED_KEYS } from "@/lib/constants";
import prisma from "@/lib/prisma";
import { LinkProps } from "@/lib/types";
import { redis } from "@/lib/upstash";
+import { getParamsFromURL } from "../utils";
export async function getLinksForProject({
domain,
@@ -60,17 +61,24 @@ export async function addLink(link: LinkProps) {
const hasPassword = password && password.length > 0 ? true : false;
const proxy = title && description && image ? true : false;
const exat = expiresAt ? new Date(expiresAt).getTime() / 1000 : null;
- console.log(expiresAt, exat);
const exists = await checkIfKeyExists(domain, key);
if (exists) return null;
+ const { utm_source, utm_medium, utm_campaign, utm_term, utm_content } =
+ getParamsFromURL(url);
+
let [response, _] = await Promise.all([
prisma.link.create({
data: {
...link,
// can't upload base64 image string to mysql, need to upload to cloudinary first
image: undefined,
+ utm_source,
+ utm_medium,
+ utm_campaign,
+ utm_term,
+ utm_content,
},
}),
redis.set(
@@ -132,6 +140,8 @@ export async function editLink(
const exists = await checkIfKeyExists(domain, key);
if (exists) return null;
}
+ const { utm_source, utm_medium, utm_campaign, utm_term, utm_content } =
+ getParamsFromURL(url);
const [response, ...effects] = await Promise.all([
prisma.link.update({
@@ -142,6 +152,11 @@ export async function editLink(
...link,
// if it's an uploaded image (base64 URI), need to upload to cloudinary first
image: uploadedImage ? undefined : image,
+ utm_source,
+ utm_medium,
+ utm_campaign,
+ utm_term,
+ utm_content,
},
}),
// only upload image to cloudinary if it's changed
diff --git a/lib/types.ts b/lib/types.ts
index 62ac88f9b6..aadf8abffb 100644
--- a/lib/types.ts
+++ b/lib/types.ts
@@ -16,12 +16,6 @@ export interface LinkProps {
description: string | null;
image: string | null;
- utm_source: string | null;
- utm_medium: string | null;
- utm_campaign: string | null;
- utm_term: string | null;
- utm_content: string | null;
-
clicks: number;
userId: string;
diff --git a/lib/utils.ts b/lib/utils.ts
index 5d8dbeffcb..f68bc5c704 100644
--- a/lib/utils.ts
+++ b/lib/utils.ts
@@ -208,3 +208,33 @@ export const getApexDomain = (url: string) => {
// if it's a normal domain (e.g. dub.sh), we return the domain
return domain;
};
+
+export const getParamsFromURL = (url: string) => {
+ if (!url) return {};
+ try {
+ const params = new URL(url).searchParams;
+ const paramsObj: Record<string, string> = {};
+ for (const [key, value] of params.entries()) {
+ paramsObj[key] = value;
+ }
+ return paramsObj;
+ } catch (e) {
+ return {};
+ }
+};
+
+export const constructURLFromUTMParams = (
+ url: string,
+ utmParams: Record<string, string>,
+) => {
+ if (!url) return "";
+ try {
+ const params = new URL(url).searchParams;
+ for (const [key, value] of Object.entries(utmParams)) {
+ params.set(key, value);
+ }
+ return `${url.split("?")[0]}?${params.toString()}`;
+ } catch (e) {
+ return "";
+ }
+};
diff --git a/package.json b/package.json
index 88b558c27c..f57fe1704e 100644
--- a/package.json
+++ b/package.json
@@ -14,6 +14,7 @@
"dependencies": {
"@next-auth/prisma-adapter": "^1.0.4",
"@prisma/client": "^4.3.1",
+ "@radix-ui/react-accordion": "^1.0.1",
"@radix-ui/react-popover": "^1.0.2",
"@radix-ui/react-slider": "^1.0.0",
"@radix-ui/react-switch": "^1.0.0",
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index d32e1941c0..c943e442fa 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -117,7 +117,7 @@ model Link {
id String @id @default(cuid())
domain String // domain of the link (e.g. dub.sh) – also stored on Redis
key String // key of the link (e.g. /github) – also stored on Redis
- url String // target url (e.g. https://github.com/steven-tey/dub) – also stored on Redis
+ url String @db.LongText // target url (e.g. https://github.com/steven-tey/dub) – also stored on Redis
archived Boolean @default(false) // whether the link is archived or not
expiresAt DateTime? // when the link expires – stored on Redis via ttl
password String? // password to access the link – also stored on Redis
diff --git a/tailwind.config.js b/tailwind.config.js
index e20abf9413..83f8f4d169 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -61,6 +61,12 @@ module.exports = {
plugin(({ addVariant }) => {
addVariant("radix-state-checked", '&[data-state="checked"]');
addVariant("radix-state-unchecked", '&[data-state="unchecked"]');
+ addVariant("radix-state-open", '&[data-state="open"]');
+ addVariant("radix-state-closed", '&[data-state="closed"]');
+ addVariant(
+ "group-radix-state-open",
+ ':merge(.group)[data-state="open"] &',
+ );
}),
],
};
diff --git a/tsconfig.json b/tsconfig.json
index a0aa35d246..d558e5c4a5 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -11,6 +11,7 @@
"@/lib/*": ["lib/*"],
"@/styles/*": ["styles/*"]
},
+ "downlevelIteration": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
diff --git a/yarn.lock b/yarn.lock
index 862cbbc796..a03f953b70 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -717,6 +717,21 @@
dependencies:
"@babel/runtime" "^7.13.10"
+"@radix-ui/react-accordion@^1.0.1":
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/@radix-ui/react-accordion/-/react-accordion-1.0.1.tgz#d956e3adb9ed32c629d0ebe4c771a80843903916"
+ integrity sha512-Ka7BQoyRRPwsOb0YEv0fQU8V8aCXCxAzNVI5BRN7WmPG2E1zQKKxmb86NVDqIj6uSnaahJ1E5S6bX5Lk9hTK+g==
+ dependencies:
+ "@babel/runtime" "^7.13.10"
+ "@radix-ui/primitive" "1.0.0"
+ "@radix-ui/react-collapsible" "1.0.1"
+ "@radix-ui/react-collection" "1.0.1"
+ "@radix-ui/react-compose-refs" "1.0.0"
+ "@radix-ui/react-context" "1.0.0"
+ "@radix-ui/react-id" "1.0.0"
+ "@radix-ui/react-primitive" "1.0.1"
+ "@radix-ui/react-use-controllable-state" "1.0.0"
+
"@radix-ui/[email protected]":
version "1.0.0"
resolved "https://registry.npmjs.org/@radix-ui/react-arrow/-/react-arrow-1.0.0.tgz"
@@ -733,6 +748,21 @@
"@babel/runtime" "^7.13.10"
"@radix-ui/react-primitive" "1.0.1"
+"@radix-ui/[email protected]":
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/@radix-ui/react-collapsible/-/react-collapsible-1.0.1.tgz#7184312ce18e703628b9ef75cdc44b896d6f06b1"
+ integrity sha512-0maX4q91iYa4gjt3PsNf7dq/yqSR+HGAE8I5p54dQ6gnveS+ETWlMoijxrhmgV1k8svxpm34mQAtqIrJt4XZmA==
+ dependencies:
+ "@babel/runtime" "^7.13.10"
+ "@radix-ui/primitive" "1.0.0"
+ "@radix-ui/react-compose-refs" "1.0.0"
+ "@radix-ui/react-context" "1.0.0"
+ "@radix-ui/react-id" "1.0.0"
+ "@radix-ui/react-presence" "1.0.0"
+ "@radix-ui/react-primitive" "1.0.1"
+ "@radix-ui/react-use-controllable-state" "1.0.0"
+ "@radix-ui/react-use-layout-effect" "1.0.0"
+
"@radix-ui/[email protected]":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@radix-ui/react-collection/-/react-collection-1.0.0.tgz#0ec4c72fabd35a03b5787075ac799e3b17ca5710"
@@ -744,6 +774,17 @@
"@radix-ui/react-primitive" "1.0.0"
"@radix-ui/react-slot" "1.0.0"
+"@radix-ui/[email protected]":
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/@radix-ui/react-collection/-/react-collection-1.0.1.tgz#259506f97c6703b36291826768d3c1337edd1de5"
+ integrity sha512-uuiFbs+YCKjn3X1DTSx9G7BHApu4GHbi3kgiwsnFUbOKCrwejAJv4eE4Vc8C0Oaxt9T0aV4ox0WCOdx+39Xo+g==
+ dependencies:
+ "@babel/runtime" "^7.13.10"
+ "@radix-ui/react-compose-refs" "1.0.0"
+ "@radix-ui/react-context" "1.0.0"
+ "@radix-ui/react-primitive" "1.0.1"
+ "@radix-ui/react-slot" "1.0.1"
+
"@radix-ui/[email protected]":
version "1.0.0"
resolved "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.0.0.tgz"