@gitlab/ui 40.6.3 → 40.6.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "40.6.3",
3
+ "version": "40.6.6",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -87,15 +87,15 @@
87
87
  "@rollup/plugin-commonjs": "^11.1.0",
88
88
  "@rollup/plugin-node-resolve": "^7.1.3",
89
89
  "@rollup/plugin-replace": "^2.3.2",
90
- "@storybook/addon-a11y": "6.5.4",
91
- "@storybook/addon-docs": "6.5.4",
92
- "@storybook/addon-essentials": "6.5.4",
90
+ "@storybook/addon-a11y": "6.5.5",
91
+ "@storybook/addon-docs": "6.5.5",
92
+ "@storybook/addon-essentials": "6.5.5",
93
93
  "@storybook/addon-knobs": "6.4.0",
94
- "@storybook/addon-storyshots": "6.5.4",
95
- "@storybook/addon-storyshots-puppeteer": "6.5.4",
96
- "@storybook/addon-viewport": "6.5.4",
97
- "@storybook/theming": "6.5.4",
98
- "@storybook/vue": "6.5.4",
94
+ "@storybook/addon-storyshots": "6.5.5",
95
+ "@storybook/addon-storyshots-puppeteer": "6.5.5",
96
+ "@storybook/addon-viewport": "6.5.5",
97
+ "@storybook/theming": "6.5.5",
98
+ "@storybook/vue": "6.5.5",
99
99
  "@vue/test-utils": "1.3.0",
100
100
  "autoprefixer": "^9.7.6",
101
101
  "babel-jest": "^26.6.3",
@@ -106,7 +106,7 @@
106
106
  "bootstrap": "4.5.3",
107
107
  "cypress": "^6.6.0",
108
108
  "emoji-regex": "^10.0.0",
109
- "eslint": "7.32.0",
109
+ "eslint": "8.16.0",
110
110
  "eslint-import-resolver-jest": "3.0.2",
111
111
  "eslint-plugin-cypress": "2.12.1",
112
112
  "eslint-plugin-storybook": "0.5.12",
@@ -202,8 +202,10 @@ const LabelToken = {
202
202
  },
203
203
  containerStyle() {
204
204
  if (this.activeLabel) {
205
+ // eslint-disable-next-line camelcase
205
206
  const { color, text_color } = this.activeLabel;
206
207
 
208
+ // eslint-disable-next-line camelcase
207
209
  return { backgroundColor: color, color: text_color };
208
210
  }
209
211
  return {};
@@ -18,6 +18,7 @@
18
18
  }
19
19
 
20
20
  .invalid-feedback,
