Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import PropTypes from 'prop-types'
import { spacing, position, layout, dimensions } from 'ui-box'
import { Pane } from '../../layers'
import { Text } from '../../typography'
import Radio from './Radio'
let radioCount = 1 // Used for generating unique input names
export default class RadioGroup extends PureComponent {
static propTypes = {
/**
* Composes some Box APIs.
*/
...spacing.propTypes,
...position.propTypes,
...layout.propTypes,
...dimensions.propTypes,
/**
* The options for the radios of the Radio Group.
*/
options: PropTypes.arrayOf(
PropTypes.shape({
label: PropTypes.node.isRequired,
value: PropTypes.string.isRequired,
isDisabled: PropTypes.bool
})
).isRequired,
/**
* The selected item value when controlled.
*/
...dimensions.propTypes,
/**
* Composes the spacing spec from the Box primitivie.
*/
...spacing.propTypes,
/**
* Composes the position spec from the Box primitivie.
*/
...position.propTypes,
/**
* Composes the layout spec from the Box primitivie.
*/
...layout.propTypes,
/**
* The id attribute for the select.
*/
id: PropTypes.string,
/**
* The name attribute for the select.
*/
name: PropTypes.string,
/**
* The options that are passed to the select.
*/
children: PropTypes.node,
...dimensions.propTypes,
/**
* Composes the spacing spec from the Box primitivie.
*/
...spacing.propTypes,
/**
* Composes the position spec from the Box primitivie.
*/
...position.propTypes,
/**
* Composes the layout spec from the Box primitivie.
*/
...layout.propTypes,
/**
* Name of a Blueprint UI icon, or an icon element, to render.
* This prop is required because it determines the content of the component, but it can
* be explicitly set to falsy values to render nothing.
*
* - If `null` or `undefined` or `false`, this component will render nothing.
* - If given an `IconName` (a string literal union of all icon names),
* that icon will be rendered as an `<svg>` with `<path>` tags.
* - If given a `JSX.Element`, that element will be rendered and _all other props on this component are ignored._
* This type is supported to simplify usage of this component in other Blueprint components.
* As a consumer, you should never use `}` directly; simply render `` instead.
*/
icon: PropTypes.string,
/**</path></svg>
...dimensions.propTypes,
/**
* Composes the spacing spec from the Box primitive.
*/
...spacing.propTypes,
/**
* Composes the position spec from the Box primitive.
*/
...position.propTypes,
/**
* Composes the layout spec from the Box primitive.
*/
...layout.propTypes
}
static defaultProps = {
labelProps: {
size: 400
}
}
render() {
const {
hint,
label,
labelFor,
children,
isRequired,
labelProps,
/>
)
MinusIcon.propTypes = {
fill: PropTypes.string
}
class Checkbox extends PureComponent {
static propTypes = {
/**
* Composes some Box APIs.
*/
...spacing.propTypes,
...position.propTypes,
...layout.propTypes,
...dimensions.propTypes,
/**
* The id attribute of the checkbox.
*/
id: PropTypes.string,
/**
* The id attribute of the checkbox.
*/
name: PropTypes.string,
/**
* Label of the checkbox.
*/
label: PropTypes.node,
...dimensions.propTypes,
/**
* Composes the spacing spec from the Box primitivie.
*/
...spacing.propTypes,
/**
* Composes the position spec from the Box primitivie.
*/
...position.propTypes,
/**
* Composes the layout spec from the Box primitivie.
*/
...layout.propTypes,
/**
* The intent of the button.
*/
intent: PropTypes.oneOf(['none', 'success', 'warning', 'danger']),
/**
* The appearance of the button.
*/
appearance: PropTypes.oneOf(['default', 'minimal', 'primary']).isRequired,
/**
* When true, show a loading spinner before the children.
* This also disables the button.
*/
isLoading: PropTypes.bool,
fill: PropTypes.string,
size: PropTypes.number
}
const isControlled = component => {
return {}.hasOwnProperty.call(component.props, 'checked')
}
class Switch extends PureComponent {
static propTypes = {
/**
* Composes some Box APIs.
*/
...spacing.propTypes,
...position.propTypes,
...layout.propTypes,
/**
* The id attribute of the radio.
*/
id: PropTypes.string,
/**
* The name attribute of the radio.
*/
name: PropTypes.string,
/**
* The value attribute of the radio.
*/
value: PropTypes.string,
import PropTypes from 'prop-types'
import { spacing, dimensions, position, layout } from 'ui-box'
import { withTheme } from '../../theme'
import { Pane } from '../../layers'
import { Heading, Paragraph } from '../../typography'
import { IconButton } from '../../buttons'
import { Icon } from '../../icon'
class Alert extends PureComponent {
static propTypes = {
/**
* Composes some Box APIs.
*/
...spacing.propTypes,
...position.propTypes,
...layout.propTypes,
...dimensions.propTypes,
/**
* The content of the alert. When a string is passed it is wrapped in a `
import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import { spacing, dimensions, position, layout } from 'ui-box'
import { withTheme } from '../../theme'
import { Pane } from '../../layers'
import { Text } from '../../typography'
import { Icon } from '../../icon'
class InlineAlert extends PureComponent {
static propTypes = {
/**
* Composes some Box APIs.
*/
...spacing.propTypes,
...position.propTypes,
...layout.propTypes,
...dimensions.propTypes,
/**
* The content of the alert.
*/
children: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
/**
* The intent of the alert. This should always be set explicitly.
*/
intent: PropTypes.oneOf(['none', 'success', 'warning', 'danger'])
.isRequired,
/**
* When true, show a icon on the left matching the type.
* There is no point not showing this.
...dimensions.propTypes,
/**
* Composes the spacing spec from the Box primitivie.
*/
...spacing.propTypes,
/**
* Composes the position spec from the Box primitivie.
*/
...position.propTypes,
/**
* Composes the layout spec from the Box primitivie.
*/
...layout.propTypes,
/**
* Forcefully set the active state of a button.
* Useful in conjuction with a Popover.
*/
isActive: PropTypes.bool,
/**
* When true, the button is disabled.
* isLoading also sets the button to disabled.
*/
disabled: PropTypes.bool,
/**
* Name of a Blueprint UI icon, or an icon element, to render.
* This prop is required because it determines the content of the component, but it can