@gitlab/ui 40.6.2 → 40.6.5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "40.6.2",
3
+ "version": "40.6.5",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -81,21 +81,21 @@
81
81
  "@arkweid/lefthook": "0.7.7",
82
82
  "@babel/core": "^7.10.2",
83
83
  "@babel/preset-env": "^7.10.2",
84
- "@gitlab/eslint-plugin": "12.2.0",
84
+ "@gitlab/eslint-plugin": "12.3.0",
85
85
  "@gitlab/stylelint-config": "4.0.0",
86
86
  "@gitlab/svgs": "2.14.0",
87
87
  "@rollup/plugin-commonjs": "^11.1.0",
88
88
  "@rollup/plugin-node-resolve": "^7.1.3",
89
89
  "@rollup/plugin-replace": "^2.3.2",
90
- "@storybook/addon-a11y": "6.5.2",
91
- "@storybook/addon-docs": "6.5.2",
92
- "@storybook/addon-essentials": "6.5.2",
90
+ "@storybook/addon-a11y": "6.5.5",
91
+ "@storybook/addon-docs": "6.5.5",
92
+ "@storybook/addon-essentials": "6.5.5",
93
93
  "@storybook/addon-knobs": "6.4.0",
94
- "@storybook/addon-storyshots": "6.5.2",
95
- "@storybook/addon-storyshots-puppeteer": "6.5.2",
96
- "@storybook/addon-viewport": "6.5.2",
97
- "@storybook/theming": "6.5.2",
98
- "@storybook/vue": "6.5.2",
94
+ "@storybook/addon-storyshots": "6.5.5",
95
+ "@storybook/addon-storyshots-puppeteer": "6.5.5",
96
+ "@storybook/addon-viewport": "6.5.5",
97
+ "@storybook/theming": "6.5.5",
98
+ "@storybook/vue": "6.5.5",
99
99
  "@vue/test-utils": "1.3.0",
100
100
  "autoprefixer": "^9.7.6",
101
101
  "babel-jest": "^26.6.3",
@@ -140,6 +140,7 @@
140
140
  "sass-loader": "^10.2.0",
141
141
  "sass-true": "^5.0.0",
142
142
  "start-server-and-test": "^1.10.6",
143
+ "storybook-dark-mode": "^1.0.8",
143
144
  "stylelint": "14.3.0",
144
145
  "stylelint-config-prettier": "9.0.3",
145
146
  "stylelint-prettier": "2.0.0",
@@ -31,7 +31,8 @@ While this component is based on
31
31
 
32
32
  - Has a different set of valid `variant`s. See the examples or props
33
33
  documentation for those values.
34
- - Always sets the `pill` prop of the underlying `BBadge` to `true`. Any passed
34
+ - Always sets the `pill` prop of the underlying
35
+ [`BBadge`](https://bootstrap-vue.org/docs/components/badge) to `true`. Any passed
35
36
  in `pill` prop value is ignored.
36
37
  - Does _not_ scale itself to match the size of its immediate parent, like
37
- `BBadge` does.
38
+ [`BBadge`](https://bootstrap-vue.org/docs/components/badge) does.
@@ -1,6 +1,7 @@
1
1
  import { GlDatepicker } from '../../../index';
2
2
  import { disableControls } from '../../../utils/stories_utils';
3
3
  import { useFakeDate } from '../../../utils/use_fake_date';
4
+ import { makeContainer } from '../../../utils/story_decorators/container';
4
5
  import readme from './datepicker.md';
5
6
 
6
7
  const defaults = {
@@ -18,8 +19,6 @@ const generateProps = ({ minDate = defaultMinDate, maxDate = defaultMaxDate } =
18
19
  maxDate,
19
20
  });
20
21
 
21
- const wrap = (template) => `<div style="height: 280px">${template}</div>`;
22
-
23
22
  export const Default = (_args, { argTypes }) => ({
24
23
  ...defaults,
25
24
  props: Object.keys(argTypes),
@@ -28,9 +27,7 @@ export const Default = (_args, { argTypes }) => ({
28
27
  pickerValue: defaultDate,
29
28
  };
30
29
  },
31
- template: wrap(`
32
- <gl-datepicker :max-date="maxDate" :min-date="minDate" :start-opened="true" v-model="pickerValue" />
33
- `),
30
+ template: `<gl-datepicker :max-date="maxDate" :min-date="minDate" :start-opened="true" v-model="pickerValue" />`,
34
31
  });
35
32
  Default.args = generateProps();
36
33
 
@@ -42,14 +39,15 @@ export const CustomTrigger = (_args, { argTypes }) => ({
42
39
  pickerValue: null,
43
40
  };
44
41
  },
45
- template: wrap(`
46
- <div class="dropdown">
47
- <button type="button" class="dropdown-menu-toggle">
48
- <span class="dropdown-toggle-text"> Start date: {{value}} </span>
49
- </button>
50
- </div>
51
- <gl-datepicker v-model="pickerValue" target=".dropdown-menu-toggle" :container="null" />
52
- `),
42
+ template: `
43
+ <div>
44
+ <div class="dropdown">
45
+ <button type="button" class="dropdown-menu-toggle">
46
+ <span class="dropdown-toggle-text"> Start date: {{value}} </span>
47
+ </button>
48
+ </div>
49
+ <gl-datepicker v-model="pickerValue" target=".dropdown-menu-toggle" :container="null" />
50
+ </div>`,
53
51
  });
