diff --git a/docs/components/Props.js b/docs/components/Props.js index 775a87303d..22ec913e56 100644 --- a/docs/components/Props.js +++ b/docs/components/Props.js @@ -12,16 +12,24 @@ import { CheckIcon } from '@welcome-ui/icons' import * as TYPES from '../../utils/propTypes' -const removeQuote = str => str?.replace(/'/g, '') +const removeQuote = str => str?.toString()?.replace(/'/g, '') const isArray = Array.isArray -const Type = ({ type }) => { +const reactTypes = ['ElementType'] + +function Type({ type }) { if (!type) { return null } const { name, raw, value } = type + if (reactTypes.includes(raw)) { + return `React.${raw}` + } + + if (raw === 'boolean') return 'Boolean' + // Enum if (name === 'enum') { let values @@ -58,11 +66,13 @@ const Type = ({ type }) => { return name } -export const Props = ({ propTypes }) => { +export function Props({ propTypes }) { if (!propTypes) { - return 'No propTypes specified' + return 'No props specified' } + const { props } = propTypes + return ( @@ -76,8 +86,8 @@ export const Props = ({ propTypes }) => { - {Object.keys(propTypes).map(key => { - const { defaultValue, description, required, type } = propTypes[key] + {Object.keys(props).map(key => { + const { defaultValue, description, required, type } = props[key] if (!type) { return null diff --git a/docs/getStaticProps.js b/docs/getStaticProps.js index 48eba0ff3d..caa7f799a3 100644 --- a/docs/getStaticProps.js +++ b/docs/getStaticProps.js @@ -1,57 +1,28 @@ -const isComponentFile = file => { - if (file === 'index.js') { - return true - } - - const [name, extension] = file.split('.') - const firstLetter = name[0] - - // Components start with capital letter e.g. Title.js - if (extension === 'js' && firstLetter === firstLetter.toUpperCase()) { - return true - } - - return false -} +const path = require('path') +const fs = require('fs/promises') export async function getStaticProps() { - // Only import on server - const reactDocs = require('react-docgen') - const path = require('path') - const fs = require('fs') - - let propTypes = {} - - // Use react-docgen to get proptypes - const cwd = process.cwd() - const packages = fs.readdirSync(path.join(cwd, 'packages')) - - // Loop through all packages… - packages.forEach(packageName => { - const componentFiles = fs - .readdirSync(path.join(cwd, `packages/${packageName}`)) - .filter(isComponentFile) - - // Loop through all component files for a package and add to prepped propTypes object - componentFiles.forEach(file => { - const content = fs.readFileSync(path.join(cwd, `packages/${packageName}/${file}`), 'utf8') - try { - const { props } = reactDocs.parse(content) - if (!props) { - return - } - - let key = packageName - if (file !== 'index.js') { - const [filename] = file.split('.') - key = `${key}.${filename}` - } - propTypes[key] = props - } catch (e) { - console.error({ packageName, file, e: e.message }) - return - } - }) + const propTypes = {} + const packages = await fs.readdir(path.join(process.cwd(), 'docs', 'pages', 'components')) + + packages.forEach(file => { + const packageName = file.replace('.mdx', '') + + try { + const packageProps = require(`@welcome-ui/${packageName}/dist/${packageName}.doc.json`) + + Object.keys(packageProps).forEach(key => { + propTypes[key] = packageProps[key] + }) + } catch (error) { + // eslint-disable-next-line no-console + console.error(`@welcome-ui/${packageName}/dist/${packageName}.doc.json is missing`) + } }) - return { props: { propTypes } } + + return { + props: { + propTypes, + }, + } } diff --git a/docs/pages/components/badge.mdx b/docs/pages/components/badge.mdx index a75cbe6df1..40624c9956 100644 --- a/docs/pages/components/badge.mdx +++ b/docs/pages/components/badge.mdx @@ -1,3 +1,5 @@ +export { getStaticProps } from '../../getStaticProps' + import { component, dependencies, @@ -27,6 +29,10 @@ Badge is the [Tag](/components/tag) component with small size. New ``` +## Properties + + + ## Dependencies diff --git a/docs/pages/components/radio-group.mdx b/docs/pages/components/radio-group.mdx index 116af403cc..9b2a0a4942 100644 --- a/docs/pages/components/radio-group.mdx +++ b/docs/pages/components/radio-group.mdx @@ -76,7 +76,7 @@ function () { ## Properties - + ## Dependencies diff --git a/docs/pages/components/toggle.mdx b/docs/pages/components/toggle.mdx index 9143d8f050..4ab0e45a7d 100644 --- a/docs/pages/components/toggle.mdx +++ b/docs/pages/components/toggle.mdx @@ -74,7 +74,7 @@ function () { ## Properties - + ## Dependencies diff --git a/docs/pages/installation.mdx b/docs/pages/installation.mdx index 3338a9dab7..33dacaa141 100644 --- a/docs/pages/installation.mdx +++ b/docs/pages/installation.mdx @@ -40,6 +40,8 @@ export default function Root() { ### WuiProvider Props + + ## Hide Focus Ring diff --git a/package.json b/package.json index 8b2ad47187..f36c20eef6 100644 --- a/package.json +++ b/package.json @@ -19,10 +19,11 @@ "webfont:build": "node -r esm scripts/webfont-build.js --force && yarn build:packages --scope @welcome-ui/icons.font", "webfont:deploy": "./scripts/webfont-deploy.sh", "pre-build": "yarn icons:collect", - "build": "yarn webfont:build && yarn build:core && yarn build:packages && yarn build:types", + "build": "yarn webfont:build && yarn build:core && yarn build:packages && yarn build:types && yarn build:docs", "build:packages": "lerna run build --ignore docs --ignore @welcome-ui/core", "build:core": "./scripts/core.sh", - "build:types": "lerna run types --scope @welcome-ui/core && lerna run types --ignore @welcome-ui/core", + "build:types": "lerna run types", + "build:docs": "lerna run doc --concurrency 2", "watch": "onchange 'packages/**/*.ts*' -e '**/dist/**' -- node -r esm scripts/watch.js {{changed}}", "release:publish": "yarn lerna publish --conventional-commits --no-private", "release:prerelease": "yarn -s check:ssh && yarn build && yarn lerna publish --conventional-prerelease --no-private --pre-dist-tag next --yes || yarn -s check:ssh-error", @@ -85,19 +86,19 @@ "@rollup/plugin-replace": "^2.3.4", "@testing-library/dom": "7.29.4", "@testing-library/jest-dom": "^5.11.9", - "@testing-library/react-hooks": "^7.0.1", "@testing-library/react": "^11.2.3", + "@testing-library/react-hooks": "^7.0.1", "@testing-library/user-event": "12.6.0", "@types/emoji-mart": "3.0.8", - "@types/lodash.range": "^3.2.6", - "@types/ramda": "^0.27.44", - "@types/react-datepicker": "^4.3.2", - "@types/react": "^17.0.11", - "@types/styled-components": "^5.1.11", "@types/lodash.debounce": "^4.0.6", "@types/lodash.escaperegexp": "^4.1.6", "@types/lodash.groupby": "^4.6.6", + "@types/lodash.range": "^3.2.6", + "@types/ramda": "^0.27.44", + "@types/react": "^17.0.11", + "@types/react-datepicker": "^4.3.2", "@types/react-window": "^1.8.5", + "@types/styled-components": "^5.1.11", "@typescript-eslint/eslint-plugin": "^4.28.2", "@typescript-eslint/parser": "^4.28.2", "@xstyled/styled-components": "^3.0.3", @@ -112,47 +113,48 @@ "conventional-github-releaser": "^3.1.3", "date-fns": "^2.19.0", "depcheck": "=0.9.1", + "eslint": "^7.28.0", "eslint-config-prettier": "^8.3.0", "eslint-config-react-app": "^6.0.0", "eslint-plugin-cypress": "^2.11.2", "eslint-plugin-import": "^2.22.1", "eslint-plugin-jsx-a11y": "^6.4.1", "eslint-plugin-prettier": "^3.3.1", - "eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-react": "^7.23.2", + "eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-sort-destructure-keys": "^1.3.3", - "eslint": "^7.28.0", "esm": "^3.2.25", "final-form": "^4.20.2", "husky": "=3.1.0", - "jest-styled-components": "7.0.3", "jest": "26.6.3", - "lerna-update-wizard": "^0.17.8", + "jest-styled-components": "7.0.3", "lerna": "^3.22.1", + "lerna-update-wizard": "^0.17.8", "lodash.difference": "^4.5.0", "minimist": "1.2.5", "netlify-cli": "^2.59.1", "onchange": "^7.0.2", "prettier": "^2.4.0", "prop-types": "^15.7.2", + "react": "^17.0.1", + "react-docgen-typescript": "^2.2.2", "react-dom": "^17.0.1", "react-final-form": "^6.5.2", "react-helmet": "^5.2.1", "react-live": "^2.2.1", "react-router-dom": "=5.1.2", - "react": "^17.0.1", "rimraf": "^3.0.2", + "rollup": "2.51.1", "rollup-plugin-babel": "=4.3.2", "rollup-plugin-node-resolve": "^5.0.1", "rollup-plugin-postcss": "=2.0.3", - "rollup": "2.51.1", "standard-version": "^6.0.1", "style-loader": "=0.23.1", "styled-components": "^5.3.0", + "stylelint": "=12.0.0", "stylelint-config-recommended": "=3.0.0", "stylelint-config-styled-components": "=0.1.1", "stylelint-processor-styled-components": "=1.9.0", - "stylelint": "=12.0.0", "surge": "=0.21.3", "svgo": "^2.2.0", "typescript": "^4.4.3", diff --git a/packages/Accordion/package.json b/packages/Accordion/package.json index 93a576040e..f8fd570e8a 100644 --- a/packages/Accordion/package.json +++ b/packages/Accordion/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist", + "doc": "node -r esm ../../scripts/doc-props.js --name Accordion" }, "publishConfig": { "access": "public" diff --git a/packages/Alert/Title.tsx b/packages/Alert/Title.tsx index 8852394f5e..4862ac2ce3 100644 --- a/packages/Alert/Title.tsx +++ b/packages/Alert/Title.tsx @@ -8,6 +8,9 @@ import { AlertOptions } from '.' export type AlertTitleProps = CreateWuiProps<'h5', VariantIconOptions & AlertOptions> +/** + * @name Alert.Title + */ export const Title: React.FC = ({ children, dataTestId, diff --git a/packages/Alert/package.json b/packages/Alert/package.json index 3f5d6f43a2..55b03f8f18 100644 --- a/packages/Alert/package.json +++ b/packages/Alert/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name Alert" }, "publishConfig": { "access": "public" diff --git a/packages/Avatar/package.json b/packages/Avatar/package.json index 2d63cd7905..116668e8ee 100644 --- a/packages/Avatar/package.json +++ b/packages/Avatar/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name Avatar" }, "publishConfig": { "access": "public" diff --git a/packages/Badge/index.tsx b/packages/Badge/index.tsx index 71dda71f4b..c1576c1679 100644 --- a/packages/Badge/index.tsx +++ b/packages/Badge/index.tsx @@ -2,7 +2,8 @@ import React from 'react' import { Tag, TagOptions } from '@welcome-ui/tag' import { CreateWuiProps, forwardRef } from '@welcome-ui/system' -export type BadgeProps = CreateWuiProps<'div', Omit> +export type BadgeOptions = Omit +export type BadgeProps = CreateWuiProps<'div', BadgeOptions> export const Badge = forwardRef<'div', BadgeProps>((props, ref) => ( diff --git a/packages/Badge/package.json b/packages/Badge/package.json index b36d547351..7376562b36 100644 --- a/packages/Badge/package.json +++ b/packages/Badge/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name Badge" }, "publishConfig": { "access": "public" diff --git a/packages/Box/package.json b/packages/Box/package.json index 6002d87a06..599fc81c9b 100644 --- a/packages/Box/package.json +++ b/packages/Box/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name Box" }, "publishConfig": { "access": "public" diff --git a/packages/Breadcrumb/Item.tsx b/packages/Breadcrumb/Item.tsx index 3491f1cbb5..f09218d645 100644 --- a/packages/Breadcrumb/Item.tsx +++ b/packages/Breadcrumb/Item.tsx @@ -11,6 +11,9 @@ export interface ItemOptions { export type ItemProps = CreateWuiProps<'li', ItemOptions> +/** + * @name Breadcrumb.Item + */ export const Item: React.FC = ({ children, dataTestId, separator, ...rest }) => { return ( +/** + * @tag button + */ export const Button = forwardRef<'button', ButtonProps>( ({ children, dataTestId, disabled, size = 'md', variant = 'primary', ...rest }, ref) => ( css` +const shapeStyles = (size: ButtonOptions['size'], shape: ButtonOptions['shape'] = 'square') => css` width: ${th(`buttons.sizes.${size}.height`)}; padding: 0; ${shape === 'circle' && @@ -15,16 +15,7 @@ const shapeStyles = (size: Size, shape = 'square') => css` `}; ` -export interface StyledButtonProps { - disabled?: boolean - shape?: Shape - size?: Size - variant?: Variant -} - -export const Button = styled(ReakitButton).withConfig({ shouldForwardProp })< - StyledButtonProps & WuiProps ->( +export const Button = styled(ReakitButton).withConfig({ shouldForwardProp })( ({ disabled, shape, size = 'md', variant }) => css` ${th(`buttons.${variant}`)}; position: relative; diff --git a/packages/Card/Cover.tsx b/packages/Card/Cover.tsx index f00a7ac880..81b22d520d 100644 --- a/packages/Card/Cover.tsx +++ b/packages/Card/Cover.tsx @@ -9,6 +9,9 @@ export interface CoverOptions { export type CoverProps = CoverOptions & ShapeProps +/** + * @name Card.Cover + */ export const Cover: React.FC = ({ src, ...rest }) => ( diff --git a/packages/Card/package.json b/packages/Card/package.json index 7c03c4418b..6bdf319eef 100644 --- a/packages/Card/package.json +++ b/packages/Card/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name Card" }, "publishConfig": { "access": "public" diff --git a/packages/Checkbox/index.tsx b/packages/Checkbox/index.tsx index 08b9f3794e..5f1a57640e 100644 --- a/packages/Checkbox/index.tsx +++ b/packages/Checkbox/index.tsx @@ -4,13 +4,13 @@ import { DefaultFieldStylesProps } from '@welcome-ui/utils' import * as S from './styles' -export type CheckboxOptions = { +export interface CheckboxOptions extends DefaultFieldStylesProps { checked?: boolean Component?: React.ElementType disabled?: boolean name?: string onChange?: (event: React.ChangeEvent) => void -} & DefaultFieldStylesProps +} export type CheckboxProps = CreateWuiProps<'input', CheckboxOptions> diff --git a/packages/Checkbox/package.json b/packages/Checkbox/package.json index d3ae914bf8..e0ddb88a9e 100644 --- a/packages/Checkbox/package.json +++ b/packages/Checkbox/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name Checkbox" }, "publishConfig": { "access": "public" diff --git a/packages/ClearButton/package.json b/packages/ClearButton/package.json index e7724a4ec7..8ce4e53f49 100644 --- a/packages/ClearButton/package.json +++ b/packages/ClearButton/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name ClearButton" }, "publishConfig": { "access": "public" diff --git a/packages/CloseButton/package.json b/packages/CloseButton/package.json index e5c84094e8..12b21f6b71 100644 --- a/packages/CloseButton/package.json +++ b/packages/CloseButton/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name CloseButton" }, "publishConfig": { "access": "public" diff --git a/packages/DateTimePickerCommon/package.json b/packages/DateTimePickerCommon/package.json index 747df4d727..5615e010c8 100644 --- a/packages/DateTimePickerCommon/package.json +++ b/packages/DateTimePickerCommon/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name DateTimePicker" }, "publishConfig": { "access": "public" diff --git a/packages/Drawer/index.tsx b/packages/Drawer/index.tsx index 3f751512a5..d0dcc62097 100644 --- a/packages/Drawer/index.tsx +++ b/packages/Drawer/index.tsx @@ -57,6 +57,9 @@ export type DrawerBackdropProps = DrawerBackdropOptions & DialogBackdropProps // Needed to allow to style the backdrop // see: https://reakit.io/docs/styling/#css-in-js +/** + * @name Drawer.Backdrop + */ export const DrawerBackdrop: React.FC = ({ children, hideOnClickOutside = true, diff --git a/packages/Drawer/package.json b/packages/Drawer/package.json index 6d3e04e927..15f58f5185 100644 --- a/packages/Drawer/package.json +++ b/packages/Drawer/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name Drawer" }, "publishConfig": { "access": "public" diff --git a/packages/DropdownMenu/package.json b/packages/DropdownMenu/package.json index d0a41ed2e2..5aa65d8a6d 100644 --- a/packages/DropdownMenu/package.json +++ b/packages/DropdownMenu/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name DropdownMenu" }, "publishConfig": { "access": "public" diff --git a/packages/Emoji/package.json b/packages/Emoji/package.json index ff7dd13b80..71201a3a92 100644 --- a/packages/Emoji/package.json +++ b/packages/Emoji/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name Emoji" }, "publishConfig": { "access": "public" diff --git a/packages/EmojiPicker/package.json b/packages/EmojiPicker/package.json index 4df31d2c9e..d3fa5a2749 100644 --- a/packages/EmojiPicker/package.json +++ b/packages/EmojiPicker/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name EmojiPicker" }, "publishConfig": { "access": "public" diff --git a/packages/Field/index.tsx b/packages/Field/index.tsx index 8cbebed664..efc9734819 100644 --- a/packages/Field/index.tsx +++ b/packages/Field/index.tsx @@ -8,7 +8,7 @@ import { RowContainer } from './layout' import * as S from './styles' import { generateRandomId, getBaseType, getVariant } from './utils' -type FieldOptions = { +export interface FieldOptions { children: JSX.Element disabled?: boolean disabledIcon?: JSX.Element @@ -19,7 +19,7 @@ type FieldOptions = { warning?: string | JSX.Element } -type FieldProps = CreateWuiProps<'div', FieldOptions> +export type FieldProps = CreateWuiProps<'div', FieldOptions> export const Field = forwardRef<'div', FieldProps>( ( diff --git a/packages/Field/package.json b/packages/Field/package.json index bd0d003f53..21f7257cbd 100644 --- a/packages/Field/package.json +++ b/packages/Field/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name Field" }, "publishConfig": { "access": "public" diff --git a/packages/FieldGroup/package.json b/packages/FieldGroup/package.json index 28a5294fda..0291279aa7 100644 --- a/packages/FieldGroup/package.json +++ b/packages/FieldGroup/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name FieldGroup" }, "publishConfig": { "access": "public" diff --git a/packages/FileDrop/package.json b/packages/FileDrop/package.json index e29bf0975b..3c79d32c03 100644 --- a/packages/FileDrop/package.json +++ b/packages/FileDrop/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name FileDrop" }, "publishConfig": { "access": "public" diff --git a/packages/FileUpload/package.json b/packages/FileUpload/package.json index c8f96e7e7b..f802013d34 100644 --- a/packages/FileUpload/package.json +++ b/packages/FileUpload/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name FileUpload" }, "publishConfig": { "access": "public" diff --git a/packages/Group/package.json b/packages/Group/package.json index 9234aaceab..ddfccb0296 100644 --- a/packages/Group/package.json +++ b/packages/Group/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name Group" }, "publishConfig": { "access": "public" diff --git a/packages/Hint/package.json b/packages/Hint/package.json index 59cacca9a4..3eae4b44ae 100644 --- a/packages/Hint/package.json +++ b/packages/Hint/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name Hint" }, "publishConfig": { "access": "public" diff --git a/packages/Icon/package.json b/packages/Icon/package.json index cb4fa0777d..0ef313bd88 100644 --- a/packages/Icon/package.json +++ b/packages/Icon/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name Icon" }, "publishConfig": { "access": "public" diff --git a/packages/InputText/index.tsx b/packages/InputText/index.tsx index 84ee7866a7..eb523ea838 100644 --- a/packages/InputText/index.tsx +++ b/packages/InputText/index.tsx @@ -6,7 +6,7 @@ import { CreateWuiProps, forwardRef } from '@welcome-ui/system' import * as S from './styles' -export type InputTextOptions = { +export interface InputTextOptions extends DefaultFieldStylesProps { autoFocus?: boolean disabled?: boolean icon?: JSX.Element @@ -20,7 +20,7 @@ export type InputTextOptions = { placeholder?: string type?: string value?: string -} & DefaultFieldStylesProps +} export type InputTextProps = CreateWuiProps<'input', InputTextOptions> diff --git a/packages/InputText/package.json b/packages/InputText/package.json index 6edd41a376..43cf192d0a 100644 --- a/packages/InputText/package.json +++ b/packages/InputText/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name InputText" }, "publishConfig": { "access": "public" diff --git a/packages/Label/package.json b/packages/Label/package.json index 6625feec3e..def95eb485 100644 --- a/packages/Label/package.json +++ b/packages/Label/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name Label" }, "publishConfig": { "access": "public" diff --git a/packages/Link/package.json b/packages/Link/package.json index 95ec944254..1d0ca17848 100644 --- a/packages/Link/package.json +++ b/packages/Link/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name Link" }, "publishConfig": { "access": "public" diff --git a/packages/Loader/package.json b/packages/Loader/package.json index 7194c37c74..9ba1154313 100644 --- a/packages/Loader/package.json +++ b/packages/Loader/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name Loader" }, "publishConfig": { "access": "public" diff --git a/packages/MarkdownEditor/index.tsx b/packages/MarkdownEditor/index.tsx index 1ee24036b5..4feabcb69f 100644 --- a/packages/MarkdownEditor/index.tsx +++ b/packages/MarkdownEditor/index.tsx @@ -27,7 +27,7 @@ interface Actions { [key: string]: Action } export type Variant = 'error' | 'info' | 'success' | 'valid' | 'warning' -export type MarkdownEditorOptions = { +export interface MarkdownEditorOptions extends DefaultFieldStylesProps { actions?: React.ReactElement autoFocus?: SimpleMDEEditorProps['options']['autofocus'] disabled?: boolean @@ -39,7 +39,7 @@ export type MarkdownEditorOptions = { placeholder: SimpleMDEEditorProps['options']['placeholder'] toolbar?: DefaultToolbar value: string | null -} & DefaultFieldStylesProps +} export type MarkdownEditorProps = CreateWuiProps< 'div', diff --git a/packages/MarkdownEditor/package.json b/packages/MarkdownEditor/package.json index 567bf50428..f49c082b85 100644 --- a/packages/MarkdownEditor/package.json +++ b/packages/MarkdownEditor/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name MarkdownEditor" }, "publishConfig": { "access": "public" diff --git a/packages/Modal/package.json b/packages/Modal/package.json index 739cd7ffdc..9b815026e6 100644 --- a/packages/Modal/package.json +++ b/packages/Modal/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name Modal" }, "publishConfig": { "access": "public" diff --git a/packages/Pagination/package.json b/packages/Pagination/package.json index 3479e66904..934a9d2984 100644 --- a/packages/Pagination/package.json +++ b/packages/Pagination/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name Pagination" }, "publishConfig": { "access": "public" diff --git a/packages/PasswordInput/package.json b/packages/PasswordInput/package.json index 479dc50dc6..880fd9ba39 100644 --- a/packages/PasswordInput/package.json +++ b/packages/PasswordInput/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name PasswordInput" }, "publishConfig": { "access": "public" diff --git a/packages/Picker/package.json b/packages/Picker/package.json index 1ba965aa0d..b0e6105640 100644 --- a/packages/Picker/package.json +++ b/packages/Picker/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name Picker" }, "publishConfig": { "access": "public" diff --git a/packages/Popover/package.json b/packages/Popover/package.json index aee34253d9..d14ce1d596 100644 --- a/packages/Popover/package.json +++ b/packages/Popover/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name Popover" }, "publishConfig": { "access": "public" diff --git a/packages/Radio/package.json b/packages/Radio/package.json index 90cb52f57a..c10e4f0284 100644 --- a/packages/Radio/package.json +++ b/packages/Radio/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name Radio" }, "publishConfig": { "access": "public" diff --git a/packages/RadioGroup/package.json b/packages/RadioGroup/package.json index 6760136df5..e69787de5d 100644 --- a/packages/RadioGroup/package.json +++ b/packages/RadioGroup/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name RadioGroup" }, "publishConfig": { "access": "public" diff --git a/packages/RadioTab/index.tsx b/packages/RadioTab/index.tsx index c5eb08f790..5c86a8edd9 100644 --- a/packages/RadioTab/index.tsx +++ b/packages/RadioTab/index.tsx @@ -5,14 +5,14 @@ import { RadioProps } from 'reakit/Radio' import * as S from './styles' -export type RadioTabsOptions = { +export interface RadioTabsOptions extends DefaultFieldStylesProps { checked?: boolean disabled?: boolean disabledIcon?: React.ReactElement label: React.ReactElement onChange?: (event: React.MouseEvent) => void onClick?: (event: React.MouseEvent) => void -} & DefaultFieldStylesProps +} export type RadioTabsProps = CreateWuiProps< 'input', diff --git a/packages/RadioTab/package.json b/packages/RadioTab/package.json index fa314d329a..c49a2ced5f 100644 --- a/packages/RadioTab/package.json +++ b/packages/RadioTab/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name RadioTab" }, "publishConfig": { "access": "public" diff --git a/packages/Search/index.tsx b/packages/Search/index.tsx index e1832aa0aa..3f00779e6b 100644 --- a/packages/Search/index.tsx +++ b/packages/Search/index.tsx @@ -12,7 +12,7 @@ export type Option = { label: string; value: string } export type OptionGroup = { label: string; options: Option[] } type Item = Option | OptionGroup | string | unknown -export type SearchOptions = { +export interface SearchOptions extends DefaultFieldStylesProps { groupsEnabled?: boolean icon?: React.ReactElement itemToString: (item: Item) => string @@ -23,7 +23,7 @@ export type SearchOptions = { search: (query: string) => Promise throttle?: number value?: Item -} & DefaultFieldStylesProps +} export type SearchProps = CreateWuiProps< 'input', diff --git a/packages/Search/package.json b/packages/Search/package.json index b0ab6136bc..c8f11029d8 100644 --- a/packages/Search/package.json +++ b/packages/Search/package.json @@ -9,7 +9,8 @@ "build": "rollup -c", "watch": "rollup -c -w", "test": "jest", - "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types" + "types": "rimraf dist/types && tsc --emitDeclarationOnly --declaration --declarationDir dist/types", + "doc": "node -r esm ../../scripts/doc-props.js --name Search" }, "publishConfig": { "access": "public" diff --git a/packages/Select/index.tsx b/packages/Select/index.tsx index 743ba27b86..c7c8452886 100644 --- a/packages/Select/index.tsx +++ b/packages/Select/index.tsx @@ -31,7 +31,7 @@ export type OptionItem = Option | OptionGroup export type Options = Array