@gitlab/ui 66.30.0 → 66.31.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/components/base/infinite_scroll/infinite_scroll.js +7 -2
  3. package/dist/components/base/new_dropdowns/listbox/listbox.js +3 -4
  4. package/dist/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.js +1 -1
  5. package/dist/components/experimental/duo/chat/components/duo_chat_message_sources/duo_chat_message_sources.js +2 -1
  6. package/dist/components/experimental/duo/chat/components/duo_chat_predefined_prompts/duo_chat_predefined_prompts.js +1 -1
  7. package/dist/components/experimental/duo/user_feedback/user_feedback.js +1 -1
  8. package/dist/components/experimental/duo/user_feedback/user_feedback_modal.js +4 -1
  9. package/dist/components/experimental/experiment_badge/experiment_badge.js +3 -1
  10. package/dist/tokens/css/tokens.css +1 -1
  11. package/dist/tokens/css/tokens.dark.css +1 -1
  12. package/dist/tokens/js/tokens.dark.js +1 -1
  13. package/dist/tokens/js/tokens.js +1 -1
  14. package/dist/tokens/scss/_tokens.dark.scss +1 -1
  15. package/dist/tokens/scss/_tokens.scss +1 -1
  16. package/package.json +1 -1
  17. package/src/components/base/dropdown/dropdown.md +3 -3
  18. package/src/components/base/dropdown/dropdown.stories.js +1 -1
  19. package/src/components/base/dropdown/dropdown_item.stories.js +1 -1
  20. package/src/components/base/infinite_scroll/infinite_scroll.md +3 -1
  21. package/src/components/base/infinite_scroll/infinite_scroll.spec.js +2 -2
  22. package/src/components/base/infinite_scroll/infinite_scroll.vue +5 -2
  23. package/src/components/base/new_dropdowns/disclosure/disclosure_dropdown.stories.js +1 -1
  24. package/src/components/base/new_dropdowns/listbox/listbox.spec.js +27 -0
  25. package/src/components/base/new_dropdowns/listbox/listbox.stories.js +1 -1
  26. package/src/components/base/new_dropdowns/listbox/listbox.vue +2 -4
  27. package/src/components/base/tabs/tabs/tabs.spec.js +1 -1
  28. package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.spec.js +1 -1
  29. package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.vue +1 -1
  30. package/src/components/experimental/duo/chat/components/duo_chat_message_sources/duo_chat_message_sources.spec.js +2 -1
  31. package/src/components/experimental/duo/chat/components/duo_chat_message_sources/duo_chat_message_sources.vue +2 -1
  32. package/src/components/experimental/duo/chat/components/duo_chat_predefined_prompts/duo_chat_predefined_prompts.spec.js +1 -1
  33. package/src/components/experimental/duo/chat/components/duo_chat_predefined_prompts/duo_chat_predefined_prompts.vue +1 -1
  34. package/src/components/experimental/duo/user_feedback/user_feedback.spec.js +1 -1
  35. package/src/components/experimental/duo/user_feedback/user_feedback.stories.js +3 -1
  36. package/src/components/experimental/duo/user_feedback/user_feedback.vue +1 -1
  37. package/src/components/experimental/duo/user_feedback/user_feedback_modal.spec.js +4 -1
  38. package/src/components/experimental/duo/user_feedback/user_feedback_modal.vue +4 -1
  39. package/src/components/experimental/experiment_badge/experiment_badge.vue +3 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [66.31.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v66.31.0...v66.31.1) (2023-10-13)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **GlCollapsibleListbox:** Visibility of Reset button ([f71f767](https://gitlab.com/gitlab-org/gitlab-ui/commit/f71f767553a93237167c65772479e990c8913f93))
7
+
8
+ # [66.31.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v66.30.0...v66.31.0) (2023-10-13)
9
+
10
+
11
+ ### Features
12
+
13
+ * **InfiniteScroll:** Add support for scrolling behavior ([ca91a07](https://gitlab.com/gitlab-org/gitlab-ui/commit/ca91a07706107652d4b659e8bece8b5bfea31d89))
14
+
1
15
  # [66.30.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v66.29.0...v66.30.0) (2023-10-12)
2
16
 
3
17
 
@@ -115,13 +115,18 @@ var script = {
115
115
  *
116
116
  * @param params.top - Number of pixels along Y axis to
117
117
  * scroll the list container.
118
+ * @param params.behavior - Determines whether scrolling
119
+ * is instant or animates smoothly. Can be 'auto', 'instant', or 'smooth'
120
+ * See [MDN spec](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTo)
118
121
  */
119
122
  scrollTo(_ref) {
120
123
  let {
121
- top
124
+ top,
125
+ behavior
122
126
  } = _ref;
123
127
  this.$refs.infiniteContainer.scrollTo({
124
- top
128
+ top,
129
+ behavior
125
130
  });
126
131
  },
127
132
  topReached: throttle(function topReachedThrottled() {
@@ -408,10 +408,9 @@ var script = {
408
408
  if (!this.selected || this.selected.length === 0) {
409
409
  return false;
410
410
  }
411
- if (this.multiple) {
412
- return this.selected.length === this.flattenedOptions.length;
413
- }
414
- return Boolean(this.selected);
411
+
412
+ // only show reset button if show all button is not there
413
+ return !this.showSelectAllButton;
415
414
  },
416
415
  showSelectAllButton() {
417
416
  if (!this.showSelectAllButtonLabel) {
@@ -1,4 +1,4 @@
1
- import { GlDuoUserFeedback } from '../../../../../../index';
1
+ import GlDuoUserFeedback from '../../../user_feedback/user_feedback';
2
2
  import { SafeHtmlDirective } from '../../../../../../directives/safe_html/safe_html';
3
3
  import { MESSAGE_MODEL_ROLES } from '../../constants';
4
4
  import DocumentationSources from '../duo_chat_message_sources/duo_chat_message_sources';
@@ -1,4 +1,5 @@
1
- import { GlIcon, GlLink } from '../../../../../../index';
1
+ import GlIcon from '../../../../../base/icon/icon';
2
+ import GlLink from '../../../../../base/link/link';
2
3
  import { DOCUMENTATION_SOURCE_TYPES } from '../../constants';
3
4
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
4
5
 
@@ -1,4 +1,4 @@
1
- import { GlButton } from '../../../../../../index';
1
+ import GlButton from '../../../../../base/button/button';
2
2
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
3
3
 
4
4
  var script = {
@@ -1,4 +1,4 @@
1
- import { GlButton } from '../../../../index';
1
+ import GlButton from '../../../base/button/button';
2
2
  import FeedbackModal from './user_feedback_modal';
3
3
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
4
4
 
@@ -1,4 +1,7 @@
1
- import { GlModal, GlFormCheckboxGroup, GlFormGroup, GlFormTextarea } from '../../../../index';
1
+ import GlModal from '../../../base/modal/modal';
2
+ import GlFormGroup from '../../../base/form/form_group/form_group';
3
+ import GlFormTextarea from '../../../base/form/form_textarea/form_textarea';
4
+ import GlFormCheckboxGroup from '../../../base/form/form_checkbox/form_checkbox_group';
2
5
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
3
6
 
4
7
  const i18n = {
@@ -1,5 +1,7 @@
1
1
  import uniqueId from 'lodash/uniqueId';
2
- import { GlBadge, GlPopover, GlLink } from '../../../index';
2
+ import GlBadge from '../../base/badge/badge';
3
+ import GlLink from '../../base/link/link';
4
+ import GlPopover from '../../base/popover/popover';
3
5
  import GlSprintf from '../../utilities/sprintf/sprintf';
4
6
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
5
7
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 12 Oct 2023 16:02:49 GMT
3
+ * Generated on Fri, 13 Oct 2023 20:03:52 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 12 Oct 2023 16:02:49 GMT
3
+ * Generated on Fri, 13 Oct 2023 20:03:52 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 12 Oct 2023 16:02:49 GMT
3
+ * Generated on Fri, 13 Oct 2023 20:03:52 GMT
4
4
  */
5
5
 
6
6
  export const BLACK = "#fff";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 12 Oct 2023 16:02:49 GMT
3
+ * Generated on Fri, 13 Oct 2023 20:03:52 GMT
4
4
  */
5
5
 
6
6
  export const BLACK = "#000";
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Thu, 12 Oct 2023 16:02:49 GMT
3
+ // Generated on Fri, 13 Oct 2023 20:03:52 GMT
4
4
 
5
5
  $red-950: #fff4f3;
6
6
  $red-900: #fcf1ef;
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Thu, 12 Oct 2023 16:02:49 GMT
3
+ // Generated on Fri, 13 Oct 2023 20:03:52 GMT
4
4
 
5
5
  $gl-line-height-52: 3.25rem;
6
6
  $gl-line-height-44: 2.75rem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "66.30.0",
3
+ "version": "66.31.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -1,15 +1,15 @@
1
1
  The dropdown component offers a user multiple items or actions to choose from which are initially
2
2
  collapsed behind a button.
3
3
 
4
- > **NOTE**: This component will eventually be deprecated in favor of components
4
+ > **NOTE**: This component has been deprecated in favor of components
5
5
  > more suited to the various use cases for dropdowns. Consider using a more
6
6
  > appropriate component instead:
7
7
  >
8
8
  > - For single or multiselect options, use `GlCollapsibleListbox`.
9
9
  > - For displaying a list of actions like "Edit user", "Delete user", use `GlDisclosureDropdown`.
10
10
  >
11
- > See [this epic](https://gitlab.com/groups/gitlab-org/-/epics/1059) for the
12
- > most up-to-date information about what to use and when.
11
+ > See [Which component should you use?](https://design.gitlab.com/components/dropdown-overview#which-component-should-you-use)
12
+ > for what to use and when.
13
13
 
14
14
  ### Icon-only dropdown
15
15
 
@@ -536,7 +536,7 @@ export const OnRightEdge = (args, { argTypes }) => ({
536
536
  OnRightEdge.args = generateProps({ text: 'Some dropdown' });
537
537
 
538
538
  export default {
539
- title: 'base/dropdown',
539
+ title: 'base/dropdown/deprecated',
540
540
  component: GlDropdown,
541
541
  subcomponents: {
542
542
  GlDropdownDivider,
@@ -90,7 +90,7 @@ CheckedWithSecondaryText.args = generateProps({
90
90
  });
91
91
 
92
92
  export default {
93
- title: 'base/dropdown/dropdown-item',
93
+ title: 'base/dropdown/deprecated/dropdown-item',
94
94
  component: GlDropdownItem,
95
95
  parameters: {
96
96
  bootstrapComponent: 'b-dropdown-item',
@@ -15,7 +15,9 @@ Useful public methods you can call via `$refs`:
15
15
 
16
16
  - `.scrollUp()`: Scrolls to the top of the container.
17
17
  - `.scrollDown()`: Scrolls to the bottom of the container.
18
- - `.scrollTo({ top })`: Scrolls to a number of pixels along the Y axis of the container.
18
+ - `.scrollTo({ top, behavior })`: Scrolls to a number of pixels
19
+ along the Y axis of the container. The scrolling behavior can also be specified,
20
+ as per MDN spec (<https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTo>)
19
21
 
20
22
  ## Implementation Example
21
23
 
@@ -174,9 +174,9 @@ describe('Infinite Scroll component', () => {
174
174
 
175
175
  it('scrollTo', () => {
176
176
  createComponent();
177
- wrapper.vm.scrollTo({ top: 250 });
177
+ wrapper.vm.scrollTo({ top: 250, behavior: 'instant' });
178
178
 
179
- expect(mockScrollTo).toHaveBeenCalledWith({ top: 250 });
179
+ expect(mockScrollTo).toHaveBeenCalledWith({ top: 250, behavior: 'instant' });
180
180
  });
181
181
  });
182
182
  });
@@ -107,9 +107,12 @@ export default {
107
107
  *
108
108
  * @param params.top - Number of pixels along Y axis to
109
109
  * scroll the list container.
110
+ * @param params.behavior - Determines whether scrolling
111
+ * is instant or animates smoothly. Can be 'auto', 'instant', or 'smooth'
112
+ * See [MDN spec](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollTo)
110
113
  */
111
- scrollTo({ top }) {
112
- this.$refs.infiniteContainer.scrollTo({ top });
114
+ scrollTo({ top, behavior }) {
115
+ this.$refs.infiniteContainer.scrollTo({ top, behavior });
113
116
  },
114
117
 
115
118
  topReached: throttle(function topReachedThrottled() {
@@ -333,7 +333,7 @@ MiscellaneousContent.args = {
333
333
  MiscellaneousContent.decorators = [makeContainer({ height: '200px' })];
334
334
 
335
335
  export default {
336
- title: 'base/new-dropdowns/disclosure',
336
+ title: 'base/dropdown/disclosure-dropdown',
337
337
  component: GlDisclosureDropdown,
338
338
  parameters: {
339
339
  docs: {
@@ -517,6 +517,18 @@ describe('GlCollapsibleListbox', () => {
517
517
  }
518
518
  );
519
519
 
520
+ it('shows the button if the label is provided and only one option is selected in multi select', () => {
521
+ buildWrapper({
522
+ headerText: 'Select assignee',
523
+ resetButtonLabel: 'Unassign',
524
+ items: mockOptions,
525
+ multiple: true,
526
+ selected: mockOptionsValues.slice(0, 1),
527
+ });
528
+
529
+ expect(findResetButton().exists()).toBe(true);
530
+ });
531
+
520
532
  it.each`
521
533
  description | props
522
534
  ${'multi-select'} | ${{ multiple: true, selected: [] }}
@@ -598,6 +610,7 @@ describe('GlCollapsibleListbox', () => {
598
610
  describe.each`
599
611
  multiple | resetVisible | selectAllVisible | selected
600
612
  ${false} | ${false} | ${false} | ${[]}
613
+ ${false} | ${false} | ${false} | ${undefined}
601
614
  ${true} | ${false} | ${true} | ${[]}
602
615
  `(
603
616
  'when label is provided, selection is empty and multiple option is $multiple',
@@ -623,6 +636,20 @@ describe('GlCollapsibleListbox', () => {
623
636
  }
624
637
  );
625
638
 
639
+ it('when label is provided and one option is selected in multiselect', () => {
640
+ buildWrapper({
641
+ headerText: 'Select assignee',
642
+ resetButtonLabel: 'Unassign',
643
+ showSelectAllButtonLabel: 'Select All',
644
+ items: mockOptions,
645
+ selected: mockOptionsValues.slice(0, 1),
646
+ multiple: true,
647
+ });
648
+
649
+ expect(findSelectAllButton().exists()).toBe(true);
650
+ expect(findResetButton().exists()).toBe(false);
651
+ });
652
+
626
653
  it('hides select all button if dropdown has no items', () => {
627
654
  buildWrapper({
628
655
  headerText: 'Select assignee',
@@ -450,7 +450,7 @@ GroupWithoutLabel.args = generateProps({
450
450
  });
451
451
 
452
452
  export default {
453
- title: 'base/new-dropdowns/listbox',
453
+ title: 'base/dropdown/collapsible-listbox',
454
454
  component: GlCollapsibleListbox,
455
455
  parameters: {
456
456
  docs: {
@@ -419,10 +419,8 @@ export default {
419
419
  return false;
420
420
  }
421
421
 
422
- if (this.multiple) {
423
- return this.selected.length === this.flattenedOptions.length;
424
- }
425
- return Boolean(this.selected);
422
+ // only show reset button if show all button is not there
423
+ return !this.showSelectAllButton;
426
424
  },
427
425
  showSelectAllButton() {
428
426
  if (!this.showSelectAllButtonLabel) {
@@ -1,6 +1,6 @@
1
1
  import { mount } from '@vue/test-utils';
2
2
  import { nextTick } from 'vue';
3
- import { GlButton } from '../../../../index';
3
+ import GlButton from '../../button/button.vue';
4
4
  import { tabsButtonDefaults } from '../../../../utils/constants';
5
5
  import GlTab from '../tab/tab.vue';
6
6
  import GlTabs from './tabs.vue';
@@ -1,6 +1,6 @@
1
1
  import { nextTick } from 'vue';
2
2
  import { shallowMount } from '@vue/test-utils';
3
- import { GlDuoUserFeedback } from '../../../../../../index';
3
+ import GlDuoUserFeedback from '../../../user_feedback/user_feedback.vue';
4
4
  import {
5
5
  MOCK_USER_PROMPT_MESSAGE,
6
6
  MOCK_RESPONSE_MESSAGE,
@@ -1,5 +1,5 @@
1
1
  <script>
2
- import { GlDuoUserFeedback } from '../../../../../../index';
2
+ import GlDuoUserFeedback from '../../../user_feedback/user_feedback.vue';
3
3
  import { SafeHtmlDirective as SafeHtml } from '../../../../../../directives/safe_html/safe_html';
4
4
  import { MESSAGE_MODEL_ROLES } from '../../constants';
5
5
  import DocumentationSources from '../duo_chat_message_sources/duo_chat_message_sources.vue';
@@ -1,5 +1,6 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
- import { GlIcon, GlLink } from '../../../../../../index';
2
+ import GlIcon from '../../../../../base/icon/icon.vue';
3
+ import GlLink from '../../../../../base/link/link.vue';
3
4
  import { DOCUMENTATION_SOURCE_TYPES } from '../../constants';
4
5
  import GlDuoChatMessageSources from './duo_chat_message_sources.vue';
5
6
 
@@ -1,5 +1,6 @@
1
1
  <script>
2
- import { GlIcon, GlLink } from '../../../../../../index';
2
+ import GlIcon from '../../../../../base/icon/icon.vue';
3
+ import GlLink from '../../../../../base/link/link.vue';
3
4
  import { DOCUMENTATION_SOURCE_TYPES } from '../../constants';
4
5
 
5
6
  export const i18n = {
@@ -1,5 +1,5 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
- import { GlButton } from '../../../../../../index';
2
+ import GlButton from '../../../../../base/button/button.vue';
3
3
  import GlDuoChatPredefinedPrompts from './duo_chat_predefined_prompts.vue';
4
4
 
5
5
  describe('GlDuoChatPredefinedPrompts', () => {
@@ -1,5 +1,5 @@
1
1
  <script>
2
- import { GlButton } from '../../../../../../index';
2
+ import GlButton from '../../../../../base/button/button.vue';
3
3
 
4
4
  export default {
5
5
  name: 'GlDuoChatPredefinedPrompts',
@@ -1,6 +1,6 @@
1
1
  import { nextTick } from 'vue';
2
2
  import { shallowMount } from '@vue/test-utils';
3
- import { GlButton } from '../../../../index';
3
+ import GlButton from '../../../base/button/button.vue';
4
4
  import FeedbackModal from './user_feedback_modal.vue';
5
5
  import UserFeedback, { i18n } from './user_feedback.vue';
6
6
 
@@ -1,4 +1,6 @@
1
- import { GlAlert, GlFormGroup, GlFormTextarea } from '../../../../index';
1
+ import GlAlert from '../../../base/alert/alert.vue';
2
+ import GlFormGroup from '../../../base/form/form_group/form_group.vue';
3
+ import GlFormTextarea from '../../../base/form/form_textarea/form_textarea.vue';
2
4
  import GlDuoUserFeedback from './user_feedback.vue';
3
5
  import readme from './user_feedback.md';
4
6
 
@@ -1,5 +1,5 @@
1
1
  <script>
2
- import { GlButton } from '../../../../index';
2
+ import GlButton from '../../../base/button/button.vue';
3
3
  import FeedbackModal from './user_feedback_modal.vue';
4
4
 
5
5
  export const i18n = {
@@ -1,5 +1,8 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
- import { GlModal, GlFormCheckboxGroup, GlFormCheckbox, GlFormTextarea } from '../../../../index';
2
+ import GlModal from '../../../base/modal/modal.vue';
3
+ import GlFormCheckbox from '../../../base/form/form_checkbox/form_checkbox.vue';
4
+ import GlFormCheckboxGroup from '../../../base/form/form_checkbox/form_checkbox_group.vue';
5
+ import GlFormTextarea from '../../../base/form/form_textarea/form_textarea.vue';
3
6
  import FeedbackModal, { feedbackOptions } from './user_feedback_modal.vue';
4
7
 
5
8
  const DummyComponent = {
@@ -1,5 +1,8 @@
1
1
  <script>
2
- import { GlModal, GlFormCheckboxGroup, GlFormGroup, GlFormTextarea } from '../../../../index';
2
+ import GlModal from '../../../base/modal/modal.vue';
3
+ import GlFormGroup from '../../../base/form/form_group/form_group.vue';
4
+ import GlFormTextarea from '../../../base/form/form_textarea/form_textarea.vue';
5
+ import GlFormCheckboxGroup from '../../../base/form/form_checkbox/form_checkbox_group.vue';
3
6
 
4
7
  export const i18n = {
5
8
  MODAL_TITLE: 'Give feedback on AI content',
@@ -1,6 +1,8 @@
1
1
  <script>
2
2
  import uniqueId from 'lodash/uniqueId';
3
- import { GlBadge, GlLink, GlPopover } from '../../../index';
3
+ import GlBadge from '../../base/badge/badge.vue';
4
+ import GlLink from '../../base/link/link.vue';
5
+ import GlPopover from '../../base/popover/popover.vue';
4
6
  import GlSprintf from '../../utilities/sprintf/sprintf.vue';
5
7
 
6
8
  export const i18n = {