diff --git a/package-lock.json b/package-lock.json index 1a177a46..842db9c9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@radui/ui", - "version": "0.0.25", + "version": "0.0.26", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@radui/ui", - "version": "0.0.25", + "version": "0.0.26", "license": "ISC", "dependencies": { "@floating-ui/react": "^0.26.20", diff --git a/package.json b/package.json index 112c6a35..e6a65d24 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@radui/ui", - "version": "0.0.25", + "version": "0.0.26", "description": "", "main": "dist", "type": "module", @@ -9,6 +9,7 @@ "./themes/tailwind-presets/default.js": "./dist/themes/tailwind-presets/default.js", "./Accordion": "./dist/components/Accordion.js", "./AlertDialog": "./dist/components/AlertDialog.js", + "./AspectRatio": "./dist/components/AspectRatio.js", "./Avatar": "./dist/components/Avatar.js", "./AvatarGroup": "./dist/components/AvatarGroup.js", "./Badge": "./dist/components/Badge.js", @@ -20,6 +21,7 @@ "./Collapsible": "./dist/components/Collapsible.js", "./Em": "./dist/components/Em.js", "./Heading": "./dist/components/Heading.js", + "./HoverCard": "./dist/components/HoverCard.js", "./Kbd": "./dist/components/Kbd.js", "./Link": "./dist/components/Link.js", "./Progress": "./dist/components/Progress.js", @@ -35,7 +37,8 @@ "./TextArea": "./dist/components/TextArea.js", "./Toggle": "./dist/components/Toggle.js", "./ToggleGroup": "./dist/components/ToggleGroup.js", - "./Tooltip": "./dist/components/Tooltip.js" + "./Tooltip": "./dist/components/Tooltip.js", + "./VisuallyHidden": "./dist/components/VisuallyHidden.js" }, "scripts": { "test": "jest", diff --git a/src/components/ui/AspectRatio/AspectRatio.tsx b/src/components/ui/AspectRatio/AspectRatio.tsx index 95b27a8f..02c8fb97 100644 --- a/src/components/ui/AspectRatio/AspectRatio.tsx +++ b/src/components/ui/AspectRatio/AspectRatio.tsx @@ -12,14 +12,13 @@ export type AspectRatioProps = { props: Record[]; } -const AspectRatio = ({ children, customRootClass, className, ratio="1", ...props }: AspectRatioProps) => { - - if (isNaN(Number(ratio)) && !ratio.match(/^(\d+)\/(\d+)$/)) ratio = "1" - if (Number(ratio) <= 0) ratio = "1" +const AspectRatio = ({ children, customRootClass, className, ratio = '1', ...props }: AspectRatioProps) => { + if (isNaN(Number(ratio)) && !ratio.match(/^(\d+)\/(\d+)$/)) ratio = '1'; + if (Number(ratio) <= 0) ratio = '1'; const rootClass = customClassSwitcher(customRootClass, COMPONENT_NAME); - return
{children}
-} + return
{children}
; +}; AspectRatio.displayName = COMPONENT_NAME; -export default AspectRatio; \ No newline at end of file +export default AspectRatio; diff --git a/src/components/ui/AspectRatio/stories/AspectRatio.stories.js b/src/components/ui/AspectRatio/stories/AspectRatio.stories.js index dc4a6a26..30ee0c52 100644 --- a/src/components/ui/AspectRatio/stories/AspectRatio.stories.js +++ b/src/components/ui/AspectRatio/stories/AspectRatio.stories.js @@ -9,18 +9,18 @@ export default { Landscape photograph - + className="Image" + src="https://images.pexels.com/photos/346529/pexels-photo-346529.jpeg?cs=srgb&dl=pexels-bri-schneiter-28802-346529.jpg&fm=jpg" + alt="Landscape photograph" + /> + }; // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args export const Default = { args: { - className:"", - ratio: "16/9" + className: '', + ratio: '16/9' } }; diff --git a/src/components/ui/AspectRatio/tests/AspectRatio.test.js b/src/components/ui/AspectRatio/tests/AspectRatio.test.js index 110bff62..61c47301 100644 --- a/src/components/ui/AspectRatio/tests/AspectRatio.test.js +++ b/src/components/ui/AspectRatio/tests/AspectRatio.test.js @@ -9,7 +9,7 @@ describe('AspectRatio', () => { }); test('applies custom classes correctly', () => { - render(Content); + render(Content); const divElement = screen.getByText('Content'); expect(divElement).toHaveClass('additional-class'); }); @@ -38,6 +38,4 @@ describe('AspectRatio', () => { render(Content); expect(screen.getByText('Content').style.aspectRatio).toBe('1'); }); - - -}); \ No newline at end of file +}); diff --git a/src/components/ui/Code/Code.tsx b/src/components/ui/Code/Code.tsx index 301870a2..01f25742 100644 --- a/src/components/ui/Code/Code.tsx +++ b/src/components/ui/Code/Code.tsx @@ -10,8 +10,8 @@ export type CodeProps= { customRootClass?: string; } -const Code = ({ children, customRootClass='' }: CodeProps) => { - const rootClass = customClassSwitcher(customRootClass, COMPONENT_NAME) +const Code = ({ children, customRootClass = '' }: CodeProps) => { + const rootClass = customClassSwitcher(customRootClass, COMPONENT_NAME); return {children} diff --git a/src/components/ui/VisuallyHidden/VisuallyHidden.tsx b/src/components/ui/VisuallyHidden/VisuallyHidden.tsx index b2b0e0f2..8ffec6d0 100644 --- a/src/components/ui/VisuallyHidden/VisuallyHidden.tsx +++ b/src/components/ui/VisuallyHidden/VisuallyHidden.tsx @@ -14,11 +14,9 @@ export type VisuallyHiddenProps = { } const VisuallyHidden = ({ children, customRootClass, className, ...props }: VisuallyHiddenProps) => { - const rootClass = customClassSwitcher(customRootClass, COMPONENT_NAME); - return {children} - -} + return {children}; +}; VisuallyHidden.displayName = COMPONENT_NAME; -export default VisuallyHidden; \ No newline at end of file +export default VisuallyHidden; diff --git a/src/components/ui/VisuallyHidden/stories/VisuallyHidden.stories.tsx b/src/components/ui/VisuallyHidden/stories/VisuallyHidden.stories.tsx index 50b2757e..cf413a27 100644 --- a/src/components/ui/VisuallyHidden/stories/VisuallyHidden.stories.tsx +++ b/src/components/ui/VisuallyHidden/stories/VisuallyHidden.stories.tsx @@ -8,23 +8,22 @@ export default { component: VisuallyHidden, render: (args: VisuallyHiddenProps) => - {args.children} - + {args.children} + }; - // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args export const Default = { args: { - className:"", - children: "This is a visually hidden text", + className: '', + children: 'This is a visually hidden text' } }; export const WithAsChild = { args: { - asChild: true, - children: This is a visually hidden text , + asChild: true, + children: This is a visually hidden text } }; diff --git a/src/components/ui/VisuallyHidden/tests/VisuallyHidden.test.js b/src/components/ui/VisuallyHidden/tests/VisuallyHidden.test.js index f78fbea1..475f01b5 100644 --- a/src/components/ui/VisuallyHidden/tests/VisuallyHidden.test.js +++ b/src/components/ui/VisuallyHidden/tests/VisuallyHidden.test.js @@ -2,7 +2,6 @@ import React from 'react'; import { render, screen } from '@testing-library/react'; import VisuallyHidden from '../VisuallyHidden'; - describe('VisuallyHidden Component', () => { test('renders VisuallyHidden component', () => { render(Visually Hidden); @@ -22,6 +21,5 @@ describe('VisuallyHidden Component', () => { test('renders VisuallyHidden component with asChild prop as span', () => { render(Visually Hidden); expect(screen.getByText('Visually Hidden').tagName).toBe('SPAN'); - }); -}) \ No newline at end of file +});