@gitlab/ui 32.34.1 → 32.38.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 (30) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/components/base/dropdown/dropdown.js +3 -3
  3. package/dist/components/base/filtered_search/filtered_search_token_segment.js +5 -0
  4. package/dist/components/base/popover/popover.js +1 -1
  5. package/dist/components/base/table/constants.js +5 -0
  6. package/dist/components/base/table/table.js +19 -1
  7. package/dist/utility_classes.css +1 -1
  8. package/dist/utility_classes.css.map +1 -1
  9. package/dist/utils/constants.js +2 -2
  10. package/dist/utils/utils.js +12 -2
  11. package/package.json +2 -2
  12. package/scss_to_js/scss_variables.js +2 -0
  13. package/scss_to_js/scss_variables.json +11 -1
  14. package/src/components/base/dropdown/dropdown.spec.js +6 -9
  15. package/src/components/base/dropdown/dropdown.stories.js +3 -3
  16. package/src/components/base/dropdown/dropdown.vue +3 -3
  17. package/src/components/base/filtered_search/filtered_search_token_segment.spec.js +17 -1
  18. package/src/components/base/filtered_search/filtered_search_token_segment.vue +5 -0
  19. package/src/components/base/popover/popover.spec.js +9 -0
  20. package/src/components/base/popover/popover.stories.js +37 -12
  21. package/src/components/base/popover/popover.vue +1 -2
  22. package/src/components/base/table/constants.js +49 -0
  23. package/src/components/base/table/table.spec.js +49 -0
  24. package/src/components/base/table/table.vue +16 -0
  25. package/src/scss/utilities.scss +32 -0
  26. package/src/scss/utility-mixins/color.scss +4 -0
  27. package/src/scss/utility-mixins/sizing.scss +12 -0
  28. package/src/scss/variables.scss +4 -1
  29. package/src/utils/constants.js +1 -1
  30. package/src/utils/utils.js +11 -1
@@ -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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "32.34.1",
3
+ "version": "32.38.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -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,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,
@@ -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', () => {
@@ -195,6 +195,11 @@ export default {
195
195
  this.$emit('submit');
196
196
  }
197
197
  },
198
+ ':': () => {
199
+ if (suggestedValue != null) {
200
+ this.applySuggestion(suggestedValue);
201
+ }
202
+ },
198
203
  Escape: () => {
199
204
  this.$emit('complete');
200
205
  },
@@ -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>
@@ -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';
@@ -0,0 +1,49 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import { logWarning } from '../../../utils/utils';
3
+ import { waitForAnimationFrame } from '../../../utils/test_utils';
4
+ import { glTableLiteWarning } from './constants';
5
+ import Table from './table.vue';
6
+
7
+ jest.mock('../../../utils/utils', () => ({
8
+ isDev: () => true,
9
+ logWarning: jest.fn(),
10
+ }));
11
+
12
+ describe('GlTable', () => {
13
+ const slotsTemplate = {
14
+ empty: `
15
+ <p>Placeholder empty text</p>`,
16
+ };
17
+
18
+ const factory = ({ props = {}, scopedSlots = {} } = {}) => {
19
+ shallowMount(Table, {
20
+ scopedSlots,
21
+ propsData: props,
22
+ });
23
+ };
24
+
25
+ afterEach(() => {
26
+ logWarning.mockClear();
27
+ });
28
+
29
+ it('should log a warning when not given any props or slots which qualifies for the usage of GlTable', async () => {
30
+ factory();
31
+ await waitForAnimationFrame();
32
+
33
+ expect(logWarning).toHaveBeenCalledWith(glTableLiteWarning);
34
+ });
35
+
36
+ it('should not log a warning when given a prop which qualifies for the usage of GlTable', async () => {
37
+ factory({ props: { busy: true } });
38
+ await waitForAnimationFrame();
39
+
40
+ expect(logWarning).not.toHaveBeenCalled();
41
+ });
42
+
43
+ it('should not log a warning when given a slot which qualifies for the usage of GlTable', async () => {
44
+ factory({ scopedSlots: slotsTemplate });
45
+ await waitForAnimationFrame();
46
+
47
+ expect(logWarning).not.toHaveBeenCalled();
48
+ });
49
+ });
@@ -1,11 +1,27 @@
1
1
  <script>
2
2
  import { BTable } from 'bootstrap-vue';
3
+ import { logWarning, isDev } from '../../../utils/utils';
4
+ import { tableFullSlots, tableFullProps, glTableLiteWarning } from './constants';
5
+
6
+ const shouldUseFullTable = ({ $attrs, $scopedSlots }) => {
7
+ return (
8
+ tableFullProps.some((prop) => $attrs[prop] !== undefined) ||
9
+ tableFullSlots.some((slot) => $scopedSlots[slot] !== undefined)
10
+ );
11
+ };
3
12
 
4
13
  export default {
5
14
  components: {
6
15
  BTable,
7
16
  },
8
17
  inheritAttrs: false,
18
+ mounted() {
19
+ // logWarning will call isDev before logging any message
20
+ // this additional call to isDev is being made to exit the condition early when run in production
21
+ if (isDev() && !shouldUseFullTable(this)) {
22
+ logWarning(glTableLiteWarning);
23
+ }
24
+ },
9
25
  };
