@indico-data/design-system 2.36.4 → 2.37.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.
@@ -1,7 +1,7 @@
1
1
  type Props = {
2
2
  className?: string;
3
- height?: number;
4
- width?: number;
3
+ height?: number | string;
4
+ width?: number | string;
5
5
  isCircle?: boolean;
6
6
  isFullHeight?: boolean;
7
7
  };
@@ -4,6 +4,7 @@ declare const meta: Meta;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof Skeleton>;
6
6
  export declare const Default: Story;
7
+ export declare const PercentageDimensions: Story;
7
8
  export declare const Circle: Story;
8
9
  export declare const Square: Story;
9
10
  export declare const Composition: Story;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indico-data/design-system",
3
- "version": "2.36.4",
3
+ "version": "2.37.0",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "lib/index.js",
@@ -18,21 +18,23 @@ const meta: Meta = {
18
18
  },
19
19
  height: {
20
20
  control: 'number',
21
- description: 'The height of the skeleton component',
21
+ description:
22
+ 'The height of the skeleton component, either in px (number) or a generic string (e.g. "20px", "50%", "100%")',
22
23
  table: {
23
24
  category: 'Props',
24
25
  type: {
25
- summary: 'number',
26
+ summary: 'number | string',
26
27
  },
27
28
  },
28
29
  },
29
30
  width: {
30
31
  control: 'number',
31
- description: 'The width of the skeleton component',
32
+ description:
33
+ 'The width of the skeleton component, either in px (number) or a generic string (e.g. "20px", "50%", "100%")',
32
34
  table: {
33
35
  category: 'Props',
34
36
  type: {
35
- summary: 'number',
37
+ summary: 'number | string',
36
38
  },
37
39
  },
38
40
  },
@@ -78,6 +80,24 @@ export const Default: Story = {
78
80
  },
79
81
  };
80
82
 
83
+ export const PercentageDimensions: Story = {
84
+ args: {
85
+ height: 20,
86
+ width: '60%',
87
+ isCircle: false,
88
+ isFullHeight: false,
89
+ className: 'custom-class',
90
+ },
91
+ argTypes: {
92
+ width: {
93
+ control: 'text',
94
+ },
95
+ },
96
+ render: (args) => {
97
+ return <Skeleton {...args} />;
98
+ },
99
+ };
100
+
81
101
  export const Circle: Story = {
82
102
  args: {
83
103
  height: 50,
@@ -1,15 +1,15 @@
1
1
  type Props = {
2
2
  className?: string;
3
- height?: number;
4
- width?: number;
3
+ height?: number | string;
4
+ width?: number | string;
5
5
  isCircle?: boolean;
6
6
  isFullHeight?: boolean;
7
7
  };
8
8
 
9
9
  export const Skeleton = ({ className, height, width, isCircle, isFullHeight, ...rest }: Props) => {
10
10
  const dynamicStyle = {
11
- ...(height && { height: `${height}px` }),
12
- ...(width && { width: `${width}px` }),
11
+ ...(height && { height: typeof height === 'number' ? `${height}px` : height }),
12
+ ...(width && { width: typeof width === 'number' ? `${width}px` : width }),
13
13
  };
14
14
 
15
15
  const circleClass = isCircle ? 'skeleton--circle' : '';