@gitlab/ui 135.1.2 → 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 */