@gitlab/ui 135.1.1 → 136.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,14 @@
1
1
  import GlButton from '../../button/button';
2
2
  import { GlTooltipDirective } from '../../../../directives/tooltip/tooltip';
3
+ import { translate } from '../../../../utils/i18n';
3
4
  import GlFormInput from '../form_input/form_input';
4
- import GlFormInputGroup from '../form_input_group/form_input_group';
5
5
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
6
6
 
7
7
  var script = {
8
8
  name: 'GlFormPasswordInput',
9
9
  components: {
10
10
  GlButton,
11
- GlFormInput,
12
- GlFormInputGroup
11
+ GlFormInput
13
12
  },
14
13
  directives: {
15
14
  GlTooltip: GlTooltipDirective
@@ -35,28 +34,29 @@ var script = {
35
34
  },
36
35
  /**
37
36
  * Accessible label and tooltip for the toggle button while the value is masked.
38
- * Pass a translated string.
39
37
  */
40
38
  revealLabel: {
41
39
  type: String,
42
40
  required: false,
43
- default: 'Reveal password'
41
+ default: () => translate('GlFormPasswordInput.revealLabel', 'Reveal password')
44
42
  },
45
43
  /**
46
44
  * Accessible label and tooltip for the toggle button while the value is revealed.
47
- * Pass a translated string.
48
45
  */
49
46
  hideLabel: {
50
47
  type: String,
51
48
  required: false,
52
- default: 'Hide password'
49
+ default: () => translate('GlFormPasswordInput.hideLabel', 'Hide password')
53
50
  },
54
51
  /**
55
- * Disables the field while keeping it in the focus order and announced by
56
- * assistive technology (via `aria-disabled`), rather than removing it from
57
- * the tab sequence.
52
+ * Disables the field and its toggle. Neither is in the tab order and the
53
+ * value is not submitted with the form.
54
+ *
55
+ * To prevent edits while keeping the value readable, copyable and
56
+ * submitted, pass `readonly` instead. It reaches the input untouched and
57
+ * leaves the toggle usable, since revealing a value is a read.
58
58
  */
59
- accessibleDisabled: {
59
+ disabled: {
60
60
  type: Boolean,
61
61
  required: false,
62
62
  default: false
@@ -80,9 +80,6 @@ var script = {
80
80
  },
81
81
  methods: {
82
82
  toggleVisibility() {
83
- if (this.accessibleDisabled) {
84
- return;
85
- }
86
83
  this.isMasked = !this.isMasked;
87
84
  /**
88
85
  * Emitted when the reveal/hide button is clicked.
@@ -99,7 +96,7 @@ var script = {
99
96
  const __vue_script__ = script;
100
97
 
101
98
  /* template */
102
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-form-input-group',{staticClass:"gl-form-password-input",scopedSlots:_vm._u([{key:"append",fn:function(){return [_c('gl-button',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip",value:(_vm.toggleLabel),expression:"toggleLabel"}],staticClass:"gl-form-password-input-toggle !gl-border-0",attrs:{"category":"tertiary","accessible-disabled":"","aria-label":_vm.toggleLabel,"icon":_vm.toggleIcon,"disabled":_vm.accessibleDisabled},on:{"click":_vm.toggleVisibility}})]},proxy:true}])},[_c('gl-form-input',_vm._g(_vm._b({attrs:{"value":_vm.value,"type":_vm.type,"readonly":_vm.accessibleDisabled,"aria-disabled":_vm.accessibleDisabled ? 'true' : null}},'gl-form-input',_vm.$attrs,false),_vm.$listeners))],1)};
99
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-form-password-input"},[_c('gl-form-input',_vm._g(_vm._b({staticClass:"gl-form-password-input-field",attrs:{"value":_vm.value,"type":_vm.type,"disabled":_vm.disabled}},'gl-form-input',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),_c('gl-button',{directives:[{name:"gl-tooltip",rawName:"v-gl-tooltip",value:(_vm.toggleLabel),expression:"toggleLabel"}],staticClass:"gl-form-password-input-toggle",attrs:{"category":"tertiary","size":"small","aria-label":_vm.toggleLabel,"icon":_vm.toggleIcon,"disabled":_vm.disabled},on:{"click":_vm.toggleVisibility}})],1)};
103
100
  var __vue_staticRenderFns__ = [];
104
101
 
105
102
  /* style */
@@ -263,8 +263,9 @@ var script = {
263
263
  }
264
264
  },
265
265
  beforeDestroy() {
266
- this.chart.off('mouseout', this.hideAnnotationsTooltip);
267
- this.chart.off('mouseover', this.onChartMouseOver);
266
+ if (!this.chart) return;
267
+ this.chart.off('mouseout', this.onChartDataPointMouseOut);
268
+ this.chart.off('mouseover', this.onChartDataPointMouseOver);
268
269
  },
269
270
  methods: {
270
271
  defaultAnnotationTooltipText(params) {
@@ -148,6 +148,7 @@ var script = {
148
148
  this.setChartSize();
149
149
  },
150
150
  beforeDestroy() {
151
+ if (!this.chart) return;
151
152
  this.chart.off('click', this.handleClick);
152
153
  },
153
154
  methods: {
@@ -270,6 +270,7 @@ var script = {
270
270
  }
271
271
  },
272
272
  beforeDestroy() {
273
+ if (!this.chart) return;
273
274
  this.chart.off('mouseout', this.onChartDataPointMouseOut);
274
275
  this.chart.off('mouseover', this.onChartDataPointMouseOver);
275
276
  },