@gitlab/ui 41.7.0 → 41.7.1

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## [41.7.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v41.7.0...v41.7.1) (2022-06-13)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **GlModal:** Re-add deprecated modal slots ([29b7ccf](https://gitlab.com/gitlab-org/gitlab-ui/commit/29b7ccf4623de391192bce75ad176d38e10de3f1))
7
+
8
+
9
+ ### Reverts
10
+
11
+ * **GlModal:** Remove deprecated slots modal-ok and modal-cancel ([1d2cc9e](https://gitlab.com/gitlab-org/gitlab-ui/commit/1d2cc9e06b5011cd4c8155b5b37db570f8a6b581)), closes [/gitlab.com/gitlab-org/gitlab/-/merge_requests/88974#note_988604141](https://gitlab.com//gitlab.com/gitlab-org/gitlab/-/merge_requests/88974/issues/note_988604141)
12
+
1
13
  # [41.7.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v41.6.0...v41.7.0) (2022-06-13)
2
14
 
3
15
 
@@ -82,6 +82,20 @@ var script = {
82
82
  default: ''
83
83
  }
84
84
  },
85
+ computed: {
86
+ shouldRenderModalOk() {
87
+ return Boolean(this.$slots['modal-ok']);
88
+ },
89
+
90
+ shouldRenderModalCancel() {
91
+ return Boolean(this.$slots['modal-cancel']);
92
+ },
93
+
94
+ shouldRenderModalFooter() {
95
+ return Boolean(this.actionCancel || this.actionSecondary || this.actionPrimary || this.$slots['modal-footer']);
96
+ }
97
+
98
+ },
85
99
 
86
100
  mounted() {
87
101
  if (!this.ariaLabel && !this.title) {
@@ -165,7 +179,7 @@ var script = {
165
179
  const __vue_script__ = script;
166
180
 
167
181
  /* template */
168
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-modal',_vm._g(_vm._b({ref:"modal",attrs:{"id":_vm.modalId,"title-tag":_vm.titleTag,"size":_vm.size,"visible":_vm.visible,"aria-label":_vm.ariaLabel || _vm.title,"lazy":"","modal-class":['gl-modal', _vm.modalClass]},on:{"shown":_vm.setFocus,"ok":_vm.primary,"cancel":_vm.canceled,"change":function($event){return _vm.$emit('change', $event)}},scopedSlots:_vm._u([{key:"default",fn:function(){return [_vm._t("default")]},proxy:true},{key:"modal-header",fn:function(){return [_vm._t("modal-header",[_c('h4',{staticClass:"modal-title"},[_vm._t("modal-title",[_vm._v(_vm._s(_vm.title))])],2)]),_vm._v(" "),_c('close-button',{ref:"close-button",attrs:{"label":_vm.dismissLabel},on:{"click":_vm.close}})]},proxy:true},{key:"modal-footer",fn:function(){return [_vm._t("modal-footer",[(_vm.actionCancel)?_c('gl-button',_vm._b({staticClass:"js-modal-action-cancel",on:{"click":_vm.cancel}},'gl-button',_vm.buttonBinding(_vm.actionCancel, 'actionCancel'),false),[_vm._v("\n "+_vm._s(_vm.actionCancel.text)+"\n ")]):_vm._e(),_vm._v(" "),(_vm.actionSecondary)?_c('gl-button',_vm._b({staticClass:"js-modal-action-secondary",on:{"click":_vm.secondary}},'gl-button',_vm.buttonBinding(_vm.actionSecondary, 'actionSecondary'),false),[_vm._v("\n "+_vm._s(_vm.actionSecondary.text)+"\n ")]):_vm._e(),_vm._v(" "),(_vm.actionPrimary)?_c('gl-button',_vm._b({staticClass:"js-modal-action-primary",on:{"click":_vm.ok}},'gl-button',_vm.buttonBinding(_vm.actionPrimary, 'actionPrimary'),false),[_vm._v("\n "+_vm._s(_vm.actionPrimary.text)+"\n ")]):_vm._e()])]},proxy:true}],null,true)},'b-modal',_vm.$attrs,false),_vm.$listeners))};
182
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-modal',_vm._g(_vm._b({ref:"modal",attrs:{"id":_vm.modalId,"title-tag":_vm.titleTag,"size":_vm.size,"visible":_vm.visible,"aria-label":_vm.ariaLabel || _vm.title,"lazy":"","modal-class":['gl-modal', _vm.modalClass]},on:{"shown":_vm.setFocus,"ok":_vm.primary,"cancel":_vm.canceled,"change":function($event){return _vm.$emit('change', $event)}},scopedSlots:_vm._u([{key:"default",fn:function(){return [_vm._t("default")]},proxy:true},{key:"modal-header",fn:function(){return [_vm._t("modal-header",[_c('h4',{staticClass:"modal-title"},[_vm._t("modal-title",[_vm._v(_vm._s(_vm.title))])],2)]),_vm._v(" "),_c('close-button',{ref:"close-button",attrs:{"label":_vm.dismissLabel},on:{"click":_vm.close}})]},proxy:true},(_vm.shouldRenderModalOk)?{key:"modal-ok",fn:function(){return [_vm._t("modal-ok")]},proxy:true}:null,(_vm.shouldRenderModalCancel)?{key:"modal-cancel",fn:function(){return [_vm._t("modal-cancel")]},proxy:true}:null,(_vm.shouldRenderModalFooter)?{key:"modal-footer",fn:function(){return [_vm._t("modal-footer",[(_vm.actionCancel)?_c('gl-button',_vm._b({staticClass:"js-modal-action-cancel",on:{"click":_vm.cancel}},'gl-button',_vm.buttonBinding(_vm.actionCancel, 'actionCancel'),false),[_vm._v("\n "+_vm._s(_vm.actionCancel.text)+"\n ")]):_vm._e(),_vm._v(" "),(_vm.actionSecondary)?_c('gl-button',_vm._b({staticClass:"js-modal-action-secondary",on:{"click":_vm.secondary}},'gl-button',_vm.buttonBinding(_vm.actionSecondary, 'actionSecondary'),false),[_vm._v("\n "+_vm._s(_vm.actionSecondary.text)+"\n ")]):_vm._e(),_vm._v(" "),(_vm.actionPrimary)?_c('gl-button',_vm._b({staticClass:"js-modal-action-primary",on:{"click":_vm.ok}},'gl-button',_vm.buttonBinding(_vm.actionPrimary, 'actionPrimary'),false),[_vm._v("\n "+_vm._s(_vm.actionPrimary.text)+"\n ")]):_vm._e()])]},proxy:true}:null],null,true)},'b-modal',_vm.$attrs,false),_vm.$listeners))};
169
183
  var __vue_staticRenderFns__ = [];
170
184
 
171
185
  /* style */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "41.7.0",
3
+ "version": "41.7.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -7,7 +7,11 @@ should serve a single purpose dedicated to completing the user’s task.
7
7
  You can use the `v-model` directive to control the modal’s visibility. The `v-model`
8
8
  directive interfaces with the `visible` property and the `@change` event.
9
9
 
10
- ## Modal footer
10
+ ## Deprecation Warning
11
+
12
+ We are deprecating the `modal-ok` and `modal-cancel` slots. We are also changing the way the
13
+ `modal-footer` slot content is populated. This is in order to align this component with the design
14
+ system.
11
15
 
12
16
  The `modal-footer` slot should only be populated via props: `action-primary`, `action-secondary` and
13
17
  `action-cancel`. These props allow you to handle how a primary, secondary and cancel button will
@@ -86,6 +86,22 @@ export default {
86
86
  default: '',
87
87
  },
88
88
  },
89
+ computed: {
90
+ shouldRenderModalOk() {
91
+ return Boolean(this.$slots['modal-ok']);
92
+ },
93
+ shouldRenderModalCancel() {
94
+ return Boolean(this.$slots['modal-cancel']);
95
+ },
96
+ shouldRenderModalFooter() {
97
+ return Boolean(
98
+ this.actionCancel ||
99
+ this.actionSecondary ||
100
+ this.actionPrimary ||
101
+ this.$slots['modal-footer']
102
+ );
103
+ },
104
+ },
89
105
  mounted() {
90
106
  if (!this.ariaLabel && !this.title) {
91
107
  logWarning(
@@ -152,7 +168,7 @@ export default {
152
168
  </script>
153
169
 
154
170
  <template>
155
- <!--
171
+ <!--
156
172
  Emitted when the modal visibility changes
157
173
  @event change
158
174
  -->
@@ -186,8 +202,14 @@ export default {
186
202
  <!-- @slot Content of Modal header close button. If modal-header slot is used, this slot will not be shown. -->
187
203
  <close-button ref="close-button" :label="dismissLabel" @click="close" />
188
204
  </template>
205
+ <template v-if="shouldRenderModalOk" #modal-ok>
206
+ <slot name="modal-ok"></slot>
207
+ </template>
208
+ <template v-if="shouldRenderModalCancel" #modal-cancel>
209
+ <slot name="modal-cancel"></slot>
210
+ </template>
189
211
  <!-- @slot Populated via props: modal-action-primary, modal-action-cancel and modal-action-secondary. -->
190
- <template #modal-footer>
212
+ <template v-if="shouldRenderModalFooter" #modal-footer>
191
213
  <slot name="modal-footer">
192
214
  <!--
193
215
  Emitted when clicked on modal-action-cancel