@gitlab/ui 36.7.1 → 37.0.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 (42) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/components/base/alert/alert.js +1 -11
  3. package/dist/components/base/card/card.js +1 -1
  4. package/dist/components/charts/area/area.documentation.js +1 -7
  5. package/dist/components/charts/line/line.documentation.js +2 -5
  6. package/dist/index.css +1 -1
  7. package/dist/index.css.map +1 -1
  8. package/dist/utils/stories_utils.js +13 -1
  9. package/documentation/documented_stories.js +2 -0
  10. package/package.json +2 -2
  11. package/src/components/base/accordion/accordion.stories.js +2 -1
  12. package/src/components/base/alert/alert.scss +0 -38
  13. package/src/components/base/alert/alert.spec.js +0 -1
  14. package/src/components/base/alert/alert.stories.js +0 -8
  15. package/src/components/base/alert/alert.vue +30 -41
  16. package/src/components/base/badge/badge.stories.js +4 -24
  17. package/src/components/base/card/card.vue +2 -2
  18. package/src/components/base/daterange_picker/daterange_picker.stories.js +10 -35
  19. package/src/components/base/icon/icon.stories.js +2 -5
  20. package/src/components/base/toggle/toggle.stories.js +2 -3
  21. package/src/components/charts/area/area.documentation.js +0 -5
  22. package/src/components/charts/area/area.stories.js +127 -127
  23. package/src/components/charts/bar/bar.stories.js +8 -5
  24. package/src/components/charts/heatmap/heatmap.stories.js +13 -16
  25. package/src/components/charts/line/line.documentation.js +0 -2
  26. package/src/components/charts/line/line.md +0 -2
  27. package/src/components/charts/line/line.stories.js +124 -113
  28. package/src/utils/stories_utils.js +6 -0
  29. package/src/utils/stories_utils.spec.js +18 -0
  30. package/dist/components/charts/area/examples/area.basic.example.js +0 -45
  31. package/dist/components/charts/area/examples/area.basic_plus.example.js +0 -53
  32. package/dist/components/charts/area/examples/index.js +0 -19
  33. package/dist/components/charts/line/examples/index.js +0 -19
  34. package/dist/components/charts/line/examples/line.basic.example.js +0 -45
  35. package/dist/components/charts/line/examples/line.series.example.js +0 -53
  36. package/src/components/charts/area/area.md +0 -1
  37. package/src/components/charts/area/examples/area.basic.example.vue +0 -14
  38. package/src/components/charts/area/examples/area.basic_plus.example.vue +0 -25
  39. package/src/components/charts/area/examples/index.js +0 -22
  40. package/src/components/charts/line/examples/index.js +0 -22
  41. package/src/components/charts/line/examples/line.basic.example.vue +0 -14
  42. package/src/components/charts/line/examples/line.series.example.vue +0 -25
@@ -9,5 +9,17 @@ const SERIES_NAME = {
9
9
  [SERIES_NAME_LONG]: 'Series name long. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tincidunt interdum sapien ut blandit. Nulla fermentum nisi id euismod vulputate. END',
10
10
  [SERIES_NAME_LONG_WITHOUT_SPACES]: 'Series_name_long._Lorem_ipsum_dolor_sit_amet,_consectetur_adipiscing_elit._Sed_tincidunt_interdum_sapien_ut_blandit._Nulla_fermentum_nisi_id_euismod_vulputate._END'
11
11
  };
12
+ /**
13
+ * Builds the parameters object disable one or multiple controls.
14
+ */
15
+
16
+ const disableControls = function () {
17
+ let controls = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
18
+ return Object.fromEntries(controls.map(control => [control, {
19
+ control: {
20
+ disable: true
21
+ }
22
+ }]));
23
+ };
12
24
 
13
- export { SERIES_NAME, SERIES_NAME_LONG, SERIES_NAME_LONG_WITHOUT_SPACES, SERIES_NAME_SHORT };
25
+ export { SERIES_NAME, SERIES_NAME_LONG, SERIES_NAME_LONG_WITHOUT_SPACES, SERIES_NAME_SHORT, disableControls };
@@ -132,6 +132,8 @@ export const setupStorybookReadme = () =>
132
132
  'GlHeatmap',
133
133
  'GlFormRadioGroup',
134
134
  'GlChartSeriesLabel',
135
+ 'GlAreaChart',
136
+ 'GlLineChart',
135
137
  ],
