(
return (
{!hiddenLabel && (
-
+
+
)}
,
+) {
+ const { invalid, ...rest } = props;
+ return (
+
+ );
+});
diff --git a/apps/frontend/src/ui/Menu.tsx b/apps/frontend/src/ui/Menu.tsx
index c69338d84..c0d0d9df5 100644
--- a/apps/frontend/src/ui/Menu.tsx
+++ b/apps/frontend/src/ui/Menu.tsx
@@ -31,8 +31,8 @@ export function Menu({ className, ...props }: MenuProps) {
type MenuItemVariant = "default" | "danger";
const menuItemVariantClasses: Record = {
- default: "text hover:bg-active focus:bg-active",
- danger: "text-danger-low hover:bg-danger-active focus:bg-danger-active",
+ default: "text hover:bg-hover focus:bg-hover",
+ danger: "text-danger-low hover:bg-danger-hover focus:bg-danger-hover",
};
export function MenuItem(
@@ -46,7 +46,7 @@ export function MenuItem(
className={clsx(
menuItemVariantClasses[props.variant ?? "default"],
props.href ? "cursor-pointer" : "cursor-default",
- "aria-disabled:opacity-disabled flex items-center rounded px-3 py-1.5 text-sm transition focus:outline-none aria-disabled:hover:bg-transparent",
+ "aria-disabled:opacity-disabled flex items-center rounded px-3 py-1.5 text-sm focus:outline-none aria-disabled:hover:bg-transparent",
)}
{...props}
>
diff --git a/apps/frontend/src/ui/Popover.tsx b/apps/frontend/src/ui/Popover.tsx
index aed4271c8..ec28bc1f9 100644
--- a/apps/frontend/src/ui/Popover.tsx
+++ b/apps/frontend/src/ui/Popover.tsx
@@ -1,3 +1,4 @@
+import { forwardRef } from "react";
import { clsx } from "clsx";
import {
PopoverProps,
@@ -9,16 +10,20 @@ const popoverStyles = (values: PopoverRenderProps) =>
clsx(
"bg-subtle z-50 bg-clip-padding border rounded-lg p-1 fill-mode-forwards flex",
"data-[placement=bottom]:origin-top data-[placement=top]:origin-bottom data-[placement=left]:origin-right data-[placement=right]:origin-left",
- values.isEntering && "animate-in fade-in zoom-in-95",
+ values.isEntering && "animate-in fade-in",
values.isExiting && "animate-out fade-out zoom-out-95",
);
-export function Popover({ className, ...props }: PopoverProps) {
+export const Popover = forwardRef(function Popover(
+ { className, ...props }: PopoverProps,
+ ref: React.ForwardedRef,
+) {
return (
clsx(popoverStyles(values), className)}
{...props}
/>
);
-}
+});
diff --git a/apps/frontend/src/ui/Slider.tsx b/apps/frontend/src/ui/Slider.tsx
new file mode 100644
index 000000000..4b640c22e
--- /dev/null
+++ b/apps/frontend/src/ui/Slider.tsx
@@ -0,0 +1,84 @@
+import { forwardRef } from "react";
+import { clsx } from "clsx";
+import {
+ Slider as RACSlider,
+ SliderOutput as RACSliderOutput,
+ SliderOutputProps as RACSliderOutputProps,
+ SliderProps as RACSliderProps,
+ SliderThumb as RACSliderThumb,
+ SliderThumbProps as RACSliderThumbProps,
+ SliderTrack as RACSliderTrack,
+ SliderTrackProps as RACSliderTrackProps,
+} from "react-aria-components";
+
+export type SliderProps = RACSliderProps;
+
+export const Slider = forwardRef(function Slider(
+ props: SliderProps,
+ ref: React.ForwardedRef,
+) {
+ return (
+ label]:[grid-area:label]",
+ props.className,
+ )}
+ />
+ );
+});
+
+export type SliderOutputProps = RACSliderOutputProps;
+
+export const SliderOutput = forwardRef(function SliderOutput(
+ props: SliderOutputProps,
+ ref: React.ForwardedRef,
+) {
+ return (
+
+ );
+});
+
+export type SliderTrackProps = RACSliderTrackProps;
+
+export const SliderTrack = forwardRef(function SliderTrack(
+ props: SliderTrackProps,
+ ref: React.ForwardedRef,
+) {
+ return (
+
+ );
+});
+
+export type SliderThumbProps = RACSliderThumbProps;
+
+export const SliderThumb = forwardRef(function SliderThumb(
+ props: SliderThumbProps,
+ ref: React.ForwardedRef,
+) {
+ return (
+
+ );
+});
diff --git a/apps/frontend/src/ui/TwicPicture.tsx b/apps/frontend/src/ui/TwicPicture.tsx
index e502eca14..f352dc782 100644
--- a/apps/frontend/src/ui/TwicPicture.tsx
+++ b/apps/frontend/src/ui/TwicPicture.tsx
@@ -1,12 +1,14 @@
import { forwardRef } from "react";
+export type TwicPictureProps = React.ImgHTMLAttributes & {
+ src: string;
+ transforms?: string[];
+ original?: boolean;
+};
+
export const TwicPicture = forwardRef(function TwicPicture(
- props: React.ImgHTMLAttributes & {
- src: string;
- transforms?: string[];
- original?: boolean;
- },
- ref: React.Ref,
+ props: TwicPictureProps,
+ ref: React.ForwardedRef,
) {
const { src, transforms = [], original, ...rest } = props;
if (original) {
diff --git a/apps/frontend/src/util/color-detection/hook.ts b/apps/frontend/src/util/color-detection/hook.ts
index 07fb3366d..801d73574 100644
--- a/apps/frontend/src/util/color-detection/hook.ts
+++ b/apps/frontend/src/util/color-detection/hook.ts
@@ -8,7 +8,9 @@ import type { Rect } from "./types";
export function useColoredRects(input: { url: string }): null | Rect[] {
const [rects, setRects] = useState(null);
useEffect(() => {
- const worker = new Worker(new URL("./worker.ts", import.meta.url));
+ const worker = new Worker(new URL("./worker.ts", import.meta.url), {
+ type: "module",
+ });
worker.onmessage = (event) => {
setRects(event.data);
};