@gitlab/ui 80.0.0 → 80.1.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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Wed, 01 May 2024 16:11:38 GMT
3
+ * Generated on Fri, 03 May 2024 04:11:25 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Wed, 01 May 2024 16:11:38 GMT
3
+ * Generated on Fri, 03 May 2024 04:11:25 GMT
4
4
  */
5
5
 
6
6
  :root.gl-dark {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Wed, 01 May 2024 16:11:38 GMT
3
+ * Generated on Fri, 03 May 2024 04:11:25 GMT
4
4
  */
5
5
 
6
6
  export const DATA_VIZ_GREEN_50 = "#133a03";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Wed, 01 May 2024 16:11:38 GMT
3
+ * Generated on Fri, 03 May 2024 04:11:25 GMT
4
4
  */
5
5
 
6
6
  export const DATA_VIZ_GREEN_50 = "#ddfab7";
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Wed, 01 May 2024 16:11:38 GMT
3
+ // Generated on Fri, 03 May 2024 04:11:26 GMT
4
4
 
5
5
  $gl-text-color-disabled: #89888d !default; // Used for disabled text.
6
6
  $gl-text-color-link: #63a6e9 !default; // Used for default text links.
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Wed, 01 May 2024 16:11:38 GMT
3
+ // Generated on Fri, 03 May 2024 04:11:25 GMT
4
4
 
5
5
  $gl-text-color-disabled: #89888d !default; // Used for disabled text.
6
6
  $gl-text-color-success: #217645 !default; // Used for text indicating success or validity.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "80.0.0",
3
+ "version": "80.1.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -80,7 +80,7 @@
80
80
  "peerDependencies": {
81
81
  "@gitlab/svgs": "^1.116.0 || ^2.0.0 || ^3.0.0",
82
82
  "bootstrap": ">=4.5.3 <=4.6.2",
83
- "dompurify": "^2.4.7 || ^3.0.5",
83
+ "dompurify": ">=2.5.2 <3.0.0 || >=3.1.2",
84
84
  "emoji-regex": ">=10.0.0",
85
85
  "pikaday": "^1.8.0",
86
86
  "tailwindcss": "^3",
@@ -93,10 +93,10 @@
93
93
  },
94
94
  "devDependencies": {
95
95
  "@arkweid/lefthook": "0.7.7",
96
- "@babel/core": "^7.24.4",
96
+ "@babel/core": "^7.24.5",
97
97
  "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
98
98
  "@babel/plugin-proposal-optional-chaining": "^7.21.0",
99
- "@babel/preset-env": "^7.24.4",
99
+ "@babel/preset-env": "^7.24.5",
100
100
  "@babel/preset-react": "^7.24.1",
101
101
  "@cypress/grep": "^4.0.1",
102
102
  "@gitlab/eslint-plugin": "19.5.0",
@@ -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
- "dompurify": "^3.0.0",
137
+ "dompurify": "^3.1.2",
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": "3.0.0",
141
+ "eslint-plugin-cypress": "3.0.3",
142
142
  "eslint-plugin-storybook": "0.8.0",
143
143
  "glob": "10.3.3",
144
144
  "identity-obj-proxy": "^3.0.0",
@@ -100,6 +100,7 @@ $gl-drawer-scrim-gradient: linear-gradient(to bottom, $transparent-rgba, $white)
100
100
  }
101
101
 
102
102
  .gl-drawer-close-button {
103
+ @include gl-align-self-start;
103
104
  @include gl-bg-none;
104
105
  @include gl-border-none;
105
106
  }
@@ -144,7 +144,7 @@ export const WithActions = (_args, { viewMode }) => ({
144
144
  <gl-button @click="toggle">Toggle Drawer</gl-button>
145
145
  ${createSidebarTemplate(`
146
146
  <template #title>
147
- <h3>custom-network-policy</h3>
147
+ <h3>custom-network-policy multiple lines headline</h3>
148
148
  </template>
149
149
  <template #header>
150
150
  <div class="gl-mt-5">
@@ -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
  },