@workday/canvas-kit-react
Version:
The parent module that contains all Workday Canvas Kit React components
24 lines (23 loc) • 1.1 kB
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 canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
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, ...(0, canvas_kit_styling_1.handleCsProp)(elemProps), children: children }));
});