@gitlab/ui 79.0.0 → 79.1.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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 22 Apr 2024 16:22:48 GMT
3
+ * Generated on Wed, 24 Apr 2024 14:36:20 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 22 Apr 2024 16:22:48 GMT
3
+ * Generated on Wed, 24 Apr 2024 14:36:21 GMT
4
4
  */
5
5
 
6
6
  :root.gl-dark {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 22 Apr 2024 16:22:48 GMT
3
+ * Generated on Wed, 24 Apr 2024 14:36:21 GMT
4
4
  */
5
5
 
6
6
  export const DATA_VIZ_GREEN_50 = "#133a03";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 22 Apr 2024 16:22:48 GMT
3
+ * Generated on Wed, 24 Apr 2024 14:36:20 GMT
4
4
  */
5
5
 
6
6
  export const DATA_VIZ_GREEN_50 = "#ddfab7";
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Mon, 22 Apr 2024 16:22:49 GMT
3
+ // Generated on Wed, 24 Apr 2024 14:36:21 GMT
4
4
 
5
5
  $gl-text-tertiary: #737278 !default;
6
6
  $gl-text-secondary: #89888d !default;
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Mon, 22 Apr 2024 16:22:48 GMT
3
+ // Generated on Wed, 24 Apr 2024 14:36:20 GMT
4
4
 
5
5
  $gl-text-tertiary: #89888d !default;
6
6
  $gl-text-secondary: #737278 !default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "79.0.0",
3
+ "version": "79.1.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -7,4 +7,5 @@
7
7
  @include gl-text-decoration-none;
8
8
  @include gl-text-gray-900;
9
9
  @include gl-outline-0;
10
+ @include gl-focus($inset: true);
10
11
  }
@@ -4,6 +4,10 @@
4
4
  .gl-filtered-search-suggestion-list.dropdown-menu {
5
5
  @include gl-display-block;
6
6
  width: $gl-dropdown-width;
7
+ @include gl-p-2;
8
+ @include gl-border-gray-200;
9
+ @include gl-rounded-lg;
10
+ @include gl-shadow-md;
7
11
  }
8
12
 
