@gitlab/ui 32.36.0 → 32.40.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.
Files changed (62) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/components/base/carousel/carousel.documentation.js +1 -4
  3. package/dist/components/base/dropdown/dropdown.js +3 -3
  4. package/dist/components/base/filtered_search/filtered_search.js +1 -1
  5. package/dist/components/base/filtered_search/filtered_search_token_segment.js +10 -2
  6. package/dist/components/base/form/form_input_group/form_input_group.js +6 -1
  7. package/dist/components/base/markdown/markdown.documentation.js +2 -6
  8. package/dist/components/base/popover/popover.js +1 -1
  9. package/dist/components/base/search_box_by_click/search_box_by_click.js +1 -1
  10. package/dist/components/base/table/constants.js +5 -0
  11. package/dist/components/base/table/table.js +19 -1
  12. package/dist/components/charts/bar/bar.js +1 -1
  13. package/dist/components/charts/sparkline/sparkline.js +1 -1
  14. package/dist/components/charts/stacked_column/stacked_column.js +1 -1
  15. package/dist/utility_classes.css +1 -1
  16. package/dist/utility_classes.css.map +1 -1
  17. package/dist/utils/constants.js +2 -2
  18. package/dist/utils/utils.js +12 -2
  19. package/documentation/documented_stories.js +2 -0
  20. package/package.json +3 -3
  21. package/scss_to_js/scss_variables.js +2 -0
  22. package/scss_to_js/scss_variables.json +11 -1
  23. package/src/components/base/carousel/carousel.documentation.js +0 -2
  24. package/src/components/base/carousel/carousel.md +0 -2
  25. package/src/components/base/carousel/carousel.stories.js +24 -11
  26. package/src/components/base/dropdown/dropdown.spec.js +6 -9
  27. package/src/components/base/dropdown/dropdown.stories.js +3 -3
  28. package/src/components/base/dropdown/dropdown.vue +3 -3
  29. package/src/components/base/filtered_search/filtered_search.vue +1 -0
  30. package/src/components/base/filtered_search/filtered_search_token_segment.spec.js +17 -1
  31. package/src/components/base/filtered_search/filtered_search_token_segment.vue +9 -1
  32. package/src/components/base/form/form_input_group/form_input_group.spec.js +18 -1
  33. package/src/components/base/form/form_input_group/form_input_group.vue +6 -1
  34. package/src/components/base/markdown/markdown.documentation.js +0 -3
  35. package/src/components/base/markdown/markdown.md +0 -2
  36. package/src/components/base/markdown/markdown.stories.js +25 -24
  37. package/src/components/base/popover/popover.spec.js +9 -0
  38. package/src/components/base/popover/popover.stories.js +37 -12
  39. package/src/components/base/popover/popover.vue +1 -2
  40. package/src/components/base/search_box_by_click/search_box_by_click.vue +1 -0
  41. package/src/components/base/table/constants.js +49 -0
  42. package/src/components/base/table/table.spec.js +49 -0
  43. package/src/components/base/table/table.vue +16 -0
  44. package/src/components/charts/bar/bar.spec.js +0 -15
  45. package/src/components/charts/bar/bar.vue +3 -2
  46. package/src/components/charts/sparkline/sparkline.spec.js +21 -27
  47. package/src/components/charts/sparkline/sparkline.vue +24 -12
  48. package/src/components/charts/stacked_column/stacked_column.spec.js +11 -1
  49. package/src/components/charts/stacked_column/stacked_column.vue +5 -8
  50. package/src/scss/utilities.scss +8 -0
  51. package/src/scss/utility-mixins/color.scss +4 -0
  52. package/src/scss/variables.scss +4 -1
  53. package/src/utils/constants.js +1 -1
  54. package/src/utils/utils.js +11 -1
  55. package/dist/components/base/carousel/examples/carousel.basic.example.js +0 -38
  56. package/dist/components/base/carousel/examples/index.js +0 -13
  57. package/dist/components/base/markdown/examples/index.js +0 -13
  58. package/dist/components/base/markdown/examples/markdown.basic.example.js +0 -38
  59. package/src/components/base/carousel/examples/carousel.basic.example.vue +0 -26
  60. package/src/components/base/carousel/examples/index.js +0 -15
  61. package/src/components/base/markdown/examples/index.js +0 -15
  62. package/src/components/base/markdown/examples/markdown.basic.example.vue +0 -15
