@gitlab/ui 48.1.2 → 48.3.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 (24) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/components/base/datepicker/datepicker.js +16 -17
  3. package/dist/components/base/filtered_search/filtered_search.js +25 -1
  4. package/dist/components/base/filtered_search/filtered_search_token.js +2 -0
  5. package/dist/components/base/filtered_search/filtered_search_token_segment.js +44 -1
  6. package/dist/utility_classes.css +1 -1
  7. package/dist/utility_classes.css.map +1 -1
  8. package/dist/utils/charts/theme.js +27 -27
  9. package/package.json +2 -2
  10. package/scss_to_js/scss_variables.js +43 -43
  11. package/scss_to_js/scss_variables.json +86 -86
  12. package/src/components/base/avatar/avatar.stories.js +3 -3
  13. package/src/components/base/avatars_inline/avatars_inline.stories.js +5 -5
  14. package/src/components/base/datepicker/datepicker.spec.js +8 -0
  15. package/src/components/base/datepicker/datepicker.vue +16 -18
  16. package/src/components/base/filtered_search/filtered_search.spec.js +14 -5
  17. package/src/components/base/filtered_search/filtered_search.vue +31 -13
  18. package/src/components/base/filtered_search/filtered_search_token.vue +3 -0
  19. package/src/components/base/filtered_search/filtered_search_token_segment.spec.js +7 -7
  20. package/src/components/base/filtered_search/filtered_search_token_segment.vue +39 -1
  21. package/src/components/charts/bar/__snapshots__/bar.spec.js.snap +3 -3
  22. package/src/components/charts/column/__snapshots__/column_chart.spec.js.snap +11 -11
  23. package/src/components/charts/stacked_column/__snapshots__/stacked_column.spec.js.snap +23 -23
  24. package/src/scss/variables.scss +44 -44
