@gitlab/ui 64.20.1 → 64.21.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 +14 -0
- package/dist/components/base/toggle/toggle.js +38 -17
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/tokens/css/tokens.css +1 -1
- package/dist/tokens/css/tokens.dark.css +1 -1
- package/dist/tokens/js/tokens.dark.js +1 -1
- package/dist/tokens/js/tokens.js +1 -1
- package/dist/tokens/scss/_tokens.dark.scss +1 -1
- package/dist/tokens/scss/_tokens.scss +1 -1
- package/dist/utility_classes.css +1 -1
- package/dist/utility_classes.css.map +1 -1
- package/dist/utils/constants.js +1 -0
- package/package.json +2 -2
- package/src/components/base/toggle/toggle.scss +35 -6
- package/src/components/base/toggle/toggle.spec.js +38 -26
- package/src/components/base/toggle/toggle.stories.js +6 -0
- package/src/components/base/toggle/toggle.vue +76 -55
- package/src/scss/utilities.scss +8 -0
- package/src/scss/utility-mixins/flex.scss +4 -0
- package/src/utils/constants.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [64.21.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v64.20.1...v64.21.0) (2023-07-14)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **GlToggle:** Enable flex-grow-1 to ensure backwards compatibility ([dfd6554](https://gitlab.com/gitlab-org/gitlab-ui/commit/dfd655420bd8aef33a3af0d5ea3144ac59934ee0))
|
|
7
|
+
* **GlToggle:** Remove vertical padding if label is sr-only ([697a597](https://gitlab.com/gitlab-org/gitlab-ui/commit/697a5979ceae6f6e46c877c8baea58051741f732))
|
|
8
|
+
* **GlToggle:** Wrap long texts when using block-layout for toggle ([a487517](https://gitlab.com/gitlab-org/gitlab-ui/commit/a4875170a207018b605833b022d6fce6ca3803e4))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **GlToggle:** Add a block level toggle ([0b73ddb](https://gitlab.com/gitlab-org/gitlab-ui/commit/0b73ddb0acfdad3d81501cb360e857de4089247e))
|
|
14
|
+
|
|
1
15
|
## [64.20.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v64.20.0...v64.20.1) (2023-07-13)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -88,18 +88,40 @@ var script = {
|
|
|
88
88
|
};
|
|
89
89
|
},
|
|
90
90
|
computed: {
|
|
91
|
+
layoutAllowsDescription() {
|
|
92
|
+
return this.isVerticalLayout || this.isBlockLayout;
|
|
93
|
+
},
|
|
91
94
|
shouldRenderDescription() {
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
return Boolean(this.$scopedSlots.description || this.description) && this.layoutAllowsDescription;
|
|
96
|
+
},
|
|
97
|
+
labelIsSrOnly() {
|
|
98
|
+
return this.labelPosition === 'hidden';
|
|
99
|
+
},
|
|
100
|
+
layoutAllowsHelp() {
|
|
101
|
+
return this.isVerticalLayout || this.isBlockLayout;
|
|
94
102
|
},
|
|
95
103
|
shouldRenderHelp() {
|
|
96
|
-
|
|
97
|
-
return Boolean(this.$slots.help || this.help) && this.isVerticalLayout;
|
|
104
|
+
return Boolean(this.$scopedSlots.help || this.help) && this.layoutAllowsHelp;
|
|
98
105
|
},
|
|
99
|
-
|
|
100
|
-
return
|
|
101
|
-
'gl-
|
|
102
|
-
}
|
|
106
|
+
labelContainerClasses() {
|
|
107
|
+
return {
|
|
108
|
+
'gl-mb-3': this.isVerticalLayout && !this.labelIsSrOnly
|
|
109
|
+
};
|
|
110
|
+
},
|
|
111
|
+
labelClasses() {
|
|
112
|
+
if (this.labelIsSrOnly) return 'gl-sr-only';
|
|
113
|
+
return {
|
|
114
|
+
'gl-mb-2': this.shouldRenderDescription,
|
|
115
|
+
'gl-mb-3': !this.shouldRenderDescription && !this.isVerticalLayout
|
|
116
|
+
};
|
|
117
|
+
},
|
|
118
|
+
wrapperClasses() {
|
|
119
|
+
return {
|
|
120
|
+
'gl-flex-direction-column': this.isVerticalLayout,
|
|
121
|
+
'gl-toggle-label-inline': !this.isVerticalLayout,
|
|
122
|
+
'is-disabled': this.disabled,
|
|
123
|
+
'gl-toggle-label-position-block': this.isBlockLayout
|
|
124
|
+
};
|
|
103
125
|
},
|
|
104
126
|
icon() {
|
|
105
127
|
return this.value ? 'mobile-issue-close' : 'close';
|
|
@@ -112,6 +134,9 @@ var script = {
|
|
|
112
134
|
},
|
|
113
135
|
isVerticalLayout() {
|
|
114
136
|
return this.labelPosition === 'top' || this.labelPosition === 'hidden';
|
|
137
|
+
},
|
|
138
|
+
isBlockLayout() {
|
|
139
|
+
return this.labelPosition === 'block';
|
|
115
140
|
}
|
|
116
141
|
},
|
|
117
142
|
beforeCreate() {
|
|
@@ -137,15 +162,11 @@ var script = {
|
|
|
137
162
|
const __vue_script__ = script;
|
|
138
163
|
|
|
139
164
|
/* template */
|
|
140
|
-
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:{
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
'gl-toggle': true,
|
|
146
|
-
'is-checked': _vm.value,
|
|
147
|
-
'is-disabled': _vm.disabled,
|
|
148
|
-
},attrs:{"role":"switch","aria-checked":_vm.isChecked,"aria-labelledby":_vm.labelId,"aria-describedby":_vm.helpId,"aria-disabled":_vm.disabled,"type":"button"},on:{"click":function($event){$event.preventDefault();return _vm.toggleFeature.apply(null, arguments)}}},[(_vm.isLoading)?_c('gl-loading-icon',{staticClass:"toggle-loading",attrs:{"color":"light"}}):_c('span',{class:{ 'toggle-icon': true, disabled: _vm.disabled }},[_c('gl-icon',{attrs:{"name":_vm.icon,"size":16}})],1)],1),_vm._v(" "),(_vm.shouldRenderHelp)?_c('span',{staticClass:"gl-help-label",attrs:{"id":_vm.helpId,"data-testid":"toggle-help"}},[_vm._t("help",function(){return [_vm._v(_vm._s(_vm.help))]})],2):_vm._e()])};
|
|
165
|
+
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 flex-grow-1",class:_vm.wrapperClasses,attrs:{"data-testid":"toggle-wrapper"}},[_c('span',{staticClass:"gl-toggle-label-container",class:_vm.labelContainerClasses},[_c('span',{staticClass:"gl-toggle-label",class:_vm.labelClasses,attrs:{"id":_vm.labelId,"data-testid":"toggle-label"}},[_vm._t("label",function(){return [_vm._v(_vm._s(_vm.label))]})],2),_vm._v(" "),(_vm.shouldRenderDescription)?_c('span',{staticClass:"gl-description-label",attrs:{"data-testid":"toggle-description"}},[_vm._t("description",function(){return [_vm._v(_vm._s(_vm.description))]})],2):_vm._e()]),_vm._v(" "),_c('span',{staticClass:"gl-toggle-switch-container"},[(_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:{
|
|
166
|
+
'gl-toggle': true,
|
|
167
|
+
'is-checked': _vm.value,
|
|
168
|
+
'is-disabled': _vm.disabled,
|
|
169
|
+
},attrs:{"role":"switch","aria-checked":_vm.isChecked,"aria-labelledby":_vm.labelId,"aria-describedby":_vm.helpId,"aria-disabled":_vm.disabled,"type":"button"},on:{"click":function($event){$event.preventDefault();return _vm.toggleFeature.apply(null, arguments)}}},[(_vm.isLoading)?_c('gl-loading-icon',{staticClass:"toggle-loading",attrs:{"color":"light"}}):_c('span',{class:{ 'toggle-icon': true, disabled: _vm.disabled }},[_c('gl-icon',{attrs:{"name":_vm.icon,"size":16}})],1)],1),_vm._v(" "),(_vm.shouldRenderHelp)?_c('span',{staticClass:"gl-help-label",attrs:{"id":_vm.helpId,"data-testid":"toggle-help"}},[_vm._t("help",function(){return [_vm._v(_vm._s(_vm.help))]})],2):_vm._e()])])};
|
|
149
170
|
var __vue_staticRenderFns__ = [];
|
|
150
171
|
|
|
151
172
|
/* style */
|