@gitlab/ui 107.5.0 → 107.6.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.
@@ -9488,15 +9488,15 @@
9488
9488
  "intro": {
9489
9489
  "border": {
9490
9490
  "color": {
9491
- "$value": "#064787",
9491
+ "$value": "#0b5cad",
9492
9492
  "$type": "color",
9493
9493
  "$description": "Used for the border of an info banner.",
9494
9494
  "filePath": "src/tokens/contextual/banner.tokens.json",
9495
9495
  "isSource": true,
9496
9496
  "original": {
9497
9497
  "$value": {
9498
- "default": "{color.blue.100}",
9499
- "dark": "{color.blue.800}"
9498
+ "default": "{color.blue.200}",
9499
+ "dark": "{color.blue.700}"
9500
9500
  },
9501
9501
  "$type": "color",
9502
9502
  "$description": "Used for the border of an info banner."
@@ -9540,15 +9540,15 @@
9540
9540
  },
9541
9541
  "border": {
9542
9542
  "color": {
9543
- "$value": "#453894",
9543
+ "$value": "#5943b6",
9544
9544
  "$type": "color",
9545
9545
  "$description": "Used for the border of a promo banner.",
9546
9546
  "filePath": "src/tokens/contextual/banner.tokens.json",
9547
9547
  "isSource": true,
9548
9548
  "original": {
9549
9549
  "$value": {
9550
- "default": "{color.purple.100}",
9551
- "dark": "{color.purple.800}"
9550
+ "default": "{color.purple.200}",
9551
+ "dark": "{color.purple.700}"
9552
9552
  },
9553
9553
  "$type": "color",
9554
9554
  "$description": "Used for the border of a promo banner."
@@ -9488,15 +9488,15 @@
9488
9488
  "intro": {
9489
9489
  "border": {
9490
9490
  "color": {
9491
- "$value": "#cbe2f9",
9491
+ "$value": "#9dc7f1",
9492
9492
  "$type": "color",
9493
9493
  "$description": "Used for the border of an info banner.",
9494
9494
  "filePath": "src/tokens/contextual/banner.tokens.json",
9495
9495
  "isSource": true,
9496
9496
  "original": {
9497
9497
  "$value": {
9498
- "default": "{color.blue.100}",
9499
- "dark": "{color.blue.800}"
9498
+ "default": "{color.blue.200}",
9499
+ "dark": "{color.blue.700}"
9500
9500
  },
9501
9501
  "$type": "color",
9502
9502
  "$description": "Used for the border of an info banner."
@@ -9540,15 +9540,15 @@
9540
9540
  },
9541
9541
  "border": {
9542
9542
  "color": {
9543
- "$value": "#e1d8f9",
9543
+ "$value": "#cbbbf2",
9544
9544
  "$type": "color",
9545
9545
  "$description": "Used for the border of a promo banner.",
9546
9546
  "filePath": "src/tokens/contextual/banner.tokens.json",
9547
9547
  "isSource": true,
9548
9548
  "original": {
9549
9549
  "$value": {
9550
- "default": "{color.purple.100}",
9551
- "dark": "{color.purple.800}"
9550
+ "default": "{color.purple.200}",
9551
+ "dark": "{color.purple.700}"
9552
9552
  },
9553
9553
  "$type": "color",
9554
9554
  "$description": "Used for the border of a promo banner."
@@ -650,9 +650,9 @@ $gl-badge-tier-text-color-active: $gl-color-purple-950; // Used for the text of
650
650
  $gl-badge-tier-icon-color-default: $gl-color-purple-950; // Used for the icon of a tier related badge when static or the default state when linked.
651
651
  $gl-badge-tier-icon-color-hover: $gl-color-purple-950; // Used for the icon of a tier related badge in the hover state.
652
652
  $gl-badge-tier-icon-color-active: $gl-color-purple-950; // Used for the icon of a tier related badge in the active state.
653
- $gl-banner-intro-border-color: $gl-color-blue-800; // Used for the border of an info banner.
653
+ $gl-banner-intro-border-color: $gl-color-blue-700; // Used for the border of an info banner.
654
654
  $gl-banner-promo-background-color: $gl-color-purple-950; // Used for the background of a promo banner.
655
- $gl-banner-promo-border-color: $gl-color-purple-800; // Used for the border of a promo banner.
655
+ $gl-banner-promo-border-color: $gl-color-purple-700; // Used for the border of a promo banner.
656
656
  $gl-breadcrumb-separator-color: $gl-color-neutral-400; // Used for the breadcrumb level separator.
657
657
  $gl-broadcast-banner-background-color-blue: $gl-color-theme-blue-700; // Used for the background for the blue banner type.
658
658
  $gl-broadcast-banner-background-color-dark: $gl-color-neutral-500; // Used for the background for the dark banner type.
@@ -650,9 +650,9 @@ $gl-badge-tier-text-color-active: $gl-color-purple-900; // Used for the text of
650
650
  $gl-badge-tier-icon-color-default: $gl-color-purple-700; // Used for the icon of a tier related badge when static or the default state when linked.
651
651
  $gl-badge-tier-icon-color-hover: $gl-color-purple-800; // Used for the icon of a tier related badge in the hover state.
652
652
  $gl-badge-tier-icon-color-active: $gl-color-purple-900; // Used for the icon of a tier related badge in the active state.
653
- $gl-banner-intro-border-color: $gl-color-blue-100; // Used for the border of an info banner.
653
+ $gl-banner-intro-border-color: $gl-color-blue-200; // Used for the border of an info banner.
654
654
  $gl-banner-promo-background-color: $gl-color-purple-50; // Used for the background of a promo banner.
655
- $gl-banner-promo-border-color: $gl-color-purple-100; // Used for the border of a promo banner.
655
+ $gl-banner-promo-border-color: $gl-color-purple-200; // Used for the border of a promo banner.
656
656
  $gl-breadcrumb-separator-color: $gl-color-neutral-400; // Used for the breadcrumb level separator.
657
657
  $gl-broadcast-banner-background-color-blue: $gl-color-theme-blue-700; // Used for the background for the blue banner type.
658
658
  $gl-broadcast-banner-background-color-dark: $gl-color-neutral-500; // Used for the background for the dark banner type.
@@ -4,8 +4,8 @@
4
4
  "border": {
5
5
  "color": {
6
6
  "$value": {
7
- "default": "{color.blue.100}",
8
- "dark": "{color.blue.800}"
7
+ "default": "{color.blue.200}",
8
+ "dark": "{color.blue.700}"
9
9
  },
10
10
  "$type": "color",
11
11
  "$description": "Used for the border of an info banner."
@@ -26,8 +26,8 @@
26
26
  "border": {
27
27
  "color": {
28
28
  "$value": {
29
- "default": "{color.purple.100}",
30
- "dark": "{color.purple.800}"
29
+ "default": "{color.purple.200}",
30
+ "dark": "{color.purple.700}"
31
31
  },
32
32
  "$type": "color",
33
33
  "$description": "Used for the border of a promo banner."
@@ -1,25 +1,30 @@
1
1
  <script>
2
+ import Fuse from 'fuse.js';
2
3
  import GlBadge from '../components/base/badge/badge.vue';
3
4
  import GlButton from '../components/base/button/button.vue';
4
5
  import GlCollapsibleListbox from '../components/base/new_dropdowns/listbox/listbox.vue';
5
- import GlFormInput from '../components/base/form/form_input/form_input.vue';
6
+ import GlSearchBoxByType from '../components/base/search_box_by_type/search_box_by_type.vue';
6
7
  import GlLink from '../components/base/link/link.vue';
7
8
  import GlTable from '../components/base/table/table.vue';
9
+ import GlPagination from '../components/base/pagination/pagination.vue';
8
10
  import { GlTooltipDirective } from '../directives/tooltip';
9
11
  import TOKENS_DEFAULT from './build/json/tokens.json';
10
12
  import TOKENS_DARK from './build/json/tokens.dark.json';
11
13
 
12
14
  export default {
13
15
  name: 'TokensTable',
14
- TOKENS_DEFAULT,
15
- TOKENS_DARK,
16
+ tokens: {
17
+ default: TOKENS_DEFAULT,
18
+ dark: TOKENS_DARK,
19
+ },
16
20
  components: {
17
21
  GlBadge,
18
22
  GlButton,
19
23
  GlCollapsibleListbox,
20
- GlFormInput,
24
+ GlSearchBoxByType,
21
25
  GlLink,
22
26
  GlTable,
27
+ GlPagination,
23
28
  },
24
29
  directives: {
25
30
  GlTooltip: GlTooltipDirective,
@@ -36,7 +41,7 @@ export default {
36
41
  ],
37
42
  data() {
38
43
  return {
39
- filter: null,
44
+ filter: '',
40
45
  platforms: [
41
46
  {
42
47
  value: 'name',
@@ -67,16 +72,15 @@ export default {
67
72
  ],
68
73
  selectedPlatform: 'name',
69
74
  selectedMode: 'default',
70
- tokens: {
71
- default: this.$options.TOKENS_DEFAULT,
72
- dark: this.$options.TOKENS_DARK,
73
- },
75
+ currentPage: 1,
76
+ perPage: 50,
77
+ totalFilteredItems: 0,
74
78
  };
75
79
  },
76
- computed: {
77
- items() {
78
- return this.transformTokensToTableRows(this.tokens[this.selectedMode]);
79
- },
80
+ watch: {
81
+ selectedPlatform: 'refresh',
82
+ selectedMode: 'refresh',
83
+ filter: 'resetCurrentPage',
80
84
  },
81
85
  methods: {
82
86
  isColor(type) {
@@ -113,10 +117,44 @@ export default {
113
117
  type: token.$type,
114
118
  value: token.$value,
115
119
  valueLabel: this.getValueLabel(token),
116
- deprecated: token.deprecated,
120
+ deprecated: token.deprecated ? 'deprecated' : '',
117
121
  description: token.$description,
118
122
  };
119
123
  },
124
+ filterItems(items, filter) {
125
+ if (!filter) return items;
126
+
127
+ const fuse = new Fuse(items, {
128
+ keys: Object.keys(items[0]),
129
+ includeScore: true,
130
+ });
131
+ const results = fuse.search(filter);
132
+
133
+ return results
134
+ .sort((a, b) => {
135
+ if (a.item.deprecated && !b.item.deprecated) return 1;
136
+ if (!a.item.deprecated && b.item.deprecated) return -1;
137
+ return a.score - b.score;
138
+ })
139
+ .map(({ item }) => item);
140
+ },
141
+ paginateItems(items, currentPage, perPage) {
142
+ const start = (currentPage - 1) * perPage;
143
+ return items.slice(start, start + perPage);
144
+ },
145
+ itemsProvider({ currentPage, perPage, filter }) {
146
+ try {
147
+ const items = this.transformTokensToTableRows(this.$options.tokens[this.selectedMode]);
148
+ const filteredItems = this.filterItems(items, filter);
149
+ this.totalFilteredItems = filteredItems.length;
150
+ const paginatedFilteredItems = this.paginateItems(filteredItems, currentPage, perPage);
151
+ return paginatedFilteredItems;
152
+ } catch (e) {
153
+ // eslint-disable-next-line no-console
154
+ console.error('Failed to provide items', e);
155
+ return [];
156
+ }
157
+ },
120
158
  transformTokensToTableRows(tokens) {
121
159
  const tokensArray = [];
122
160
 
@@ -179,6 +217,12 @@ export default {
179
217
  copyToClipboard(value) {
180
218
  navigator.clipboard.writeText(value);
181
219
  },
220
+ resetCurrentPage() {
221
+ this.currentPage = 1;
222
+ },
223
+ refresh() {
224
+ this.$root.$emit('bv::refresh::table', 'tokens-table');
225
+ },
182
226
  },
183
227
  };
184
228
  </script>
@@ -194,7 +238,7 @@ export default {
194
238
  >
195
239
  </p>
196
240
  <div class="gl-mb-5 gl-flex gl-items-center gl-gap-3">
197
- <gl-form-input v-model="filter" placeholder="Type to search" />
241
+ <gl-search-box-by-type v-model="filter" debounce="250" class="gl-grow" />
198
242
  <gl-collapsible-listbox
199
243
  v-model="selectedPlatform"
200
244
  :selected="selectedPlatform"
@@ -209,11 +253,15 @@ export default {
209
253
  />
210
254
  </div>
211
255
  <gl-table
256
+ id="tokens-table"
212
257
  :filter="filter"
213
- :items="items"
258
+ :items="itemsProvider"
214
259
  :fields="$options.fields"
215
260
  :tbody-tr-attr="(item) => ({ id: item.id })"
261
+ :current-page="currentPage"
262
+ :per-page="perPage"
216
263
  hover
264
+ fixed
217
265
  stacked="sm"
218
266
  >
219
267
  <template #cell(description)="{ item: { name, deprecated, description } }">
@@ -240,9 +288,16 @@ export default {
240
288
  class="gl-h-5 gl-w-5 gl-rounded-base"
241
289
  :style="{ 'background-color': value }"
242
290
  ></div>
243
- <code class="gl-text-base gl-text-strong">{{ valueLabel }}</code>
291
+ <code class="gl-min-w-0 gl-text-base gl-text-strong">{{ valueLabel }}</code>
244
292
  </div>
245
293
  </template>
246
294
  </gl-table>
295
+
296
+ <gl-pagination
297
+ v-model="currentPage"
298
+ align="center"
299
+ :per-page="perPage"
300
+ :total-items="totalFilteredItems"
301
+ />
247
302
  </div>
248
303
  </template>