Skip to content

Commit

Permalink
Merge pull request #89 from lidofinance/fix/types
Browse files Browse the repository at this point in the history
Fix types
  • Loading branch information
kolyasapphire authored May 18, 2021
2 parents dd47e9b + 7628fef commit 0a447a2
Show file tree
Hide file tree
Showing 49 changed files with 274 additions and 112 deletions.
1 change: 1 addition & 0 deletions packages/accordion/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"dependencies": {
"@lidofinance/icons": "workspace:*",
"@lidofinance/theme": "workspace:*",
"@lidofinance/utils": "workspace:*",
"react-collapsed": "3.0.2"
},
"peerDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/accordion/src/Accordion.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Story } from '@storybook/react'
import { Story, Meta } from '@storybook/react'
import { AccordionProps } from './types'
import Accordion from './Accordion'

export default {
component: Accordion,
title: 'Layout/Accordion',
}
} as Meta

export const Basic: Story<AccordionProps> = (props) => (
<Accordion {...props}>
Expand Down
12 changes: 8 additions & 4 deletions packages/accordion/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { LidoComponentProps } from '@lidofinance/utils'
export type { Theme } from '@lidofinance/theme'

export type AccordionProps = {
defaultExpanded?: boolean
summary: React.ReactNode
} & Omit<JSX.IntrinsicElements['div'], 'ref'>
export type AccordionProps = LidoComponentProps<
'div',
{
defaultExpanded?: boolean
summary: React.ReactNode
}
>
3 changes: 2 additions & 1 deletion packages/block/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
"dependencies": {
"@lidofinance/theme": "workspace:*"
"@lidofinance/theme": "workspace:*",
"@lidofinance/utils": "workspace:*"
},
"peerDependencies": {
"react": "17.0.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/block/src/Block.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Story } from '@storybook/react'
import { Story, Meta } from '@storybook/react'
import { BlockProps, BlockColor, BlockVariant } from './types'
import Block from './Block'

Expand All @@ -23,6 +23,6 @@ export default {
control: 'inline-radio',
},
},
}
} as Meta

export const Basic: Story<BlockProps> = (props) => <Block {...props} />
12 changes: 8 additions & 4 deletions packages/block/src/types.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { LidoComponentProps } from '@lidofinance/utils'
export type { Theme } from '@lidofinance/theme'

export enum BlockVariant {
Expand All @@ -12,7 +13,10 @@ export enum BlockColor {
}
export type BlockColors = keyof typeof BlockColor

export type BlockProps = {
color?: BlockColors
variant?: BlockVariants
} & Omit<JSX.IntrinsicElements['div'], 'ref'>
export type BlockProps = LidoComponentProps<
'div',
{
color?: BlockColors
variant?: BlockVariants
}
>
3 changes: 2 additions & 1 deletion packages/button/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"types": "dist/esm/index.d.ts",
"dependencies": {
"@lidofinance/loaders": "workspace:*",
"@lidofinance/theme": "workspace:*"
"@lidofinance/theme": "workspace:*",
"@lidofinance/utils": "workspace:*"
},
"peerDependencies": {
"react": "17.0.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/button/src/Button.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Story } from '@storybook/react'
import { Story, Meta } from '@storybook/react'
import { Whitepaper } from '@lidofinance/icons'
import {
ButtonProps,
Expand Down Expand Up @@ -39,7 +39,7 @@ export default {
control: 'inline-radio',
},
},
}
} as Meta

export const Basic: Story<ButtonProps> = (props) => <Button {...props} />

Expand Down
21 changes: 13 additions & 8 deletions packages/button/src/types.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { LidoComponentProps } from '@lidofinance/utils'
export type { Theme } from '@lidofinance/theme'

