@gitlab/ui 77.2.0 → 77.4.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 (38) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/components/base/new_dropdowns/base_dropdown/base_dropdown.js +10 -3
  3. package/dist/components/base/sorting/sorting.js +1 -4
  4. package/dist/index.css +2 -2
  5. package/dist/index.css.map +1 -1
  6. package/dist/tokens/common_story_options.js +28 -68
  7. package/dist/tokens/css/tokens.css +1 -1
  8. package/dist/tokens/css/tokens.dark.css +1 -1
  9. package/dist/tokens/js/tokens.dark.js +1 -1
  10. package/dist/tokens/js/tokens.js +1 -1
  11. package/dist/tokens/scss/_tokens.dark.scss +1 -1
  12. package/dist/tokens/scss/_tokens.scss +1 -1
  13. package/dist/tokens/tokens_story.js +83 -0
  14. package/dist/utility_classes.css +1 -1
  15. package/dist/utility_classes.css.map +1 -1
  16. package/package.json +1 -1
  17. package/src/components/base/button/button.stories.js +0 -30
  18. package/src/components/base/button_group/button_group.md +22 -0
  19. package/src/components/base/button_group/button_group.stories.js +92 -12
  20. package/src/components/base/new_dropdowns/base_dropdown/base_dropdown.spec.js +1 -1
  21. package/src/components/base/new_dropdowns/base_dropdown/base_dropdown.vue +8 -1
  22. package/src/components/base/new_dropdowns/disclosure/disclosure_dropdown.md +13 -9
  23. package/src/components/base/new_dropdowns/disclosure/disclosure_dropdown.scss +0 -32
  24. package/src/components/base/new_dropdowns/dropdown.scss +58 -2
  25. package/src/components/base/new_dropdowns/listbox/listbox.md +19 -15
  26. package/src/components/base/sorting/sorting.vue +1 -9
  27. package/src/scss/utilities.scss +12 -0
  28. package/src/scss/utility-mixins/flex.scss +6 -0
  29. package/src/tokens/color.dark.tokens.stories.js +8 -38
  30. package/src/tokens/color.data_viz.dark.tokens.stories.js +7 -27
  31. package/src/tokens/color.data_viz.tokens.stories.js +7 -27
  32. package/src/tokens/color.theme.dark.tokens.stories.js +8 -32
  33. package/src/tokens/color.theme.tokens.stories.js +8 -32
  34. package/src/tokens/color.tokens.stories.js +8 -38
  35. package/src/tokens/color.transparency.tokens.stories.js +5 -14
  36. package/src/tokens/common_story_options.js +21 -67
  37. package/src/tokens/text.tokens.stories.js +4 -7
  38. package/src/tokens/tokens_story.vue +73 -0
@@ -1,74 +1,34 @@
1
1
  import { WHITE, GRAY_950 } from '../../dist/tokens/js/tokens';
2
- import { colorFromBackground } from '../utils/utils';
3
- import GlColorContrast from '../internal/color_contrast/color_contrast';
2
+ import TokensStory from './tokens_story';
4
3
 
