diff --git a/README.md b/README.md index 8e8fffd5..61b99311 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Using Force UI as a dependency in package.json - ```json "dependencies": { - "@bsf/force-ui": "git+https://github.com/brainstormforce/force-ui#1.3.2" + "@bsf/force-ui": "git+https://github.com/brainstormforce/force-ui#1.3.3" } ``` @@ -28,7 +28,7 @@ npm install Or you can directly run the following command to install the package - ```bash -npm i -S @bsf/force-ui@git+https://github.com/brainstormforce/force-ui.git#1.3.2 +npm i -S @bsf/force-ui@git+https://github.com/brainstormforce/force-ui.git#1.3.3 ```
diff --git a/changelog.txt b/changelog.txt index 7c0fbbd4..cd516a27 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +Version 1.3.3 - 20th December, 2024 +Fixed - React `Each child in a list should have a unique "key" prop` console warning. +Fixed - Toaster content overlapping with the close button. + Version 1.3.2 - 17th December, 2024 Fixed - Adjusted the color of the Switch component label and help text. diff --git a/package.json b/package.json index babe0eb0..e78445fe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bsf/force-ui", - "version": "1.3.2", + "version": "1.3.3", "description": "Library of components for the BSF project", "main": "./dist/force-ui.js", "module": "./dist/force-ui.js", diff --git a/src/components/button/button.tsx b/src/components/button/button.tsx index b9ce047a..8f951e06 100644 --- a/src/components/button/button.tsx +++ b/src/components/button/button.tsx @@ -1,4 +1,9 @@ -import React, { forwardRef, type ElementType, type ReactNode } from 'react'; +import React, { + forwardRef, + Fragment, + type ElementType, + type ReactNode, +} from 'react'; import { cn } from '@/utilities/functions'; export interface ButtonProps { @@ -140,12 +145,14 @@ const Button: React.FunctionComponent = forwardRef( disabled={ disabled } { ...rest } > - { iconLeft } + { iconLeft } { children ? { children } : null } - { iconRight } + { iconRight } ); } ); +Button.displayName = 'Button'; + export default Button; diff --git a/src/components/label/label.tsx b/src/components/label/label.tsx index 7a261cad..8c3521ca 100644 --- a/src/components/label/label.tsx +++ b/src/components/label/label.tsx @@ -78,6 +78,8 @@ const Label = forwardRef( } ); +Label.displayName = 'Label'; + export default Label as ( props: LabelProps & T, ref: React.Ref diff --git a/src/components/toaster/toaster.stories.tsx b/src/components/toaster/toaster.stories.tsx index 752a4867..1d330e53 100644 --- a/src/components/toaster/toaster.stories.tsx +++ b/src/components/toaster/toaster.stories.tsx @@ -1,6 +1,8 @@ import type { Meta, StoryFn } from '@storybook/react'; import { Toaster } from './toaster'; import { toast } from './controller'; +import { nanoid } from 'nanoid'; +import { useState, useEffect } from 'react'; const meta: Meta = { title: 'Atoms/Toaster', @@ -62,9 +64,15 @@ export default meta; type Story = StoryFn; const Template: Story = ( args ) => { + const [ keyId, setKeyId ] = useState( nanoid() ); + + useEffect( () => { + setKeyId( nanoid() ); + }, [ args ] ); + return (
- +
-
+
{ getTitle( { title, theme } ) } { getContent( { content, theme } ) } { diff --git a/src/components/tooltip/tooltip.tsx b/src/components/tooltip/tooltip.tsx index e9eda68e..4c3b9d3b 100644 --- a/src/components/tooltip/tooltip.tsx +++ b/src/components/tooltip/tooltip.tsx @@ -5,6 +5,7 @@ import { isValidElement, cloneElement, useMemo, + Fragment, } from 'react'; import { useFloating, @@ -174,21 +175,23 @@ export const Tooltip = ( { const widthClasses = 'max-w-80 w-fit'; return ( - <> - { isValidElement( children ) && - cloneElement( children as React.ReactElement, { - ...children.props, - ref: mergeRefs( - ( - children as React.ReactElement & { - ref?: React.Ref; - } - ).ref, - refs.setReference - ), - className: cn( children.props.className ), - ...getReferenceProps(), - } ) } + + { isValidElement( children ) && ( + + { cloneElement( children as React.ReactElement, { + ref: mergeRefs( + ( + children as React.ReactElement & { + ref?: React.Ref; + } + ).ref, + refs.setReference + ), + className: cn( children.props.className ), + ...getReferenceProps(), + } ) } + + ) } { isMounted && (
{ !! title && ( - { title } + + { title } + ) } { !! content && ( -
{ content }
+
+ { content } +
) }
{ arrow && ( @@ -223,8 +236,10 @@ export const Tooltip = ( {
) }
- +
); }; +Tooltip.displayName = 'Tooltip'; + export default Tooltip; diff --git a/version.json b/version.json index 7a009da5..fcf52ace 100644 --- a/version.json +++ b/version.json @@ -1,3 +1,3 @@ { - "force-ui": "1.3.2" + "force-ui": "1.3.3" }