export enum ButtonSize {
Expand All @@ -22,14 +23,18 @@ export enum ButtonColor {
}
export type ButtonColors = keyof typeof ButtonColor

export type ButtonProps = {
size?: ButtonSizes
variant?: ButtonVariants
color?: ButtonColors
fullwidth?: boolean
square?: boolean
loading?: boolean
} & Omit<JSX.IntrinsicElements['button'], 'ref' | 'color'>
export type ButtonProps = LidoComponentProps<
'button',
{
size?: ButtonSizes
variant?: ButtonVariants
color?: ButtonColors
fullwidth?: boolean
square?: boolean
loading?: boolean
as?: never
}
>

export type ButtonIconProps = {
icon: React.ReactNode
Expand Down
3 changes: 2 additions & 1 deletion packages/checkbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"types": "dist/esm/index.d.ts",
"dependencies": {
"@lidofinance/icons": "workspace:*",
"@lidofinance/theme": "workspace:*"
"@lidofinance/theme": "workspace:*",
"@lidofinance/utils": "workspace:*"
},
"peerDependencies": {
"react": "17.0.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/checkbox/src/Checkbox.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Story } from '@storybook/react'
import { Story, Meta } from '@storybook/react'
import { CheckboxProps } from './types'
import Checkbox from './Checkbox'

Expand All @@ -14,7 +14,7 @@ export default {
table: { disable: true },
},
},
}
} as Meta

