Skip to content

Commit 0dcd468

Browse files
authored
Fix types error (#1203)
1 parent b9e9699 commit 0dcd468

File tree

9 files changed

+23
-13
lines changed

9 files changed

+23
-13
lines changed

src/components/ui/Accordion/stories/AccordionRootVisualTests.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const Template: Story = (args) => <SandboxEditor>
1414
<Accordion.Trigger>
1515
Hello
1616
</Accordion.Trigger>
17-
<Accordion.Content>
17+
<Accordion.Content index={0}>
1818
abc
1919
</Accordion.Content>
2020
</Accordion.Item>
@@ -35,7 +35,7 @@ const AsChildTemplate: Story = (args) => {
3535
<Accordion.Trigger>
3636
Hello
3737
</Accordion.Trigger>
38-
<Accordion.Content>
38+
<Accordion.Content index={0}>
3939
abc
4040
</Accordion.Content>
4141
</Accordion.Item>

src/components/ui/Disclosure/stories/Disclosure.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const Composed = () => {
4646
return <SandboxEditor>
4747
<Disclosure.Root>
4848
{disclosureItems.map((item) => (
49-
<Disclosure.Item key={item.title}>
49+
<Disclosure.Item key={item.title} value={0}>
5050
<Disclosure.Trigger>
5151
{item.title}
5252
</Disclosure.Trigger>

src/components/ui/HoverCard/contexts/HoverCardContext.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ type HoverCardContextType = {
1111
getFloatingProps: () => Record<string, any>;
1212
floatingStyles: React.CSSProperties;
1313
rootClass: string;
14+
rootTriggerClass: string;
1415
closeWithDelay: () => void;
1516
closeWithoutDelay: () => void;
1617
openWithDelay: () => void;

src/components/ui/HoverCard/fragments/HoverCardTrigger.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import Primitive from '~/core/primitives/Primitive';
77
type HoverCardTriggerProps = {
88
children: React.ReactNode,
99
props?: React.HTMLAttributes<HTMLElement>
10+
className?: string
1011
}
1112

1213
const HoverCardTrigger = ({ children, className = '', ...props }: HoverCardTriggerProps) => {

src/components/ui/Kbd/Kbd.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export type KbdProps = {
1010
customRootClass?: string;
1111
className?: string;
1212
size?: string;
13-
props: Record<string, any>[];
13+
props?: Record<string, any>[];
1414
}
1515

1616
const Kbd = ({ children, customRootClass, className, size = '', ...props }: KbdProps) => {

src/components/ui/ScrollArea/fragments/ScrollAreaScrollbar.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ import React, { useContext, useRef, useCallback } from 'react';
44
import { ScrollAreaContext } from '../context/ScrollAreaContext';
55
import clsx from 'clsx';
66

7-
const ScrollAreaScrollbar = ({ children, className = '', ...props }: React.HTMLAttributes<HTMLDivElement>) => {
7+
type ScrollAreaScrollbarProps = React.HTMLAttributes<HTMLDivElement> & {
8+
orientation?: 'horizontal' | 'vertical';
9+
};
10+
11+
const ScrollAreaScrollbar = ({ children, className = '', orientation, ...props }: ScrollAreaScrollbarProps) => {
812
const { rootClass, handleScrollbarClick, scrollXThumbRef } = useContext(ScrollAreaContext);
913
const intervalRef = useRef<NodeJS.Timeout | null>(null);
1014
const isScrollingRef = useRef(false);
@@ -77,6 +81,7 @@ const ScrollAreaScrollbar = ({ children, className = '', ...props }: React.HTMLA
7781
return (
7882
<div
7983
className={clsx(rootClass + '-scrollbar', className)}
84+
data-orientation={orientation}
8085
onMouseDown={startContinuousScroll}
8186
onMouseUp={stopContinuousScroll}
8287
onMouseLeave={stopContinuousScroll}

src/components/ui/ScrollArea/stories/ScrollArea.stories.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import SandboxEditor from '~/components/tools/SandboxEditor/SandboxEditor';
55
import Text from '~/components/ui/Text/Text';
66
import Heading from '~/components/ui/Heading/Heading';
77

8-
const ScrollAreaTemplate = (args) => {
8+
const ScrollAreaTemplate = (args: any) => {
99
return (
1010
<SandboxEditor>
1111
<ScrollArea.Root>
@@ -39,11 +39,11 @@ const ScrollAreaTemplate = (args) => {
3939
export default {
4040
title: 'WIP/ScrollArea',
4141
component: ScrollArea,
42-
render: (args) => <ScrollAreaTemplate {...args}/>
42+
render: (args: any) => <ScrollAreaTemplate {...args}/>
4343
};
4444

4545
export const All = {};
46-
All.args = {};
46+
// All.args = {}; // Not needed, All is not a function story
4747

4848
const LayoutTemplate = () => {
4949
return <SandboxEditor>
@@ -70,4 +70,5 @@ const LayoutTemplate = () => {
7070
};
7171

7272
export const Layout = LayoutTemplate.bind({});
73-
Layout.args = {};
73+
// Layout.args = {}; // Not needed, Layout is not a function story
74+
// TODO: Add proper typing for args if needed in the future

src/core/primitives/Dialog/context/DialogPrimitiveContext.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ type DialogPrimitiveContextType = {
1313
setFloating: React.RefCallback<HTMLElement> | (() => void);
1414
};
1515
floatingStyles: React.CSSProperties;
16+
floaterContext?: any
1617
};
1718

1819
export const DialogPrimitiveContext = createContext<DialogPrimitiveContextType>({

src/core/primitives/Dialog/fragments/DialogPrimitiveRoot.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ import Floater from '~/core/primitives/Floater';
55

66
export type DialogPrimitiveRootProps = {
77
children: React.ReactNode;
8-
open: boolean;
9-
onOpenChange: (open: boolean) => void;
8+
open?: boolean;
9+
onOpenChange?: (open: boolean) => void;
1010
onClickOutside?: () => void;
11+
className?:string
1112
}
1213

1314
const COMPONENT_NAME = 'DialogPrimitive';
1415

15-
const DialogPrimitiveRoot = ({ children, open, onOpenChange = () => {}, onClickOutside = () => {}, ...props } : DialogPrimitiveRootProps) => {
16+
const DialogPrimitiveRoot = ({ children, open=false, onOpenChange = () => {}, onClickOutside = () => {}, className, ...props } : DialogPrimitiveRootProps) => {
1617
const [isOpen, setIsOpen] = useState(open);
1718
const handleOpenChange = (open: boolean) => {
1819
setIsOpen(open);
@@ -38,7 +39,7 @@ const DialogPrimitiveRoot = ({ children, open, onOpenChange = () => {}, onClickO
3839
const contextProps = { isOpen, handleOpenChange, floaterContext, handleOverlayClick, getReferenceProps, getFloatingProps, getItemProps, refs, floatingStyles };
3940
return (
4041
<DialogPrimitiveContext.Provider value={contextProps}>
41-
<div {...props}>
42+
<div {...props} className={className}>
4243
{children}
4344
</div>
4445
</DialogPrimitiveContext.Provider>

0 commit comments

Comments
 (0)