@gitlab/ui 135.1.2 → 136.1.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.
Files changed (32) hide show
  1. package/dist/components/base/form/form_password_input/form_password_input.js +12 -15
  2. package/dist/components/base/label/label.js +9 -1
  3. package/dist/components/base/toast/index.js +21 -13
  4. package/dist/components/index.js +1 -1
  5. package/dist/index.css +2 -2
  6. package/dist/index.css.map +1 -1
  7. package/dist/tailwind.css +1 -1
  8. package/dist/tailwind.css.map +1 -1
  9. package/dist/tokens/build/js/tokens.dark.js +2 -1
  10. package/dist/tokens/build/js/tokens.js +2 -1
  11. package/dist/vendor/bootstrap-vue/src/components/tooltip/helpers/bv-tooltip.js +3 -1
  12. package/package.json +6 -6
  13. package/src/components/base/form/form_password_input/form_password_input.scss +14 -32
  14. package/src/components/base/form/form_password_input/form_password_input.vue +25 -31
  15. package/src/components/base/label/label.vue +10 -1
  16. package/src/components/base/toast/index.js +23 -10
  17. package/src/components/base/tooltip/tooltip.scss +1 -0
  18. package/src/components/index.js +1 -1
  19. package/src/tokens/build/css/tokens.css +1 -0
  20. package/src/tokens/build/css/tokens.dark.css +1 -0
  21. package/src/tokens/build/figma/mode.dark.json +10 -0
  22. package/src/tokens/build/figma/mode.json +10 -0
  23. package/src/tokens/build/js/tokens.dark.js +1 -0
  24. package/src/tokens/build/js/tokens.js +1 -0
  25. package/src/tokens/build/json/tokens.dark.json +38 -0
  26. package/src/tokens/build/json/tokens.json +38 -0
  27. package/src/tokens/build/scss/_tokens.dark.scss +1 -0
  28. package/src/tokens/build/scss/_tokens.scss +1 -0
  29. package/src/tokens/build/scss/_tokens_custom_properties.scss +1 -0
  30. package/src/tokens/contextual/tooltip.tokens.json +18 -0
  31. package/src/vendor/bootstrap-vue/src/components/tooltip/helpers/bv-tooltip.js +3 -1
  32. package/translations.js +2 -0
@@ -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 */
@@ -79,6 +79,14 @@ var script = {
79
79
  type: Boolean,
80
80
  required: false,
81
81
  default: false
82
+ },
83
+ /**
84
+ * Additional text shown in a muted footer line of the tooltip (e.g. "Archived")
85
+ */
86
+ footer: {
87
+ type: String,
88
+ required: false,
89
+ default: ''
82
90
  }
83
91
  },