5
- const components = {
6
- GlColorContrast
7
- };
8
- const methods = {
9
- isAlpha(value) {
10
- return value.startsWith('rgba(');
11
- },
12
- isBackgroundColor(property) {
13
- return property === 'backgroundColor';
14
- },
15
- getTokenName(token) {
16
- return token.path.filter(Boolean).join('.');
17
- },
18
- getClasses(property, value) {
19
- if (this.isAlpha(value)) return '';
20
- if (!this.isBackgroundColor(property)) return '';
21
- const textColorVariant = colorFromBackground(value, 4.5);
22
- return {
23
- 'gl-text-gray-950': textColorVariant === 'dark',
24
- 'gl-text-white': textColorVariant === 'light'
25
- };
26
- },
27
- getStyle(property, value) {
28
- if (this.isBackgroundColor(property)) {
29
- return {
30
- backgroundColor: value
31
- };
32
- }
4
+ const createDesignTokenStory = function () {
5
+ let {
6
+ tokens = {},
7
+ isBackgroundColorStory = true,
8
+ containerClass = ''
9
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
10
+ const Story = (args, _ref) => {
11
+ let {
12
+ argTypes
13
+ } = _ref;
33
14
  return {
34
- color: value
15
+ props: Object.keys(argTypes),
16
+ components: {
17
+ TokensStory
18
+ },
19
+ provide: {
20
+ containerClass,
21
+ isBackgroundColorStory,
22
+ lightBackground: WHITE,
23
+ darkBackground: GRAY_950
24
+ },
25
+ template: `<tokens-story v-bind="$props" />`
35
26
  };
36
- }
37
- };
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;
42
- return `
43
- <ul
44
- class="gl-list-style-none gl-m-0 gl-p-0"
45
- >
46
- <li
47
- v-for="token in tokens"
48
- :key="token.name"
49
- class="gl-display-flex gl-flex-wrap gl-align-items-center gl-justify-content-space-between gl-gap-3 gl-p-3"
50
- :class="getClasses('${property}', token.value)"
51
- :style="getStyle('${property}', token.value)"
52
- >
53
- <code class="gl-reset-color">{{ getTokenName(token) }}</code>
54
- <div class="gl-display-flex gl-align-items-center gl-gap-3">
55
- <code class="gl-reset-color">{{ token.value }}</code>
56
- <gl-color-contrast v-if="!isAlpha(token.value)" :foreground="token.value" background="${darkBackground}" />
57
- <gl-color-contrast v-if="!isAlpha(token.value)" :foreground="token.value" background="${lightBackground}" />
58
- </div>
59
- </li>
60
- </ul>
61
- `;
62
- };
63
- const colorTokenStoryOptions = {
64
- components,
65
- methods,
66
- template: colorTemplate('backgroundColor')
67
- };
68
- const colorTextTokenStoryOptions = {
69
- components,
70
- methods,
71
- template: colorTemplate('color')
27
+ };
28
+ Story.args = {
29
+ tokens
30
+ };
31
+ return Story;
72
32
  };
73
33
 
74
- export { colorTextTokenStoryOptions, colorTokenStoryOptions, components, methods };
34
+ export { createDesignTokenStory };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 27 Feb 2024 18:50:13 GMT
3
+ * Generated on Wed, 28 Feb 2024 13:41:10 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 27 Feb 2024 18:50:13 GMT
3
+ * Generated on Wed, 28 Feb 2024 13:41:11 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 Tue, 27 Feb 2024 18:50:13 GMT
3
+ * Generated on Wed, 28 Feb 2024 13:41:11 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 Tue, 27 Feb 2024 18:50:13 GMT
3
+ * Generated on Wed, 28 Feb 2024 13:41:10 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 Tue, 27 Feb 2024 18:50:13 GMT
3
+ // Generated on Wed, 28 Feb 2024 13:41:11 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 Tue, 27 Feb 2024 18:50:13 GMT
3
+ // Generated on Wed, 28 Feb 2024 13:41:10 GMT
4
4
 
5
5
  $gl-line-height-52: 3.25rem;
6
6
  $gl-line-height-44: 2.75rem;
@@ -0,0 +1,83 @@
1
+ import { colorFromBackground } from '../utils/utils';
2
+ import GlColorContrast from '../internal/color_contrast/color_contrast';
3
+ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
4
+
5
+ var script = {
6
+ name: 'TokensStory',
7
+ components: {
8
+ GlColorContrast
9
+ },
10
+ inject: ['isBackgroundColorStory', 'lightBackground', 'darkBackground', 'containerClass'],
11
+ props: {
12
+ tokens: {
13
+ type: Object,
14
+ required: false,
15
+ default: () => ({})
16
+ }
17
+ },
18
+ methods: {
19
+ isAlpha(value) {
20
+ return value.startsWith('rgba(');
21
+ },
22
+ getTokenName(token) {
23
+ return token.path.filter(Boolean).join('.');
24
+ },
25
+ getClasses(value) {
26
+ if (this.isAlpha(value)) return '';
27
+ if (!this.isBackgroundColorStory) return '';
28
+ const textColorVariant = colorFromBackground(value, 4.5);
29
+ return {
30
+ 'gl-text-gray-950': textColorVariant === 'dark',
31
+ 'gl-text-white': textColorVariant === 'light'
32
+ };
33
+ },
34
+ getStyle(value) {
35
+ if (this.isBackgroundColorStory) {
36
+ return {
37
+ backgroundColor: value
38
+ };
39
+ }
40
+ return {
41
+ color: value
42
+ };
43
+ }
44
+ }
45
+ };
46
+
47
+ /* script */
48
+ const __vue_script__ = script;
49
+
50
+ /* template */
51
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{class:_vm.containerClass},[_c('ul',{staticClass:"gl-list-style-none gl-m-0 gl-p-0"},_vm._l((_vm.tokens),function(token){return _c('li',{key:token.name,staticClass:"gl-display-flex gl-flex-wrap gl-align-items-center gl-justify-content-space-between gl-gap-3 gl-p-3",class:_vm.getClasses(token.value),style:(_vm.getStyle(token.value))},[_c('code',{staticClass:"gl-reset-color"},[_vm._v(_vm._s(_vm.getTokenName(token)))]),_vm._v(" "),_c('div',{staticClass:"gl-display-flex gl-align-items-center gl-gap-3"},[_c('code',{staticClass:"gl-reset-color"},[_vm._v(_vm._s(token.value))]),_vm._v(" "),(!_vm.isAlpha(token.value))?_c('gl-color-contrast',{attrs:{"foreground":token.value,"background":_vm.darkBackground}}):_vm._e(),_vm._v(" "),(!_vm.isAlpha(token.value))?_c('gl-color-contrast',{attrs:{"foreground":token.value,"background":_vm.lightBackground}}):_vm._e()],1)])}),0)])};
52
+ var __vue_staticRenderFns__ = [];
53
+
54
+ /* style */
55
+ const __vue_inject_styles__ = undefined;
56
+ /* scoped */
57
+ const __vue_scope_id__ = undefined;
58
+ /* module identifier */
59
+ const __vue_module_identifier__ = undefined;
60
+ /* functional template */
61
+ const __vue_is_functional_template__ = false;
62
+ /* style inject */
63
+
64
+ /* style inject SSR */
65
+
66
+ /* style inject shadow dom */
67
+
68
+
69
+
70
+ const __vue_component__ = __vue_normalize__(
71
+ { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
72
+ __vue_inject_styles__,
73
+ __vue_script__,
74
+ __vue_scope_id__,
75
+ __vue_is_functional_template__,
76
+ __vue_module_identifier__,
77
+ false,
78
+ undefined,
79
+ undefined,
80
+ undefined
81
+ );
82
+
83
+ export default __vue_component__;