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

(HDS-2157) Tag mark deprecated and changed properties #1234

Merged
merged 1 commit into from
Mar 6, 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
Changes that are not related to specific components

- [Component] What has been changed
- [Tag] Marked changed and removed properties in the next major release

#### Fixed

Expand Down
24 changes: 16 additions & 8 deletions packages/react/src/components/tag/Tag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ export type TagProps = {
className?: string;
/**
* The aria-label for the delete button
* @deprecated Will be removed in the next major release.
*/
deleteButtonAriaLabel?: string;
/**
* Prop will be passed to the delete button `<button>` element. It also hides the default label from screen readers to prevent confusion with labels when present.
* @deprecated Will be removed in the next major release.
*/
deleteButtonProps?: React.ComponentPropsWithoutRef<'button'>;
/**
Expand All @@ -36,10 +38,12 @@ export type TagProps = {
id?: string;
/**
* Additional class names to apply to the tag's label element
* @deprecated Will be removed in the next major release.
*/
labelClassName?: string;
/**
* Props that will be passed to the label `<span>` element.
* @deprecated Will be removed in the next major release.
*/
labelProps?: React.ComponentPropsWithoutRef<'span'>;
/**
Expand All @@ -52,19 +56,23 @@ export type TagProps = {
onDelete?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
/**
* Sets the role of the tag when it's clickable. Uses 'link' by default.
* @deprecated Usage will change in the next major release.
*/
role?: 'link' | 'button';
/**
* Size variant for the Tag.
* @default 'm'
* @deprecated Will change in the next major release.
*/
size?: 'm' | 'l';
/**
* The label is only visible to screen readers. Can be used to give screen reader users additional information about the tag.
* @deprecated Will be removed in the next major release.
*/
srOnlyLabel?: string;
/**
* Custom theme styles
* Will contain more properties in the next major release.
*/
theme?: TagCustomTheme;
};
Expand All @@ -74,17 +82,17 @@ export const Tag = forwardRef<HTMLDivElement, TagProps>(
{
children,
className,
deleteButtonAriaLabel,
deleteButtonProps,
deleteButtonAriaLabel, // Will be removed in the next major release
deleteButtonProps, // Will be removed in the next major release
id = 'hds-tag', // Default value will be removed in the next major release
labelClassName,
labelProps,
labelClassName, // Will be removed in the next major release
labelProps, // Will be removed in the next major release
onClick,
onDelete,
role = 'link',
size = 'm',
srOnlyLabel,
theme,
role = 'link', // Use will change in the next major release
size = 'm', // Will change in the next major release
srOnlyLabel, // Will be removed in the next major release
theme, // Will contain more properties in the next major release
...rest
},
ref: React.Ref<HTMLDivElement>,
Expand Down
Loading