@gitlab/ui 79.4.1 → 80.0.1

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": "79.4.1",
3
+ "version": "80.0.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -131,14 +131,14 @@
131
131
  "babel-jest": "29.0.1",
132
132
  "babel-loader": "^8.0.5",
133
133
  "bootstrap": "4.6.2",
134
- "cypress": "13.8.0",
134
+ "cypress": "13.8.1",
135
135
  "cypress-axe": "^1.4.0",
136
136
  "cypress-real-events": "^1.11.0",
137
137
  "dompurify": "^3.0.0",
138
138
  "emoji-regex": "^10.0.0",
139
139
  "eslint": "8.57.0",
140
140
  "eslint-import-resolver-jest": "3.0.2",
141
- "eslint-plugin-cypress": "2.15.2",
141
+ "eslint-plugin-cypress": "3.0.0",
142
142
  "eslint-plugin-storybook": "0.8.0",
143
143
  "glob": "10.3.3",
144
144
  "identity-obj-proxy": "^3.0.0",
@@ -1,25 +1,32 @@
1
- import { formStateOptions, formInputWidths } from '../../../../utils/constants';
2
- import GlFormSelect from './form_select.vue';
1
+ import uniqueId from 'lodash/uniqueId';
2
+ import { formInputWidths, formStateOptions } from '../../../../utils/constants';
3
+ import GlFormGroup from '../form_group/form_group.vue';
3
4
  import { formSelectOptions } from './constants';
4
5
  import readme from './form_select.md';
6
+ import GlFormSelect from './form_select.vue';
5
7
 
6
8
  const data = () => ({
7
9
  selected: 'Pizza',
8
10
  });
9
11
 
10
12
  const template = `
11
- <gl-form-select
12
- v-model="selected"
13
- :width="width"
14
- :disabled="disabled"
15
- :state="state"
16
- :multiple="multiple"
17
- :selectSize="selectSize"
18
- :options="options">
19
- </gl-form-select>
13
+ <gl-form-group :label="labelText" :label-for="inputId">
14
+ <gl-form-select
15
+ :id="inputId"
16
+ v-model="selected"
17
+ :width="width"
18
+ :disabled="disabled"
19
+ :state="state"
20
+ :multiple="multiple"
21
+ :selectSize="selectSize"
22
+ :options="options">
23
+ </gl-form-select>
24
+ </gl-form-group>
20
25
  `;
21
26
 