136
138
  components: {
137
139
  GlComponentDocumentation,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "36.7.1",
3
+ "version": "37.0.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -85,7 +85,7 @@
85
85
  "@babel/preset-env": "^7.10.2",
86
86
  "@gitlab/eslint-plugin": "10.0.2",
87
87
  "@gitlab/stylelint-config": "4.0.0",
88
- "@gitlab/svgs": "2.5.0",
88
+ "@gitlab/svgs": "2.6.0",
89
89
  "@rollup/plugin-commonjs": "^11.1.0",
90
90
  "@rollup/plugin-node-resolve": "^7.1.3",
91
91
  "@rollup/plugin-replace": "^2.3.2",
@@ -1,3 +1,4 @@
1
+ import { disableControls } from '../../../utils/stories_utils';
1
2
  import readme from './accordion.md';
2
3
  import GlAccordion from './accordion.vue';
3
4
  import GlAccordionItem from './accordion_item.vue';
@@ -63,6 +64,6 @@ export default {
63
64
  options: [1, 2, 3, 4, 5, 6],
64
65
  },
65
66
  },
66
- autoCollapse: { control: { disable: true } },
67
+ ...disableControls(['autoCollapse']),
67
68
  },
68
69
  };
@@ -85,44 +85,6 @@
85
85
  @include gl-right-4;
86
86
  }
87
87
 
