@workday/canvas-kit-react
Version:
The parent module that contains all Workday Canvas Kit React components
23 lines (22 loc) • 990 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ComboboxCard = exports.useComboboxCard = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const common_1 = require("@workday/canvas-kit-react/common");
const menu_1 = require("@workday/canvas-kit-react/menu");
const useComboboxModel_1 = require("./hooks/useComboboxModel");
/**
* This hook sets the `minWidth` style attribute to match the width of the
* {@link ComboboxInput Combobox.Input} component.
*/
exports.useComboboxCard = (0, common_1.createElemPropsHook)(useComboboxModel_1.useComboboxModel)(model => {
return {
minWidth: model.state.width,
};
});
exports.ComboboxCard = (0, common_1.createSubcomponent)('div')({
modelHook: useComboboxModel_1.useComboboxModel,
elemPropsHook: exports.useComboboxCard,
})(({ children, ...elemProps }, Element) => {
return ((0, jsx_runtime_1.jsx)(menu_1.Menu.Card, { as: Element, ...elemProps, children: children }));
});