9
13
  .gl-filtered-search-suggestion-list {
@@ -11,6 +15,20 @@
11
15
  @include gl-overflow-y-auto;
12
16
  max-height: $gl-max-dropdown-max-height;
13
17
 
18
+ .gl-filtered-search-suggestion,
19
+ .gl-filtered-search-suggestion > a,
20
+ .gl-filtered-search-suggestion > button {
21
+ border-radius: $gl-border-radius-base !important;
22
+ }
23
+
24
+ .gl-dropdown-divider {
25
+ @include gl-mx-n2;
26
+ }
27
+
28
+ .gl-spinner-container {
29
+ @include gl-my-2;
30
+ }
31
+
14
32
  .gl-filtered-search-suggestion {
15
33
  @include gl-p-0;
16
34
  }
@@ -1,8 +1,8 @@
1
+ import { disableControls } from '../../../../utils/stories_utils';
1
2
  import GlFormInput from '../form_input/form_input.vue';
2
3
  import GlFormTextarea from '../form_textarea/form_textarea.vue';
3
- import { disableControls } from '../../../../utils/stories_utils';
4
- import GlFormGroup from './form_group.vue';
5
4
  import readme from './form_group.md';
5
+ import GlFormGroup from './form_group.vue';
6
6
 
7
7
  const components = {
8
8
  GlFormGroup,
@@ -24,16 +24,24 @@ const generateProps = ({
24
24
  description,
25
25
  });
26
26
 
27
- const wrap = (template, bindings = '') => `
27
+ const makeBindings = (overrides = {}) =>
28
+ Object.entries({
29
+ ':id': "id + '_group'",
30
+ ':label-for': 'id',
31
+ ':label': 'label',
32
+ ':label-description': 'labelDescription',
33
+ ':optional': 'optional',
34
+ ':optional-text': 'optionalText',
35
+ ':description': 'description',
36
+ ...overrides,
37
+ })
38
+ .map(([key, value]) => `${key}="${value}"`)
39
+ .join(' ');
40
+
41
+ const wrap = (template, bindingsOverrides = {}) => `
28
42
  <gl-form-group
29
- :id="id + '_group'"
30
- :label="label"
31
- :label-description="labelDescription"
32
- :optional="optional"
33
- :optional-text="optionalText"
34
- :description="description"
35
- ${bindings}
36
- :label-for="id">
43
+ ${makeBindings(bindingsOverrides)}
44
+ >
37
45
  ${template}
38
46
  </gl-form-group>
39
47
  `;
@@ -78,14 +86,15 @@ export const WithValidations = (_args, { argTypes }) => ({
78
86
  components: { ...components, GlFormInput },
79
87
  template: `
80
88
  <div>
81
- ${wrap(
82
- '<gl-form-input :id="id" :state="false" />',
83
- 'invalid-feedback="This field is required."'
84
- )}
85
- ${wrap(
86
- '<gl-form-input :id="id" :state="true" value="Sidney Jones" />',
87
- 'valid-feedback="This field is valid."'
88
- )}
89
+ ${wrap('<gl-form-input :id="id + \'-name1\'" :state="false" />', {
90
+ 'invalid-feedback': 'This field is required.',
91
+ ':label-for': "id + '-name1'",
92
+ })}
93
+ ${wrap('<gl-form-input :id="id + \'-name2\'" :state="true" value="Sidney Jones" />', {
94
+ 'valid-feedback': 'This field is valid.',
95
+ ':id': "'group2'",
96
+ ':label-for': "id + '-name2'",
97
+ })}
89
98
  </div>
90
99
  `,
91
100
  });
@@ -201,5 +201,42 @@ describe('GlFormTextArea', () => {
201
201
 
202
202
  itUpdatesDebouncedScreenReaderText(expectedText);
203
203
  });
204
+
205
+ describe('when `value` prop is `null`', () => {
206
+ const expectedText = `${characterCount} characters remaining`;
207
+
208
+ beforeEach(() => {
209
+ createComponent({
210
+ value: null,
211
+ characterCount,
212
+ });
213
+ });
214
+
215
+ it('displays remaining characters', () => {
216
+ expect(wrapper.text()).toContain(expectedText);
217
+ });
218
+
219
+ itUpdatesDebouncedScreenReaderText(expectedText);
220
+ });
221
+
222
+ describe('when `value` prop is updated to `null`', () => {
223
+ const textareaCharacterCount = 5;
224
+ const expectedText = `${characterCount} characters remaining`;
225
+
226
+ beforeEach(() => {
227
+ createComponent({
228
+ value: 'a'.repeat(textareaCharacterCount),
229
+ characterCount,
230
+ });
231
+
232
+ wrapper.setProps({ value: null });
233
+ });
234
+
235
+ it('updates character count text', () => {
236
+ expect(wrapper.text()).toContain(expectedText);
237
+ });
238
+
239
+ itUpdatesDebouncedScreenReaderText(expectedText);
240
+ });
204
241
  });
205
242
  });
@@ -98,7 +98,7 @@ export default {
98
98
  return;
99
99
  }
100
100
 
101
- this.remainingCharacterCount = this.characterCount - newValue.length;
101
+ this.remainingCharacterCount = this.characterCount - this.valueLength(newValue);
102
102
  this.debouncedUpdateRemainingCharacterCountSrOnly(newValue);
103
103
  },
104
104
  },
@@ -111,16 +111,19 @@ export default {
111
111
  );
112
112
  },
113
113
  methods: {
114
+ valueLength(value) {
115
+ return value?.length || 0;
116
+ },
114
117
  handleKeyPress(e) {
115
118
  if (e.keyCode === 13 && (e.metaKey || e.ctrlKey)) {
116
119
  this.$emit('submit');
117
120
  }
118
121
  },
119
122
  updateRemainingCharacterCountSrOnly(newValue) {
120
- this.remainingCharacterCountSrOnly = this.characterCount - newValue.length;
123
+ this.remainingCharacterCountSrOnly = this.characterCount - this.valueLength(newValue);
121
124
  },
122
125
  initialRemainingCharacterCount() {
123
- return this.characterCount - this.value.length;
126
+ return this.characterCount - this.valueLength(this.value);
124
127
  },
125
128
  },
126
129
  };