84
92
  computed: {
@@ -139,7 +147,7 @@ var script = {
139
147
  const __vue_script__ = script;
140
148
 
141
149
  /* template */
142
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('span',_vm._b({staticClass:"gl-label",class:_vm.cssClasses,style:(_vm.cssVariables),on:{"click":_vm.onClick}},'span',_vm.$attrs,false),[_c(_vm.labelComponent,{ref:"labelTitle",tag:"component",staticClass:"gl-label-link",class:{ 'gl-label-link-underline': _vm.target },attrs:{"href":_vm.target ? _vm.target : false,"tabindex":"0"}},[_c('span',{staticClass:"gl-label-text"},[_vm._v("\n "+_vm._s(_vm.scopedKey)+"\n ")]),_vm._v(" "),(_vm.scoped && _vm.scopedValue)?_c('span',{staticClass:"gl-label-text-scoped"},[_vm._v("\n "+_vm._s(_vm.scopedValue)+"\n ")]):_vm._e()]),_vm._v(" "),(_vm.showCloseButton)?_c('gl-button',{staticClass:"gl-label-close !gl-p-0",attrs:{"category":"tertiary","size":"small","variant":"reset","aria-label":_vm.removeButtonAriaLabel,"disabled":_vm.disabled},on:{"click":_vm.onClose}},[_c('gl-icon',{attrs:{"name":"close-xs","size":12}})],1):_vm._e(),_vm._v(" "),(_vm.description)?_c('gl-tooltip',{attrs:{"target":function () { return _vm.tooltipTarget; },"placement":_vm.tooltipPlacement,"boundary":"viewport"}},[(_vm.scoped)?_c('span',{staticClass:"gl-label-tooltip-title"},[_vm._v("Scoped label")]):_vm._e(),_vm._v("\n "+_vm._s(_vm.description)+"\n ")]):_vm._e()],1)};
150
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('span',_vm._b({staticClass:"gl-label",class:_vm.cssClasses,style:(_vm.cssVariables),on:{"click":_vm.onClick}},'span',_vm.$attrs,false),[_c(_vm.labelComponent,{ref:"labelTitle",tag:"component",staticClass:"gl-label-link",class:{ 'gl-label-link-underline': _vm.target },attrs:{"href":_vm.target ? _vm.target : false,"tabindex":"0"}},[_c('span',{staticClass:"gl-label-text"},[_vm._v("\n "+_vm._s(_vm.scopedKey)+"\n ")]),_vm._v(" "),(_vm.scoped && _vm.scopedValue)?_c('span',{staticClass:"gl-label-text-scoped"},[_vm._v("\n "+_vm._s(_vm.scopedValue)+"\n ")]):_vm._e()]),_vm._v(" "),(_vm.showCloseButton)?_c('gl-button',{staticClass:"gl-label-close !gl-p-0",attrs:{"category":"tertiary","size":"small","variant":"reset","aria-label":_vm.removeButtonAriaLabel,"disabled":_vm.disabled},on:{"click":_vm.onClose}},[_c('gl-icon',{attrs:{"name":"close-xs","size":12}})],1):_vm._e(),_vm._v(" "),(_vm.description || _vm.footer)?_c('gl-tooltip',{attrs:{"target":function () { return _vm.tooltipTarget; },"placement":_vm.tooltipPlacement,"boundary":"viewport"}},[(_vm.scoped)?_c('span',{staticClass:"gl-label-tooltip-title"},[_vm._v("Scoped label")]):_vm._e(),_vm._v("\n "+_vm._s(_vm.description)+"\n "),(_vm.footer)?_c('span',{staticClass:"gl-block gl-text-subtle"},[_vm._v(_vm._s(_vm.footer))]):_vm._e()]):_vm._e()],1)};
143
151
  var __vue_staticRenderFns__ = [];
144
152
 
145
153
  /* style */
@@ -42,25 +42,33 @@ function showToast(message) {
42
42
  return toast;
43
43
  }
44
44
 
45
+ /**
46
+ * Adds a `$toast` property to the component it's applied to.
47
+ *
48
+ * Use this to opt individual components into toasts, instead of adding `$toast`
49
+ * to every component in the app with `GlToastPlugin`.
50
+ */
51
+ const GlToastMixin = {
52
+ beforeCreate() {
53
+ if (this.$toast) {
54
+ return;
55
+ }
56
+ this.$toast = {
57
+ show: showToast.bind(this)
58
+ };
59
+ }
60
+ };
61
+
45
62
  /**
46
63
  * Note: This is not a typical Vue component and needs to be registered before instantiating a Vue app.
47
64
  * Once registered, the toast will be globally available throughout your app.
48
65
  *
49
- * See https://design.gitlab.com/storybook for detailed documentation.
66
+ * See https://design.gitlab.com/components/toast for detailed documentation.
50
67
  */
51
- var index = {
68
+ const GlToastPlugin = {
52
69
  install(V) {
53
- V.mixin({
54
- beforeCreate() {
55
- if (this.$toast) {
56
- return;
57
- }
58
- this.$toast = {
59
- show: showToast.bind(this)
60
- };
61
- }
62
- });
70
+ V.mixin(GlToastMixin);
63
71
  }
64
72
  };
65
73
 
66
- export { index as default };
74
+ export { GlToastMixin, GlToastPlugin, GlToastPlugin as default };
@@ -32,7 +32,7 @@ export { default as GlBadge } from './base/badge/badge';
32
32
  export { default as GlBanner } from './base/banner/banner';
33
33
  export { default as GlButton } from './base/button/button';
34
34
  export { default as GlTooltip } from './base/tooltip/tooltip';
35
- export { default as GlToast } from './base/toast';
35
+ export { default as GlToast, GlToastMixin, GlToastPlugin } from './base/toast';
36
36
  export { default as GlDashboardSkeleton } from './regions/dashboard_skeleton/dashboard_skeleton';
37
37
  export { default as GlEmptyState } from './regions/empty_state/empty_state';
38
38
  export { default as GlForm } from './base/form/form';