diff --git a/www/apps/ui/src/components/scroll-area.tsx b/www/apps/ui/src/components/scroll-area.tsx index 8f48acba07..87c410c3ff 100644 --- a/www/apps/ui/src/components/scroll-area.tsx +++ b/www/apps/ui/src/components/scroll-area.tsx @@ -3,16 +3,18 @@ import { clx } from "@medusajs/ui" import * as Primitives from "@radix-ui/react-scroll-area" import clsx from "clsx" +import { Key } from "@/types/props" type ScrollbarProps = React.ComponentProps -const Scrollbar = (props: ScrollbarProps) => { +const Scrollbar = ({ key, ...props }: ScrollbarProps) => { return ( ) @@ -20,7 +22,7 @@ const Scrollbar = (props: ScrollbarProps) => { type ThumbProps = React.ComponentProps -const Thumb = ({ className, ...props }: ThumbProps) => { +const Thumb = ({ className, key, ...props }: ThumbProps) => { return ( { "before:min-h-[44px] before:w-full before:min-w-[44px] before:-translate-x-1/2 before:-translate-y-1/2 before:content-['']", className )} + key={key as Key} {...props} /> ) diff --git a/www/apps/ui/src/components/tabs.tsx b/www/apps/ui/src/components/tabs.tsx index a19e1a68c8..efe19c0206 100644 --- a/www/apps/ui/src/components/tabs.tsx +++ b/www/apps/ui/src/components/tabs.tsx @@ -3,6 +3,7 @@ import { clx } from "@medusajs/ui" import * as Primitives from "@radix-ui/react-tabs" import * as React from "react" +import { Key } from "@/types/props" const Tabs = Primitives.Root @@ -10,13 +11,14 @@ const TabsList = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef // eslint-disable-next-line react/prop-types ->(({ className, ...props }, ref) => ( +>(({ className, key, ...props }, ref) => ( )) @@ -26,7 +28,7 @@ const TabsTrigger = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef // eslint-disable-next-line react/prop-types ->(({ className, ...props }, ref) => ( +>(({ className, key, ...props }, ref) => ( )) @@ -44,13 +47,14 @@ const TabsContent = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef // eslint-disable-next-line react/prop-types ->(({ className, ...props }, ref) => ( +>(({ className, key, ...props }, ref) => ( )) diff --git a/www/apps/ui/src/types/props.ts b/www/apps/ui/src/types/props.ts index d8851a0a4b..6f1a860110 100644 --- a/www/apps/ui/src/types/props.ts +++ b/www/apps/ui/src/types/props.ts @@ -37,3 +37,7 @@ export type PropDataMap = PropData[] export type PropRegistryItem = { table: LazyExoticComponent } + +// resolve type errors related to +// key with radix components +export type Key = string | number | null | undefined diff --git a/www/packages/docs-ui/src/components/CodeBlock/index.tsx b/www/packages/docs-ui/src/components/CodeBlock/index.tsx index 539f33934c..7d9065cd3a 100644 --- a/www/packages/docs-ui/src/components/CodeBlock/index.tsx +++ b/www/packages/docs-ui/src/components/CodeBlock/index.tsx @@ -64,7 +64,7 @@ export const CodeBlock = ({ className={clsx( "text-code-body font-monospace table min-w-full pb-docs_1.5 print:whitespace-pre-wrap", tokens.length > 1 && "pt-docs_1 pr-docs_1", - tokens.length <= 1 && "py-docs_0.5 px-docs_1" + tokens.length <= 1 && "!py-docs_0.5 px-docs_1" )} > {tokens.map((line, i) => {