package/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ # [48.3.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v48.2.0...v48.3.0) (2022-10-24)
2
+
3
+
4
+ ### Features
5
+
6
+ * **Color:** Update aqua error ([9092b09](https://gitlab.com/gitlab-org/gitlab-ui/commit/9092b09130e1d4f03644e87d4a8dacecf6e2e1eb))
7
+ * **Color:** Update chart snapshots ([6cff69d](https://gitlab.com/gitlab-org/gitlab-ui/commit/6cff69ded0073ed9ddce09da29a89211dc1f7b50))
8
+ * **Color:** Update data viz variables ([3c0edbb](https://gitlab.com/gitlab-org/gitlab-ui/commit/3c0edbb30b6f5078f8938627418fd9349f788db2))
9
+
10
+ # [48.2.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v48.1.2...v48.2.0) (2022-10-24)
11
+
12
+
13
+ ### Features
14
+
15
+ * **datepicker:** add public show method for datepicker ([adc2c8f](https://gitlab.com/gitlab-org/gitlab-ui/commit/adc2c8f53016efb253b003b02e6c354eb297ddb6))
16
+
1
17
  ## [48.1.2](https://gitlab.com/gitlab-org/gitlab-ui/compare/v48.1.1...v48.1.2) (2022-10-21)
2
18
 
3
19
 
@@ -189,7 +189,7 @@ var script = {
189
189
 
190
190
  computed: {
191
191
  formattedDate() {
192
- return this.$options.pikaday.calendar && this.$options.pikaday.calendar.toString();
192
+ return 'calendar' in this && this.calendar.toString();
193
193
  },
194
194
 
195
195
  customTrigger() {
@@ -223,25 +223,25 @@ var script = {
223
223
  },
224
224
  watch: {
225
225
  value(val) {
226
- if (!areDatesEqual(val, this.$options.pikaday.calendar.getDate())) {
227
- this.$options.pikaday.calendar.setDate(val, true);
226
+ if (!areDatesEqual(val, this.calendar.getDate())) {
227
+ this.calendar.setDate(val, true);
228
228
  }
229
229
  },
230
230
 
231
231
  minDate(minDate) {
232
- this.$options.pikaday.calendar.setMinDate(minDate);
232
+ this.calendar.setMinDate(minDate);
233
233
  },
234
234
 
235
235
  maxDate(maxDate) {
236
- this.$options.pikaday.calendar.setMaxDate(maxDate);
236
+ this.calendar.setMaxDate(maxDate);
237
237
  },
238
238
 
239
239
  startRange(startRange) {
240
- this.$options.pikaday.calendar.setStartRange(startRange);
240
+ this.calendar.setStartRange(startRange);
241
241
  },
242
242
 
243
243
  endRange(endRange) {
244
- this.$options.pikaday.calendar.setEndRange(endRange);
244
+ this.calendar.setEndRange(endRange);
245
245
  }
246
246
 
247
247
  },
@@ -295,18 +295,23 @@ var script = {
295
295
  pikadayConfig.i18n = this.i18n;
296
296
  }
297
297
 
298
- this.$options.pikaday.calendar = new Pikaday(pikadayConfig);
298
+ this.calendar = new Pikaday(pikadayConfig);
299
299
 
300
300
  if (this.startOpened) {
301
- this.$options.pikaday.calendar.show();
301
+ this.calendar.show();
302
302
  }
303
303
  },
304
304
 
305
305
  beforeDestroy() {
306
- this.$options.pikaday.calendar.destroy();
306
+ this.calendar.destroy();
307
307
  },
308
308
 
309
309
  methods: {
310
+ // is used to open datepicker programmatically
311
+ show() {
312
+ this.calendar.show();
313
+ },
314
+
310
315
  selected(date) {
311
316
  /**
312
317
  * Emitted when a new date has been selected.
@@ -348,17 +353,11 @@ var script = {
348
353
  onKeydown() {
349
354
  if (this.textInput === '') {
350
355
  const resetDate = this.minDate || null;
351
- this.$options.pikaday.calendar.setDate(resetDate);
356
+ this.calendar.setDate(resetDate);
352
357
  this.selected(resetDate);
353
358
  }
354
359
  }
355
360
 
356
- },
357
- // Vue3 will make this.$options shallow-readonly
358
- // that means that in order to store anything in $options
359
- // we need an object as a container
360
- pikaday: {
361
- calendar: null
362
361
  }
363
362
  };
364
363
 
@@ -56,7 +56,31 @@ var script = {
56
56
  availableTokens: {
57
57
  type: Array,
58
58
  required: false,
59
- default: () => []
59
+ default: () => [],
60
+
61
+ validator(value) {
62
+ // eslint-disable-next-line no-underscore-dangle
63
+ if (!value.__v_raw) {
64
+ // This is Vue 2
65
+ return true;
66
+ } // eslint-disable-next-line no-underscore-dangle
67
+
68
+
69
+ const isOk = Array.isArray(value) && value.every(_ref => {
70
+ let {
71
+ token
72
+ } = _ref;
73
+ return token.__v_skip;
74
+ });
75
+
76
+ if (!isOk) {
77
+ // eslint-disable-next-line no-console
78
+ console.warn('You are using Vue3. In Vue3 each token component passed to filtered search must be wrapped into markRaw');
79
+ }
80
+
81
+ return isOk;
82
+ }
83
+
60
84
  },
61
85
 
62
86
  /**
@@ -19,6 +19,8 @@ const DEFAULT_OPERATORS = [{
19
19
  }];
20
20
  var script = {
21
21
  name: 'GlFilteredSearchToken',
22
+ // FIXME: temporary workaround to ensure compatibility with @vue/compat
23
+ __v_skip: true,
22
24
  components: {
23
25
  GlToken,
24
26
  GlFilteredSearchTokenSegment
@@ -6,6 +6,49 @@ import GlFilteredSearchSuggestionList from './filtered_search_suggestion_list';
6
6
  import { splitOnQuotes, wrapTokenInQuotes } from './filtered_search_utils';
7
7
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
8
8
 
9
+ // @vue/compat will render comment nodes for v-if and comments in HTML
10
+ // Also it makes use of fragments - both comments and nodes are Symbols.
11
+ // In Vue3 all of them (Comment, Fragment) are exposed as named exports on vue module
12
+ // However we want to maintain compatibility with Vue2, so taking this hacky approach
13
+ // relying on Symbol.toString()
14
+ // I'm keeping this directly here instead of helper to increase probability of
15
+ // fixing ASAP and because I don't want this helper to be reused
16
+ // FIXME: replace with Symbols when we will switch to Vue3
17
+
18
+ const isVue3Comment = vnode => {
19
+ var _vnode$type, _vnode$type$toString;
20
+
21
+ return (vnode === null || vnode === void 0 ? void 0 : (_vnode$type = vnode.type) === null || _vnode$type === void 0 ? void 0 : (_vnode$type$toString = _vnode$type.toString) === null || _vnode$type$toString === void 0 ? void 0 : _vnode$type$toString.call(_vnode$type)) === 'Symbol(Comment)';
22
+ };
23
+
24
+ const isVue3Fragment = vnode => {
25
+ var _vnode$type2, _vnode$type2$toString;
26
+
27
+ return (vnode === null || vnode === void 0 ? void 0 : (_vnode$type2 = vnode.type) === null || _vnode$type2 === void 0 ? void 0 : (_vnode$type2$toString = _vnode$type2.toString) === null || _vnode$type2$toString === void 0 ? void 0 : _vnode$type2$toString.call(_vnode$type2)) === 'Symbol(Fragment)';
28
+ };
29
+
30
+ const isVNodeEmpty = vnode => {
31
+ if (isVue3Fragment(vnode)) {
32
+ // vnode.children might be an array or single node in edge cases
33
+ return Array.isArray(vnode.children) ? vnode.children.every(isVNodeEmpty) : isVNodeEmpty(vnode.children);
34
+ }
35
+
36
+ if (isVue3Comment(vnode)) {
37
+ return true;
38
+ }
39
+
40
+ return false;
41
+ };
42
+
43
+ const isSlotNotEmpty = slot => {
44
+ if (!slot) {
45
+ return false;
46
+ }
47
+
48
+ const vnodes = typeof slot === 'function' ? slot() : slot;
49
+ return !(Array.isArray(vnodes) ? vnodes.every(isVNodeEmpty) : isVNodeEmpty(vnodes));
50
+ };
51
+
9
52
  var script = {
10
53
  name: 'GlFilteredSearchTokenSegment',
11
54
  components: {
@@ -132,7 +175,7 @@ var script = {
132
175
  var _this$options2;
133
176
 
134
177
  // eslint-disable-next-line @gitlab/vue-prefer-dollar-scopedslots
135
- return ((_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.length) || this.$slots.suggestions;
178
+ return ((_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.length) || isSlotNotEmpty(this.$slots.suggestions);
136
179
  },
137
180
 
138
181
  defaultSuggestedValue() {