22
27
  const generateProps = ({
28
+ inputId = uniqueId('input-'),
29
+ labelText = 'Label',
23
30
  width = null,
24
31
  state = null,
25
32
  disabled = false,
@@ -27,6 +34,8 @@ const generateProps = ({
27
34
  selectSize = 1,
28
35
  options = formSelectOptions,
29
36
  } = {}) => ({
37
+ inputId,
38
+ labelText,
30
39
  width,
31
40
  disabled,
32
41
  state,
@@ -36,7 +45,7 @@ const generateProps = ({
36
45
  });
37
46
 
38
47
  const Template = (args) => ({
39
- components: { GlFormSelect },
48
+ components: { GlFormSelect, GlFormGroup },
40
49
  props: Object.keys(args),
41
50
  data,
42
51
  template,
@@ -55,7 +64,7 @@ export const InvalidState = Template.bind({});
55
64
  InvalidState.args = generateProps({ state: false });
56
65
 
57
66
  export const WithTruncation = (args, { argTypes }) => ({
58
- components: { GlFormSelect },
67
+ components: { GlFormSelect, GlFormGroup },
59
68
  props: Object.keys(argTypes),
60
69
  data() {
61
70
  return {
@@ -78,7 +87,7 @@ WithTruncation.args = generateProps({
78
87
  });
79
88
 
80
89
  export const Widths = (args, { argTypes }) => ({
81
- components: { GlFormSelect },
90
+ components: { GlFormSelect, GlFormGroup },
82
91
  props: Object.keys(argTypes),
83
92
  data() {
84
93
  return {
@@ -87,13 +96,14 @@ export const Widths = (args, { argTypes }) => ({
87
96
  },
88
97
  template: `
89
98
  <div>
90
- <div v-for="(width, name) in formInputWidths" :key="width" class="gl-mb-4">
99
+ <gl-form-group v-for="(width, name) in formInputWidths" :key="width" :label="name" :label-for="'width-' + width">
91
100
  <gl-form-select
101
+ :id="'width-' + width"
92
102
  v-model="name"
93
103
  :width="width"
94
104
  :options="[{ value: name, text: name }]">
95
105
  </gl-form-select>
96
- </div>
106
+ </gl-form-group>
97
107
  </div>`,
98
108
  });
99
109
  Widths.args = generateProps();
@@ -201,7 +201,7 @@ export const CustomGroupsItemsAndToggle = makeGroupedExample({
201
201
  <template #list-item>
202
202
  <span class="gl-display-flex gl-flex-direction-column">
203
203
  <span class="gl-font-weight-bold gl-white-space-nowrap">Orange Fox</span>
204
- <span class="gl-text-gray-400">@thefox</span>
204
+ <span class="gl-text-gray-600">@thefox</span>
205
205
  </span>
206
206
  </template>
207
207
  </gl-disclosure-dropdown-item>
@@ -237,7 +237,11 @@ export default {
237
237
  },
238
238
  computed: {
239
239
  disclosureTag() {
240
- if (this.items?.length || hasOnlyListItems(this.$scopedSlots)) {
240
+ if (
241
+ this.items?.length ||
242
+ // eslint-disable-next-line @gitlab/vue-prefer-dollar-scopedslots
243
+ hasOnlyListItems(this.$scopedSlots.default || this.$slots.default)
244
+ ) {
241
245
  return 'ul';
242
246
  }
243
247
  return 'div';
@@ -1,4 +1,6 @@
1
+ import Vue from 'vue';
1
2
  import isFunction from 'lodash/isFunction';
3
+ import isString from 'lodash/isString';
2
4
  import { DISCLOSURE_DROPDOWN_ITEM_NAME, DISCLOSURE_DROPDOWN_GROUP_NAME } from './constants';
3
5
 
4
6
  const itemValidator = (item) => item?.text?.length > 0 && !Array.isArray(item?.items);
@@ -21,17 +23,14 @@ const isListItem = (tag) =>
21
23
  const isValidSlotTagVue2 = (vNode) =>
22
24
  Boolean(vNode) && isListItem(vNode.componentOptions?.tag || vNode.tag);
23
25
 
24
- const isValidSlotTag = (vNode) => {
26
+ const isValidSlotTagVue3 = (vNode) => {
25
27
  return (
26
28
  [DISCLOSURE_DROPDOWN_ITEM_NAME, DISCLOSURE_DROPDOWN_GROUP_NAME].includes(vNode.type?.name) ||
27
29
  vNode.type === 'li'
28
30
  );
29
31
  };
30
32
 
31
- const hasOnlyListItems = ({ default: defaultSlot }) => {
32
- if (!isFunction(defaultSlot)) {
33
- return false;
34
- }
33
+ const hasOnlyListItemsVue2 = (defaultSlot) => {
35
34
  const nodes = defaultSlot();
36
35
 
37
36
  if (!Array.isArray(nodes)) {
@@ -40,7 +39,32 @@ const hasOnlyListItems = ({ default: defaultSlot }) => {
40
39
 
41
40
  const tags = nodes.filter((vNode) => vNode.tag);
42
41
 
43
- return tags.length && tags.every((tag) => isValidSlotTag(tag) || isValidSlotTagVue2(tag));
42
+ return tags.length && tags.every((tag) => isValidSlotTagVue2(tag));
43
+ };
44
+
45
+ const hasOnlyListItemsVue3 = (defaultSlot) => {
46
+ const nodes = defaultSlot();
47
+ const fragment = nodes.find((node) => Array.isArray(node.children) && node.children.length);
48
+ const targetNodes = fragment ? fragment.children : nodes;
49
+
50
+ return (
51
+ targetNodes
52
+ // Remove empty text vNodes
53
+ .filter((vNode) => !isString(vNode.text) || vNode.text.trim().length > 0)
54
+ .every((vNode) => isValidSlotTagVue3(vNode))
55
+ );
56
+ };
57
+
58
+ const hasOnlyListItems = (defaultSlot) => {
59
+ if (!isFunction(defaultSlot)) {
60
+ return false;
61
+ }
62
+
63
+ if (Vue.version.startsWith('3')) {
64
+ return hasOnlyListItemsVue3(defaultSlot);
65
+ }
66
+
67
+ return hasOnlyListItemsVue2(defaultSlot);
44
68
  };
45
69
 
46
70
  export { itemsValidator, isItem, isGroup, hasOnlyListItems };
@@ -27,13 +27,13 @@ pagination, use `GlTableLite` which offers a subset of `GlTable` features.
27
27
  fields: [
28
28
  {
29
29
  key: 'column_one',
30
- label: __('Column One'),
30
+ label: __('First column'),
31
31
  thClass: 'w-60p',
32
32
  tdClass: 'table-col d-flex'
33
33
  },
34
34
  {
35
35
  key: 'col_2',
36
- label: __('Column 2'),
36
+ label: __('Second column'),
37
37
  thClass: 'w-15p',
38
38
  tdClass: 'table-col d-flex'
39
39
  },
@@ -43,7 +43,7 @@ pagination, use `GlTableLite` which offers a subset of `GlTable` features.
43
43
  <template>
44
44
  <gl-table :items="items" :fields="$options.fields">
45
45
  <template #head(column_one)>
46
- <div>Column One</div>
46
+ <div>First column</div>
47
47
  <!-- This is the column head for the first object in `fields` -->
48
48
  </template>
49
49
 
@@ -63,20 +63,20 @@ export const Default = (args, { argTypes }) => ({
63
63
  fields: [
64
64
  {
65
65
  key: 'column_one',
66
- label: 'Column One',
66
+ label: 'First column',
67
67
  variant: 'secondary',
68
68
  sortable: true,
69
69
  isRowHeader: false,
70
70
  },
71
71
  {
72
72
  key: 'col_2',
73
- label: 'Column 2',
73
+ label: 'Second column',
74
74
  formatter: (value) => value,
75
75
  },
76
76
  {
77
77
  key: 'col_three',
78
78
  sortable: true,
79
- label: 'Column 2',
79
+ label: 'Third column',
80
80
  formatter: (value) => value,
81
81
  thClass: 'gl-text-right',
82
82
  tdClass: 'gl-text-right',
@@ -37,13 +37,13 @@ export default {
37
37
  fields: [
38
38
  {
39
39
  key: 'column_one',
40
- label: __('Column One'),
40
+ label: __('First column'),
41
41
  thClass: 'w-60p',
42
42
  tdClass: 'table-col d-flex'
43
43
  },
44
44
  {
45
45
  key: 'col_2',
46
- label: __('Column 2'),
46
+ label: __('Second column'),
47
47
  thClass: 'w-15p',
48
48
  tdClass: 'table-col d-flex'
49
49
  },
@@ -56,7 +56,7 @@ export default {
56
56
  :fields="$options.fields"
57
57
  >
58
58
  <template #head(column_one)>
59
- <div>Column One</div><!-- This is the column head for the first object in `fields` -->
59
+ <div>First column</div><!-- This is the column head for the first object in `fields` -->
60
60
  </template>
61
61
 
62
62
  <template #cell(column_one)>
@@ -4,13 +4,13 @@ import GlTableLite from './table_lite.vue';
4
4
  const fieldsMock = [
5
5
  {
6
6
  key: 'column_one',
7
- label: 'Column One',
7
+ label: 'First column',
8
8
  thClass: 'w-60p',
9
9
  tdClass: 'table-col',
10
10
  },
11
11
  {
12
12
  key: 'column_two',
13
- label: 'Column Two',
13
+ label: 'Second column',
14
14
  thClass: 'w-60p',
15
15
  tdClass: 'table-col',
16
16
  },
@@ -1,5 +1,5 @@
1
1
  The `presentation` property allows you to change between a stacked and tiled presentation style. It
2
- is only setup to accept `stacked` or `tiled` as values, the default value is `tiled`.
2
+ is only setup to accept `stacked` or `tiled` as values, the default value is `stacked`.
3
3
 
4
4
  The `stacked` presentation allows to view multiple series of the same stack as a single column,
5
5
  while `tiled` presents the information in multiple columns for each series of a stack.
@@ -6757,36 +6757,6 @@ $gl-animate-skeleton-loader-max-width: 64 * $grid-size;
6757
6757
  margin-left: -#{$gl-spacing-scale-6} !important;
6758
6758
  margin-right: -#{$gl-spacing-scale-6} !important;
6759
6759
  }
6760
- .gl-gap-x-3 {
6761
- > * + * {
6762
- margin-left: #{$gl-spacing-scale-3};
6763
- }
6764
- }
6765
- .gl-gap-x-3\! {
6766
- > * + * {
6767
- margin-left: #{$gl-spacing-scale-3} !important;
6768
- }
6769
- }
6770
- .gl-gap-x-5 {
6771
- > * + * {
6772
- margin-left: #{$gl-spacing-scale-5};
6773
- }
6774
- }
6775
- .gl-gap-x-5\! {
6776
- > * + * {
6777
- margin-left: #{$gl-spacing-scale-5} !important;
6778
- }
6779
- }
6780
- .gl-gap-y-3 {
6781
- > * + * {
6782
- margin-top: #{$gl-spacing-scale-3};
6783
- }
6784
- }
6785
- .gl-gap-y-3\! {
6786
- > * + * {
6787
- margin-top: #{$gl-spacing-scale-3} !important;
6788
- }
6789
- }
6790
6760
  .gl-gap-1 {
6791
6761
  gap: $gl-spacing-scale-1;
6792
6762
  }
@@ -864,24 +864,6 @@
864
864
  * - Utilities should be refactored to use gap after dropping Safari 13.x support
865
865
  */
866
866
 
867
- @mixin gl-gap-x-3 {
868
- > * + * {
869
- margin-left: #{$gl-spacing-scale-3};
870
- }
871
- }
872
-
873
- @mixin gl-gap-x-5 {
874
- > * + * {
875
- margin-left: #{$gl-spacing-scale-5};
876
- }
877
- }
878
-
879
- @mixin gl-gap-y-3 {
880
- > * + * {
881
- margin-top: #{$gl-spacing-scale-3};
882
- }
883
- }
884
-
885
867
  @mixin gl-gap-1 {
886
868
  gap: $gl-spacing-scale-1;
887
869
  }
@@ -3,7 +3,7 @@
3
3
  "primary": {
4
4
  "$value": "#ececef",
5
5
  "$type": "color",
6
- "$description": "Use text.color.strong instead",
6
+ "$description": "Use text.color.default instead",
7
7
  "deprecated": true,
8
8
  "themeable": true
9
9
  },
@@ -3,7 +3,7 @@
3
3
  "primary": {
4
4
  "$value": "#333238",
5
5
  "$type": "color",
6
- "$description": "Use text.color.strong instead",
6
+ "$description": "Use text.color.default instead",
7
7
  "deprecated": true,
8
8
  "themeable": true
9
9
  },