Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
"devDependencies": {
"@commitlint/cli": "^19.5.0",
"@commitlint/config-conventional": "^19.5.0",
"@douglasneuroinformatics/eslint-config": "^5.2.1",
"@douglasneuroinformatics/eslint-config": "^5.2.4",
"@douglasneuroinformatics/prettier-config": "^0.0.1",
"@douglasneuroinformatics/semantic-release": "^0.0.1",
"@douglasneuroinformatics/tsconfig": "^1.0.2",
Expand All @@ -140,7 +140,7 @@
"@vitejs/plugin-react-swc": "^3.7.1",
"@vitest/coverage-v8": "^2.1.2",
"autoprefixer": "^10.4.20",
"eslint": "^9.12.0",
"eslint": "^9.19.0",
"happy-dom": "^14.12.0",
"husky": "^9.1.6",
"jsdom": "25.0.1",
Expand Down
6,714 changes: 2,811 additions & 3,903 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/components/ArrowToggle/ArrowToggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { cn } from '@/utils';
import { Button, type ButtonProps } from '../Button';

export type ArrowToggleProps = Simplify<
{
React.HTMLAttributes<HTMLButtonElement> & {
/** Whether or not the arrow is currently toggled */
isToggled?: boolean;

Expand All @@ -23,7 +23,7 @@ export type ArrowToggleProps = Simplify<

/** The variant of button to use */
variant?: Extract<ButtonProps['variant'], 'ghost' | 'outline'>;
} & React.HTMLAttributes<HTMLButtonElement>
}
>;

export const ArrowToggle = React.forwardRef<HTMLButtonElement, ArrowToggleProps>(function ArrowToggle(
Expand Down
4 changes: 2 additions & 2 deletions src/components/Breadcrumb/BreadcrumbLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { cn } from '@/utils';

export const BreadcrumbLink = forwardRef<
HTMLAnchorElement,
{
React.ComponentPropsWithoutRef<'a'> & {
asChild?: boolean;
} & React.ComponentPropsWithoutRef<'a'>
}
>(function BreadcrumbLink({ asChild, className, ...props }, ref) {
const Comp = asChild ? Slot : 'a';
return <Comp className={cn('transition-colors hover:text-foreground', className)} ref={ref} {...props} />;
Expand Down
4 changes: 2 additions & 2 deletions src/components/Breadcrumb/BreadcrumbRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { forwardRef } from 'react';

export const BreadcrumbRoot = forwardRef<
HTMLElement,
{
React.ComponentPropsWithoutRef<'nav'> & {
separator?: React.ReactNode;
} & React.ComponentPropsWithoutRef<'nav'>
}
>(function BreadcrumbRoot({ ...props }, ref) {
return <nav aria-label="breadcrumb" ref={ref} {...props} />;
});
12 changes: 6 additions & 6 deletions src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ export const buttonVariants = cva(
);

export type ButtonProps = Simplify<
{
asChild?: boolean;
/** @deprecated - use children */
label?: string;
} & React.ButtonHTMLAttributes<HTMLButtonElement> &
VariantProps<typeof buttonVariants>
React.ButtonHTMLAttributes<HTMLButtonElement> &
VariantProps<typeof buttonVariants> & {
asChild?: boolean;
/** @deprecated - use children */
label?: string;
}
>;

export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(function Button(
Expand Down
4 changes: 2 additions & 2 deletions src/components/Chart/ChartContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import type { ChartConfig } from './types';

export const ChartContainer = forwardRef<
HTMLDivElement,
{
React.ComponentProps<'div'> & {
children: React.ComponentProps<typeof ResponsiveContainer>['children'];
config: ChartConfig;
} & React.ComponentProps<'div'>
}
>(function ChartContainer({ children, className, config, id, ...props }, ref) {
const uniqueId = useId();
const chartId = `chart-${id ?? uniqueId.replace(/:/g, '')}`;
Expand Down
10 changes: 5 additions & 5 deletions src/components/Chart/ChartLegendContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import { getPayloadConfigFromPayload } from './utils';

export const ChartLegendContent = forwardRef<
HTMLDivElement,
{
hideIcon?: boolean;
nameKey?: string;
} & Pick<LegendProps, 'payload' | 'verticalAlign'> &
React.ComponentProps<'div'>
Pick<LegendProps, 'payload' | 'verticalAlign'> &
React.ComponentProps<'div'> & {
hideIcon?: boolean;
nameKey?: string;
}
>(function ChartLegendContent({ className, hideIcon = false, nameKey, payload, verticalAlign = 'bottom' }, ref) {
const { config } = useChart();

Expand Down
16 changes: 8 additions & 8 deletions src/components/Chart/ChartTooltipContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import { getPayloadConfigFromPayload } from './utils';

export const ChartTooltipContent = forwardRef<
HTMLDivElement,
{
hideIndicator?: boolean;
hideLabel?: boolean;
indicator?: 'dashed' | 'dot' | 'line';
labelKey?: string;
nameKey?: string;
} & React.ComponentProps<'div'> &
React.ComponentProps<typeof Tooltip>
React.ComponentProps<'div'> &
React.ComponentProps<typeof Tooltip> & {
hideIndicator?: boolean;
hideLabel?: boolean;
indicator?: 'dashed' | 'dot' | 'line';
labelKey?: string;
nameKey?: string;
}
>(function ChartLegendContent(
{
active,
Expand Down
4 changes: 2 additions & 2 deletions src/components/ContextMenu/ContextMenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { cn } from '@/utils';

export const ContextMenuItem = forwardRef<
React.ElementRef<typeof ContextMenuPrimitive.Item>,
{
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {
inset?: boolean;
} & React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item>
}
>(function ContextMenuItem({ className, inset, ...props }, ref) {
return (
<ContextMenuPrimitive.Item
Expand Down
4 changes: 2 additions & 2 deletions src/components/ContextMenu/ContextMenuLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { cn } from '@/utils';

export const ContextMenuLabel = forwardRef<
React.ElementRef<typeof ContextMenuPrimitive.Label>,
{
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {
inset?: boolean;
} & React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label>
}
>(function ContextMenuLabel({ className, inset, ...props }, ref) {
return (
<ContextMenuPrimitive.Label
Expand Down
4 changes: 2 additions & 2 deletions src/components/ContextMenu/ContextMenuSubTrigger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { cn } from '@/utils';

export const ContextMenuSubTrigger = forwardRef<
React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,
{
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {
inset?: boolean;
} & React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger>
}
>(function ContextMenuSubTrigger({ children, className, inset, ...props }, ref) {
return (
<ContextMenuPrimitive.SubTrigger
Expand Down
4 changes: 2 additions & 2 deletions src/components/DropdownMenu/DropdownMenuContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';

import { cn } from '@/utils';

export type DropdownMenuContentProps = {
export type DropdownMenuContentProps = React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content> & {
widthFull?: boolean;
} & React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>;
};
export const DropdownMenuContent = React.forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.Content>,
DropdownMenuContentProps
Expand Down
4 changes: 2 additions & 2 deletions src/components/DropdownMenu/DropdownMenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { cn } from '@/utils';

export const DropdownMenuItem = forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.Item>,
{
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
inset?: boolean;
} & React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item>
}
>(function DropdownMenuItem({ className, inset, ...props }, ref) {
return (
<DropdownMenuPrimitive.Item
Expand Down
4 changes: 2 additions & 2 deletions src/components/DropdownMenu/DropdownMenuLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { cn } from '@/utils';

export const DropdownMenuLabel = forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.Label>,
{
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
inset?: boolean;
} & React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label>
}
>(function DropdownMenuLabel({ className, inset, ...props }, ref) {
return (
<DropdownMenuPrimitive.Label
Expand Down
4 changes: 2 additions & 2 deletions src/components/DropdownMenu/DropdownMenuSubTrigger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { cn } from '@/utils';

export const DropdownMenuSubTrigger = forwardRef<
React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
{
React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
inset?: boolean;
} & React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger>
}
>(function DropdownMenuSubTrigger({ children, className, inset, ...props }, ref) {
return (
<DropdownMenuPrimitive.SubTrigger
Expand Down
4 changes: 2 additions & 2 deletions src/components/Form/BaseRadioField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ const baseRadioFieldVariants = cva('flex', {
});

export type BaseRadioFieldProps<T extends string> = Simplify<
{
BaseFieldComponentProps<T> & {
description?: string;
disabled?: boolean;
label: string;
options: { [K in T]: string };
orientation?: 'horizontal' | 'vertical';
} & BaseFieldComponentProps<T>
}
>;

export const BaseRadioField = <T extends string>({
Expand Down
1 change: 0 additions & 1 deletion src/components/Form/Form.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable max-lines */
/* eslint-disable perfectionist/sort-objects */

import { useEffect, useState } from 'react';
Expand Down
1 change: 0 additions & 1 deletion src/components/Form/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ type FormProps<TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<T
validationSchema: z.ZodType<TData>;
};

// eslint-disable-next-line max-lines-per-function
const Form = <TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<TSchema> = z.TypeOf<TSchema>>({
additionalButtons,
className,
Expand Down
16 changes: 8 additions & 8 deletions src/components/Form/ScalarField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@ import { StringField, type StringFieldProps } from './StringField';

import type { BaseFieldComponentProps } from './types';

export type ScalarFieldProps = {
export type ScalarFieldProps = BaseFieldComponentProps<ScalarFieldValue> & {
field: BooleanFormField | DateFormField | NumberFormField | SetFormField | StringFormField;
} & BaseFieldComponentProps<ScalarFieldValue>;
};

export const ScalarField = ({ field, ...props }: ScalarFieldProps) => {
switch (field.kind) {
case 'string':
return <StringField {...field} {...(props as StringFieldProps)} />;
case 'number':
return <NumberField {...field} {...(props as NumberFieldProps)} />;
case 'date':
return <DateField {...field} {...(props as DateFieldProps)} />;
case 'boolean':
return <BooleanField {...field} {...(props as BooleanFieldProps)} />;
case 'date':
return <DateField {...field} {...(props as DateFieldProps)} />;
case 'number':
return <NumberField {...field} {...(props as NumberFieldProps)} />;
case 'set':
return <SetField {...field} {...(props as SetFieldProps)} />;
case 'string':
return <StringField {...field} {...(props as StringFieldProps)} />;
default:
throw new Error(`Unexpected value for kind: ${Reflect.get(field, 'kind') satisfies never}`);
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Form/SetField/SetFieldListbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { FieldGroup } from '../FieldGroup';

import type { SetFieldProps } from './SetField';

export type SetFieldListboxProps<T extends string = string> = {
export type SetFieldListboxProps<T extends string = string> = SetFieldProps<T> & {
onCheckedChange: (option: T, isChecked: boolean) => void;
} & SetFieldProps<T>;
};

export const SetFieldListbox = <T extends string = string>({
description,
Expand Down
4 changes: 2 additions & 2 deletions src/components/Form/SetField/SetFieldSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { FieldGroup } from '../FieldGroup';

import type { SetFieldProps } from './SetField';

export type SetFieldSelectProps<T extends string = string> = {
export type SetFieldSelectProps<T extends string = string> = SetFieldProps<T> & {
onCheckedChange: (option: T, isChecked: boolean) => void;
} & SetFieldProps<T>;
};

export const SetFieldSelect = <T extends string = string>({
description,
Expand Down
7 changes: 5 additions & 2 deletions src/components/LineGraph/LineGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@ type LineGraphData = readonly { [key: string]: any }[];
/** Extract string keys from items in `T` where the value of `T[K]` extends `K` */
type ExtractValidKeys<T extends LineGraphData, K> = Extract<ConditionalKeys<T[number], K>, string>;

type LineGraphLine<T extends LineGraphData = { [key: string]: any }[]> = {
type LineGraphLine<T extends LineGraphData = { [key: string]: any }[]> = Pick<
LineProps,
'legendType' | 'stroke' | 'strokeDasharray' | 'strokeWidth' | 'type'
> & {
err?: ExtractValidKeys<T, number>;
name: string;
val: ExtractValidKeys<T, number>;
} & Pick<LineProps, 'legendType' | 'stroke' | 'strokeDasharray' | 'strokeWidth' | 'type'>;
};

const strokeColors = {
dark: '#cbd5e1', // slate-300
Expand Down
4 changes: 2 additions & 2 deletions src/components/MenuBar/MenuBarItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { cn } from '@/utils';

export const MenuBarItem = forwardRef<
React.ElementRef<typeof Item>,
{
React.ComponentPropsWithoutRef<typeof Item> & {
inset?: boolean;
} & React.ComponentPropsWithoutRef<typeof Item>
}
>(function MenuBarItem({ className, inset, ...props }, ref) {
return (
<Item
Expand Down
4 changes: 2 additions & 2 deletions src/components/MenuBar/MenuBarLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { cn } from '@/utils';

export const MenuBarLabel = forwardRef<
React.ElementRef<typeof Label>,
{
React.ComponentPropsWithoutRef<typeof Label> & {
inset?: boolean;
} & React.ComponentPropsWithoutRef<typeof Label>
}
>(function MenuBarLabel({ className, inset, ...props }, ref) {
return <Label className={cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)} ref={ref} {...props} />;
});
4 changes: 2 additions & 2 deletions src/components/MenuBar/MenuBarSubTrigger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { cn } from '@/utils';

export const MenuBarSubTrigger = forwardRef<
React.ElementRef<typeof SubTrigger>,
{
React.ComponentPropsWithoutRef<typeof SubTrigger> & {
inset?: boolean;
} & React.ComponentPropsWithoutRef<typeof SubTrigger>
}
>(function MenuBarSubTrigger({ children, className, inset, ...props }, ref) {
return (
<SubTrigger
Expand Down
8 changes: 4 additions & 4 deletions src/components/Pagination/PaginationLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import { cn } from '@/utils';
import { type ButtonProps, buttonVariants } from '../Button';

export type PaginationLinkProps = Simplify<
{
isActive?: boolean;
} & Pick<ButtonProps, 'size'> &
React.ComponentProps<'a'>
Pick<ButtonProps, 'size'> &
React.ComponentProps<'a'> & {
isActive?: boolean;
}
>;

export const PaginationLink = ({ children, className, isActive, size = 'icon', ...props }: PaginationLinkProps) => (
Expand Down
4 changes: 2 additions & 2 deletions src/components/Resizable/Resizable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import { ResizableHandle, type ResizableHandleProps } from './ResizableHandle';
import { ResizablePanelGroup, type ResizablePanelGroupProps } from './ResizablePanelGroup';

type ResizableRootType = React.FC<{ children: React.ReactNode }>;
type ResizableType = {
type ResizableType = ResizableRootType & {
Handle: React.FC<ResizableHandleProps>;
Panel: React.FC<PanelProps>;
PanelGroup: React.FC<ResizablePanelGroupProps>;
} & ResizableRootType;
};

// This is only for storybook and is unnecessary for real-world use
const ResizableRoot: ResizableRootType = ({ children }) => <>{children}</>;
Expand Down
4 changes: 2 additions & 2 deletions src/components/Resizable/ResizableHandle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { PanelResizeHandle } from 'react-resizable-panels';

import { cn } from '@/utils';

export type ResizableHandleProps = {
export type ResizableHandleProps = React.ComponentProps<typeof PanelResizeHandle> & {
withHandle?: boolean;
} & React.ComponentProps<typeof PanelResizeHandle>;
};

export const ResizableHandle = ({ className, withHandle, ...props }: ResizableHandleProps) => (
<PanelResizeHandle
Expand Down
Loading
Loading