54
52
  CustomTrigger.args = generateProps();
55
53
 
@@ -61,15 +59,14 @@ export const WithClearButton = (_args, { argTypes }) => ({
61
59
  pickerValue: defaultDate,
62
60
  };
63
61
  },
64
- template: wrap(`
65
- <gl-datepicker showClearButton :max-date="maxDate" :min-date="minDate" v-model="pickerValue" />
66
- `),
62
+ template: `<gl-datepicker showClearButton :max-date="maxDate" :min-date="minDate" v-model="pickerValue" />`,
67
63
  });
68
64
  WithClearButton.args = generateProps();
69
65
 
70
66
  export default {
71
67
  title: 'base/datepicker',
72
68
  component: GlDatepicker,
69
+ decorators: [makeContainer({ height: '280px' })],
73
70
  parameters: {
74
71
  docs: {
75
72
  description: {
@@ -1,4 +1,5 @@
1
1
  import { disableControls } from '../../../utils/stories_utils';
2
+ import { makeContainer } from '../../../utils/story_decorators/container';
2
3
  import readme from './daterange_picker.md';
3
4
  import GlDaterangePicker from './daterange_picker.vue';
4
5
 
@@ -113,6 +114,7 @@ export default {
113
114
  followsDesignSystem: true,
114
115
  title: 'base/daterange-picker',
115
116
  component: GlDaterangePicker,
117
+ decorators: [makeContainer({ height: '300px' })],
116
118
  parameters: {
117
119
  knobs: { disable: true },
118
120
  docs: {
@@ -18,6 +18,7 @@
18
18
  }
19
19
 
20
20
  .invalid-feedback,
21
+ .valid-feedback,
21
22
  .text-gl-muted {
22
23
  @include gl-font-base;
23
24
  @include gl-line-height-normal;
@@ -25,6 +26,7 @@
25
26
 
26
27
  .form-control {
27
28
  + .invalid-feedback,
29
+ + .valid-feedback,
28
30
  + .text-gl-muted,
29
31
  &.is-valid + .invalid-feedback + .text-gl-muted {
30
32
  // See https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/2806
@@ -74,31 +74,18 @@ WithLabelDescription.args = generateProps({
74
74
  export const WithValidations = (_args, { argTypes }) => ({
75
75
  props: Object.keys(argTypes),
76
76
  components: { ...components, GlFormInput },
77
- computed: {
78
- state() {
79
- return this.name.length >= 4;
80
- },
81
- invalidFeedback() {
82
- let feedbackText = 'This field is required.';
83
-
84
- if (this.name.length >= 4) {
85
- feedbackText = '';
86
- } else if (this.name.length > 0) {
87
- feedbackText = 'Enter at least 4 characters.';
88
- }
89
-
90
- return feedbackText;
91
- },
92
- },
93
- data() {
94
- return {
95
- name: '',
96
- };
97
- },
98
- template: wrap(
99
- '<gl-form-input :id="id" :state="state" v-model.trim="name" />',
100
- ':invalid-feedback="invalidFeedback"'
101
- ),
77
+ template: `
78
+ <div>
79
+ ${wrap(
80
+ '<gl-form-input :id="id" :state="false" />',
81
+ 'invalid-feedback="This field is required."'
82
+ )}
83
+ ${wrap(
84
+ '<gl-form-input :id="id" :state="true" value="Sidney Jones" />',
85
+ 'valid-feedback="This field is valid."'
86
+ )}
87
+ </div>
88
+ `,
102
89
  });
103
90
  WithValidations.args = generateProps({
104
91
  label: 'Name',
@@ -38,6 +38,10 @@
38
38
  }
39
39
  }
40
40
 
41
+ &.is-valid {
42
+ background-image: none;
43
+ }
44
+
41
45
  &::placeholder {
42
46
  @include gl-text-gray-400;
43
47
  }
@@ -64,39 +64,37 @@ export default {
64
64
  };
65
65
  </script>
66
66
  <template>
67
- <div>
68
- <b-input-group>
69
- <b-input-group-prepend v-if="activeOption || $scopedSlots.prepend">
70
- <!-- @slot Is rendered in front of the input field. -->
71
- <slot name="prepend"></slot>
72
- <gl-dropdown v-if="activeOption" :text="activeOption">
73
- <gl-dropdown-item
74
- v-for="option in predefinedOptions"
75
- :key="option.value"
76
- is-check-item
77
- :is-checked="activeOption === option.name"
78
- @click="updateValue(option)"
79
- >
80
- {{ option.name }}
81
- </gl-dropdown-item>
82
- </gl-dropdown>
83
- </b-input-group-prepend>
84
- <!-- @slot Allows replacement of default input field. -->
85
- <slot>
86
- <b-form-input
87
- ref="input"
88
- v-model="localValue"
89
- :class="['gl-form-input', inputClass]"
90
- :aria-label="label"
91
- v-bind="$attrs"
92
- v-on="$listeners"
93
- @click="handleClick"
94
- />
95
- </slot>
96
- <b-input-group-append v-if="$scopedSlots.append">
97
- <!-- @slot Is rendered after the input field. -->
98
- <slot name="append"></slot>
99
- </b-input-group-append>
100
- </b-input-group>
101
- </div>
67
+ <b-input-group>
68
+ <b-input-group-prepend v-if="activeOption || $scopedSlots.prepend">
69
+ <!-- @slot Is rendered in front of the input field. -->
70
+ <slot name="prepend"></slot>
71
+ <gl-dropdown v-if="activeOption" :text="activeOption">
72
+ <gl-dropdown-item
73
+ v-for="option in predefinedOptions"
74
+ :key="option.value"
75
+ is-check-item
76
+ :is-checked="activeOption === option.name"
77
+ @click="updateValue(option)"
78
+ >
79
+ {{ option.name }}
80
+ </gl-dropdown-item>
81
+ </gl-dropdown>
82
+ </b-input-group-prepend>
83
+ <!-- @slot Allows replacement of default input field. -->
84
+ <slot>
85
+ <b-form-input
86
+ ref="input"
87
+ v-model="localValue"
88
+ :class="['gl-form-input', inputClass]"
89
+ :aria-label="label"
90
+ v-bind="$attrs"
91
+ v-on="$listeners"
92
+ @click="handleClick"
93
+ />
94
+ </slot>
95
+ <b-input-group-append v-if="$scopedSlots.append">
96
+ <!-- @slot Is rendered after the input field. -->
97
+ <slot name="append"></slot>
98
+ </b-input-group-append>
99
+ </b-input-group>
102
100
  </template>
@@ -141,7 +141,7 @@ export const Default = (args, { argTypes }) => ({
141
141
  template: template('', `<span class="gl-my-0" id="listbox-label">Select a department</span>`),
142
142
  });
143
143
  Default.args = generateProps({ ariaLabelledby: 'listbox-label' });
144
- Default.decorators = [makeContainer({ height: '150px' })];
144
+ Default.decorators = [makeContainer({ height: '370px' })];
145
145
 
146
146
  export const HeaderAndFooter = (args, { argTypes }) => ({
147
147
  props: Object.keys(argTypes),
@@ -178,7 +178,7 @@ export const HeaderAndFooter = (args, { argTypes }) => ({
178
178
  </template>`),
179
179
  });
180
180
  HeaderAndFooter.args = generateProps({ toggleText: 'Header and Footer', multiple: true });
181
- HeaderAndFooter.decorators = [makeContainer({ height: '220px' })];
181
+ HeaderAndFooter.decorators = [makeContainer({ height: '370px' })];
182
182
 
183
183
  export const CustomListItem = (args, { argTypes }) => ({
184
184
  props: Object.keys(argTypes),
@@ -41,17 +41,16 @@
41
41
  }
42
42
  }
43
43
 
44
- .input-group {
44
+ &.input-group {
45
45
  > .input-group-prepend,
46
46
  > .input-group-append {
47
47
  @include gl-bg-white;
48
48
  }
49
+ }
49
50
 
50
- .gl-search-box-by-click-search-button {
51
- @include gl-text-gray-500;
52
- @include gl-p-3;
53
- @include gl-inset-border-1-gray-400;
54
- }
51
+ .gl-search-box-by-click-search-button {
52
+ @include gl-text-gray-500;
53
+ @include gl-inset-border-1-gray-400;
55
54
  }
56
55
 
57
56
  .gl-search-box-by-click-input {
@@ -26,6 +26,7 @@ const generateOptions = (seriesLength, seriesNameType) => {
26
26
  showSymbol: true,
27
27
  type: 'line',
28
28
  })),
29
+ animation: false,
29
30
  };
30
31
  };
31
32
 
@@ -13,6 +13,8 @@
13
13
 
14
14
  @import 'components';
15
15
 
16
+ @import 'storybook_dark_mode';
17
+
16
18
  /**
17
19
  * Custom padding for docs pages. This improves the integration in Pajamas pages.
18
20
  */
@@ -0,0 +1,23 @@
1
+ // conditional overrides for dark mode for use in storybook.
2
+ // Because we only use application.css from gitlab (and not
3
+ // application_dark), we need to override some base rules so
4
+ // that we can more easily test components in dark mode
5
+
6
+ // This is because dark mode in gitlab currently depends on
7
+ // overriding SCSS variables, but we want gitlab-ui dark mode
8
+ // to use Custom Properties instead
9
+
10
+ .gl-dark {
11
+ --color-body-bg: #1f1f1f;
12
+ --color-body-text: #fff;
13
+
14
+ color-scheme: dark;
15
+
16
+ &,
17
+ body {
18
+ // We can delete these once $body-bg and $body-color
19
+ // variables in variables.scss are updated to use CSS custom properties
20
+ background-color: var(--color-body-bg);
21
+ color: var(--color-body-text);
22
+ }
23
+ }