@gitlab/ui 136.0.0 → 136.2.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.
@@ -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 */
@@ -1,3 +1,4 @@
1
+ import { navItemIndicatorPositionOptions } from '../../../utils/constants';
1
2
  import GlAnimatedChevronRightDownIcon from '../animated_icon/animated_chevron_right_down_icon';
2
3
  import GlIcon from '../icon/icon';
3
4
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
@@ -64,6 +65,15 @@ var script = {
64
65
  type: [String, Object],
65
66
  required: false,
66
67
  default: null
68
+ },
69
+ /**
70
+ * Position of the selected indicator
71
+ */
72
+ indicatorPosition: {
73
+ type: String,
74
+ required: false,
75
+ default: 'left',
76
+ validator: value => navItemIndicatorPositionOptions[value] !== undefined
67
77
  }
68
78
  },
69
79
  computed: {
@@ -71,7 +81,7 @@ var script = {
71
81
  return this.isParent ? String(this.expanded) : null;
72
82
  },
73
83
  classes() {
74
- return ['gl-nav-item', {
84
+ return ['gl-nav-item', navItemIndicatorPositionOptions[this.indicatorPosition], {
75
85
  'gl-nav-item-is-icon-only': this.isIconOnly,
76
86
  'gl-nav-item-has-start-slot': this.icon || Boolean(this.$scopedSlots.icon),
77
87
  'gl-nav-item-has-end-slot': Boolean(this.$scopedSlots.end) || this.isParent,
@@ -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';