@hig/dropdown
Advanced tools
Comparing version 0.2.3 to 0.3.0
@@ -222,2 +222,6 @@ import React, { Component } from 'react'; | ||
/** | ||
* Called when user moves mouse over the option | ||
*/ | ||
onHover: PropTypes.func, | ||
/** | ||
* Called when user begins clicking on an option | ||
@@ -231,6 +235,2 @@ */ | ||
/** | ||
* Called when user moves mouse over the option | ||
*/ | ||
onHover: PropTypes.func, | ||
/** | ||
* Called when the user selects the option by clicking or keyboard interaction | ||
@@ -273,3 +273,3 @@ */ | ||
}, | ||
"onMouseDown": { | ||
"onHover": { | ||
"type": { | ||
@@ -279,5 +279,5 @@ "name": "func" | ||
"required": false, | ||
"description": "Called when user begins clicking on an option" | ||
"description": "Called when user moves mouse over the option" | ||
}, | ||
"onMouseMove": { | ||
"onMouseDown": { | ||
"type": { | ||
@@ -287,5 +287,5 @@ "name": "func" | ||
"required": false, | ||
"description": "Called when user moves mouse over the option" | ||
"description": "Called when user begins clicking on an option" | ||
}, | ||
"onHover": { | ||
"onMouseMove": { | ||
"type": { | ||
@@ -344,5 +344,6 @@ "name": "func" | ||
* @param {DownshiftHelpers} downshift | ||
* @param {function(Object)} renderOption | ||
* @returns {function(OptionMeta, number): JSX.Element} | ||
*/ | ||
function createOptionRenderer(downshift) { | ||
function createOptionRenderer(downshift, renderOption) { | ||
var formatOption = downshift.formatOption, | ||
@@ -355,15 +356,23 @@ getItemProps = downshift.getItemProps, | ||
return function (option, index) { | ||
var itemProps = getItemProps({ | ||
index: index, | ||
key: "option-" + index, | ||
item: option, | ||
selected: isSelected(option), | ||
highlighted: highlightedIndex === index | ||
}); | ||
var result = void 0; | ||
if (option && option.render !== undefined) { | ||
result = option.render(option); | ||
} else if (renderOption !== undefined) { | ||
result = renderOption(option); | ||
} else { | ||
var itemProps = getItemProps({ | ||
index: index, | ||
key: "option-" + index, | ||
item: option, | ||
selected: isSelected(option), | ||
highlighted: highlightedIndex === index | ||
}); | ||
return React.createElement( | ||
OptionPresenter, | ||
itemProps, | ||
formatOption(option) | ||
); | ||
result = React.createElement( | ||
OptionPresenter, | ||
itemProps, | ||
formatOption(option) | ||
); | ||
} | ||
return result; | ||
}; | ||
@@ -379,7 +388,3 @@ } | ||
function renderOptions(props) { | ||
var _props$options = props.options, | ||
options = _props$options === undefined ? [] : _props$options, | ||
_props$multiple = props.multiple, | ||
multiple = _props$multiple === undefined ? false : _props$multiple, | ||
_props$formatOption = props.formatOption, | ||
var _props$formatOption = props.formatOption, | ||
formatOption = _props$formatOption === undefined ? function (option) { | ||
@@ -393,2 +398,7 @@ return String(option); | ||
highlightedIndex = props.highlightedIndex, | ||
_props$multiple = props.multiple, | ||
multiple = _props$multiple === undefined ? false : _props$multiple, | ||
_props$options = props.options, | ||
options = _props$options === undefined ? [] : _props$options, | ||
renderOption = props.renderOption, | ||
selectedItem = props.selectedItem, | ||
@@ -399,12 +409,13 @@ _props$selectedItems = props.selectedItems, | ||
var downshift = { | ||
multiple: multiple, | ||
formatOption: formatOption, | ||
getItemProps: getItemProps, | ||
highlightedIndex: highlightedIndex, | ||
multiple: multiple, | ||
selectedItem: selectedItem, | ||
selectedItems: selectedItems | ||
}; | ||
var renderOption = createOptionRenderer(downshift); | ||
return options.map(renderOption); | ||
var optionRenderer = createOptionRenderer(downshift, renderOption); | ||
return options.map(optionRenderer); | ||
} | ||
@@ -565,6 +576,6 @@ | ||
value: function renderMenu(downshift) { | ||
var isOpen = downshift.isOpen, | ||
getItemProps = downshift.getItemProps, | ||
var getItemProps = downshift.getItemProps, | ||
getMenuProps = downshift.getMenuProps, | ||
highlightedIndex = downshift.highlightedIndex, | ||
isOpen = downshift.isOpen, | ||
selectedItem = downshift.selectedItem, | ||
@@ -575,12 +586,14 @@ selectedItems = downshift.selectedItems; | ||
var _props4 = this.props, | ||
formatOption = _props4.formatOption, | ||
multiple = _props4.multiple, | ||
options = _props4.options, | ||
formatOption = _props4.formatOption; | ||
renderOption = _props4.renderOption; | ||
var children = renderOptions({ | ||
multiple: multiple, | ||
options: options, | ||
formatOption: formatOption, | ||
getItemProps: getItemProps, | ||
highlightedIndex: highlightedIndex, | ||
multiple: multiple, | ||
options: options, | ||
renderOption: renderOption, | ||
selectedItem: selectedItem, | ||
@@ -622,2 +635,17 @@ selectedItems: selectedItems | ||
/** | ||
* The default value when the component is uncontrolled | ||
*/ | ||
defaultValue: PropTypes.oneOfType([PropTypes.any, PropTypes.arrayOf(PropTypes.any)]), | ||
/** | ||
* Prevents user actions on the field | ||
*/ | ||
disabled: PropTypes.bool, | ||
/** | ||
* Used to format options into human readable strings | ||
* | ||
* Note that if both formatOption and renderOption are provided, | ||
* renderOption will take precedence | ||
*/ | ||
formatOption: PropTypes.func, | ||
/** | ||
* HTML ID attribute | ||
@@ -627,6 +655,2 @@ */ | ||
/** | ||
* Text describing what the field represents | ||
*/ | ||
label: PropTypes.string, | ||
/** | ||
* Instructional text for the field | ||
@@ -636,5 +660,5 @@ */ | ||
/** | ||
* Placeholder text to render when an option has not been selected | ||
* Text describing what the field represents | ||
*/ | ||
placeholder: PropTypes.string, | ||
label: PropTypes.string, | ||
/** | ||
@@ -645,18 +669,14 @@ * Enables multiple selection | ||
/** | ||
* Prevents user actions on the field | ||
* Called when the text field is blurred | ||
*/ | ||
disabled: PropTypes.bool, | ||
onBlur: PropTypes.func, | ||
/** | ||
* Text describing why the field is required | ||
* Called with the selected option when the value changes | ||
*/ | ||
required: PropTypes.string, | ||
onChange: PropTypes.func, | ||
/** | ||
* The default value when the component is uncontrolled | ||
* Called when the text field is focused | ||
*/ | ||
defaultValue: PropTypes.oneOfType([PropTypes.any, PropTypes.arrayOf(PropTypes.any)]), | ||
onFocus: PropTypes.func, | ||
/** | ||
* An array of objects to choose from | ||
*/ | ||
value: PropTypes.oneOfType([PropTypes.any, PropTypes.arrayOf(PropTypes.any)]), | ||
/** | ||
* An array of unique values of any type except `undefined` | ||
@@ -666,17 +686,23 @@ */ | ||
/** | ||
* Called with the selected option when the value changes | ||
* Placeholder text to render when an option has not been selected | ||
*/ | ||
onChange: PropTypes.func, | ||
placeholder: PropTypes.string, | ||
/** | ||
* Called when the text field is blurred | ||
* When present, this function is used to render each option. Each | ||
* option is passed as an argument. If any option has Option.render | ||
* prop present, that will take precedence and this | ||
* function will not be called for that option. | ||
* | ||
* Similarly if both formatOption and renderOption are provided, | ||
* renderOption will take precedence | ||
*/ | ||
onBlur: PropTypes.func, | ||
renderOption: PropTypes.func, | ||
/** | ||
* Called when the text field is focused | ||
* Text describing why the field is required | ||
*/ | ||
onFocus: PropTypes.func, | ||
required: PropTypes.string, | ||
/** | ||
* Used to format options into human readable strings | ||
* An array of objects to choose from | ||
*/ | ||
formatOption: PropTypes.func | ||
value: PropTypes.oneOfType([PropTypes.any, PropTypes.arrayOf(PropTypes.any)]) | ||
}; | ||
@@ -696,15 +722,41 @@ Dropdown.defaultProps = { | ||
"props": { | ||
"id": { | ||
"defaultValue": { | ||
"type": { | ||
"name": "string" | ||
"name": "union", | ||
"value": [{ | ||
"name": "any" | ||
}, { | ||
"name": "arrayOf", | ||
"value": { | ||
"name": "any" | ||
} | ||
}] | ||
}, | ||
"required": false, | ||
"description": "HTML ID attribute" | ||
"description": "The default value when the component is uncontrolled" | ||
}, | ||
"label": { | ||
"disabled": { | ||
"type": { | ||
"name": "bool" | ||
}, | ||
"required": false, | ||
"description": "Prevents user actions on the field" | ||
}, | ||
"formatOption": { | ||
"type": { | ||
"name": "func" | ||
}, | ||
"required": false, | ||
"description": "Used to format options into human readable strings\n\nNote that if both formatOption and renderOption are provided,\nrenderOption will take precedence", | ||
"defaultValue": { | ||
"value": "function(option) {\n return option ? String(option) : \"\";\n}", | ||
"computed": false | ||
} | ||
}, | ||
"id": { | ||
"type": { | ||
"name": "string" | ||
}, | ||
"required": false, | ||
"description": "Text describing what the field represents" | ||
"description": "HTML ID attribute" | ||
}, | ||
@@ -718,3 +770,3 @@ "instructions": { | ||
}, | ||
"placeholder": { | ||
"label": { | ||
"type": { | ||
@@ -724,3 +776,3 @@ "name": "string" | ||
"required": false, | ||
"description": "Placeholder text to render when an option has not been selected" | ||
"description": "Text describing what the field represents" | ||
}, | ||
@@ -734,46 +786,23 @@ "multiple": { | ||
}, | ||
"disabled": { | ||
"onBlur": { | ||
"type": { | ||
"name": "bool" | ||
"name": "func" | ||
}, | ||
"required": false, | ||
"description": "Prevents user actions on the field" | ||
"description": "Called when the text field is blurred" | ||
}, | ||
"required": { | ||
"onChange": { | ||
"type": { | ||
"name": "string" | ||
"name": "func" | ||
}, | ||
"required": false, | ||
"description": "Text describing why the field is required" | ||
"description": "Called with the selected option when the value changes" | ||
}, | ||
"defaultValue": { | ||
"onFocus": { | ||
"type": { | ||
"name": "union", | ||
"value": [{ | ||
"name": "any" | ||
}, { | ||
"name": "arrayOf", | ||
"value": { | ||
"name": "any" | ||
} | ||
}] | ||
"name": "func" | ||
}, | ||
"required": false, | ||
"description": "The default value when the component is uncontrolled" | ||
"description": "Called when the text field is focused" | ||
}, | ||
"value": { | ||
"type": { | ||
"name": "union", | ||
"value": [{ | ||
"name": "any" | ||
}, { | ||
"name": "arrayOf", | ||
"value": { | ||
"name": "any" | ||
} | ||
}] | ||
}, | ||
"required": false, | ||
"description": "An array of objects to choose from" | ||
}, | ||
"options": { | ||
@@ -789,10 +818,10 @@ "type": { | ||
}, | ||
"onChange": { | ||
"placeholder": { | ||
"type": { | ||
"name": "func" | ||
"name": "string" | ||
}, | ||
"required": false, | ||
"description": "Called with the selected option when the value changes" | ||
"description": "Placeholder text to render when an option has not been selected" | ||
}, | ||
"onBlur": { | ||
"renderOption": { | ||
"type": { | ||
@@ -802,21 +831,25 @@ "name": "func" | ||
"required": false, | ||
"description": "Called when the text field is blurred" | ||
"description": "When present, this function is used to render each option. Each\noption is passed as an argument. If any option has Option.render\nprop present, that will take precedence and this\nfunction will not be called for that option.\n\nSimilarly if both formatOption and renderOption are provided,\nrenderOption will take precedence" | ||
}, | ||
"onFocus": { | ||
"required": { | ||
"type": { | ||
"name": "func" | ||
"name": "string" | ||
}, | ||
"required": false, | ||
"description": "Called when the text field is focused" | ||
"description": "Text describing why the field is required" | ||
}, | ||
"formatOption": { | ||
"value": { | ||
"type": { | ||
"name": "func" | ||
"name": "union", | ||
"value": [{ | ||
"name": "any" | ||
}, { | ||
"name": "arrayOf", | ||
"value": { | ||
"name": "any" | ||
} | ||
}] | ||
}, | ||
"required": false, | ||
"description": "Used to format options into human readable strings", | ||
"defaultValue": { | ||
"value": "function(option) {\n return option ? String(option) : \"\";\n}", | ||
"computed": false | ||
} | ||
"description": "An array of objects to choose from" | ||
} | ||
@@ -823,0 +856,0 @@ } |
@@ -230,2 +230,6 @@ 'use strict'; | ||
/** | ||
* Called when user moves mouse over the option | ||
*/ | ||
onHover: PropTypes.func, | ||
/** | ||
* Called when user begins clicking on an option | ||
@@ -239,6 +243,2 @@ */ | ||
/** | ||
* Called when user moves mouse over the option | ||
*/ | ||
onHover: PropTypes.func, | ||
/** | ||
* Called when the user selects the option by clicking or keyboard interaction | ||
@@ -281,3 +281,3 @@ */ | ||
}, | ||
"onMouseDown": { | ||
"onHover": { | ||
"type": { | ||
@@ -287,5 +287,5 @@ "name": "func" | ||
"required": false, | ||
"description": "Called when user begins clicking on an option" | ||
"description": "Called when user moves mouse over the option" | ||
}, | ||
"onMouseMove": { | ||
"onMouseDown": { | ||
"type": { | ||
@@ -295,5 +295,5 @@ "name": "func" | ||
"required": false, | ||
"description": "Called when user moves mouse over the option" | ||
"description": "Called when user begins clicking on an option" | ||
}, | ||
"onHover": { | ||
"onMouseMove": { | ||
"type": { | ||
@@ -352,5 +352,6 @@ "name": "func" | ||
* @param {DownshiftHelpers} downshift | ||
* @param {function(Object)} renderOption | ||
* @returns {function(OptionMeta, number): JSX.Element} | ||
*/ | ||
function createOptionRenderer(downshift) { | ||
function createOptionRenderer(downshift, renderOption) { | ||
var formatOption = downshift.formatOption, | ||
@@ -363,15 +364,23 @@ getItemProps = downshift.getItemProps, | ||
return function (option, index) { | ||
var itemProps = getItemProps({ | ||
index: index, | ||
key: "option-" + index, | ||
item: option, | ||
selected: isSelected(option), | ||
highlighted: highlightedIndex === index | ||
}); | ||
var result = void 0; | ||
if (option && option.render !== undefined) { | ||
result = option.render(option); | ||
} else if (renderOption !== undefined) { | ||
result = renderOption(option); | ||
} else { | ||
var itemProps = getItemProps({ | ||
index: index, | ||
key: "option-" + index, | ||
item: option, | ||
selected: isSelected(option), | ||
highlighted: highlightedIndex === index | ||
}); | ||
return React__default.createElement( | ||
OptionPresenter, | ||
itemProps, | ||
formatOption(option) | ||
); | ||
result = React__default.createElement( | ||
OptionPresenter, | ||
itemProps, | ||
formatOption(option) | ||
); | ||
} | ||
return result; | ||
}; | ||
@@ -387,7 +396,3 @@ } | ||
function renderOptions(props) { | ||
var _props$options = props.options, | ||
options = _props$options === undefined ? [] : _props$options, | ||
_props$multiple = props.multiple, | ||
multiple = _props$multiple === undefined ? false : _props$multiple, | ||
_props$formatOption = props.formatOption, | ||
var _props$formatOption = props.formatOption, | ||
formatOption = _props$formatOption === undefined ? function (option) { | ||
@@ -401,2 +406,7 @@ return String(option); | ||
highlightedIndex = props.highlightedIndex, | ||
_props$multiple = props.multiple, | ||
multiple = _props$multiple === undefined ? false : _props$multiple, | ||
_props$options = props.options, | ||
options = _props$options === undefined ? [] : _props$options, | ||
renderOption = props.renderOption, | ||
selectedItem = props.selectedItem, | ||
@@ -407,12 +417,13 @@ _props$selectedItems = props.selectedItems, | ||
var downshift = { | ||
multiple: multiple, | ||
formatOption: formatOption, | ||
getItemProps: getItemProps, | ||
highlightedIndex: highlightedIndex, | ||
multiple: multiple, | ||
selectedItem: selectedItem, | ||
selectedItems: selectedItems | ||
}; | ||
var renderOption = createOptionRenderer(downshift); | ||
return options.map(renderOption); | ||
var optionRenderer = createOptionRenderer(downshift, renderOption); | ||
return options.map(optionRenderer); | ||
} | ||
@@ -573,6 +584,6 @@ | ||
value: function renderMenu(downshift) { | ||
var isOpen = downshift.isOpen, | ||
getItemProps = downshift.getItemProps, | ||
var getItemProps = downshift.getItemProps, | ||
getMenuProps = downshift.getMenuProps, | ||
highlightedIndex = downshift.highlightedIndex, | ||
isOpen = downshift.isOpen, | ||
selectedItem = downshift.selectedItem, | ||
@@ -583,12 +594,14 @@ selectedItems = downshift.selectedItems; | ||
var _props4 = this.props, | ||
formatOption = _props4.formatOption, | ||
multiple = _props4.multiple, | ||
options = _props4.options, | ||
formatOption = _props4.formatOption; | ||
renderOption = _props4.renderOption; | ||
var children = renderOptions({ | ||
multiple: multiple, | ||
options: options, | ||
formatOption: formatOption, | ||
getItemProps: getItemProps, | ||
highlightedIndex: highlightedIndex, | ||
multiple: multiple, | ||
options: options, | ||
renderOption: renderOption, | ||
selectedItem: selectedItem, | ||
@@ -630,2 +643,17 @@ selectedItems: selectedItems | ||
/** | ||
* The default value when the component is uncontrolled | ||
*/ | ||
defaultValue: PropTypes.oneOfType([PropTypes.any, PropTypes.arrayOf(PropTypes.any)]), | ||
/** | ||
* Prevents user actions on the field | ||
*/ | ||
disabled: PropTypes.bool, | ||
/** | ||
* Used to format options into human readable strings | ||
* | ||
* Note that if both formatOption and renderOption are provided, | ||
* renderOption will take precedence | ||
*/ | ||
formatOption: PropTypes.func, | ||
/** | ||
* HTML ID attribute | ||
@@ -635,6 +663,2 @@ */ | ||
/** | ||
* Text describing what the field represents | ||
*/ | ||
label: PropTypes.string, | ||
/** | ||
* Instructional text for the field | ||
@@ -644,5 +668,5 @@ */ | ||
/** | ||
* Placeholder text to render when an option has not been selected | ||
* Text describing what the field represents | ||
*/ | ||
placeholder: PropTypes.string, | ||
label: PropTypes.string, | ||
/** | ||
@@ -653,18 +677,14 @@ * Enables multiple selection | ||
/** | ||
* Prevents user actions on the field | ||
* Called when the text field is blurred | ||
*/ | ||
disabled: PropTypes.bool, | ||
onBlur: PropTypes.func, | ||
/** | ||
* Text describing why the field is required | ||
* Called with the selected option when the value changes | ||
*/ | ||
required: PropTypes.string, | ||
onChange: PropTypes.func, | ||
/** | ||
* The default value when the component is uncontrolled | ||
* Called when the text field is focused | ||
*/ | ||
defaultValue: PropTypes.oneOfType([PropTypes.any, PropTypes.arrayOf(PropTypes.any)]), | ||
onFocus: PropTypes.func, | ||
/** | ||
* An array of objects to choose from | ||
*/ | ||
value: PropTypes.oneOfType([PropTypes.any, PropTypes.arrayOf(PropTypes.any)]), | ||
/** | ||
* An array of unique values of any type except `undefined` | ||
@@ -674,17 +694,23 @@ */ | ||
/** | ||
* Called with the selected option when the value changes | ||
* Placeholder text to render when an option has not been selected | ||
*/ | ||
onChange: PropTypes.func, | ||
placeholder: PropTypes.string, | ||
/** | ||
* Called when the text field is blurred | ||
* When present, this function is used to render each option. Each | ||
* option is passed as an argument. If any option has Option.render | ||
* prop present, that will take precedence and this | ||
* function will not be called for that option. | ||
* | ||
* Similarly if both formatOption and renderOption are provided, | ||
* renderOption will take precedence | ||
*/ | ||
onBlur: PropTypes.func, | ||
renderOption: PropTypes.func, | ||
/** | ||
* Called when the text field is focused | ||
* Text describing why the field is required | ||
*/ | ||
onFocus: PropTypes.func, | ||
required: PropTypes.string, | ||
/** | ||
* Used to format options into human readable strings | ||
* An array of objects to choose from | ||
*/ | ||
formatOption: PropTypes.func | ||
value: PropTypes.oneOfType([PropTypes.any, PropTypes.arrayOf(PropTypes.any)]) | ||
}; | ||
@@ -704,15 +730,41 @@ Dropdown.defaultProps = { | ||
"props": { | ||
"id": { | ||
"defaultValue": { | ||
"type": { | ||
"name": "string" | ||
"name": "union", | ||
"value": [{ | ||
"name": "any" | ||
}, { | ||
"name": "arrayOf", | ||
"value": { | ||
"name": "any" | ||
} | ||
}] | ||
}, | ||
"required": false, | ||
"description": "HTML ID attribute" | ||
"description": "The default value when the component is uncontrolled" | ||
}, | ||
"label": { | ||
"disabled": { | ||
"type": { | ||
"name": "bool" | ||
}, | ||
"required": false, | ||
"description": "Prevents user actions on the field" | ||
}, | ||
"formatOption": { | ||
"type": { | ||
"name": "func" | ||
}, | ||
"required": false, | ||
"description": "Used to format options into human readable strings\n\nNote that if both formatOption and renderOption are provided,\nrenderOption will take precedence", | ||
"defaultValue": { | ||
"value": "function(option) {\n return option ? String(option) : \"\";\n}", | ||
"computed": false | ||
} | ||
}, | ||
"id": { | ||
"type": { | ||
"name": "string" | ||
}, | ||
"required": false, | ||
"description": "Text describing what the field represents" | ||
"description": "HTML ID attribute" | ||
}, | ||
@@ -726,3 +778,3 @@ "instructions": { | ||
}, | ||
"placeholder": { | ||
"label": { | ||
"type": { | ||
@@ -732,3 +784,3 @@ "name": "string" | ||
"required": false, | ||
"description": "Placeholder text to render when an option has not been selected" | ||
"description": "Text describing what the field represents" | ||
}, | ||
@@ -742,46 +794,23 @@ "multiple": { | ||
}, | ||
"disabled": { | ||
"onBlur": { | ||
"type": { | ||
"name": "bool" | ||
"name": "func" | ||
}, | ||
"required": false, | ||
"description": "Prevents user actions on the field" | ||
"description": "Called when the text field is blurred" | ||
}, | ||
"required": { | ||
"onChange": { | ||
"type": { | ||
"name": "string" | ||
"name": "func" | ||
}, | ||
"required": false, | ||
"description": "Text describing why the field is required" | ||
"description": "Called with the selected option when the value changes" | ||
}, | ||
"defaultValue": { | ||
"onFocus": { | ||
"type": { | ||
"name": "union", | ||
"value": [{ | ||
"name": "any" | ||
}, { | ||
"name": "arrayOf", | ||
"value": { | ||
"name": "any" | ||
} | ||
}] | ||
"name": "func" | ||
}, | ||
"required": false, | ||
"description": "The default value when the component is uncontrolled" | ||
"description": "Called when the text field is focused" | ||
}, | ||
"value": { | ||
"type": { | ||
"name": "union", | ||
"value": [{ | ||
"name": "any" | ||
}, { | ||
"name": "arrayOf", | ||
"value": { | ||
"name": "any" | ||
} | ||
}] | ||
}, | ||
"required": false, | ||
"description": "An array of objects to choose from" | ||
}, | ||
"options": { | ||
@@ -797,10 +826,10 @@ "type": { | ||
}, | ||
"onChange": { | ||
"placeholder": { | ||
"type": { | ||
"name": "func" | ||
"name": "string" | ||
}, | ||
"required": false, | ||
"description": "Called with the selected option when the value changes" | ||
"description": "Placeholder text to render when an option has not been selected" | ||
}, | ||
"onBlur": { | ||
"renderOption": { | ||
"type": { | ||
@@ -810,21 +839,25 @@ "name": "func" | ||
"required": false, | ||
"description": "Called when the text field is blurred" | ||
"description": "When present, this function is used to render each option. Each\noption is passed as an argument. If any option has Option.render\nprop present, that will take precedence and this\nfunction will not be called for that option.\n\nSimilarly if both formatOption and renderOption are provided,\nrenderOption will take precedence" | ||
}, | ||
"onFocus": { | ||
"required": { | ||
"type": { | ||
"name": "func" | ||
"name": "string" | ||
}, | ||
"required": false, | ||
"description": "Called when the text field is focused" | ||
"description": "Text describing why the field is required" | ||
}, | ||
"formatOption": { | ||
"value": { | ||
"type": { | ||
"name": "func" | ||
"name": "union", | ||
"value": [{ | ||
"name": "any" | ||
}, { | ||
"name": "arrayOf", | ||
"value": { | ||
"name": "any" | ||
} | ||
}] | ||
}, | ||
"required": false, | ||
"description": "Used to format options into human readable strings", | ||
"defaultValue": { | ||
"value": "function(option) {\n return option ? String(option) : \"\";\n}", | ||
"computed": false | ||
} | ||
"description": "An array of objects to choose from" | ||
} | ||
@@ -831,0 +864,0 @@ } |
@@ -0,1 +1,8 @@ | ||
# [@hig/dropdown-v0.3.0](https://github.com/Autodesk/hig/compare/@hig/dropdown@0.2.3...@hig/dropdown@0.3.0) (2018-08-23) | ||
### Features | ||
* Add Dropdown.renderOption and Option.render for optionally rendering dropdown options with custom behavior ([ade7b24](https://github.com/Autodesk/hig/commit/ade7b24)) | ||
# [@hig/dropdown-v0.2.3](https://github.com/Autodesk/hig/compare/@hig/dropdown@0.2.2...@hig/dropdown@0.2.3) (2018-08-08) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "@hig/dropdown", | ||
"version": "0.2.3", | ||
"version": "0.3.0", | ||
"description": "HIG Dropdown", | ||
@@ -5,0 +5,0 @@ "author": "Autodesk Inc.", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
93797
2291