Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
class ToolbarMenuRadioGroup extends UIComponent> {
static displayName = 'ToolbarMenuRadioGroup'
static create: ShorthandFactory
static className = 'ui-toolbars' // FIXME: required by getComponentInfo/isConformant. But this is group inside a toolbar not a group of toolbars
static slotClassNames: ToolbarMenuRadioGroupSlotClassNames = {
wrapper: `${ToolbarMenuRadioGroup.className}__wrapper`,
}
static propTypes = {
...commonPropTypes.createCommon(),
activeIndex: PropTypes.number,
items: customPropTypes.collectionShorthand,
onItemClick: PropTypes.func,
wrapper: customPropTypes.itemShorthand,
}
static defaultProps = {
as: 'ul',
accessibility: toolbarMenuRadioGroupBehavior,
wrapper: {},
}
handleItemOverrides = variables => (
predefinedProps: ToolbarMenuItemProps,
): ToolbarMenuItemProps => ({
onClick: (e, itemProps) => {
_.invoke(predefinedProps, 'onClick', e, itemProps)
_.invoke(this.props, 'onItemClick', e, itemProps)
onSearchQueryChange: PropTypes.func,
onSelectedChange: PropTypes.func,
open: PropTypes.bool,
placeholder: PropTypes.string,
position: PropTypes.oneOf(POSITIONS),
renderItem: PropTypes.func,
renderSelectedItem: PropTypes.func,
search: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
searchQuery: PropTypes.string,
searchInput: customPropTypes.itemShorthand,
toggleIndicator: customPropTypes.itemShorthandWithoutJSX,
triggerButton: customPropTypes.itemShorthand,
unstable_pinned: PropTypes.bool,
value: PropTypes.oneOfType([
customPropTypes.itemShorthand,
customPropTypes.collectionShorthand,
]),
}
static defaultProps = {
align: 'start',
as: 'div',
checkableIndicator: 'stardust-checkmark',
clearIndicator: 'stardust-close',
itemToString: item => {
if (!item || React.isValidElement(item)) {
return ''
}
// targets DropdownItem shorthand objects
return (item as any).header || String(item)
},
*/
getOverflowItems?: (
startIndex: number,
) => ShorthandCollection // FIXME: use correct kind
}
class Toolbar extends UIComponent> {
static create: ShorthandFactory
static className = 'ui-toolbar'
static displayName = 'Toolbar'
static propTypes = {
...commonPropTypes.createCommon(),
items: customPropTypes.collectionShorthandWithKindProp([
'divider',
'item',
'group',
'toggle',
'custom',
]),
overflow: PropTypes.bool,
overflowOpen: PropTypes.bool,
overflowItem: customPropTypes.shorthandAllowingChildren,
onOverflow: PropTypes.func,
onOverflowOpenChange: PropTypes.func,
getOverflowItems: PropTypes.func,
}
static defaultProps = {
accessibility: toolbarBehavior,
/** Shorthand array of props for ToolbarRadioGroup. */
items?: ShorthandCollection
}
class ToolbarRadioGroup extends UIComponent> {
static displayName = 'ToolbarRadioGroup'
static className = 'ui-toolbars' // FIXME: required by getComponentInfo/isConformant. But this is group inside a toolbar not a group of toolbars
static create: ShorthandFactory
static propTypes = {
...commonPropTypes.createCommon(),
activeIndex: PropTypes.number,
items: customPropTypes.collectionShorthandWithKindProp(['divider', 'item']),
}
static defaultProps = {
accessibility: toolbarRadioGroupBehavior as Accessibility,
}
itemRefs: React.RefObject[] = []
actionHandlers = {
nextItem: event => this.setFocusedItem(event, 1),
prevItem: event => this.setFocusedItem(event, -1),
}
setFocusedItem = (event, direction) => {
const { items } = this.props
// Heads Up! Keep in sync with renderComponent.tsx
const styleParam = {
theme: { direction: theme.rtl ? 'rtl' : 'ltr' },
}
const className = theme.renderer.renderRule(getConfig, styleParam)
return children({ className })
}
Design.displayName = 'Design'
Design.propTypes = {
children: PropTypes.func.isRequired,
config: customPropTypes.design.isRequired,
}
export default Design
static slotClassNames: TableSlotClassNames = {
header: `${Table.className}__header`,
}
static propTypes = {
...commonPropTypes.createCommon({
content: false,
}),
content: customPropTypes.every([
customPropTypes.disallow(['children']),
PropTypes.oneOfType([
PropTypes.arrayOf(customPropTypes.nodeContent),
customPropTypes.nodeContent,
]),
]),
header: customPropTypes.itemShorthand,
rows: customPropTypes.collectionShorthand,
compact: PropTypes.bool,
}
static defaultProps = {
as: 'div',
accessibility: tableBehavior as Accessibility,
}
renderRows(accessibility: ReactAccessibilityBehavior, variables: ComponentVariablesObject) {
const { rows, compact } = this.props
return _.map(rows, (row: TableRowProps, index: number) => {
const props = {
role: accessibility.attributes.row.role,
compact,
defaultSearchQuery: PropTypes.string,
defaultValue: PropTypes.oneOfType([
customPropTypes.itemShorthand,
customPropTypes.collectionShorthand,
]),
fluid: PropTypes.bool,
getA11ySelectionMessage: PropTypes.object,
getA11yStatusMessage: PropTypes.func,
highlightFirstItemOnOpen: PropTypes.bool,
highlightedIndex: PropTypes.number,
inline: PropTypes.bool,
items: customPropTypes.collectionShorthand,
itemToString: PropTypes.func,
itemToValue: PropTypes.func,
loading: PropTypes.bool,
loadingMessage: customPropTypes.itemShorthand,
moveFocusOnTab: PropTypes.bool,
multiple: PropTypes.bool,
noResultsMessage: customPropTypes.itemShorthand,
offset: PropTypes.string,
onOpenChange: PropTypes.func,
onSearchQueryChange: PropTypes.func,
onSelectedChange: PropTypes.func,
open: PropTypes.bool,
placeholder: PropTypes.string,
position: PropTypes.oneOf(POSITIONS),
renderItem: PropTypes.func,
renderSelectedItem: PropTypes.func,
search: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
searchQuery: PropTypes.string,
searchInput: customPropTypes.itemShorthand,
toggleIndicator: customPropTypes.itemShorthandWithoutJSX,
static slotClassNames: ToolbarMenuItemSlotClassNames = {
activeIndicator: `${ToolbarMenuItem.className}__activeIndicator`,
wrapper: `${ToolbarMenuItem.className}__wrapper`,
submenu: `${ToolbarMenuItem.className}__submenu`,
}
static create: ShorthandFactory
static propTypes = {
...commonPropTypes.createCommon(),
active: PropTypes.bool,
activeIndicator: customPropTypes.itemShorthandWithoutJSX,
defaultMenuOpen: PropTypes.bool,
disabled: PropTypes.bool,
icon: customPropTypes.itemShorthand,
index: PropTypes.number,
submenuIndicator: customPropTypes.itemShorthandWithoutJSX,
inSubmenu: PropTypes.bool,
menu: PropTypes.oneOfType([customPropTypes.itemShorthand, customPropTypes.collectionShorthand]),
menuOpen: PropTypes.bool,
onClick: PropTypes.func,
popup: PropTypes.oneOfType([
PropTypes.shape({
...Popup.propTypes,
trigger: customPropTypes.never,
children: customPropTypes.never,
}),
PropTypes.string,
]),
wrapper: customPropTypes.itemShorthand,
}
class FormField extends UIComponent, any> {
static displayName = 'FormField'
static className = 'ui-form__field'
static create: ShorthandFactory
static propTypes = {
...commonPropTypes.createCommon({
content: false,
}),
control: customPropTypes.itemShorthand,
id: PropTypes.string,
inline: PropTypes.bool,
label: customPropTypes.itemShorthand,
message: customPropTypes.itemShorthand,
name: PropTypes.string,
required: PropTypes.bool,
type: PropTypes.string,
}
static defaultProps = {
as: 'div',
control: { as: Input },
}
renderComponent({
ElementType,
classes,
accessibility,
styles,
loadingMessage: customPropTypes.itemShorthand,
moveFocusOnTab: PropTypes.bool,
multiple: PropTypes.bool,
noResultsMessage: customPropTypes.itemShorthand,
offset: PropTypes.string,
onOpenChange: PropTypes.func,
onSearchQueryChange: PropTypes.func,
onSelectedChange: PropTypes.func,
open: PropTypes.bool,
placeholder: PropTypes.string,
position: PropTypes.oneOf(POSITIONS),
renderItem: PropTypes.func,
renderSelectedItem: PropTypes.func,
search: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
searchQuery: PropTypes.string,
searchInput: customPropTypes.itemShorthand,
toggleIndicator: customPropTypes.itemShorthandWithoutJSX,
triggerButton: customPropTypes.itemShorthand,
unstable_pinned: PropTypes.bool,
value: PropTypes.oneOfType([
customPropTypes.itemShorthand,
customPropTypes.collectionShorthand,
]),
}
static defaultProps = {
align: 'start',
as: 'div',
checkableIndicator: 'stardust-checkmark',
clearIndicator: 'stardust-close',
itemToString: item => {
if (!item || React.isValidElement(item)) {