import templateOnly from '@ember/component/template-only';
import { setComponentTemplate } from '@ember/component';
import { precompileTemplate } from '@ember/template-compilation';
import { hash, fn } from '@ember/helper';
import { on } from '@ember/modifier';
import add from 'ember-math-helpers/helpers/add';
import sub from 'ember-math-helpers/helpers/sub';
import { eq } from 'ember-truth-helpers';
import EuiButtonIcon from '../eui-button-icon.js';
import EuiI18nComponent from '../eui-i18n.js';

const NextButton = setComponentTemplate(precompileTemplate(`
    <EuiI18n
      @token="euiPagination.nextPage"
      @default="Next page, {page}"
      @values={{hash page=(add @activePage 2)}}
      as |Token|
    >
      <Token as |nextPage|>
        <EuiI18n
          @token="euiPagination.disabledNextPage"
          @default="Next page"
          as |InnerToken|
        >
          <InnerToken as |disabledNextPage|>
            <EuiButtonIcon
              {{on "click" (fn @safeClick (add @activePage 1))}}
              @iconType="arrowRight"
              @color="text"
              aria-label={{if
                (eq @activePage (sub @pageCount 1))
                disabledNextPage
                nextPage
              }}
              aria-controls={{if @props.aria-controls @props.aria-controls}}
              href={{if @props.href @props.href}}
              disabled={{eq @props.disabled true}}
              ...attributes
            />
          </InnerToken>
        </EuiI18n>
      </Token>
    </EuiI18n>
  `, {
  strictMode: true,
  scope: () => ({
    EuiI18n: EuiI18nComponent,
    hash,
    add,
    EuiButtonIcon,
    eq,
    sub,
    on,
    fn
  })
}), templateOnly("next-button", "NextButton"));

export { NextButton as default };
//# sourceMappingURL=next-button.js.map
