all files / addon/components/polaris-page/ action.js

100% Statements 0/0
100% Branches 0/0
100% Functions 0/0
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                                                                                               
import Component from '@ember/component';
import layout from '../../templates/components/polaris-page/action';
import { handleMouseUpByBlurring } from '../../utils/focus';
import mapEventToAction from '../../utils/map-event-to-action';
 
export default Component.extend({
  tagName: 'button',
  classNames: [ 'Polaris-Page__Action' ],
  classNameBindings: [ 'action.disabled:Polaris-Page--disabled', ],
  attributeBindings: [
    'type',
    'action.disabled:disabled',
    'action.accessibilityLabel:aria-label'
  ],
 
  layout,
 
  /**
   * The action to render. The following properties can be set:
   *  - text
   *  - icon
   *  - accessibilityLabel
   *  - disabled
   *  - onAction
   *
   * These properties are available in the React component
   * but are not yet implemented in `ember-polaris`:
   *  - url
   *  - external
   *  - disclosure
   *
   * @property action
   * @public
   * @type {Object}
   * @default null
   */
  action: null,
 
  type: 'button',
 
  /*
   * Action handlers.
   */
  mouseUp: handleMouseUpByBlurring,
  click: mapEventToAction('action.onAction'),
});