@gitlab/ui 76.0.0 → 76.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ # [76.1.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v76.0.1...v76.1.0) (2024-02-27)
2
+
3
+
4
+ ### Features
5
+
6
+ * **DesignTokens:** add text design tokens ([7eb5a49](https://gitlab.com/gitlab-org/gitlab-ui/commit/7eb5a49ef97ba40a9d0c1ceb4e2d23b156dc7863))
7
+
8
+ ## [76.0.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v76.0.0...v76.0.1) (2024-02-27)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **tailwind:** add font sizes to the preset ([02f26b3](https://gitlab.com/gitlab-org/gitlab-ui/commit/02f26b34c39bd0d84e86cec938eefa1f3a15e003))
14
+ * **tailwind:** add font weights to the preset ([84fe175](https://gitlab.com/gitlab-org/gitlab-ui/commit/84fe175a0dfcaf704ab6041479444b58e3608a7e))
15
+
1
16
  # [76.0.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v75.2.0...v76.0.0) (2024-02-22)
2
17
 
3
18
 
@@ -9,21 +9,36 @@ const methods = {
9
9
  isAlpha(value) {
10
10
  return value.startsWith('rgba(');
11
11
  },
12
+ isBackgroundColor(property) {
13
+ return property === 'backgroundColor';
14
+ },
12
15
  getTokenName(token) {
13
16
  return token.path.filter(Boolean).join('.');
14
17
  },
15
- getTextColorClass(value) {
18
+ getClasses(property, value) {
16
19
  if (this.isAlpha(value)) return '';
20
+ if (!this.isBackgroundColor(property)) return '';
17
21
  const textColorVariant = colorFromBackground(value, 4.5);
18
22
  return {
19
23
  'gl-text-gray-950': textColorVariant === 'dark',
20
24
  'gl-text-white': textColorVariant === 'light'
21
25
  };
26
+ },
27
+ getStyle(property, value) {
28
+ if (this.isBackgroundColor(property)) {
29
+ return {
30
+ backgroundColor: value
31
+ };
32
+ }
33
+ return {
34
+ color: value
35
+ };
22
36
  }
23
37
  };
24
- const template = function () {
25
- let lightBackground = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : WHITE;
26
- let darkBackground = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : GRAY_950;
38
+ const colorTemplate = function () {
39
+ let property = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'backgroundColor';
40
+ let lightBackground = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : WHITE;
41
+ let darkBackground = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : GRAY_950;
27
42
  return `
28
43
  <ul
29
44
  class="gl-list-style-none gl-m-0 gl-p-0"
@@ -32,8 +47,8 @@ const template = function () {
32
47
  v-for="token in tokens"
33
48
  :key="token.name"
34
49
  class="gl-display-flex gl-flex-wrap gl-align-items-center gl-justify-content-space-between gl-gap-3 gl-p-3"
35
- :class="getTextColorClass(token.value)"
36
- :style="{ backgroundColor: token.value }"
50
+ :class="getClasses('${property}', token.value)"
51
+ :style="getStyle('${property}', token.value)"
37
52
  >
38
53
  <code class="gl-reset-color">{{ getTokenName(token) }}</code>
39
54
  <div class="gl-display-flex gl-align-items-center gl-gap-3">
@@ -48,7 +63,12 @@ const template = function () {
48
63
  const colorTokenStoryOptions = {
49
64
  components,
50
65
  methods,
51
- template: template()
66
+ template: colorTemplate('backgroundColor')
67
+ };
68
+ const colorTextTokenStoryOptions = {
69
+ components,
70
+ methods,
71
+ template: colorTemplate('color')
52
72
  };
53
73
 
54
- export { colorTokenStoryOptions, components, methods, template };
74
+ export { colorTextTokenStoryOptions, colorTokenStoryOptions, components, methods };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 22 Feb 2024 15:02:54 GMT
3
+ * Generated on Tue, 27 Feb 2024 14:33:51 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -234,4 +234,7 @@
234
234
  --data-viz-green-200: #b0d97b;
235
235
  --data-viz-green-100: #c6ed94;
236
236
  --data-viz-green-50: #ddfab7;
237
+ --gl-text-tertiary: var(--gray-400);
238
+ --gl-text-secondary: var(--gray-500);
239
+ --gl-text-primary: var(--gray-900);
237
240
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 22 Feb 2024 15:02:54 GMT
3
+ * Generated on Tue, 27 Feb 2024 14:33:51 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 Thu, 22 Feb 2024 15:02:54 GMT
3
+ * Generated on Tue, 27 Feb 2024 14:33:51 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 Thu, 22 Feb 2024 15:02:54 GMT
3
+ * Generated on Tue, 27 Feb 2024 14:33:51 GMT
4
4
  */
5
5
 
6
6
  export const DATA_VIZ_GREEN_50 = "#ddfab7";
@@ -233,3 +233,6 @@ export const GL_LINE_HEIGHT_36 = "2.25rem";
233
233
  export const GL_LINE_HEIGHT_42 = "2.625rem";
234
234
  export const GL_LINE_HEIGHT_44 = "2.75rem";
235
235
  export const GL_LINE_HEIGHT_52 = "3.25rem";
236
+ export const GL_TEXT_PRIMARY = "#333238";
237
+ export const GL_TEXT_SECONDARY = "#737278";
238
+ export const GL_TEXT_TERTIARY = "#89888d";
@@ -219,7 +219,10 @@
219
219
  "t-white-a-02": "rgba(255, 255, 255, 0.02)",
220
220
  "t-white-a-04": "rgba(255, 255, 255, 0.04)",
221
221
  "t-white-a-06": "rgba(255, 255, 255, 0.06)",
222
- "t-white-a-08": "rgba(255, 255, 255, 0.08)"
222
+ "t-white-a-08": "rgba(255, 255, 255, 0.08)",
223
+ "text-primary": "#ececef",
224
+ "text-secondary": "#89888d",
225
+ "text-tertiary": "#737278"
223
226
  },
224
227
  "dimension": {
225
228
  "line-height-12": "0.75rem",
@@ -4795,5 +4795,61 @@
4795
4795
  "52"
4796
4796
  ]
4797
4797
  }
4798
+ },
4799
+ "text": {
4800
+ "primary": {
4801
+ "value": "#ececef",
4802
+ "$type": "color",
4803
+ "themeable": true,
4804
+ "filePath": "/builds/gitlab-org/gitlab-ui/src/tokens/text.tokens.json",
4805
+ "isSource": false,
4806
+ "original": {
4807
+ "value": "{gray.900}",
4808
+ "$type": "color",
4809
+ "themeable": true
4810
+ },
4811
+ "name": "TEXT_PRIMARY",
4812
+ "attributes": {},
4813
+ "path": [
4814
+ "text",
4815
+ "primary"
4816
+ ]
4817
+ },
4818
+ "secondary": {
4819
+ "value": "#89888d",
4820
+ "$type": "color",
4821
+ "themeable": true,
4822
+ "filePath": "/builds/gitlab-org/gitlab-ui/src/tokens/text.tokens.json",
4823
+ "isSource": false,
4824
+ "original": {
4825
+ "value": "{gray.500}",
4826
+ "$type": "color",
4827
+ "themeable": true
4828
+ },
4829
+ "name": "TEXT_SECONDARY",
4830
+ "attributes": {},
4831
+ "path": [
4832
+ "text",
4833
+ "secondary"
4834
+ ]
4835
+ },
4836
+ "tertiary": {
4837
+ "value": "#737278",
4838
+ "$type": "color",
4839
+ "themeable": true,
4840
+ "filePath": "/builds/gitlab-org/gitlab-ui/src/tokens/text.tokens.json",
4841
+ "isSource": false,
4842
+ "original": {
4843
+ "value": "{gray.400}",
4844
+ "$type": "color",
4845
+ "themeable": true
4846
+ },
4847
+ "name": "TEXT_TERTIARY",
4848
+ "attributes": {},
4849
+ "path": [
4850
+ "text",
4851
+ "tertiary"
4852
+ ]
4853
+ }
4798
4854
  }
4799
4855
  }
@@ -219,7 +219,10 @@
219
219
  "t-white-a-02": "rgba(255, 255, 255, 0.02)",
220
220
  "t-white-a-04": "rgba(255, 255, 255, 0.04)",
221
221
  "t-white-a-06": "rgba(255, 255, 255, 0.06)",
222
- "t-white-a-08": "rgba(255, 255, 255, 0.08)"
222
+ "t-white-a-08": "rgba(255, 255, 255, 0.08)",
223
+ "text-primary": "#333238",
224
+ "text-secondary": "#737278",
225
+ "text-tertiary": "#89888d"
223
226
  },
224
227
  "dimension": {
225
228
  "line-height-12": "0.75rem",
@@ -4795,5 +4795,61 @@
4795
4795
  "52"
4796
4796
  ]
4797
4797
  }
4798
+ },
4799
+ "text": {
4800
+ "primary": {
4801
+ "value": "#333238",
4802
+ "$type": "color",
4803
+ "themeable": true,
4804
+ "filePath": "/builds/gitlab-org/gitlab-ui/src/tokens/text.tokens.json",
4805
+ "isSource": false,
4806
+ "original": {
4807
+ "value": "{gray.900}",
4808
+ "$type": "color",
4809
+ "themeable": true
4810
+ },
4811
+ "name": "TEXT_PRIMARY",
4812
+ "attributes": {},
4813
+ "path": [
4814
+ "text",
4815
+ "primary"
4816
+ ]
4817
+ },
4818
+ "secondary": {
4819
+ "value": "#737278",
4820
+ "$type": "color",
4821
+ "themeable": true,
4822
+ "filePath": "/builds/gitlab-org/gitlab-ui/src/tokens/text.tokens.json",
4823
+ "isSource": false,
4824
+ "original": {
4825
+ "value": "{gray.500}",
4826
+ "$type": "color",
4827
+ "themeable": true
4828
+ },
4829
+ "name": "TEXT_SECONDARY",
4830
+ "attributes": {},
4831
+ "path": [
4832
+ "text",
4833
+ "secondary"
4834
+ ]
4835
+ },
4836
+ "tertiary": {
4837
+ "value": "#89888d",
4838
+ "$type": "color",
4839
+ "themeable": true,
4840
+ "filePath": "/builds/gitlab-org/gitlab-ui/src/tokens/text.tokens.json",
4841
+ "isSource": false,
4842
+ "original": {
4843
+ "value": "{gray.400}",
4844
+ "$type": "color",
4845
+ "themeable": true
4846
+ },
4847
+ "name": "TEXT_TERTIARY",
4848
+ "attributes": {},
4849
+ "path": [
4850
+ "text",
4851
+ "tertiary"
4852
+ ]
4853
+ }
4798
4854
  }
4799
4855
  }
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Thu, 22 Feb 2024 15:02:54 GMT
3
+ // Generated on Tue, 27 Feb 2024 14:33:51 GMT
4
4
 
5
5
  $red-950: #fff4f3;
6
6
  $red-900: #fcf1ef;
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Thu, 22 Feb 2024 15:02:54 GMT
3
+ // Generated on Tue, 27 Feb 2024 14:33:51 GMT
4
4
 
5
5
  $gl-line-height-52: 3.25rem;
6
6
  $gl-line-height-44: 2.75rem;
@@ -232,3 +232,6 @@ $data-viz-green-300: #94c25e !default;
232
232
  $data-viz-green-200: #b0d97b !default;
233
233
  $data-viz-green-100: #c6ed94 !default;
234
234
  $data-viz-green-50: #ddfab7 !default;
235
+ $gl-text-tertiary: $gray-400 !default;
236
+ $gl-text-secondary: $gray-500 !default;
237
+ $gl-text-primary: $gray-900 !default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "76.0.0",
3
+ "version": "76.1.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -102,23 +102,23 @@
102
102
  "@gitlab/eslint-plugin": "19.4.0",
103
103
  "@gitlab/fonts": "^1.3.0",
104
104
  "@gitlab/stylelint-config": "6.1.0",
105
- "@gitlab/svgs": "3.84.0",
105
+ "@gitlab/svgs": "3.85.0",
106
106
  "@rollup/plugin-commonjs": "^11.1.0",
107
107
  "@rollup/plugin-node-resolve": "^7.1.3",
108
108
  "@rollup/plugin-replace": "^2.3.2",
109
- "@storybook/addon-a11y": "^7.6.16",
110
- "@storybook/addon-docs": "^7.6.16",
111
- "@storybook/addon-essentials": "^7.6.16",
112
- "@storybook/addon-interactions": "^7.6.16",
113
- "@storybook/addon-viewport": "^7.6.16",
114
- "@storybook/builder-webpack5": "^7.6.16",
115
- "@storybook/test": "^7.6.16",
109
+ "@storybook/addon-a11y": "^7.6.17",
110
+ "@storybook/addon-docs": "^7.6.17",
111
+ "@storybook/addon-essentials": "^7.6.17",
112
+ "@storybook/addon-interactions": "^7.6.17",
113
+ "@storybook/addon-viewport": "^7.6.17",
114
+ "@storybook/builder-webpack5": "^7.6.17",
115
+ "@storybook/test": "^7.6.17",
116
116
  "@storybook/test-runner": "0.16.0",
117
- "@storybook/theming": "^7.6.16",
118
- "@storybook/vue": "^7.6.16",
119
- "@storybook/vue-webpack5": "^7.6.16",
120
- "@storybook/vue3": "^7.6.16",
121
- "@storybook/vue3-webpack5": "^7.6.16",
117
+ "@storybook/theming": "^7.6.17",
118
+ "@storybook/vue": "^7.6.17",
119
+ "@storybook/vue-webpack5": "^7.6.17",
120
+ "@storybook/vue3": "^7.6.17",
121
+ "@storybook/vue3-webpack5": "^7.6.17",
122
122
  "@types/jest-image-snapshot": "^6.4.0",
123
123
  "@vue/compat": "^3.2.40",
124
124
  "@vue/compiler-sfc": "^3.2.40",
@@ -131,7 +131,7 @@
131
131
  "babel-jest": "29.0.1",
132
132
  "babel-loader": "^8.0.5",
133
133
  "bootstrap": "4.6.2",
134
- "cypress": "13.6.4",
134
+ "cypress": "13.6.6",
135
135
  "cypress-axe": "^1.4.0",
136
136
  "cypress-real-events": "^1.11.0",
137
137
  "dompurify": "^3.0.0",
@@ -170,7 +170,7 @@
170
170
  "sass-loader": "^10.2.0",
171
171
  "sass-true": "^6.1.0",
172
172
  "start-server-and-test": "^1.10.6",
173
- "storybook": "^7.6.16",
173
+ "storybook": "^7.6.17",
174
174
  "storybook-dark-mode": "3.0.3",
175
175
  "style-dictionary": "^3.8.0",
176
176
  "stylelint": "15.10.2",
@@ -1,5 +1,5 @@
1
1
  import DOMPurify from 'dompurify';
2
- import GlSafeHtml from './safe_html';
2
+ import { SafeHtmlDirective as SafeHtml } from './safe_html';
3
3
  import readme from './safe_html.md';
4
4
 
5
5
  const { sanitize } = DOMPurify;
@@ -12,7 +12,7 @@ const generateProps = ({
12
12
 
13
13
  export const Default = (_args, { argTypes }) => ({
14
14
  directives: {
15
- GlSafeHtml,
15
+ SafeHtml,
16
16
  },
17
17
  props: Object.keys(argTypes),
18
18
  computed: {
@@ -38,7 +38,7 @@ export const Default = (_args, { argTypes }) => ({
38
38
  <tr>
39
39
  <td><strong>v-safe-html</strong></td>
40
40
  <td><code>{{ sanitizedHtml }}</code></td>
41
- <td v-gl-safe-html="unsafeHTML"></td>
41
+ <td v-safe-html="unsafeHTML"></td>
42
42
  </tr>
43
43
  </tbody>
44
44
  </table>
@@ -48,7 +48,7 @@ Default.args = generateProps();
48
48
 
49
49
  export default {
50
50
  title: 'directives/safe-html-directive',
51
- component: GlSafeHtml,
51
+ component: SafeHtml,
52
52
  tags: ['skip-visual-test'],
53
53
  parameters: {
54
54
  docs: {
@@ -18,6 +18,7 @@ $gl-spacing-scale-11-5: 9 * $grid-size;
18
18
  $gl-spacing-scale-12: 10 * $grid-size;
19
19
  $gl-spacing-scale-13: 12 * $grid-size;
20
20
  $gl-spacing-scale-15: 15 * $grid-size;
21
+ $gl-spacing-scale-18: 18 * $grid-size;
21
22
  $gl-spacing-scale-20: 20 * $grid-size;
22
23
  $gl-spacing-scale-26: 26 * $grid-size;
23
24
  $gl-spacing-scale-28: 28 * $grid-size;
@@ -10,20 +10,34 @@ export const methods = {
10
10
  isAlpha(value) {
11
11
  return value.startsWith('rgba(');
12
12
  },
13
+ isBackgroundColor(property) {
14
+ return property === 'backgroundColor';
15
+ },
13
16
  getTokenName(token) {
14
17
  return token.path.filter(Boolean).join('.');
15
18
  },
16
- getTextColorClass(value) {
19
+ getClasses(property, value) {
17
20
  if (this.isAlpha(value)) return '';
21
+ if (!this.isBackgroundColor(property)) return '';
18
22
  const textColorVariant = colorFromBackground(value, 4.5);
19
23
  return {
20
24
  'gl-text-gray-950': textColorVariant === 'dark',
21
25
  'gl-text-white': textColorVariant === 'light',
22
26
  };
23
27
  },
28
+ getStyle(property, value) {
29
+ if (this.isBackgroundColor(property)) {
30
+ return { backgroundColor: value };
31
+ }
32
+ return { color: value };
33
+ },
24
34
  };
25
35
 
26
- export const template = (lightBackground = WHITE, darkBackground = GRAY_950) => `
36
+ const colorTemplate = (
37
+ property = 'backgroundColor',
38
+ lightBackground = WHITE,
39
+ darkBackground = GRAY_950
40
+ ) => `
27
41
  <ul
28
42
  class="gl-list-style-none gl-m-0 gl-p-0"
29
43
  >
@@ -31,8 +45,8 @@ export const template = (lightBackground = WHITE, darkBackground = GRAY_950) =>
31
45
  v-for="token in tokens"
32
46
  :key="token.name"
33
47
  class="gl-display-flex gl-flex-wrap gl-align-items-center gl-justify-content-space-between gl-gap-3 gl-p-3"
34
- :class="getTextColorClass(token.value)"
35
- :style="{ backgroundColor: token.value }"
48
+ :class="getClasses('${property}', token.value)"
49
+ :style="getStyle('${property}', token.value)"
36
50
  >
37
51
  <code class="gl-reset-color">{{ getTokenName(token) }}</code>
38
52
  <div class="gl-display-flex gl-align-items-center gl-gap-3">
@@ -47,5 +61,11 @@ export const template = (lightBackground = WHITE, darkBackground = GRAY_950) =>
47
61
  export const colorTokenStoryOptions = {
48
62
  components,
49
63
  methods,
50
- template: template(),
64
+ template: colorTemplate('backgroundColor'),
65
+ };
66
+
67
+ export const colorTextTokenStoryOptions = {
68
+ components,
69
+ methods,
70
+ template: colorTemplate('color'),
51
71
  };
@@ -0,0 +1,19 @@
1
+ {
2
+ "text": {
3
+ "primary": {
4
+ "$value": "{gray.900}",
5
+ "$type": "color",
6
+ "themeable": true
7
+ },
8
+ "secondary": {
9
+ "$value": "{gray.500}",
10
+ "$type": "color",
11
+ "themeable": true
12
+ },
13
+ "tertiary": {
14
+ "$value": "{gray.400}",
15
+ "$type": "color",
16
+ "themeable": true
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,15 @@
1
+ import COMPILED_TOKENS from '../../dist/tokens/json/tokens.json';
2
+ import { colorTextTokenStoryOptions } from './common_story_options';
3
+
4
+ const generateProps = ({ tokens = {} } = {}) => ({ tokens });
5
+
6
+ export const Default = (args, { argTypes }) => ({
7
+ props: Object.keys(argTypes),
8
+ ...colorTextTokenStoryOptions,
9
+ });
10
+ Default.args = generateProps({ name: 'text', tokens: COMPILED_TOKENS.text });
11
+
12
+ // eslint-disable-next-line storybook/csf-component
13
+ export default {
14
+ title: 'tokens/text',
15
+ };
@@ -66,5 +66,18 @@ module.exports = {
66
66
  ...themeColors,
67
67
  },
68
68
  spacing,
69
+ fontSize: {
70
+ xs: '0.625rem',
71
+ sm: '0.75rem',
72
+ base: '0.875rem',
73
+ lg: '1rem',
74
+ },
75
+ fontWeight: {
76
+ 100: 100,
77
+ 300: 300,
78
+ normal: 400,
79
+ semibold: 500,
80
+ bold: 600,
81
+ },
69
82
  },
70
83
  };