@hyphen/hyphen-components 6.0.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AspectRatio/AspectRatio.d.ts +3 -0
- package/dist/components/AspectRatio/AspectRatio.stories.d.ts +6 -0
- package/package.json +7 -6
- package/src/components/AspectRatio/AspectRatio.mdx +15 -0
- package/src/components/AspectRatio/AspectRatio.stories.tsx +28 -0
- package/src/components/AspectRatio/AspectRatio.tsx +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyphen/hyphen-components",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "@hyphen"
|
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@emotion/react": "^11.14.0",
|
|
65
65
|
"@hyphen/hyphen-design-tokens": "^5.1.0",
|
|
66
|
+
"@radix-ui/react-aspect-ratio": "^1.1.7",
|
|
66
67
|
"@radix-ui/react-collapsible": "^1.1.12",
|
|
67
68
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
68
69
|
"@radix-ui/react-popover": "^1.1.15",
|
|
@@ -85,13 +86,13 @@
|
|
|
85
86
|
},
|
|
86
87
|
"devDependencies": {
|
|
87
88
|
"@babel/core": "^7.27.4",
|
|
88
|
-
"@chromatic-com/storybook": "^4.1.
|
|
89
|
+
"@chromatic-com/storybook": "^4.1.1",
|
|
89
90
|
"@semantic-release/commit-analyzer": "^11.1.0",
|
|
90
91
|
"@size-limit/preset-small-lib": "^11.1.4",
|
|
91
|
-
"@storybook/addon-a11y": "^9.
|
|
92
|
-
"@storybook/addon-docs": "^9.
|
|
93
|
-
"@storybook/addon-themes": "^9.
|
|
94
|
-
"@storybook/react-vite": "^9.
|
|
92
|
+
"@storybook/addon-a11y": "^9.1.3",
|
|
93
|
+
"@storybook/addon-docs": "^9.1.3",
|
|
94
|
+
"@storybook/addon-themes": "^9.1.3",
|
|
95
|
+
"@storybook/react-vite": "^9.1.3",
|
|
95
96
|
"@testing-library/jest-dom": "^6.6.3",
|
|
96
97
|
"@testing-library/react": "^16.2.0",
|
|
97
98
|
"@testing-library/user-event": "^14.6.1",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Canvas, Meta, ArgTypes } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import * as Stories from './AspectRatio.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# Aspect Ratio
|
|
7
|
+
|
|
8
|
+
Aspect Ratio components are used to maintain a specific aspect ratio for their content.
|
|
9
|
+
|
|
10
|
+
This component is extended from [Radix](https://www.radix-ui.com/primitives/docs/components/aspect-ratio).
|
|
11
|
+
|
|
12
|
+
[API Reference](https://www.radix-ui.com/primitives/docs/components/aspect-ratio#api-reference)
|
|
13
|
+
|
|
14
|
+
<Canvas of={Stories.Usage} />
|
|
15
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta } from '@storybook/react-vite';
|
|
3
|
+
import { AspectRatio } from './AspectRatio';
|
|
4
|
+
import { Box } from '../Box/Box';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof AspectRatio> = {
|
|
7
|
+
title: 'Components/AspectRatio',
|
|
8
|
+
component: AspectRatio,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
|
|
13
|
+
export const Usage = () => (
|
|
14
|
+
<Box width="9xl">
|
|
15
|
+
<AspectRatio ratio={16 / 9}>
|
|
16
|
+
<img
|
|
17
|
+
className="Image"
|
|
18
|
+
src="https://images.unsplash.com/photo-1750688650545-d9e2a060dfe8?q=80&w=512&auto=format&fit=crop"
|
|
19
|
+
alt="Landscape photograph by Jonas Degener"
|
|
20
|
+
style={{
|
|
21
|
+
objectFit: 'cover',
|
|
22
|
+
width: '100%',
|
|
23
|
+
height: '100%',
|
|
24
|
+
}}
|
|
25
|
+
/>
|
|
26
|
+
</AspectRatio>
|
|
27
|
+
</Box>
|
|
28
|
+
);
|