Skip to content

Commit

Permalink
Update flow types to use literal vs class wrapper (#969)
Browse files Browse the repository at this point in the history
* Update Array types

* Update String types

* Update Number types

* Update Date types

* Update Boolean types

* Final cleanup types

* Changelog and kit template
  • Loading branch information
thestephenmarshall committed Aug 10, 2020
1 parent 8d9f3c4 commit a4c146c
Show file tree
Hide file tree
Showing 83 changed files with 517 additions and 512 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Fixed
- Update flow types to use literal vs class wrapper ([#969](https://github.com/powerhome/playbook/pull/969) @thestephenmarshall)


## [v6.1.0] 2020-8-6

Expand Down
8 changes: 4 additions & 4 deletions app/pb_kits/playbook/pb_avatar/_avatar.jsx
Expand Up @@ -11,11 +11,11 @@ import { Image } from '../'

type AvatarProps = {
aria?: object,
className?: String,
className?: string,
data?: object,
id?: String,
imageUrl: String,
name: String,
id?: string,
imageUrl: string,
name: string,
size?: "md" | "lg" | "sm" | "xl" | "xs",
status: "away" | "offline" | "online",
}
Expand Down
Expand Up @@ -11,17 +11,17 @@ import {
} from '../utilities/props'

type AvatarActionButtonProps = {
action?: String,
action?: string,
aria: Object,
className?: String,
className?: string,
data?: Object,
id?: String,
imageUrl?: String,
linkUrl?: String,
name?: String,
onClick?: String,
placement?: String,
size?: String,
id?: string,
imageUrl?: string,
linkUrl?: string,
name?: string,
onClick?: string,
placement?: string,
size?: string,
}

const AvatarActionButton = ({
Expand Down
8 changes: 4 additions & 4 deletions app/pb_kits/playbook/pb_badge/_badge.jsx
Expand Up @@ -12,11 +12,11 @@ import {

type BadgeProps = {
aria?: object,
className?: String,
className?: string,
data?: object,
id?: String,
rounded?: Boolean,
text?: String,
id?: string,
rounded?: boolean,
text?: string,
variant?: "error" | "info" | "neutral" | "primary" | "success" | "warning",
}
const Badge = (props: BadgeProps) => {
Expand Down
32 changes: 16 additions & 16 deletions app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
Expand Up @@ -6,23 +6,23 @@ import { pbChart } from '../'
import { globalProps } from '../utilities/globalProps.js'

type BarGraphProps = {
axisTitle: String,
xAxisCategories: Array,
yAxisMin: Number,
yAxisMax: Number,
chartData: Array<{
name: String,
data: Array<Number>,
axisTitle: string,
xAxisCategories: array,
yAxisMin: number,
yAxisMax: number,
chartData: array<{
name: string,
data: array<number>,
}>,
className?: String,
id: Number,
pointStart: Number,
subTitle?: String,
title: String,
type?: String,
legend?: Boolean,
toggleLegendClick?: Boolean,
height?: String,
className?: string,
id: number,
pointStart: number,
subTitle?: string,
title: string,
type?: string,
legend?: boolean,
toggleLegendClick?: boolean,
height?: string,
}

export default class BarGraph extends React.Component<BarGraphProps> {
Expand Down
14 changes: 7 additions & 7 deletions app/pb_kits/playbook/pb_body/_body.jsx
Expand Up @@ -8,17 +8,17 @@ import { globalProps } from '../utilities/globalProps.js'

type BodyProps = {
aria?: object,
className?: String,
children?: Array<React.ReactChild>,
className?: string,
children?: array<React.ReactChild>,
color: 'dark' | 'default' | 'light' | 'lighter' | 'light_dark' | 'lighter_dark',
dark?: Boolean,
dark?: boolean,
data?: object,
highlightedText?: Array<String>,
highlighting?: Boolean,
id?: String,
highlightedText?: array<string>,
highlighting?: boolean,
id?: string,
status?: 'negative' | 'neutral' | 'positive',
tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'div',
text?: String,
text?: string,
}

const Body = (props: BodyProps) => {
Expand Down
30 changes: 15 additions & 15 deletions app/pb_kits/playbook/pb_button/_button.jsx
Expand Up @@ -9,26 +9,26 @@ import Icon from '../pb_icon/_icon.jsx'
type EventHandler = (SyntheticInputEvent<HTMLInputElement>) => void
type ButtonPropTypes = {
aria?: {
label: String,
label: string,
},
children?: Array<React.ReactChild>,
className?: String | Array<String>,
disabled?: Boolean,
fixedWidth?: Boolean,
fullWidth?: Boolean,
icon?: String,
id?: String,
link?: String,
loading?: Boolean,
newWindow?: Boolean,
children?: array<React.ReactChild>,
className?: string | array<string>,
disabled?: boolean,
fixedWidth?: boolean,
fullWidth?: boolean,
icon?: string,
id?: string,
link?: string,
loading?: boolean,
newWindow?: boolean,
onClick?: EventHandler,
size: 'large' | 'medium' | 'small',
text?: String,
text?: string,
type: 'inline' | null,
htmlType: String | 'button',
value?: String | null,
htmlType: string | 'button',
value?: string | null,
variant: 'primary' | 'secondary' | 'link',
wrapperClass: String,
wrapperClass: string,
}

const buttonClassName = (props: ButtonPropTypes) => {
Expand Down
12 changes: 6 additions & 6 deletions app/pb_kits/playbook/pb_button_toolbar/_button_toolbar.jsx
Expand Up @@ -9,15 +9,15 @@ import { globalProps } from '../utilities/globalProps.js'

type ButtonToolbarProps = {
aria?: object,
children?: Array<React.ReactChild>,
className?: String,
connected?: Boolean,
children?: array<React.ReactChild>,
className?: string,
connected?: boolean,
data?: object,
id?: String,
id?: string,
onClick?: EventHandler,
orientation?: "horizontal" | "vertical",
text?: String,
variant?: String,
text?: string,
variant?: string,
}

const ButtonToolbar = (props: ButtonToolbarProps) => {
Expand Down
8 changes: 4 additions & 4 deletions app/pb_kits/playbook/pb_caption/_caption.jsx
Expand Up @@ -7,13 +7,13 @@ import { globalProps } from '../utilities/globalProps.js'

type CaptionProps = {
aria?: object,
className?: String,
children: Array<React.ReactNode> | React.ReactNode,
className?: string,
children: array<React.ReactNode> | React.ReactNode,
data?: object,
id?: String,
id?: string,
size?: "xs" | "sm" | "md" | "lg" | "xl",
tag?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "div",
text?: String,
text?: string,
}

const Caption = (props: CaptionProps) => {
Expand Down
26 changes: 13 additions & 13 deletions app/pb_kits/playbook/pb_card/_card.jsx
Expand Up @@ -7,29 +7,29 @@ import { buildCss } from '../utilities/props'
import { globalProps } from '../utilities/globalProps.js'

type CardPropTypes = {
borderNone?: Boolean,
children: Array<React.ReactNode> | React.ReactNode,
className?: String,
borderNone?: boolean,
children: array<React.ReactNode> | React.ReactNode,
className?: string,
highlight?: {
position?: "side" | "top",
color?: String,
color?: string,
},
padding?: String,
selected?: Boolean,
padding?: string,
selected?: boolean,
shadow?: "none" | "deep" | "deeper" | "deepest",
}

type CardHeaderProps = {
categoryColor?: Number,
children: Array<React.ReactNode> | React.ReactNode,
className?: String,
padding?: String,
categoryColor?: number,
children: array<React.ReactNode> | React.ReactNode,
className?: string,
padding?: string,
}

type CardBodyProps = {
children: Array<React.ReactNode> | React.ReactNode | String,
className?: String,
padding?: String,
children: array<React.ReactNode> | React.ReactNode | string,
className?: string,
padding?: string,
}

// Header component
Expand Down
18 changes: 9 additions & 9 deletions app/pb_kits/playbook/pb_checkbox/_checkbox.jsx
Expand Up @@ -9,17 +9,17 @@ import { globalProps } from '../utilities/globalProps.js'

type CheckboxProps = {
aria?: object,
checked?: Boolean,
className?: String,
dark?: Boolean,
checked?: boolean,
className?: string,
dark?: boolean,
data?: object,
error?: Boolean,
id?: String,
name: String,
text: String,
value: String,
error?: boolean,
id?: string,
name: string,
text: string,
value: string,
children: Node,
onChange: (Boolean) => void,
onChange: (boolean) => void,
}

const Checkbox = (props: CheckboxProps) => {
Expand Down
Expand Up @@ -15,15 +15,15 @@ import { globalProps } from '../utilities/globalProps.js'

type CircleIconButtonProps = {
aria?: object,
className?: String,
dark?: Boolean,
className?: string,
dark?: boolean,
data?: object,
disabled?: Boolean,
icon: String,
id?: String,
link?: String,
disabled?: boolean,
icon: string,
id?: string,
link?: string,
onClick?: Callback,
newWindow?: Boolean,
newWindow?: boolean,
type?: 'button' | 'submit' | 'reset',
variant?: 'primary' | 'secondary' | 'link',
}
Expand Down
10 changes: 5 additions & 5 deletions app/pb_kits/playbook/pb_contact/_contact.jsx
Expand Up @@ -39,12 +39,12 @@ const formatContact = (contactString, contactType) => {

type ContactProps = {
aria?: object,
className?: String | Array<String>,
contactDetail?: String,
contactType?: String,
contactValue: String,
className?: string | array<string>,
contactDetail?: string,
contactType?: string,
contactValue: string,
data?: object,
id?: String,
id?: string,
}

const Contact = (props: ContactProps) => {
Expand Down
14 changes: 7 additions & 7 deletions app/pb_kits/playbook/pb_currency/_currency.jsx
Expand Up @@ -9,16 +9,16 @@ import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'

type CurrencyProps = {
align?: 'center' | 'left' | 'right',
amount: String,
amount: string,
aria?: object,
className?: String,
dark?: Boolean,
className?: string,
dark?: boolean,
data?: object,
id?: String,
label?: String,
id?: string,
label?: string,
size?: 'sm' | 'md' | 'lg',
symbol?: String,
unit?: String,
symbol?: string,
unit?: string,
}

const sizes = {
Expand Down
14 changes: 7 additions & 7 deletions app/pb_kits/playbook/pb_dashboard_value/_dashboard_value.jsx
Expand Up @@ -13,17 +13,17 @@ import {
type DashboardValueProps = {
align?: 'left' | 'center' | 'right',
aria?: object,
className?: String,
className?: string,
data?: object,
id?: String,
id?: string,
statChange?: {
change?: String,
value?: String | Number
change?: string,
value?: string | Number
},
statLabel?: String,
statLabel?: string,
statValue?: {
unit?: String,
value?: String | Number
unit?: string,
value?: string | Number
}
}

Expand Down
4 changes: 2 additions & 2 deletions app/pb_kits/playbook/pb_date/_date.jsx
Expand Up @@ -49,8 +49,8 @@ const LargeDate = ({ value, ...props }: DateSubcomponent) => (

type PbDateProps = {
size?: "xs" | "sm" | "lg",
value?: String,
className?: String
value?: string,
className?: string
}

const PbDate = ({ size, value, className, ...props }: PbDateProps) => {
Expand Down

0 comments on commit a4c146c

Please sign in to comment.