Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated defaultProps #171

Merged
merged 3 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 5 additions & 13 deletions src/data/DateFormat/DateFormat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ export interface DateFormatProps {
}

export const DateFormat: FC<DateFormatProps> = ({
allowToggle,
allowToggle = false,
cacheKey,
className,
format,
emptyMessage,
includeSeconds,
addSuffix,
format = 'MM/dd/yy hh:mm:ss a',
emptyMessage = 'N/A',
includeSeconds = false,
addSuffix = true,
fromNow,
date,
theme: customTheme
Expand Down Expand Up @@ -163,11 +163,3 @@ export const DateFormat: FC<DateFormatProps> = ({
</time>
);
};

DateFormat.defaultProps = {
format: 'MM/dd/yy hh:mm:ss a',
includeSeconds: false,
allowToggle: false,
addSuffix: true,
emptyMessage: 'N/A'
};
6 changes: 1 addition & 5 deletions src/data/Duration/Duration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ export interface DurationProps {
emptyValue?: string;
}

export const Duration: FC<DurationProps> = ({ value, emptyValue }) => (
export const Duration: FC<DurationProps> = ({ value, emptyValue = 'N/A' }) => (
<>{formatDuration(value, emptyValue)}</>
);

Duration.defaultProps = {
emptyValue: 'N/A'
};
12 changes: 3 additions & 9 deletions src/data/Ellipsis/Ellipsis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ export const Ellipsis: FC<EllipsisProps> = ({
value,
className,
title,
removeLinebreaks,
expandable,
limit,
removeLinebreaks = true,
expandable = true,
limit = 256,
theme: customTheme
}) => {
const [expanded, setExpanded] = useState<boolean>(false);
Expand Down Expand Up @@ -85,9 +85,3 @@ export const Ellipsis: FC<EllipsisProps> = ({
</span>
);
};

Ellipsis.defaultProps = {
removeLinebreaks: true,
expandable: true,
limit: 256
};
9 changes: 2 additions & 7 deletions src/data/InfinityList/InfinityList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export interface InfinityListProps extends Omit<InfinityListInputs, 'items'> {

export const InfinityList: FC<InfinityListProps> = ({
children,
size,
threshold,
size = 10,
threshold = 3,
nextSize,
buttonClassName
}) => {
Expand Down Expand Up @@ -47,8 +47,3 @@ export const InfinityList: FC<InfinityListProps> = ({
</>
);
};

InfinityList.defaultProps = {
size: 10,
threshold: 3
};
18 changes: 5 additions & 13 deletions src/data/Pager/Pager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ export const Pager: FC<PagerProps> = ({
page,
size,
total,
startArrow,
endArrow,
previousArrow,
nextArrow,
startArrow = <StartArrow />,
endArrow = <EndArrow />,
previousArrow = <PreviousArrow />,
nextArrow = <NextArrow />,
onPageChange,
displayMode,
displayMode = 'pages',
theme: customTheme
}) => {
const pageCount = Math.ceil(total / size);
Expand Down Expand Up @@ -229,11 +229,3 @@ export const Pager: FC<PagerProps> = ({
</div>
);
};

Pager.defaultProps = {
previousArrow: <PreviousArrow />,
nextArrow: <NextArrow />,
startArrow: <StartArrow />,
endArrow: <EndArrow />,
displayMode: 'pages'
};
15 changes: 4 additions & 11 deletions src/data/Redact/Redact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ export interface RedactProps {
}

export const Redact: FC<RedactProps> = ({
allowToggle,
compactLength,
tooltipText,
allowToggle = true,
compactLength = 8,
tooltipText = 'Click to toggle sensitive content',
className,
character,
character = '*',
value,
theme: customTheme
}) => {
Expand Down Expand Up @@ -79,10 +79,3 @@ export const Redact: FC<RedactProps> = ({
</span>
);
};

Redact.defaultProps = {
allowToggle: true,
character: '*',
compactLength: 8,
tooltipText: 'Click to toggle sensitive content'
};
6 changes: 1 addition & 5 deletions src/data/Sort/Sort.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const Sort: FC<SortProps> = ({
disabled,
direction,
iconClassName,
icon: Icon,
icon: Icon = DownArrowIcon,
neutralIcon: NeutralIcon,
neutralIconClassName,
children,
Expand Down Expand Up @@ -142,7 +142,3 @@ export const Sort: FC<SortProps> = ({
</div>
);
};

Sort.defaultProps = {
icon: DownArrowIcon
};
12 changes: 3 additions & 9 deletions src/elements/Avatar/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ export const Avatar = React.forwardRef<HTMLDivElement, AvatarProps>(
name,
src,
color,
size,
variant,
rounded,
size = 24,
variant = 'filled',
rounded = true,
className,
colorOptions,
theme: customTheme,
Expand Down Expand Up @@ -108,9 +108,3 @@ export const Avatar = React.forwardRef<HTMLDivElement, AvatarProps>(
);
}
);

Avatar.defaultProps = {
size: 24,
rounded: true,
variant: 'filled'
};
6 changes: 1 addition & 5 deletions src/elements/AvatarGroup/AvatarGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const AvatarGroup = forwardRef<HTMLDivElement, AvatarGroupProps>(
{
children,
className,
size,
size = 10,
theme: customTheme,
...rest
}: AvatarGroupProps,
Expand Down Expand Up @@ -61,7 +61,3 @@ export const AvatarGroup = forwardRef<HTMLDivElement, AvatarGroupProps>(
);
}
);

AvatarGroup.defaultProps = {
size: 10
};
9 changes: 2 additions & 7 deletions src/elements/Badge/Badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ export const Badge: FC<BadgeProps & BadgeRef> = forwardRef(
(
{
children,
color,
color = 'default',
className,
disableMargins,
content,
hidden,
placement,
placement = 'top-end',
theme: customTheme,
...rest
}: BadgeProps,
Expand Down Expand Up @@ -81,8 +81,3 @@ export const Badge: FC<BadgeProps & BadgeRef> = forwardRef(
);
}
);

Badge.defaultProps = {
color: 'default',
placement: 'top-end'
};
15 changes: 5 additions & 10 deletions src/elements/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ export interface ButtonRef {
export const Button: FC<ButtonProps & ButtonRef> = forwardRef(
(
{
color,
variant,
color = 'default',
variant = 'filled',
children,
fullWidth,
size,
size = 'medium',
disableAnimation,
className,
disableMargins,
Expand All @@ -81,6 +81,7 @@ export const Button: FC<ButtonProps & ButtonRef> = forwardRef(
startAdornment,
endAdornment,
theme: customTheme,
type = 'button',
...rest
}: ButtonProps,
ref
Expand All @@ -95,6 +96,7 @@ export const Button: FC<ButtonProps & ButtonRef> = forwardRef(
return (
<motion.button
{...rest}
type={type}
disabled={disabled}
ref={ref}
whileTap={{ scale: disabled || disableAnimation ? 1 : 0.9 }}
Expand Down Expand Up @@ -140,10 +142,3 @@ export const Button: FC<ButtonProps & ButtonRef> = forwardRef(
);
}
);

Button.defaultProps = {
color: 'default',
variant: 'filled',
size: 'medium',
type: 'button'
};
8 changes: 1 addition & 7 deletions src/elements/Chip/Chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const Chip: FC<ChipProps & ChipRef> = forwardRef(
children,
color = 'default',
variant = 'filled',
size,
size = 'medium',
selected,
disabled,
className,
Expand Down Expand Up @@ -135,9 +135,3 @@ export const Chip: FC<ChipProps & ChipRef> = forwardRef(
);
}
);

Chip.defaultProps = {
color: 'default',
size: 'medium',
variant: 'filled'
};
15 changes: 5 additions & 10 deletions src/elements/Chip/DeletableChip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ export const DeletableChip: FC<DeletableChipProps & ChipRef> = forwardRef(
{
children,
disabled,
deleteIcon,
deleteIcon = <CloseIcon height={12} width={12} />,
onDelete,
size,
color,
size = 'medium',
color = 'default',
theme: customTheme,
variant = 'filled',
...rest
},
ref
Expand Down Expand Up @@ -67,17 +68,11 @@ export const DeletableChip: FC<DeletableChipProps & ChipRef> = forwardRef(
{deleteIcon}
</Button>
}
variant={variant}
{...rest}
>
{children}
</Chip>
);
}
);

DeletableChip.defaultProps = {
color: 'default',
size: 'medium',
variant: 'filled',
deleteIcon: <CloseIcon height={12} width={12} />
};
6 changes: 1 addition & 5 deletions src/elements/CommandPalette/CommandPalette.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const CommandPalette: FC<CommandPaletteProps> = ({
placeholder,
children,
inputIcon,
autoFocus,
autoFocus = true,
emptyMessage,
onHotkey,
onSelectedIndexChange,
Expand Down Expand Up @@ -149,7 +149,3 @@ export const CommandPalette: FC<CommandPaletteProps> = ({
</Card>
);
};

CommandPalette.defaultProps = {
autoFocus: true
};
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { SearchIcon } from './SearchIcon';
import { HotkeyIem } from '@/elements/CommandPalette/useFlattenedTree';
import { CommandPaletteTheme } from '@/elements/CommandPalette/CommandPaletteTheme';
import { useComponentTheme } from '@/utils';
import keys, { Handler } from '@reaviz/ctrl-keys';
import keys, { Handler } from 'ctrl-keys';

export interface CommandPaletteInputProps {
/**
Expand Down Expand Up @@ -68,7 +68,7 @@ export interface CommandPaletteInputProps {
export const CommandPaletteInput: FC<CommandPaletteInputProps> = ({
value,
autoFocus,
icon,
icon = <SearchIcon />,
hotkeys,
placeholder,
onHotkey,
Expand Down Expand Up @@ -133,7 +133,3 @@ export const CommandPaletteInput: FC<CommandPaletteInputProps> = ({
</div>
);
};

CommandPaletteInput.defaultProps = {
icon: <SearchIcon />
};
9 changes: 2 additions & 7 deletions src/elements/Loader/DotsLoader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export interface DotsLoaderProps {

export const DotsLoader: FC<DotsLoaderProps> = ({
className,
size,
speed,
size = 'medium',
speed = 0.2,
theme: customTheme
}) => {
const theme: DotsLoaderTheme = useComponentTheme('dotsLoader', customTheme);
Expand Down Expand Up @@ -42,8 +42,3 @@ export const DotsLoader: FC<DotsLoaderProps> = ({
</motion.div>
);
};

DotsLoader.defaultProps = {
speed: 0.2,
size: 'medium'
};
Loading
Loading