Skip to content

Commit b759858

Browse files
authored
Merge pull request #1086 from strapi/release/1.7.8
[release]: 1.7.8
2 parents 3a7d8b8 + d82da91 commit b759858

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+579
-770
lines changed

lerna.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"packages": ["packages/*", "docs"],
3-
"version": "1.7.7",
3+
"version": "1.7.8",
44
"npmClient": "yarn",
55
"useWorkspaces": true
66
}

packages/primitives/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@strapi/ui-primitives",
3-
"version": "1.7.7",
3+
"version": "1.7.8",
44
"license": "MIT",
55
"type": "module",
66
"sideEffects": false,

packages/strapi-design-system/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@strapi/design-system",
3-
"version": "1.7.7",
3+
"version": "1.7.8",
44
"license": "MIT",
55
"type": "module",
66
"sideEffects": false,
@@ -24,7 +24,7 @@
2424
"@radix-ui/react-dismissable-layer": "^1.0.3",
2525
"@radix-ui/react-dropdown-menu": "^2.0.4",
2626
"@radix-ui/react-focus-scope": "1.0.2",
27-
"@strapi/ui-primitives": "^1.7.7",
27+
"@strapi/ui-primitives": "^1.7.8",
2828
"@uiw/react-codemirror": "^4.19.16",
2929
"aria-hidden": "^1.2.3",
3030
"compute-scroll-into-view": "^3.0.3",
@@ -33,7 +33,7 @@
3333
},
3434
"devDependencies": {
3535
"@playwright/test": "1.33.0",
36-
"@strapi/icons": "^1.7.7",
36+
"@strapi/icons": "^1.7.8",
3737
"@types/react-router-dom": "^5.3.3",
3838
"@types/styled-components": "^5.1.26",
3939
"axe-playwright": "^1.2.3",

packages/strapi-design-system/src/Box/Box.tsx

+12-14
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ import * as React from 'react';
22

33
import styled, { CSSProperties, DefaultTheme } from 'styled-components';
44

5-
import handleResponsiveValues from '../helpers/handleResponsiveValues';
5+
import handleResponsiveValues, { ResponsiveValue } from '../helpers/handleResponsiveValues';
66
import { extractStyleFromTheme } from '../helpers/theme';
77

8-
type SpaceProps = keyof DefaultTheme['spaces'] | Array<keyof DefaultTheme['spaces']>;
9-
108
type DefaultThemeOrCSSProp<T extends keyof DefaultTheme, K extends keyof CSSProperties> =
119
| keyof DefaultTheme[T]
1210
| CSSProperties[K];
@@ -25,7 +23,6 @@ export type BoxProps<TElement extends keyof JSX.IntrinsicElements = 'div'> = Rea
2523
| 'animation'
2624
| 'textAlign'
2725
| 'textTransform'
28-
| 'lineHeight'
2926
> & {
3027
/**
3128
* JavaScript hover handler
@@ -71,27 +68,27 @@ export type BoxProps<TElement extends keyof JSX.IntrinsicElements = 'div'> = Rea
7168
/**
7269
* Padding. Supports responsive values
7370
*/
74-
padding?: SpaceProps;
71+
padding?: ResponsiveValue;
7572
/**
7673
* Padding bottom. Supports responsive values
7774
*/
78-
paddingBottom?: SpaceProps;
75+
paddingBottom?: ResponsiveValue;
7976
/**
8077
* Padding left. Supports responsive values
8178
*/
82-
paddingLeft?: SpaceProps;
79+
paddingLeft?: ResponsiveValue;
8380
/**
8481
* Padding right. Supports responsive values
8582
*/
86-
paddingRight?: SpaceProps;
83+
paddingRight?: ResponsiveValue;
8784
/**
8885
* Padding top. Supports responsive values
8986
*/
90-
paddingTop?: SpaceProps;
91-
marginLeft?: SpaceProps;
92-
marginBottom?: SpaceProps;
93-
marginRight?: SpaceProps;
94-
marginTop?: SpaceProps;
87+
paddingTop?: ResponsiveValue;
88+
marginLeft?: ResponsiveValue;
89+
marginBottom?: ResponsiveValue;
90+
marginRight?: ResponsiveValue;
91+
marginTop?: ResponsiveValue;
9592
/**
9693
* Shadow name (see `theme.shadows`)
9794
*/
@@ -101,6 +98,7 @@ export type BoxProps<TElement extends keyof JSX.IntrinsicElements = 'div'> = Rea
10198
*/
10299
shrink?: CSSProperties['flexShrink'];
103100

101+
lineHeight?: DefaultThemeOrCSSProp<'lineHeights', 'lineHeight'>;
104102
width?: DefaultThemeOrCSSProp<'spaces', 'width'>;
105103
minWidth?: DefaultThemeOrCSSProp<'spaces', 'minWidth'>;
106104
maxWidth?: DefaultThemeOrCSSProp<'spaces', 'maxWidth'>;
@@ -215,7 +213,7 @@ export const Box = styled.div.withConfig<BoxProps>({
215213
// Text
216214
text-align: ${({ textAlign }) => textAlign};
217215
text-transform: ${({ textTransform }) => textTransform};
218-
line-height: ${({ lineHeight }) => lineHeight};
216+
line-height: ${({ theme, lineHeight }) => extractStyleFromTheme(theme.lineHeights, lineHeight, lineHeight)};
219217
220218
// Cursor
221219
cursor: ${({ cursor }) => cursor};

packages/strapi-design-system/src/Divider/Divider.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export interface DividerProps extends Omit<BoxProps<'hr'>, 'as' | 'background'>
77
* @preserve
88
* @deprecated use `margin` style props instead
99
*/
10-
unsetMargin: boolean;
10+
unsetMargin?: boolean;
1111
}
1212

1313
const DividerWrapper = styled(Box)<DividerProps>`

packages/strapi-design-system/src/Flex/Flex.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import styled, { CSSProperties, DefaultTheme } from 'styled-components';
1+
import styled, { CSSProperties } from 'styled-components';
22

33
import { Box, BoxProps } from '../Box';
4-
import handleResponsiveValues from '../helpers/handleResponsiveValues';
4+
import handleResponsiveValues, { ResponsiveValue } from '../helpers/handleResponsiveValues';
55

66
/**
77
* Prevents these attributes from being spread on the DOM node
@@ -16,7 +16,7 @@ export type FlexProps<TElement extends keyof JSX.IntrinsicElements = 'div'> = Bo
1616
/**
1717
* Supports responsive values
1818
*/
19-
gap?: keyof DefaultTheme['spaces'] | Array<keyof DefaultTheme['spaces']>;
19+
gap?: ResponsiveValue;
2020
inline?: boolean;
2121
justifyContent?: CSSProperties['justifyContent'];
2222
wrap?: CSSProperties['flexWrap'];

packages/strapi-design-system/src/Grid/Grid.js

-34
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import * as React from 'react';
2+
3+
import styled from 'styled-components';
4+
5+
import { Box, BoxProps } from '../Box';
6+
import handleResponsiveValues, { ResponsiveValue } from '../helpers/handleResponsiveValues';
7+
8+
export interface GridProps extends BoxProps {
9+
gridCols?: number;
10+
gap?: ResponsiveValue;
11+
}
12+
13+
const GridWrapper = styled(Box)<Required<Pick<GridProps, 'gridCols' | 'gap'>>>`
14+
display: grid;
15+
grid-template-columns: repeat(${({ gridCols }) => gridCols}, 1fr);
16+
${({ theme, gap }) => handleResponsiveValues('gap', gap, theme)}
17+
`;
18+
19+
export const Grid: React.FC<GridProps> = ({ gap = '0', gridCols = 12, ...props }) => {
20+
return <GridWrapper gap={gap} gridCols={gridCols} {...props} />;
21+
};

packages/strapi-design-system/src/Grid/GridContext.js

-5
This file was deleted.

packages/strapi-design-system/src/Grid/GridItem.js

-42
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import styled from 'styled-components';
2+
3+
import { Box, BoxProps } from '../Box';
4+
5+
export interface GridItemProps extends BoxProps {
6+
col: number;
7+
s?: number;
8+
xs?: number;
9+
}
10+
11+
export const GridItem = styled(Box)<GridItemProps>`
12+
grid-column: span ${({ col }) => col};
13+
max-width: 100%;
14+
15+
${({ theme }) => theme.mediaQueries.tablet} {
16+
grid-column: span ${({ s }) => s};
17+
}
18+
19+
${({ theme }) => theme.mediaQueries.mobile} {
20+
grid-column: span ${({ xs }) => xs};
21+
}
22+
`;

packages/strapi-design-system/src/Layout/ActionLayout.js

-42
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { Flex } from '../Flex';
2+
3+
interface ActionLayoutProps {
4+
endActions?: React.ReactNode;
5+
startActions?: React.ReactNode;
6+
}
7+
8+
export const ActionLayout = ({ startActions, endActions }: ActionLayoutProps) => {
9+
if (!startActions || !endActions) {
10+
return null;
11+
}
12+
13+
return (
14+
<Flex justifyContent="space-between" alignItems="flex-start" paddingBottom={4} paddingLeft={10} paddingRight={10}>
15+
<Flex gap={2} wrap="wrap">
16+
{startActions}
17+
</Flex>
18+
19+
<Flex gap={2} shrink={0} wrap="wrap">
20+
{endActions}
21+
</Flex>
22+
</Flex>
23+
);
24+
};

packages/strapi-design-system/src/Layout/ContentLayout.js

-17
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Box } from '../Box';
2+
3+
interface ContentLayoutProps {
4+
children: React.ReactNode;
5+
}
6+
7+
export const ContentLayout = ({ children }: ContentLayoutProps) => {
8+
return (
9+
<Box paddingLeft={10} paddingRight={10}>
10+
{children}
11+
</Box>
12+
);
13+
};
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
import PropTypes from 'prop-types';
21
import styled from 'styled-components';
32

43
export const GridLayout = styled.div`
54
display: grid;
65
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
76
grid-gap: ${({ theme }) => theme.spaces[4]};
87
`;
9-
10-
GridLayout.propTypes = {
11-
children: PropTypes.node.isRequired,
12-
};

0 commit comments

Comments
 (0)