Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.usage(
`import { MaskedInput } from 'grommet';
`,
)
.intrinsicElement('input');
DocumentedMaskedInput.propTypes = {
id: PropTypes.string.description('The id attribute of the input.'),
name: PropTypes.string.description('The name attribute of the input.'),
onChange: PropTypes.func.description(
`Function that will be called when the user types or pastes text.`,
),
onBlur: PropTypes.func.description(
`Function that will be called when the user leaves the field.`,
),
mask: PropTypes.arrayOf(
PropTypes.shape({
length: PropTypes.oneOfType([
PropTypes.number,
PropTypes.arrayOf(PropTypes.number),
]),
fixed: PropTypes.string,
options: PropTypes.arrayOf(
PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
),
regexp: PropTypes.shape({}), // RegExp
}),
).description(
`Describes the structure of the mask. If a regexp is provided, it should
allow both the final full string element as well as partial strings
as the user types characters one by one.`,
),
export var doc = function doc(Chart) {
var DocumentedChart = describe(Chart).availableAt(getAvailableAtBadge('Chart')).description('A graphical chart.').usage("import { Chart } from 'grommet';\n"); // We don't include svg due to a collision on the values property
// .intrinsicElement('svg');
DocumentedChart.propTypes = _extends({}, genericProps, {
bounds: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.number)).description("The limits for the values, specified as a two dimensional array.\n If not specified, the bounds will automatically be set to fit\n the provided values."),
color: PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
color: PropTypes.string,
opacity: PropTypes.oneOfType([PropTypes.oneOf(['weak', 'medium', 'strong']), PropTypes.bool])
}), PropTypes.arrayOf(PropTypes.shape({
color: PropTypes.string,
value: PropTypes.number
}))]).description("A color identifier to use for the graphic color. If an\n array is specified, it is used to create a gradient mask. Array objects\n indicate what color to show at what value. In the simplest case, the\n values should map to the Y bounds values, resulting in a vertical\n gradient. Specifying more objects allows more fine grained control over\n where the gradient colors change.").defaultValue('accent-1'),
gap: PropTypes.oneOfType([PropTypes.oneOf(['none', 'xxsmall', 'xsmall', 'small', 'medium', 'large', 'xlarge']), PropTypes.string]).description("The amount of spacing between data points. This\n is only used when the size specifies width as 'auto'."),
id: PropTypes.string.description("A unique identifier for the Chart. This\n is required if more than one Chart is shown and they use color\n gradients."),
onClick: PropTypes.func.description("Called when the user clicks on it.\n This is only available when the type is line or area."),
onHover: PropTypes.func.description("Called with a boolean argument\n indicating when the user hovers onto or away from it.\n This is only available when the type is line or area."),
overflow: PropTypes.bool.description("Whether the chart strokes should overflow the component. Set this\n to true for precise positioning when stacking charts or including\n precise axes. Set this to false to have the graphical elements\n align with the component boundaries.").defaultValue(false),
round: PropTypes.bool.description('Whether to round the line ends.').defaultValue(false),
size: PropTypes.oneOfType([PropTypes.oneOf(['xxsmall', 'xsmall', 'small', 'medium', 'large', 'xlarge', 'full']), PropTypes.shape({
height: PropTypes.oneOfType([PropTypes.oneOf(['xxsmall', 'xsmall', 'small', 'medium', 'large', 'xlarge', 'full']), PropTypes.string]),
width: PropTypes.oneOfType([PropTypes.oneOf(['xxsmall', 'xsmall', 'small', 'medium', 'large', 'xlarge', 'full', 'auto']), PropTypes.string])
}), PropTypes.string]).description('The size of the Chart.').defaultValue({
width: 'medium',
height: 'small'
}),
suggestionIsOpen: PropTypes.string
}).description("Custom messages for TextInput. Used for accessibility by screen \n readers.").defaultValue({
enterSelect: '(Press Enter to Select)',
suggestionsCount: 'suggestions available',
suggestionsExist: 'This input has suggestions use arrow keys to navigate',
suggestionIsOpen: 'Suggestions drop is open, continue to use arrow keys to navigate'
}),
name: PropTypes.string.description('The name attribute of the input.'),
onChange: PropTypes.func.description('Function that will be called when the user types in the input.'),
onSelect: PropTypes.func.description("Function that will be called when the user selects a suggestion.\nThe suggestion contains the object chosen from the supplied suggestions."),
onSuggestionsOpen: PropTypes.func.description('Function that will be called when the suggestions drop is opened.'),
onSuggestionsClose: PropTypes.func.description('Function that will be called when the suggestions drop is closed.'),
placeholder: PropTypes.node.description('Placeholder to use when no value is provided.'),
plain: PropTypes.bool.description("Whether this is a plain input with no border or padding.\nOnly use this when the containing context provides sufficient affordance"),
size: PropTypes.oneOfType([PropTypes.oneOf(['small', 'medium', 'large', 'xlarge']), PropTypes.string]).description('The size of the TextInput.'),
suggestions: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.shape({
label: PropTypes.node,
value: PropTypes.any
}), PropTypes.string])).description("Suggestions to show. It is recommended to avoid showing too many\nsuggestions and instead rely on the user to type more."),
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('What text to put in the input.')
};
return DocumentedTextInput;
};
export var themeDoc = _extends({
'Whether to allow multiple options to be selected.',
),
onChange: PropTypes.func.description(
'Function that will be called when the user selects an option.',
),
onClose: PropTypes.func.description(
'Function that will be called when the Select drop closes.',
),
onOpen: PropTypes.func.description(
'Function that will be called when the Select drop opens.',
),
onSearch: PropTypes.func.description(
`Function that will be called when the user types in the search input.
If this property is not provided, no search field will be rendered.`,
),
options: PropTypes.arrayOf(
PropTypes.oneOfType([
PropTypes.string,
PropTypes.element,
PropTypes.object,
]),
).description(
`Options can be either a string or an object. If an object is used, use
children callback in order to render anything based on the current item.`,
).isRequired,
open: PropTypes.bool.description(`Initial state of the select component`),
placeholder: PropTypes.oneOfType([
PropTypes.string,
PropTypes.node,
]).description('Placeholder text to use when no value is provided.'),
plain: PropTypes.bool.description(
'Whether this is a plain Select input with no border or padding.',
'xxsmall',
'xsmall',
'small',
'medium',
'large',
'xlarge',
'full',
]),
PropTypes.string,
])
.description('How thick to make the selection indicator.')
.defaultValue('medium'),
step: PropTypes.number
.description('The step interval between values.')
.defaultValue(1),
values: PropTypes.arrayOf(PropTypes.number).description(
'The current values.',
).isRequired,
};
return DocumentedRangeSelector;
};
export const doc = WorldMap => {
const DocumentedWorldMap = describe(WorldMap)
.availableAt(getAvailableAtBadge('WorldMap'))
.description('A map of the world, or a continent.')
.usage("import { WorldMap } from 'grommet';\n")
.intrinsicElement('svg');
DocumentedWorldMap.propTypes = {
...genericProps,
color: colorPropType.description('Default color'),
continents: PropTypes.arrayOf(
PropTypes.shape({
color: colorPropType,
name: PropTypes.oneOf([
'Africa',
'Asia',
'Australia',
'Europe',
'North America',
'South America',
]).isRequired,
onClick: PropTypes.func,
onHover: PropTypes.func,
}),
).description('Continent details.'),
onSelectPlace: PropTypes.func
.description(`Called when the user clicks on a place.
DocumentedMenu.propTypes = {
disabled: PropTypes.bool.description('Whether the menu should be disabled.'),
dropAlign: PropTypes.shape({
top: PropTypes.oneOf(VERTICAL_ALIGN_OPTIONS),
bottom: PropTypes.oneOf(VERTICAL_ALIGN_OPTIONS),
left: PropTypes.oneOf(HORIZONTAL_ALIGN_OPTIONS),
right: PropTypes.oneOf(HORIZONTAL_ALIGN_OPTIONS)
}).description('Where to place the drop down. The keys correspond to a side of the drop down.\nThe values correspond to a side of the control. For instance,\n{left: \'left\', top: \'bottom\'} would align the left edges and the top of\nthe drop down to the bottom of the control. At most one of left or right and\none of top or bottom should be specified.'),
dropBackground: PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
color: PropTypes.string,
opacity: PropTypes.oneOfType([PropTypes.oneOf(['weak', 'medium', 'strong']), PropTypes.bool])
})]).description('Background color when drop is active'),
dropTarget: PropTypes.object.description('Target where the drop will be aligned to. This should be\n a React reference. Typically, this is not required as the drop will be\n aligned to the Menu itself by default.'),
icon: PropTypes.oneOfType([PropTypes.bool, PropTypes.node]).description('Indicates the icon shown as a control to open it.'),
items: PropTypes.arrayOf(PropTypes.object).description('Menu items to be placed inside the drop down.\nThe object values can be any Button prop, for example: label and onClick.').isRequired,
label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).description('Indicates the label shown as a control to open it.'),
messages: PropTypes.shape({
closeMenu: PropTypes.string,
openMenu: PropTypes.string
}).description('Custom messages. Used for accessibility by screen readers.'),
size: PropTypes.oneOf(['small', 'medium', 'large', 'xlarge']).description('The size of the menu.')
};
return DocumentedMenu;
});
DocumentedSelect.propTypes = {
...genericProps,
children: PropTypes.func.description(
`Function that will be called when each option is rendered.
It will be passed (option, index, options, state) where option
is the option to render, index is the index of that option in the
options array, and state is an object with
{ active, disabled, selected } keys indicating the current state
of the option.`,
),
closeOnChange: PropTypes.bool
.description('Wether to close the drop when a selection is made.')
.defaultValue(true),
disabled: PropTypes.oneOfType([
PropTypes.bool,
PropTypes.arrayOf(
PropTypes.oneOfType([
PropTypes.number,
PropTypes.string,
PropTypes.object,
]),
),
])
.description(
`Whether the entire select or individual options should be disabled.
An array of numbers indicates the indexes into 'options' of the
disabled options. An array of strings or objects work the same way
as the 'value' to indicate which options are disabled.`,
)
.defaultValue(false),
disabledKey: PropTypes.oneOfType([
PropTypes.string,
dropTarget: PropTypes.object.description('Target where the options drop will be aligned to. This should be\n a React reference. Typically, this is not required as the drop will be\n aligned to the Select itself by default.'),
focusIndicator: PropTypes.bool.description('Whether when \'plain\' it should receive a focus outline.'),
messages: PropTypes.shape({
multiple: PropTypes.string
}).description('Custom messages.'),
multiple: PropTypes.bool.description('Whether to allow multiple options to be selected.'),
onChange: PropTypes.func.description('Function that will be called when the user selects an option.'),
onClose: PropTypes.func.description('Function that will be called when the Select drop closes.'),
onSearch: PropTypes.func.description('Function that will be called when the user types in the search input.\n If this property is not provided, no search field will be rendered.'),
options: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.object])).description('Options can be either a string or an object. If an object is used, use\n children callback in order to render anything based on the current item.').isRequired,
placeholder: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).description('Placeholder text to use when no value is provided.'),
plain: PropTypes.bool.description('Whether this is a plain Select input with no border or padding.'),
searchPlaceholder: PropTypes.string.description('Placeholder text to use in the search box when the search input is empty.'),
selected: PropTypes.oneOfType([PropTypes.number, PropTypes.arrayOf(PropTypes.number)]).description('Index of the currently selected option. When multiple, the set of\n options selected. This property is required when multiple.'),
size: PropTypes.oneOf(['small', 'medium', 'large', 'xlarge']).description('The size of the select.'),
value: PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.object, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.object]))]).description('Currently selected value. This can be an array\n when multiple. Passing an element allows the caller to control how\n the value is rendered.')
};
return DocumentedSelect;
});