@awsui/components-react
Version:
AWS UI is a collection of [React](https://reactjs.org/) components that help create intuitive, responsive, and accessible user experiences for web applications. It is developed by Amazon Web Services (AWS). This work is available under the terms of the [A
11 lines (10 loc) • 604 B
JavaScript
import { useMemo } from 'react';
import { generateUniqueId } from '../../../hooks/use-unique-id';
export var useIds = function (_a) {
var hasHighlightedOption = _a.hasHighlightedOption, hasSelectedOption = _a.hasSelectedOption;
return {
highlightedOptionId: useMemo(function () { return (hasHighlightedOption ? generateUniqueId() : undefined); }, [hasHighlightedOption]),
selectedOptionId: useMemo(function () { return (hasSelectedOption ? generateUniqueId() : undefined); }, [hasSelectedOption]),
menuId: useMemo(function () { return generateUniqueId(); }, [])
};
};