@gitlab/ui 80.2.0 → 80.4.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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Fri, 03 May 2024 22:13:37 GMT
3
+ * Generated on Tue, 07 May 2024 00:27:09 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Fri, 03 May 2024 22:13:37 GMT
3
+ * Generated on Tue, 07 May 2024 00:27:09 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 Fri, 03 May 2024 22:13:37 GMT
3
+ * Generated on Tue, 07 May 2024 00:27:09 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 Fri, 03 May 2024 22:13:37 GMT
3
+ * Generated on Tue, 07 May 2024 00:27:09 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 Fri, 03 May 2024 22:13:37 GMT
3
+ // Generated on Tue, 07 May 2024 00:27:09 GMT
4
4
 
5
5
  $gl-text-color-disabled: #89888d !default; // Used for disabled text.
6
6
  $gl-text-color-link: #63a6e9 !default; // Used for default text links.
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Fri, 03 May 2024 22:13:37 GMT
3
+ // Generated on Tue, 07 May 2024 00:27:09 GMT
4
4
 
5
5
  $gl-text-color-disabled: #89888d !default; // Used for disabled text.
6
6
  $gl-text-color-success: #217645 !default; // Used for text indicating success or validity.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "80.2.0",
3
+ "version": "80.4.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -138,7 +138,7 @@
138
138
  "emoji-regex": "^10.0.0",
139
139
  "eslint": "8.57.0",
140
140
  "eslint-import-resolver-jest": "3.0.2",
141
- "eslint-plugin-cypress": "3.0.3",
141
+ "eslint-plugin-cypress": "3.1.0",
142
142
  "eslint-plugin-storybook": "0.8.0",
143
143
  "glob": "10.3.3",
144
144
  "identity-obj-proxy": "^3.0.0",
@@ -471,11 +471,9 @@ export const WithHistoryItems = () => ({
471
471
  });
472
472
  WithHistoryItems.play = async ({ canvasElement }) => {
473
473
  const canvas = within(canvasElement);
474
- const button = canvas.getByRole('button', { name: 'Toggle history' });
474
+ const button = canvas.getByTestId('base-dropdown-toggle');
475
475
  await userEvent.click(button);
476
- await waitFor(() =>
477
- expect(within(document).getByRole('menu', { name: 'Toggle history' })).toBeVisible()
478
- );
476
+ await waitFor(() => expect(within(document).getByTestId('base-dropdown-menu')).toBeVisible());
479
477
  };
480
478
 
