all files / addon/components/ polaris-pagination.js

100% Statements 0/0
100% Branches 0/0
0% Functions 0/2
100% Lines 0/0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94                                                                                                                                                                                           
import Component from '@ember/component';
import { not } from '@ember/object/computed';
import { handleMouseUpByBlurring } from '../utils/focus';
import layout from '../templates/components/polaris-pagination';
 
export default Component.extend({
  tagName: 'nav',
  classNames: ['Polaris-Pagination'],
  classNameBindings: ['plain:Polaris-Pagination--plain'],
  attributeBindings: ['accessibilityLabel:aria-label'],
 
  layout,
 
  /**
   * A more subdued control for use in headers
   *
   * @property plain
   * @type {Boolean}
   * @default false
   */
  plain: false,
 
  /**
   * The URL of the next page
   *
   * @property nextUrl
   * @type {String}
   * @default null
   * TODO not implemented
   */
  nextUrl: null,
 
  /**
   * The URL of the previous page
   *
   * @property previousUrl
   * @type {String}
   * @default null
   * TODO not implemented
   */
  previousUrl: null,
 
  /**
   * Whether there is a next page to show
   *
   * @property hasNext
   * @type {Boolean}
   * @default false
   */
  hasNext: false,
 
  /**
   * Whether there is a previous page to show
   *
   * @property hasPrevious
   * @type {Boolean}
   * @default false
   */
  hasPrevious: false,
 
  /**
   * Visually hidden text for screen readers
   *
   * @property accessibilityLabel
   * @type {string}
   * @default 'Pagination'
   */
  accessibilityLabel: 'Pagination',
 
  /**
   * Callback when next button is clicked
   *
   * @property onNext
   * @type {function}
   * @default no-op
   */
  onNext() {},
 
  /**
   * Callback when previous button is clicked
   *
   * @property onPrevious
   * @type {function}
   * @default no-op
   */
  onPrevious() {},
 
  isPreviousDisabled: not('hasPrevious').readOnly(),
  isNextDisabled: not('hasNext').readOnly(),
 
  handleMouseUpByBlurring,
});