@bigbinary/neetoui
Version:
neetoUI drives the experience at all neeto products
46 lines (42 loc) • 1.54 kB
JavaScript
;
require('react');
var classnames = require('classnames');
var jsxRuntime = require('react/jsx-runtime');
var Stepper = function Stepper(_ref) {
var steps = _ref.steps,
activeIndex = _ref.activeIndex,
setActiveIndex = _ref.setActiveIndex;
return /*#__PURE__*/jsxRuntime.jsx("div", {
className: "neeto-ui-stepper__wrapper",
children: steps.map(function (_ref2, index) {
var id = _ref2.id,
label = _ref2.label;
return /*#__PURE__*/jsxRuntime.jsx("div", {
"data-testid": "stepper-item-".concat(id),
className: classnames("neeto-ui-stepper-item__wrapper", {
"neeto-ui-stepper-item__wrapper--active": index === activeIndex,
"neeto-ui-stepper-item__wrapper--done": index < activeIndex
}),
children: /*#__PURE__*/jsxRuntime.jsxs("button", {
className: "neeto-ui-stepper-item",
"data-testid": "stepper-navigation-button",
onClick: function onClick() {
return setActiveIndex(index);
},
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
className: "neeto-ui-stepper-item__stage",
children: /*#__PURE__*/jsxRuntime.jsx("span", {
children: id
})
}), /*#__PURE__*/jsxRuntime.jsx("span", {
className: "neeto-ui-stepper-item__label",
"data-text": label,
children: label
})]
})
}, id);
})
});
};
module.exports = Stepper;
//# sourceMappingURL=Stepper.js.map