refactor(site): use React namespace for React types (#29837)
This commit is contained in:
1 parent
c0ad7f9344
commit
d2c23fda30
828 files changed
+2688
-3251
No files matched your search
@@ -225,6 +225,28 @@
|
||||
"name": "#/contexts/auth/AuthProvider",
|
||||
"importNames": ["AuthContext"],
|
||||
"message": "Use the useAuthContext() or useAuthenticated() hooks instead of the raw AuthContext."
|
||||
},
|
||||
// Keep in sync with the src/components override below.
|
||||
{
|
||||
"name": "react",
|
||||
"importNames": [
|
||||
"AnimationEvent",
|
||||
"ClipboardEvent",
|
||||
"CompositionEvent",
|
||||
"DragEvent",
|
||||
"FocusEvent",
|
||||
"InputEvent",
|
||||
"KeyboardEvent",
|
||||
"MouseEvent",
|
||||
"PointerEvent",
|
||||
"SubmitEvent",
|
||||
"ToggleEvent",
|
||||
"TouchEvent",
|
||||
"TransitionEvent",
|
||||
"UIEvent",
|
||||
"WheelEvent"
|
||||
],
|
||||
"message": "Use React.<Event> so it isn't confused with the DOM event of the same name."
|
||||
}
|
||||
],
|
||||
"patterns": [
|
||||
@@ -240,6 +262,47 @@
|
||||
"error",
|
||||
{
|
||||
"types": {
|
||||
"FC": "Use React.FC instead.",
|
||||
"ComponentProps": "Use React.ComponentProps instead.",
|
||||
"CSSProperties": "Use React.CSSProperties instead.",
|
||||
"Dispatch": "Use React.Dispatch instead.",
|
||||
"ElementType": "Use React.ElementType instead.",
|
||||
"ForwardedRef": "Use React.ForwardedRef instead.",
|
||||
"HTMLProps": "Use React.HTMLProps instead.",
|
||||
"JSX.Element": "Use React.JSX.Element instead.",
|
||||
"JSX.IntrinsicElements": "Use React.JSX.IntrinsicElements instead.",
|
||||
"PropsWithChildren": "Use React.PropsWithChildren instead.",
|
||||
"ReactElement": "Use React.ReactElement instead.",
|
||||
"ReactNode": "Use React.ReactNode instead.",
|
||||
"Ref": "Use React.Ref instead.",
|
||||
"RefObject": "Use React.RefObject instead.",
|
||||
"SetStateAction": "Use React.SetStateAction instead.",
|
||||
// Event types that share a DOM name are covered by
|
||||
// no-restricted-imports instead.
|
||||
"BaseSyntheticEvent": "Use React.BaseSyntheticEvent instead.",
|
||||
"ChangeEvent": "Use React.ChangeEvent instead.",
|
||||
"FormEvent": "Use React.FormEvent instead.",
|
||||
"InvalidEvent": "Use React.InvalidEvent instead.",
|
||||
"SyntheticEvent": "Use React.SyntheticEvent instead.",
|
||||
"AnimationEventHandler": "Use React.AnimationEventHandler instead.",
|
||||
"ChangeEventHandler": "Use React.ChangeEventHandler instead.",
|
||||
"ClipboardEventHandler": "Use React.ClipboardEventHandler instead.",
|
||||
"CompositionEventHandler": "Use React.CompositionEventHandler instead.",
|
||||
"DragEventHandler": "Use React.DragEventHandler instead.",
|
||||
"EventHandler": "Use React.EventHandler instead.",
|
||||
"FocusEventHandler": "Use React.FocusEventHandler instead.",
|
||||
"FormEventHandler": "Use React.FormEventHandler instead.",
|
||||
"InputEventHandler": "Use React.InputEventHandler instead.",
|
||||
"KeyboardEventHandler": "Use React.KeyboardEventHandler instead.",
|
||||
"MouseEventHandler": "Use React.MouseEventHandler instead.",
|
||||
"PointerEventHandler": "Use React.PointerEventHandler instead.",
|
||||
"ReactEventHandler": "Use React.ReactEventHandler instead.",
|
||||
"SubmitEventHandler": "Use React.SubmitEventHandler instead.",
|
||||
"ToggleEventHandler": "Use React.ToggleEventHandler instead.",
|
||||
"TouchEventHandler": "Use React.TouchEventHandler instead.",
|
||||
"TransitionEventHandler": "Use React.TransitionEventHandler instead.",
|
||||
"UIEventHandler": "Use React.UIEventHandler instead.",
|
||||
"WheelEventHandler": "Use React.WheelEventHandler instead.",
|
||||
"ComponentPropsWithRef": {
|
||||
"message": "Use ComponentProps instead. Under React 19 it already includes ref."
|
||||
},
|
||||
@@ -293,6 +356,31 @@
|
||||
"no-restricted-imports": [
|
||||
"error",
|
||||
{
|
||||
"paths": [
|
||||
// Overrides replace the rule's options rather than merging
|
||||
// them, so the React event types entry is repeated here.
|
||||
{
|
||||
"name": "react",
|
||||
"importNames": [
|
||||
"AnimationEvent",
|
||||
"ClipboardEvent",
|
||||
"CompositionEvent",
|
||||
"DragEvent",
|
||||
"FocusEvent",
|
||||
"InputEvent",
|
||||
"KeyboardEvent",
|
||||
"MouseEvent",
|
||||
"PointerEvent",
|
||||
"SubmitEvent",
|
||||
"ToggleEvent",
|
||||
"TouchEvent",
|
||||
"TransitionEvent",
|
||||
"UIEvent",
|
||||
"WheelEvent"
|
||||
],
|
||||
"message": "Use React.<Event> so it isn't confused with the DOM event of the same name."
|
||||
}
|
||||
],
|
||||
"patterns": [
|
||||
{
|
||||
"group": ["**/pages", "**/pages/**"],
|
||||
|
||||
+4
-10
@@ -1,12 +1,6 @@
|
||||
import "./theme/globalFonts";
|
||||
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
||||
import {
|
||||
type FC,
|
||||
type ReactNode,
|
||||
StrictMode,
|
||||
useEffect,
|
||||
useState,
|
||||
} from "react";
|
||||
import { StrictMode, useEffect, useState } from "react";
|
||||
import { QueryClient, QueryClientProvider } from "react-query";
|
||||
import { RouterProvider } from "react-router";
|
||||
import {
|
||||
@@ -29,11 +23,11 @@ const defaultQueryClient = new QueryClient({
|
||||
});
|
||||
|
||||
type AppProvidersProps = {
|
||||
children: ReactNode;
|
||||
children: React.ReactNode;
|
||||
queryClient?: QueryClient;
|
||||
};
|
||||
|
||||
export const AppProviders: FC<AppProvidersProps> = ({
|
||||
export const AppProviders: React.FC<AppProvidersProps> = ({
|
||||
children,
|
||||
queryClient = defaultQueryClient,
|
||||
}) => {
|
||||
@@ -71,7 +65,7 @@ export const AppProviders: FC<AppProvidersProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
export const App: FC = () => {
|
||||
export const App: React.FC = () => {
|
||||
return (
|
||||
<StrictMode>
|
||||
<AppProviders>
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { cn } from "cn";
|
||||
import type { ComponentProps, FC } from "react";
|
||||
|
||||
type Pronunciation = "shorthand" | "acronym" | "initialism";
|
||||
|
||||
type AbbrProps = ComponentProps<"abbr"> & {
|
||||
type AbbrProps = React.ComponentProps<"abbr"> & {
|
||||
children: string;
|
||||
title: string;
|
||||
pronunciation?: Pronunciation;
|
||||
@@ -19,7 +18,7 @@ type AbbrProps = ComponentProps<"abbr"> & {
|
||||
* - Better integration with screen readers (like exposing the title prop to
|
||||
* them), with more options for influencing how they pronounce text
|
||||
*/
|
||||
export const Abbr: FC<AbbrProps> = ({
|
||||
export const Abbr: React.FC<AbbrProps> = ({
|
||||
children,
|
||||
title,
|
||||
pronunciation = "shorthand",
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
TriangleAlertIcon,
|
||||
XIcon,
|
||||
} from "lucide-react";
|
||||
import { type FC, type ReactNode, useState } from "react";
|
||||
import { useState } from "react";
|
||||
import { Button } from "#/components/Button/Button";
|
||||
|
||||
const alertVariants = cva(
|
||||
@@ -63,16 +63,16 @@ const severityIcons = {
|
||||
export type AlertColor = "info" | "success" | "warning" | "error";
|
||||
|
||||
export type AlertProps = {
|
||||
actions?: ReactNode;
|
||||
actions?: React.ReactNode;
|
||||
dismissible?: boolean;
|
||||
onDismiss?: () => void;
|
||||
severity?: AlertColor;
|
||||
prominent?: boolean;
|
||||
children?: ReactNode;
|
||||
children?: React.ReactNode;
|
||||
className?: string;
|
||||
};
|
||||
|
||||
export const Alert: FC<AlertProps> = ({
|
||||
export const Alert: React.FC<AlertProps> = ({
|
||||
children,
|
||||
actions,
|
||||
dismissible,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { isAxiosError } from "axios";
|
||||
import type { FC } from "react";
|
||||
import { getErrorDetail, getErrorMessage, getErrorStatus } from "#/api/errors";
|
||||
import { Link } from "../Link/Link";
|
||||
import { Alert, AlertDescription, type AlertProps, AlertTitle } from "./Alert";
|
||||
@@ -11,7 +10,7 @@ type ErrorAlertProps = Readonly<
|
||||
}
|
||||
>;
|
||||
|
||||
export const ErrorAlert: FC<ErrorAlertProps> = ({
|
||||
export const ErrorAlert: React.FC<ErrorAlertProps> = ({
|
||||
error,
|
||||
showDebugDetail = true,
|
||||
...alertProps
|
||||
|
||||
@@ -1,14 +1,6 @@
|
||||
import { cn } from "cn";
|
||||
import { CheckIcon, XIcon } from "lucide-react";
|
||||
import {
|
||||
type KeyboardEvent,
|
||||
type ReactNode,
|
||||
type SyntheticEvent,
|
||||
useCallback,
|
||||
useId,
|
||||
useRef,
|
||||
useState,
|
||||
} from "react";
|
||||
import { useCallback, useId, useRef, useState } from "react";
|
||||
import { ChevronDownIcon } from "#/components/AnimatedIcons/ChevronDown";
|
||||
import {
|
||||
Command,
|
||||
@@ -33,7 +25,7 @@ type AutocompleteProps<TOption> = {
|
||||
getOptionValue: (option: TOption) => string;
|
||||
getOptionLabel: (option: TOption) => string;
|
||||
isOptionEqualToValue?: (option: TOption, value: TOption) => boolean;
|
||||
renderOption?: (option: TOption, isSelected: boolean) => ReactNode;
|
||||
renderOption?: (option: TOption, isSelected: boolean) => React.ReactNode;
|
||||
loading?: boolean;
|
||||
placeholder?: string;
|
||||
noOptionsText?: string;
|
||||
@@ -46,7 +38,7 @@ type AutocompleteProps<TOption> = {
|
||||
inlineSearch?: boolean;
|
||||
clearable?: boolean;
|
||||
disabled?: boolean;
|
||||
startAdornment?: ReactNode;
|
||||
startAdornment?: React.ReactNode;
|
||||
className?: string;
|
||||
triggerAriaInvalid?: boolean;
|
||||
triggerAriaDescribedBy?: string;
|
||||
@@ -140,7 +132,7 @@ export function Autocomplete<TOption>({
|
||||
);
|
||||
|
||||
const handleClear = useCallback(
|
||||
(e: SyntheticEvent) => {
|
||||
(e: React.SyntheticEvent) => {
|
||||
e.stopPropagation();
|
||||
onChange(null);
|
||||
handleInputChange("");
|
||||
@@ -149,7 +141,7 @@ export function Autocomplete<TOption>({
|
||||
);
|
||||
|
||||
const handleKeyDown = useCallback(
|
||||
(e: KeyboardEvent<HTMLElement>) => {
|
||||
(e: React.KeyboardEvent<HTMLElement>) => {
|
||||
if (e.key === "Escape") {
|
||||
// cmdk consumes Escape unless default is prevented before its handler.
|
||||
e.preventDefault();
|
||||
@@ -175,7 +167,7 @@ export function Autocomplete<TOption>({
|
||||
? `${listboxId}-option-${highlightedIndex}`
|
||||
: undefined;
|
||||
|
||||
const handleInlineKeyDown = (e: KeyboardEvent<HTMLElement>) => {
|
||||
const handleInlineKeyDown = (e: React.KeyboardEvent<HTMLElement>) => {
|
||||
if (disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { cn } from "cn";
|
||||
import { type FC, useId, useState } from "react";
|
||||
import { useId, useState } from "react";
|
||||
import { keepPreviousData, useQuery } from "react-query";
|
||||
import { getErrorMessage } from "#/api/errors";
|
||||
import { workspaceAvailableUsers } from "#/api/queries/users";
|
||||
@@ -41,10 +41,9 @@ type WorkspaceUserAutocompleteProps = CommonAutocompleteProps<MinimalUser> & {
|
||||
organizationId: string;
|
||||
};
|
||||
|
||||
export const WorkspaceUserAutocomplete: FC<WorkspaceUserAutocompleteProps> = ({
|
||||
organizationId,
|
||||
...props
|
||||
}) => {
|
||||
export const WorkspaceUserAutocomplete: React.FC<
|
||||
WorkspaceUserAutocompleteProps
|
||||
> = ({ organizationId, ...props }) => {
|
||||
const [filter, setFilter] = useState<string>();
|
||||
|
||||
const availableUsersQuery = useQuery({
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
import { cn } from "cn";
|
||||
import type { FC, ReactNode } from "react";
|
||||
import { Avatar } from "#/components/Avatar/Avatar";
|
||||
|
||||
type AvatarCardProps = {
|
||||
header: string;
|
||||
imgUrl: string;
|
||||
subtitle?: ReactNode;
|
||||
subtitle?: React.ReactNode;
|
||||
maxWidth?: number | "none";
|
||||
};
|
||||
|
||||
export const AvatarCard: FC<AvatarCardProps> = ({
|
||||
export const AvatarCard: React.FC<AvatarCardProps> = ({
|
||||
header,
|
||||
imgUrl,
|
||||
subtitle,
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { cn } from "cn";
|
||||
import type { FC, ReactNode } from "react";
|
||||
import { Avatar } from "#/components/Avatar/Avatar";
|
||||
|
||||
type AvatarDataProps = {
|
||||
title: ReactNode;
|
||||
subtitle?: ReactNode;
|
||||
title: React.ReactNode;
|
||||
subtitle?: React.ReactNode;
|
||||
src?: string;
|
||||
avatar?: React.ReactNode;
|
||||
|
||||
@@ -27,7 +26,7 @@ type AvatarDataProps = {
|
||||
truncate?: boolean;
|
||||
};
|
||||
|
||||
export const AvatarData: FC<AvatarDataProps> = ({
|
||||
export const AvatarData: React.FC<AvatarDataProps> = ({
|
||||
title,
|
||||
subtitle,
|
||||
src,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import type { FC } from "react";
|
||||
import { Skeleton } from "#/components/Skeleton/Skeleton";
|
||||
|
||||
export const AvatarDataSkeleton: FC = () => {
|
||||
export const AvatarDataSkeleton: React.FC = () => {
|
||||
return (
|
||||
<div className="flex items-center gap-3 w-full">
|
||||
<Skeleton className="size-10 rounded-sm shrink-0" />
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
import { cn } from "cn";
|
||||
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
||||
import type { ComponentProps } from "react";
|
||||
import {
|
||||
type DayButton,
|
||||
DayPicker,
|
||||
@@ -26,7 +25,7 @@ function Calendar({
|
||||
formatters,
|
||||
components,
|
||||
...props
|
||||
}: ComponentProps<typeof DayPicker> & {
|
||||
}: React.ComponentProps<typeof DayPicker> & {
|
||||
buttonVariant?: ButtonProps["variant"];
|
||||
}) {
|
||||
const defaultClassNames = getDefaultClassNames();
|
||||
@@ -169,7 +168,7 @@ function CalendarDayButton({
|
||||
day,
|
||||
modifiers,
|
||||
...props
|
||||
}: ComponentProps<typeof DayButton>) {
|
||||
}: React.ComponentProps<typeof DayButton>) {
|
||||
const defaultClassNames = getDefaultClassNames();
|
||||
|
||||
return (
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import { cn } from "cn";
|
||||
import { createContext, type Ref, useContext, useId, useMemo } from "react";
|
||||
import { createContext, useContext, useId, useMemo } from "react";
|
||||
import * as RechartsPrimitive from "recharts";
|
||||
|
||||
// Format: { THEME_NAME: CSS_SELECTOR }
|
||||
@@ -131,7 +131,7 @@ type ChartTooltipContentProps = React.ComponentProps<
|
||||
indicator?: "line" | "dot" | "dashed";
|
||||
nameKey?: string;
|
||||
labelKey?: string;
|
||||
ref?: Ref<HTMLDivElement>;
|
||||
ref?: React.Ref<HTMLDivElement>;
|
||||
};
|
||||
|
||||
export const ChartTooltipContent: React.FC<ChartTooltipContentProps> = ({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { cn } from "cn";
|
||||
import { EyeIcon, EyeOffIcon } from "lucide-react";
|
||||
import { type FC, useState } from "react";
|
||||
import { useState } from "react";
|
||||
import { Button } from "#/components/Button/Button";
|
||||
import {
|
||||
Tooltip,
|
||||
@@ -25,7 +25,7 @@ type CodeExampleProps = {
|
||||
/**
|
||||
* Component to show single-line code examples, with a copy button
|
||||
*/
|
||||
export const CodeExample: FC<CodeExampleProps> = ({
|
||||
export const CodeExample: React.FC<CodeExampleProps> = ({
|
||||
code,
|
||||
className,
|
||||
secret = true,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { cva, type VariantProps } from "class-variance-authority";
|
||||
import { cn } from "cn";
|
||||
import { ChevronRightIcon } from "lucide-react";
|
||||
import { type FC, type ReactNode, useEffect, useRef, useState } from "react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
|
||||
const collapsibleSummaryVariants = cva(
|
||||
`flex items-center gap-1 p-0 bg-transparent border-0 text-inherit cursor-pointer
|
||||
@@ -30,7 +30,7 @@ type CollapsibleSummaryProps = VariantProps<
|
||||
/**
|
||||
* The content to show when expanded
|
||||
*/
|
||||
children: ReactNode;
|
||||
children: React.ReactNode;
|
||||
/**
|
||||
* Whether the section is initially expanded
|
||||
*/
|
||||
@@ -49,7 +49,7 @@ type CollapsibleSummaryProps = VariantProps<
|
||||
scrollIntoViewOnOpen?: boolean;
|
||||
};
|
||||
|
||||
export const CollapsibleSummary: FC<CollapsibleSummaryProps> = ({
|
||||
export const CollapsibleSummary: React.FC<CollapsibleSummaryProps> = ({
|
||||
label,
|
||||
children,
|
||||
defaultOpen = false,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { CopyIcon } from "lucide-react";
|
||||
import type { FC } from "react";
|
||||
import { CheckIcon } from "#/components/AnimatedIcons/Check";
|
||||
import { Button, type ButtonProps } from "#/components/Button/Button";
|
||||
import {
|
||||
@@ -15,7 +14,7 @@ type CopyButtonProps = ButtonProps & {
|
||||
tooltipSide?: "top" | "bottom" | "left" | "right";
|
||||
};
|
||||
|
||||
export const CopyButton: FC<CopyButtonProps> = ({
|
||||
export const CopyButton: React.FC<CopyButtonProps> = ({
|
||||
text,
|
||||
label,
|
||||
tooltipSide,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { cn } from "cn";
|
||||
import { type ComponentProps, type FC, useState } from "react";
|
||||
import { useState } from "react";
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
@@ -10,12 +10,12 @@ import { useClipboard } from "#/hooks/useClipboard";
|
||||
|
||||
type TooltipSide = "top" | "right" | "bottom" | "left";
|
||||
|
||||
type CopyableValueProps = ComponentProps<"span"> & {
|
||||
type CopyableValueProps = React.ComponentProps<"span"> & {
|
||||
value: string;
|
||||
side?: TooltipSide;
|
||||
};
|
||||
|
||||
export const CopyableValue: FC<CopyableValueProps> = ({
|
||||
export const CopyableValue: React.FC<CopyableValueProps> = ({
|
||||
value,
|
||||
side = "bottom",
|
||||
children,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import { cn } from "cn";
|
||||
import dayjs from "dayjs";
|
||||
import { CalendarIcon, MoveRightIcon } from "lucide-react";
|
||||
import { type FC, useState } from "react";
|
||||
import { useState } from "react";
|
||||
import type { DateRange as DayPickerDateRange } from "react-day-picker";
|
||||
import { Button, type ButtonProps } from "#/components/Button/Button";
|
||||
import { Calendar } from "#/components/Calendar/Calendar";
|
||||
@@ -127,7 +127,7 @@ function fromBoundary(value: DateRangeValue): DayPickerDateRange {
|
||||
return { from, to };
|
||||
}
|
||||
|
||||
export const DateRangePicker: FC<DateRangePickerProps> = ({
|
||||
export const DateRangePicker: React.FC<DateRangePickerProps> = ({
|
||||
value,
|
||||
onChange,
|
||||
now,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { cn } from "cn";
|
||||
import dayjs from "dayjs";
|
||||
import { CalendarIcon, CheckIcon } from "lucide-react";
|
||||
import { type FC, type KeyboardEvent, useEffect, useId, useState } from "react";
|
||||
import { useEffect, useId, useState } from "react";
|
||||
import type { DateRange as DayPickerDateRange } from "react-day-picker";
|
||||
import { ChevronDownIcon } from "#/components/AnimatedIcons/ChevronDown";
|
||||
import { Button, type ButtonProps } from "#/components/Button/Button";
|
||||
@@ -112,7 +112,7 @@ const defaultTimeFields = (): TimeFieldsState => ({
|
||||
toTouched: false,
|
||||
});
|
||||
|
||||
export const DateTimeRangePicker: FC<DateTimeRangePickerProps> = ({
|
||||
export const DateTimeRangePicker: React.FC<DateTimeRangePickerProps> = ({
|
||||
value,
|
||||
onChange,
|
||||
now,
|
||||
@@ -175,7 +175,9 @@ export const DateTimeRangePicker: FC<DateTimeRangePickerProps> = ({
|
||||
};
|
||||
|
||||
// Roving focus for the quick-pick radiogroup.
|
||||
const handleQuickPickKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {
|
||||
const handleQuickPickKeyDown = (
|
||||
event: React.KeyboardEvent<HTMLDivElement>,
|
||||
) => {
|
||||
const isNext = event.key === "ArrowDown" || event.key === "ArrowRight";
|
||||
const isPrevious = event.key === "ArrowUp" || event.key === "ArrowLeft";
|
||||
if (!isNext && !isPrevious) {
|
||||
@@ -416,7 +418,7 @@ type QuickPickButtonProps = {
|
||||
onClick: () => void;
|
||||
};
|
||||
|
||||
const QuickPickButton: FC<QuickPickButtonProps> = ({
|
||||
const QuickPickButton: React.FC<QuickPickButtonProps> = ({
|
||||
label,
|
||||
selected,
|
||||
tabIndex,
|
||||
@@ -453,7 +455,7 @@ type TimeRowProps = {
|
||||
onMeridiemChange: (meridiem: Meridiem) => void;
|
||||
};
|
||||
|
||||
const TimeRow: FC<TimeRowProps> = ({
|
||||
const TimeRow: React.FC<TimeRowProps> = ({
|
||||
id,
|
||||
label,
|
||||
time,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { FC, ReactNode } from "react";
|
||||
import {
|
||||
Dialog,
|
||||
DialogActions,
|
||||
@@ -12,7 +11,7 @@ import {
|
||||
type ConfirmDialogType = "delete" | "info" | "success";
|
||||
|
||||
type ConfirmDialogTypeConfig = {
|
||||
confirmText: ReactNode;
|
||||
confirmText: React.ReactNode;
|
||||
hideCancel: boolean;
|
||||
};
|
||||
|
||||
@@ -38,9 +37,9 @@ export type ConfirmDialogProps = {
|
||||
readonly title: string;
|
||||
readonly open: boolean;
|
||||
readonly onClose: () => void;
|
||||
readonly description: ReactNode;
|
||||
readonly description: React.ReactNode;
|
||||
readonly cancelText?: string;
|
||||
readonly confirmText?: ReactNode;
|
||||
readonly confirmText?: React.ReactNode;
|
||||
readonly confirmLoading?: boolean;
|
||||
readonly disabled?: boolean;
|
||||
/**
|
||||
@@ -65,7 +64,7 @@ export type ConfirmDialogProps = {
|
||||
/**
|
||||
* Quick-use dialog for yes/no style confirmations without custom layout.
|
||||
*/
|
||||
export const ConfirmDialog: FC<ConfirmDialogProps> = ({
|
||||
export const ConfirmDialog: React.FC<ConfirmDialogProps> = ({
|
||||
cancelText = "Cancel",
|
||||
confirmLoading = false,
|
||||
confirmText,
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
import {
|
||||
type ChangeEvent,
|
||||
type FC,
|
||||
type KeyboardEvent,
|
||||
type ReactNode,
|
||||
useId,
|
||||
useState,
|
||||
} from "react";
|
||||
import { useId, useState } from "react";
|
||||
import { Input } from "#/components/Input/Input";
|
||||
import { Label } from "#/components/Label/Label";
|
||||
|
||||
@@ -40,13 +33,13 @@ export const useDeleteConfirmation = (name: string, isOpen: boolean) => {
|
||||
showError,
|
||||
inputProps: {
|
||||
value,
|
||||
onChange: (event: ChangeEvent<HTMLInputElement>) => {
|
||||
onChange: (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
setValue(event.target.value);
|
||||
setHasSubmittedInvalid(false);
|
||||
},
|
||||
onFocus: () => setIsFocused(true),
|
||||
onBlur: () => setIsFocused(false),
|
||||
onKeyDown: (event: KeyboardEvent<HTMLInputElement>) => {
|
||||
onKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => {
|
||||
// DeleteDialog disables its submit button for a wrong name, so its form
|
||||
// never submits and onSubmit cannot set this.
|
||||
if (event.key === "Enter" && !confirmed) {
|
||||
@@ -59,15 +52,13 @@ export const useDeleteConfirmation = (name: string, isOpen: boolean) => {
|
||||
|
||||
type DeleteConfirmationFieldProps = {
|
||||
confirmation: ReturnType<typeof useDeleteConfirmation>;
|
||||
label: ReactNode;
|
||||
label: React.ReactNode;
|
||||
entity: string;
|
||||
};
|
||||
|
||||
export const DeleteConfirmationField: FC<DeleteConfirmationFieldProps> = ({
|
||||
confirmation,
|
||||
label,
|
||||
entity,
|
||||
}) => {
|
||||
export const DeleteConfirmationField: React.FC<
|
||||
DeleteConfirmationFieldProps
|
||||
> = ({ confirmation, label, entity }) => {
|
||||
const inputId = useId();
|
||||
const errorId = `${inputId}-error`;
|
||||
const { name, value, showError, inputProps } = confirmation;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { screen } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { type FC, useState } from "react";
|
||||
import { useState } from "react";
|
||||
import { render } from "#/testHelpers/renderHelpers";
|
||||
import { DeleteDialog } from "./DeleteDialog";
|
||||
|
||||
@@ -11,7 +11,11 @@ type HarnessProps = {
|
||||
};
|
||||
|
||||
// Callers either close the dialog after confirming or keep it open to retry.
|
||||
const Harness: FC<HarnessProps> = ({ onConfirm, onCancel, closeOnConfirm }) => {
|
||||
const Harness: React.FC<HarnessProps> = ({
|
||||
onConfirm,
|
||||
onCancel,
|
||||
closeOnConfirm,
|
||||
}) => {
|
||||
const [isOpen, setIsOpen] = useState(true);
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { FC, FormEvent } from "react";
|
||||
import { Alert } from "#/components/Alert/Alert";
|
||||
import { Button } from "#/components/Button/Button";
|
||||
import {
|
||||
@@ -29,7 +28,7 @@ type DeleteDialogProps = {
|
||||
confirmText?: string;
|
||||
};
|
||||
|
||||
export const DeleteDialog: FC<DeleteDialogProps> = ({
|
||||
export const DeleteDialog: React.FC<DeleteDialogProps> = ({
|
||||
isOpen,
|
||||
onCancel,
|
||||
onConfirm,
|
||||
@@ -51,7 +50,7 @@ export const DeleteDialog: FC<DeleteDialogProps> = ({
|
||||
}
|
||||
};
|
||||
|
||||
const onSubmit = (event: FormEvent<HTMLFormElement>) => {
|
||||
const onSubmit = (event: React.FormEvent<HTMLFormElement>) => {
|
||||
event.preventDefault();
|
||||
if (confirmation.confirmed && !confirmLoading) {
|
||||
onConfirm();
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
import { cn } from "cn";
|
||||
import {
|
||||
type ComponentProps,
|
||||
type FC,
|
||||
type ReactNode,
|
||||
useId,
|
||||
useState,
|
||||
} from "react";
|
||||
import { useId, useState } from "react";
|
||||
import { Input } from "#/components/Input/Input";
|
||||
import { Label } from "#/components/Label/Label";
|
||||
import {
|
||||
@@ -23,14 +17,14 @@ import {
|
||||
} from "#/utils/time";
|
||||
|
||||
type DurationFieldProps = Omit<
|
||||
ComponentProps<typeof Input>,
|
||||
React.ComponentProps<typeof Input>,
|
||||
"value" | "onChange" | "type"
|
||||
> & {
|
||||
valueMs: number;
|
||||
onChange: (value: number) => void;
|
||||
label?: string;
|
||||
error?: boolean;
|
||||
helperText?: ReactNode;
|
||||
helperText?: React.ReactNode;
|
||||
};
|
||||
|
||||
function toMs(value: string, unit: TimeUnit): number {
|
||||
@@ -47,7 +41,7 @@ function toDisplayValue(ms: number, unit: TimeUnit): string {
|
||||
: durationInDays(ms).toString();
|
||||
}
|
||||
|
||||
export const DurationField: FC<DurationFieldProps> = ({
|
||||
export const DurationField: React.FC<DurationFieldProps> = ({
|
||||
valueMs,
|
||||
onChange,
|
||||
label,
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import { cn } from "cn";
|
||||
import type { ComponentProps, FC, ReactNode } from "react";
|
||||
|
||||
export type EmptyStateProps = ComponentProps<"div"> & {
|
||||
export type EmptyStateProps = React.ComponentProps<"div"> & {
|
||||
/** Text Message to display, placed inside Typography component */
|
||||
message: string;
|
||||
/** Longer optional description to display below the message */
|
||||
description?: string | ReactNode;
|
||||
cta?: ReactNode;
|
||||
image?: ReactNode;
|
||||
description?: string | React.ReactNode;
|
||||
cta?: React.ReactNode;
|
||||
image?: React.ReactNode;
|
||||
isCompact?: boolean;
|
||||
};
|
||||
|
||||
@@ -16,7 +15,7 @@ export type EmptyStateProps = ComponentProps<"div"> & {
|
||||
* provide a button that would allow the user to return from where they were,
|
||||
* or to add an item that they currently have none of.
|
||||
*/
|
||||
export const EmptyState: FC<EmptyStateProps> = ({
|
||||
export const EmptyState: React.FC<EmptyStateProps> = ({
|
||||
message,
|
||||
description,
|
||||
cta,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { type FC, useState } from "react";
|
||||
import { useState } from "react";
|
||||
import {
|
||||
type ErrorResponse,
|
||||
isRouteErrorResponse,
|
||||
@@ -14,15 +14,15 @@ const errorPageTitle = "Something went wrong";
|
||||
|
||||
// Mocking React Router's error-handling logic is a pain; the next best thing is
|
||||
// to split it off from the rest of the code, and pass the value via props
|
||||
export const GlobalErrorBoundary: FC = () => {
|
||||
export const GlobalErrorBoundary: React.FC = () => {
|
||||
const error = useRouteError();
|
||||
return <GlobalErrorBoundaryInner error={error} />;
|
||||
};
|
||||
|
||||
type GlobalErrorBoundaryInnerProps = Readonly<{ error: unknown }>;
|
||||
export const GlobalErrorBoundaryInner: FC<GlobalErrorBoundaryInnerProps> = ({
|
||||
error,
|
||||
}) => {
|
||||
export const GlobalErrorBoundaryInner: React.FC<
|
||||
GlobalErrorBoundaryInnerProps
|
||||
> = ({ error }) => {
|
||||
const [showErrorMessage, setShowErrorMessage] = useState(false);
|
||||
const { metadata } = useEmbeddedMetadata();
|
||||
const location = useLocation();
|
||||
@@ -93,7 +93,7 @@ export const GlobalErrorBoundaryInner: FC<GlobalErrorBoundaryInnerProps> = ({
|
||||
};
|
||||
|
||||
type ErrorStackProps = Readonly<{ error: Error | ErrorResponse }>;
|
||||
const ErrorStack: FC<ErrorStackProps> = ({ error }) => {
|
||||
const ErrorStack: React.FC<ErrorStackProps> = ({ error }) => {
|
||||
return (
|
||||
<aside className="p-4 text-left rounded-md border border-content-tertiary border-solid">
|
||||
{isRouteErrorResponse(error) ? (
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { type FC, useMemo } from "react";
|
||||
import { useMemo } from "react";
|
||||
import setiIconTheme from "./seti-icon-theme.json";
|
||||
|
||||
type SetiIconDefinition = {
|
||||
@@ -256,7 +256,7 @@ type FileIconProps = {
|
||||
style?: React.CSSProperties;
|
||||
};
|
||||
|
||||
export const FileIcon: FC<FileIconProps> = ({
|
||||
export const FileIcon: React.FC<FileIconProps> = ({
|
||||
fileName,
|
||||
filePath,
|
||||
className,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { cn } from "cn";
|
||||
import { CloudUploadIcon, FolderIcon, TrashIcon } from "lucide-react";
|
||||
import { type DragEvent, type FC, type ReactNode, useRef } from "react";
|
||||
import { useRef } from "react";
|
||||
import { Button } from "#/components/Button/Button";
|
||||
import { useClickable } from "#/hooks/useClickable";
|
||||
import { Spinner } from "../Spinner/Spinner";
|
||||
@@ -13,11 +13,11 @@ type FileUploadProps = {
|
||||
file?: File;
|
||||
removeLabel: string;
|
||||
title: string;
|
||||
description?: ReactNode;
|
||||
description?: React.ReactNode;
|
||||
extensions?: string[];
|
||||
};
|
||||
|
||||
export const FileUpload: FC<FileUploadProps> = ({
|
||||
export const FileUpload: React.FC<FileUploadProps> = ({
|
||||
isUploading,
|
||||
onUpload,
|
||||
onUnsupportedFile,
|
||||
@@ -107,14 +107,14 @@ const useFileDrop = (
|
||||
extensions?: string[],
|
||||
onUnsupportedFile?: (file: File) => void,
|
||||
): {
|
||||
onDragOver: (e: DragEvent<HTMLDivElement>) => void;
|
||||
onDrop: (e: DragEvent<HTMLDivElement>) => void;
|
||||
onDragOver: (e: React.DragEvent<HTMLDivElement>) => void;
|
||||
onDrop: (e: React.DragEvent<HTMLDivElement>) => void;
|
||||
} => {
|
||||
const onDragOver = (e: DragEvent<HTMLDivElement>) => {
|
||||
const onDragOver = (e: React.DragEvent<HTMLDivElement>) => {
|
||||
e.preventDefault();
|
||||
};
|
||||
|
||||
const onDrop = (e: DragEvent<HTMLDivElement>) => {
|
||||
const onDrop = (e: React.DragEvent<HTMLDivElement>) => {
|
||||
e.preventDefault();
|
||||
const file = e.dataTransfer.files[0] as File | undefined;
|
||||
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
import { cn } from "cn";
|
||||
import { ExternalLinkIcon, SlidersHorizontalIcon } from "lucide-react";
|
||||
import {
|
||||
type ComponentProps,
|
||||
type FC,
|
||||
type ReactNode,
|
||||
useEffect,
|
||||
useRef,
|
||||
useState,
|
||||
} from "react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import {
|
||||
getValidationErrorMessage,
|
||||
hasError,
|
||||
@@ -105,7 +98,10 @@ export const useFilter = ({
|
||||
};
|
||||
};
|
||||
|
||||
const BaseSkeleton: FC<SkeletonProps> = ({ children, ...skeletonProps }) => {
|
||||
const BaseSkeleton: React.FC<SkeletonProps> = ({
|
||||
children,
|
||||
...skeletonProps
|
||||
}) => {
|
||||
return (
|
||||
<Skeleton
|
||||
height={36}
|
||||
@@ -117,23 +113,23 @@ const BaseSkeleton: FC<SkeletonProps> = ({ children, ...skeletonProps }) => {
|
||||
);
|
||||
};
|
||||
|
||||
export const MenuSkeleton: FC = () => {
|
||||
export const MenuSkeleton: React.FC = () => {
|
||||
return <BaseSkeleton className="min-w-[200px] shrink-0" />;
|
||||
};
|
||||
|
||||
type FilterProps = ComponentProps<"div"> & {
|
||||
type FilterProps = React.ComponentProps<"div"> & {
|
||||
filter: ReturnType<typeof useFilter>;
|
||||
optionsSkeleton: ReactNode;
|
||||
optionsSkeleton: React.ReactNode;
|
||||
isLoading: boolean;
|
||||
learnMoreLink?: string;
|
||||
learnMoreLabel2?: string;
|
||||
learnMoreLink2?: string;
|
||||
error?: unknown;
|
||||
options?: ReactNode;
|
||||
options?: React.ReactNode;
|
||||
presets: PresetFilter[];
|
||||
};
|
||||
|
||||
export const Filter: FC<FilterProps> = ({
|
||||
export const Filter: React.FC<FilterProps> = ({
|
||||
filter,
|
||||
isLoading,
|
||||
error,
|
||||
@@ -234,7 +230,7 @@ type PresetMenuProps = {
|
||||
onSelect: (query: string) => void;
|
||||
};
|
||||
|
||||
const PresetMenu: FC<PresetMenuProps> = ({
|
||||
const PresetMenu: React.FC<PresetMenuProps> = ({
|
||||
value,
|
||||
presets,
|
||||
learnMoreLink,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { CheckIcon, ListFilterIcon, SearchIcon } from "lucide-react";
|
||||
import { type ReactNode, useId } from "react";
|
||||
import { useId } from "react";
|
||||
import { Avatar } from "#/components/Avatar/Avatar";
|
||||
import { Badge } from "#/components/Badge/Badge";
|
||||
import { Button } from "#/components/Button/Button";
|
||||
@@ -236,7 +236,11 @@ export function FilterCombobox({
|
||||
const OPTION_ITEM_CLASS = "min-h-8.5 gap-2 px-2 py-1.25";
|
||||
|
||||
// Fixed 24px slot so icons, avatars, and status dots of different sizes align.
|
||||
function OptionIcon({ children }: { children: ReactNode }): ReactNode {
|
||||
function OptionIcon({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}): React.ReactNode {
|
||||
return (
|
||||
<span
|
||||
aria-hidden
|
||||
@@ -253,7 +257,7 @@ function ChipLabel({
|
||||
}: {
|
||||
prefix: string;
|
||||
value: string;
|
||||
}): ReactNode {
|
||||
}): React.ReactNode {
|
||||
if (prefix.length === 0) {
|
||||
return value;
|
||||
}
|
||||
@@ -273,7 +277,7 @@ function CategoryPreviewText({
|
||||
preview,
|
||||
}: {
|
||||
preview: CategoryPreview | undefined;
|
||||
}): ReactNode {
|
||||
}): React.ReactNode {
|
||||
if (!preview) {
|
||||
return null;
|
||||
}
|
||||
@@ -295,7 +299,7 @@ function CategoryPreviewText({
|
||||
);
|
||||
}
|
||||
|
||||
function ResultIcon({ result }: { result: SearchResult }): ReactNode {
|
||||
function ResultIcon({ result }: { result: SearchResult }): React.ReactNode {
|
||||
if (result.startIcon) {
|
||||
return <OptionIcon>{result.startIcon}</OptionIcon>;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { ReactNode } from "react";
|
||||
import {
|
||||
FILTER_TOKEN_RE,
|
||||
needsQuotes,
|
||||
@@ -275,7 +274,7 @@ type CategoryValueSuggestion = {
|
||||
option: {
|
||||
label: string;
|
||||
value: string;
|
||||
startIcon?: ReactNode;
|
||||
startIcon?: React.ReactNode;
|
||||
};
|
||||
token: string;
|
||||
};
|
||||
|
||||
@@ -1,16 +1,7 @@
|
||||
import { Command as CommandPrimitive, useCommandState } from "cmdk";
|
||||
import { cn } from "cn";
|
||||
import { XIcon } from "lucide-react";
|
||||
import {
|
||||
type ComponentProps,
|
||||
createContext,
|
||||
type FC,
|
||||
type ReactNode,
|
||||
type RefObject,
|
||||
useContext,
|
||||
useRef,
|
||||
useState,
|
||||
} from "react";
|
||||
import { createContext, useContext, useRef, useState } from "react";
|
||||
import { Badge } from "#/components/Badge/Badge";
|
||||
import { InputGroup } from "#/components/InputGroup/InputGroup";
|
||||
import {
|
||||
@@ -27,7 +18,7 @@ import {
|
||||
// `Command*` layer could remove the duplication.
|
||||
|
||||
const FilterComboboxAnchorContext =
|
||||
createContext<RefObject<HTMLDivElement | null> | null>(null);
|
||||
createContext<React.RefObject<HTMLDivElement | null> | null>(null);
|
||||
|
||||
type FilterComboboxStateValue = {
|
||||
inputValue: string;
|
||||
@@ -65,7 +56,7 @@ type FilterComboboxRootProps = {
|
||||
onItemHighlighted?: (value: string | undefined) => void;
|
||||
/** Accessible label for the input. cmdk wires it via `aria-labelledby`. */
|
||||
label?: string;
|
||||
children?: ReactNode;
|
||||
children?: React.ReactNode;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -133,9 +124,9 @@ export function FilterComboboxRoot({
|
||||
);
|
||||
}
|
||||
|
||||
type FilterComboboxContentProps = ComponentProps<typeof PopoverContent>;
|
||||
type FilterComboboxContentProps = React.ComponentProps<typeof PopoverContent>;
|
||||
|
||||
export const FilterComboboxContent: FC<FilterComboboxContentProps> = ({
|
||||
export const FilterComboboxContent: React.FC<FilterComboboxContentProps> = ({
|
||||
className,
|
||||
align = "start",
|
||||
sideOffset = 6,
|
||||
@@ -168,9 +159,11 @@ export const FilterComboboxContent: FC<FilterComboboxContentProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
type FilterComboboxListProps = ComponentProps<typeof CommandPrimitive.List>;
|
||||
type FilterComboboxListProps = React.ComponentProps<
|
||||
typeof CommandPrimitive.List
|
||||
>;
|
||||
|
||||
export const FilterComboboxList: FC<FilterComboboxListProps> = ({
|
||||
export const FilterComboboxList: React.FC<FilterComboboxListProps> = ({
|
||||
className,
|
||||
...props
|
||||
}) => {
|
||||
@@ -189,14 +182,16 @@ export const FilterComboboxList: FC<FilterComboboxListProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
type FilterComboboxItemProps = ComponentProps<typeof CommandPrimitive.Item>;
|
||||
type FilterComboboxItemProps = React.ComponentProps<
|
||||
typeof CommandPrimitive.Item
|
||||
>;
|
||||
|
||||
/**
|
||||
* A dropdown row. Rows are actions, not toggles: pass `onSelect` to run the
|
||||
* row's behavior (open a category, add a chip, navigate to a result). cmdk
|
||||
* calls `onSelect` on click and on Enter for the highlighted row.
|
||||
*/
|
||||
export const FilterComboboxItem: FC<FilterComboboxItemProps> = ({
|
||||
export const FilterComboboxItem: React.FC<FilterComboboxItemProps> = ({
|
||||
className,
|
||||
...props
|
||||
}) => {
|
||||
@@ -212,9 +207,11 @@ export const FilterComboboxItem: FC<FilterComboboxItemProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
type FilterComboboxGroupProps = ComponentProps<typeof CommandPrimitive.Group>;
|
||||
type FilterComboboxGroupProps = React.ComponentProps<
|
||||
typeof CommandPrimitive.Group
|
||||
>;
|
||||
|
||||
export const FilterComboboxGroup: FC<FilterComboboxGroupProps> = ({
|
||||
export const FilterComboboxGroup: React.FC<FilterComboboxGroupProps> = ({
|
||||
className,
|
||||
...props
|
||||
}) => {
|
||||
@@ -227,9 +224,9 @@ export const FilterComboboxGroup: FC<FilterComboboxGroupProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
type FilterComboboxLabelProps = ComponentProps<"div">;
|
||||
type FilterComboboxLabelProps = React.ComponentProps<"div">;
|
||||
|
||||
export const FilterComboboxLabel: FC<FilterComboboxLabelProps> = ({
|
||||
export const FilterComboboxLabel: React.FC<FilterComboboxLabelProps> = ({
|
||||
className,
|
||||
...props
|
||||
}) => {
|
||||
@@ -246,9 +243,9 @@ export const FilterComboboxLabel: FC<FilterComboboxLabelProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
type FilterComboboxEmptyProps = ComponentProps<"div">;
|
||||
type FilterComboboxEmptyProps = React.ComponentProps<"div">;
|
||||
|
||||
export const FilterComboboxEmpty: FC<FilterComboboxEmptyProps> = ({
|
||||
export const FilterComboboxEmpty: React.FC<FilterComboboxEmptyProps> = ({
|
||||
className,
|
||||
...props
|
||||
}) => {
|
||||
@@ -266,9 +263,9 @@ export const FilterComboboxEmpty: FC<FilterComboboxEmptyProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
type FilterComboboxStatusProps = ComponentProps<"div">;
|
||||
type FilterComboboxStatusProps = React.ComponentProps<"div">;
|
||||
|
||||
export const FilterComboboxStatus: FC<FilterComboboxStatusProps> = ({
|
||||
export const FilterComboboxStatus: React.FC<FilterComboboxStatusProps> = ({
|
||||
className,
|
||||
...props
|
||||
}) => {
|
||||
@@ -283,12 +280,11 @@ export const FilterComboboxStatus: FC<FilterComboboxStatusProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
type FilterComboboxInputGroupProps = ComponentProps<"div">;
|
||||
type FilterComboboxInputGroupProps = React.ComponentProps<"div">;
|
||||
|
||||
export const FilterComboboxInputGroup: FC<FilterComboboxInputGroupProps> = ({
|
||||
className,
|
||||
...props
|
||||
}) => {
|
||||
export const FilterComboboxInputGroup: React.FC<
|
||||
FilterComboboxInputGroupProps
|
||||
> = ({ className, ...props }) => {
|
||||
const anchorRef = useContext(FilterComboboxAnchorContext);
|
||||
|
||||
return (
|
||||
@@ -302,9 +298,9 @@ export const FilterComboboxInputGroup: FC<FilterComboboxInputGroupProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
type FilterComboboxChipsProps = ComponentProps<"div">;
|
||||
type FilterComboboxChipsProps = React.ComponentProps<"div">;
|
||||
|
||||
export const FilterComboboxChips: FC<FilterComboboxChipsProps> = ({
|
||||
export const FilterComboboxChips: React.FC<FilterComboboxChipsProps> = ({
|
||||
className,
|
||||
...props
|
||||
}) => {
|
||||
@@ -320,7 +316,7 @@ export const FilterComboboxChips: FC<FilterComboboxChipsProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
type FilterComboboxChipProps = ComponentProps<typeof Badge> & {
|
||||
type FilterComboboxChipProps = React.ComponentProps<typeof Badge> & {
|
||||
/**
|
||||
* Token passed to `onRemoveValue` when the chip is removed. Decoupled from
|
||||
* `children` so the chip can render richer content than a bare string.
|
||||
@@ -332,7 +328,7 @@ type FilterComboboxChipProps = ComponentProps<typeof Badge> & {
|
||||
removeLabel?: string;
|
||||
};
|
||||
|
||||
export const FilterComboboxChip: FC<FilterComboboxChipProps> = ({
|
||||
export const FilterComboboxChip: React.FC<FilterComboboxChipProps> = ({
|
||||
className,
|
||||
children,
|
||||
value,
|
||||
@@ -383,15 +379,13 @@ export const FilterComboboxChip: FC<FilterComboboxChipProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
type FilterComboboxChipsInputProps = ComponentProps<
|
||||
type FilterComboboxChipsInputProps = React.ComponentProps<
|
||||
typeof CommandPrimitive.Input
|
||||
>;
|
||||
|
||||
export const FilterComboboxChipsInput: FC<FilterComboboxChipsInputProps> = ({
|
||||
className,
|
||||
ref,
|
||||
...props
|
||||
}) => {
|
||||
export const FilterComboboxChipsInput: React.FC<
|
||||
FilterComboboxChipsInputProps
|
||||
> = ({ className, ref, ...props }) => {
|
||||
const { inputValue, onInputValueChange } = useFilterComboboxState();
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
export type FilterOption = {
|
||||
label: string;
|
||||
/** Label used once the option is applied; defaults to `label`. */
|
||||
appliedLabel?: string;
|
||||
value: string;
|
||||
startIcon?: ReactNode;
|
||||
startIcon?: React.ReactNode;
|
||||
subtitle?: string;
|
||||
/**
|
||||
* Explicit chip token committed when this option is selected, overriding the
|
||||
@@ -20,7 +18,7 @@ export type FilterCategory = {
|
||||
key: string;
|
||||
label: string;
|
||||
getOptions: (query: string) => Promise<FilterOption[]>;
|
||||
icon?: ReactNode;
|
||||
icon?: React.ReactNode;
|
||||
/** Extra typed prefixes that enter this category, e.g. `user` for `owner`. */
|
||||
aliases?: readonly string[];
|
||||
/** Fixed text at the end of the category row instead of an options sample. */
|
||||
@@ -38,7 +36,7 @@ export type FilterCategory = {
|
||||
export type SearchResult = {
|
||||
label: string;
|
||||
value: string;
|
||||
startIcon?: ReactNode;
|
||||
startIcon?: React.ReactNode;
|
||||
/** Renders an avatar when `startIcon` is not provided. */
|
||||
imageUrl?: string;
|
||||
/** Opaque payload for `onSearchResultSelect`, e.g. a workspace URL path. */
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
import {
|
||||
type KeyboardEvent as ReactKeyboardEvent,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useReducer,
|
||||
useRef,
|
||||
} from "react";
|
||||
import { useEffect, useMemo, useReducer, useRef } from "react";
|
||||
import { useQueries, useQuery } from "react-query";
|
||||
import { useDebouncedFunction, useDebouncedValue } from "#/hooks/debounce";
|
||||
import {
|
||||
@@ -605,7 +599,7 @@ export const useFilterCombobox = ({
|
||||
updateFromChips(chipValues.filter((entry) => entry !== token));
|
||||
};
|
||||
|
||||
const handleInputKeyDown = (event: ReactKeyboardEvent<HTMLInputElement>) => {
|
||||
const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {
|
||||
const isBackspaceOrDelete =
|
||||
event.key === "Backspace" || event.key === "Delete";
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { FC } from "react";
|
||||
import { Filter, type useFilter } from "#/components/Filter/Filter";
|
||||
|
||||
type GroupsFilterProps = {
|
||||
@@ -7,7 +6,7 @@ type GroupsFilterProps = {
|
||||
|
||||
// GroupsFilter renders a search-only filter. Groups support free-text search
|
||||
// against name and display name, so there are no presets or option menus.
|
||||
export const GroupsFilter: FC<GroupsFilterProps> = ({ filter }) => {
|
||||
export const GroupsFilter: React.FC<GroupsFilterProps> = ({ filter }) => {
|
||||
return (
|
||||
<Filter
|
||||
presets={[]}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { cn } from "cn";
|
||||
import type { FC, ReactNode } from "react";
|
||||
import {
|
||||
Combobox,
|
||||
ComboboxButton,
|
||||
@@ -14,7 +13,7 @@ import { Spinner } from "#/components/Spinner/Spinner";
|
||||
const BASE_WIDTH = 200;
|
||||
|
||||
export type SelectFilterOption = {
|
||||
startIcon?: ReactNode;
|
||||
startIcon?: React.ReactNode;
|
||||
label: string;
|
||||
value: string;
|
||||
};
|
||||
@@ -31,10 +30,10 @@ type SelectFilterProps = {
|
||||
onSelect: (option: SelectFilterOption | undefined) => void;
|
||||
width?: number;
|
||||
// SelectFilterSearch element
|
||||
selectFilterSearch?: ReactNode;
|
||||
selectFilterSearch?: React.ReactNode;
|
||||
};
|
||||
|
||||
export const SelectFilter: FC<SelectFilterProps> = ({
|
||||
export const SelectFilter: React.FC<SelectFilterProps> = ({
|
||||
label,
|
||||
options,
|
||||
selectedOption,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { FC } from "react";
|
||||
import { API } from "#/api/api";
|
||||
import { Avatar } from "#/components/Avatar/Avatar";
|
||||
import { ComboboxInput } from "#/components/Combobox/Combobox";
|
||||
@@ -88,7 +87,11 @@ type UserMenuProps = {
|
||||
width?: number;
|
||||
};
|
||||
|
||||
export const UserMenu: FC<UserMenuProps> = ({ menu, width, placeholder }) => {
|
||||
export const UserMenu: React.FC<UserMenuProps> = ({
|
||||
menu,
|
||||
width,
|
||||
placeholder,
|
||||
}) => {
|
||||
return (
|
||||
<SelectFilter
|
||||
label="Select user"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { FC } from "react";
|
||||
import {
|
||||
Filter,
|
||||
MenuSkeleton,
|
||||
@@ -68,7 +67,11 @@ type UsersFilterProps = {
|
||||
};
|
||||
};
|
||||
|
||||
export const UsersFilter: FC<UsersFilterProps> = ({ filter, error, menus }) => {
|
||||
export const UsersFilter: React.FC<UsersFilterProps> = ({
|
||||
filter,
|
||||
error,
|
||||
menus,
|
||||
}) => {
|
||||
return (
|
||||
<Filter
|
||||
presets={PRESET_FILTERS}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { useFormik } from "formik";
|
||||
import type { FC } from "react";
|
||||
import { FormField } from "#/components/FormField/FormField";
|
||||
import { getFormHelpers } from "#/utils/formUtils";
|
||||
import { Form, FormFields, FormSection } from "./Form";
|
||||
|
||||
const ExampleForm: FC<{ direction?: "horizontal" | "vertical" }> = ({
|
||||
const ExampleForm: React.FC<{ direction?: "horizontal" | "vertical" }> = ({
|
||||
direction,
|
||||
}) => {
|
||||
const form = useFormik({
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
import { cn } from "cn";
|
||||
import {
|
||||
type ComponentProps,
|
||||
createContext,
|
||||
type FC,
|
||||
type HTMLProps,
|
||||
type ReactNode,
|
||||
useContext,
|
||||
} from "react";
|
||||
import { createContext, useContext } from "react";
|
||||
import { AlphaBadge, DeprecatedBadge } from "#/components/Badge/PresetBadges";
|
||||
|
||||
type FormContextValue = { direction?: "horizontal" | "vertical" };
|
||||
@@ -15,11 +8,15 @@ const FormContext = createContext<FormContextValue>({
|
||||
direction: "horizontal",
|
||||
});
|
||||
|
||||
type FormProps = HTMLProps<HTMLFormElement> & {
|
||||
type FormProps = React.HTMLProps<HTMLFormElement> & {
|
||||
direction?: FormContextValue["direction"];
|
||||
};
|
||||
|
||||
export const Form: FC<FormProps> = ({ direction, className, ...formProps }) => {
|
||||
export const Form: React.FC<FormProps> = ({
|
||||
direction,
|
||||
className,
|
||||
...formProps
|
||||
}) => {
|
||||
return (
|
||||
<FormContext.Provider value={{ direction }}>
|
||||
<form
|
||||
@@ -34,7 +31,7 @@ export const Form: FC<FormProps> = ({ direction, className, ...formProps }) => {
|
||||
);
|
||||
};
|
||||
|
||||
export const HorizontalForm: FC<HTMLProps<HTMLFormElement>> = ({
|
||||
export const HorizontalForm: React.FC<React.HTMLProps<HTMLFormElement>> = ({
|
||||
children,
|
||||
...formProps
|
||||
}) => {
|
||||
@@ -45,7 +42,7 @@ export const HorizontalForm: FC<HTMLProps<HTMLFormElement>> = ({
|
||||
);
|
||||
};
|
||||
|
||||
export const VerticalForm: FC<HTMLProps<HTMLFormElement>> = ({
|
||||
export const VerticalForm: React.FC<React.HTMLProps<HTMLFormElement>> = ({
|
||||
children,
|
||||
...formProps
|
||||
}) => {
|
||||
@@ -57,9 +54,9 @@ export const VerticalForm: FC<HTMLProps<HTMLFormElement>> = ({
|
||||
};
|
||||
|
||||
type FormSectionProps = {
|
||||
children?: ReactNode;
|
||||
title: ReactNode;
|
||||
description: ReactNode;
|
||||
children?: React.ReactNode;
|
||||
title: React.ReactNode;
|
||||
description: React.ReactNode;
|
||||
classes?: {
|
||||
root?: string;
|
||||
sectionInfo?: string;
|
||||
@@ -70,7 +67,7 @@ type FormSectionProps = {
|
||||
ref?: React.Ref<HTMLElement>;
|
||||
};
|
||||
|
||||
export const FormSection: FC<FormSectionProps> = ({
|
||||
export const FormSection: React.FC<FormSectionProps> = ({
|
||||
children,
|
||||
title,
|
||||
description,
|
||||
@@ -119,7 +116,7 @@ export const FormSection: FC<FormSectionProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
export const FormFields: FC<ComponentProps<"div">> = ({
|
||||
export const FormFields: React.FC<React.ComponentProps<"div">> = ({
|
||||
className,
|
||||
...props
|
||||
}) => {
|
||||
@@ -128,7 +125,7 @@ export const FormFields: FC<ComponentProps<"div">> = ({
|
||||
);
|
||||
};
|
||||
|
||||
export const FormFooter: FC<HTMLProps<HTMLDivElement>> = ({
|
||||
export const FormFooter: React.FC<React.HTMLProps<HTMLDivElement>> = ({
|
||||
className,
|
||||
...props
|
||||
}) => (
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { useFormik } from "formik";
|
||||
import type { FC } from "react";
|
||||
import { expect, within } from "storybook/test";
|
||||
import { FormField } from "./FormField";
|
||||
|
||||
@@ -14,7 +13,7 @@ type ExampleFormFieldProps = {
|
||||
value?: string;
|
||||
};
|
||||
|
||||
const ExampleFormField: FC<ExampleFormFieldProps> = ({
|
||||
const ExampleFormField: React.FC<ExampleFormFieldProps> = ({
|
||||
id,
|
||||
label,
|
||||
description,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { cn } from "cn";
|
||||
import { type ComponentProps, type FC, type ReactNode, useId } from "react";
|
||||
import { useId } from "react";
|
||||
import { Input } from "#/components/Input/Input";
|
||||
import { Label } from "#/components/Label/Label";
|
||||
import {
|
||||
@@ -8,14 +8,14 @@ import {
|
||||
} from "#/utils/formUtils";
|
||||
|
||||
type ControlProps = Pick<
|
||||
ComponentProps<"input">,
|
||||
React.ComponentProps<"input">,
|
||||
"id" | "aria-invalid" | "aria-describedby"
|
||||
>;
|
||||
|
||||
type FormFieldProps = React.ComponentProps<"input"> & {
|
||||
field: FormHelpers;
|
||||
label: ReactNode;
|
||||
description?: ReactNode;
|
||||
label: React.ReactNode;
|
||||
description?: React.ReactNode;
|
||||
/**
|
||||
* When true, discourages password managers (1Password, LastPass, Bitwarden,
|
||||
* etc.) from offering to autofill or save this field. Has no effect when a
|
||||
@@ -25,10 +25,10 @@ type FormFieldProps = React.ComponentProps<"input"> & {
|
||||
/**
|
||||
* Renders in place of the default `Input` element
|
||||
*/
|
||||
control?: (props: ControlProps) => ReactNode;
|
||||
control?: (props: ControlProps) => React.ReactNode;
|
||||
};
|
||||
|
||||
export const FormField: FC<FormFieldProps> = ({
|
||||
export const FormField: React.FC<FormFieldProps> = ({
|
||||
field,
|
||||
label,
|
||||
description,
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { useFormik } from "formik";
|
||||
import type { FC } from "react";
|
||||
import { Button } from "#/components/Button/Button";
|
||||
import { FormFooter } from "#/components/Form/Form";
|
||||
import { FormField } from "#/components/FormField/FormField";
|
||||
import { getFormHelpers } from "#/utils/formUtils";
|
||||
import { FullPageForm, type FullPageFormProps } from "./FullPageForm";
|
||||
|
||||
const Template: FC<FullPageFormProps> = (props) => {
|
||||
const Template: React.FC<FullPageFormProps> = (props) => {
|
||||
const form = useFormik({
|
||||
initialValues: {
|
||||
field1: "",
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { FC, ReactNode } from "react";
|
||||
import { Margins, type Size } from "#/components/Margins/Margins";
|
||||
import {
|
||||
PageHeader,
|
||||
@@ -7,12 +6,12 @@ import {
|
||||
} from "#/components/PageHeader/PageHeader";
|
||||
export type FullPageFormProps = {
|
||||
title: string;
|
||||
detail?: ReactNode;
|
||||
children?: ReactNode;
|
||||
detail?: React.ReactNode;
|
||||
children?: React.ReactNode;
|
||||
size?: Size;
|
||||
};
|
||||
|
||||
export const FullPageForm: FC<FullPageFormProps> = ({
|
||||
export const FullPageForm: React.FC<FullPageFormProps> = ({
|
||||
title,
|
||||
detail,
|
||||
children,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { FC, ReactNode } from "react";
|
||||
import { Button } from "#/components/Button/Button";
|
||||
import { Margins } from "#/components/Margins/Margins";
|
||||
import {
|
||||
@@ -9,12 +8,12 @@ import {
|
||||
|
||||
type FullPageHorizontalFormProps = {
|
||||
title: string;
|
||||
detail?: ReactNode;
|
||||
detail?: React.ReactNode;
|
||||
onCancel?: () => void;
|
||||
children?: ReactNode;
|
||||
children?: React.ReactNode;
|
||||
};
|
||||
|
||||
export const FullPageHorizontalForm: FC<FullPageHorizontalFormProps> = ({
|
||||
export const FullPageHorizontalForm: React.FC<FullPageHorizontalFormProps> = ({
|
||||
title,
|
||||
detail,
|
||||
onCancel,
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { cn } from "cn";
|
||||
import type { ComponentProps, FC } from "react";
|
||||
import { Link, type LinkProps } from "react-router";
|
||||
import { TopbarIconButton } from "./Topbar";
|
||||
|
||||
export const Sidebar: FC<ComponentProps<"div">> = (props) => {
|
||||
export const Sidebar: React.FC<React.ComponentProps<"div">> = (props) => {
|
||||
return (
|
||||
<div
|
||||
// TODO: Remove extra border classes once MUI is removed
|
||||
@@ -13,7 +12,7 @@ export const Sidebar: FC<ComponentProps<"div">> = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
export const SidebarLink: FC<LinkProps> = ({ className, ...props }) => {
|
||||
export const SidebarLink: React.FC<LinkProps> = ({ className, ...props }) => {
|
||||
return (
|
||||
<Link
|
||||
className={cn(
|
||||
@@ -25,11 +24,11 @@ export const SidebarLink: FC<LinkProps> = ({ className, ...props }) => {
|
||||
);
|
||||
};
|
||||
|
||||
type SidebarItemProps = ComponentProps<"button"> & {
|
||||
type SidebarItemProps = React.ComponentProps<"button"> & {
|
||||
isActive?: boolean;
|
||||
};
|
||||
|
||||
export const SidebarItem: FC<SidebarItemProps> = ({
|
||||
export const SidebarItem: React.FC<SidebarItemProps> = ({
|
||||
isActive,
|
||||
className,
|
||||
...buttonProps
|
||||
@@ -46,7 +45,9 @@ export const SidebarItem: FC<SidebarItemProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
export const SidebarCaption: FC<ComponentProps<"span">> = (props) => {
|
||||
export const SidebarCaption: React.FC<React.ComponentProps<"span">> = (
|
||||
props,
|
||||
) => {
|
||||
return (
|
||||
<span
|
||||
className="text-[10px] leading-tight py-3 px-4 uppercase font-medium text-content-primary tracking-widest"
|
||||
@@ -57,9 +58,9 @@ export const SidebarCaption: FC<ComponentProps<"span">> = (props) => {
|
||||
|
||||
type SidebarIconButtonProps = {
|
||||
isActive: boolean;
|
||||
} & ComponentProps<typeof TopbarIconButton>;
|
||||
} & React.ComponentProps<typeof TopbarIconButton>;
|
||||
|
||||
export const SidebarIconButton: FC<SidebarIconButtonProps> = ({
|
||||
export const SidebarIconButton: React.FC<SidebarIconButtonProps> = ({
|
||||
isActive,
|
||||
className,
|
||||
...buttonProps
|
||||
|
||||
@@ -1,16 +1,9 @@
|
||||
import { cn } from "cn";
|
||||
import {
|
||||
type ComponentProps,
|
||||
cloneElement,
|
||||
type FC,
|
||||
type HTMLAttributes,
|
||||
type ReactElement,
|
||||
type Ref,
|
||||
} from "react";
|
||||
import { cloneElement } from "react";
|
||||
import { Avatar, type AvatarProps } from "#/components/Avatar/Avatar";
|
||||
import { Button, type ButtonProps } from "#/components/Button/Button";
|
||||
|
||||
export const Topbar: FC<ComponentProps<"header">> = ({
|
||||
export const Topbar: React.FC<React.ComponentProps<"header">> = ({
|
||||
className,
|
||||
...props
|
||||
}) => {
|
||||
@@ -45,7 +38,7 @@ export const TopbarButton: React.FC<ButtonProps> = ({ ...props }) => {
|
||||
return <Button variant="outline" size="sm" {...props} />;
|
||||
};
|
||||
|
||||
export const TopbarData: FC<ComponentProps<"div">> = ({
|
||||
export const TopbarData: React.FC<React.ComponentProps<"div">> = ({
|
||||
className,
|
||||
...props
|
||||
}) => {
|
||||
@@ -57,10 +50,9 @@ export const TopbarData: FC<ComponentProps<"div">> = ({
|
||||
);
|
||||
};
|
||||
|
||||
export const TopbarDivider: FC<Omit<ComponentProps<"span">, "children">> = ({
|
||||
className,
|
||||
...props
|
||||
}) => {
|
||||
export const TopbarDivider: React.FC<
|
||||
Omit<React.ComponentProps<"span">, "children">
|
||||
> = ({ className, ...props }) => {
|
||||
return (
|
||||
<span {...props} className={cn("text-border", className)}>
|
||||
/
|
||||
@@ -68,13 +60,13 @@ export const TopbarDivider: FC<Omit<ComponentProps<"span">, "children">> = ({
|
||||
);
|
||||
};
|
||||
|
||||
export const TopbarAvatar: FC<AvatarProps> = (props) => {
|
||||
export const TopbarAvatar: React.FC<AvatarProps> = (props) => {
|
||||
return <Avatar {...props} variant="icon" size="sm" />;
|
||||
};
|
||||
|
||||
// oxlint-disable-next-line no-restricted-types
|
||||
type TopbarIconProps = HTMLAttributes<HTMLOrSVGElement> & {
|
||||
ref?: Ref<HTMLOrSVGElement>;
|
||||
type TopbarIconProps = React.HTMLAttributes<HTMLOrSVGElement> & {
|
||||
ref?: React.Ref<HTMLOrSVGElement>;
|
||||
};
|
||||
|
||||
export const TopbarIcon: React.FC<TopbarIconProps> = ({
|
||||
@@ -83,7 +75,7 @@ export const TopbarIcon: React.FC<TopbarIconProps> = ({
|
||||
className,
|
||||
...restProps
|
||||
}) => {
|
||||
return cloneElement(children as ReactElement<TopbarIconProps>, {
|
||||
return cloneElement(children as React.ReactElement<TopbarIconProps>, {
|
||||
...restProps,
|
||||
ref,
|
||||
className: "text-base text-content-disabled size-icon-sm",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { isAxiosError } from "axios";
|
||||
import { ExternalLinkIcon } from "lucide-react";
|
||||
import type { FC } from "react";
|
||||
import type { ApiErrorResponse } from "#/api/errors";
|
||||
import type { ExternalAuthDevice } from "#/api/typesGenerated";
|
||||
import { Alert, AlertDescription, AlertTitle } from "#/components/Alert/Alert";
|
||||
@@ -67,7 +66,7 @@ export const newRetryDelay = (initialInterval: number | undefined) => {
|
||||
};
|
||||
};
|
||||
|
||||
export const GitDeviceAuth: FC<GitDeviceAuthProps> = ({
|
||||
export const GitDeviceAuth: React.FC<GitDeviceAuthProps> = ({
|
||||
externalAuthDevice,
|
||||
deviceExchangeError,
|
||||
}) => {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { cn } from "cn";
|
||||
import { CircleHelpIcon, ExternalLinkIcon } from "lucide-react";
|
||||
import type { ComponentProps, FC, PropsWithChildren, ReactNode } from "react";
|
||||
import {
|
||||
Popover,
|
||||
PopoverContent,
|
||||
@@ -18,7 +17,7 @@ const HelpPopoverIcon = CircleHelpIcon;
|
||||
|
||||
export const HelpPopover = Popover;
|
||||
|
||||
export const HelpPopoverContent: FC<PopoverContentProps> = ({
|
||||
export const HelpPopoverContent: React.FC<PopoverContentProps> = ({
|
||||
className,
|
||||
...props
|
||||
}) => {
|
||||
@@ -68,7 +67,7 @@ export const HelpPopoverIconTrigger: React.FC<HelpPopoverIconTriggerProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
export const HelpPopoverTitle: FC<ComponentProps<"h4">> = ({
|
||||
export const HelpPopoverTitle: React.FC<React.ComponentProps<"h4">> = ({
|
||||
children,
|
||||
className,
|
||||
...attrs
|
||||
@@ -86,7 +85,7 @@ export const HelpPopoverTitle: FC<ComponentProps<"h4">> = ({
|
||||
);
|
||||
};
|
||||
|
||||
export const HelpPopoverText: FC<ComponentProps<"p">> = ({
|
||||
export const HelpPopoverText: React.FC<React.ComponentProps<"p">> = ({
|
||||
children,
|
||||
className,
|
||||
...attrs
|
||||
@@ -105,11 +104,11 @@ export const HelpPopoverText: FC<ComponentProps<"p">> = ({
|
||||
};
|
||||
|
||||
type HelpPopoverLinkProps = {
|
||||
children?: ReactNode;
|
||||
children?: React.ReactNode;
|
||||
href: string;
|
||||
};
|
||||
|
||||
export const HelpPopoverLink: FC<HelpPopoverLinkProps> = ({
|
||||
export const HelpPopoverLink: React.FC<HelpPopoverLinkProps> = ({
|
||||
children,
|
||||
href,
|
||||
}) => {
|
||||
@@ -127,13 +126,13 @@ export const HelpPopoverLink: FC<HelpPopoverLinkProps> = ({
|
||||
};
|
||||
|
||||
type HelpPopoverActionProps = {
|
||||
children?: ReactNode;
|
||||
children?: React.ReactNode;
|
||||
icon: Icon;
|
||||
onClick: () => void;
|
||||
ariaLabel?: string;
|
||||
};
|
||||
|
||||
export const HelpPopoverAction: FC<HelpPopoverActionProps> = ({
|
||||
export const HelpPopoverAction: React.FC<HelpPopoverActionProps> = ({
|
||||
children,
|
||||
icon: Icon,
|
||||
onClick,
|
||||
@@ -152,6 +151,8 @@ export const HelpPopoverAction: FC<HelpPopoverActionProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
export const HelpPopoverLinksGroup: FC<PropsWithChildren> = ({ children }) => {
|
||||
export const HelpPopoverLinksGroup: React.FC<React.PropsWithChildren> = ({
|
||||
children,
|
||||
}) => {
|
||||
return <div className="flex flex-col gap-2 mt-4">{children}</div>;
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
import data from "@emoji-mart/data/sets/15/apple.json";
|
||||
import EmojiMart from "@emoji-mart/react";
|
||||
import { type ComponentProps, type FC, useEffect } from "react";
|
||||
import { useEffect } from "react";
|
||||
import { DEPRECATED_ICONS } from "#/theme/deprecatedIcons";
|
||||
import icons from "#/theme/icons.json";
|
||||
|
||||
@@ -24,11 +24,11 @@ const custom = [
|
||||
];
|
||||
|
||||
type EmojiPickerProps = Omit<
|
||||
ComponentProps<typeof EmojiMart>,
|
||||
React.ComponentProps<typeof EmojiMart>,
|
||||
"custom" | "data" | "set" | "theme" | "getSpritesheetURL"
|
||||
>;
|
||||
|
||||
const EmojiPicker: FC<EmojiPickerProps> = (props) => {
|
||||
const EmojiPicker: React.FC<EmojiPickerProps> = (props) => {
|
||||
/**
|
||||
* Workaround for a bug in the emoji-mart library where custom emoji images render improperly.
|
||||
* Setting the image width to 100% ensures they display correctly.
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
import { cn } from "cn";
|
||||
import {
|
||||
type ComponentProps,
|
||||
type FC,
|
||||
lazy,
|
||||
type ReactNode,
|
||||
Suspense,
|
||||
useId,
|
||||
useState,
|
||||
} from "react";
|
||||
import { lazy, Suspense, useId, useState } from "react";
|
||||
import { ChevronDownIcon as AnimatedChevronDownIcon } from "#/components/AnimatedIcons/ChevronDown";
|
||||
import { Button } from "#/components/Button/Button";
|
||||
import { ExternalImage } from "#/components/ExternalImage/ExternalImage";
|
||||
@@ -26,16 +18,16 @@ import {
|
||||
|
||||
const EmojiPicker = lazy(() => import("./EmojiPicker"));
|
||||
|
||||
type IconFieldProps = Omit<ComponentProps<"input">, "type"> & {
|
||||
label?: ReactNode;
|
||||
type IconFieldProps = Omit<React.ComponentProps<"input">, "type"> & {
|
||||
label?: React.ReactNode;
|
||||
error?: boolean;
|
||||
helperText?: ReactNode;
|
||||
helperText?: React.ReactNode;
|
||||
onPickEmoji: (value: string) => void;
|
||||
/** Accepted for call-site compatibility with former MUI TextField usage. */
|
||||
fullWidth?: boolean;
|
||||
};
|
||||
|
||||
export const IconField: FC<IconFieldProps> = ({
|
||||
export const IconField: React.FC<IconFieldProps> = ({
|
||||
id: idProp,
|
||||
value,
|
||||
label = "Icon",
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { FC, SVGProps } from "react";
|
||||
|
||||
/**
|
||||
* Variant of lucide's `ListFilterIcon` with a status dot on the top line,
|
||||
* used to signal that at least one filter is applied. Drawn on the same 24px
|
||||
* grid and stroke as lucide so it can swap in without layout shift.
|
||||
*/
|
||||
export const ListFilterActiveIcon: FC<SVGProps<SVGSVGElement>> = (props) => {
|
||||
export const ListFilterActiveIcon: React.FC<React.SVGProps<SVGSVGElement>> = (
|
||||
props,
|
||||
) => {
|
||||
return (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { cn } from "cn";
|
||||
import type { FC } from "react";
|
||||
import { getApplicationName, getLogoURL } from "#/utils/appearance";
|
||||
import { ExternalImage } from "../ExternalImage/ExternalImage";
|
||||
|
||||
@@ -7,7 +6,9 @@ import { ExternalImage } from "../ExternalImage/ExternalImage";
|
||||
* Enterprise customers can set a custom logo for their Coder application. Use
|
||||
* the custom logo wherever the Coder logo is used, if a custom one is provided.
|
||||
*/
|
||||
export const ProductLogo: FC<{ className?: string }> = ({ className }) => {
|
||||
export const ProductLogo: React.FC<{ className?: string }> = ({
|
||||
className,
|
||||
}) => {
|
||||
const applicationName = getApplicationName();
|
||||
const logoURL = getLogoURL();
|
||||
|
||||
@@ -30,7 +31,7 @@ export const ProductLogo: FC<{ className?: string }> = ({ className }) => {
|
||||
);
|
||||
};
|
||||
|
||||
const CoderLogo: FC<React.ComponentProps<"svg">> = ({
|
||||
const CoderLogo: React.FC<React.ComponentProps<"svg">> = ({
|
||||
className,
|
||||
...props
|
||||
}) => (
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { cn } from "cn";
|
||||
import { InfoIcon, TriangleAlertIcon } from "lucide-react";
|
||||
import type { FC, ReactNode } from "react";
|
||||
import {
|
||||
TOOLTIP_DELAY_DURATION,
|
||||
Tooltip,
|
||||
@@ -17,7 +16,7 @@ type InfoTooltipProps = {
|
||||
type?: InfoTooltipType;
|
||||
size?: InfoTooltipSize;
|
||||
ariaLabel?: string;
|
||||
children: ReactNode;
|
||||
children: React.ReactNode;
|
||||
};
|
||||
|
||||
const typeIcon: Record<InfoTooltipType, typeof InfoIcon> = {
|
||||
@@ -35,7 +34,7 @@ const sizeClasses: Record<InfoTooltipSize, string> = {
|
||||
medium: "[&_svg]:size-4",
|
||||
};
|
||||
|
||||
export const InfoTooltip: FC<InfoTooltipProps> = ({
|
||||
export const InfoTooltip: React.FC<InfoTooltipProps> = ({
|
||||
children,
|
||||
type = "info",
|
||||
size = "medium",
|
||||
|
||||
@@ -4,11 +4,10 @@
|
||||
*/
|
||||
|
||||
import { cn } from "cn";
|
||||
import type { ComponentProps, FC } from "react";
|
||||
|
||||
type InputProps = ComponentProps<"input">;
|
||||
type InputProps = React.ComponentProps<"input">;
|
||||
|
||||
export const Input: FC<InputProps> = ({ className, type, ...props }) => {
|
||||
export const Input: React.FC<InputProps> = ({ className, type, ...props }) => {
|
||||
return (
|
||||
<input
|
||||
type={type}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { cn } from "cn";
|
||||
import dayjs from "dayjs";
|
||||
import type { ComponentProps, FC } from "react";
|
||||
import { isAfter, subtractTime, timeFrom } from "#/utils/time";
|
||||
|
||||
type LastSeenProps = Omit<ComponentProps<"span">, "children"> & {
|
||||
type LastSeenProps = Omit<React.ComponentProps<"span">, "children"> & {
|
||||
at: dayjs.ConfigType;
|
||||
exactDays?: boolean;
|
||||
// Injectable reference time so the component is deterministic in tests.
|
||||
@@ -45,7 +44,7 @@ const exactDaysFrom = (at: dayjs.ConfigType, now: dayjs.ConfigType) => {
|
||||
return days === 1 ? "1 day ago" : `${days} days ago`;
|
||||
};
|
||||
|
||||
export const LastSeen: FC<LastSeenProps> = ({
|
||||
export const LastSeen: React.FC<LastSeenProps> = ({
|
||||
at,
|
||||
exactDays = false,
|
||||
now = new Date(),
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { cn } from "cn";
|
||||
import { CircleHelpIcon } from "lucide-react";
|
||||
import type { FC } from "react";
|
||||
import { Abbr } from "#/components/Abbr/Abbr";
|
||||
import { Spinner } from "#/components/Spinner/Spinner";
|
||||
import {
|
||||
@@ -16,7 +15,7 @@ type LatencyProps = {
|
||||
className?: string;
|
||||
};
|
||||
|
||||
export const Latency: FC<LatencyProps> = ({
|
||||
export const Latency: React.FC<LatencyProps> = ({
|
||||
latency,
|
||||
isLoading,
|
||||
className,
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import { cn } from "cn";
|
||||
import type React from "react";
|
||||
import type { FC } from "react";
|
||||
|
||||
type LinearProgressProps = React.ComponentProps<"div"> & {
|
||||
value: number;
|
||||
variant: "determinate" | "indeterminate";
|
||||
};
|
||||
|
||||
const LinearProgress: FC<LinearProgressProps> = ({
|
||||
const LinearProgress: React.FC<LinearProgressProps> = ({
|
||||
value,
|
||||
className,
|
||||
variant,
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { cn } from "cn";
|
||||
import type { ComponentProps, FC } from "react";
|
||||
import { Spinner } from "#/components/Spinner/Spinner";
|
||||
|
||||
type LoaderProps = ComponentProps<"div"> & {
|
||||
type LoaderProps = React.ComponentProps<"div"> & {
|
||||
fullscreen?: boolean;
|
||||
size?: "sm" | "lg";
|
||||
/**
|
||||
@@ -11,7 +10,7 @@ type LoaderProps = ComponentProps<"div"> & {
|
||||
label?: string;
|
||||
};
|
||||
|
||||
export const Loader: FC<LoaderProps> = ({
|
||||
export const Loader: React.FC<LoaderProps> = ({
|
||||
fullscreen,
|
||||
size = "lg",
|
||||
label,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { cn } from "cn";
|
||||
import type { ComponentProps, FC } from "react";
|
||||
import type { LogLevel } from "#/api/typesGenerated";
|
||||
|
||||
const DEFAULT_LOG_LINE_SIDE_PADDING = 24;
|
||||
@@ -14,9 +13,9 @@ export type Line = {
|
||||
|
||||
type LogLineProps = {
|
||||
level: LogLevel;
|
||||
} & ComponentProps<"pre">;
|
||||
} & React.ComponentProps<"pre">;
|
||||
|
||||
export const LogLine: FC<LogLineProps> = ({
|
||||
export const LogLine: React.FC<LogLineProps> = ({
|
||||
level,
|
||||
className,
|
||||
style,
|
||||
@@ -47,7 +46,7 @@ export const LogLine: FC<LogLineProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
export const LogLinePrefix: FC<ComponentProps<"pre">> = ({
|
||||
export const LogLinePrefix: React.FC<React.ComponentProps<"pre">> = ({
|
||||
className,
|
||||
...props
|
||||
}) => {
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
import { cn } from "cn";
|
||||
import dayjs from "dayjs";
|
||||
import type { FC, ReactNode } from "react";
|
||||
import { type Line, LogLine, LogLinePrefix } from "./LogLine";
|
||||
|
||||
const DEFAULT_LOG_LINE_SIDE_PADDING = 24;
|
||||
|
||||
type LogsHeaderProps = {
|
||||
title: ReactNode;
|
||||
title: React.ReactNode;
|
||||
/** Right-aligned secondary text. */
|
||||
detail?: ReactNode;
|
||||
detail?: React.ReactNode;
|
||||
};
|
||||
|
||||
/** Section header above a `Logs` list, such as a build stage. */
|
||||
export const LogsHeader: FC<LogsHeaderProps> = ({ title, detail }) => {
|
||||
export const LogsHeader: React.FC<LogsHeaderProps> = ({ title, detail }) => {
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
@@ -37,10 +36,10 @@ type LogsProps = {
|
||||
hideTimestamps?: boolean;
|
||||
className?: string;
|
||||
/** Renders each line's output. Defaults to plain text. */
|
||||
LineOutput?: FC<{ output: string }>;
|
||||
LineOutput?: React.FC<{ output: string }>;
|
||||
};
|
||||
|
||||
export const Logs: FC<LogsProps> = ({
|
||||
export const Logs: React.FC<LogsProps> = ({
|
||||
hideTimestamps,
|
||||
lines,
|
||||
className = "",
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { cn } from "cn";
|
||||
import type { FC, JSX } from "react";
|
||||
import {
|
||||
containerWidth,
|
||||
containerWidthMedium,
|
||||
@@ -15,11 +14,11 @@ const widthBySize: Record<Size, number> = {
|
||||
small: containerWidth / 3,
|
||||
};
|
||||
|
||||
type MarginsProps = JSX.IntrinsicElements["div"] & {
|
||||
type MarginsProps = React.JSX.IntrinsicElements["div"] & {
|
||||
size?: Size;
|
||||
};
|
||||
|
||||
export const Margins: FC<MarginsProps> = ({
|
||||
export const Margins: React.FC<MarginsProps> = ({
|
||||
size = "regular",
|
||||
children,
|
||||
className,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import isEqual from "lodash/isEqual";
|
||||
import { type FC, memo } from "react";
|
||||
import { memo } from "react";
|
||||
import ReactMarkdown, { type Options } from "react-markdown";
|
||||
import { Link } from "#/components/Link/Link";
|
||||
|
||||
@@ -29,7 +29,7 @@ type InlineMarkdownProps = {
|
||||
* content. Separated from the full Markdown component so that importing it
|
||||
* does not pull in the heavy PrismJS syntax-highlighting bundle.
|
||||
*/
|
||||
export const InlineMarkdown: FC<InlineMarkdownProps> = (props) => {
|
||||
export const InlineMarkdown: React.FC<InlineMarkdownProps> = (props) => {
|
||||
const { children, allowedElements = [], className, components = {} } = props;
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,14 +1,6 @@
|
||||
import { cn } from "cn";
|
||||
import isEqual from "lodash/isEqual";
|
||||
import {
|
||||
createElement,
|
||||
type FC,
|
||||
type HTMLProps,
|
||||
isValidElement,
|
||||
memo,
|
||||
type PropsWithChildren,
|
||||
type ReactNode,
|
||||
} from "react";
|
||||
import { createElement, isValidElement, memo } from "react";
|
||||
import ReactMarkdown, { type Options } from "react-markdown";
|
||||
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
|
||||
import { dracula } from "react-syntax-highlighter/dist/cjs/styles/prism";
|
||||
@@ -36,7 +28,7 @@ type MarkdownProps = {
|
||||
components?: Options["components"];
|
||||
};
|
||||
|
||||
export const Markdown: FC<MarkdownProps> = (props) => {
|
||||
export const Markdown: React.FC<MarkdownProps> = (props) => {
|
||||
const { children, className, components = {} } = props;
|
||||
|
||||
return (
|
||||
@@ -163,11 +155,11 @@ const githubFlavoredMarkdownAlertTypes = [
|
||||
|
||||
type AlertContent = Readonly<{
|
||||
type: string;
|
||||
children: readonly ReactNode[];
|
||||
children: readonly React.ReactNode[];
|
||||
}>;
|
||||
|
||||
function parseChildrenAsAlertContent(
|
||||
jsxChildren: ReactNode,
|
||||
jsxChildren: React.ReactNode,
|
||||
): AlertContent | null {
|
||||
// Have no idea why the plugin parses the data by mixing node types
|
||||
// like this. Have to do a good bit of nested filtering.
|
||||
@@ -175,7 +167,9 @@ function parseChildrenAsAlertContent(
|
||||
return null;
|
||||
}
|
||||
|
||||
const mainParentNode = jsxChildren.find(isValidElement<PropsWithChildren>);
|
||||
const mainParentNode = jsxChildren.find(
|
||||
isValidElement<React.PropsWithChildren>,
|
||||
);
|
||||
let parentChildren = mainParentNode?.props.children;
|
||||
if (typeof parentChildren === "string") {
|
||||
// Children will only be an array if the parsed text contains other
|
||||
@@ -204,7 +198,7 @@ function parseChildrenAsAlertContent(
|
||||
}
|
||||
|
||||
const recastProps = el.props as Record<string, unknown> & {
|
||||
children?: ReactNode;
|
||||
children?: React.ReactNode;
|
||||
};
|
||||
if (recastProps.target === "_blank") {
|
||||
return el;
|
||||
@@ -263,22 +257,24 @@ function parseChildrenAsAlertContent(
|
||||
// but the markdown parser treats them as soft wraps (spaces).
|
||||
// Convert embedded newlines in text nodes to <br/> elements to
|
||||
// match GitHub's rendering behavior.
|
||||
const withLineBreaks: ReactNode[] = remainingChildren.flatMap((child, i) => {
|
||||
if (typeof child !== "string" || !child.includes("\n")) {
|
||||
return [child];
|
||||
}
|
||||
const parts = child.split("\n");
|
||||
const result: ReactNode[] = [];
|
||||
for (let j = 0; j < parts.length; j++) {
|
||||
if (j > 0) {
|
||||
result.push(createElement("br", { key: `alert-br-${i}-${j}` }));
|
||||
const withLineBreaks: React.ReactNode[] = remainingChildren.flatMap(
|
||||
(child, i) => {
|
||||
if (typeof child !== "string" || !child.includes("\n")) {
|
||||
return [child];
|
||||
}
|
||||
if (parts[j]) {
|
||||
result.push(parts[j]);
|
||||
const parts = child.split("\n");
|
||||
const result: React.ReactNode[] = [];
|
||||
for (let j = 0; j < parts.length; j++) {
|
||||
if (j > 0) {
|
||||
result.push(createElement("br", { key: `alert-br-${i}-${j}` }));
|
||||
}
|
||||
if (parts[j]) {
|
||||
result.push(parts[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
});
|
||||
return result;
|
||||
},
|
||||
);
|
||||
|
||||
return {
|
||||
type: alertType,
|
||||
@@ -287,12 +283,12 @@ function parseChildrenAsAlertContent(
|
||||
}
|
||||
|
||||
type MarkdownGfmAlertProps = Readonly<
|
||||
HTMLProps<HTMLElement> & {
|
||||
React.HTMLProps<HTMLElement> & {
|
||||
alertType: string;
|
||||
}
|
||||
>;
|
||||
|
||||
const MarkdownGfmAlert: FC<MarkdownGfmAlertProps> = ({
|
||||
const MarkdownGfmAlert: React.FC<MarkdownGfmAlertProps> = ({
|
||||
alertType,
|
||||
children,
|
||||
...delegatedProps
|
||||
|
||||
@@ -6,10 +6,6 @@ import { Command as CommandPrimitive, useCommandState } from "cmdk";
|
||||
import { cn } from "cn";
|
||||
import { InfoIcon, XIcon } from "lucide-react";
|
||||
import {
|
||||
type ComponentProps,
|
||||
type KeyboardEvent,
|
||||
type ReactNode,
|
||||
type Ref,
|
||||
useCallback,
|
||||
useEffect,
|
||||
useImperativeHandle,
|
||||
@@ -55,9 +51,9 @@ type MultiSelectComboboxProps = {
|
||||
options?: Option[];
|
||||
placeholder?: string;
|
||||
/** Loading component. */
|
||||
loadingIndicator?: ReactNode;
|
||||
loadingIndicator?: React.ReactNode;
|
||||
/** Empty component. */
|
||||
emptyIndicator?: ReactNode;
|
||||
emptyIndicator?: React.ReactNode;
|
||||
/** Debounce time for async search. Only work with `onSearch`. */
|
||||
delay?: number;
|
||||
/**
|
||||
@@ -95,17 +91,17 @@ type MultiSelectComboboxProps = {
|
||||
/** Allow user to create option when there is no option matched. */
|
||||
creatable?: boolean;
|
||||
/** Props of `Command` */
|
||||
commandProps?: Omit<ComponentProps<typeof Command>, "ref">;
|
||||
commandProps?: Omit<React.ComponentProps<typeof Command>, "ref">;
|
||||
/** Props of `CommandInput` */
|
||||
inputProps?: Omit<
|
||||
ComponentProps<typeof CommandPrimitive.Input>,
|
||||
React.ComponentProps<typeof CommandPrimitive.Input>,
|
||||
"ref" | "value" | "placeholder" | "disabled"
|
||||
>;
|
||||
/** hide or show the button that clears all the selected options. */
|
||||
hideClearAllButton?: boolean;
|
||||
/** Test ID for testing purposes */
|
||||
"data-testid"?: string;
|
||||
ref?: Ref<MultiSelectComboboxRef>;
|
||||
ref?: React.Ref<MultiSelectComboboxRef>;
|
||||
};
|
||||
|
||||
type MultiSelectComboboxRef = {
|
||||
@@ -243,7 +239,7 @@ export const MultiSelectCombobox: React.FC<MultiSelectComboboxProps> = ({
|
||||
[onChange, selected],
|
||||
);
|
||||
|
||||
const handleKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {
|
||||
const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {
|
||||
const input = inputRef.current;
|
||||
if (input) {
|
||||
if (e.key === "Delete" || e.key === "Backspace") {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { cn } from "cn";
|
||||
import { type FC, type ReactNode, useState } from "react";
|
||||
import { useState } from "react";
|
||||
import { keepPreviousData, useQuery } from "react-query";
|
||||
import { organizationMembers } from "#/api/queries/organizations";
|
||||
import { users } from "#/api/queries/users";
|
||||
@@ -32,7 +32,7 @@ type UserAutocompleteProps = CommonMultiSelectProps<User> & {
|
||||
filter: string;
|
||||
};
|
||||
|
||||
export const MultiUserSelect: FC<UserAutocompleteProps> = ({
|
||||
export const MultiUserSelect: React.FC<UserAutocompleteProps> = ({
|
||||
filter,
|
||||
setFilter,
|
||||
...props
|
||||
@@ -60,7 +60,7 @@ type MemberAutocompleteProps =
|
||||
organizationId: string;
|
||||
};
|
||||
|
||||
export const MultiMemberSelect: FC<MemberAutocompleteProps> = ({
|
||||
export const MultiMemberSelect: React.FC<MemberAutocompleteProps> = ({
|
||||
filter,
|
||||
organizationId,
|
||||
setFilter,
|
||||
@@ -217,7 +217,7 @@ const InnerMultiSelect = <T extends SelectedUser>({
|
||||
);
|
||||
};
|
||||
|
||||
const TableLoader: FC = () => {
|
||||
const TableLoader: React.FC = () => {
|
||||
const skeletonRows = Array.from({ length: 6 }, (_, index) => index);
|
||||
|
||||
return (
|
||||
@@ -236,7 +236,7 @@ const TableLoader: FC = () => {
|
||||
|
||||
type UserRowProps<T extends SelectedUser> = {
|
||||
checked: boolean;
|
||||
children?: ReactNode;
|
||||
children?: React.ReactNode;
|
||||
isFirst: boolean;
|
||||
isLast: boolean;
|
||||
onChange: (user: T, checked: boolean) => void;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { cn } from "cn";
|
||||
import { CheckIcon } from "lucide-react";
|
||||
import { type FC, useState } from "react";
|
||||
import { useState } from "react";
|
||||
import type { Organization } from "#/api/typesGenerated";
|
||||
import { ChevronDownIcon } from "#/components/AnimatedIcons/ChevronDown";
|
||||
import { Avatar } from "#/components/Avatar/Avatar";
|
||||
@@ -57,7 +57,9 @@ export const getOrganizationLabel = (
|
||||
return displayName;
|
||||
};
|
||||
|
||||
export const OrganizationAutocomplete: FC<OrganizationAutocompleteProps> = ({
|
||||
export const OrganizationAutocomplete: React.FC<
|
||||
OrganizationAutocompleteProps
|
||||
> = ({
|
||||
value,
|
||||
onChange,
|
||||
options,
|
||||
@@ -163,7 +165,7 @@ type OrganizationValueProps = {
|
||||
className?: string;
|
||||
};
|
||||
|
||||
const OrganizationValue: FC<OrganizationValueProps> = ({
|
||||
const OrganizationValue: React.FC<OrganizationValueProps> = ({
|
||||
organization,
|
||||
labelOrganizations,
|
||||
id,
|
||||
@@ -210,7 +212,7 @@ type OrganizationFieldProps = {
|
||||
required?: boolean;
|
||||
};
|
||||
|
||||
export const OrganizationField: FC<OrganizationFieldProps> = ({
|
||||
export const OrganizationField: React.FC<OrganizationFieldProps> = ({
|
||||
id,
|
||||
organization,
|
||||
organizations,
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { cn } from "cn";
|
||||
import type { FC, PropsWithChildren, ReactNode } from "react";
|
||||
|
||||
type FullWidthPageHeaderProps = {
|
||||
children?: ReactNode;
|
||||
children?: React.ReactNode;
|
||||
sticky?: boolean;
|
||||
};
|
||||
|
||||
export const FullWidthPageHeader: FC<FullWidthPageHeaderProps> = ({
|
||||
export const FullWidthPageHeader: React.FC<FullWidthPageHeaderProps> = ({
|
||||
children,
|
||||
sticky = true,
|
||||
}) => {
|
||||
@@ -25,15 +24,21 @@ export const FullWidthPageHeader: FC<FullWidthPageHeaderProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
const _PageHeaderActions: FC<PropsWithChildren> = ({ children }) => {
|
||||
const _PageHeaderActions: React.FC<React.PropsWithChildren> = ({
|
||||
children,
|
||||
}) => {
|
||||
return <div className="ml-auto md:ml-0">{children}</div>;
|
||||
};
|
||||
|
||||
export const PageHeaderTitle: FC<PropsWithChildren> = ({ children }) => {
|
||||
export const PageHeaderTitle: React.FC<React.PropsWithChildren> = ({
|
||||
children,
|
||||
}) => {
|
||||
return <h1 className="text-lg font-medium m-0 leading-6">{children}</h1>;
|
||||
};
|
||||
|
||||
export const PageHeaderSubtitle: FC<PropsWithChildren> = ({ children }) => {
|
||||
export const PageHeaderSubtitle: React.FC<React.PropsWithChildren> = ({
|
||||
children,
|
||||
}) => {
|
||||
return (
|
||||
<span className="text-sm text-content-secondary block">{children}</span>
|
||||
);
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import { cn } from "cn";
|
||||
import type React from "react";
|
||||
import type { FC, ReactNode } from "react";
|
||||
|
||||
type PageHeaderProps = {
|
||||
actions?: ReactNode;
|
||||
actions?: React.ReactNode;
|
||||
className?: string;
|
||||
children?: ReactNode;
|
||||
children?: React.ReactNode;
|
||||
};
|
||||
|
||||
export const PageHeader: FC<PageHeaderProps> = ({
|
||||
export const PageHeader: React.FC<PageHeaderProps> = ({
|
||||
children,
|
||||
actions,
|
||||
className,
|
||||
@@ -34,7 +33,7 @@ export const PageHeader: FC<PageHeaderProps> = ({
|
||||
|
||||
type PageHeaderTitleProps = React.ComponentProps<"h1">;
|
||||
|
||||
export const PageHeaderTitle: FC<PageHeaderTitleProps> = ({
|
||||
export const PageHeaderTitle: React.FC<PageHeaderTitleProps> = ({
|
||||
children,
|
||||
className,
|
||||
...props
|
||||
@@ -54,7 +53,7 @@ export const PageHeaderTitle: FC<PageHeaderTitleProps> = ({
|
||||
|
||||
type PageHeaderSubtitleProps = React.ComponentProps<"h2">;
|
||||
|
||||
export const PageHeaderSubtitle: FC<PageHeaderSubtitleProps> = ({
|
||||
export const PageHeaderSubtitle: React.FC<PageHeaderSubtitleProps> = ({
|
||||
children,
|
||||
className,
|
||||
...props
|
||||
@@ -74,7 +73,7 @@ export const PageHeaderSubtitle: FC<PageHeaderSubtitleProps> = ({
|
||||
|
||||
type PageHeaderCaptionProps = React.ComponentProps<"span">;
|
||||
|
||||
export const PageHeaderCaption: FC<PageHeaderCaptionProps> = ({
|
||||
export const PageHeaderCaption: React.FC<PageHeaderCaptionProps> = ({
|
||||
children,
|
||||
className,
|
||||
...props
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { FC, ReactNode } from "react";
|
||||
import { Button } from "#/components/Button/Button";
|
||||
|
||||
type NumberedPageButtonProps = {
|
||||
@@ -9,7 +8,7 @@ type NumberedPageButtonProps = {
|
||||
disabled?: boolean;
|
||||
};
|
||||
|
||||
export const NumberedPageButton: FC<NumberedPageButtonProps> = ({
|
||||
export const NumberedPageButton: React.FC<NumberedPageButtonProps> = ({
|
||||
pageNumber,
|
||||
totalPages,
|
||||
onClick,
|
||||
@@ -31,10 +30,10 @@ export const NumberedPageButton: FC<NumberedPageButtonProps> = ({
|
||||
|
||||
type PlaceholderPageButtonProps = {
|
||||
pagesOmitted: number;
|
||||
children?: ReactNode;
|
||||
children?: React.ReactNode;
|
||||
};
|
||||
|
||||
export const PlaceholderPageButton: FC<PlaceholderPageButtonProps> = ({
|
||||
export const PlaceholderPageButton: React.FC<PlaceholderPageButtonProps> = ({
|
||||
pagesOmitted,
|
||||
children = <>…</>,
|
||||
}) => {
|
||||
@@ -50,7 +49,7 @@ export const PlaceholderPageButton: FC<PlaceholderPageButtonProps> = ({
|
||||
};
|
||||
|
||||
type BasePageButtonProps = {
|
||||
children?: ReactNode;
|
||||
children?: React.ReactNode;
|
||||
onClick?: () => void;
|
||||
name: string;
|
||||
"aria-label": string;
|
||||
@@ -58,7 +57,7 @@ type BasePageButtonProps = {
|
||||
disabled?: boolean;
|
||||
};
|
||||
|
||||
const BasePageButton: FC<BasePageButtonProps> = ({
|
||||
const BasePageButton: React.FC<BasePageButtonProps> = ({
|
||||
children,
|
||||
onClick,
|
||||
name,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { cn } from "cn";
|
||||
import type { FC } from "react";
|
||||
import { Skeleton } from "#/components/Skeleton/Skeleton";
|
||||
|
||||
type PaginationHeaderProps = {
|
||||
@@ -15,7 +14,7 @@ type PaginationHeaderProps = {
|
||||
className?: string;
|
||||
};
|
||||
|
||||
export const PaginationAmount: FC<PaginationHeaderProps> = ({
|
||||
export const PaginationAmount: React.FC<PaginationHeaderProps> = ({
|
||||
paginationUnitLabel,
|
||||
limit,
|
||||
totalRecords,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import type { ComponentProps, FC, PropsWithChildren } from "react";
|
||||
import { PaginationContainer } from "./PaginationContainer";
|
||||
import {
|
||||
mockInitialRenderResult,
|
||||
@@ -7,12 +6,12 @@ import {
|
||||
} from "./PaginationContainer.mocks";
|
||||
|
||||
// Filtering out optional <div> props to give better auto-complete experience
|
||||
type EssentialComponent = FC<
|
||||
type EssentialComponent = React.FC<
|
||||
Omit<
|
||||
ComponentProps<typeof PaginationContainer>,
|
||||
keyof ComponentProps<"div">
|
||||
React.ComponentProps<typeof PaginationContainer>,
|
||||
keyof React.ComponentProps<"div">
|
||||
> &
|
||||
PropsWithChildren
|
||||
React.PropsWithChildren
|
||||
>;
|
||||
|
||||
const meta: Meta<EssentialComponent> = {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { ComponentProps, FC } from "react";
|
||||
import type { PaginationResultInfo } from "#/hooks/usePaginatedQuery";
|
||||
import { PaginationAmount } from "./PaginationAmount";
|
||||
import { PaginationWidgetBase } from "./PaginationWidgetBase";
|
||||
@@ -8,12 +7,12 @@ export type PaginationResult<Data = unknown> = PaginationResultInfo & {
|
||||
data?: Data;
|
||||
};
|
||||
|
||||
type PaginationProps = ComponentProps<"div"> & {
|
||||
type PaginationProps = React.ComponentProps<"div"> & {
|
||||
query: PaginationResult;
|
||||
paginationUnitLabel: string;
|
||||
};
|
||||
|
||||
export const PaginationContainer: FC<PaginationProps> = ({
|
||||
export const PaginationContainer: React.FC<PaginationProps> = ({
|
||||
children,
|
||||
query,
|
||||
paginationUnitLabel,
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import type { ComponentProps, ReactNode } from "react";
|
||||
import { Button } from "#/components/Button/Button";
|
||||
|
||||
type PaginationNavButtonProps = Omit<
|
||||
ComponentProps<"button">,
|
||||
React.ComponentProps<"button">,
|
||||
"aria-disabled"
|
||||
> & {
|
||||
// Required/narrowed versions of default props
|
||||
children: ReactNode;
|
||||
children: React.ReactNode;
|
||||
disabled: boolean;
|
||||
onClick: () => void;
|
||||
"aria-label": string;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
||||
import type { FC } from "react";
|
||||
import { NumberedPageButton, PlaceholderPageButton } from "./PageButtons";
|
||||
import { PaginationNavButton } from "./PaginationNavButton";
|
||||
import { buildPagedList } from "./utils";
|
||||
@@ -18,7 +17,7 @@ export type PaginationWidgetBaseProps = {
|
||||
totalPages?: number;
|
||||
};
|
||||
|
||||
export const PaginationWidgetBase: FC<PaginationWidgetBaseProps> = ({
|
||||
export const PaginationWidgetBase: React.FC<PaginationWidgetBaseProps> = ({
|
||||
currentPage,
|
||||
pageSize,
|
||||
totalRecords,
|
||||
@@ -89,7 +88,7 @@ type PaginationRowProps = {
|
||||
onChange: (newPage: number) => void;
|
||||
};
|
||||
|
||||
const PaginationRow: FC<PaginationRowProps> = ({
|
||||
const PaginationRow: React.FC<PaginationRowProps> = ({
|
||||
currentPage,
|
||||
totalPages,
|
||||
onChange,
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
import type { ComponentProps, FC } from "react";
|
||||
import { keepPreviousData, useQuery } from "react-query";
|
||||
import { API } from "#/api/api";
|
||||
import { FormField } from "#/components/FormField/FormField";
|
||||
import { useDebouncedValue } from "#/hooks/debounce";
|
||||
|
||||
type PasswordFieldProps = ComponentProps<typeof FormField>;
|
||||
type PasswordFieldProps = React.ComponentProps<typeof FormField>;
|
||||
|
||||
/**
|
||||
* A password field component that validates the password against the API with
|
||||
* debounced calls. It uses a debounced value to minimize the number of API
|
||||
* calls and displays validation errors.
|
||||
*/
|
||||
export const PasswordField: FC<PasswordFieldProps> = ({ field, ...props }) => {
|
||||
export const PasswordField: React.FC<PasswordFieldProps> = ({
|
||||
field,
|
||||
...props
|
||||
}) => {
|
||||
const value = field.value === undefined ? "" : String(field.value);
|
||||
const debouncedValue = useDebouncedValue(value, 500);
|
||||
const validatePasswordQuery = useQuery({
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { cn } from "cn";
|
||||
import { ArrowRightIcon, CheckIcon } from "lucide-react";
|
||||
import type React from "react";
|
||||
import type { FC } from "react";
|
||||
import { type LinkProps, Link as RouterLink } from "react-router";
|
||||
import { Button } from "#/components/Button/Button";
|
||||
import { Supergraphic } from "#/components/Supergraphic/Supergraphic";
|
||||
@@ -47,7 +46,7 @@ export const Paywall = ({
|
||||
);
|
||||
};
|
||||
|
||||
export const PaywallContent: FC<React.ComponentProps<"div">> = ({
|
||||
export const PaywallContent: React.FC<React.ComponentProps<"div">> = ({
|
||||
children,
|
||||
className,
|
||||
...props
|
||||
@@ -65,7 +64,7 @@ export const PaywallContent: FC<React.ComponentProps<"div">> = ({
|
||||
);
|
||||
};
|
||||
|
||||
export const PaywallHeading: FC<React.ComponentProps<"div">> = ({
|
||||
export const PaywallHeading: React.FC<React.ComponentProps<"div">> = ({
|
||||
children,
|
||||
className,
|
||||
...props
|
||||
@@ -83,7 +82,7 @@ export const PaywallHeading: FC<React.ComponentProps<"div">> = ({
|
||||
);
|
||||
};
|
||||
|
||||
export const PaywallTitle: FC<React.ComponentProps<"h5">> = ({
|
||||
export const PaywallTitle: React.FC<React.ComponentProps<"h5">> = ({
|
||||
children,
|
||||
className,
|
||||
...props
|
||||
@@ -98,7 +97,7 @@ export const PaywallTitle: FC<React.ComponentProps<"h5">> = ({
|
||||
);
|
||||
};
|
||||
|
||||
export const PaywallDescription: FC<React.ComponentProps<"p">> = ({
|
||||
export const PaywallDescription: React.FC<React.ComponentProps<"p">> = ({
|
||||
children,
|
||||
className,
|
||||
...props
|
||||
@@ -113,14 +112,14 @@ export const PaywallDescription: FC<React.ComponentProps<"p">> = ({
|
||||
);
|
||||
};
|
||||
|
||||
export const PaywallSupergraphic: FC<React.ComponentProps<"div">> = ({
|
||||
export const PaywallSupergraphic: React.FC<React.ComponentProps<"div">> = ({
|
||||
className,
|
||||
...props
|
||||
}) => {
|
||||
return <Supergraphic className={cn("left-0 w-1/2", className)} {...props} />;
|
||||
};
|
||||
|
||||
export const PaywallStack: FC<React.ComponentProps<"div">> = ({
|
||||
export const PaywallStack: React.FC<React.ComponentProps<"div">> = ({
|
||||
children,
|
||||
className,
|
||||
...props
|
||||
@@ -135,7 +134,7 @@ export const PaywallStack: FC<React.ComponentProps<"div">> = ({
|
||||
);
|
||||
};
|
||||
|
||||
export const PaywallFeatures: FC<React.ComponentProps<"ul">> = ({
|
||||
export const PaywallFeatures: React.FC<React.ComponentProps<"ul">> = ({
|
||||
children,
|
||||
className,
|
||||
...props
|
||||
@@ -150,7 +149,7 @@ export const PaywallFeatures: FC<React.ComponentProps<"ul">> = ({
|
||||
);
|
||||
};
|
||||
|
||||
export const PaywallFeature: FC<React.ComponentProps<"li">> = ({
|
||||
export const PaywallFeature: React.FC<React.ComponentProps<"li">> = ({
|
||||
children,
|
||||
className,
|
||||
...props
|
||||
@@ -163,7 +162,7 @@ export const PaywallFeature: FC<React.ComponentProps<"li">> = ({
|
||||
);
|
||||
};
|
||||
|
||||
export const PaywallCTALink: FC<LinkProps> = ({
|
||||
export const PaywallCTALink: React.FC<LinkProps> = ({
|
||||
children,
|
||||
className,
|
||||
...props
|
||||
@@ -178,7 +177,7 @@ export const PaywallCTALink: FC<LinkProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
export const PaywallGuidance: FC<React.ComponentProps<"p">> = ({
|
||||
export const PaywallGuidance: React.FC<React.ComponentProps<"p">> = ({
|
||||
children,
|
||||
className,
|
||||
...props
|
||||
@@ -196,7 +195,7 @@ export const PaywallGuidance: FC<React.ComponentProps<"p">> = ({
|
||||
);
|
||||
};
|
||||
|
||||
const FeatureIcon: FC<React.ComponentProps<"svg">> = ({
|
||||
const FeatureIcon: React.FC<React.ComponentProps<"svg">> = ({
|
||||
className,
|
||||
...props
|
||||
}) => {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { cn } from "cn";
|
||||
import type { FC } from "react";
|
||||
import { Supergraphic } from "#/components/Supergraphic/Supergraphic";
|
||||
import {
|
||||
PaywallCTALink,
|
||||
@@ -16,7 +15,7 @@ import {
|
||||
|
||||
const DEFAULT_HERO_SUBTITLE = "Start an unlimited 30-day trial today";
|
||||
|
||||
const PaywallPremiumHeader: FC<React.ComponentProps<"div">> = ({
|
||||
const PaywallPremiumHeader: React.FC<React.ComponentProps<"div">> = ({
|
||||
children,
|
||||
className,
|
||||
...props
|
||||
@@ -35,7 +34,7 @@ const PaywallPremiumHeader: FC<React.ComponentProps<"div">> = ({
|
||||
);
|
||||
};
|
||||
|
||||
const PaywallPremiumContent: FC<React.ComponentProps<"div">> = ({
|
||||
const PaywallPremiumContent: React.FC<React.ComponentProps<"div">> = ({
|
||||
children,
|
||||
className,
|
||||
...props
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { SearchIcon, XIcon } from "lucide-react";
|
||||
import { type Ref, useEffectEvent, useLayoutEffect, useRef } from "react";
|
||||
import { useEffectEvent, useLayoutEffect, useRef } from "react";
|
||||
import {
|
||||
InputGroup,
|
||||
InputGroupAddon,
|
||||
@@ -20,7 +20,7 @@ export type SearchFieldProps = {
|
||||
className?: string;
|
||||
autoFocus?: boolean;
|
||||
onBlur?: () => void;
|
||||
ref?: Ref<HTMLInputElement>;
|
||||
ref?: React.Ref<HTMLInputElement>;
|
||||
"aria-label"?: string;
|
||||
"aria-invalid"?: boolean;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { useFormik } from "formik";
|
||||
import type { FC } from "react";
|
||||
import { expect, userEvent, waitFor, within } from "storybook/test";
|
||||
import { SelectItem } from "#/components/Select/Select";
|
||||
import { SelectField } from "./SelectField";
|
||||
@@ -18,7 +17,7 @@ type ExampleSelectFieldProps = {
|
||||
disabled?: boolean;
|
||||
};
|
||||
|
||||
const ExampleSelectField: FC<ExampleSelectFieldProps> = ({
|
||||
const ExampleSelectField: React.FC<ExampleSelectFieldProps> = ({
|
||||
id,
|
||||
label,
|
||||
description,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { cn } from "cn";
|
||||
import type { FC, ReactNode } from "react";
|
||||
import { FormField } from "#/components/FormField/FormField";
|
||||
import {
|
||||
Select,
|
||||
@@ -11,11 +10,11 @@ import type { FormHelpers } from "#/utils/formUtils";
|
||||
|
||||
type SelectFieldProps = {
|
||||
field: FormHelpers;
|
||||
label: ReactNode;
|
||||
label: React.ReactNode;
|
||||
onValueChange: (value: string) => void;
|
||||
children: ReactNode;
|
||||
children: React.ReactNode;
|
||||
id?: string;
|
||||
description?: ReactNode;
|
||||
description?: React.ReactNode;
|
||||
placeholder?: string;
|
||||
required?: boolean;
|
||||
disabled?: boolean;
|
||||
@@ -26,7 +25,7 @@ type SelectFieldProps = {
|
||||
* A labelled Select wired to Formik through getFormHelpers. The label's
|
||||
* `htmlFor` targets the trigger's `id`, which makes the ComboBox name accessible.
|
||||
*/
|
||||
export const SelectField: FC<SelectFieldProps> = ({
|
||||
export const SelectField: React.FC<SelectFieldProps> = ({
|
||||
field,
|
||||
label,
|
||||
onValueChange,
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
import { cn } from "cn";
|
||||
import { Separator as SeparatorPrimitive } from "radix-ui";
|
||||
import type * as React from "react";
|
||||
|
||||
function Separator({
|
||||
className,
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
import { cva, type VariantProps } from "class-variance-authority";
|
||||
import { cn } from "cn";
|
||||
import type { FC, PropsWithChildren, ReactNode } from "react";
|
||||
import { Link } from "#/components/Link/Link";
|
||||
|
||||
type SettingsHeaderProps = Readonly<
|
||||
PropsWithChildren<{
|
||||
actions?: ReactNode;
|
||||
React.PropsWithChildren<{
|
||||
actions?: React.ReactNode;
|
||||
className?: string;
|
||||
}>
|
||||
>;
|
||||
export const SettingsHeader: FC<SettingsHeaderProps> = ({
|
||||
export const SettingsHeader: React.FC<SettingsHeaderProps> = ({
|
||||
children,
|
||||
actions,
|
||||
className,
|
||||
@@ -28,12 +27,12 @@ export const SettingsHeader: FC<SettingsHeaderProps> = ({
|
||||
};
|
||||
|
||||
type SettingsHeaderDocsLinkProps = Readonly<
|
||||
PropsWithChildren<{
|
||||
React.PropsWithChildren<{
|
||||
href: string;
|
||||
context?: string;
|
||||
}>
|
||||
>;
|
||||
export const SettingsHeaderDocsLink: FC<SettingsHeaderDocsLinkProps> = ({
|
||||
export const SettingsHeaderDocsLink: React.FC<SettingsHeaderDocsLinkProps> = ({
|
||||
href,
|
||||
context,
|
||||
children = "View docs",
|
||||
@@ -60,15 +59,15 @@ const titleVariants = cva("m-0 flex items-center gap-2 leading-tight", {
|
||||
},
|
||||
});
|
||||
type SettingsHeaderTitleProps = Readonly<
|
||||
PropsWithChildren<
|
||||
React.PropsWithChildren<
|
||||
VariantProps<typeof titleVariants> & {
|
||||
level?: `h${1 | 2 | 3 | 4 | 5 | 6}`;
|
||||
tooltip?: ReactNode;
|
||||
tooltip?: React.ReactNode;
|
||||
className?: string;
|
||||
}
|
||||
>
|
||||
>;
|
||||
export const SettingsHeaderTitle: FC<SettingsHeaderTitleProps> = ({
|
||||
export const SettingsHeaderTitle: React.FC<SettingsHeaderTitleProps> = ({
|
||||
children,
|
||||
tooltip,
|
||||
className,
|
||||
@@ -91,14 +90,13 @@ export const SettingsHeaderTitle: FC<SettingsHeaderTitleProps> = ({
|
||||
};
|
||||
|
||||
type SettingsHeaderDescriptionProps = Readonly<
|
||||
PropsWithChildren<{
|
||||
React.PropsWithChildren<{
|
||||
className?: string;
|
||||
}>
|
||||
>;
|
||||
export const SettingsHeaderDescription: FC<SettingsHeaderDescriptionProps> = ({
|
||||
children,
|
||||
className,
|
||||
}) => {
|
||||
export const SettingsHeaderDescription: React.FC<
|
||||
SettingsHeaderDescriptionProps
|
||||
> = ({ children, className }) => {
|
||||
return (
|
||||
<p
|
||||
className={cn(
|
||||
|
||||
@@ -1,25 +1,24 @@
|
||||
import { cn } from "cn";
|
||||
import type { FC, ReactNode } from "react";
|
||||
import { NavLink, type To } from "react-router";
|
||||
|
||||
type SidebarProps = {
|
||||
children?: ReactNode;
|
||||
children?: React.ReactNode;
|
||||
className?: string;
|
||||
};
|
||||
|
||||
export const Sidebar: FC<SidebarProps> = ({ className, children }) => {
|
||||
export const Sidebar: React.FC<SidebarProps> = ({ className, children }) => {
|
||||
return (
|
||||
<nav className={cn("w-full lg:w-60 shrink-0", className)}>{children}</nav>
|
||||
);
|
||||
};
|
||||
|
||||
type SettingsSidebarNavItemProps = {
|
||||
children?: ReactNode;
|
||||
children?: React.ReactNode;
|
||||
href: To;
|
||||
end?: boolean;
|
||||
};
|
||||
|
||||
export const SettingsSidebarNavItem: FC<SettingsSidebarNavItemProps> = ({
|
||||
export const SettingsSidebarNavItem: React.FC<SettingsSidebarNavItemProps> = ({
|
||||
children,
|
||||
href,
|
||||
end,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { FC, PropsWithChildren } from "react";
|
||||
export const SignInLayout: FC<PropsWithChildren> = ({ children }) => {
|
||||
export const SignInLayout: React.FC<React.PropsWithChildren> = ({
|
||||
children,
|
||||
}) => {
|
||||
return (
|
||||
<div className="grow basis-0 h-screen flex justify-center items-center">
|
||||
<div className="flex flex-col items-center">
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
import { isPixel } from "@coder/pixel-storybook/storyapi";
|
||||
import { cva, type VariantProps } from "class-variance-authority";
|
||||
import { cn } from "cn";
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
const leaves = Array.from({ length: 8 }).map((_, i) => i);
|
||||
|
||||
@@ -25,7 +24,7 @@ const spinnerVariants = cva("", {
|
||||
|
||||
type SpinnerProps = React.ComponentProps<"svg"> &
|
||||
VariantProps<typeof spinnerVariants> & {
|
||||
children?: ReactNode;
|
||||
children?: React.ReactNode;
|
||||
loading?: boolean;
|
||||
/**
|
||||
* Exposes the spinner as an accessible live region labelled with this text. Leave undefined for
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { cn } from "cn";
|
||||
import type { ComponentProps, FC } from "react";
|
||||
|
||||
/**
|
||||
* Use these components as the label in FormControlLabel when implementing radio
|
||||
* buttons, checkboxes, or switches to ensure proper styling.
|
||||
*/
|
||||
|
||||
export const StackLabel: FC<ComponentProps<"div">> = ({
|
||||
export const StackLabel: React.FC<React.ComponentProps<"div">> = ({
|
||||
className,
|
||||
...props
|
||||
}) => {
|
||||
@@ -18,7 +17,7 @@ export const StackLabel: FC<ComponentProps<"div">> = ({
|
||||
);
|
||||
};
|
||||
|
||||
export const StackLabelHelperText: FC<ComponentProps<"p">> = ({
|
||||
export const StackLabelHelperText: React.FC<React.ComponentProps<"p">> = ({
|
||||
className,
|
||||
...props
|
||||
}) => {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { cn } from "cn";
|
||||
import type { ComponentProps, FC, ReactNode } from "react";
|
||||
|
||||
export const Stats: FC<ComponentProps<"div">> = ({
|
||||
export const Stats: React.FC<React.ComponentProps<"div">> = ({
|
||||
children,
|
||||
className,
|
||||
...attrs
|
||||
@@ -19,12 +18,12 @@ export const Stats: FC<ComponentProps<"div">> = ({
|
||||
);
|
||||
};
|
||||
|
||||
type StatsItemProps = ComponentProps<"div"> & {
|
||||
type StatsItemProps = React.ComponentProps<"div"> & {
|
||||
label: string;
|
||||
value: ReactNode;
|
||||
value: React.ReactNode;
|
||||
};
|
||||
|
||||
export const StatsItem: FC<StatsItemProps> = ({
|
||||
export const StatsItem: React.FC<StatsItemProps> = ({
|
||||
label,
|
||||
value,
|
||||
className,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { FC } from "react";
|
||||
import { Badge, type BadgeProps } from "#/components/Badge/Badge";
|
||||
import {
|
||||
Tooltip,
|
||||
@@ -35,7 +34,7 @@ type StatusBadgeProps = {
|
||||
label?: string;
|
||||
};
|
||||
|
||||
export const StatusBadge: FC<StatusBadgeProps> = ({
|
||||
export const StatusBadge: React.FC<StatusBadgeProps> = ({
|
||||
code,
|
||||
isHttpCode,
|
||||
label,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { cva, type VariantProps } from "class-variance-authority";
|
||||
import { cn } from "cn";
|
||||
import { createContext, type FC, useContext } from "react";
|
||||
import { createContext, useContext } from "react";
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
@@ -76,7 +76,7 @@ const dotVariants = cva("rounded-full inline-block border-4 border-solid", {
|
||||
type StatusIndicatorDotProps = React.ComponentProps<"div"> &
|
||||
VariantProps<typeof dotVariants>;
|
||||
|
||||
export const StatusIndicatorDot: FC<StatusIndicatorDotProps> = ({
|
||||
export const StatusIndicatorDot: React.FC<StatusIndicatorDotProps> = ({
|
||||
className,
|
||||
// We allow the size and variant to be overridden directly by the component.
|
||||
// This allows StatusIndicatorDot to be used alone.
|
||||
@@ -103,7 +103,7 @@ type StatusHealthyIndicatorProps = {
|
||||
derpOnly?: boolean;
|
||||
};
|
||||
|
||||
export const StatusHealthyIndicator: FC<StatusHealthyIndicatorProps> = ({
|
||||
export const StatusHealthyIndicator: React.FC<StatusHealthyIndicatorProps> = ({
|
||||
derpOnly,
|
||||
}: StatusHealthyIndicatorProps) => {
|
||||
return (
|
||||
@@ -114,7 +114,7 @@ export const StatusHealthyIndicator: FC<StatusHealthyIndicatorProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
export const StatusNotHealthyIndicator: FC = () => {
|
||||
export const StatusNotHealthyIndicator: React.FC = () => {
|
||||
return (
|
||||
<StatusIndicator variant="failed">
|
||||
<StatusIndicatorDot />
|
||||
@@ -123,7 +123,7 @@ export const StatusNotHealthyIndicator: FC = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export const StatusNotRegisteredIndicator: FC = () => {
|
||||
export const StatusNotRegisteredIndicator: React.FC = () => {
|
||||
return (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
@@ -139,7 +139,7 @@ export const StatusNotRegisteredIndicator: FC = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export const StatusNotReachableIndicator: FC = () => {
|
||||
export const StatusNotReachableIndicator: React.FC = () => {
|
||||
return (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { cn } from "cn";
|
||||
import type { FC } from "react";
|
||||
|
||||
/**
|
||||
* A decorative layer that paints the Coder brand supergraphic.
|
||||
*/
|
||||
export const Supergraphic: FC<React.ComponentProps<"div">> = ({
|
||||
export const Supergraphic: React.FC<React.ComponentProps<"div">> = ({
|
||||
className,
|
||||
...props
|
||||
}) => {
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
import Editor, { DiffEditor, loader } from "@monaco-editor/react";
|
||||
import type * as Monaco from "monaco-editor";
|
||||
import * as monaco from "monaco-editor";
|
||||
import {
|
||||
type ComponentProps,
|
||||
type FC,
|
||||
useCallback,
|
||||
useEffect,
|
||||
useRef,
|
||||
} from "react";
|
||||
import { useCallback, useEffect, useRef } from "react";
|
||||
import { useTheme } from "#/theme/context";
|
||||
import { useCoderTheme } from "./coderTheme";
|
||||
|
||||
@@ -16,7 +10,7 @@ loader.config({ monaco });
|
||||
// Shared editor props with onMount typed to accept either editor variant,
|
||||
// so callers don't need to know which underlying component will render.
|
||||
type CommonEditorProps = Omit<
|
||||
ComponentProps<typeof Editor> & ComponentProps<typeof DiffEditor>,
|
||||
React.ComponentProps<typeof Editor> & React.ComponentProps<typeof DiffEditor>,
|
||||
"onMount"
|
||||
> & {
|
||||
onMount?: (
|
||||
@@ -34,7 +28,7 @@ type SyntaxHighlighterProps = {
|
||||
compareWith?: string;
|
||||
};
|
||||
|
||||
export const SyntaxHighlighter: FC<SyntaxHighlighterProps> = ({
|
||||
export const SyntaxHighlighter: React.FC<SyntaxHighlighterProps> = ({
|
||||
value,
|
||||
compareWith,
|
||||
language,
|
||||
@@ -93,7 +87,7 @@ type DiffFileProps = CommonEditorProps & {
|
||||
// the models mid-teardown (which throws), so we dispose them ourselves after
|
||||
// React has torn the editor down. Without this the models accumulate unbounded
|
||||
// as users open template versions until the tab runs out of memory.
|
||||
const DiffFile: FC<DiffFileProps> = ({
|
||||
const DiffFile: React.FC<DiffFileProps> = ({
|
||||
original,
|
||||
modified,
|
||||
onMount,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { FC } from "react";
|
||||
import {
|
||||
EmptyState,
|
||||
type EmptyStateProps,
|
||||
@@ -7,7 +6,7 @@ import { TableCell, TableRow } from "#/components/Table/Table";
|
||||
|
||||
type TableEmptyProps = EmptyStateProps;
|
||||
|
||||
export const TableEmpty: FC<TableEmptyProps> = (props) => {
|
||||
export const TableEmpty: React.FC<TableEmptyProps> = (props) => {
|
||||
return (
|
||||
<TableRow>
|
||||
<TableCell colSpan={999}>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cloneElement, type FC, isValidElement, type ReactNode } from "react";
|
||||
import { cloneElement, isValidElement } from "react";
|
||||
import {
|
||||
TableCell,
|
||||
TableRow,
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
} from "#/components/Table/Table";
|
||||
import { Loader } from "../Loader/Loader";
|
||||
|
||||
export const TableLoader: FC = () => {
|
||||
export const TableLoader: React.FC = () => {
|
||||
return (
|
||||
<TableRow>
|
||||
<TableCell colSpan={999} className="text-center h-40">
|
||||
@@ -18,10 +18,10 @@ export const TableLoader: FC = () => {
|
||||
|
||||
type TableLoaderSkeletonProps = {
|
||||
rows?: number;
|
||||
children?: ReactNode;
|
||||
children?: React.ReactNode;
|
||||
};
|
||||
|
||||
export const TableLoaderSkeleton: FC<TableLoaderSkeletonProps> = ({
|
||||
export const TableLoaderSkeleton: React.FC<TableLoaderSkeletonProps> = ({
|
||||
rows = 4,
|
||||
children,
|
||||
}) => {
|
||||
@@ -39,7 +39,7 @@ export const TableLoaderSkeleton: FC<TableLoaderSkeletonProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
export const TableRowSkeleton: FC<TableRowProps> = ({
|
||||
export const TableRowSkeleton: React.FC<TableRowProps> = ({
|
||||
children,
|
||||
...rowProps
|
||||
}) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { FC, PropsWithChildren } from "react";
|
||||
|
||||
export const TableToolbar: FC<PropsWithChildren> = ({ children }) => {
|
||||
export const TableToolbar: React.FC<React.PropsWithChildren> = ({
|
||||
children,
|
||||
}) => {
|
||||
return (
|
||||
<div className="text-xs mb-2 mt-0 h-9 text-content-secondary flex items-center [&_strong]:text-content-primary">
|
||||
{children}
|
||||
|
||||
@@ -2,7 +2,6 @@ import { cva, type VariantProps } from "class-variance-authority";
|
||||
import { cn } from "cn";
|
||||
import { Tabs as TabsPrimitive } from "radix-ui";
|
||||
import {
|
||||
type ComponentProps,
|
||||
createContext,
|
||||
useCallback,
|
||||
useContext,
|
||||
@@ -14,7 +13,7 @@ import { Link, type LinkProps } from "react-router";
|
||||
|
||||
// --- Radix tabs (stateful panels) ---
|
||||
|
||||
type TabsProps = ComponentProps<typeof TabsPrimitive.Root>;
|
||||
type TabsProps = React.ComponentProps<typeof TabsPrimitive.Root>;
|
||||
|
||||
export const Tabs = ({ ...props }: TabsProps) => {
|
||||
return <TabsPrimitive.Root data-slot="tabs" {...props} />;
|
||||
@@ -46,7 +45,7 @@ const tabsListVariants = cva("flex flex-wrap items-center", {
|
||||
variant: "outsideBox",
|
||||
},
|
||||
});
|
||||
type TabsListProps = ComponentProps<typeof TabsPrimitive.List> &
|
||||
type TabsListProps = React.ComponentProps<typeof TabsPrimitive.List> &
|
||||
VariantProps<typeof tabsListVariants> & {
|
||||
overflowKebabMenu?: boolean;
|
||||
};
|
||||
@@ -72,7 +71,7 @@ export const TabsList = ({
|
||||
);
|
||||
};
|
||||
|
||||
type TabsTriggerProps = ComponentProps<typeof TabsPrimitive.Trigger>;
|
||||
type TabsTriggerProps = React.ComponentProps<typeof TabsPrimitive.Trigger>;
|
||||
|
||||
export const TabsTrigger = ({
|
||||
type: triggerType = "button",
|
||||
@@ -97,7 +96,7 @@ export const TabsTrigger = ({
|
||||
);
|
||||
};
|
||||
|
||||
type TabsContentProps = ComponentProps<typeof TabsPrimitive.Content>;
|
||||
type TabsContentProps = React.ComponentProps<typeof TabsPrimitive.Content>;
|
||||
|
||||
export const TabsContent = ({ ...props }: TabsContentProps) => {
|
||||
return <TabsPrimitive.Content data-slot="tabs-content" {...props} />;
|
||||
@@ -116,7 +115,7 @@ const LinkTabsContext = createContext<LinkTabsContextValue | undefined>(
|
||||
undefined,
|
||||
);
|
||||
|
||||
type LinkTabsProps = ComponentProps<"div"> & LinkTabsContextValue;
|
||||
type LinkTabsProps = React.ComponentProps<"div"> & LinkTabsContextValue;
|
||||
|
||||
export const LinkTabs = ({
|
||||
className,
|
||||
@@ -139,7 +138,7 @@ export const LinkTabs = ({
|
||||
);
|
||||
};
|
||||
|
||||
type LinkTabsListProps = ComponentProps<"div">;
|
||||
type LinkTabsListProps = React.ComponentProps<"div">;
|
||||
|
||||
export const LinkTabsList = ({ className, ...props }: LinkTabsListProps) => {
|
||||
const tabsContext = useContext(LinkTabsContext);
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
import {
|
||||
type RefObject,
|
||||
useCallback,
|
||||
useLayoutEffect,
|
||||
useRef,
|
||||
useState,
|
||||
} from "react";
|
||||
import { useCallback, useLayoutEffect, useRef, useState } from "react";
|
||||
|
||||
type TabValue = {
|
||||
value: string;
|
||||
@@ -18,7 +12,7 @@ type UseKebabMenuOptions<T extends TabValue> = {
|
||||
};
|
||||
|
||||
type UseKebabMenuResult<T extends TabValue> = {
|
||||
containerRef: RefObject<HTMLDivElement | null>;
|
||||
containerRef: React.RefObject<HTMLDivElement | null>;
|
||||
visibleTabs: T[];
|
||||
overflowTabs: T[];
|
||||
getTabMeasureProps: (tabValue: string) => Record<string, string>;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { XIcon } from "lucide-react";
|
||||
import { type FC, useId, useMemo } from "react";
|
||||
import { useId, useMemo } from "react";
|
||||
import { Badge } from "#/components/Badge/Badge";
|
||||
import { Button } from "#/components/Button/Button";
|
||||
|
||||
@@ -10,7 +10,7 @@ type TagInputProps = {
|
||||
onChange: (values: string[]) => void;
|
||||
};
|
||||
|
||||
export const TagInput: FC<TagInputProps> = ({
|
||||
export const TagInput: React.FC<TagInputProps> = ({
|
||||
label,
|
||||
id,
|
||||
values,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { CheckIcon } from "lucide-react";
|
||||
import type { FC } from "react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
|
||||
export const useTemporarySavedState = (
|
||||
@@ -33,7 +32,7 @@ export const useTemporarySavedState = (
|
||||
return { isSavedVisible, showSavedState };
|
||||
};
|
||||
|
||||
export const TemporarySavedState: FC = () => (
|
||||
export const TemporarySavedState: React.FC = () => (
|
||||
<div
|
||||
aria-live="polite"
|
||||
className="inline-flex min-w-8 min-h-6 shrink-0 items-center justify-center gap-1 rounded-md border border-border-success bg-surface-success px-2 font-sans text-2xs font-medium whitespace-nowrap text-content-success"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Fragment, type JSX } from "react";
|
||||
import { Fragment } from "react";
|
||||
import { TimelineDateRow } from "#/components/Timeline/TimelineDateRow";
|
||||
|
||||
type GetDateFn<TData> = (data: TData) => Date;
|
||||
@@ -25,14 +25,14 @@ const groupByDate = <TData,>(
|
||||
type TimelineProps<TData> = {
|
||||
items: readonly TData[];
|
||||
getDate: GetDateFn<TData>;
|
||||
row: (item: TData) => JSX.Element;
|
||||
row: (item: TData) => React.JSX.Element;
|
||||
};
|
||||
|
||||
export const Timeline = <TData,>({
|
||||
items,
|
||||
getDate,
|
||||
row,
|
||||
}: TimelineProps<TData>): JSX.Element => {
|
||||
}: TimelineProps<TData>): React.JSX.Element => {
|
||||
const itemsByDate = groupByDate(items, getDate);
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { FC } from "react";
|
||||
import { TableCell, TableRow } from "#/components/Table/Table";
|
||||
import { formatDate } from "#/utils/time";
|
||||
import { createDisplayDate } from "./utils";
|
||||
@@ -7,7 +6,7 @@ type TimelineDateRowProps = {
|
||||
date: Date;
|
||||
};
|
||||
|
||||
export const TimelineDateRow: FC<TimelineDateRowProps> = ({ date }) => {
|
||||
export const TimelineDateRow: React.FC<TimelineDateRowProps> = ({ date }) => {
|
||||
return (
|
||||
<TableRow>
|
||||
<TableCell
|
||||
|
||||
Loaded 100 of 828 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user