@mskcc/carbon-react
Version:
Carbon react components for the MSKCC DSM
46 lines (38 loc) • 1.4 kB
JavaScript
/**
* MSKCC 2021, 2024
*/
;
Object.defineProperty(exports, '__esModule', { value: true });
var PropTypes = require('prop-types');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
const sortingPropTypes = {
/**
* Provide a compare function that is used to determine the ordering of
* options. `compareItems` has the following function signature:
*
* compareFunction :
* (itemA: string, itemB: string, { locale: string }) => number
*/
compareItems: PropTypes__default["default"].func.isRequired,
/**
* Provide a method that sorts all options in the control. Overriding this
* prop means that you also have to handle the sort logic for selected versus
* un-selected items. If you just want to control ordering, consider the
* `compareItems` prop instead.
*
* `sortItems` has the following signature:
*
* sortItems :
* (items: Array<Item>, {
* selectedItems: Array<Item>,
* itemToString: Item => string,
* compareItems: (itemA: string, itemB: string, {
* locale: string
* }) => number,
* locale: string,
* }) => Array<Item>
*/
sortItems: PropTypes__default["default"].func.isRequired
};
exports.sortingPropTypes = sortingPropTypes;