481
479
  export const WithFriendlyText = () => ({
@@ -1,55 +1,17 @@
1
1
  .gl-search-box-by-click {
2
2
  @include gl-font-base;
3
3
 
4
- .gl-search-box-by-click-history {
5
- > button {
6
- @include gl-p-3;
7
- @include gl-border-none;
8
- @include gl-inset-border-1-gray-400;
9
- }
10
-
11
- .gl-search-box-by-click-history-icon {
12
- @include gl-mr-2;
13
- @include gl-text-gray-500;
14
- }
15
-
16
- .gl-search-box-by-click-history-icon-chevron {
17
- @include gl-text-gray-500;
18
- @include gl-mr-0;
19
- }
20
-
21
- .gl-search-box-by-click-close-history-button {
22
- position: absolute;
23
- top: 0;
24
- right: $gl-spacing-scale-2;
25
- @include gl-line-height-0;
26
- @include gl-shadow-none;
27
- @include gl-w-auto;
28
- }
29
-
30
- .gl-search-box-by-click-history-header {
31
- @include gl-text-center;
32
- }
33
-
34
- .gl-search-box-by-click-history-no-searches {
35
- @include gl-text-center;
36
- @include gl-text-gray-500;
37
-
38
- .gl-dropdown-text {
39
- @include gl-font-weight-normal;
40
- }
41
- }
42
- }
43
-
44
- &.input-group {
45
- > .input-group-prepend,
46
- > .input-group-append {
47
- @include gl-bg-white;
48
- }
4
+ .gl-search-box-by-click-history > button {
5
+ padding-left: $gl-spacing-scale-4 !important;
6
+ padding-right: $gl-spacing-scale-3 !important;
7
+ @include gl-border-none;
8
+ border-top-right-radius: 0;
9
+ border-bottom-right-radius: 0;
10
+ @include gl-inset-border-1-gray-400;
49
11
  }
50
12
 
51
13
  .gl-search-box-by-click-search-button {
52
- @include gl-text-gray-500;
14
+ @include gl-text-secondary;
53
15
  @include gl-inset-border-1-gray-400;
54
16
  }
55
17
 
@@ -66,19 +28,14 @@
66
28
  @include gl-mr-2;
67
29
  @include gl-z-index-3;
68
30
  }
69
-
70
- .gl-search-box-by-click-menu {
71
- @include gl-font-base;
72
- width: $gl-dropdown-width-wide;
73
- }
74
31
  }
75
32
 
76
33
  .gl-search-box-by-click-with-search-button {
77
34
  .gl-search-box-by-click-input {
78
35
  @include gl-pr-7;
79
36
  }
80
-
37
+
81
38
  .gl-search-box-by-click-clear-button {
82
39
  right: $gl-spacing-scale-7;
83
40
  }
84
- }
41
+ }
@@ -1,6 +1,7 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
2
  import ClearIcon from '~/components/shared_components/clear_icon_button/clear_icon_button.vue';
3
- import GlDropdownItem from '../dropdown/dropdown_item.vue';
3
+ import GlDisclosureDropdown from '../new_dropdowns/disclosure/disclosure_dropdown.vue';
4
+ import GlDisclosureDropdownItem from '../new_dropdowns/disclosure/disclosure_dropdown_item.vue';
4
5
  import GlFormInput from '../form/form_input/form_input.vue';
5
6
  import SearchBoxByClick from './search_box_by_click.vue';
6
7
 
@@ -20,7 +21,10 @@ describe('search box by click component', () => {
20
21
  const createComponent = (propsData) => {
21
22
  wrapper = shallowMount(SearchBoxByClick, {
22
23
  propsData,
23
- stubs: { GlFormInputGroup: GlFormInputGroupStub },
24
+ stubs: {
25
+ GlDisclosureDropdown,
26
+ GlFormInputGroup: GlFormInputGroupStub,
27
+ },
24
28
  });
25
29
  };
26
30
 
@@ -91,14 +95,6 @@ describe('search box by click component', () => {
91
95
  expect(wrapper.findComponent({ ref: 'historyDropdown' }).exists()).toBe(true);
92
96
  });
93
97
 
94
- it('hides dropdown when close buton is clicked', () => {
95
- wrapper.vm.$refs.historyDropdown.hide = jest.fn();
96
-
97
- wrapper.findComponent({ ref: 'closeHistory' }).vm.$emit('click');
98
-
99
- expect(wrapper.vm.$refs.historyDropdown.hide).toHaveBeenCalled();
100
- });
101
-
102
98
  it('emits clear-history event when clear button is clicked', () => {
103
99
  wrapper.findComponent({ ref: 'clearHistory' }).vm.$emit('click');
104
100
 
@@ -106,7 +102,7 @@ describe('search box by click component', () => {
106
102
  });
107
103
 
108
104
  it('emits proper events when history item is clicked', async () => {
109
- wrapper.findComponent(GlDropdownItem).vm.$emit('click');
105
+ wrapper.findComponent(GlDisclosureDropdownItem).vm.$emit('action');
110
106
 
111
107
  await wrapper.vm.$nextTick();
112
108
  expect(wrapper.emitted('input')[0]).toEqual(['one']);
@@ -2,25 +2,19 @@
2
2
  import { GlTooltipDirective } from '../../../directives/tooltip';
3
3
  import GlClearIconButton from '../../shared_components/clear_icon_button/clear_icon_button.vue';
4
4
  import GlButton from '../button/button.vue';
5
- import GlDropdown from '../dropdown/dropdown.vue';
6
- import GlDropdownDivider from '../dropdown/dropdown_divider.vue';
7
- import GlDropdownItem from '../dropdown/dropdown_item.vue';
8
- import GlDropdownText from '../dropdown/dropdown_text.vue';
5
+ import GlDisclosureDropdown from '../new_dropdowns/disclosure/disclosure_dropdown.vue';
6
+ import GlDisclosureDropdownItem from '../new_dropdowns/disclosure/disclosure_dropdown_item.vue';
9
7
  import GlFormInput from '../form/form_input/form_input.vue';
10
8
  import GlFormInputGroup from '../form/form_input_group/form_input_group.vue';
11
- import GlIcon from '../icon/icon.vue';
12
9
 
13
10
  export default {
14
11
  name: 'GlSearchboxByClick',
15
12
  components: {
16
13
  GlClearIconButton,
17
- GlIcon,
18
14
  GlButton,
19
15
  GlFormInput,
20
- GlDropdown,
21
- GlDropdownText,
22
- GlDropdownItem,
23
- GlDropdownDivider,
16
+ GlDisclosureDropdown,
17
+ GlDisclosureDropdownItem,
24
18
  GlFormInputGroup,
25
19
  },
26
20
  directives: {
@@ -169,9 +163,6 @@ export default {
169
163
  },
170
164
  },
171
165
  methods: {
172
- closeHistoryDropdown() {
173
- this.$refs.historyDropdown.hide();
174
- },
175
166
  search(value) {
176
167
  /**
177
168
  * Emitted when search is submitted
@@ -217,52 +208,55 @@ export default {
217
208
  :class="{ 'gl-search-box-by-click-with-search-button': showSearchButton }"
218
209
  >
219
210
  <template v-if="historyItems" #prepend>
220
- <gl-dropdown
211
+ <gl-disclosure-dropdown
221
212
  ref="historyDropdown"
222
213
  class="gl-search-box-by-click-history"
223
- menu-class="gl-search-box-by-click-menu"
224
- category="secondary"
214
+ icon="history"
215
+ toggle-text="Toggle history"
216
+ text-sr-only
217
+ fluid-width
225
218
  :disabled="disabled"
226
219
  >
227
- <template #button-content>
228
- <gl-icon name="history" class="gl-search-box-by-click-history-icon" />
229
- <gl-icon name="chevron-down" class="gl-search-box-by-click-history-icon-chevron" />
230
- <span class="gl-sr-only">Toggle history</span>
220
+ <template #header>
221
+ <div
222
+ class="gl-search-box-by-click-history-header gl-display-flex gl-align-items-center gl-p-4! gl-min-h-8 gl-border-b-1 gl-border-b-solid gl-border-b-gray-200 gl-flex-grow-1 gl-font-weight-bold gl-font-sm"
223
+ >
224
+ {{ recentSearchesHeader }}
225
+ </div>
231
226
  </template>
232
- <gl-dropdown-text class="gl-search-box-by-click-history-header">
233
- {{ recentSearchesHeader }}
234
- <gl-button
235
- ref="closeHistory"
236
- v-gl-tooltip.hover="{ container: tooltipContainer }"
237
- :title="closeButtonTitle"
238
- :aria-label="closeButtonTitle"
239
- category="tertiary"
240
- class="gl-search-box-by-click-close-history-button"
241
- name="close"
242
- icon="close"
243
- @click="closeHistoryDropdown"
244
- />
245
- </gl-dropdown-text>
246
- <gl-dropdown-divider />
227
+
247
228
  <template v-if="historyItems.length">
248
- <gl-dropdown-item
229
+ <gl-disclosure-dropdown-item
249
230
  v-for="(item, idx) in historyItems"
250
231
  :key="idx"
251
232
  class="gl-search-box-by-click-history-item"
252
- @click="selectHistoryItem(item)"
233
+ @action="selectHistoryItem(item)"
234
+ >
235
+ <template #list-item>
236
+ <!-- @slot Slot to customize history item in history dropdown. Used only with history-items prop -->
237
+ <slot name="history-item" :history-item="item">{{ item }}</slot>
238
+ </template>
239
+ </gl-disclosure-dropdown-item>
240
+ </template>
241
+ <div v-else class="gl-font-sm gl-text-secondary gl-py-2 gl-px-4">
242
+ {{ noRecentSearchesText }}
243
+ </div>
244
+
245
+ <template v-if="historyItems.length" #footer>
246
+ <div
247
+ class="gl-border-t-solid gl-border-t-1 gl-border-t-gray-200 gl-display-flex gl-flex-direction-column gl-p-2"
253
248
  >
254
- <!-- @slot Slot to customize history item in history dropdown. Used only with history-items prop -->
255
- <slot name="history-item" :history-item="item">{{ item }}</slot>
256
- </gl-dropdown-item>
257
- <gl-dropdown-divider />
258
- <gl-dropdown-item ref="clearHistory" @click="emitClearHistory">{{
259
- clearRecentSearchesText
260
- }}</gl-dropdown-item>
249
+ <gl-button
250
+ ref="clearHistory"
251
+ category="tertiary"
252
+ class="gl-justify-content-start!"
253
+ @click="emitClearHistory"
254
+ >
255
+ {{ clearRecentSearchesText }}
256
+ </gl-button>
257
+ </div>
261
258
  </template>
262
- <gl-dropdown-text v-else class="gl-search-box-by-click-history-no-searches">{{
263
- noRecentSearchesText
264
- }}</gl-dropdown-text>
265
- </gl-dropdown>
259
+ </gl-disclosure-dropdown>
266
260
  </template>
267
261
  <slot name="input">
268
262
  <gl-form-input
@@ -34,10 +34,20 @@ const generateProps = ({
34
34
  const Template = (args, { argTypes }) => ({
35
35
  components: { GlToggle },
36
36
  props: Object.keys(argTypes),
37
+ data() {
38
+ return {
39
+ localValue: this.value,
40
+ };
41
+ },
42
+ watch: {
43
+ value(newValue) {
44
+ this.localValue = newValue;
45
+ },
46
+ },
37
47
  template: `
38
48
  <div class="gl-font-base">
39
49
  <gl-toggle
40
- v-model="value"
50
+ v-model="localValue"
41
51
  :disabled="disabled"
42
52
  :description="description"
43
53
  :help="help"