Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
};
return(
<button aria-expanded="{expanded}">
<span>{text}</span>
{icon}
</button>
);
};
ButtonWithIcon.propTypes = {
/** id for the button */
id: PropTypes.string,
// Function to run on click of the button.
onClick: PropTypes.func,
// Sets a reference to the button onto the passed node.
setButtonRef: ref(),
// Button text.
text: PropTypes.string,
/** HTML <button> 'type' attribute */
type: PropTypes.oneOf(['submit', 'reset', 'button', '']),
// Button classes.
classes: PropTypes.arrayOf(PropTypes.string),
// Icon to display within the button.
icon: PropTypes.element,
// Adds expanded class to button if true.
expanded: PropTypes.bool,
// Adds capitalized class to button if true.
capitalized: PropTypes.bool,
// Defines the size, default size fits the most square icons and "small" setting is specific for the chevron icon.
iconSize: PropTypes.oneOf(['', 'small']),
/** The aria-label property is used to provide the label to any assistive
* technologies. This is useful if the text value is not descriptive of the</button>
// eslint-disable-next-line react/jsx-props-no-spreading
const component = ;
if (WrappingComponent) {
return (
// eslint-disable-next-line react/jsx-props-no-spreading
{component}
);
}
return component;
}
}
WrapperComponent.propTypes = {
Component: makeValidElementType(adapter).isRequired,
refProp: PropTypes.oneOfType([PropTypes.string, ref()]),
props: PropTypes.object.isRequired,
wrappingComponentProps: PropTypes.object,
context: PropTypes.object,
};
WrapperComponent.defaultProps = {
refProp: null,
context: null,
wrappingComponentProps: null,
};
if (options.context && (node.type.contextTypes || options.childContextTypes)) {
// For full rendering, we are using this wrapper component to provide context if it is
// specified in both the options AND the child component defines `contextTypes` statically
// OR the merged context types for all children (the node component or deeper children) are
// specified in options parameter under childContextTypes.
// In that case, we define both a `getChildContext()` function and a `childContextTypes` prop.