88
- .gl-alert-max-content {
89
- @include gl-display-flex;
90
- @include gl-justify-content-center;
91
- @include gl-p-5;
92
-
93
- .gl-alert-icon {
94
- @include gl-static;
95
- @include gl-mr-5;
96
- @include gl-flex-shrink-0;
97
- }
98
-
99
- .gl-dismiss-btn {
100
- @include gl-static;
101
- @include gl-align-self-start;
102
- @include gl-ml-4;
103
- // The negative margins optically align the × with the title text and right padding
104
- margin-top: -$gl-spacing-scale-2;
105
- margin-right: -$gl-spacing-scale-2;
106
- order: 3;
107
- }
108
-
109
- .gl-alert-container {
110
- @include gl-relative;
111
- @include gl-display-flex;
112
- @include gl-justify-content-space-between;
113
- @include gl-flex-grow-1;
114
- @include gl-mx-auto;
115
- }
116
-
117
- .gl-alert-content {
118
- @include gl-flex-grow-1;
119
- }
120
- }
121
-
122
- .gl-alert-layout-limited .gl-alert-container {
123
- @include gl-layout-w-limited;
124
- }
125
-
126
88
  .gl-alert-danger {
127
89
  @include gl-bg-red-50;
128
90
 
@@ -154,7 +154,6 @@ describe('Alert component', () => {
154
154
  describe('top-level classes', () => {
155
155
  describe.each`
156
156
  prop | cssClass | presentIf
157
- ${'contained'} | ${'gl-alert-max-content'} | ${true}
158
157
  ${'sticky'} | ${'gl-alert-sticky'} | ${true}
159
158
  ${'dismissible'} | ${'gl-alert-not-dismissible'} | ${false}
160
159
  `('$cssClass', ({ prop, cssClass, presentIf }) => {
@@ -12,7 +12,6 @@ const template = `
12
12
  :secondary-button-text="secondaryButtonText"
13
13
  :primary-button-link="primaryButtonLink"
14
14
  :secondary-button-link="secondaryButtonLink"
15
- :contained="contained"
16
15
  :sticky="sticky"
17
16
  >{{ message }}</gl-alert>`;
18
17
 
@@ -27,7 +26,6 @@ const generateProps = ({
27
26
  primaryButtonLink = defaultValue('primaryButtonLink'),
28
27
  secondaryButtonText = defaultValue('secondaryButtonText'),
29
28
  secondaryButtonLink = defaultValue('secondaryButtonLink'),
30
- contained = defaultValue('contained'),
31
29
  sticky = defaultValue('sticky'),
32
30
  } = {}) => ({
33
31
  title,
@@ -39,7 +37,6 @@ const generateProps = ({
39
37
  primaryButtonLink,
40
38
  secondaryButtonText,
41
39
  secondaryButtonLink,
42
- contained,
43
40
  sticky,
44
41
  });
45
42
 
@@ -118,11 +115,6 @@ Variants.parameters = {
118
115
  storyshots: { disable: true },
119
116
  };
120
117
 
121
- export const Contained = Template.bind({});
122
- Contained.args = generateProps({
123
- contained: true,
124
- });
125
-
126
118
  export const Sticky = () => ({
127
119
  components: { GlAlert },
128
120
  variants: alertVariantOptions,
@@ -74,14 +74,6 @@ export default {
74
74
  required: false,
75
75
  default: '',
76
76
  },
77
- /**
78
- * Contained alerts have their content's width limited.
79
- */
80
- contained: {
81
- type: Boolean,
82
- required: false,
83
- default: false,
84
- },
85
77
  sticky: {
86
78
  type: Boolean,
87
79
  required: false,
@@ -171,48 +163,45 @@ export default {
171
163
  <div
172
164
  :class="[
173
165
  'gl-alert',
174
- { 'gl-alert-max-content gl-alert-layout-limited': contained },
175
166
  { 'gl-alert-sticky': sticky },
176
167
  { 'gl-alert-not-dismissible': !dismissible },
177
168
  variantClass,
178
169
  ]"
179
170
  >
180
- <div class="gl-alert-container">
181
- <gl-icon
182
- :name="iconName"
183
- :class="{ 'gl-alert-icon': true, 'gl-alert-icon-no-title': !title }"
184
- />
171
+ <gl-icon
172
+ :name="iconName"
173
+ :class="{ 'gl-alert-icon': true, 'gl-alert-icon-no-title': !title }"
174
+ />
185
175
 
186
- <close-button
187
- v-if="dismissible"
188
- ref="dismiss"
189
- class="gl-dismiss-btn"
190
- :label="dismissLabel"
191
- @click="onDismiss"
192
- />
176
+ <close-button
177
+ v-if="dismissible"
178
+ ref="dismiss"
179
+ class="gl-dismiss-btn"
180
+ :label="dismissLabel"
181
+ @click="onDismiss"
182
+ />
193
183
 
194
- <div class="gl-alert-content" role="alert">
195
- <h4 v-if="title" class="gl-alert-title">{{ title }}</h4>
184
+ <div class="gl-alert-content" role="alert">
185
+ <h4 v-if="title" class="gl-alert-title">{{ title }}</h4>
196
186
 
197
- <div class="gl-alert-body">
198
- <!-- @slot The alert message to display. -->
199
- <slot></slot>
200
- </div>
187
+ <div class="gl-alert-body">
188
+ <!-- @slot The alert message to display. -->
189
+ <slot></slot>
190
+ </div>
201
191
 
202
- <div v-if="shouldRenderActions" class="gl-alert-actions">
203
- <!-- @slot If the primary/secondary action buttons aren't flexible enough, place arbitrary content here. -->
204
- <slot name="actions">
205
- <gl-button
206
- v-for="(actionButton, index) in actionButtons"
207
- :key="index"
208
- class="gl-alert-action"
209
- v-bind="actionButton.attrs"
210
- v-on="actionButton.listeners"
211
- >
212
- {{ actionButton.text }}
213
- </gl-button>
214
- </slot>
215
- </div>
192
+ <div v-if="shouldRenderActions" class="gl-alert-actions">
193
+ <!-- @slot If the primary/secondary action buttons aren't flexible enough, place arbitrary content here. -->
194
+ <slot name="actions">
195
+ <gl-button
196
+ v-for="(actionButton, index) in actionButtons"
197
+ :key="index"
198
+ class="gl-alert-action"
199
+ v-bind="actionButton.attrs"
200
+ v-on="actionButton.listeners"
201
+ >
202
+ {{ actionButton.text }}
203
+ </gl-button>
204
+ </slot>
216
205
  </div>
217
206
  </div>
218
207
  </div>
@@ -1,6 +1,7 @@
1
1
  import iconSpriteInfo from '@gitlab/svgs/dist/icons.json';
2
2
  import { GlBadge } from '../../../index';
3
3
  import { badgeSizeOptions, badgeVariantOptions } from '../../../utils/constants';
4
+ import { disableControls } from '../../../utils/stories_utils';
4
5
  import readme from './badge.md';
5
6
 
6
7
  const template = `
@@ -61,14 +62,7 @@ export const Variants = (args, { argTypes }) => ({
61
62
  Variants.args = generateProps({
62
63
  variant: badgeVariantOptions.warning,
63
64
  });
64
- Variants.argTypes = {
65
- content: {
66
- control: { disable: true },
67
- },
68
- variant: {
69
- control: { disable: true },
70
- },
71
- };
65
+ Variants.argTypes = disableControls(['content', 'variant']);
72
66
 
73
67
  export const Actionable = (args, { argTypes }) => ({
74
68
  components: { GlBadge },
@@ -95,14 +89,7 @@ Actionable.args = generateProps({
95
89
  Actionable.parameters = {
96
90
  storyshots: { disable: true },
97
91
  };
98
- Actionable.argTypes = {
99
- content: {
100
- control: { disable: true },
101
- },
102
- variant: {
103
- control: { disable: true },
104
- },
105
- };
92
+ Actionable.argTypes = disableControls(['content', 'variant']);
106
93
 
107
94
  export const Sizes = (args, { argTypes }) => ({
108
95
  components: { GlBadge },
@@ -125,14 +112,7 @@ export const Sizes = (args, { argTypes }) => ({
125
112
  Sizes.args = generateProps({
126
113
  variant: badgeVariantOptions.danger,
127
114
  });
128
- Sizes.argTypes = {
129
- content: {
130
- control: { disable: true },
131
- },
132
- size: {
133
- control: { disable: true },
134
- },
135
- };
115
+ Sizes.argTypes = disableControls(['content', 'size']);
136
116
 
137
117
  export const BadgeIcon = (args, { argTypes }) => ({
138
118
  components: { GlBadge },
@@ -31,7 +31,7 @@ export default {
31
31
 
32
32
  <template>
33
33
  <div class="gl-card">
34
- <div v-if="this.$slots.header" class="gl-card-header" :class="headerClass">
34
+ <div v-if="$slots.header" class="gl-card-header" :class="headerClass">
35
35
  <!-- @slot The card's header content. -->
36
36
  <slot name="header"></slot>
37
37
  </div>
@@ -39,7 +39,7 @@ export default {
39
39
  <!-- @slot The card's main content. -->
40
40
  <slot></slot>
41
41
  </div>
42
- <div v-if="this.$slots.footer" class="gl-card-footer" :class="footerClass">
42
+ <div v-if="$slots.footer" class="gl-card-footer" :class="footerClass">
43
43
  <!-- @slot The card's footer content. -->
44
44
  <slot name="footer"></slot>
45
45
  </div>
@@ -1,3 +1,4 @@
1
+ import { disableControls } from '../../../utils/stories_utils';
1
2
  import readme from './daterange_picker.md';
2
3
  import GlDaterangePicker from './daterange_picker.vue';
3
4
 
@@ -121,31 +122,15 @@ export default {
121
122
  },
122
123
  },
123
124
  argTypes: {
124
- i18n: {
125
- control: {
126
- disable: true,
127
- },
128
- },
129
- startPickerTarget: {
130
- control: {
131
- disable: true,
132
- },
133
- },
134
- startPickerContainer: {
135
- control: {
136
- disable: true,
137
- },
138
- },
139
- endPickerTarget: {
140
- control: {
141
- disable: true,
142
- },
143
- },
144
- endPickerContainer: {
145
- control: {
146
- disable: true,
147
- },
148
- },
125
+ ...disableControls([
126
+ 'i18n',
127
+ 'startPickerTarget',
128
+ 'startPickerContainer',
129
+ 'endPickerTarget',
130
+ 'endPickerContainer',
131
+ 'defaultStartDate',
132
+ 'defaultEndDate',
133
+ ]),
149
134
  defaultMinDate: {
150
135
  control: {
151
136
  type: 'date',
@@ -156,15 +141,5 @@ export default {
156
141
  type: 'date',
157
142
  },
158
143
  },
159
- defaultStartDate: {
160
- control: {
161
- disable: true,
162
- },
163
- },
164
- defaultEndDate: {
165
- control: {
166
- disable: true,
167
- },
168
- },
169
144
  },
170
145
  };
@@ -1,6 +1,7 @@
1
1
  import iconSpriteInfo from '@gitlab/svgs/dist/icons.json';
2
2
  import { GlIcon } from '../../../index';
3
3
  import { iconSizeOptions } from '../../../utils/constants';
4
+ import { disableControls } from '../../../utils/stories_utils';
4
5
  import readme from './icon.md';
5
6
 
6
7
  const components = {
@@ -41,6 +42,7 @@ export default {
41
42
  storyshots: { disable: true },
42
43
  },
43
44
  argTypes: {
45
+ ...disableControls(['useDeprecatedSizes']),
44
46
  name: {
45
47
  control: {
46
48
  type: 'select',
@@ -53,10 +55,5 @@ export default {
53
55
  options: iconSizeOptions,
54
56
  },
55
57
  },
56
- useDeprecatedSizes: {
57
- control: {
58
- disable: true,
59
- },
60
- },
61
58
  },
62
59
  };
@@ -1,5 +1,6 @@
1
1
  import { GlToggle } from '../../../index';
2
2
  import { toggleLabelPosition } from '../../../utils/constants';
3
+ import { disableControls } from '../../../utils/stories_utils';
3
4
  import readme from './toggle.md';
4
5
 
5
6
  const defaultValue = (prop) => GlToggle.props[prop].default;
@@ -53,6 +54,7 @@ export default {
53
54
  },
54
55
  },
55
56
  argTypes: {
57
+ ...disableControls(['name']),
56
58
  labelPosition: {
57
59
  control: {
58
60
  type: 'select',
@@ -69,8 +71,5 @@ export default {
69
71
  type: 'text',
70
72
  },
71
73
  },
72
- name: {
73
- control: { disable: true },
74
- },
75
74
  },
76
75
  };
@@ -1,8 +1,3 @@
1
- import description from './area.md';
2
- import examples from './examples';
3
-
4
1
  export default {
5
2
  followsDesignSystem: false,
6
- description,
7
- examples,
8
3
  };