export const Uncontrolled: Story<CheckboxProps> = (props) => (
<Checkbox {...props} />
Expand Down
11 changes: 8 additions & 3 deletions packages/checkbox/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { LidoComponentProps } from '@lidofinance/utils'
export type { Theme } from '@lidofinance/theme'

export type CheckboxProps = {
wrapperRef?: React.RefObject<HTMLLabelElement>
} & Omit<JSX.IntrinsicElements['input'], 'ref'>
export type CheckboxProps = LidoComponentProps<
'input',
{
wrapperRef?: React.RefObject<HTMLLabelElement>
children?: never
}
>
3 changes: 2 additions & 1 deletion packages/container/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
"dependencies": {
"@lidofinance/theme": "workspace:*"
"@lidofinance/theme": "workspace:*",
"@lidofinance/utils": "workspace:*"
},
"peerDependencies": {
"react": "17.0.2",
Expand Down
6 changes: 3 additions & 3 deletions packages/container/src/Container.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ Base.argTypes = {

export const PageLayout: Story = () => (
<>
<Container size='full'>
<Container as='header' size='full'>
<StyledDiv>Header</StyledDiv>
</Container>
<Container size='content'>
<Container as='main' size='content'>
<StyledDiv
style={{
margin: '20px 0',
Expand All @@ -55,7 +55,7 @@ export const PageLayout: Story = () => (
Content
</StyledDiv>
</Container>
<Container size='full'>
<Container as='footer' size='full'>
<StyledDiv>Footer</StyledDiv>
</Container>
</>
Expand Down
10 changes: 7 additions & 3 deletions packages/container/src/types.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { LidoComponentProps } from '@lidofinance/utils'
export type { Theme } from '@lidofinance/theme'

export enum ContainerSize {
Expand All @@ -6,6 +7,9 @@ export enum ContainerSize {
}
export type ContainerSizes = keyof typeof ContainerSize

export type ContainerProps = {
size?: ContainerSizes
} & Omit<JSX.IntrinsicElements['div'], 'ref'>
export type ContainerProps = LidoComponentProps<
'div',
{
size?: ContainerSizes
}
>
3 changes: 2 additions & 1 deletion packages/divider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
"dependencies": {
"@lidofinance/theme": "workspace:*"
"@lidofinance/theme": "workspace:*",
"@lidofinance/utils": "workspace:*"
},
"peerDependencies": {
"react": "17.0.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/divider/src/Divider.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Story } from '@storybook/react'
import { Story, Meta } from '@storybook/react'
import { DividerIndent, DividerProps, DividerType, DividerTypes } from './types'
import Divider from './Divider'
import styled from 'styled-components'
Expand All @@ -23,7 +23,7 @@ export default {
control: 'inline-radio',
},
},
}
} as Meta

const Wrapper = styled.div<{ $type?: DividerTypes }>`
color: ${({ theme }) => theme.colors.text};
Expand Down
13 changes: 9 additions & 4 deletions packages/divider/src/types.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { LidoComponentProps } from '@lidofinance/utils'
export type { Theme } from '@lidofinance/theme'

export enum DividerType {
Expand All @@ -15,7 +16,11 @@ export enum DividerIndent {
}
export type DividerIndents = keyof typeof DividerIndent

export type DividerProps = {
type?: DividerTypes
indents?: DividerIndents
} & Omit<JSX.IntrinsicElements['div'], 'ref'>
export type DividerProps = LidoComponentProps<
'div',
{
type?: DividerTypes
indents?: DividerIndents
children?: never
}
>
3 changes: 2 additions & 1 deletion packages/heading/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
"dependencies": {
"@lidofinance/theme": "workspace:*"
"@lidofinance/theme": "workspace:*",
"@lidofinance/utils": "workspace:*"
},
"peerDependencies": {
"react": "17.0.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/heading/src/Heading.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Story } from '@storybook/react'
import { Story, Meta } from '@storybook/react'
import Heading, { H1, H2, H3 } from './Heading'
import { HeadingProps, HeadingColor, HeadingSize, HProps } from './types'

Expand All @@ -21,7 +21,7 @@ export default {
control: 'inline-radio',
},
},
}
} as Meta

export const Basic: Story<HeadingProps> = (props) => <Heading {...props} />

Expand Down
23 changes: 16 additions & 7 deletions packages/heading/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { LidoComponentProps } from '@lidofinance/utils'

export enum HeadingColor {
text,
secondary,
Expand All @@ -11,11 +13,18 @@ export enum HeadingSize {
}
export type HeadingSizes = keyof typeof HeadingSize

export type HeadingProps = {
color?: HeadingColors
size?: HeadingSizes
} & Omit<JSX.IntrinsicElements['div'], 'ref'>
export type HeadingProps = LidoComponentProps<
'div',
{
color?: HeadingColors
size?: HeadingSizes
}
>

export type HProps<T extends 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'> = {
color?: HeadingColor
} & Omit<JSX.IntrinsicElements[T], 'ref'>
export type HProps<T extends 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'> =
LidoComponentProps<
T,
{
color?: HeadingColors
}
>
4 changes: 2 additions & 2 deletions packages/icons/src/Icon.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Story } from '@storybook/react'
import { Story, Meta } from '@storybook/react'
import { Theme } from '@lidofinance/theme'
import styled, { useTheme } from 'styled-components'
import * as components from './index'
Expand All @@ -8,7 +8,7 @@ const iconKeys = Object.keys(components) as IconVariants[]

export default {
title: 'Images/Icons',
}
} as Meta

export const Base: Story<{ color: string; type: IconVariants }> = (props) => {
const theme: Theme = useTheme()
Expand Down
1 change: 1 addition & 0 deletions packages/identicon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"types": "dist/esm/index.d.ts",
"dependencies": {
"@lidofinance/theme": "workspace:*",
"@lidofinance/utils": "workspace:*",
"react-jazzicon": "0.1.3"
},
"peerDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/identicon/src/Identicon.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Story } from '@storybook/react'
import { Story, Meta } from '@storybook/react'
import { IdenticonProps, IdenticonBadgeProps } from './types'
import Identicon from './Identicon'
import IdenticonBadge from './IdenticonBadge'
Expand All @@ -16,7 +16,7 @@ export default {
control: { type: 'range', min: 4, max: 64, step: 4 },
},
},
}
} as Meta

export const Basic: Story<IdenticonProps> = (props) => <Identicon {...props} />

Expand Down
16 changes: 10 additions & 6 deletions packages/identicon/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { LidoComponentProps } from '@lidofinance/utils'
export type { Theme } from '@lidofinance/theme'

export type IdenticonProps = {
address: string
diameter?: number
paperStyles?: React.CSSProperties
svgStyles?: React.CSSProperties
} & Omit<JSX.IntrinsicElements['div'], 'ref' | 'children'>
export type IdenticonProps = LidoComponentProps<
'div',
{
address: string
diameter?: number
paperStyles?: React.CSSProperties
svgStyles?: React.CSSProperties
}
>

export type IdenticonBadgeProps = {
symbols?: number
Expand Down
Loading

0 comments on commit 0a447a2

Please sign in to comment.