@workday/canvas-kit-labs-react
Version:
Canvas Kit Labs is an incubator for new and experimental components. Since we have a rather rigorous process for getting components in at a production level, it can be valuable to make them available earlier while we continuously iterate on the API/functi
20 lines (19 loc) • 693 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.useExpandableTarget = void 0;
const common_1 = require("@workday/canvas-kit-react/common");
const useExpandableModel_1 = require("./useExpandableModel");
exports.useExpandableTarget = (0, common_1.createElemPropsHook)(useExpandableModel_1.useExpandableModel)(({ state, events }) => {
return {
'aria-controls': state.id,
'aria-expanded': state.visibility !== 'hidden',
onClick: (event) => {
if (state.visibility !== 'hidden') {
events.hide(event);
}
else {
events.show(event);
}
},
};
});
;