MCPcopy Create free account
hub / github.com/microsoft/SandDance / getOptionComponent

Function getOptionComponent

docs/app/js/sanddance-app.js:38327–38371  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38325 return onRenderOption(item, _this._onRenderOptionContent);
38326 };
38327 var getOptionComponent = function() {
38328 return !_this.props.multiSelect ? _react.createElement((0, _button.CommandButton), {
38329 id: id + "-list" + item.index,
38330 key: item.key,
38331 "data-index": item.index,
38332 styles: optionStyles,
38333 checked: isSelected,
38334 className: "ms-ComboBox-option",
38335 onClick: _this._onItemClick(item),
38336 // eslint-disable-next-line react/jsx-no-bind
38337 onMouseEnter: _this._onOptionMouseEnter.bind(_this, item.index),
38338 // eslint-disable-next-line react/jsx-no-bind
38339 onMouseMove: _this._onOptionMouseMove.bind(_this, item.index),
38340 onMouseLeave: _this._onOptionMouseLeave,
38341 role: "option",
38342 "aria-selected": isChecked ? "true" : "false",
38343 ariaLabel: item.ariaLabel,
38344 disabled: item.disabled,
38345 title: title
38346 }, _react.createElement("span", {
38347 className: optionClassNames.optionTextWrapper,
38348 ref: isSelected ? _this._selectedElement : undefined
38349 }, onRenderOption(item, _this._onRenderOptionContent))) : _react.createElement((0, _checkbox.Checkbox), {
38350 id: id + "-list" + item.index,
38351 ariaLabel: item.ariaLabel,
38352 key: item.key,
38353 styles: optionStyles,
38354 className: "ms-ComboBox-option",
38355 onChange: _this._onItemClick(item),
38356 label: item.text,
38357 checked: isChecked,
38358 title: title,
38359 disabled: item.disabled,
38360 // eslint-disable-next-line react/jsx-no-bind
38361 onRenderLabel: onRenderCheckboxLabel,
38362 inputProps: (0, _tslib.__assign)({
38363 // aria-selected should only be applied to checked items, not hovered items
38364 "aria-selected": isChecked ? "true" : "false",
38365 role: "option"
38366 }, {
38367 "data-index": item.index,
38368 "data-is-focusable": true
38369 })
38370 });
38371 };
38372 return _react.createElement(ComboBoxOptionWrapper, {
38373 key: item.key,
38374 index: item.index,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected