@gitlab/ui 48.3.1 → 49.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # [49.0.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v48.3.1...v49.0.0) (2022-10-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **GlToggle:** Fix help text visibility ([1bd4137](https://gitlab.com/gitlab-org/gitlab-ui/commit/1bd4137fca78152966869b0b6781fe44c5f9a69e))
7
+
8
+
9
+ ### BREAKING CHANGES
10
+
11
+ * **GlToggle:** Hide help text when `labelPosition: left`
12
+
1
13
  ## [48.3.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v48.3.0...v48.3.1) (2022-10-24)
2
14
 
3
15
 
@@ -90,7 +90,7 @@ var script = {
90
90
  computed: {
91
91
  shouldRenderHelp() {
92
92
  // eslint-disable-next-line @gitlab/vue-prefer-dollar-scopedslots
93
- return Boolean(this.$slots.help || this.help);
93
+ return Boolean(this.$slots.help || this.help) && this.isVerticalLayout;
94
94
  },
95
95
 
96
96
  icon() {
@@ -103,6 +103,10 @@ var script = {
103
103
 
104
104
  isChecked() {
105
105
  return this.value ? 'true' : 'false';
106
+ },
107
+
108
+ isVerticalLayout() {
109
+ return this.labelPosition === 'top' || this.labelPosition === 'hidden';
106
110
  }
107
111
 
108
112
  },
@@ -133,8 +137,8 @@ const __vue_script__ = script;
133
137
 
134
138
  /* template */
135
139
  var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-toggle-wrapper gl-display-flex gl-mb-0",class:{
136
- 'gl-flex-direction-column': _vm.labelPosition === 'top' || _vm.labelPosition === 'hidden',
137
- 'gl-toggle-label-inline': _vm.labelPosition === 'left',
140
+ 'gl-flex-direction-column': _vm.isVerticalLayout,
141
+ 'gl-toggle-label-inline': !_vm.isVerticalLayout,
138
142
  'is-disabled': _vm.disabled,
139
143
  },attrs:{"data-testid":"toggle-wrapper"}},[_c('span',{staticClass:"gl-toggle-label gl-flex-shrink-0",class:{ 'gl-sr-only': _vm.labelPosition === 'hidden' },attrs:{"id":_vm.labelId,"data-testid":"toggle-label"}},[_vm._t("label",function(){return [_vm._v(_vm._s(_vm.label))]})],2),_vm._v(" "),(_vm.name)?_c('input',{attrs:{"name":_vm.name,"type":"hidden"},domProps:{"value":_vm.value}}):_vm._e(),_vm._v(" "),_c('button',{staticClass:"gl-flex-shrink-0",class:{
140
144
  'gl-toggle': true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "48.3.1",
3
+ "version": "49.0.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -86,10 +86,11 @@ describe('toggle', () => {
86
86
  });
87
87
 
88
88
  describe.each`
89
- state | help | props | options | getAriaDescribedBy
90
- ${'with help'} | ${helpText} | ${{ help: helpText }} | ${undefined} | ${() => findHelpElement().attributes('id')}
91
- ${'with help in slot'} | ${helpText} | ${undefined} | ${{ slots: { help: helpText } }} | ${() => findHelpElement().attributes('id')}
92
- ${'without help'} | ${undefined} | ${undefined} | ${undefined} | ${() => undefined}
89
+ state | help | props | options | getAriaDescribedBy
90
+ ${'with help'} | ${helpText} | ${{ help: helpText }} | ${undefined} | ${() => findHelpElement().attributes('id')}
91
+ ${'with help in slot'} | ${helpText} | ${undefined} | ${{ slots: { help: helpText } }} | ${() => findHelpElement().attributes('id')}
92
+ ${'without help'} | ${undefined} | ${undefined} | ${undefined} | ${() => undefined}
93
+ ${'with help and labelPosition left'} | ${undefined} | ${{ help: helpText, labelPosition: toggleLabelPosition.left }} | ${undefined} | ${() => undefined}
93
94
  `('$state', ({ help, props, options, getAriaDescribedBy }) => {
94
95
  beforeEach(() => {
95
96
  createWrapper(props, options);
@@ -83,7 +83,7 @@ export default {
83
83
  computed: {
84
84
  shouldRenderHelp() {
85
85
  // eslint-disable-next-line @gitlab/vue-prefer-dollar-scopedslots
86
- return Boolean(this.$slots.help || this.help);
86
+ return Boolean(this.$slots.help || this.help) && this.isVerticalLayout;
87
87
  },
88
88
  icon() {
89
89
  return this.value ? 'mobile-issue-close' : 'close';
@@ -94,6 +94,9 @@ export default {
94
94
  isChecked() {
95
95
  return this.value ? 'true' : 'false';
96
96
  },
97
+ isVerticalLayout() {
98
+ return this.labelPosition === 'top' || this.labelPosition === 'hidden';
99
+ },
97
100
  },
98
101
 
99
102
  beforeCreate() {
@@ -121,8 +124,8 @@ export default {
121
124
  <div
122
125
  class="gl-toggle-wrapper gl-display-flex gl-mb-0"
123
126
  :class="{
124
- 'gl-flex-direction-column': labelPosition === 'top' || labelPosition === 'hidden',
125
- 'gl-toggle-label-inline': labelPosition === 'left',
127
+ 'gl-flex-direction-column': isVerticalLayout,
128
+ 'gl-toggle-label-inline': !isVerticalLayout,
126
129
  'is-disabled': disabled,
127
130
  }"
128
131
  data-testid="toggle-wrapper"