import{__rest as o}from"../../_virtual/_tslib.js";import{jsxs as t,jsx as n}from"react/jsx-runtime";import{useMemo as r,useCallback as i}from"react";import e from"classnames";import s from"../Icon/Icons/components/NavigationChevronRight.js";import c from"../Icon/Icons/components/NavigationChevronLeft.js";import{BEMClass as m}from"../../helpers/bem-helper.js";import a from"../Icon/Icon.js";import d from"../Button/Button.js";import{NOOP as l}from"../../utils/function-utils.js";import{NEXT_DESCRIPTION as p,BACK_DESCRIPTION as f,NEXT_COMMAND_TEST_ID as u,BACK_COMMAND_TEST_ID as v,STEPS_CSS_BASE_CLASS as I}from"./StepsConstants.js";var j="".concat(I,"-command"),h=m(j),b=function(m){var I=m.isNext,b=void 0!==I&&I,C=m.onChangeActiveStep,N=void 0===C?l:C,R=m.activeStepIndex,g=m.stepsCount,k=m.isIconHidden,O=void 0!==k&&k,x=m.isOnPrimary,_=void 0!==x&&x,A=m.buttonProps,P=void 0===A?{}:A,S=P.children,T=o(P,["children"]),w=r((function(){return S||(b?p:f)}),[b,S]),B=_?d.colors.ON_PRIMARY_COLOR:void 0,L=b?R+1:R-1,Y=i((function(o){return N(o,L)}),[L,N]),y=b&&R===g-1||!b&&0===R,E=b?s:c;return t(d,Object.assign({className:e(j,h({state:b?"forward":"backward"})),dataTestId:b?u:v,kind:d.kinds.TERTIARY,onClick:Y,disabled:y,color:B},T,{children:[w,O?null:n(a,{icon:E,clickable:!1,className:h({element:"icon"})})]}))};export{b as StepsCommand};