@@ -97,7 +97,7 @@ const badgeForButtonOptions = {
97
97
  [buttonVariantOptions.confirm]: badgeVariantOptions.info,
98
98
  [buttonVariantOptions.danger]: badgeVariantOptions.danger
99
99
  };
100
- const newDropdownVariantOptions = {
100
+ const dropdownVariantOptions = {
101
101
  default: 'default',
102
102
  confirm: 'confirm',
103
103
  info: 'info (deprecated)',
@@ -251,4 +251,4 @@ const loadingIconSizes = {
251
251
  'xl (64x64)': 'xl'
252
252
  };
253
253
 
254
- export { COMMA, alertVariantIconMap, alertVariantOptions, alignOptions, avatarShapeOptions, avatarSizeOptions, avatarsInlineSizeOptions, badgeForButtonOptions, badgeSizeOptions, badgeVariantOptions, bannerVariants, buttonCategoryOptions, buttonSizeOptions, buttonSizeOptionsMap, buttonVariantOptions, colorThemes, columnOptions, defaultDateFormat, drawerVariants, focusableTags, formInputSizes, formStateOptions, glThemes, iconSizeOptions, keyboard, labelColorOptions, labelSizeOptions, loadingIconSizes, maxZIndex, modalButtonDefaults, modalSizeOptions, newDropdownVariantOptions, popoverPlacements, resizeDebounceTime, sizeOptions, sizeOptionsWithNoDefault, tabsButtonDefaults, targetOptions, toggleLabelPosition, tokenVariants, tooltipActionEvents, tooltipDelay, tooltipPlacements, triggerVariantOptions, truncateOptions, variantCssColorMap, variantOptions, variantOptionsWithNoDefault, viewModeOptions };
254
+ export { COMMA, alertVariantIconMap, alertVariantOptions, alignOptions, avatarShapeOptions, avatarSizeOptions, avatarsInlineSizeOptions, badgeForButtonOptions, badgeSizeOptions, badgeVariantOptions, bannerVariants, buttonCategoryOptions, buttonSizeOptions, buttonSizeOptionsMap, buttonVariantOptions, colorThemes, columnOptions, defaultDateFormat, drawerVariants, dropdownVariantOptions, focusableTags, formInputSizes, formStateOptions, glThemes, iconSizeOptions, keyboard, labelColorOptions, labelSizeOptions, loadingIconSizes, maxZIndex, modalButtonDefaults, modalSizeOptions, popoverPlacements, resizeDebounceTime, sizeOptions, sizeOptionsWithNoDefault, tabsButtonDefaults, targetOptions, toggleLabelPosition, tokenVariants, tooltipActionEvents, tooltipDelay, tooltipPlacements, triggerVariantOptions, truncateOptions, variantCssColorMap, variantOptions, variantOptionsWithNoDefault, viewModeOptions };
@@ -88,15 +88,25 @@ function focusFirstFocusableElement(elts) {
88
88
  const focusableElt = elts.find(el => isElementFocusable(el));
89
89
  if (focusableElt) focusableElt.focus();
90
90
  }
91
+ /**
92
+ * Returns true if the current environment is considered a development environment (it's not
93
+ * production or test).
94
+ *
95
+ * @returns {boolean}
96
+ */
97
+
98
+ function isDev() {
99
+ return !['test', 'production'].includes(process.env.NODE_ENV);
100
+ }
91
101
  /**
92
102
  * Prints a warning message to the console in non-test and non-production environments.
93
103
  * @param {string} message message to print to the console
94
104
  */
95
105
 
96
106
  function logWarning(message = '') {
97
- if (message.length && !['test', 'production'].includes(process.env.NODE_ENV)) {
107
+ if (message.length && isDev()) {
98
108
  console.warn(message); // eslint-disable-line no-console
99
109
  }
100
110
  }
101
111
 
102
- export { colorFromBackground, debounceByAnimationFrame, focusFirstFocusableElement, hexToRgba, isElementFocusable, logWarning, rgbFromHex, rgbFromString, throttle, uid };
112
+ export { colorFromBackground, debounceByAnimationFrame, focusFirstFocusableElement, hexToRgba, isDev, isElementFocusable, logWarning, rgbFromHex, rgbFromString, throttle, uid };
@@ -90,6 +90,8 @@ export const setupStorybookReadme = () =>
90
90
  'GlAccordionItem',
91
91
  'GlDaterangePicker',
92
92
  'GlBarChart',
93
+ 'GlCarousel',
94
+ 'GlMarkdown',
93
95
  ],
94
96
  components: {
95
97
  GlComponentDocumentation,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "32.36.0",
3
+ "version": "32.40.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -84,7 +84,7 @@
84
84
  "@babel/preset-env": "^7.10.2",
85
85
  "@gitlab/eslint-plugin": "9.4.0",
86
86
  "@gitlab/stylelint-config": "2.6.0",
87
- "@gitlab/svgs": "1.220.0",
87
+ "@gitlab/svgs": "1.221.0",
88
88
  "@rollup/plugin-commonjs": "^11.1.0",
89
89
  "@rollup/plugin-node-resolve": "^7.1.3",
90
90
  "@rollup/plugin-replace": "^2.3.2",
@@ -129,7 +129,7 @@
129
129
  "postcss-scss": "^2.1.1",
130
130
  "prettier": "2.2.1",
131
131
  "pug": "^2.0.3",
132
- "puppeteer": "^5.2.1",
132
+ "puppeteer": "^10.4.0",
133
133
  "raw-loader": "^0.5.1",
134
134
  "rollup": "^2.53.1",
135
135
  "rollup-plugin-babel": "^4.4.0",
@@ -226,6 +226,8 @@ export const tGrayA04 = 'rgba(0, 0, 0, 0.04)'
226
226
  export const tGrayA06 = 'rgba(0, 0, 0, 0.06)'
227
227
  export const tGrayA08 = 'rgba(0, 0, 0, 0.08)'
228
228
  export const tGrayA24 = 'rgba(0, 0, 0, 0.24)'
229
+ export const glTextColor = '#303030'
230
+ export const glTextColorSecondary = '#666'
229
231
  export const glFontWeightLight = '300'
230
232
  export const glFontWeightNormal = '400'
231
233
  export const glFontWeightBold = '600'
@@ -1167,6 +1167,16 @@
1167
1167
  "value": "rgba(#000, 0.24)",
1168
1168
  "compiledValue": "rgba(0, 0, 0, 0.24)"
1169
1169
  },
1170
+ {
1171
+ "name": "$gl-text-color",
1172
+ "value": "$gray-900",
1173
+ "compiledValue": "#303030"
1174
+ },
1175
+ {
1176
+ "name": "$gl-text-color-secondary",
1177
+ "value": "$gray-500",
1178
+ "compiledValue": "#666"
1179
+ },
1170
1180
  {
1171
1181
  "name": "$gl-font-weight-light",
1172
1182
  "value": "300",
@@ -1624,7 +1634,7 @@
1624
1634
  },
1625
1635
  {
1626
1636
  "name": "$body-color",
1627
- "value": "$gray-900",
1637
+ "value": "$gl-text-color",
1628
1638
  "compiledValue": "#303030"
1629
1639
  },
1630
1640
  {
@@ -1,8 +1,6 @@
1
1
  import description from './carousel.md';
2
- import examples from './examples';
3
2
 
4
3
  export default {
5
4
  description,
6
- examples,
7
5
  bootstrapComponent: 'b-carousel',
8
6
  };
@@ -1,5 +1,3 @@
1
- ## Carousel
2
-
3
1
  The carousel is a slideshow for cycling through a series of content, built with CSS 3D
4
2
  transforms. It works with a series of images, text, or custom markup. It also includes support
5
3
  for previous/next controls and indicators.
@@ -1,16 +1,8 @@
1
- import { documentedStoriesOf } from '../../../../documentation/documented_stories';
2
1
  import readme from './carousel.md';
3
2
  import GlCarousel from './carousel.vue';
4
3
  import GlCarouselSlide from './carousel_slide.vue';
5
4
 
6
- const components = {
7
- GlCarousel,
8
- GlCarouselSlide,
9
- };
10
-
11
- documentedStoriesOf('base/carousel', readme).add('default carousel', () => ({
12
- components,
13
- template: `
5
+ const template = `
14
6
  <gl-carousel
15
7
  :interval="0"
16
8
  controls
@@ -34,5 +26,26 @@ documentedStoriesOf('base/carousel', readme).add('default carousel', () => ({
34
26
 
35
27
  <!-- Slides with image only -->
36
28
  <gl-carousel-slide img-src="./img/carousel_slide3.jpg"/>
37
- </gl-carousel>`,
38
- }));
29
+ </gl-carousel>
30
+ `;
31
+
32
+ const Template = () => ({
33
+ components: { GlCarousel, GlCarouselSlide },
34
+ template,
35
+ });
36
+
37
+ export const Default = Template.bind({});
38
+
39
+ export default {
40
+ title: 'base/carousel',
41
+ component: GlCarousel,
42
+ parameters: {
43
+ bootstrapComponent: 'b-carousel',
44
+ knobs: { disable: true },
45
+ docs: {
46
+ description: {
47
+ component: readme,
48
+ },
49
+ },
50
+ },
51
+ };
@@ -1,6 +1,6 @@
1
1
  import { mount } from '@vue/test-utils';
2
2
 
3
- import { newDropdownVariantOptions } from '../../../utils/constants';
3
+ import { dropdownVariantOptions } from '../../../utils/constants';
4
4
  import GlLoadingIcon from '../loading_icon/loading_icon.vue';
5
5
  import GlDropdown from './dropdown.vue';
6
6
 
@@ -175,14 +175,11 @@ describe('new dropdown', () => {
175
175
  });
176
176
 
177
177
  describe('secondary category', () => {
178
- it.each(Object.keys(newDropdownVariantOptions))(
179
- 'applies %s variant class properly',
180
- (variant) => {
181
- buildWrapper({ category: 'secondary', variant });
182
-
183
- expect(findDropdownToggle().classes()).toContain(`btn-${variant}-secondary`);
184
- }
185
- );
178
+ it.each(Object.keys(dropdownVariantOptions))('applies %s variant class properly', (variant) => {
179
+ buildWrapper({ category: 'secondary', variant });
180
+
181
+ expect(findDropdownToggle().classes()).toContain(`btn-${variant}-secondary`);
182
+ });
186
183
  });
187
184
 
188
185
  describe('when the header slot exists', () => {
@@ -12,8 +12,8 @@ import {
12
12
  } from '../../../../index';
13
13
  import {
14
14
  buttonCategoryOptions,
15
- newDropdownVariantOptions,
16
15
  buttonSizeOptions,
16
+ dropdownVariantOptions,
17
17
  } from '../../../utils/constants';
18
18
  import readme from './dropdown.md';
19
19
 
@@ -57,7 +57,7 @@ function generateProps({
57
57
  },
58
58
  variant: {
59
59
  type: String,
60
- default: select('variant', Object.values(newDropdownVariantOptions), variant),
60
+ default: select('variant', Object.values(dropdownVariantOptions), variant),
61
61
  },
62
62
  size: {
63
63
  type: String,
@@ -197,7 +197,7 @@ documentedStoriesOf('base/dropdown', readme)
197
197
  props: generateProps({
198
198
  text: 'Some dropdown',
199
199
  category: buttonCategoryOptions.secondary,
200
- variant: newDropdownVariantOptions.confirm,
200
+ variant: dropdownVariantOptions.confirm,
201
201
  }),
202
202
  components,
203
203
  template: wrap`
@@ -3,8 +3,8 @@ import { BDropdown } from 'bootstrap-vue';
3
3
  import { isVisible, selectAll } from 'bootstrap-vue/src/utils/dom';
4
4
  import {
5
5
  buttonCategoryOptions,
6
- newDropdownVariantOptions,
7
6
  buttonSizeOptions,
7
+ dropdownVariantOptions,
8
8
  } from '../../../utils/constants';
9
9
  import { ButtonMixin } from '../../mixins/button_mixin';
10
10
  import GlButton from '../button/button.vue';
@@ -106,8 +106,8 @@ export default {
106
106
  variant: {
107
107
  type: String,
108
108
  required: false,
109
- default: newDropdownVariantOptions.default,
110
- validator: (value) => Object.keys(newDropdownVariantOptions).includes(value),
109
+ default: dropdownVariantOptions.default,
110
+ validator: (value) => Object.keys(dropdownVariantOptions).includes(value),
111
111
  },
112
112
  size: {
113
113
  type: String,
@@ -253,6 +253,7 @@ export default {
253
253
  :value="tokens"
254
254
  :history-items="historyItems"
255
255
  :clearable="hasValue"
256
+ data-testid="filtered-search-input"
256
257
  @submit="submit"
257
258
  @input="applyNewValue"
258
259
  @history-item-selected="$emit('history-item-selected', $event)"
@@ -27,7 +27,7 @@ describe('Filtered search token segment', () => {
27
27
  methods: {
28
28
  nextItem: jest.fn(),
29
29
  prevItem: jest.fn(),
30
- getValue: jest.fn(),
30
+ getValue: () => 'notnull',
31
31
  },
32
32
  template: `<div class="ololosha"><slot></slot></div>`,
33
33
  };
@@ -195,6 +195,22 @@ describe('Filtered search token segment', () => {
195
195
  expect(wrapper.emitted().select[0][0]).toBe(formattedToken);
196
196
  expect(wrapper.emitted().complete[0][0]).toBe(formattedToken);
197
197
  });
198
+
199
+ it('selects suggestion on press Enter', () => {
200
+ createComponent({ active: true, options: OPTIONS, value: false });
201
+ wrapper.find('input').trigger('keydown', { key: 'ArrowDown' });
202
+
203
+ wrapper.find('input').trigger('keydown', { key: 'Enter' });
204
+ expect(wrapper.emitted('select')).toHaveLength(1);
205
+ });
206
+
207
+ it('selects suggestion on press Colon', () => {
208
+ createComponent({ active: true, options: OPTIONS, value: false });
209
+ wrapper.find('input').trigger('keydown', { key: 'ArrowDown' });
210
+
211
+ wrapper.find('input').trigger('keydown', { key: ':' });
212
+ expect(wrapper.emitted('select')).toHaveLength(1);
213
+ });
198
214
  });
199
215
 
200
216
  describe('when multi select', () => {
@@ -189,13 +189,21 @@ export default {
189
189
 
190
190
  const handlers = {
191
191
  Enter: () => {
192
+ e.preventDefault();
192
193
  if (suggestedValue != null) {
193
194
  this.applySuggestion(suggestedValue);
194
195
  } else {
195
196
  this.$emit('submit');
196
197
  }
197
198
  },
199
+ ':': () => {
200
+ if (suggestedValue != null) {
201
+ e.preventDefault();
202
+ this.applySuggestion(suggestedValue);
203
+ }
204
+ },
198
205
  Escape: () => {
206
+ e.preventDefault();
199
207
  this.$emit('complete');
200
208
  },
201
209
  };
@@ -212,7 +220,6 @@ export default {
212
220
  }
213
221
 
214
222
  if (Object.keys(handlers).includes(key)) {
215
- e.preventDefault();
216
223
  handlers[key]();
217
224
  return;
218
225
  }
@@ -239,6 +246,7 @@ export default {
239
246
  <div
240
247
  class="gl-filtered-search-token-segment"
241
248
  :class="{ 'gl-filtered-search-token-segment-active': active }"
249
+ data-testid="filtered-search-token-segment"
242
250
  @mousedown.left="emitIfInactive"
243
251
  >
244
252
  <template v-if="active">
@@ -1,5 +1,5 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
- import { BInputGroup } from 'bootstrap-vue';
2
+ import { BInputGroup, BFormInput } from 'bootstrap-vue';
3
3
  import GlDropdownItem from '../../dropdown/dropdown_item.vue';
4
4
  import InputGroup from './form_input_group.vue';
5
5
 
@@ -54,6 +54,23 @@ describe('Input Group', () => {
54
54
  expect(wrapper.emitted('input')).toBeUndefined();
55
55
  });
56
56
 
57
+ describe('`inputClass` prop', () => {
58
+ it.each`
59
+ inputClass
60
+ ${'foo-bar baz'}
61
+ ${['foo-bar', 'baz']}
62
+ ${{ 'foo-bar': true, baz: true }}
63
+ `('correctly adds classes to input when `inputClass` prop is $inputClass', ({ inputClass }) => {
64
+ createWrapper({
65
+ propsData: { inputClass },
66
+ });
67
+
68
+ expect(wrapper.findComponent(BFormInput).classes()).toEqual(
69
+ expect.arrayContaining(['gl-form-input', 'foo-bar', 'baz'])
70
+ );
71
+ });
72
+ });
73
+
57
74
  describe('predefined options', () => {
58
75
  const options = [
59
76
  { name: 'Foo', value: 'foo.com' },
@@ -32,6 +32,11 @@ export default {
32
32
  required: false,
33
33
  default: undefined,
34
34
  },
35
+ inputClass: {
36
+ type: [String, Array, Object],
37
+ required: false,
38
+ default: '',
39
+ },
35
40
  },
36
41
  data() {
37
42
  return {
@@ -73,7 +78,7 @@ export default {
73
78
  <b-form-input
74
79
  ref="input"
75
80
  v-model="localValue"
76
- class="gl-form-input"
81
+ :class="['gl-form-input', inputClass]"
77
82
  :aria-label="label"
78
83
  v-bind="$attrs"
79
84
  v-on="$listeners"
@@ -1,8 +1,5 @@
1
- import examples from './examples';
2
1
  import * as description from './markdown.md';
3
2
 
4
3
  export default {
5
4
  description,
6
- examples,
7
- propsInfo: {},
8
5
  };
@@ -1,5 +1,3 @@
1
- # GlMarkdown
2
-
3
1
  The `GlMarkdown` component styles markdown-generated HTML following the Pajamas Documentation Markdown
4
2
  [styling specifications](https://www.figma.com/file/qEddyqCrI7kPSBjGmwkZzQ/Pajamas-UI-Kit---Beta?node-id=542%3A2).
5
3
 
@@ -1,30 +1,31 @@
1
- import { withKnobs, boolean } from '@storybook/addon-knobs';
2
- import { documentedStoriesOf } from '../../../../documentation/documented_stories';
3
1
  import readme from './markdown.md';
4
2
  import GlMarkdown from './markdown.vue';
5
3
  import markdownTypescaleDemoContent from './markdown_typescale_demo.html';
6
4
 
7
- const components = {
8
- GlMarkdown,
9
- };
5
+ const template = `
6
+ <gl-markdown :compact="compact">${markdownTypescaleDemoContent}</gl-markdown>
7
+ `;
8
+
9
+ const generateProps = ({ compact = false } = {}) => ({ compact });
10
+
11
+ const Template = (args, { argTypes }) => ({
12
+ components: { GlMarkdown },
13
+ props: Object.keys(argTypes),
14
+ template,
15
+ });
10
16
 
11
- documentedStoriesOf('base/markdown', readme)
12
- .addDecorator(withKnobs)
13
- .add(
14
- 'typescale',
15
- () => ({
16
- components,
17
- props: {
18
- compact: {
19
- type: Boolean,
20
- default: boolean('compact', false),
21
- },
17
+ export const Typescale = Template.bind({});
18
+ Typescale.args = generateProps();
19
+
20
+ export default {
21
+ title: 'base/markdown',
22
+ component: GlMarkdown,
23
+ parameters: {
24
+ docs: {
25
+ description: {
26
+ component: readme,
22
27
  },
23
- template: `
24
- <gl-markdown :compact="compact">${markdownTypescaleDemoContent}</gl-markdown>
25
- `,
26
- }),
27
- {
28
- viewport: { defaultViewport: 'breakpointExtraLarge' },
29
- }
30
- );
28
+ },
29
+ knobs: { disabled: true },
30
+ },
31
+ };
@@ -42,4 +42,13 @@ describe('GlPopover', () => {
42
42
  expect(findBVPopover().props('triggers')).toBe(triggers);
43
43
  });
44
44
  });
45
+
46
+ describe('title slot', () => {
47
+ it('renders title slot content', () => {
48
+ const title = 'Popover title';
49
+ createWrapper({ title });
50
+
51
+ expect(findBVPopover().props('title')).toBe(title);
52
+ });
53
+ });
45
54
  });
@@ -2,6 +2,12 @@ import { withKnobs, select, text } from '@storybook/addon-knobs';
2
2
  import { documentedStoriesOf } from '../../../../documentation/documented_stories';
3
3
  import { popoverPlacements } from '../../../utils/constants';
4
4
 
5
+ const contentString = `
6
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent volutpat a nisi non
7
+ pellentesque. Pellentesque efficitur vulputate rutrum. Fusce nisl magna, porttitor in
8
+ massa ac, porta condimentum libero. Ut id lacus tristique, egestas arcu non, molestie nisi.
9
+ `;
10
+
5
11
  const template = `
6
12
  <div class="gl-display-flex gl-justify-content-center gl-p-6">
7
13
  <gl-button id="pop-top">{{placement}}</gl-button>
@@ -9,13 +15,29 @@ const template = `
9
15
  triggers="hover focus"
10
16
  :title="title"
11
17
  :placement="placement"
12
- :content="content"
18
+ content="${contentString}"
19
+ data-testid="popover-with-props"
13
20
  show
14
21
  />
15
22
  </div>
16
23
  `;
17
24
 
18
- function generateProps({ placement = popoverPlacements.top, title = 'Popover' } = {}) {
25
+ const scopedSlotTemplate = `
26
+ <div class="gl-display-flex gl-justify-content-center gl-p-6">
27
+ <gl-button id="pop-top-two" data-testid="popover-button-click">{{placement}}</gl-button>
28
+ <gl-popover target="pop-top-two"
29
+ triggers="click"
30
+ :placement="placement"
31
+ content="${contentString}"
32
+ >
33
+ <template #title>
34
+ <span data-testid="popover-title">Popover title</span>
35
+ </template>
36
+ </gl-popover>
37
+ </div>
38
+ `;
39
+
40
+ function generateProps({ placement = popoverPlacements.top, title = 'Popover', triggers } = {}) {
19
41
  return {
20
42
  placement: {
21
43
  type: String,
@@ -25,6 +47,10 @@ function generateProps({ placement = popoverPlacements.top, title = 'Popover' }
25
47
  type: String,
26
48
  default: text('title', title),
27
49
  },
50
+ triggers: {
51
+ type: String,
52
+ default: text('hover focus', triggers),
53
+ },
28
54
  };
29
55
  }
30
56
 
@@ -33,13 +59,12 @@ documentedStoriesOf('base/popover', '')
33
59
  .add('default', () => ({
34
60
  template,
35
61
  props: generateProps(),
36
- computed: {
37
- content() {
38
- return `
39
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent volutpat a nisi non
40
- pellentesque. Pellentesque efficitur vulputate rutrum. Fusce nisl magna, porttitor in
41
- massa ac, porta condimentum libero. Ut id lacus tristique, egestas arcu non, molestie nisi.
42
- `;
43
- },
44
- },
45
- }));
62
+ }))
63
+ .add(
64
+ 'on click',
65
+ () => ({
66
+ template: scopedSlotTemplate,
67
+ props: generateProps(),
68
+ }),
69
+ { storyshots: false }
70
+ );
@@ -39,8 +39,7 @@ export default {
39
39
  v-bind="$attrs"
40
40
  v-on="$listeners"
41
41
  >
42
- <!-- eslint-disable-next-line vue/no-deprecated-slot-attribute -->
43
- <template slot="title">
42
+ <template v-if="$scopedSlots.title" #title>
44
43
  <slot name="title"></slot>
45
44
  </template>
46
45
  <slot></slot>
@@ -210,6 +210,7 @@ export default {
210
210
  :title="clearButtonTitle"
211
211
  :tooltip-container="tooltipContainer"
212
212
  class="gl-search-box-by-click-icon-button gl-search-box-by-click-clear-button gl-clear-icon-button"
213
+ data-testid="filtered-search-clear-button"
213
214
  @click="clearInput"
214
215
  />
215
216
  <template #append class="gl-search-box-by-click-input-group-control">
@@ -0,0 +1,49 @@
1
+ export const tableFullSlots = [
2
+ 'bottom-row',
3
+ 'empty',
4
+ 'emptyfiltered',
5
+ 'table-busy',
6
+ 'thead-top',
7
+ 'top-row',
8
+ ];
9
+
10
+ export const tableFullProps = [
11
+ 'api-url',
12
+ 'busy',
13
+ 'current-page',
14
+ 'empty-filtered-html',
15
+ 'empty-filtered-text',
16
+ 'empty-html',
17
+ 'empty-text',
18
+ 'filter',
19
+ 'filter-debounce',
20
+ 'filter-function',
21
+ 'filter-ignored-fields',
22
+ 'filter-included-fields',
23
+ 'label-sort-asc',
24
+ 'label-sort-clear',
25
+ 'label-sort-desc',
26
+ 'no-footer-sorting',
27
+ 'no-local-sorting',
28
+ 'no-provider-filtering',
29
+ 'no-provider-paging',
30
+ 'no-provider-sorting',
31
+ 'no-select-on-click',
32
+ 'no-sort-reset',
33
+ 'per-page',
34
+ 'select-mode',
35
+ 'selectable',
36
+ 'selected-variant',
37
+ 'show-empty',
38
+ 'sort-by',
39
+ 'sort-compare',
40
+ 'sort-compare-locale',
41
+ 'sort-compare-options',
42
+ 'sort-desc',
43
+ 'sort-direction',
44
+ 'sort-icon-left',
45
+ 'sort-null-last',
46
+ ];
47
+
48
+ export const glTableLiteWarning =
49
+ 'This GlTable could be a GlTableLite component, please consider using GlTableLite instead of GlTable to reduce the page bundlesize more about this here: https://gitlab-org.gitlab.io/gitlab-ui/?path=/docs/base-table-table-lite--default';