@gitlab/ui 80.9.0 → 80.10.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,10 @@
1
+ # [80.10.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v80.9.0...v80.10.0) (2024-05-15)
2
+
3
+
4
+ ### Features
5
+
6
+ * **DesignTokens:** Create design token table Storybook story ([a7d97d1](https://gitlab.com/gitlab-org/gitlab-ui/commit/a7d97d11b6fee5e6e942f32785a1e4843ca3924b))
7
+
1
8
  # [80.9.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v80.8.1...v80.9.0) (2024-05-15)
2
9
 
3
10
 
package/dist/tailwind.css CHANGED
@@ -1,2 +1,2 @@
1
- .gl-fixed{position:fixed}.\!gl-absolute{position:absolute!important}.gl-absolute{position:absolute}.gl-relative{position:relative}.gl-bottom-0{bottom:0}.gl-bottom-2{bottom:.25rem}.gl-left-0{left:0}.gl-right-2{right:.25rem}.gl-float-right{float:right}.gl-text-blue-100{color:var(--blue-100,#cbe2f9)}.gl-text-blue-500{color:var(--blue-500,#1f75cb)}.gl-text-blue-900{color:var(--blue-900,#033464)}.gl-text-danger{color:var(--gl-text-color-danger,#c91c00)}.gl-text-gray-400{color:var(--gray-400,#89888d)}.gl-text-gray-500{color:var(--gray-500,#737278)}.gl-text-gray-600{color:var(--gray-600,#626168)}.gl-text-gray-700{color:var(--gray-700,#535158)}.gl-text-gray-900{color:var(--gray-900,#333238)}.gl-text-gray-950{color:var(--gray-950,#1f1e24)}.gl-text-green-500{color:var(--green-500,#108548)}.gl-text-green-600{color:var(--green-600,#217645)}.gl-text-orange-500{color:var(--orange-500,#ab6100)}.gl-text-red-300{color:var(--red-300,#f57f6c)}.gl-text-red-500{color:var(--red-500,#dd2b0e)}.gl-text-red-600{color:var(--red-600,#c91c00)}.gl-text-secondary{color:var(--gl-text-secondary,#737278)}.gl-text-subtle{color:var(--gl-text-color-subtle,#626168)}.gl-text-white{color:var(--white,#fff)}
1
+ .gl-fixed{position:fixed}.\!gl-absolute{position:absolute!important}.gl-absolute{position:absolute}.gl-relative{position:relative}.gl-bottom-0{bottom:0}.gl-bottom-2{bottom:.25rem}.gl-left-0{left:0}.gl-right-2{right:.25rem}.gl-float-right{float:right}.gl-text-blue-100{color:var(--blue-100,#cbe2f9)}.gl-text-blue-500{color:var(--blue-500,#1f75cb)}.gl-text-blue-900{color:var(--blue-900,#033464)}.gl-text-danger{color:var(--gl-text-color-danger,#c91c00)}.gl-text-gray-400{color:var(--gray-400,#89888d)}.gl-text-gray-500{color:var(--gray-500,#737278)}.gl-text-gray-600{color:var(--gray-600,#626168)}.gl-text-gray-700{color:var(--gray-700,#535158)}.gl-text-gray-900{color:var(--gray-900,#333238)}.gl-text-gray-950{color:var(--gray-950,#1f1e24)}.gl-text-green-500{color:var(--green-500,#108548)}.gl-text-green-600{color:var(--green-600,#217645)}.gl-text-orange-500{color:var(--orange-500,#ab6100)}.gl-text-red-300{color:var(--red-300,#f57f6c)}.gl-text-red-500{color:var(--red-500,#dd2b0e)}.gl-text-red-600{color:var(--red-600,#c91c00)}.gl-text-secondary{color:var(--gl-text-secondary,#737278)}.gl-text-strong{color:var(--gl-text-color-strong,#1f1e24)}.gl-text-subtle{color:var(--gl-text-color-subtle,#626168)}.gl-text-white{color:var(--white,#fff)}
2
2
  /*# sourceMappingURL=tailwind.css.map */
@@ -1 +1 @@
1
- {"version":3,"sources":["tailwind.css"],"names":[],"mappings":"AAAA,UAAA,cAAmB,CAAnB,eAAA,2BAAmB,CAAnB,aAAA,iBAAmB,CAAnB,aAAA,iBAAmB,CAAnB,aAAA,QAAmB,CAAnB,aAAA,aAAmB,CAAnB,WAAA,MAAmB,CAAnB,YAAA,YAAmB,CAAnB,gBAAA,WAAmB,CAAnB,kBAAA,6BAAmB,CAAnB,kBAAA,6BAAmB,CAAnB,kBAAA,6BAAmB,CAAnB,gBAAA,yCAAmB,CAAnB,kBAAA,6BAAmB,CAAnB,kBAAA,6BAAmB,CAAnB,kBAAA,6BAAmB,CAAnB,kBAAA,6BAAmB,CAAnB,kBAAA,6BAAmB,CAAnB,kBAAA,6BAAmB,CAAnB,mBAAA,8BAAmB,CAAnB,mBAAA,8BAAmB,CAAnB,oBAAA,+BAAmB,CAAnB,iBAAA,4BAAmB,CAAnB,iBAAA,4BAAmB,CAAnB,iBAAA,4BAAmB,CAAnB,mBAAA,sCAAmB,CAAnB,gBAAA,yCAAmB,CAAnB,eAAA,uBAAmB","file":"tailwind.css","sourcesContent":["@tailwind utilities;\n"]}
1
+ {"version":3,"sources":["tailwind.css"],"names":[],"mappings":"AAAA,UAAA,cAAmB,CAAnB,eAAA,2BAAmB,CAAnB,aAAA,iBAAmB,CAAnB,aAAA,iBAAmB,CAAnB,aAAA,QAAmB,CAAnB,aAAA,aAAmB,CAAnB,WAAA,MAAmB,CAAnB,YAAA,YAAmB,CAAnB,gBAAA,WAAmB,CAAnB,kBAAA,6BAAmB,CAAnB,kBAAA,6BAAmB,CAAnB,kBAAA,6BAAmB,CAAnB,gBAAA,yCAAmB,CAAnB,kBAAA,6BAAmB,CAAnB,kBAAA,6BAAmB,CAAnB,kBAAA,6BAAmB,CAAnB,kBAAA,6BAAmB,CAAnB,kBAAA,6BAAmB,CAAnB,kBAAA,6BAAmB,CAAnB,mBAAA,8BAAmB,CAAnB,mBAAA,8BAAmB,CAAnB,oBAAA,+BAAmB,CAAnB,iBAAA,4BAAmB,CAAnB,iBAAA,4BAAmB,CAAnB,iBAAA,4BAAmB,CAAnB,mBAAA,sCAAmB,CAAnB,gBAAA,yCAAmB,CAAnB,gBAAA,yCAAmB,CAAnB,eAAA,uBAAmB","file":"tailwind.css","sourcesContent":["@tailwind utilities;\n"]}
@@ -0,0 +1,147 @@
1
+ import GlBadge from '../components/base/badge/badge';
2
+ import GlCollapsibleListbox from '../components/base/new_dropdowns/listbox/listbox';
3
+ import GlFormInput from '../components/base/form/form_input/form_input';
4
+ import GlTable from '../components/base/table/table';
5
+ import TOKENS_DEFAULT from './build/json/tokens.json';
6
+ import TOKENS_DARK from './build/json/tokens.dark.json';
7
+ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
8
+
9
+ var script = {
10
+ name: 'TokensTable',
11
+ TOKENS_DEFAULT,
12
+ TOKENS_DARK,
13
+ components: {
14
+ GlBadge,
15
+ GlCollapsibleListbox,
16
+ GlFormInput,
17
+ GlTable
18
+ },
19
+ fields: [{
20
+ key: 'description',
21
+ label: 'Description'
22
+ }, {
23
+ key: 'value',
24
+ label: 'Value'
25
+ }],
26
+ data() {
27
+ return {
28
+ filter: null,
29
+ modes: [{
30
+ value: 'default',
31
+ text: 'Default'
32
+ }, {
33
+ value: 'dark',
34
+ text: 'Dark'
35
+ }],
36
+ selectedMode: 'default',
37
+ tokens: {
38
+ default: this.$options.TOKENS_DEFAULT,
39
+ dark: this.$options.TOKENS_DARK
40
+ }
41
+ };
42
+ },
43
+ computed: {
44
+ items() {
45
+ return this.transformTokensToTableRows(this.tokens[this.selectedMode]);
46
+ }
47
+ },
48
+ methods: {
49
+ isColor(type) {
50
+ return type === 'color';
51
+ },
52
+ isAliasValue(value) {
53
+ return typeof value === 'string' && value.includes('{');
54
+ },
55
+ isAliasObject(value) {
56
+ return typeof value === 'object' && Object.values(value).some(val => this.isAliasValue(val));
57
+ },
58
+ getAliasValueName(value) {
59
+ if (this.isAliasValue(value)) {
60
+ return value.slice(1, -1);
61
+ }
62
+ return value;
63
+ },
64
+ getValueLabel(token) {
65
+ const {
66
+ value
67
+ } = token.original;
68
+ if (this.isAliasObject(value)) {
69
+ return this.getAliasValueName(value[this.selectedMode]);
70
+ }
71
+ if (this.isAliasValue(value)) {
72
+ return this.getAliasValueName(value);
73
+ }
74
+ return token.value;
75
+ },
76
+ transformTokenToTableColumns(token) {
77
+ return {
78
+ name: token.path.filter(Boolean).join('.'),
79
+ type: token.$type,
80
+ value: token.value,
81
+ valueLabel: this.getValueLabel(token),
82
+ deprecated: token.deprecated,
83
+ description: token.comment
84
+ };
85
+ },
86
+ transformTokensToTableRows(tokens) {
87
+ const tokensArray = [];
88
+ Object.keys(tokens).forEach(key => {
89
+ const token = tokens[key];
90
+ if (token.value) {
91
+ tokensArray.push(this.transformTokenToTableColumns(token));
92
+ } else {
93
+ tokensArray.push(...this.transformTokensToTableRows(token));
94
+ }
95
+ });
96
+ return tokensArray;
97
+ }
98
+ }
99
+ };
100
+
101
+ /* script */
102
+ const __vue_script__ = script;
103
+
104
+ /* template */
105
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('div',{staticClass:"gl-display-flex gl-align-items-center gl-gap-3 gl-mb-5"},[_c('gl-form-input',{attrs:{"placeholder":"Type to search"},model:{value:(_vm.filter),callback:function ($$v) {_vm.filter=$$v;},expression:"filter"}}),_vm._v(" "),_c('gl-collapsible-listbox',{attrs:{"id":"component-listbox","selected":_vm.selectedMode,"items":_vm.modes},on:{"search":function($event){_vm.query = $event;}},model:{value:(_vm.selectedMode),callback:function ($$v) {_vm.selectedMode=$$v;},expression:"selectedMode"}})],1),_vm._v(" "),_c('gl-table',{attrs:{"filter":_vm.filter,"items":_vm.items,"fields":_vm.$options.fields,"tbody-tr-attr":function (item) { return ({ id: item.name }); },"hover":"","stacked":"sm"},scopedSlots:_vm._u([{key:"cell(description)",fn:function(ref){
106
+ var ref_item = ref.item;
107
+ var name = ref_item.name;
108
+ var deprecated = ref_item.deprecated;
109
+ var description = ref_item.description;
110
+ return [_c('code',{staticClass:"gl-font-base gl-text-strong"},[_vm._v("\n "+_vm._s(name)+"\n "),(deprecated)?_c('gl-badge',{attrs:{"size":"sm","variant":"neutral"}},[_vm._v("Deprecated")]):_vm._e()],1),_vm._v(" "),(description)?_c('div',{staticClass:"gl-mt-3 gl-text-subtle"},[_vm._v("\n "+_vm._s(description)+"\n ")]):_vm._e()]}},{key:"cell(value)",fn:function(ref){
111
+ var ref_item = ref.item;
112
+ var type = ref_item.type;
113
+ var value = ref_item.value;
114
+ var valueLabel = ref_item.valueLabel;
115
+ return [_c('div',{staticClass:"gl-display-flex gl-align-items-center gl-gap-3"},[(_vm.isColor(type))?_c('div',{staticClass:"gl-w-5 gl-h-5 gl-rounded-base",style:({ 'background-color': value })}):_vm._e(),_vm._v(" "),_c('code',{staticClass:"gl-font-base gl-text-strong"},[_vm._v(_vm._s(valueLabel))])])]}}])})],1)};
116
+ var __vue_staticRenderFns__ = [];
117
+
118
+ /* style */
119
+ const __vue_inject_styles__ = undefined;
120
+ /* scoped */
121
+ const __vue_scope_id__ = undefined;
122
+ /* module identifier */
123
+ const __vue_module_identifier__ = undefined;
124
+ /* functional template */
125
+ const __vue_is_functional_template__ = false;
126
+ /* style inject */
127
+
128
+ /* style inject SSR */
129
+
130
+ /* style inject shadow dom */
131
+
132
+
133
+
134
+ const __vue_component__ = __vue_normalize__(
135
+ { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
136
+ __vue_inject_styles__,
137
+ __vue_script__,
138
+ __vue_scope_id__,
139
+ __vue_is_functional_template__,
140
+ __vue_module_identifier__,
141
+ false,
142
+ undefined,
143
+ undefined,
144
+ undefined
145
+ );
146
+
147
+ export default __vue_component__;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "80.9.0",
3
+ "version": "80.10.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -29,10 +29,10 @@ Example:
29
29
  <gl-keyset-pagination v-bind="pageInfo" :prev-text="__('Prev')" :next-text="__('Next')" />
30
30
  ```
31
31
 
32
- **✅ Do** use this component for paginating GraphQL requests<sup>1</sup> (or any
32
+ **✅ Do** use this component for paginating GraphQL requests[^1] (or any
33
33
  endpoint that uses keyset pagination).
34
34
 
35
- **❌ Don't** use this component for paginating REST requests<sup>1</sup> (or any
35
+ **❌ Don't** use this component for paginating REST requests[^1] (or any
36
36
  endpoint that uses offset pagination).
37
37
 
38
38
  For offset pagination, use the [`GlPagination`
@@ -42,12 +42,7 @@ For more information on the difference between offset and keyset pagination see
42
42
  [our documentation on GraphQL
43
43
  pagination](https://docs.gitlab.com/ee/development/graphql_guide/pagination.html).
44
44
 
45
- <small><sup>1</sup>There's no intrinsic reason why GraphQL endpoints can't
46
- support offset pagination (in fact, [the official
47
- documentation](https://graphql.org/learn/pagination/#pagination-and-edges) shows
48
- an example offset pagination implementation) or why REST endpoints can't support
49
- keyset pagination. This is simply how we've chosen to implement our REST and
50
- GraphQL endpoints at GitLab.</small>
45
+ [^1]: There's no intrinsic reason why GraphQL endpoints can't support offset pagination (in fact, [the official documentation](https://graphql.org/learn/pagination/#pagination-and-edges) shows an example offset pagination implementation) or why REST endpoints can't support keyset pagination. This is simply how we've chosen to implement our REST and GraphQL endpoints at GitLab.
51
46
 
52
47
  ## Pajamas reference
53
48
 
@@ -0,0 +1,16 @@
1
+ import TokensTable from './tokens_table.vue';
2
+
3
+ const Template = () => ({
4
+ components: {
5
+ TokensTable,
6
+ },
7
+ template: `<tokens-table />`,
8
+ });
9
+
10
+ export const Default = Template.bind({});
11
+
12
+ export default {
13
+ title: 'tokens/all',
14
+ component: TokensTable,
15
+ tags: ['skip-visual-test'],
16
+ };
@@ -0,0 +1,151 @@
1
+ <script>
2
+ import GlBadge from '../components/base/badge/badge.vue';
3
+ import GlCollapsibleListbox from '../components/base/new_dropdowns/listbox/listbox.vue';
4
+ import GlFormInput from '../components/base/form/form_input/form_input.vue';
5
+ import GlTable from '../components/base/table/table.vue';
6
+ import TOKENS_DEFAULT from './build/json/tokens.json';
7
+ import TOKENS_DARK from './build/json/tokens.dark.json';
8
+
9
+ export default {
10
+ name: 'TokensTable',
11
+ TOKENS_DEFAULT,
12
+ TOKENS_DARK,
13
+ components: {
14
+ GlBadge,
15
+ GlCollapsibleListbox,
16
+ GlFormInput,
17
+ GlTable,
18
+ },
19
+ fields: [
20
+ {
21
+ key: 'description',
22
+ label: 'Description',
23
+ },
24
+ {
25
+ key: 'value',
26
+ label: 'Value',
27
+ },
28
+ ],
29
+ data() {
30
+ return {
31
+ filter: null,
32
+ modes: [
33
+ {
34
+ value: 'default',
35
+ text: 'Default',
36
+ },
37
+ {
38
+ value: 'dark',
39
+ text: 'Dark',
40
+ },
41
+ ],
42
+ selectedMode: 'default',
43
+ tokens: {
44
+ default: this.$options.TOKENS_DEFAULT,
45
+ dark: this.$options.TOKENS_DARK,
46
+ },
47
+ };
48
+ },
49
+ computed: {
50
+ items() {
51
+ return this.transformTokensToTableRows(this.tokens[this.selectedMode]);
52
+ },
53
+ },
54
+ methods: {
55
+ isColor(type) {
56
+ return type === 'color';
57
+ },
58
+ isAliasValue(value) {
59
+ return typeof value === 'string' && value.includes('{');
60
+ },
61
+ isAliasObject(value) {
62
+ return (
63
+ typeof value === 'object' && Object.values(value).some((val) => this.isAliasValue(val))
64
+ );
65
+ },
66
+ getAliasValueName(value) {
67
+ if (this.isAliasValue(value)) {
68
+ return value.slice(1, -1);
69
+ }
70
+ return value;
71
+ },
72
+ getValueLabel(token) {
73
+ const { value } = token.original;
74
+ if (this.isAliasObject(value)) {
75
+ return this.getAliasValueName(value[this.selectedMode]);
76
+ }
77
+ if (this.isAliasValue(value)) {
78
+ return this.getAliasValueName(value);
79
+ }
80
+ return token.value;
81
+ },
82
+ transformTokenToTableColumns(token) {
83
+ return {
84
+ name: token.path.filter(Boolean).join('.'),
85
+ type: token.$type,
86
+ value: token.value,
87
+ valueLabel: this.getValueLabel(token),
88
+ deprecated: token.deprecated,
89
+ description: token.comment,
90
+ };
91
+ },
92
+ transformTokensToTableRows(tokens) {
93
+ const tokensArray = [];
94
+
95
+ Object.keys(tokens).forEach((key) => {
96
+ const token = tokens[key];
97
+ if (token.value) {
98
+ tokensArray.push(this.transformTokenToTableColumns(token));
99
+ } else {
100
+ tokensArray.push(...this.transformTokensToTableRows(token));
101
+ }
102
+ });
103
+
104
+ return tokensArray;
105
+ },
106
+ },
107
+ };
108
+ </script>
109
+
110
+ <template>
111
+ <div>
112
+ <div class="gl-display-flex gl-align-items-center gl-gap-3 gl-mb-5">
113
+ <gl-form-input v-model="filter" placeholder="Type to search" />
114
+ <gl-collapsible-listbox
115
+ id="component-listbox"
116
+ v-model="selectedMode"
117
+ :selected="selectedMode"
118
+ :items="modes"
119
+ @search="query = $event"
120
+ />
121
+ </div>
122
+ <gl-table
123
+ :filter="filter"
124
+ :items="items"
125
+ :fields="$options.fields"
126
+ :tbody-tr-attr="(item) => ({ id: item.name })"
127
+ hover
128
+ stacked="sm"
129
+ >
130
+ <template #cell(description)="{ item: { name, deprecated, description } }">
131
+ <code class="gl-font-base gl-text-strong">
132
+ {{ name }}
133
+ <gl-badge v-if="deprecated" size="sm" variant="neutral">Deprecated</gl-badge>
134
+ </code>
135
+ <div v-if="description" class="gl-mt-3 gl-text-subtle">
136
+ {{ description }}
137
+ </div>
138
+ </template>
139
+ <template #cell(value)="{ item: { type, value, valueLabel } }">
140
+ <div class="gl-display-flex gl-align-items-center gl-gap-3">
141
+ <div
142
+ v-if="isColor(type)"
143
+ class="gl-w-5 gl-h-5 gl-rounded-base"
144
+ :style="{ 'background-color': value }"
145
+ ></div>
146
+ <code class="gl-font-base gl-text-strong">{{ valueLabel }}</code>
147
+ </div>
148
+ </template>
149
+ </gl-table>
150
+ </div>
151
+ </template>