21
+ .valid-feedback,
21
22
  .text-gl-muted {
22
23
  @include gl-font-base;
23
24
  @include gl-line-height-normal;
@@ -25,6 +26,7 @@
25
26
 
26
27
  .form-control {
27
28
  + .invalid-feedback,
29
+ + .valid-feedback,
28
30
  + .text-gl-muted,
29
31
  &.is-valid + .invalid-feedback + .text-gl-muted {
30
32
  // See https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/2806
@@ -74,31 +74,18 @@ WithLabelDescription.args = generateProps({
74
74
  export const WithValidations = (_args, { argTypes }) => ({
75
75
  props: Object.keys(argTypes),
76
76
  components: { ...components, GlFormInput },
77
- computed: {
78
- state() {
79
- return this.name.length >= 4;
80
- },
81
- invalidFeedback() {
82
- let feedbackText = 'This field is required.';
83
-
84
- if (this.name.length >= 4) {
85
- feedbackText = '';
86
- } else if (this.name.length > 0) {
87
- feedbackText = 'Enter at least 4 characters.';
88
- }
89
-
90
- return feedbackText;
91
- },
92
- },
93
- data() {
94
- return {
95
- name: '',
96
- };
97
- },
98
- template: wrap(
99
- '<gl-form-input :id="id" :state="state" v-model.trim="name" />',
100
- ':invalid-feedback="invalidFeedback"'
101
- ),
77
+ template: `
78
+ <div>
79
+ ${wrap(
80
+ '<gl-form-input :id="id" :state="false" />',
81
+ 'invalid-feedback="This field is required."'
82
+ )}
83
+ ${wrap(
84
+ '<gl-form-input :id="id" :state="true" value="Sidney Jones" />',
85
+ 'valid-feedback="This field is valid."'
86
+ )}
87
+ </div>
88
+ `,
102
89
  });
103
90
  WithValidations.args = generateProps({
104
91
  label: 'Name',
@@ -38,6 +38,10 @@
38
38
  }
39
39
  }
40
40
 
41
+ &.is-valid {
42
+ background-image: none;
43
+ }
44
+
41
45
  &::placeholder {
42
46
  @include gl-text-gray-400;
43
47
  }
@@ -41,17 +41,16 @@
41
41
  }
42
42
  }
43
43
 
44
- .input-group {
44
+ &.input-group {
45
45
  > .input-group-prepend,
46
46
  > .input-group-append {
47
47
  @include gl-bg-white;
48
48
  }
49
+ }
49
50
 
50
- .gl-search-box-by-click-search-button {
51
- @include gl-text-gray-500;
52
- @include gl-p-3;
53
- @include gl-inset-border-1-gray-400;
54
- }
51
+ .gl-search-box-by-click-search-button {
52
+ @include gl-text-gray-500;
53
+ @include gl-inset-border-1-gray-400;
55
54
  }
56
55
 
57
56
  .gl-search-box-by-click-input {
@@ -22,7 +22,6 @@
22
22
  @include gl-line-height-normal;
23
23
  @include gl-font-weight-normal;
24
24
  @include gl-display-inline-flex;
25
- @include gl-flex-direction-column;
26
25
 
27
26
  &.is-disabled {
28
27
  @include gl-opacity-4;
@@ -109,18 +109,23 @@ describe('toggle', () => {
109
109
 
110
110
  describe('label position', () => {
111
111
  describe.each`
112
- state | labelPosition | hasGlSrOnlyClass
113
- ${'top'} | ${toggleLabelPosition.top} | ${false}
114
- ${'left'} | ${toggleLabelPosition.left} | ${false}
115
- ${'hidden'} | ${toggleLabelPosition.hidden} | ${true}
116
- `('when $state', ({ labelPosition, hasGlSrOnlyClass }) => {
112
+ state | labelPosition | hasGlSrOnlyClass | flexDirection
113
+ ${'top'} | ${toggleLabelPosition.top} | ${false} | ${'gl-flex-direction-column'}
114
+ ${'left'} | ${toggleLabelPosition.left} | ${false} | ${'gl-toggle-label-inline'}
115
+ ${'hidden'} | ${toggleLabelPosition.hidden} | ${true} | ${'gl-flex-direction-column'}
116
+ `('when $state', ({ labelPosition, hasGlSrOnlyClass, flexDirection }) => {
117
117
  beforeEach(() => {
118
118
  createWrapper({ labelPosition });
119
119
  });
120
120
 
121
+ it(`${flexDirection} class is added to the label`, () => {
122
+ const cssClasses = wrapper.find('[data-testid="toggle-wrapper"]').classes();
123
+
124
+ return expect(cssClasses).toContain(flexDirection);
125
+ });
126
+
121
127
  it(`${hasGlSrOnlyClass ? 'adds' : 'does not add'} 'gl-sr-only' class to the label`, () => {
122
128
  const cssClasses = wrapper.find('[data-testid="toggle-label"]').classes();
123
-
124
129
  return hasGlSrOnlyClass
125
130
  ? expect(cssClasses).toContain('gl-sr-only')
126
131
  : expect(cssClasses).not.toContain('gl-sr-only');
@@ -118,8 +118,13 @@ export default {
118
118
 
119
119
  <template>
120
120
  <div
121
- class="gl-toggle-wrapper gl-display-flex gl-flex-direction-column gl-mb-0 gl-w-max-content"
122
- :class="{ 'gl-toggle-label-inline': labelPosition === 'left', 'is-disabled': disabled }"
121
+ class="gl-toggle-wrapper gl-display-flex gl-mb-0 gl-w-max-content"
122
+ :class="{
123
+ 'gl-flex-direction-column': labelPosition === 'top' || labelPosition === 'hidden',
124
+ 'gl-toggle-label-inline': labelPosition === 'left',
125
+ 'is-disabled': disabled,
126
+ }"
127
+ data-testid="toggle-wrapper"
123
128
  >
124
129
  <span
125
130
  :id="labelId"