From e76c0e9f94658e8b95ab4b2128972788f0bc145a Mon Sep 17 00:00:00 2001 From: Marcos Conceicao Date: Tue, 13 Jun 2023 11:16:37 -0300 Subject: [PATCH 1/6] chore(package.json): added typescript plugin for eslint --- .eslintrc.json | 2 +- package.json | 5 ++-- yarn.lock | 62 +++++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 63 insertions(+), 6 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index d142dd85d..cfc42e2a1 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -4,7 +4,7 @@ "env": { "jest": true }, - "parser": "babel-eslint", + "parser": ["babel-eslint", "@typescript-eslint/parser"], "rules": { "strict": 0, "import/no-extraneous-dependencies": 0, diff --git a/package.json b/package.json index 106fa1711..143c49f4c 100644 --- a/package.json +++ b/package.json @@ -68,6 +68,7 @@ "@testing-library/jest-dom": "^5.16.1", "@testing-library/react": "^12.1.2", "@testing-library/user-event": "^13.5.0", + "@typescript-eslint/parser": "^5.59.9", "all-contributors-cli": "^6.8.0", "babel-core": "^7.0.0-bridge.0", "babel-eslint": "^10.0.1", @@ -113,8 +114,8 @@ "slugify": "^1.3.6" }, "peerDependencies": { - "react": "^16.14.0 || ^17", - "react-dom": "^16.14.0 || ^17", + "react": "^16.14.0 || ^17 || ^18.0.0", + "react-dom": "^16.14.0 || ^17 || ^18.0.0", "styled-components": ">= 4" }, "lint-staged": { diff --git a/yarn.lock b/yarn.lock index 543d9a6d6..f1b85b141 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3690,6 +3690,50 @@ resolved "https://registry.yarnpkg.com/@types/yoga-layout/-/yoga-layout-1.9.2.tgz#efaf9e991a7390dc081a0b679185979a83a9639a" integrity sha512-S9q47ByT2pPvD65IvrWp7qppVMpk9WGMbVq9wbWZOHg6tnXSD4vyhao6nOSBwwfDdV2p3Kx9evA9vI+XWTfDvw== +"@typescript-eslint/parser@^5.59.9": + version "5.59.9" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.59.9.tgz#a85c47ccdd7e285697463da15200f9a8561dd5fa" + integrity sha512-FsPkRvBtcLQ/eVK1ivDiNYBjn3TGJdXy2fhXX+rc7czWl4ARwnpArwbihSOHI2Peg9WbtGHrbThfBUkZZGTtvQ== + dependencies: + "@typescript-eslint/scope-manager" "5.59.9" + "@typescript-eslint/types" "5.59.9" + "@typescript-eslint/typescript-estree" "5.59.9" + debug "^4.3.4" + +"@typescript-eslint/scope-manager@5.59.9": + version "5.59.9" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.59.9.tgz#eadce1f2733389cdb58c49770192c0f95470d2f4" + integrity sha512-8RA+E+w78z1+2dzvK/tGZ2cpGigBZ58VMEHDZtpE1v+LLjzrYGc8mMaTONSxKyEkz3IuXFM0IqYiGHlCsmlZxQ== + dependencies: + "@typescript-eslint/types" "5.59.9" + "@typescript-eslint/visitor-keys" "5.59.9" + +"@typescript-eslint/types@5.59.9": + version "5.59.9" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.59.9.tgz#3b4e7ae63718ce1b966e0ae620adc4099a6dcc52" + integrity sha512-uW8H5NRgTVneSVTfiCVffBb8AbwWSKg7qcA4Ot3JI3MPCJGsB4Db4BhvAODIIYE5mNj7Q+VJkK7JxmRhk2Lyjw== + +"@typescript-eslint/typescript-estree@5.59.9": + version "5.59.9" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.9.tgz#6bfea844e468427b5e72034d33c9fffc9557392b" + integrity sha512-pmM0/VQ7kUhd1QyIxgS+aRvMgw+ZljB3eDb+jYyp6d2bC0mQWLzUDF+DLwCTkQ3tlNyVsvZRXjFyV0LkU/aXjA== + dependencies: + "@typescript-eslint/types" "5.59.9" + "@typescript-eslint/visitor-keys" "5.59.9" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + semver "^7.3.7" + tsutils "^3.21.0" + +"@typescript-eslint/visitor-keys@5.59.9": + version "5.59.9" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.9.tgz#9f86ef8e95aca30fb5a705bb7430f95fc58b146d" + integrity sha512-bT7s0td97KMaLwpEBckbzj/YohnvXtqbe2XgqNvTl6RJVakY5mvENOTPvw5u66nljfZxthESpDozs86U+oLY8Q== + dependencies: + "@typescript-eslint/types" "5.59.9" + eslint-visitor-keys "^3.3.0" + "@webassemblyjs/ast@1.11.5", "@webassemblyjs/ast@^1.11.5": version "1.11.5" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.11.5.tgz#6e818036b94548c1fb53b754b5cae3c9b208281c" @@ -6563,7 +6607,7 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9: dependencies: ms "2.0.0" -debug@4, debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.3: +debug@4, debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -7437,6 +7481,11 @@ eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e" integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== +eslint-visitor-keys@^3.3.0: + version "3.4.1" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz#c22c48f48942d08ca824cc526211ae400478a994" + integrity sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA== + eslint@^5.15.3: version "5.16.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.16.0.tgz#a1e3ac1aae4a3fbd8296fcf8f7ab7314cbb6abea" @@ -8521,7 +8570,7 @@ globalthis@^1.0.0, globalthis@^1.0.3: dependencies: define-properties "^1.1.3" -globby@^11.0.0, globby@^11.0.1, globby@^11.0.2: +globby@^11.0.0, globby@^11.0.1, globby@^11.0.2, globby@^11.1.0: version "11.1.0" resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== @@ -15798,7 +15847,7 @@ tsconfig-paths@^3.14.1: minimist "^1.2.6" strip-bom "^3.0.0" -tslib@^1.9.0: +tslib@^1.8.1, tslib@^1.9.0: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== @@ -15808,6 +15857,13 @@ tslib@^2.0.0, tslib@^2.0.1, tslib@^2.0.3, tslib@^2.1.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf" integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg== +tsutils@^3.21.0: + version "3.21.0" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" + integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== + dependencies: + tslib "^1.8.1" + tty-browserify@0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6" From 84f1bb981ce901359b2876360fbe5af08a748448 Mon Sep 17 00:00:00 2001 From: Marcos Conceicao Date: Tue, 13 Jun 2023 11:17:19 -0300 Subject: [PATCH 2/6] fix: Updated components type --- components/Accordion/index.d.ts | 5 ++- components/Alert/index.d.ts | 5 ++- components/AutoComplete/index.d.ts | 6 +-- components/Avatar/index.d.ts | 5 ++- components/Badge/index.d.ts | 5 ++- components/Breadcrumbs/index.d.ts | 5 ++- components/Button/index.d.ts | 10 +++-- components/Card/Content.d.ts | 13 ++++--- components/Card/Description.d.ts | 11 ++++-- components/Card/Footer.d.ts | 11 ++++-- components/Card/Header.d.ts | 11 ++++-- components/Card/HeaderText.d.ts | 8 +++- components/Card/Media.d.ts | 12 +++--- components/Card/Thumbnail.d.ts | 10 +++-- components/Card/Title.d.ts | 12 +++--- components/Card/index.d.ts | 53 ++++++++++++------------- components/Carousel/index.d.ts | 7 ++-- components/ChargeBar/index.d.ts | 5 ++- components/Checkbox/index.d.ts | 54 +++++++++++++------------- components/CircularLoader/index.d.ts | 6 ++- components/Dialog/index.d.ts | 7 ++-- components/Dropdown/index.d.ts | 5 ++- components/DropdownLight/index.d.ts | 6 +-- components/Form/index.d.ts | 22 ++++++----- components/GlobalStyle/index.d.ts | 8 ++-- components/Grid/index.d.ts | 19 +++++---- components/Hamburger/index.d.ts | 5 ++- components/Icon/index.d.ts | 5 ++- components/InfiniteScroll/index.d.ts | 5 ++- components/Input/index.d.ts | 21 +++++----- components/Link/index.d.ts | 9 +++-- components/List/index.d.ts | 28 ++++++------- components/Modal/index.d.ts | 44 ++++++++++++--------- components/Pagination/index.d.ts | 5 ++- components/Popover/index.d.ts | 5 ++- components/ProgressBar/index.d.ts | 5 ++- components/RadioGroup/index.d.ts | 19 ++++----- components/RangeSlider/index.d.ts | 5 ++- components/SegmentedControl/index.d.ts | 9 +++-- components/Skeleton/index.d.ts | 41 +++++++++---------- components/SnackBar/index.d.ts | 5 ++- components/SocialButton/index.d.ts | 7 ++-- components/Socials/index.d.ts | 5 ++- components/Stepper/index.d.ts | 1 + components/TabbedView/index.d.ts | 10 +++-- components/Tag/index.d.ts | 7 ++-- components/TextArea/index.d.ts | 7 ++-- components/Toggle/index.d.ts | 7 ++-- components/Tooltip/index.d.ts | 5 ++- components/index.d.ts | 18 +++++---- 50 files changed, 328 insertions(+), 271 deletions(-) diff --git a/components/Accordion/index.d.ts b/components/Accordion/index.d.ts index 13724d473..5ad832080 100644 --- a/components/Accordion/index.d.ts +++ b/components/Accordion/index.d.ts @@ -1,4 +1,4 @@ -import { ReactNode, Component } from 'react'; +import { ReactNode, FC } from 'react'; export interface AccordionProps { theme?: { @@ -15,4 +15,5 @@ export interface AccordionProps { }>; } -export default class Accordion extends Component {} +declare const Accordion: FC; +export default Accordion; diff --git a/components/Alert/index.d.ts b/components/Alert/index.d.ts index 067df9d47..3845589f3 100644 --- a/components/Alert/index.d.ts +++ b/components/Alert/index.d.ts @@ -1,4 +1,4 @@ -import { ReactNode, MouseEventHandler, TouchEventHandler, Component } from 'react'; +import { ReactNode, MouseEventHandler, TouchEventHandler, FC } from 'react'; import { IconNames } from '../Icon'; export interface AlertProps { @@ -17,4 +17,5 @@ export interface AlertProps { }; } -export default class Alert extends Component {} +declare const Alert: FC; +export default Alert; diff --git a/components/AutoComplete/index.d.ts b/components/AutoComplete/index.d.ts index 685a32e38..dce8eb312 100644 --- a/components/AutoComplete/index.d.ts +++ b/components/AutoComplete/index.d.ts @@ -1,5 +1,4 @@ -import { Component } from 'react'; - +import { FC } from 'react'; export interface AutoCompleteProps { theme?: { colors?: object; @@ -19,4 +18,5 @@ export interface AutoCompleteProps { onSelectedItem?: (item: string) => void; } -export default class AutoComplete extends Component { } +declare const AutoComplete: FC; +export default AutoComplete; \ No newline at end of file diff --git a/components/Avatar/index.d.ts b/components/Avatar/index.d.ts index 74f338ab5..b37a5669e 100644 --- a/components/Avatar/index.d.ts +++ b/components/Avatar/index.d.ts @@ -1,4 +1,4 @@ -import { Component } from 'react'; +import { FC } from 'react'; export interface AvatarProps { picture?: string; @@ -9,4 +9,5 @@ export interface AvatarProps { onClick?: () => void; } -export default class Avatar extends Component { } +declare const Avatar: FC; +export default Avatar; \ No newline at end of file diff --git a/components/Badge/index.d.ts b/components/Badge/index.d.ts index b1ba1023f..6a65d8e71 100644 --- a/components/Badge/index.d.ts +++ b/components/Badge/index.d.ts @@ -1,4 +1,4 @@ -import { Component, ReactNode } from 'react'; +import { FC, ReactNode } from 'react'; export interface BadgeProps { skin?: 'primary' | 'secondary' | 'success' | 'error' | 'neutral'; @@ -15,4 +15,5 @@ export interface BadgeProps { }; } -export default class Badge extends Component {} +declare const Badge: FC; +export default Badge; diff --git a/components/Breadcrumbs/index.d.ts b/components/Breadcrumbs/index.d.ts index 19d13a57d..b40e34c11 100644 --- a/components/Breadcrumbs/index.d.ts +++ b/components/Breadcrumbs/index.d.ts @@ -1,5 +1,5 @@ -import { Component } from 'react'; +import { FC } from 'react'; export interface BreadcrumbsProps { items: Array<{ @@ -13,5 +13,6 @@ export interface BreadcrumbsProps { }; } -export default class Breadcrumbs extends Component {} +declare const Breadcrumbs: FC; +export default Breadcrumbs; \ No newline at end of file diff --git a/components/Button/index.d.ts b/components/Button/index.d.ts index fb00e1415..13243bb5f 100644 --- a/components/Button/index.d.ts +++ b/components/Button/index.d.ts @@ -1,4 +1,4 @@ -import { Component, ButtonHTMLAttributes, ReactNode, MouseEventHandler } from 'react'; +import { FC, ButtonHTMLAttributes, ReactNode, MouseEventHandler } from 'react'; import { IconNames } from '../Icon'; import IconButton from './IconButton'; @@ -25,6 +25,8 @@ export interface ButtonProps extends ButtonHTMLAttributes { }; } -export default class Button extends Component { - static Icon: IconButton; -} +declare const Button: FC & { + Icon: IconButton; +}; + +export default Button; diff --git a/components/Card/Content.d.ts b/components/Card/Content.d.ts index 875132fc6..ea2c5771b 100644 --- a/components/Card/Content.d.ts +++ b/components/Card/Content.d.ts @@ -1,9 +1,12 @@ -import { ComponentType } from 'react'; +import { FC, ReactNode } from 'react'; -type Content = ComponentType<{ +export interface ContentProps { theme?: { baseFontSize?: number; spacing?: object }; -}> & { + children: ReactNode | ReactNode[]; +} + +declare const Content: FC & { displayName: 'Card.Content'; }; - -export default Content; + +export default Content; \ No newline at end of file diff --git a/components/Card/Description.d.ts b/components/Card/Description.d.ts index 28858d316..202b3ae15 100644 --- a/components/Card/Description.d.ts +++ b/components/Card/Description.d.ts @@ -1,10 +1,13 @@ -import { ComponentType } from 'react'; +import { ReactNode, FC } from 'react'; -type Description = ComponentType<{ +export interface DescriptionProps { small?: boolean; theme?: { baseFontSize?: number; spacing?: object }; -}> & { + children: ReactNode | ReactNode[]; +} + +declare const Description: FC & { displayName: 'Card.Description'; }; - + export default Description; diff --git a/components/Card/Footer.d.ts b/components/Card/Footer.d.ts index 1ff7b730e..f5403b79a 100644 --- a/components/Card/Footer.d.ts +++ b/components/Card/Footer.d.ts @@ -1,9 +1,12 @@ -import { ComponentType } from 'react'; +import { FC, ReactNode } from 'react'; -type Footer = ComponentType<{ +export interface FooterProps { theme?: { spacing?: object }; -}> & { + children: ReactNode | ReactNode[]; +} + +declare const Footer: FC & { displayName: 'Card.Footer'; }; - + export default Footer; diff --git a/components/Card/Header.d.ts b/components/Card/Header.d.ts index 578cb225c..e3086e268 100644 --- a/components/Card/Header.d.ts +++ b/components/Card/Header.d.ts @@ -1,9 +1,12 @@ -import { ComponentType } from 'react'; +import { FC, ReactNode } from 'react'; -type Header = ComponentType<{ +export interface HeaderProps { theme?: { spacing?: object }; -}> & { + children: ReactNode | ReactNode[]; +} + +declare const Header: FC & { displayName: 'Card.Header'; }; - + export default Header; diff --git a/components/Card/HeaderText.d.ts b/components/Card/HeaderText.d.ts index e074473c2..8f59b408e 100644 --- a/components/Card/HeaderText.d.ts +++ b/components/Card/HeaderText.d.ts @@ -1,6 +1,10 @@ -import { ComponentType } from 'react'; +import { FC, ReactNode } from 'react'; -type HeaderText = ComponentType & { +export interface HeaderTextProps { + children: ReactNode | ReactNode[]; +} + +declare const HeaderText: FC & { displayName: 'Card.HeaderText'; }; diff --git a/components/Card/Media.d.ts b/components/Card/Media.d.ts index 4394adc68..a76d529c3 100644 --- a/components/Card/Media.d.ts +++ b/components/Card/Media.d.ts @@ -1,11 +1,11 @@ -import { ComponentType } from 'react'; +import { FC, HTMLAttributes } from 'react'; -type Media = ComponentType<{ - className?: string; - style?: {}; +export interface MediaProps extends HTMLAttributes { theme?: { colors?: {}; spacing?: {} }; -}> & { - displayName: 'Card.Media'; +} + +declare const Media: FC & { + displayName: "Card.Media"; }; export default Media; diff --git a/components/Card/Thumbnail.d.ts b/components/Card/Thumbnail.d.ts index 462664bea..87f934d81 100644 --- a/components/Card/Thumbnail.d.ts +++ b/components/Card/Thumbnail.d.ts @@ -1,12 +1,14 @@ -import { ComponentType } from 'react'; +import { FC } from 'react'; -type Thumbnail = ComponentType<{ +export interface ThumbnailProps { src: string; alt: string; rounded?: boolean; theme?: { colors?: object }; -}> & { - displayName: 'Card.Thumbnail'; +} + +declare const Thumbnail: FC & { + displayName: "Card.Thumbnail"; }; export default Thumbnail; diff --git a/components/Card/Title.d.ts b/components/Card/Title.d.ts index 10e5ad9b1..c6ecedee9 100644 --- a/components/Card/Title.d.ts +++ b/components/Card/Title.d.ts @@ -1,10 +1,12 @@ -import { ComponentType } from 'react'; +import { FC } from 'react'; -type Title = ComponentType<{ +export interface TitleProps { small?: boolean; theme?: { baseFontSize?: object }; -}> & { - displayName: 'Card.Title'; +} + +declare const Title: FC & { + displayName: "Card.Title"; }; -export default Title; +export default Title; \ No newline at end of file diff --git a/components/Card/index.d.ts b/components/Card/index.d.ts index 085f5698b..cab661ba1 100644 --- a/components/Card/index.d.ts +++ b/components/Card/index.d.ts @@ -1,35 +1,30 @@ -import { Component, MouseEvent } from 'react'; -import Content from './Content'; -import Description from './Description'; -import Footer from './Footer'; -import Header from './Header'; -import HeaderText from './HeaderText'; -import Media from './Media'; -import Thumbnail from './Thumbnail'; -import Title from './Title'; - -type Props = { +import { FC, MouseEvent } from 'react'; +import { ContentProps } from './Content'; +import { DescriptionProps } from './Description'; +import { FooterProps } from './Footer'; +import { HeaderProps } from './Header'; +import { HeaderTextProps } from './HeaderText'; +import { MediaProps } from './Media'; +import { ThumbnailProps } from './Thumbnail'; +import { TitleProps } from './Title'; + +export interface CardProps { onClick?: (e: MouseEvent) => void; theme?: { - colors?: object + colors?: object; }, - backgroundOpacity?: number + backgroundOpacity?: number; } -export default class Card extends Component { - static Content: Content; - - static Description: Description; - - static Footer: Footer; - - static Header: Header; - - static HeaderText: HeaderText; - - static Media: Media; - - static Thumbnail: Thumbnail; - - static Title: Title; +declare const Card: FC & { + Content: FC; + Description: FC; + Footer: FC; + Header: FC; + HeaderText: FC; + Media: FC; + Thumbnail: FC; + Title: FC; } + +export default Card; diff --git a/components/Carousel/index.d.ts b/components/Carousel/index.d.ts index c9eb3b8b2..a956e38fc 100644 --- a/components/Carousel/index.d.ts +++ b/components/Carousel/index.d.ts @@ -1,4 +1,4 @@ -import { Component } from 'react'; +import { FC } from 'react'; export type NonEmptyArray = [T, ...T[]]; @@ -8,7 +8,7 @@ export interface CarouselProps { slidesToScroll?: number, arrowColor?: 'primary' | 'success' | 'error' | 'neutral' | 'warning', cardSize?: 'small' | 'medium' | 'large', - cards:NonEmptyArray<{ + cards: NonEmptyArray<{ imagePath?: string, imageDescription?: string, title?: string, @@ -22,4 +22,5 @@ export interface CarouselProps { }; } -export default class Carousel extends Component {} \ No newline at end of file +declare const Carousel: FC; +export default Carousel; \ No newline at end of file diff --git a/components/ChargeBar/index.d.ts b/components/ChargeBar/index.d.ts index c4554c429..d3cdf0b45 100644 --- a/components/ChargeBar/index.d.ts +++ b/components/ChargeBar/index.d.ts @@ -1,4 +1,4 @@ -import { Component } from 'react'; +import { FC } from 'react'; export interface ChargeBarProps { skin?: 'neutral' | 'primary' | 'secondary' | 'success'; @@ -14,4 +14,5 @@ export interface ChargeBarProps { label?: string; } -export default class ChargeBar extends Component {} +declare const ChargeBar: FC; +export default ChargeBar; diff --git a/components/Checkbox/index.d.ts b/components/Checkbox/index.d.ts index 63908f2c7..bcf8fb381 100644 --- a/components/Checkbox/index.d.ts +++ b/components/Checkbox/index.d.ts @@ -1,4 +1,4 @@ -import { Component, ChangeEventHandler, ComponentType, ReactNode } from 'react'; +import { FC, ReactNode, ChangeEventHandler, ChangeEvent } from 'react'; export interface CheckboxProps { checked?: boolean; @@ -17,33 +17,21 @@ export interface CheckboxProps { }; } -export class Checkbox extends Component {} -export type CheckboxType = ComponentType; - export interface CheckboxButtonProps { - children?: ReactNode[] | ReactNode; - skin?: 'neutral' | 'primary' | 'success' | 'warning' | 'error'; - size?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge'; - checked?: boolean; - disabled?: boolean; - error?: string; - id?: string; - icon?: string; - label?: string; - name: string; - onChange?: ChangeEventHandler; - value?: string; -} - -export type CheckboxButton = ComponentType; - -export type Options = Array<{ + children?: ReactNode[] | ReactNode; + skin?: 'neutral' | 'primary' | 'success' | 'warning' | 'error'; + size?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge'; checked?: boolean; disabled?: boolean; - label?: ReactNode; + error?: string; + id?: string; + icon?: string; + label?: string; name: string; + onChange?: ChangeEventHandler; value?: string; -}>; +} + export interface CheckboxGroupProps { children?: JSX.Element[] | JSX.Element; error?: string; @@ -51,15 +39,27 @@ export interface CheckboxGroupProps { onChange?: (items?: Options, event?: ChangeEvent) => void; options?: Options; size?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge'; - type: 'checkbox' | 'button'; + type?: 'checkbox' | 'button'; theme?: { colors?: {}; spacing?: {}; }; } -export class CheckboxGroup extends Component { - static Checkbox: CheckboxType; +export type Options = Array<{ + checked?: boolean; + disabled?: boolean; + label?: ReactNode; + name: string; + value?: string; +}>; - static Button: CheckboxButton; +declare const Checkbox: FC; +declare const CheckboxButton: FC; +declare const CheckboxGroup: FC & { + Checkbox: typeof Checkbox; + Button: typeof CheckboxButton; } + +export { Checkbox, CheckboxButton, CheckboxGroup }; +export default Checkbox; \ No newline at end of file diff --git a/components/CircularLoader/index.d.ts b/components/CircularLoader/index.d.ts index b4d149104..301b7aa36 100644 --- a/components/CircularLoader/index.d.ts +++ b/components/CircularLoader/index.d.ts @@ -1,4 +1,4 @@ -import { Component } from 'react'; +import { FC } from 'react'; export interface CircularLoaderProps { size?: 'medium' | 'large' | 'xlarge' | 'xxlarge' | 'xxxlarge'; @@ -9,4 +9,6 @@ export interface CircularLoaderProps { }; } -export default class CircularLoader extends Component {} +declare const CircularLoader: FC; + +export default CircularLoader diff --git a/components/Dialog/index.d.ts b/components/Dialog/index.d.ts index b280dd89b..4f9798e36 100644 --- a/components/Dialog/index.d.ts +++ b/components/Dialog/index.d.ts @@ -1,4 +1,4 @@ -import { Component, ReactNode } from 'react'; +import { FC, ReactNode } from 'react'; export interface DialogProps { children: ReactNode[] | ReactNode; @@ -7,8 +7,9 @@ export interface DialogProps { }; onClose?: () => void; onClickOutside?: () => void; - disableClickOutside: boolean; + disableClickOutside?: boolean; closeOnTime?: number; } -export default class Dialog extends Component {} +declare const Dialog: FC; +export default Dialog; diff --git a/components/Dropdown/index.d.ts b/components/Dropdown/index.d.ts index 0d32dcba3..0f99e2db7 100644 --- a/components/Dropdown/index.d.ts +++ b/components/Dropdown/index.d.ts @@ -1,4 +1,4 @@ -import { Component } from 'react'; +import { FC } from 'react'; import { ControllerStateAndHelpers } from 'downshift'; export type ItemPropType = string | { value: string | number; label: string }; @@ -29,4 +29,5 @@ export interface DropdownProps { }; } -export default class Dropdown extends Component {} +declare const Dropdown: FC; +export default Dropdown; diff --git a/components/DropdownLight/index.d.ts b/components/DropdownLight/index.d.ts index 0400e8dbf..e70bae56e 100644 --- a/components/DropdownLight/index.d.ts +++ b/components/DropdownLight/index.d.ts @@ -1,10 +1,9 @@ // Generated with scripts/create-component.js -import { Component } from 'react'; +import { FC } from 'react'; export type ItemPropType = string | { value: string | number; label: string }; - export interface DropdownLightProps { id?: string; name?: string; @@ -27,5 +26,6 @@ export interface DropdownLightProps { ) => void; } -export default class DropdownLight extends Component {} +declare const DropdownLight: FC; +export default DropdownLight; \ No newline at end of file diff --git a/components/Form/index.d.ts b/components/Form/index.d.ts index b79747d39..f7a848737 100644 --- a/components/Form/index.d.ts +++ b/components/Form/index.d.ts @@ -1,28 +1,30 @@ -import { FormHTMLAttributes, ReactNode, Component } from 'react'; +import { FormHTMLAttributes, ReactNode, FC } from 'react'; -export interface FormProps extends FormHTMLAttributes { +export interface FormProps extends Omit, "onSubmit"> { children: ReactNode[] | ReactNode; onSubmit?: ({ valid }?: { valid: boolean }) => void; onValidSubmit?: (values?: { [name: string]: string | undefined }) => void; noValidate?: boolean; } -export class Form extends Component {} +declare const Form: FC; export namespace Validations { function Required(params: { value?: string }): string; - + function CPF(params: { value?: string }, cpf?: string): string; - + function CEP(params: { value?: string }): string; - + function Date(params: { value?: string }): string; - + function MinLength(params: { value?: string; minLength?: string | number }): string; - + function MaxLength(params: { value?: string; maxLength?: string | number }): string; - + function Email(params: { value?: string }): string; - + function EmailBlockAccent(params: { value?: string }): string; } + +export default Form; \ No newline at end of file diff --git a/components/GlobalStyle/index.d.ts b/components/GlobalStyle/index.d.ts index 200f493b6..b532a9e18 100644 --- a/components/GlobalStyle/index.d.ts +++ b/components/GlobalStyle/index.d.ts @@ -1,5 +1,7 @@ -import { Component, FC } from 'react'; +import { FC } from 'react'; -export default class GlobalStyle extends Component {} +declare const GlobalStyle: FC; +declare const Typography: FC; -export const Typography: FC; +export { Typography, GlobalStyle }; +export default GlobalStyle; diff --git a/components/Grid/index.d.ts b/components/Grid/index.d.ts index 15f5325a9..e93f1ea39 100644 --- a/components/Grid/index.d.ts +++ b/components/Grid/index.d.ts @@ -1,9 +1,9 @@ -import { Component, ReactNode } from 'react'; +import { FC, HTMLAttributes, ReactNode } from 'react'; import Breakpoints from '../Breakpoints'; export type BreakpointsType = keyof typeof Breakpoints; -export interface ColProps { +export interface ColProps extends HTMLAttributes { 'no-gutters'?: boolean; xsmall?: number; small?: number; @@ -16,9 +16,8 @@ export interface ColProps { hide?: BreakpointsType | BreakpointsType[]; } -export class Col extends Component {} -export interface ContainerProps { +export interface ContainerProps extends HTMLAttributes { withBreakpoints?: boolean; fluid?: boolean; hide?: BreakpointsType | string[]; @@ -29,9 +28,8 @@ export interface ContainerProps { 'no-gutters'?: boolean; } -export class Container extends Component {} -export interface HideProps { +export interface HideProps extends HTMLAttributes { large?: boolean; medium?: boolean; small?: boolean; @@ -41,9 +39,7 @@ export interface HideProps { }; } -export class Hide extends Component {} - -export interface RowProps { +export interface RowProps extends HTMLAttributes { 'no-gutters'?: boolean; children: ReactNode[] | ReactNode; hide?: BreakpointsType | BreakpointsType[]; @@ -52,4 +48,7 @@ export interface RowProps { }; } -export class Row extends Component {} +export const Row: FC; +export const Col: FC; +export const Hide: FC; +export const Container: FC; \ No newline at end of file diff --git a/components/Hamburger/index.d.ts b/components/Hamburger/index.d.ts index 54d176368..ce4029e2b 100644 --- a/components/Hamburger/index.d.ts +++ b/components/Hamburger/index.d.ts @@ -1,4 +1,4 @@ -import { Component } from 'react'; +import { FC } from 'react'; export interface HamburgerProps { showNotification?: boolean; @@ -7,4 +7,5 @@ export interface HamburgerProps { ariaLabelDescription?: string; } -export default class Hamburger extends Component {} +declare const Hamburger: FC; +export default Hamburger; diff --git a/components/Icon/index.d.ts b/components/Icon/index.d.ts index 01e9283c6..93a4deb6c 100644 --- a/components/Icon/index.d.ts +++ b/components/Icon/index.d.ts @@ -1,4 +1,4 @@ -import { Component, CSSProperties } from 'react'; +import { FC, CSSProperties } from 'react'; export type IconNames = | 'access_alarm' @@ -939,4 +939,5 @@ export interface IconProps { size?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge'; } -export default class Icon extends Component {} +declare const Icon: FC; +export default Icon; diff --git a/components/InfiniteScroll/index.d.ts b/components/InfiniteScroll/index.d.ts index 64a490e65..d823401fb 100644 --- a/components/InfiniteScroll/index.d.ts +++ b/components/InfiniteScroll/index.d.ts @@ -1,6 +1,6 @@ // Generated with scripts/create-component.js -import { Component } from 'react'; +import { FC, ReactNode } from 'react'; export interface InfiniteScrollProps { children: ReactNode[] | ReactNode; @@ -8,5 +8,6 @@ export interface InfiniteScrollProps { onScrollEnd?: () => void; } -export default class InfiniteScroll extends Component {} +declare const InfiniteScroll: FC; +export default InfiniteScroll; \ No newline at end of file diff --git a/components/Input/index.d.ts b/components/Input/index.d.ts index 79a4b2953..709cb9e09 100644 --- a/components/Input/index.d.ts +++ b/components/Input/index.d.ts @@ -1,4 +1,4 @@ -import { InputHTMLAttributes, MouseEventHandler, ChangeEventHandler } from 'react'; +import { InputHTMLAttributes, MouseEventHandler, ChangeEventHandler, FC } from 'react'; import { Validations } from '../Form'; export type MaskFunction = (rawValue: string) => string[]; @@ -40,16 +40,13 @@ export interface InputProps extends InputHTMLAttributes { }; } - -interface CompoundedInput extends React.FunctionComponent { - CEP: React.FunctionComponent; - CNPJ: React.FunctionComponent; - CPF: React.FunctionComponent; - Date: React.FunctionComponent; - Password: React.FunctionComponent; - Phone: React.FunctionComponent; -} - -const Input: CompoundedInput = () => null +declare const Input: FC & { + CEP: FC; + CNPJ: FC; + CPF: FC; + Date: FC; + Password: FC; + Phone: FC; +}; export default Input; diff --git a/components/Link/index.d.ts b/components/Link/index.d.ts index 9c6a07d5f..c040a541a 100644 --- a/components/Link/index.d.ts +++ b/components/Link/index.d.ts @@ -1,9 +1,12 @@ -import { ReactNode, AnchorHTMLAttributes } from 'react'; +import { ReactNode, AnchorHTMLAttributes, FC } from 'react'; -export interface Link extends AnchorHTMLAttributes { +export interface LinkProps extends AnchorHTMLAttributes { theme?: { colors?: {}; }; skin?: 'default' | 'dark'; children?: ReactNode[] | ReactNode; -} \ No newline at end of file +} + +declare const Link: FC; +export default Link \ No newline at end of file diff --git a/components/List/index.d.ts b/components/List/index.d.ts index d4c56b80a..0642bb293 100644 --- a/components/List/index.d.ts +++ b/components/List/index.d.ts @@ -1,4 +1,4 @@ -import { Component, ReactElement } from 'react'; +import { FC, ReactNode } from 'react'; import { IconNames } from '../Icon'; interface ItemContent { @@ -12,12 +12,12 @@ interface ListItem { } export interface ListProps { - items: string[] | ListItem[]; + items?: string[] | ListItem[]; ordered?: boolean; inline?: boolean; divided?: boolean; bullet?: boolean; - children?: ReactElement | ReactElement[]; + children?: ReactNode | ReactNode[]; theme?: { colors?: {}; spacing?: {}; @@ -29,7 +29,7 @@ interface Content { header?: string; subheader?: string; content?: ItemContent, - children?: ReactElement | ReactElement[]; + children?: ReactNode | ReactNode[]; theme?: { spacing?: {}; baseFontSize?: number; @@ -37,13 +37,14 @@ interface Content { } interface Header { + children?: ReactNode | ReactNode[]; theme?: { spacing?: {}; }; } interface SubHeader { - children?: ReactElement | ReactElement[]; + children?: ReactNode | ReactNode[]; theme?: { baseFontSize?: number; } @@ -53,19 +54,18 @@ interface Item { content?: ItemContent; icon?: IconNames | string; bullet?: string; - children?: ReactElement | ReactElement[]; + children?: ReactNode | ReactNode[]; theme?: { spacing?: {}; baseFontSize?: number; } } -export default class List extends Component { - static Header: Header; - - static SubHeader: SubHeader; - - static Content: Content; +declare const List: FC & { + Header: FC
; + SubHeader: FC; + Content: FC; + Item: FC; +} - static Item: Item; -} \ No newline at end of file +export default List; \ No newline at end of file diff --git a/components/Modal/index.d.ts b/components/Modal/index.d.ts index 28c7ca6bf..326006657 100644 --- a/components/Modal/index.d.ts +++ b/components/Modal/index.d.ts @@ -1,55 +1,61 @@ -import { ReactNode, TouchEvent, MouseEventHandler } from 'react'; +import { ReactNode, TouchEvent, MouseEventHandler, FC, HTMLAttributes } from 'react'; export interface ModalProps { children?: ReactNode[] | ReactNode; - onClick?: (e?: MouseEvent | TouchEvent) => void; + onClick?: (e?: MouseEvent | TouchEvent) => void; // braking change onClose?: MouseEventHandler; closeButtonAriaLabel?: string; theme?: { - breakpoints?: {}; - colors?: {}; - spacing?: {}; + breakpoints?: object; + colors?: object; + spacing?: object; components?: { - button?: {}; + button?: object; }; }; } - interface ModalHeaderProps { + interface ModalHeaderProps extends HTMLAttributes { + children?: ReactNode[] | ReactNode; theme?: { - spacing?: {}; + spacing?: object; }; } - interface ModalTitleProps { + interface ModalTitleProps extends HTMLAttributes { + children?: ReactNode[] | ReactNode; small?: boolean; theme?: { - baseFontSize?: {}; + baseFontSize?: object; }; } -interface ModalContentProps { +interface ModalContentProps extends HTMLAttributes { + children?: ReactNode[] | ReactNode; theme?: { baseFontSize?: number; spacing?: {} }; } -interface ModalFooterProps { +interface ModalFooterProps extends HTMLAttributes { + children?: ReactNode[] | ReactNode; theme?: { spacing?: {}; }; } -interface CompoundedModal extends React.FunctionComponent { - Header: React.FunctionComponent; - Title: React.FunctionComponent; - HeaderText: React.FunctionComponent; - Content: React.FunctionComponent; - Footer: React.FunctionComponent; +interface HeaderTextProps extends HTMLAttributes { + children?: ReactNode[] | ReactNode; } -const Modal: CompoundedModal = () => null; +declare const Modal: FC & { + Header: FC; + Title: FC; + HeaderText: FC; + Content: FC; + Footer: FC; +}; export default Modal; diff --git a/components/Pagination/index.d.ts b/components/Pagination/index.d.ts index 552a76bfe..fc6335e29 100644 --- a/components/Pagination/index.d.ts +++ b/components/Pagination/index.d.ts @@ -1,4 +1,4 @@ -import { Component } from 'react'; +import { FC } from 'react'; export interface PaginationProps { tabIndex?: number; @@ -16,4 +16,5 @@ export interface PaginationProps { hideLastPagination?: boolean; } -export default class Pagination extends Component {} +declare const Pagination: FC; +export default Pagination; diff --git a/components/Popover/index.d.ts b/components/Popover/index.d.ts index 831c3bc14..0522074f9 100644 --- a/components/Popover/index.d.ts +++ b/components/Popover/index.d.ts @@ -1,4 +1,4 @@ -import { Component, ReactNode } from 'react'; +import { FC, ReactNode } from 'react'; export interface PopoverProps { inverted?: boolean; @@ -10,4 +10,5 @@ export interface PopoverProps { onClose?: () => void; } -export default class Popover extends Component {} +declare const Popover: FC; +export default Popover; diff --git a/components/ProgressBar/index.d.ts b/components/ProgressBar/index.d.ts index 22d1367c9..d48923e74 100644 --- a/components/ProgressBar/index.d.ts +++ b/components/ProgressBar/index.d.ts @@ -1,4 +1,4 @@ -import { Component } from 'react'; +import { FC } from 'react'; export interface ProgressBarProps { skin?: 'neutral' | 'primary' | 'secondary'; @@ -13,5 +13,6 @@ export interface ProgressBarProps { progressPercent?: number; label?: string; } +declare const ProgressBar: FC; -export default class ProgressBar extends Component {} +export default ProgressBar diff --git a/components/RadioGroup/index.d.ts b/components/RadioGroup/index.d.ts index 71cab6675..f73b826fb 100644 --- a/components/RadioGroup/index.d.ts +++ b/components/RadioGroup/index.d.ts @@ -1,10 +1,10 @@ -import { Component, ReactNode, ChangeEventHandler, ComponentType } from 'react'; +import { FC, ReactNode, ChangeEventHandler, ComponentType } from 'react'; import { IconNames } from '../Icon'; export interface RadioProps { disabled?: boolean; error?: boolean; - children?: string | ReactNode[] | ReactNode; + children?: ReactNode[] | ReactNode; label?: string; onChange?: ChangeEventHandler; theme?: { @@ -14,7 +14,6 @@ export interface RadioProps { value: string; } -export type Radio = ComponentType; export interface RadioButtonProps { checked?: boolean; @@ -39,8 +38,6 @@ export interface RadioButtonProps { value: string; } -export type RadioButton = ComponentType; - export interface RadioGroupProps { type?: 'radio' | 'button'; size?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge'; @@ -62,8 +59,12 @@ export interface RadioGroupProps { required?: boolean; } -export default class RadioGroup extends Component { - static Radio: Radio; - - static Button: RadioButton; +declare const Radio: FC; +declare const RadioButton: FC; +declare const RadioGroup: FC & { + Radio: typeof Radio; + Button: typeof RadioButton; } + +export { Radio, RadioButton }; +export default RadioGroup; diff --git a/components/RangeSlider/index.d.ts b/components/RangeSlider/index.d.ts index 9da289124..3e25b376b 100644 --- a/components/RangeSlider/index.d.ts +++ b/components/RangeSlider/index.d.ts @@ -1,4 +1,4 @@ -import { Component, ChangeEventHandler } from 'react'; +import { FC, ChangeEventHandler } from 'react'; export interface RangeSliderProps { step?: number; @@ -24,4 +24,5 @@ export interface RangeSliderProps { }; } -export default class RangeSlider extends Component {} +declare const RangeSlider: FC; +export default RangeSlider; diff --git a/components/SegmentedControl/index.d.ts b/components/SegmentedControl/index.d.ts index 1eec3eadb..7b25db8b0 100644 --- a/components/SegmentedControl/index.d.ts +++ b/components/SegmentedControl/index.d.ts @@ -1,5 +1,7 @@ import { FC, MouseEventHandler } from 'react'; +export type NonEmptyArray = [T, ...T[]]; + export interface SegmentedControlProps { name?: string; onChange?: MouseEventHandler; @@ -8,12 +10,13 @@ export interface SegmentedControlProps { spacing?: {}; colors?: {}; }; - items: [{ + items: NonEmptyArray<{ label: string; value: string; icon: string; checked: boolean; - }]; + }>; } -declare const SegmentedControl: FC; \ No newline at end of file +declare const SegmentedControl: FC; +export default SegmentedControl; \ No newline at end of file diff --git a/components/Skeleton/index.d.ts b/components/Skeleton/index.d.ts index 0e9fbd9e4..3dbb8247e 100644 --- a/components/Skeleton/index.d.ts +++ b/components/Skeleton/index.d.ts @@ -1,4 +1,4 @@ -import { Component, ComponentType } from 'react'; +import { FC } from 'react'; export interface SkeletonButtonProps { size?: 'xsmall' | 'small' | 'medium' | 'large'; @@ -7,24 +7,18 @@ export interface SkeletonButtonProps { }; } -export type SkeletonButton = ComponentType; - -export type SkeletonCircle = ComponentType; -export interface SkeletonTagProps { +export interface SkeletonProps { + type?: 'rect' | 'circle' | 'text' | 'button' | 'tag'; + as?: 'div' | 'span'; + width?: string; + height?: string; size?: 'xsmall' | 'small' | 'medium' | 'large'; theme?: { spacing?: {}; baseFontSize?: number; }; } - -export type SkeletonTag = ComponentType; - -export interface SkeletonProps { - type?: 'rect' | 'circle' | 'text' | 'button' | 'tag'; - as?: 'div' | 'span'; - width?: string; - height?: string; +export interface SkeletonTagProps { size?: 'xsmall' | 'small' | 'medium' | 'large'; theme?: { spacing?: {}; @@ -32,14 +26,17 @@ export interface SkeletonProps { }; } -export type SkeletonText = ComponentType; +declare const SkeletonText: FC; +declare const SkeletonButton: FC; +declare const SkeletonTag: FC; +declare const SkeletonCircle: FC; -export default class Skeleton extends Component { - static Button: SkeletonButton; - - static Circle: SkeletonCircle; - - static Text: SkeletonText; - - static Tag: SkeletonTag; +declare const Skeleton: FC & { + Button: typeof SkeletonButton; + Circle: typeof SkeletonCircle; + Text: typeof SkeletonText; + Tag: typeof SkeletonTag; } + +export { SkeletonText, SkeletonButton, SkeletonTag, SkeletonCircle}; +export default Skeleton; diff --git a/components/SnackBar/index.d.ts b/components/SnackBar/index.d.ts index bde606171..c792b3fa8 100644 --- a/components/SnackBar/index.d.ts +++ b/components/SnackBar/index.d.ts @@ -1,4 +1,4 @@ -import { Component, MouseEventHandler, TouchEventHandler } from 'react'; +import { FC, MouseEventHandler, TouchEventHandler } from 'react'; export interface SnackBarProps { actionTrigger?: { @@ -25,4 +25,5 @@ export interface SnackBarProps { id?: string; } -export default class SnackBar extends Component {} +declare const SnackBar: FC; +export default SnackBar; diff --git a/components/SocialButton/index.d.ts b/components/SocialButton/index.d.ts index 99802311b..f17caea48 100644 --- a/components/SocialButton/index.d.ts +++ b/components/SocialButton/index.d.ts @@ -1,8 +1,9 @@ -import { Component } from 'react'; +import { FC } from 'react'; import { ButtonProps } from '../Button'; -interface SocialButtonProps extends ButtonProps { +export interface SocialButtonProps extends ButtonProps { provider: string; } -export default class SocialButton extends Component {} +declare const SocialButton: FC; +export default SocialButton; diff --git a/components/Socials/index.d.ts b/components/Socials/index.d.ts index 6e5a35e0b..d5189263b 100644 --- a/components/Socials/index.d.ts +++ b/components/Socials/index.d.ts @@ -1,4 +1,4 @@ -import { Component } from 'react'; +import { FC } from 'react'; export type NonEmptyArray = [T, ...T[]]; @@ -15,4 +15,5 @@ export interface SocialsProps { withBox?: boolean; } -export default class Socials extends Component {} +declare const Socials: FC; +export default Socials; diff --git a/components/Stepper/index.d.ts b/components/Stepper/index.d.ts index 20d3b14e4..79a855ed6 100644 --- a/components/Stepper/index.d.ts +++ b/components/Stepper/index.d.ts @@ -18,3 +18,4 @@ export interface StepperProps { } declare const Stepper: FC; +export default Stepper; diff --git a/components/TabbedView/index.d.ts b/components/TabbedView/index.d.ts index 84ec69594..08bdf2b5b 100644 --- a/components/TabbedView/index.d.ts +++ b/components/TabbedView/index.d.ts @@ -1,4 +1,4 @@ -import { Component, ReactNode } from 'react'; +import { FC, ReactNode } from 'react'; export interface TabProps { title: string; @@ -7,7 +7,6 @@ export interface TabProps { children: ReactNode[] | ReactNode; } -export type Tab = Component; export interface TabbedViewProps { fluid?: boolean; @@ -25,6 +24,9 @@ export interface TabbedViewProps { onTabClick?: () => void; } -export default class TabbedView extends Component { - static Tab: Tab; +declare const Tab: FC; +declare const TabbedView: FC & { + Tab: typeof Tab; } + +export default TabbedView; \ No newline at end of file diff --git a/components/Tag/index.d.ts b/components/Tag/index.d.ts index 9d66f09ff..74fafcf98 100644 --- a/components/Tag/index.d.ts +++ b/components/Tag/index.d.ts @@ -1,6 +1,6 @@ -import { Component, ReactNode, MouseEventHandler } from 'react'; +import { ReactNode, MouseEventHandler, FC, HTMLAttributes } from 'react'; -export interface TagProps { +export interface TagProps extends HTMLAttributes { bold?: boolean; inverted?: boolean; children?: ReactNode[] | ReactNode; @@ -18,4 +18,5 @@ export interface TagProps { }; } -export default class Tag extends Component {} +declare const Tag: FC; +export default Tag; diff --git a/components/TextArea/index.d.ts b/components/TextArea/index.d.ts index 9601c78dd..b192bea9a 100644 --- a/components/TextArea/index.d.ts +++ b/components/TextArea/index.d.ts @@ -1,6 +1,6 @@ -import { Component, ChangeEventHandler, TextareaHTMLAttributes } from 'react'; +import { FC, ChangeEventHandler, TextareaHTMLAttributes } from 'react'; -export interface TextAreaProps extends TextareaHTMLAttributes { +export interface TextAreaProps extends Omit, "onChange" | "id"> { disabled?: boolean; isAutoResize?: boolean; autoResizeConfig?: { @@ -24,4 +24,5 @@ export interface TextAreaProps extends TextareaHTMLAttributes {} +declare const TextArea: FC; +export default TextArea; diff --git a/components/Toggle/index.d.ts b/components/Toggle/index.d.ts index 61ef7fc7a..2dd95a5db 100644 --- a/components/Toggle/index.d.ts +++ b/components/Toggle/index.d.ts @@ -1,6 +1,6 @@ -import { Component, ChangeEventHandler } from 'react'; +import { ChangeEventHandler, FC, HTMLAttributes } from 'react'; -export interface ToggleProps { +export interface ToggleProps extends HTMLAttributes{ onChange?: ChangeEventHandler; id?: string; checked?: boolean; @@ -11,4 +11,5 @@ export interface ToggleProps { }; } -export default class Toggle extends Component {} +declare const Toggle: FC; +export default Toggle; diff --git a/components/Tooltip/index.d.ts b/components/Tooltip/index.d.ts index f38f71b2f..6a28b3483 100644 --- a/components/Tooltip/index.d.ts +++ b/components/Tooltip/index.d.ts @@ -1,4 +1,4 @@ -import { Component, ReactNode } from 'react'; +import { FC, ReactNode } from 'react'; export interface TooltipProps { text: string; @@ -13,4 +13,5 @@ export interface TooltipProps { }; } -export default class Tooltip extends Component {} +declare const Tooltip: FC; +export default Tooltip; diff --git a/components/index.d.ts b/components/index.d.ts index 3ff026d22..12070004c 100644 --- a/components/index.d.ts +++ b/components/index.d.ts @@ -10,16 +10,16 @@ import { default as BadgeComponent, BadgeProps } from "./Badge" import { default as BreadcrumbsComponent, BreadcrumbsProps } from "./Breadcrumbs" import { default as ButtonComponent, ButtonProps } from "./Button" import { default as SocialButtonComponent, SocialButtonProps } from "./SocialButton" -import { default as CardComponent, Props as CardProps } from "./Card" +import { default as CardComponent, CardProps } from "./Card" import { default as ChargeBarComponent, ChargeBarProps } from "./ChargeBar" -import { Checkbox as CheckboxComponent, CheckboxGroup as CheckboxGroupComponent, CheckboxProps, CheckboxGroupProps } from './Checkbox'; +import { default as CheckboxComponent, CheckboxGroup as CheckboxGroupComponent, CheckboxProps, CheckboxGroupProps } from './Checkbox'; import { default as CircularLoaderComponent, CircularLoaderProps } from "./CircularLoader" import { default as DialogComponent, DialogProps } from "./Dialog" import { default as DropdownComponent, DropdownProps } from "./Dropdown" import { default as DropdownLightComponent, DropdownLightProps } from "./DropdownLight" -import { Container as ContainerComponent, Col as ColComponent, Row as RowComponent, ColProps, RowProps, ContainerProps } from './Grid'; +import { Container as ContainerComponent, Col as ColComponent, Row as RowComponent, Hide as HideComponent, ColProps, RowProps, ContainerProps, HideProps } from './Grid'; import { default as HamburgerComponent, HamburgerProps } from "./Hamburger" -import { default as Icon, IconProps } from "./Icon" +import { default as IconComponent, IconProps } from "./Icon" import { default as InputComponent, InputProps } from "./Input" import { default as LinkComponent, LinkProps } from "./Link" import { default as ListComponent, ListProps } from "./List" @@ -32,22 +32,21 @@ import { default as RangeSliderComponent, RangeSliderProps } from "./RangeSlider import { default as SnackBarComponent, SnackBarProps } from "./SnackBar" import { default as SocialsComponent, SocialsProps } from "./Socials" import { default as StepperComponent, StepperProps } from "./Stepper" -import { TabbedView as TabbedViewComponent, TabbedViewProps } from './TabbedView'; +import { TabbedView as TabbedViewComponent, Tab as TabComponent, TabbedViewProps, TabProps } from './TabbedView'; import { default as TagComponent, TagProps } from "./Tag" import { default as TextAreaComponent, TextAreaProps } from "./TextArea" import { default as ToggleComponent, ToggleProps } from "./Toggle" import { default as TooltipComponent, TooltipProps } from "./Tooltip" import { default as SegmentedControlComponent, SegmentedControlProps } from "./SegmentedControl" import { default as CarouselComponent, CarouselProps } from "./Carousel" +import { default as InfiniteScrollComponent, InfiniteScrollProps } from "./InfiniteScroll" +import { default as SkeletonComponent, SkeletonProps } from "./Skeleton"; export { default as BREAKPOINTS } from './Breakpoints'; export { default as Colors } from "./Colors" export { Form, Validations } from './Form'; export { default as GlobalStyle, IconFont, Typography } from "./GlobalStyle" -export { Hide } from './Grid'; export { default as shared } from "./shared" -export { default as Skeleton } from "./Skeleton" -export { Tab } from './TabbedView' export const Accordion: StyledComponent; export const Alert: StyledComponent; @@ -66,6 +65,7 @@ export const Dropdown: StyledComponent; export const Container: StyledComponent; export const Col: StyledComponent; export const Row: StyledComponent; +export const Hide: StyledComponent; export const Hamburger: StyledComponent; export const Icon: StyledComponent; export const Input: StyledComponent; @@ -79,8 +79,10 @@ export const RadioGroup: StyledComponent; export const SnackBar: StyledComponent; export const Socials: StyledComponent; +export const Skeleton: StyledComponent; export const Stepper: StyledComponent; export const TabbedView: StyledComponent; +export const TabView: StyledComponent; export const Tag: StyledComponent; export const TextArea: StyledComponent; export const Toggle: StyledComponent; From 6249be803ba28b3f192751aaf9566e1f706b061a Mon Sep 17 00:00:00 2001 From: Marcos Conceicao Date: Tue, 13 Jun 2023 12:21:49 -0300 Subject: [PATCH 3/6] chore: Updated eslint config for ts --- .eslintrc.json | 12 +++++- package.json | 1 + yarn.lock | 108 ++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 118 insertions(+), 3 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index cfc42e2a1..17be02375 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -4,7 +4,7 @@ "env": { "jest": true }, - "parser": ["babel-eslint", "@typescript-eslint/parser"], + "parser": "babel-eslint", "rules": { "strict": 0, "import/no-extraneous-dependencies": 0, @@ -43,5 +43,13 @@ "globals": { "window": true, "document": true - } + }, + "overrides": [ + { + "files": "*.d.ts", + "excludedFiles": ["*.js, *.jsx"], + "parser": "@typescript-eslint/parser", + "plugins": ["@typescript-eslint"] + } + ] } diff --git a/package.json b/package.json index 143c49f4c..8a95b2780 100644 --- a/package.json +++ b/package.json @@ -68,6 +68,7 @@ "@testing-library/jest-dom": "^5.16.1", "@testing-library/react": "^12.1.2", "@testing-library/user-event": "^13.5.0", + "@typescript-eslint/eslint-plugin": "^5.59.11", "@typescript-eslint/parser": "^5.59.9", "all-contributors-cli": "^6.8.0", "babel-core": "^7.0.0-bridge.0", diff --git a/yarn.lock b/yarn.lock index f1b85b141..baf94db97 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1271,6 +1271,18 @@ resolved "https://registry.yarnpkg.com/@emotion/unitless/-/unitless-0.7.5.tgz#77211291c1900a700b8a78cfafda3160d76949ed" integrity sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg== +"@eslint-community/eslint-utils@^4.2.0": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" + integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== + dependencies: + eslint-visitor-keys "^3.3.0" + +"@eslint-community/regexpp@^4.4.0": + version "4.5.1" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.5.1.tgz#cdd35dce4fa1a89a4fd42b1599eb35b3af408884" + integrity sha512-Z5ba73P98O1KUYCCJTUeVpja9RcGoMdncZ6T49FCUl2lN38JtCJ+3WgIDBv0AuY4WChU5PmtJmOCTlN6FZTFKQ== + "@gar/promisify@^1.0.1", "@gar/promisify@^1.1.3": version "1.1.3" resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6" @@ -3467,6 +3479,11 @@ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== +"@types/json-schema@^7.0.9": + version "7.0.12" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.12.tgz#d70faba7039d5fca54c83c7dbab41051d2b6f6cb" + integrity sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA== + "@types/json5@^0.0.29": version "0.0.29" resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" @@ -3599,6 +3616,11 @@ resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.3.tgz#cef09e3ec9af1d63d2a6cc5b383a737e24e6dcf5" integrity sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ== +"@types/semver@^7.3.12": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.0.tgz#591c1ce3a702c45ee15f47a42ade72c2fd78978a" + integrity sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw== + "@types/source-list-map@*": version "0.1.2" resolved "https://registry.yarnpkg.com/@types/source-list-map/-/source-list-map-0.1.2.tgz#0078836063ffaf17412349bba364087e0ac02ec9" @@ -3690,6 +3712,22 @@ resolved "https://registry.yarnpkg.com/@types/yoga-layout/-/yoga-layout-1.9.2.tgz#efaf9e991a7390dc081a0b679185979a83a9639a" integrity sha512-S9q47ByT2pPvD65IvrWp7qppVMpk9WGMbVq9wbWZOHg6tnXSD4vyhao6nOSBwwfDdV2p3Kx9evA9vI+XWTfDvw== +"@typescript-eslint/eslint-plugin@^5.59.11": + version "5.59.11" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.11.tgz#8d466aa21abea4c3f37129997b198d141f09e76f" + integrity sha512-XxuOfTkCUiOSyBWIvHlUraLw/JT/6Io1365RO6ZuI88STKMavJZPNMU0lFcUTeQXEhHiv64CbxYxBNoDVSmghg== + dependencies: + "@eslint-community/regexpp" "^4.4.0" + "@typescript-eslint/scope-manager" "5.59.11" + "@typescript-eslint/type-utils" "5.59.11" + "@typescript-eslint/utils" "5.59.11" + debug "^4.3.4" + grapheme-splitter "^1.0.4" + ignore "^5.2.0" + natural-compare-lite "^1.4.0" + semver "^7.3.7" + tsutils "^3.21.0" + "@typescript-eslint/parser@^5.59.9": version "5.59.9" resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.59.9.tgz#a85c47ccdd7e285697463da15200f9a8561dd5fa" @@ -3700,6 +3738,14 @@ "@typescript-eslint/typescript-estree" "5.59.9" debug "^4.3.4" +"@typescript-eslint/scope-manager@5.59.11": + version "5.59.11" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.59.11.tgz#5d131a67a19189c42598af9fb2ea1165252001ce" + integrity sha512-dHFOsxoLFtrIcSj5h0QoBT/89hxQONwmn3FOQ0GOQcLOOXm+MIrS8zEAhs4tWl5MraxCY3ZJpaXQQdFMc2Tu+Q== + dependencies: + "@typescript-eslint/types" "5.59.11" + "@typescript-eslint/visitor-keys" "5.59.11" + "@typescript-eslint/scope-manager@5.59.9": version "5.59.9" resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.59.9.tgz#eadce1f2733389cdb58c49770192c0f95470d2f4" @@ -3708,11 +3754,39 @@ "@typescript-eslint/types" "5.59.9" "@typescript-eslint/visitor-keys" "5.59.9" +"@typescript-eslint/type-utils@5.59.11": + version "5.59.11" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.59.11.tgz#5eb67121808a84cb57d65a15f48f5bdda25f2346" + integrity sha512-LZqVY8hMiVRF2a7/swmkStMYSoXMFlzL6sXV6U/2gL5cwnLWQgLEG8tjWPpaE4rMIdZ6VKWwcffPlo1jPfk43g== + dependencies: + "@typescript-eslint/typescript-estree" "5.59.11" + "@typescript-eslint/utils" "5.59.11" + debug "^4.3.4" + tsutils "^3.21.0" + +"@typescript-eslint/types@5.59.11": + version "5.59.11" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.59.11.tgz#1a9018fe3c565ba6969561f2a49f330cf1fe8db1" + integrity sha512-epoN6R6tkvBYSc+cllrz+c2sOFWkbisJZWkOE+y3xHtvYaOE6Wk6B8e114McRJwFRjGvYdJwLXQH5c9osME/AA== + "@typescript-eslint/types@5.59.9": version "5.59.9" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.59.9.tgz#3b4e7ae63718ce1b966e0ae620adc4099a6dcc52" integrity sha512-uW8H5NRgTVneSVTfiCVffBb8AbwWSKg7qcA4Ot3JI3MPCJGsB4Db4BhvAODIIYE5mNj7Q+VJkK7JxmRhk2Lyjw== +"@typescript-eslint/typescript-estree@5.59.11": + version "5.59.11" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.11.tgz#b2caaa31725e17c33970c1197bcd54e3c5f42b9f" + integrity sha512-YupOpot5hJO0maupJXixi6l5ETdrITxeo5eBOeuV7RSKgYdU3G5cxO49/9WRnJq9EMrB7AuTSLH/bqOsXi7wPA== + dependencies: + "@typescript-eslint/types" "5.59.11" + "@typescript-eslint/visitor-keys" "5.59.11" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + semver "^7.3.7" + tsutils "^3.21.0" + "@typescript-eslint/typescript-estree@5.59.9": version "5.59.9" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.9.tgz#6bfea844e468427b5e72034d33c9fffc9557392b" @@ -3726,6 +3800,28 @@ semver "^7.3.7" tsutils "^3.21.0" +"@typescript-eslint/utils@5.59.11": + version "5.59.11" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.59.11.tgz#9dbff49dc80bfdd9289f9f33548f2e8db3c59ba1" + integrity sha512-didu2rHSOMUdJThLk4aZ1Or8IcO3HzCw/ZvEjTTIfjIrcdd5cvSIwwDy2AOlE7htSNp7QIZ10fLMyRCveesMLg== + dependencies: + "@eslint-community/eslint-utils" "^4.2.0" + "@types/json-schema" "^7.0.9" + "@types/semver" "^7.3.12" + "@typescript-eslint/scope-manager" "5.59.11" + "@typescript-eslint/types" "5.59.11" + "@typescript-eslint/typescript-estree" "5.59.11" + eslint-scope "^5.1.1" + semver "^7.3.7" + +"@typescript-eslint/visitor-keys@5.59.11": + version "5.59.11" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.11.tgz#dca561ddad169dc27d62396d64f45b2d2c3ecc56" + integrity sha512-KGYniTGG3AMTuKF9QBD7EIrvufkB6O6uX3knP73xbKLMpH+QRPcgnCxjWXSHjMRuOxFLovljqQgQpR0c7GvjoA== + dependencies: + "@typescript-eslint/types" "5.59.11" + eslint-visitor-keys "^3.3.0" + "@typescript-eslint/visitor-keys@5.59.9": version "5.59.9" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.9.tgz#9f86ef8e95aca30fb5a705bb7430f95fc58b146d" @@ -7453,7 +7549,7 @@ eslint-plugin-react@^7.12.3: semver "^6.3.0" string.prototype.matchall "^4.0.8" -eslint-scope@5.1.1: +eslint-scope@5.1.1, eslint-scope@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== @@ -8640,6 +8736,11 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6 resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== +grapheme-splitter@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz#9cf3a665c6247479896834af35cf1dbb4400767e" + integrity sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ== + handlebars@^4.7.7: version "4.7.7" resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.7.tgz#9ce33416aad02dbd6c8fafa8240d5d98004945a1" @@ -11962,6 +12063,11 @@ nanomatch@^1.2.9: snapdragon "^0.8.1" to-regex "^3.0.1" +natural-compare-lite@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz#17b09581988979fddafe0201e931ba933c96cbb4" + integrity sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g== + natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" From d795540f395adb86944f9f49f8b8f491a1a8621a Mon Sep 17 00:00:00 2001 From: Marcos Conceicao Date: Wed, 14 Jun 2023 18:08:49 -0300 Subject: [PATCH 4/6] chore: Fixed types --- components/Breakpoints/index.d.ts | 4 +- components/Card/Content.d.ts | 8 +- components/Card/Description.d.ts | 8 +- components/Card/Footer.d.ts | 8 +- components/Card/Header.d.ts | 8 +- components/Card/HeaderText.d.ts | 8 +- components/Card/Media.d.ts | 4 +- components/Card/Thumbnail.d.ts | 8 +- components/Card/Title.d.ts | 8 +- components/Card/index.d.ts | 32 +-- components/Carousel/index.d.ts | 3 +- components/RadioGroup/index.d.ts | 4 +- components/Socials/index.d.ts | 3 +- components/TabbedView/index.d.ts | 10 +- components/index.d.ts | 8 +- components/shared/ErrorMessage.d.ts | 12 + components/shared/FieldGroup.d.ts | 12 + components/shared/HiddenInput.d.ts | 5 + components/shared/Label.d.ts | 5 + components/shared/breakpoints.d.ts | 22 ++ components/shared/helpers.d.ts | 2 + components/shared/hexToRgba.d.ts | 2 + components/shared/icons.d.ts | 3 + components/shared/index.d.ts | 29 +++ components/shared/masks.d.ts | 11 + components/shared/normalizeChars.d.ts | 3 + components/shared/shadow.d.ts | 8 + components/shared/theme.d.ts | 339 ++++++++++++++++++++++++++ components/shared/theme.js | 1 + components/shared/types.d.ts | 1 + components/shared/uniqId.d.ts | 1 + package.json | 4 +- 32 files changed, 512 insertions(+), 72 deletions(-) create mode 100644 components/shared/ErrorMessage.d.ts create mode 100644 components/shared/FieldGroup.d.ts create mode 100644 components/shared/HiddenInput.d.ts create mode 100644 components/shared/Label.d.ts create mode 100644 components/shared/breakpoints.d.ts create mode 100644 components/shared/helpers.d.ts create mode 100644 components/shared/hexToRgba.d.ts create mode 100644 components/shared/icons.d.ts create mode 100644 components/shared/index.d.ts create mode 100644 components/shared/masks.d.ts create mode 100644 components/shared/normalizeChars.d.ts create mode 100644 components/shared/shadow.d.ts create mode 100644 components/shared/theme.d.ts create mode 100644 components/shared/types.d.ts create mode 100644 components/shared/uniqId.d.ts diff --git a/components/Breakpoints/index.d.ts b/components/Breakpoints/index.d.ts index b636c7623..9de5a3a9e 100644 --- a/components/Breakpoints/index.d.ts +++ b/components/Breakpoints/index.d.ts @@ -16,6 +16,6 @@ export interface Breakpoints { columns: number; }; } -declare const breakPoints: Breakpoints; +declare const breakpoints: Breakpoints; -export default breakPoints; +export default breakpoints; diff --git a/components/Card/Content.d.ts b/components/Card/Content.d.ts index ea2c5771b..b24241db8 100644 --- a/components/Card/Content.d.ts +++ b/components/Card/Content.d.ts @@ -1,12 +1,10 @@ -import { FC, ReactNode } from 'react'; +import { FC, HTMLAttributes, ReactNode } from 'react'; -export interface ContentProps { +export interface ContentProps extends HTMLAttributes { theme?: { baseFontSize?: number; spacing?: object }; children: ReactNode | ReactNode[]; } -declare const Content: FC & { - displayName: 'Card.Content'; -}; +declare const Content: FC; export default Content; \ No newline at end of file diff --git a/components/Card/Description.d.ts b/components/Card/Description.d.ts index 202b3ae15..c02bf8178 100644 --- a/components/Card/Description.d.ts +++ b/components/Card/Description.d.ts @@ -1,13 +1,11 @@ -import { ReactNode, FC } from 'react'; +import { ReactNode, FC, HTMLAttributes } from 'react'; -export interface DescriptionProps { +export interface DescriptionProps extends HTMLAttributes { small?: boolean; theme?: { baseFontSize?: number; spacing?: object }; children: ReactNode | ReactNode[]; } -declare const Description: FC & { - displayName: 'Card.Description'; -}; +declare const Description: FC; export default Description; diff --git a/components/Card/Footer.d.ts b/components/Card/Footer.d.ts index f5403b79a..87cdc10c6 100644 --- a/components/Card/Footer.d.ts +++ b/components/Card/Footer.d.ts @@ -1,12 +1,10 @@ -import { FC, ReactNode } from 'react'; +import { FC, HTMLAttributes, ReactNode } from 'react'; -export interface FooterProps { +export interface FooterProps extends HTMLAttributes { theme?: { spacing?: object }; children: ReactNode | ReactNode[]; } -declare const Footer: FC & { - displayName: 'Card.Footer'; -}; +declare const Footer: FC; export default Footer; diff --git a/components/Card/Header.d.ts b/components/Card/Header.d.ts index e3086e268..45179c9dc 100644 --- a/components/Card/Header.d.ts +++ b/components/Card/Header.d.ts @@ -1,12 +1,10 @@ -import { FC, ReactNode } from 'react'; +import { FC, HTMLAttributes, ReactNode } from 'react'; -export interface HeaderProps { +export interface HeaderProps extends HTMLAttributes { theme?: { spacing?: object }; children: ReactNode | ReactNode[]; } -declare const Header: FC & { - displayName: 'Card.Header'; -}; +declare const Header: FC; export default Header; diff --git a/components/Card/HeaderText.d.ts b/components/Card/HeaderText.d.ts index 8f59b408e..e3245d147 100644 --- a/components/Card/HeaderText.d.ts +++ b/components/Card/HeaderText.d.ts @@ -1,11 +1,9 @@ -import { FC, ReactNode } from 'react'; +import { FC, HTMLAttributes, ReactNode } from 'react'; -export interface HeaderTextProps { +export interface HeaderTextProps extends HTMLAttributes { children: ReactNode | ReactNode[]; } -declare const HeaderText: FC & { - displayName: 'Card.HeaderText'; -}; +declare const HeaderText: FC; export default HeaderText; diff --git a/components/Card/Media.d.ts b/components/Card/Media.d.ts index a76d529c3..b2c29b357 100644 --- a/components/Card/Media.d.ts +++ b/components/Card/Media.d.ts @@ -4,8 +4,6 @@ export interface MediaProps extends HTMLAttributes { theme?: { colors?: {}; spacing?: {} }; } -declare const Media: FC & { - displayName: "Card.Media"; -}; +declare const Media: FC; export default Media; diff --git a/components/Card/Thumbnail.d.ts b/components/Card/Thumbnail.d.ts index 87f934d81..70fe6df0d 100644 --- a/components/Card/Thumbnail.d.ts +++ b/components/Card/Thumbnail.d.ts @@ -1,14 +1,12 @@ -import { FC } from 'react'; +import { FC, HTMLAttributes } from 'react'; -export interface ThumbnailProps { +export interface ThumbnailProps extends HTMLAttributes { src: string; alt: string; rounded?: boolean; theme?: { colors?: object }; } -declare const Thumbnail: FC & { - displayName: "Card.Thumbnail"; -}; +declare const Thumbnail: FC; export default Thumbnail; diff --git a/components/Card/Title.d.ts b/components/Card/Title.d.ts index c6ecedee9..5bfd3b40b 100644 --- a/components/Card/Title.d.ts +++ b/components/Card/Title.d.ts @@ -1,12 +1,10 @@ -import { FC } from 'react'; +import { FC, HTMLAttributes } from 'react'; -export interface TitleProps { +export interface TitleProps extends HTMLAttributes { small?: boolean; theme?: { baseFontSize?: object }; } -declare const Title: FC & { - displayName: "Card.Title"; -}; +declare const Title: FC; export default Title; \ No newline at end of file diff --git a/components/Card/index.d.ts b/components/Card/index.d.ts index cab661ba1..6061e72c3 100644 --- a/components/Card/index.d.ts +++ b/components/Card/index.d.ts @@ -1,12 +1,12 @@ import { FC, MouseEvent } from 'react'; -import { ContentProps } from './Content'; -import { DescriptionProps } from './Description'; -import { FooterProps } from './Footer'; -import { HeaderProps } from './Header'; -import { HeaderTextProps } from './HeaderText'; -import { MediaProps } from './Media'; -import { ThumbnailProps } from './Thumbnail'; -import { TitleProps } from './Title'; +import Content from './Content'; +import Description from './Description'; +import Footer from './Footer'; +import Header from './Header'; +import HeaderText from './HeaderText'; +import Media from './Media'; +import Thumbnail from './Thumbnail'; +import Title from './Title'; export interface CardProps { onClick?: (e: MouseEvent) => void; @@ -17,14 +17,14 @@ export interface CardProps { } declare const Card: FC & { - Content: FC; - Description: FC; - Footer: FC; - Header: FC; - HeaderText: FC; - Media: FC; - Thumbnail: FC; - Title: FC; + Content: typeof Content; + Description: typeof Description; + Footer: typeof Footer; + Header: typeof Header; + HeaderText: typeof HeaderText; + Media: typeof Media; + Thumbnail: typeof Thumbnail; + Title: typeof Title; } export default Card; diff --git a/components/Carousel/index.d.ts b/components/Carousel/index.d.ts index a956e38fc..a03a0ebd3 100644 --- a/components/Carousel/index.d.ts +++ b/components/Carousel/index.d.ts @@ -1,6 +1,5 @@ import { FC } from 'react'; - -export type NonEmptyArray = [T, ...T[]]; +import { NonEmptyArray } from '../shared/types'; export interface CarouselProps { dotsPagination?: boolean, diff --git a/components/RadioGroup/index.d.ts b/components/RadioGroup/index.d.ts index f73b826fb..7d84cdd21 100644 --- a/components/RadioGroup/index.d.ts +++ b/components/RadioGroup/index.d.ts @@ -1,4 +1,4 @@ -import { FC, ReactNode, ChangeEventHandler, ComponentType } from 'react'; +import { FC, ReactNode, ChangeEventHandler, ComponentType, FormEvent } from 'react'; import { IconNames } from '../Icon'; export interface RadioProps { @@ -48,7 +48,7 @@ export interface RadioGroupProps { }>; children?: ReactNode[] | ReactNode; inline?: boolean; - onChange?: () => {} | ChangeEventHandler; + onChange?: (values: { value: string; label: string }, event: FormEvent) => void; defaultValue?: string; name: string; error?: string; diff --git a/components/Socials/index.d.ts b/components/Socials/index.d.ts index d5189263b..e0907438d 100644 --- a/components/Socials/index.d.ts +++ b/components/Socials/index.d.ts @@ -1,6 +1,5 @@ import { FC } from 'react'; - -export type NonEmptyArray = [T, ...T[]]; +import { NonEmptyArray } from '../shared/types'; export interface SocialsProps { size?: string; diff --git a/components/TabbedView/index.d.ts b/components/TabbedView/index.d.ts index 08bdf2b5b..79c5c7ff4 100644 --- a/components/TabbedView/index.d.ts +++ b/components/TabbedView/index.d.ts @@ -1,4 +1,5 @@ import { FC, ReactNode } from 'react'; +import { baseFontSizeType, breakpointsProps, colorsProps, componentsProps, spacingProps } from '../shared/theme'; export interface TabProps { title: string; @@ -15,11 +16,11 @@ export interface TabbedViewProps { skin?: 'neutral' | 'primary'; theme?: { components?: { - tabbedView?: {}; + tabbedView?: componentsProps["tabbedView"]; }; - baseFontSize?: number; - breakpoints?: {}; - spacing?: {}; + baseFontSize?: baseFontSizeType; + breakpoints?: breakpointsProps; + spacing?: spacingProps; }; onTabClick?: () => void; } @@ -29,4 +30,5 @@ declare const TabbedView: FC & { Tab: typeof Tab; } +export { TabbedView, Tab}; export default TabbedView; \ No newline at end of file diff --git a/components/index.d.ts b/components/index.d.ts index 12070004c..a866fcf3a 100644 --- a/components/index.d.ts +++ b/components/index.d.ts @@ -43,10 +43,10 @@ import { default as InfiniteScrollComponent, InfiniteScrollProps } from "./Infin import { default as SkeletonComponent, SkeletonProps } from "./Skeleton"; export { default as BREAKPOINTS } from './Breakpoints'; -export { default as Colors } from "./Colors" -export { Form, Validations } from './Form'; -export { default as GlobalStyle, IconFont, Typography } from "./GlobalStyle" -export { default as shared } from "./shared" +export { default as Colors } from "./Colors"; +export { default as Form, Validations } from './Form'; +export { default as GlobalStyle, Typography } from "./GlobalStyle"; +export { default as shared } from "./shared"; export const Accordion: StyledComponent; export const Alert: StyledComponent; diff --git a/components/shared/ErrorMessage.d.ts b/components/shared/ErrorMessage.d.ts new file mode 100644 index 000000000..b79ded02f --- /dev/null +++ b/components/shared/ErrorMessage.d.ts @@ -0,0 +1,12 @@ +import {FC, HTMLAttributes } from "react"; + +interface ErrorMessageProps extends HTMLAttributes{ + theme?: { + spacing?: object; + colors?: object; + } +} + +declare const ErrorMessage: FC; + +export default ErrorMessage; \ No newline at end of file diff --git a/components/shared/FieldGroup.d.ts b/components/shared/FieldGroup.d.ts new file mode 100644 index 000000000..b65f8eba9 --- /dev/null +++ b/components/shared/FieldGroup.d.ts @@ -0,0 +1,12 @@ +import { FC, HTMLAttributes } from "react"; + +interface FieldGroupProps extends HTMLAttributes{ + theme?: { + colors?: object; + } + skin: 'default' | string; +} + +declare const FieldGroup: FC; + +export default FieldGroup; \ No newline at end of file diff --git a/components/shared/HiddenInput.d.ts b/components/shared/HiddenInput.d.ts new file mode 100644 index 000000000..5bcc8deef --- /dev/null +++ b/components/shared/HiddenInput.d.ts @@ -0,0 +1,5 @@ +import { FC, HTMLAttributes } from "react"; + +declare const HiddenInput: FC>; + +export default HiddenInput; \ No newline at end of file diff --git a/components/shared/Label.d.ts b/components/shared/Label.d.ts new file mode 100644 index 000000000..6084ee28d --- /dev/null +++ b/components/shared/Label.d.ts @@ -0,0 +1,5 @@ +import { FC, HTMLAttributes } from "react"; + +declare const Label: FC>; + +export default Label; \ No newline at end of file diff --git a/components/shared/breakpoints.d.ts b/components/shared/breakpoints.d.ts new file mode 100644 index 000000000..8860985d1 --- /dev/null +++ b/components/shared/breakpoints.d.ts @@ -0,0 +1,22 @@ + +interface BreakpointsProps { + xsmall: { + width: number; + columns: number; + }, + small: { + width: number; + columns: number; + }, + medium: { + width: number; + columns: number; + }, + large: { + width: number; + columns: number; + } +} + +declare const breakpoints: BreakpointsProps; +export default breakpoints; \ No newline at end of file diff --git a/components/shared/helpers.d.ts b/components/shared/helpers.d.ts new file mode 100644 index 000000000..99ed7a86e --- /dev/null +++ b/components/shared/helpers.d.ts @@ -0,0 +1,2 @@ +declare const matchMediaMock: (match?: boolean) => Window & typeof globalThis; +export default matchMediaMock; \ No newline at end of file diff --git a/components/shared/hexToRgba.d.ts b/components/shared/hexToRgba.d.ts new file mode 100644 index 000000000..aba695a1b --- /dev/null +++ b/components/shared/hexToRgba.d.ts @@ -0,0 +1,2 @@ +declare const hexToRgba: (hex: any, opacity?: number) => string; +export default hexToRgba; \ No newline at end of file diff --git a/components/shared/icons.d.ts b/components/shared/icons.d.ts new file mode 100644 index 000000000..11b6ee029 --- /dev/null +++ b/components/shared/icons.d.ts @@ -0,0 +1,3 @@ +declare const icons: readonly string[]; + +export default icons; \ No newline at end of file diff --git a/components/shared/index.d.ts b/components/shared/index.d.ts new file mode 100644 index 000000000..3208261f0 --- /dev/null +++ b/components/shared/index.d.ts @@ -0,0 +1,29 @@ +import ErrorMessage from './ErrorMessage'; +import Label from './Label'; +import FieldGroup from './FieldGroup'; +import icons from './icons'; +import masks from './masks'; +import * as theme from './theme'; +import BREAKPOINTS from './breakpoints'; +import * as INPUT_STYLE from './inputStyle'; +import hexToRgba from './hexToRgba'; +import shadow from './shadow'; +import HiddenInput from './HiddenInput'; +import normalizeChars from './normalizeChars'; + +export * from './uniqId'; + +export { + ErrorMessage, + Label, + FieldGroup, + icons, + masks, + theme, + BREAKPOINTS, + INPUT_STYLE, + hexToRgba, + shadow, + HiddenInput, + normalizeChars, +}; diff --git a/components/shared/masks.d.ts b/components/shared/masks.d.ts new file mode 100644 index 000000000..993262ff2 --- /dev/null +++ b/components/shared/masks.d.ts @@ -0,0 +1,11 @@ +interface maskProps { + cep: (string | RegExp)[]; + cnpj: (string | RegExp)[]; + cpf: (string | RegExp)[]; + date: (string | RegExp)[]; + phone: (userInput: any) => (string | RegExp)[]; +} + +declare const mask: maskProps; + +export default mask; \ No newline at end of file diff --git a/components/shared/normalizeChars.d.ts b/components/shared/normalizeChars.d.ts new file mode 100644 index 000000000..73475afa9 --- /dev/null +++ b/components/shared/normalizeChars.d.ts @@ -0,0 +1,3 @@ +declare const normalizeChars: (value: string) => string; + +export default normalizeChars; \ No newline at end of file diff --git a/components/shared/shadow.d.ts b/components/shared/shadow.d.ts new file mode 100644 index 000000000..42a825d87 --- /dev/null +++ b/components/shared/shadow.d.ts @@ -0,0 +1,8 @@ +type shadowWithThemeType = (styledParams: object, elevation: string, color?: string) => string; +type shadowType = (elevation?: number, color?: string) => (styledParams: object) => shadowWithThemeType; + +declare const shadowWithTheme: (styledParams: object) => shadowWithThemeType; +declare const shadow: shadowType + +export { shadowWithTheme }; +export default shadow; \ No newline at end of file diff --git a/components/shared/theme.d.ts b/components/shared/theme.d.ts new file mode 100644 index 000000000..009b9530b --- /dev/null +++ b/components/shared/theme.d.ts @@ -0,0 +1,339 @@ +export interface breakpointsProps { + xsmall: { + width: number; + columns: number; + }; + small: { + width: number; + columns: number; + }; + medium: { + width: number; + columns: number; + }; + large: { + width: number; + columns: number; + }; +} + +export interface colorsProps { + primary: { + 100: string; + 300: string; + 500: string; + 700: string; + 900: string; + }; + secondary: { + 100: string; + 300: string; + 500: string; + 700: string; + 900: string; + }; + success: { + 100: string; + 300: string; + 500: string; + 700: string; + 900: string; + }; + warning: { + 100: string; + 300: string; + 500: string; + 700: string; + 900: string; + }; + error: { + 100: string; + 300: string; + 500: string; + 700: string; + 900: string; + }; + neutral: { + 0: string; + 100: string; + 300: string; + 500: string; + 700: string; + 900: string; + 1000: string; + }; +} + +export type gutterType = number; +export type baseFontSizeType = number; + +export interface spacingProps { + xxxsmall: number; + xxsmall: number; + xsmall: number; + small: number; + medium: number; + large: number; + xlarge: number; + xxlarge: number; + xxxlarge: number; +} + + +export interface componentsProps { + button: { + skins: { + neutral: { + mainColor: colorsProps["neutral"]; + text: colorsProps["neutral"]; + }; + primary: { + mainColor: colorsProps["primary"]; + text: colorsProps["neutral"]; + }; + secondary: { + mainColor: colorsProps["secondary"]; + text: colorsProps["neutral"]; + }; + success: { + mainColor: colorsProps["success"]; + text: colorsProps["neutral"]; + }; + warning: { + mainColor: colorsProps["warning"]; + text: colorsProps["neutral"]; + }; + error: { + mainColor: colorsProps["error"]; + text: colorsProps["neutral"]; + }; + }; + }; + badge: { + skins: { + neutral: { + background: colorsProps["neutral"][100]; + text: colorsProps["neutral"][700]; + }; + primary: { + background: colorsProps["primary"][700]; + text: colorsProps["neutral"][100]; + }; + secondary: { + background: colorsProps["secondary"][500]; + text: colorsProps["neutral"][0]; + }; + error: { + background: colorsProps["error"][500]; + text: colorsProps["neutral"][100]; + }; + success: { + background: colorsProps["success"][100]; + text: colorsProps["success"][900]; + }; + }; + }; + container: { + breakpoints: { + xsmall: string; + small: string; + medium: string; + large: string; + }; + }; + tag: { + skins: { + neutral: { + background: colorsProps["neutral"][100]; + text: colorsProps["neutral"][700]; + }; + primary: { + background: colorsProps["primary"][100]; + text: colorsProps["primary"][700]; + }; + success: { + background: colorsProps["success"][100]; + text: colorsProps["success"][900]; + }; + warning: { + background: colorsProps["warning"][100]; + text: colorsProps["warning"][900]; + }; + error: { + background: colorsProps["error"][100]; + text: colorsProps["error"][900]; + }; + }; + }; + + popover: { + skins: { + neutral: { + background: colorsProps["neutral"][0]; + text: colorsProps["neutral"][700]; + }; + primary: { + background: colorsProps["primary"][100]; + text: colorsProps["neutral"][700]; + }; + success: { + background: colorsProps["success"][100]; + text: colorsProps["success"][900]; + }; + warning: { + background: colorsProps["warning"][100]; + text: colorsProps["neutral"][700]; + }; + error: { + background: colorsProps["error"][100]; + text: colorsProps["neutral"][700]; + }; + }; + }; + + snackbar: { + skins: { + neutral: { + background: colorsProps["neutral"][700]; + text: colorsProps["neutral"][100]; + iconColor: colorsProps["neutral"][100]; + icon: string; + }; + primary: { + background: colorsProps["primary"][900]; + text: colorsProps["neutral"][0]; + iconColor: colorsProps["neutral"][0]; + icon: string; + }; + success: { + background: colorsProps["success"][900]; + text: colorsProps["neutral"][0]; + iconColor: colorsProps["neutral"][0]; + icon: string; + }; + warning: { + background: colorsProps["warning"][700]; + text: colorsProps["neutral"][900]; + iconColor: colorsProps["neutral"][900]; + icon: string; + }; + error: { + background: colorsProps["error"][900]; + text: colorsProps["neutral"][0]; + iconColor: colorsProps["neutral"][0]; + icon: string; + }; + }; + }; + + alert: { + skins: { + neutral: { + icon: colorsProps["neutral"][700]; + background: colorsProps["neutral"][300]; + text: colorsProps["neutral"][700]; + }; + primary: { + icon: colorsProps["primary"][700]; + background: colorsProps["primary"][100]; + text: colorsProps["neutral"][700]; + }; + success: { + icon: colorsProps["success"][900]; + background: colorsProps["success"][100]; + text: colorsProps["success"][900]; + }; + warning: { + icon: colorsProps["warning"][700]; + background: colorsProps["warning"][100]; + text: colorsProps["neutral"][700]; + }; + error: { + icon: colorsProps["error"][700]; + background: colorsProps["error"][100]; + text: colorsProps["error"][900]; + }; + }; + }; + + progressBar: { + skins: { + neutral: { + titleColor: colorsProps["neutral"][1000]; + background: colorsProps["neutral"][500]; + textColor: colorsProps["neutral"][700]; + }; + primary: { + titleColor: colorsProps["neutral"][1000]; + background: colorsProps["primary"][700]; + textColor: colorsProps["neutral"][700]; + }; + secondary: { + titleColor: colorsProps["neutral"][1000]; + background: colorsProps["secondary"][500]; + textColor: colorsProps["neutral"][700]; + }; + }; + }; + + chargeBar: { + skins: { + neutral: { + titleColor: colorsProps["neutral"][1000]; + background: colorsProps["neutral"][700]; + }; + primary: { + titleColor: colorsProps["neutral"][1000]; + background: colorsProps["primary"][700]; + }; + secondary: { + titleColor: colorsProps["neutral"][1000]; + background: colorsProps["secondary"][700]; + }; + success: { + titleColor: colorsProps["neutral"][1000]; + background: colorsProps["success"][700]; + }; + }; + }; + + tabbedView: { + skins: { + neutral: { + border: colorsProps["neutral"][300]; + activeText: colorsProps["primary"][700]; + background: string; + hoverBackground: colorsProps["primary"][100]; + text: string; + }; + primary: { + border: colorsProps["neutral"][100]; + activeText: colorsProps["neutral"][0]; + background: colorsProps["primary"][700]; + hoverBackground: string; + text: colorsProps["neutral"][0]; + }; + }; + }; +} + +interface themeProps { + breakpoints: breakpointsProps; + gutter: gutterType; + colors: colorsProps; + components: componentsProps; + spacing: spacingProps; + baseFontSize: baseFontSizeType; +} + +declare const theme: themeProps; +declare const breakpoints: breakpointsProps; +declare const gutter: gutterType; +declare const colors: colorsProps; +declare const components: componentsProps; +declare const spacing: spacingProps; +declare const baseFontSize: baseFontSizeType; + +export { theme, breakpoints, gutter, colors, components, spacing, baseFontSize }; + +export default theme; diff --git a/components/shared/theme.js b/components/shared/theme.js index 67e3f9d9c..d05c5a8d0 100644 --- a/components/shared/theme.js +++ b/components/shared/theme.js @@ -2,6 +2,7 @@ import hexToRgba from './hexToRgba'; const breakpoints = { xsmall: { + width: 1, columns: 4, }, small: { diff --git a/components/shared/types.d.ts b/components/shared/types.d.ts new file mode 100644 index 000000000..5ae448c0c --- /dev/null +++ b/components/shared/types.d.ts @@ -0,0 +1 @@ +export type NonEmptyArray = [T, ...T[]]; diff --git a/components/shared/uniqId.d.ts b/components/shared/uniqId.d.ts new file mode 100644 index 000000000..6918c3f6c --- /dev/null +++ b/components/shared/uniqId.d.ts @@ -0,0 +1 @@ +export type createUniqId = (prefix?: string) => () => string; diff --git a/package.json b/package.json index 8a95b2780..7f03ac202 100644 --- a/package.json +++ b/package.json @@ -115,8 +115,8 @@ "slugify": "^1.3.6" }, "peerDependencies": { - "react": "^16.14.0 || ^17 || ^18.0.0", - "react-dom": "^16.14.0 || ^17 || ^18.0.0", + "react": "^16.14.0 || ^17.0.0 || ^18.0.0", + "react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0", "styled-components": ">= 4" }, "lint-staged": { From e0a2415135ecad664f4e486835a26053731810a1 Mon Sep 17 00:00:00 2001 From: Marcos Conceicao Date: Wed, 14 Jun 2023 18:13:03 -0300 Subject: [PATCH 5/6] chore: Updated items list type --- components/List/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/List/index.d.ts b/components/List/index.d.ts index 0642bb293..e963685c6 100644 --- a/components/List/index.d.ts +++ b/components/List/index.d.ts @@ -8,7 +8,7 @@ interface ItemContent { interface ListItem { icon?: IconNames | string; - content?: ItemContent; + content?: ItemContent | string; } export interface ListProps { From e072ca6f5ad707717bc2c26add4181396f55398f Mon Sep 17 00:00:00 2001 From: Marcos Conceicao Date: Wed, 14 Jun 2023 18:17:02 -0300 Subject: [PATCH 6/6] chore(theme.js): Updated breakpoints --- components/shared/theme.js | 1 - 1 file changed, 1 deletion(-) diff --git a/components/shared/theme.js b/components/shared/theme.js index d05c5a8d0..67e3f9d9c 100644 --- a/components/shared/theme.js +++ b/components/shared/theme.js @@ -2,7 +2,6 @@ import hexToRgba from './hexToRgba'; const breakpoints = { xsmall: { - width: 1, columns: 4, }, small: {