diff --git a/.storybook/blocks/Grid/Row.tsx b/.storybook/blocks/Grid/Row.tsx index 99a6fc42c..be8ba237e 100644 --- a/.storybook/blocks/Grid/Row.tsx +++ b/.storybook/blocks/Grid/Row.tsx @@ -1,9 +1,4 @@ -import React, { - InputHTMLAttributes, - useCallback, - ChangeEvent, - ReactNode, -} from 'react'; +import React, { ReactNode } from 'react'; import cn from 'classnames'; import styles from './Row.module.css'; diff --git a/package-lock.json b/package-lock.json index 00ac8424c..76dbb546a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -54857,11 +54857,11 @@ }, "packages/accordion": { "name": "@heycar-uikit/accordion", - "version": "2.1.3", + "version": "2.1.6", "license": "UNLICENSED", "dependencies": { "@heycar-uikit/collapse": "^1.4.0", - "@heycar-uikit/icons": "^3.0.1", + "@heycar-uikit/icons": "^3.1.0", "classnames": "^2.3.1" }, "peerDependencies": { @@ -54881,7 +54881,7 @@ }, "packages/button": { "name": "@heycar-uikit/button", - "version": "2.0.1", + "version": "2.0.3", "license": "UNLICENSED", "dependencies": { "classnames": "^2.3.1" @@ -54892,10 +54892,10 @@ }, "packages/chip": { "name": "@heycar-uikit/chip", - "version": "0.4.6", + "version": "0.4.9", "license": "UNLICENSED", "dependencies": { - "@heycar-uikit/icons": "^3.0.1", + "@heycar-uikit/icons": "^3.1.0", "classnames": "^2.3.1" }, "peerDependencies": { @@ -54915,7 +54915,7 @@ }, "packages/dropdown": { "name": "@heycar-uikit/dropdown", - "version": "1.0.0", + "version": "1.0.2", "license": "UNLICENSED", "dependencies": { "classnames": "^2.3.1" @@ -54945,7 +54945,7 @@ }, "packages/grid": { "name": "@heycar-uikit/grid", - "version": "2.0.0", + "version": "2.0.2", "license": "UNLICENSED", "dependencies": { "classnames": "^2.3.1" @@ -54956,7 +54956,7 @@ }, "packages/icons": { "name": "@heycar-uikit/icons", - "version": "3.0.1", + "version": "3.1.0", "license": "UNLICENSED", "dependencies": { "classnames": "^2.3.1" @@ -54967,7 +54967,7 @@ }, "packages/input": { "name": "@heycar-uikit/input", - "version": "1.1.8", + "version": "1.1.9", "license": "UNLICENSED", "dependencies": { "@heycar-uikit/form-control": "^1.5.1", @@ -54987,7 +54987,7 @@ }, "packages/pill": { "name": "@heycar-uikit/pill", - "version": "1.1.1", + "version": "1.1.3", "license": "UNLICENSED", "peerDependencies": { "react": "^17.0.1" @@ -54995,7 +54995,7 @@ }, "packages/switch": { "name": "@heycar-uikit/switch", - "version": "2.2.2", + "version": "2.2.4", "license": "UNLICENSED", "dependencies": { "classnames": "^2.3.1" @@ -55023,7 +55023,7 @@ }, "packages/typography": { "name": "@heycar-uikit/typography", - "version": "2.0.1", + "version": "2.0.3", "license": "UNLICENSED", "dependencies": { "classnames": "^2.3.1" @@ -56532,7 +56532,7 @@ "version": "file:packages/accordion", "requires": { "@heycar-uikit/collapse": "^1.4.0", - "@heycar-uikit/icons": "^3.0.1", + "@heycar-uikit/icons": "^3.1.0", "classnames": "^2.3.1" } }, @@ -56551,7 +56551,7 @@ "@heycar-uikit/chip": { "version": "file:packages/chip", "requires": { - "@heycar-uikit/icons": "^3.0.1", + "@heycar-uikit/icons": "^3.1.0", "classnames": "^2.3.1" } }, diff --git a/packages/button/src/__tests__/__image_snapshots__/Button colors size=large sprite-2-snap.png b/packages/button/src/__tests__/__image_snapshots__/Button colors size=large sprite-2-snap.png index 89ff5c9e7..c9242f677 100644 Binary files a/packages/button/src/__tests__/__image_snapshots__/Button colors size=large sprite-2-snap.png and b/packages/button/src/__tests__/__image_snapshots__/Button colors size=large sprite-2-snap.png differ diff --git a/packages/button/src/__tests__/__image_snapshots__/Button colors size=large sprite-snap.png b/packages/button/src/__tests__/__image_snapshots__/Button colors size=large sprite-snap.png index 69c94a946..7376aa02e 100644 Binary files a/packages/button/src/__tests__/__image_snapshots__/Button colors size=large sprite-snap.png and b/packages/button/src/__tests__/__image_snapshots__/Button colors size=large sprite-snap.png differ diff --git a/packages/button/src/__tests__/__image_snapshots__/Button events tests Button click test-snap.png b/packages/button/src/__tests__/__image_snapshots__/Button events tests Button click test-snap.png index d1250e322..37da9f909 100644 Binary files a/packages/button/src/__tests__/__image_snapshots__/Button events tests Button click test-snap.png and b/packages/button/src/__tests__/__image_snapshots__/Button events tests Button click test-snap.png differ diff --git a/packages/button/src/__tests__/__image_snapshots__/Button events tests Button hover event-snap.png b/packages/button/src/__tests__/__image_snapshots__/Button events tests Button hover event-snap.png index dcea110d6..bf1666421 100644 Binary files a/packages/button/src/__tests__/__image_snapshots__/Button events tests Button hover event-snap.png and b/packages/button/src/__tests__/__image_snapshots__/Button events tests Button hover event-snap.png differ diff --git a/packages/button/src/__tests__/__image_snapshots__/Button sizes variant=outlined sprite-2-snap.png b/packages/button/src/__tests__/__image_snapshots__/Button sizes variant=outlined sprite-2-snap.png index 49f57ff2f..901c7c0ff 100644 Binary files a/packages/button/src/__tests__/__image_snapshots__/Button sizes variant=outlined sprite-2-snap.png and b/packages/button/src/__tests__/__image_snapshots__/Button sizes variant=outlined sprite-2-snap.png differ diff --git a/packages/button/src/__tests__/__image_snapshots__/Button sizes variant=outlined sprite-snap.png b/packages/button/src/__tests__/__image_snapshots__/Button sizes variant=outlined sprite-snap.png index c72ec76ff..68c471fe2 100644 Binary files a/packages/button/src/__tests__/__image_snapshots__/Button sizes variant=outlined sprite-snap.png and b/packages/button/src/__tests__/__image_snapshots__/Button sizes variant=outlined sprite-snap.png differ diff --git a/packages/button/src/__tests__/__image_snapshots__/Button variants size=large sprite-2-snap.png b/packages/button/src/__tests__/__image_snapshots__/Button variants size=large sprite-2-snap.png index 49f57ff2f..901c7c0ff 100644 Binary files a/packages/button/src/__tests__/__image_snapshots__/Button variants size=large sprite-2-snap.png and b/packages/button/src/__tests__/__image_snapshots__/Button variants size=large sprite-2-snap.png differ diff --git a/packages/button/src/__tests__/__image_snapshots__/Button variants size=large sprite-3-snap.png b/packages/button/src/__tests__/__image_snapshots__/Button variants size=large sprite-3-snap.png index 680b0c009..fc6e68f8d 100644 Binary files a/packages/button/src/__tests__/__image_snapshots__/Button variants size=large sprite-3-snap.png and b/packages/button/src/__tests__/__image_snapshots__/Button variants size=large sprite-3-snap.png differ diff --git a/packages/button/src/__tests__/__image_snapshots__/Button variants size=large sprite-snap.png b/packages/button/src/__tests__/__image_snapshots__/Button variants size=large sprite-snap.png index 69c94a946..7376aa02e 100644 Binary files a/packages/button/src/__tests__/__image_snapshots__/Button variants size=large sprite-snap.png and b/packages/button/src/__tests__/__image_snapshots__/Button variants size=large sprite-snap.png differ diff --git a/packages/button/src/__tests__/__image_snapshots__/Whatsapp button colors size=middle sprite-snap.png b/packages/button/src/__tests__/__image_snapshots__/Whatsapp button colors size=middle sprite-snap.png index 6f656f2ab..df06d5bb5 100644 Binary files a/packages/button/src/__tests__/__image_snapshots__/Whatsapp button colors size=middle sprite-snap.png and b/packages/button/src/__tests__/__image_snapshots__/Whatsapp button colors size=middle sprite-snap.png differ diff --git a/packages/chip/src/__tests__/__image_snapshots__/Chip Component sprite-2-snap.png b/packages/chip/src/__tests__/__image_snapshots__/Chip Component sprite-2-snap.png index 6983220f8..3debb5250 100644 Binary files a/packages/chip/src/__tests__/__image_snapshots__/Chip Component sprite-2-snap.png and b/packages/chip/src/__tests__/__image_snapshots__/Chip Component sprite-2-snap.png differ diff --git a/packages/chip/src/__tests__/__image_snapshots__/Chip Component sprite-snap.png b/packages/chip/src/__tests__/__image_snapshots__/Chip Component sprite-snap.png index d4f5d8625..7bb6e1ffc 100644 Binary files a/packages/chip/src/__tests__/__image_snapshots__/Chip Component sprite-snap.png and b/packages/chip/src/__tests__/__image_snapshots__/Chip Component sprite-snap.png differ diff --git a/packages/chip/src/__tests__/__image_snapshots__/Chip children sprite-2-snap.png b/packages/chip/src/__tests__/__image_snapshots__/Chip children sprite-2-snap.png index 85d247f7d..31b6e40fd 100644 Binary files a/packages/chip/src/__tests__/__image_snapshots__/Chip children sprite-2-snap.png and b/packages/chip/src/__tests__/__image_snapshots__/Chip children sprite-2-snap.png differ diff --git a/packages/chip/src/__tests__/__image_snapshots__/Chip children sprite-snap.png b/packages/chip/src/__tests__/__image_snapshots__/Chip children sprite-snap.png index 047f31281..56bfa3a3e 100644 Binary files a/packages/chip/src/__tests__/__image_snapshots__/Chip children sprite-snap.png and b/packages/chip/src/__tests__/__image_snapshots__/Chip children sprite-snap.png differ diff --git a/packages/chip/src/__tests__/__image_snapshots__/Chip data-test-id sprite-2-snap.png b/packages/chip/src/__tests__/__image_snapshots__/Chip data-test-id sprite-2-snap.png index 6983220f8..3debb5250 100644 Binary files a/packages/chip/src/__tests__/__image_snapshots__/Chip data-test-id sprite-2-snap.png and b/packages/chip/src/__tests__/__image_snapshots__/Chip data-test-id sprite-2-snap.png differ diff --git a/packages/chip/src/__tests__/__image_snapshots__/Chip data-test-id sprite-snap.png b/packages/chip/src/__tests__/__image_snapshots__/Chip data-test-id sprite-snap.png index d4f5d8625..7bb6e1ffc 100644 Binary files a/packages/chip/src/__tests__/__image_snapshots__/Chip data-test-id sprite-snap.png and b/packages/chip/src/__tests__/__image_snapshots__/Chip data-test-id sprite-snap.png differ diff --git a/packages/chip/src/__tests__/__image_snapshots__/Chip disabled sprite-2-snap.png b/packages/chip/src/__tests__/__image_snapshots__/Chip disabled sprite-2-snap.png index ef744de5f..565051137 100644 Binary files a/packages/chip/src/__tests__/__image_snapshots__/Chip disabled sprite-2-snap.png and b/packages/chip/src/__tests__/__image_snapshots__/Chip disabled sprite-2-snap.png differ diff --git a/packages/chip/src/__tests__/__image_snapshots__/Chip disabled sprite-snap.png b/packages/chip/src/__tests__/__image_snapshots__/Chip disabled sprite-snap.png index f17b40703..6f080b568 100644 Binary files a/packages/chip/src/__tests__/__image_snapshots__/Chip disabled sprite-snap.png and b/packages/chip/src/__tests__/__image_snapshots__/Chip disabled sprite-snap.png differ diff --git a/packages/chip/src/__tests__/__image_snapshots__/Chip leftIcon sprite-2-snap.png b/packages/chip/src/__tests__/__image_snapshots__/Chip leftIcon sprite-2-snap.png index 6983220f8..3debb5250 100644 Binary files a/packages/chip/src/__tests__/__image_snapshots__/Chip leftIcon sprite-2-snap.png and b/packages/chip/src/__tests__/__image_snapshots__/Chip leftIcon sprite-2-snap.png differ diff --git a/packages/chip/src/__tests__/__image_snapshots__/Chip leftIcon sprite-snap.png b/packages/chip/src/__tests__/__image_snapshots__/Chip leftIcon sprite-snap.png index d4f5d8625..7bb6e1ffc 100644 Binary files a/packages/chip/src/__tests__/__image_snapshots__/Chip leftIcon sprite-snap.png and b/packages/chip/src/__tests__/__image_snapshots__/Chip leftIcon sprite-snap.png differ diff --git a/packages/chip/src/__tests__/__image_snapshots__/Chip selected sprite-2-snap.png b/packages/chip/src/__tests__/__image_snapshots__/Chip selected sprite-2-snap.png index 226d20d0f..a879a47a2 100644 Binary files a/packages/chip/src/__tests__/__image_snapshots__/Chip selected sprite-2-snap.png and b/packages/chip/src/__tests__/__image_snapshots__/Chip selected sprite-2-snap.png differ diff --git a/packages/chip/src/__tests__/__image_snapshots__/Chip selected sprite-snap.png b/packages/chip/src/__tests__/__image_snapshots__/Chip selected sprite-snap.png index af488c305..83eda5800 100644 Binary files a/packages/chip/src/__tests__/__image_snapshots__/Chip selected sprite-snap.png and b/packages/chip/src/__tests__/__image_snapshots__/Chip selected sprite-snap.png differ diff --git a/packages/chip/src/__tests__/__image_snapshots__/Chip variants sprite-2-snap.png b/packages/chip/src/__tests__/__image_snapshots__/Chip variants sprite-2-snap.png index 6983220f8..3debb5250 100644 Binary files a/packages/chip/src/__tests__/__image_snapshots__/Chip variants sprite-2-snap.png and b/packages/chip/src/__tests__/__image_snapshots__/Chip variants sprite-2-snap.png differ diff --git a/packages/chip/src/__tests__/__image_snapshots__/Chip variants sprite-snap.png b/packages/chip/src/__tests__/__image_snapshots__/Chip variants sprite-snap.png index d4f5d8625..7bb6e1ffc 100644 Binary files a/packages/chip/src/__tests__/__image_snapshots__/Chip variants sprite-snap.png and b/packages/chip/src/__tests__/__image_snapshots__/Chip variants sprite-snap.png differ diff --git a/packages/dropdown/src/__tests__/__image_snapshots__/Dropdown tests Dropdown default test-snap.png b/packages/dropdown/src/__tests__/__image_snapshots__/Dropdown tests Dropdown default test-snap.png index f547a2e9a..886a95b94 100644 Binary files a/packages/dropdown/src/__tests__/__image_snapshots__/Dropdown tests Dropdown default test-snap.png and b/packages/dropdown/src/__tests__/__image_snapshots__/Dropdown tests Dropdown default test-snap.png differ diff --git a/packages/dropdown/src/__tests__/__image_snapshots__/Dropdown tests Dropdown disabled event-snap.png b/packages/dropdown/src/__tests__/__image_snapshots__/Dropdown tests Dropdown disabled event-snap.png index 0712fe82b..a673a1eea 100644 Binary files a/packages/dropdown/src/__tests__/__image_snapshots__/Dropdown tests Dropdown disabled event-snap.png and b/packages/dropdown/src/__tests__/__image_snapshots__/Dropdown tests Dropdown disabled event-snap.png differ diff --git a/packages/grid/src/Grid.tsx b/packages/grid/src/Grid.tsx index bc6d5dc94..5ee9c5947 100644 --- a/packages/grid/src/Grid.tsx +++ b/packages/grid/src/Grid.tsx @@ -1,19 +1,13 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import { FC } from 'react'; - import Col from './components/Col'; -import { ColProps } from './components/Col.types'; +import Container from './components/Container'; import Row from './components/Row'; -import { RowProps } from './components/Row.types'; -const Grid: { - Row: FC; - Col: FC; - displayName: string; -} = { +const Grid = { Row, Col, + Container, displayName: 'Grid', -}; +} as const; export default Grid; diff --git a/packages/grid/src/__tests__/Col.test.tsx b/packages/grid/src/__tests__/Col.test.tsx index cd3db3b1f..679311397 100644 --- a/packages/grid/src/__tests__/Col.test.tsx +++ b/packages/grid/src/__tests__/Col.test.tsx @@ -64,7 +64,7 @@ describe('Grid.Col', () => { it('should set tag correcly', () => { const dataTestId = 'test-id'; const { getByTestId } = render( - , + , ); expect(getByTestId(dataTestId).tagName).toBe('ARTICLE'); diff --git a/packages/grid/src/__tests__/Container.test.tsx b/packages/grid/src/__tests__/Container.test.tsx new file mode 100644 index 000000000..8835ed5fc --- /dev/null +++ b/packages/grid/src/__tests__/Container.test.tsx @@ -0,0 +1,22 @@ +import React from 'react'; +import { render } from '@testing-library/react'; + +import Container from '../components/Container'; + +describe('Grid.Container', () => { + describe('Snapshots tests', () => { + it('should match snapshot', () => { + const { container } = render(content); + + expect(container).toMatchSnapshot(); + }); + }); + + it('should set tag correctly', () => { + const { getByText } = render( + hey, + ); + + expect(getByText('hey').tagName).toBe('SECTION'); + }); +}); diff --git a/packages/grid/src/__tests__/Row.test.tsx b/packages/grid/src/__tests__/Row.test.tsx index 0e71bd291..15af6c4b5 100644 --- a/packages/grid/src/__tests__/Row.test.tsx +++ b/packages/grid/src/__tests__/Row.test.tsx @@ -64,7 +64,7 @@ describe('Grid.Row', () => { it('should set tag correcly', () => { const dataTestId = 'test-id'; const { getByTestId } = render( - , + , ); expect(getByTestId(dataTestId).tagName).toBe('SECTION'); diff --git a/packages/grid/src/__tests__/__snapshots__/Container.test.tsx.snap b/packages/grid/src/__tests__/__snapshots__/Container.test.tsx.snap new file mode 100644 index 000000000..f6c8a8747 --- /dev/null +++ b/packages/grid/src/__tests__/__snapshots__/Container.test.tsx.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Grid.Container Snapshots tests should match snapshot 1`] = ` +
+
+ content +
+
+`; diff --git a/packages/grid/src/components/Col.module.css b/packages/grid/src/components/Col.module.css index 70cf825c0..fd82e197c 100644 --- a/packages/grid/src/components/Col.module.css +++ b/packages/grid/src/components/Col.module.css @@ -3,36 +3,6 @@ :root { --grid-col-width: calc(100% / 12); margin: 0 auto; - - @media (--mobile) { - padding-right: var(--gap-l); - padding-left: var(--gap-l); - } - @media (--tablet) { - padding-right: var(--gap-xl); - padding-left: var(--gap-xl); - } - - @media (--tablet-l) { - padding-right: var(--gap-3xl); - padding-left: var(--gap-3xl); - } - - @media (--desktop) { - padding-right: var(--gap-3xl); - padding-left: var(--gap-3xl); - } - - @media (--desktop-m) { - padding-right: var(--gap-3xl); - padding-left: var(--gap-3xl); - } - - @media (--desktop-l) { - max-width: 1440px; - padding-right: var(--gap-9xl); - padding-left: var(--gap-9xl); - } } .component { diff --git a/packages/grid/src/components/Col.tsx b/packages/grid/src/components/Col.tsx index fea9fae7f..96e3b8c33 100644 --- a/packages/grid/src/components/Col.tsx +++ b/packages/grid/src/components/Col.tsx @@ -8,8 +8,8 @@ import { ColProps } from './Col.types'; import guttersStyles from '../styles/gutters.module.css'; import styles from './Col.module.css'; -function Col({ - Component = 'div', +function Col({ + component, className, align, order, @@ -17,7 +17,9 @@ function Col({ width, children, dataTestId, -}: ColProps) { +}: ColProps) { + const Component = component ?? 'div'; + const gridClassNames = useMemo( () => getGridClassNames({ order, offset, width }, styles), [order, offset, width], diff --git a/packages/grid/src/components/Col.types.ts b/packages/grid/src/components/Col.types.ts index 3344e7578..e7ae6c944 100644 --- a/packages/grid/src/components/Col.types.ts +++ b/packages/grid/src/components/Col.types.ts @@ -2,7 +2,7 @@ import React from 'react'; import { ResponsivePropertyType } from '../Grid.types'; -export type ColProps = { +type ColBaseProps = { /** * Additional class */ @@ -44,9 +44,10 @@ export type ColProps = { order?: ResponsivePropertyType; /** - * The html tag of the component + * The component used for the root node. Either a string to use a HTML element or a component + * @default "div" */ - Component?: keyof JSX.IntrinsicElements; + component?: E; /** * Content @@ -58,3 +59,6 @@ export type ColProps = { */ dataTestId?: string; }; + +export type ColProps = ColBaseProps & + Omit, keyof ColBaseProps>; diff --git a/packages/grid/src/components/Container.module.css b/packages/grid/src/components/Container.module.css new file mode 100644 index 000000000..2b5b8da47 --- /dev/null +++ b/packages/grid/src/components/Container.module.css @@ -0,0 +1,38 @@ +@import '../../../themes/src/default.css'; + +.container { + width: 100%; + margin: 0 auto; + display: flex; + flex-direction: column; + justify-content: center; + box-sizing: border-box; + padding-left: var(--gap-l); + padding-right: var(--gap-l); + + @media (--tablet) { + padding-right: var(--gap-xl); + padding-left: var(--gap-xl); + } + + @media (--tablet-l) { + padding-right: var(--gap-3xl); + padding-left: var(--gap-3xl); + } + + @media (--desktop) { + padding-right: var(--gap-3xl); + padding-left: var(--gap-3xl); + } + + @media (--desktop-m) { + padding-right: var(--gap-3xl); + padding-left: var(--gap-3xl); + } + + @media (--desktop-l) { + max-width: 1440px; + padding-right: var(--gap-9xl); + padding-left: var(--gap-9xl); + } +} diff --git a/packages/grid/src/components/Container.tsx b/packages/grid/src/components/Container.tsx new file mode 100644 index 000000000..d5e9b5d18 --- /dev/null +++ b/packages/grid/src/components/Container.tsx @@ -0,0 +1,26 @@ +import React from 'react'; +import cn from 'classnames'; + +import { ContainerProps } from './Container.types'; + +import styles from './Container.module.css'; + +function Container({ + className, + children, + component, + ...rest +}: ContainerProps) { + const Component = component ?? 'div'; + + return React.createElement( + Component, + { + className: cn(styles.container, className), + ...rest, + }, + children, + ); +} + +export default Container; diff --git a/packages/grid/src/components/Container.types.ts b/packages/grid/src/components/Container.types.ts new file mode 100644 index 000000000..706096796 --- /dev/null +++ b/packages/grid/src/components/Container.types.ts @@ -0,0 +1,13 @@ +import React from 'react'; + +type ContainerBaseProps = { + /** + * The component used for the root node. Either a string to use a HTML element or a component + * @default "div" + */ + component?: E; +}; + +export type ContainerProps = + ContainerBaseProps & + Omit, keyof ContainerBaseProps>; diff --git a/packages/grid/src/components/Row.tsx b/packages/grid/src/components/Row.tsx index 0e024427e..2fb288a2a 100644 --- a/packages/grid/src/components/Row.tsx +++ b/packages/grid/src/components/Row.tsx @@ -8,8 +8,8 @@ import { RowProps } from './Row.types'; import guttersStyles from '../styles/gutters.module.css'; import styles from './Row.module.css'; -function Row({ - Component = 'div', +function Row({ + component, className, gutter = { mobile: 8, @@ -24,11 +24,14 @@ function Row({ justify = 'between', children, dataTestId, -}: RowProps) { +}: RowProps) { + const Component = component ?? 'div'; + const gridClassNames = useMemo( () => getGridClassNames({ gutter }, guttersStyles), [gutter], ); + const classNames = cn( guttersStyles.row, styles.component, diff --git a/packages/grid/src/components/Row.types.ts b/packages/grid/src/components/Row.types.ts index 5429ff3ae..a31b6a4ac 100644 --- a/packages/grid/src/components/Row.types.ts +++ b/packages/grid/src/components/Row.types.ts @@ -2,7 +2,7 @@ import React from 'react'; import { ResponsivePropertyType } from '../Grid.types'; -export interface RowProps { +type RowBaseProps = { /** * Additional class */ @@ -29,9 +29,10 @@ export interface RowProps { justify?: 'left' | 'center' | 'right' | 'around' | 'between'; /** - * HTML component tag + * The component used for the root node. Either a string to use a HTML element or a component + * @default "div" */ - Component?: keyof JSX.IntrinsicElements; + component?: E; /** * Content @@ -42,4 +43,7 @@ export interface RowProps { * Identifier for automated testing systems */ dataTestId?: string; -} +}; + +export type RowProps = RowBaseProps & + Omit, keyof RowBaseProps>; diff --git a/packages/grid/src/docs/Component.stories.mdx b/packages/grid/src/docs/Component.stories.mdx index b05099c6f..30712a630 100644 --- a/packages/grid/src/docs/Component.stories.mdx +++ b/packages/grid/src/docs/Component.stories.mdx @@ -21,7 +21,7 @@ import Description from './Description.mdx'; marginTop: 10, }; return ( -
+
@@ -64,7 +64,7 @@ import Description from './Description.mdx'; ))} -
+
); })} @@ -94,6 +94,7 @@ import Grid from '@heycar-uikit/grid'; components={{ Row: Grid.Row, Col: Grid.Col, + Container: Grid.Container, }} /> ), diff --git a/packages/grid/src/docs/Description.mdx b/packages/grid/src/docs/Description.mdx index 6dcfb008b..07869ffce 100644 --- a/packages/grid/src/docs/Description.mdx +++ b/packages/grid/src/docs/Description.mdx @@ -347,3 +347,38 @@ render(() => { ); }); ``` + +## Grid.Container + +The container component is used to contain the page content. Grid.Row can be used inside of container component. + +```tsx live +render(() => { + const style = { + height: 30, + lineHeight: '30px', + color: '#fff', + background: '#7394c8', + textAlign: 'center', + marginTop: 10, + }; + return ( + + + +
+ 12 +
+
+
+ + {[1, 2].map(key => ( + +
6
+
+ ))} +
+
+ ); +}); +``` diff --git a/packages/icons/src/__tests__/__image_snapshots__/Icon colors icon-2-snap.png b/packages/icons/src/__tests__/__image_snapshots__/Icon colors icon-2-snap.png index ae617beee..37dcc73d4 100644 Binary files a/packages/icons/src/__tests__/__image_snapshots__/Icon colors icon-2-snap.png and b/packages/icons/src/__tests__/__image_snapshots__/Icon colors icon-2-snap.png differ diff --git a/packages/icons/src/__tests__/__image_snapshots__/Icon colors icon-3-snap.png b/packages/icons/src/__tests__/__image_snapshots__/Icon colors icon-3-snap.png index 04aebab2e..ed981c64a 100644 Binary files a/packages/icons/src/__tests__/__image_snapshots__/Icon colors icon-3-snap.png and b/packages/icons/src/__tests__/__image_snapshots__/Icon colors icon-3-snap.png differ diff --git a/packages/icons/src/__tests__/__image_snapshots__/Icon colors icon-snap.png b/packages/icons/src/__tests__/__image_snapshots__/Icon colors icon-snap.png index 7d54e5435..3262eea82 100644 Binary files a/packages/icons/src/__tests__/__image_snapshots__/Icon colors icon-snap.png and b/packages/icons/src/__tests__/__image_snapshots__/Icon colors icon-snap.png differ diff --git a/packages/pill/src/__tests__/__image_snapshots__/Pill sprite-snap.png b/packages/pill/src/__tests__/__image_snapshots__/Pill sprite-snap.png index b08a694ca..66874ca46 100644 Binary files a/packages/pill/src/__tests__/__image_snapshots__/Pill sprite-snap.png and b/packages/pill/src/__tests__/__image_snapshots__/Pill sprite-snap.png differ diff --git a/packages/pill/src/__tests__/__image_snapshots__/Pill with component prop as span sprite-snap.png b/packages/pill/src/__tests__/__image_snapshots__/Pill with component prop as span sprite-snap.png index b08a694ca..66874ca46 100644 Binary files a/packages/pill/src/__tests__/__image_snapshots__/Pill with component prop as span sprite-snap.png and b/packages/pill/src/__tests__/__image_snapshots__/Pill with component prop as span sprite-snap.png differ diff --git a/packages/pill/src/__tests__/__image_snapshots__/Pill with icon sprite-snap.png b/packages/pill/src/__tests__/__image_snapshots__/Pill with icon sprite-snap.png index b08a694ca..66874ca46 100644 Binary files a/packages/pill/src/__tests__/__image_snapshots__/Pill with icon sprite-snap.png and b/packages/pill/src/__tests__/__image_snapshots__/Pill with icon sprite-snap.png differ diff --git a/packages/switch/src/__tests__/__image_snapshots__/Switch checked and disabled sprite-snap.png b/packages/switch/src/__tests__/__image_snapshots__/Switch checked and disabled sprite-snap.png index 0178ec545..35716d55f 100644 Binary files a/packages/switch/src/__tests__/__image_snapshots__/Switch checked and disabled sprite-snap.png and b/packages/switch/src/__tests__/__image_snapshots__/Switch checked and disabled sprite-snap.png differ diff --git a/packages/switch/src/__tests__/__image_snapshots__/Switch checked sprite-snap.png b/packages/switch/src/__tests__/__image_snapshots__/Switch checked sprite-snap.png index efd6cb298..593f8cece 100644 Binary files a/packages/switch/src/__tests__/__image_snapshots__/Switch checked sprite-snap.png and b/packages/switch/src/__tests__/__image_snapshots__/Switch checked sprite-snap.png differ diff --git a/packages/switch/src/__tests__/__image_snapshots__/Switch events tests click when checked-snap.png b/packages/switch/src/__tests__/__image_snapshots__/Switch events tests click when checked-snap.png index efd6cb298..593f8cece 100644 Binary files a/packages/switch/src/__tests__/__image_snapshots__/Switch events tests click when checked-snap.png and b/packages/switch/src/__tests__/__image_snapshots__/Switch events tests click when checked-snap.png differ diff --git a/packages/switch/src/__tests__/__image_snapshots__/Switch events tests click when unchecked and disabled-snap.png b/packages/switch/src/__tests__/__image_snapshots__/Switch events tests click when unchecked and disabled-snap.png index 73adeaec3..e282ba247 100644 Binary files a/packages/switch/src/__tests__/__image_snapshots__/Switch events tests click when unchecked and disabled-snap.png and b/packages/switch/src/__tests__/__image_snapshots__/Switch events tests click when unchecked and disabled-snap.png differ diff --git a/packages/switch/src/__tests__/__image_snapshots__/Switch events tests click when unchecked-snap.png b/packages/switch/src/__tests__/__image_snapshots__/Switch events tests click when unchecked-snap.png index 3e1c4cbf1..88f73cf14 100644 Binary files a/packages/switch/src/__tests__/__image_snapshots__/Switch events tests click when unchecked-snap.png and b/packages/switch/src/__tests__/__image_snapshots__/Switch events tests click when unchecked-snap.png differ diff --git a/packages/switch/src/__tests__/__image_snapshots__/Switch events tests hover when checked-snap.png b/packages/switch/src/__tests__/__image_snapshots__/Switch events tests hover when checked-snap.png index efd6cb298..593f8cece 100644 Binary files a/packages/switch/src/__tests__/__image_snapshots__/Switch events tests hover when checked-snap.png and b/packages/switch/src/__tests__/__image_snapshots__/Switch events tests hover when checked-snap.png differ diff --git a/packages/switch/src/__tests__/__image_snapshots__/Switch events tests hover when unchecked and disabled-snap.png b/packages/switch/src/__tests__/__image_snapshots__/Switch events tests hover when unchecked and disabled-snap.png index 73adeaec3..e282ba247 100644 Binary files a/packages/switch/src/__tests__/__image_snapshots__/Switch events tests hover when unchecked and disabled-snap.png and b/packages/switch/src/__tests__/__image_snapshots__/Switch events tests hover when unchecked and disabled-snap.png differ diff --git a/packages/switch/src/__tests__/__image_snapshots__/Switch events tests hover when unchecked-snap.png b/packages/switch/src/__tests__/__image_snapshots__/Switch events tests hover when unchecked-snap.png index 632b357f6..b505dab01 100644 Binary files a/packages/switch/src/__tests__/__image_snapshots__/Switch events tests hover when unchecked-snap.png and b/packages/switch/src/__tests__/__image_snapshots__/Switch events tests hover when unchecked-snap.png differ diff --git a/packages/switch/src/__tests__/__image_snapshots__/Switch unchecked and disabled sprite-snap.png b/packages/switch/src/__tests__/__image_snapshots__/Switch unchecked and disabled sprite-snap.png index 73adeaec3..e282ba247 100644 Binary files a/packages/switch/src/__tests__/__image_snapshots__/Switch unchecked and disabled sprite-snap.png and b/packages/switch/src/__tests__/__image_snapshots__/Switch unchecked and disabled sprite-snap.png differ diff --git a/packages/switch/src/__tests__/__image_snapshots__/Switch unchecked sprite-snap.png b/packages/switch/src/__tests__/__image_snapshots__/Switch unchecked sprite-snap.png index 47680d191..662b0f30b 100644 Binary files a/packages/switch/src/__tests__/__image_snapshots__/Switch unchecked sprite-snap.png and b/packages/switch/src/__tests__/__image_snapshots__/Switch unchecked sprite-snap.png differ diff --git a/packages/typography/src/__tests__/__image_snapshots__/Typography variant body1-snap.png b/packages/typography/src/__tests__/__image_snapshots__/Typography variant body1-snap.png index e39a0a8f2..671daee35 100644 Binary files a/packages/typography/src/__tests__/__image_snapshots__/Typography variant body1-snap.png and b/packages/typography/src/__tests__/__image_snapshots__/Typography variant body1-snap.png differ diff --git a/packages/typography/src/__tests__/__image_snapshots__/Typography variant body2-snap.png b/packages/typography/src/__tests__/__image_snapshots__/Typography variant body2-snap.png index 8f350eec6..ce5e14d5d 100644 Binary files a/packages/typography/src/__tests__/__image_snapshots__/Typography variant body2-snap.png and b/packages/typography/src/__tests__/__image_snapshots__/Typography variant body2-snap.png differ diff --git a/packages/typography/src/__tests__/__image_snapshots__/Typography variant body3-snap.png b/packages/typography/src/__tests__/__image_snapshots__/Typography variant body3-snap.png index 204c445b4..0b1db3c60 100644 Binary files a/packages/typography/src/__tests__/__image_snapshots__/Typography variant body3-snap.png and b/packages/typography/src/__tests__/__image_snapshots__/Typography variant body3-snap.png differ diff --git a/packages/typography/src/__tests__/__image_snapshots__/Typography variant body4-snap.png b/packages/typography/src/__tests__/__image_snapshots__/Typography variant body4-snap.png index 954f3c9c0..3f1b6b368 100644 Binary files a/packages/typography/src/__tests__/__image_snapshots__/Typography variant body4-snap.png and b/packages/typography/src/__tests__/__image_snapshots__/Typography variant body4-snap.png differ diff --git a/packages/typography/src/__tests__/__image_snapshots__/Typography variant caption1-snap.png b/packages/typography/src/__tests__/__image_snapshots__/Typography variant caption1-snap.png index c818eabcf..706c75851 100644 Binary files a/packages/typography/src/__tests__/__image_snapshots__/Typography variant caption1-snap.png and b/packages/typography/src/__tests__/__image_snapshots__/Typography variant caption1-snap.png differ diff --git a/packages/typography/src/__tests__/__image_snapshots__/Typography variant caption2-snap.png b/packages/typography/src/__tests__/__image_snapshots__/Typography variant caption2-snap.png index 2d732585a..c3bb0210d 100644 Binary files a/packages/typography/src/__tests__/__image_snapshots__/Typography variant caption2-snap.png and b/packages/typography/src/__tests__/__image_snapshots__/Typography variant caption2-snap.png differ diff --git a/packages/typography/src/__tests__/__image_snapshots__/Typography variant caption3-snap.png b/packages/typography/src/__tests__/__image_snapshots__/Typography variant caption3-snap.png index 68bcc614d..b50597f0e 100644 Binary files a/packages/typography/src/__tests__/__image_snapshots__/Typography variant caption3-snap.png and b/packages/typography/src/__tests__/__image_snapshots__/Typography variant caption3-snap.png differ diff --git a/packages/typography/src/__tests__/__image_snapshots__/Typography variant caption4-snap.png b/packages/typography/src/__tests__/__image_snapshots__/Typography variant caption4-snap.png index bcef72f1d..b30edb38a 100644 Binary files a/packages/typography/src/__tests__/__image_snapshots__/Typography variant caption4-snap.png and b/packages/typography/src/__tests__/__image_snapshots__/Typography variant caption4-snap.png differ diff --git a/packages/typography/src/__tests__/__image_snapshots__/Typography variant caption5-snap.png b/packages/typography/src/__tests__/__image_snapshots__/Typography variant caption5-snap.png index e793d7fd8..d2ed47abd 100644 Binary files a/packages/typography/src/__tests__/__image_snapshots__/Typography variant caption5-snap.png and b/packages/typography/src/__tests__/__image_snapshots__/Typography variant caption5-snap.png differ diff --git a/packages/typography/src/__tests__/__image_snapshots__/Typography variant display1-snap.png b/packages/typography/src/__tests__/__image_snapshots__/Typography variant display1-snap.png index 5f9599739..18a3d5eef 100644 Binary files a/packages/typography/src/__tests__/__image_snapshots__/Typography variant display1-snap.png and b/packages/typography/src/__tests__/__image_snapshots__/Typography variant display1-snap.png differ diff --git a/packages/typography/src/__tests__/__image_snapshots__/Typography variant h1-snap.png b/packages/typography/src/__tests__/__image_snapshots__/Typography variant h1-snap.png index 494e0405e..bc5083895 100644 Binary files a/packages/typography/src/__tests__/__image_snapshots__/Typography variant h1-snap.png and b/packages/typography/src/__tests__/__image_snapshots__/Typography variant h1-snap.png differ diff --git a/packages/typography/src/__tests__/__image_snapshots__/Typography variant h2-snap.png b/packages/typography/src/__tests__/__image_snapshots__/Typography variant h2-snap.png index 2251a8b13..e637f3f7e 100644 Binary files a/packages/typography/src/__tests__/__image_snapshots__/Typography variant h2-snap.png and b/packages/typography/src/__tests__/__image_snapshots__/Typography variant h2-snap.png differ diff --git a/packages/typography/src/__tests__/__image_snapshots__/Typography variant h3-snap.png b/packages/typography/src/__tests__/__image_snapshots__/Typography variant h3-snap.png index 14777310d..9e3cef796 100644 Binary files a/packages/typography/src/__tests__/__image_snapshots__/Typography variant h3-snap.png and b/packages/typography/src/__tests__/__image_snapshots__/Typography variant h3-snap.png differ diff --git a/packages/typography/src/__tests__/__image_snapshots__/Typography variant h4-snap.png b/packages/typography/src/__tests__/__image_snapshots__/Typography variant h4-snap.png index 6c851b79c..efe08c690 100644 Binary files a/packages/typography/src/__tests__/__image_snapshots__/Typography variant h4-snap.png and b/packages/typography/src/__tests__/__image_snapshots__/Typography variant h4-snap.png differ diff --git a/packages/typography/src/__tests__/__image_snapshots__/Typography variant h5-snap.png b/packages/typography/src/__tests__/__image_snapshots__/Typography variant h5-snap.png index c0973f971..ce22225d5 100644 Binary files a/packages/typography/src/__tests__/__image_snapshots__/Typography variant h5-snap.png and b/packages/typography/src/__tests__/__image_snapshots__/Typography variant h5-snap.png differ diff --git a/packages/typography/src/__tests__/__image_snapshots__/Typography variant h6-snap.png b/packages/typography/src/__tests__/__image_snapshots__/Typography variant h6-snap.png index 36f6d4983..b930117f3 100644 Binary files a/packages/typography/src/__tests__/__image_snapshots__/Typography variant h6-snap.png and b/packages/typography/src/__tests__/__image_snapshots__/Typography variant h6-snap.png differ diff --git a/packages/typography/src/__tests__/__image_snapshots__/Typography variant overline1-snap.png b/packages/typography/src/__tests__/__image_snapshots__/Typography variant overline1-snap.png index 91150f796..340bf1dda 100644 Binary files a/packages/typography/src/__tests__/__image_snapshots__/Typography variant overline1-snap.png and b/packages/typography/src/__tests__/__image_snapshots__/Typography variant overline1-snap.png differ diff --git a/packages/typography/src/__tests__/__image_snapshots__/Typography variant overline2-snap.png b/packages/typography/src/__tests__/__image_snapshots__/Typography variant overline2-snap.png index 2a8bb7833..395a85d01 100644 Binary files a/packages/typography/src/__tests__/__image_snapshots__/Typography variant overline2-snap.png and b/packages/typography/src/__tests__/__image_snapshots__/Typography variant overline2-snap.png differ diff --git a/packages/typography/src/__tests__/__image_snapshots__/Typography variant subheading1-snap.png b/packages/typography/src/__tests__/__image_snapshots__/Typography variant subheading1-snap.png index 4d1e6304d..9cf958281 100644 Binary files a/packages/typography/src/__tests__/__image_snapshots__/Typography variant subheading1-snap.png and b/packages/typography/src/__tests__/__image_snapshots__/Typography variant subheading1-snap.png differ diff --git a/packages/typography/src/__tests__/__image_snapshots__/Typography variant subheading2-snap.png b/packages/typography/src/__tests__/__image_snapshots__/Typography variant subheading2-snap.png index d636798c4..b7d96773b 100644 Binary files a/packages/typography/src/__tests__/__image_snapshots__/Typography variant subheading2-snap.png and b/packages/typography/src/__tests__/__image_snapshots__/Typography variant subheading2-snap.png differ diff --git a/packages/typography/src/__tests__/__image_snapshots__/Typography variant subheading3-snap.png b/packages/typography/src/__tests__/__image_snapshots__/Typography variant subheading3-snap.png index 1b880c4ec..f72878e86 100644 Binary files a/packages/typography/src/__tests__/__image_snapshots__/Typography variant subheading3-snap.png and b/packages/typography/src/__tests__/__image_snapshots__/Typography variant subheading3-snap.png differ diff --git a/packages/typography/src/__tests__/__image_snapshots__/Typography variant subheading4-snap.png b/packages/typography/src/__tests__/__image_snapshots__/Typography variant subheading4-snap.png index c25fa0c3b..137879427 100644 Binary files a/packages/typography/src/__tests__/__image_snapshots__/Typography variant subheading4-snap.png and b/packages/typography/src/__tests__/__image_snapshots__/Typography variant subheading4-snap.png differ