10
26
  </script>
11
27
 
@@ -1997,6 +1997,14 @@
1997
1997
  color: $body-color !important;
1998
1998
  }
1999
1999
 
2000
+ .gl-text-secondary {
2001
+ color: $gl-text-color-secondary;
2002
+ }
2003
+
2004
+ .gl-text-secondary\! {
2005
+ color: $gl-text-color-secondary !important;
2006
+ }
2007
+
2000
2008
  .gl-sm-text-body {
2001
2009
  @include gl-media-breakpoint-up(sm) {
2002
2010
  color: $body-color;
@@ -4201,6 +4209,18 @@
4201
4209
  }
4202
4210
  }
4203
4211
 
4212
+ .gl-lg-w-1px {
4213
+ @media (min-width: $breakpoint-lg) {
4214
+ width: 1px;
4215
+ }
4216
+ }
4217
+
4218
+ .gl-lg-w-1px\! {
4219
+ @media (min-width: $breakpoint-lg) {
4220
+ width: 1px !important;
4221
+ }
4222
+ }
4223
+
4204
4224
  .gl-md-w-50p {
4205
4225
  @include gl-media-breakpoint-up(md) {
4206
4226
  width: 50%;
@@ -4352,6 +4372,18 @@
4352
4372
  max-width: 30% !important;
4353
4373
  }
4354
4374
  }
4375
+
4376
+ .gl-md-max-w-50p {
4377
+ @include gl-media-breakpoint-up(md) {
4378
+ max-width: 50%;
4379
+ }
4380
+ }
4381
+
4382
+ .gl-md-max-w-50p\! {
4383
+ @include gl-media-breakpoint-up(md) {
4384
+ max-width: 50% !important;
4385
+ }
4386
+ }
4355
4387
  .gl-p-0 {
4356
4388
  padding: 0;
4357
4389
  }
@@ -19,6 +19,10 @@
19
19
  color: $body-color;
20
20
  }
21
21
 
22
+ @mixin gl-text-secondary {
23
+ color: $gl-text-color-secondary;
24
+ }
25
+
22
26
  @mixin gl-sm-text-body {
23
27
  @include gl-media-breakpoint-up(sm) {
24
28
  @include gl-text-body;
@@ -212,6 +212,12 @@
212
212
  }
213
213
  }
214
214
 
215
+ @mixin gl-lg-w-1px {
216
+ @media (min-width: $breakpoint-lg) {
217
+ width: 1px;
218
+ }
219
+ }
220
+
215
221
  @mixin gl-md-w-50p {
216
222
  @include gl-media-breakpoint-up(md) {
217
223
  width: 50%;
@@ -302,3 +308,9 @@
302
308
  max-width: 30%;
303
309
  }
304
310
  }
311
+
312
+ @mixin gl-md-max-w-50p {
313
+ @include gl-media-breakpoint-up(md) {
314
+ max-width: 50%;
315
+ }
316
+ }
@@ -295,6 +295,9 @@ $t-gray-a-08: rgba(#000, 0.08);
295
295
  $t-gray-a-24: rgba(#000, 0.24);
296
296
 
297
297
  // Text
298
+ $gl-text-color: $gray-900 !default;
299
+ $gl-text-color-secondary: $gray-500 !default;
300
+
298
301
  $gl-font-weight-light: 300;
299
302
  $gl-font-weight-normal: 400;
300
303
  $gl-font-weight-bold: 600;
@@ -453,7 +456,7 @@ $modal-backdrop-opacity: 0.64;
453
456
  // Bootstrap overrides
454
457
  // these should ideally be moved further up in the file to the compoent-relevant sections
455
458
  // but they can wait here for now
456
- $body-color: $gray-900 !default;
459
+ $body-color: $gl-text-color !default;
457
460
 
458
461
  $secondary: $gray-50;
459
462
  $success: $green-500;
@@ -115,7 +115,7 @@ export const badgeForButtonOptions = {
115
115
  [buttonVariantOptions.danger]: badgeVariantOptions.danger,
116
116
  };
117
117
 
118
- export const newDropdownVariantOptions = {
118
+ export const dropdownVariantOptions = {
119
119
  default: 'default',
120
120
  confirm: 'confirm',
121
121
  info: 'info (deprecated)',
@@ -103,12 +103,22 @@ export function focusFirstFocusableElement(elts) {
103
103
  if (focusableElt) focusableElt.focus();
104
104
  }
105
105
 
106
+ /**
107
+ * Returns true if the current environment is considered a development environment (it's not
108
+ * production or test).
109
+ *
110
+ * @returns {boolean}
111
+ */
112
+ export function isDev() {
113
+ return !['test', 'production'].includes(process.env.NODE_ENV);
114
+ }
115
+
106
116
  /**
107
117
  * Prints a warning message to the console in non-test and non-production environments.
108
118
  * @param {string} message message to print to the console
109
119
  */
110
120
  export function logWarning(message = '') {
111
- if (message.length && !['test', 'production'].includes(process.env.NODE_ENV)) {
121
+ if (message.length && isDev()) {
112
122
  console.warn(message); // eslint-disable-line no-console
113
123
  }
114
124
  }