@gitlab/ui 86.11.1 → 86.12.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [86.12.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v86.12.0...v86.12.1) (2024-07-17)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Properly handle multi-class tailwind migration ([7131ebb](https://gitlab.com/gitlab-org/gitlab-ui/commit/7131ebb48501d1ac962c1b64d7fb45fc07f6fc37))
7
+
8
+ # [86.12.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v86.11.1...v86.12.0) (2024-07-16)
9
+
10
+
11
+ ### Features
12
+
13
+ * **Charts:** use options.toolbox.show to show/hide toolbox ([5e8c462](https://gitlab.com/gitlab-org/gitlab-ui/commit/5e8c4624274aa9612b7e7fcf73f0e500ea6446f9))
14
+
1
15
  ## [86.11.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v86.11.0...v86.11.1) (2024-07-16)
2
16
 
3
17
 
@@ -183679,9 +183679,15 @@ var _23 = function() {
183679
183679
  }();
183680
183680
  var lne = { html: rn7("html", gc3, { staticAttrs: ["class"] }), glimmer: rn7("glimmer", oY, { staticAttrs: ["class"] }), lwc: rn7("lwc", gc3, { staticAttrs: ["class"] }), angular: rn7("angular", gc3, { staticAttrs: ["class"], dynamicAttrs: ["[ngClass]"] }), vue: rn7("vue", gc3, { staticAttrs: ["class"], dynamicAttrs: [":class", "v-bind:class"] }), css: rn7("css", Sv), scss: rn7("scss", Sv), less: rn7("less", Sv), babel: rn7("babel", Ls8, { staticAttrs: ["class", "className"] }), "babel-flow": rn7("babel-flow", Ls8, { staticAttrs: ["class", "className"] }), flow: rn7("flow", Ls8, { staticAttrs: ["class", "className"] }), typescript: rn7("typescript", Ls8, { staticAttrs: ["class", "className"] }), "babel-ts": rn7("babel-ts", Ls8, { staticAttrs: ["class", "className"] }), acorn: rn7("acorn", Ls8, { staticAttrs: ["class", "className"] }), meriyah: rn7("meriyah", Ls8, { staticAttrs: ["class", "className"] }), __js_expression: rn7("__js_expression", Ls8, { staticAttrs: ["class", "className"] }), ...si5.parsers.svelte ? { svelte: rn7("svelte", vc3, { staticAttrs: ["class"] }) } : {}, ...si5.parsers.astro ? { astro: rn7("astro", I23, { staticAttrs: ["class", "className"], dynamicAttrs: ["class:list", "className"] }) } : {}, ...si5.parsers.astroExpressionParser ? { astroExpressionParser: rn7("astroExpressionParser", Ls8, { staticAttrs: ["class"], dynamicAttrs: ["class:list"] }) } : {}, ...si5.parsers.marko ? { marko: rn7("marko", cY2, { staticAttrs: ["class"] }) } : {}, ...si5.parsers.melody ? { melody: rn7("melody", O23, { staticAttrs: ["class"] }) } : {}, ...si5.parsers.pug ? { pug: rn7("pug", pY, { staticAttrs: ["class"] }) } : {}, ...si5.parsers["liquid-html"] ? { "liquid-html": rn7("liquid-html", lY, { staticAttrs: ["class"] }) } : {} };
183681
183681
 
183682
- // bin/lib/tailwind_equivalents.js
183682
+ // bin/lib/tailwind_equivalents.mjs
183683
183683
  var tailwindEquivalents = {
183684
+ /**
183685
+ * These classes are mapping to multi-classes...
183686
+ */
183684
183687
  "gl-sr-only-focusable": "gl-sr-only focus:gl-not-sr-only",
183688
+ "gl--flex-center": "gl-flex gl-items-center gl-justify-center",
183689
+ "gl-flex-flow-row-wrap": "gl-flex-row gl-flex-wrap",
183690
+ // Normal replacements below
183685
183691
  "gl-spin": "gl-animate-spin",
183686
183692
  "gl-animate-skeleton-loader": null,
183687
183693
  "gl-hover-bg-transparent": "hover:gl-bg-transparent",
@@ -183797,7 +183803,6 @@ var tailwindEquivalents = {
183797
183803
  "gl-hover-text-blue-800": "hover:gl-text-blue-800",
183798
183804
  "gl-hover-text-blue-800!": "hover:!gl-text-blue-800",
183799
183805
  "gl-text-red-500!": "!gl-text-red-500",
183800
- "gl--flex-center": "gl-flex gl-items-center gl-justify-center",
183801
183806
  "gl-focus--focus": "focus:gl-focus",
183802
183807
  "gl-cursor-default!": "!gl-cursor-default",
183803
183808
  "gl-hover-cursor-pointer": "hover:gl-cursor-pointer",
@@ -183904,7 +183909,6 @@ var tailwindEquivalents = {
183904
183909
  "gl-flex-basis-half": "gl-basis-1/2",
183905
183910
  "gl-flex-basis-full": "gl-basis-full",
183906
183911
  "gl-flex-basis-full!": "!gl-basis-full",
183907
- "gl-flex-flow-row-wrap": "gl-flex-row gl-flex-wrap",
183908
183912
  "gl-justify-content-center": "gl-justify-center",
183909
183913
  "gl-justify-content-end": "gl-justify-end",
183910
183914
  "gl-justify-content-end!": "!gl-justify-end",
@@ -184208,6 +184212,21 @@ var tailwindEquivalents = {
184208
184212
  "gl-visibility-hidden": "gl-invisible",
184209
184213
  "gl-z-index-200": "gl-z-200",
184210
184214
  "gl-z-index-9999!": "!gl-z-9999",
184215
+ /*
184216
+ Items below have been found by analysing the following projects
184217
+ - jh fork of GitLab
184218
+ - https://gitlab-org.gitlab.io/frontend/playground/gitlab-code-scanner
184219
+ - https://gitlab.com/gitlab-com/gl-infra/gitlab-dedicated/switchboard/
184220
+ - https://gitlab.com/gitlab-org/customers-gitlab-com/
184221
+ - https://gitlab.com/gitlab-org/editor-extensions/gitlab-jetbrains-plugin
184222
+ - https://gitlab.com/gitlab-org/frontend/pajamas-adoption-scanner
184223
+ - https://gitlab.com/gitlab-org/frontend/playground/vue-compat-scanner
184224
+ - https://gitlab.com/gitlab-org/gitlab-docs/
184225
+ - https://gitlab.com/gitlab-org/gitlab-services/design.gitlab.com
184226
+ - https://gitlab.com/gitlab-org/gitlab-vscode-extension/
184227
+ - https://gitlab.com/gitlab-org/status-page
184228
+ - https://gitlab.com/gitlab-org/technical-writing-group/gitlab-docs-hugo
184229
+ */
184211
184230
  "gl-active-bg-t-gray-a-08": "active:gl-bg-alpha-dark-8",
184212
184231
  "gl-inset-border-b-1-gray-200": "gl-shadow-inner-b-1-gray-100",
184213
184232
  "gl-justify-content-center!": "!gl-justify-center",
@@ -184235,18 +184254,87 @@ var tailwindEquivalents = {
184235
184254
  "gl-z-index-1": "gl-z-1",
184236
184255
  "gl-z-index-2": "gl-z-2",
184237
184256
  "gl-z-index-3": "gl-z-3",
184238
- "gl-z-index-4": "gl-z-4"
184257
+ "gl-z-index-4": "gl-z-4",
184258
+ "gl-bg-data-viz-green-700!": "!gl-bg-data-viz-green-700",
184259
+ "gl-bg-data-viz-magenta-950!": "!gl-bg-data-viz-magenta-950",
184260
+ "gl-inset-border-1-red-300": "gl-shadow-inner-1-red-300",
184261
+ "gl-inset-border-1-red-500": "gl-shadow-inner-1-red-500",
184262
+ "gl-column-gap-3": "gl-gap-x-3"
184239
184263
  };
184240
184264
 
184265
+ // bin/lib/tailwind_migrations.mjs
184266
+ function legacyClassToImportant(klass) {
184267
+ return klass.endsWith("!") ? klass : `${klass}!`;
184268
+ }
184269
+ function tailwindClassToImportant(klass) {
184270
+ if (klass.includes(" ")) {
184271
+ return klass.split(" ").map((k9) => tailwindClassToImportant(k9)).join(" ");
184272
+ }
184273
+ if (klass.includes("!gl-")) {
184274
+ return klass;
184275
+ } else {
184276
+ return klass.replace(/(^|:)(-?gl-)/, "$1!$2");
184277
+ }
184278
+ }
184279
+ function filterOutNonStringValues(rawMigrations) {
184280
+ return Object.entries(rawMigrations).filter(([, to4]) => typeof to4 === "string");
184281
+ }
184282
+ function addImportantVariants(rawMigrations) {
184283
+ const map2 = rawMigrations.reduce((acc, [from, to4]) => {
184284
+ acc.set(from, to4);
184285
+ if (to4.includes(" ")) {
184286
+ acc.set("\\." + from, "." + to4.replace(/ /g, "."));
184287
+ }
184288
+ const importantFrom = legacyClassToImportant(from);
184289
+ if (!Object.hasOwn(rawMigrations, importantFrom)) {
184290
+ const importantTo = tailwindClassToImportant(to4);
184291
+ acc.set(importantFrom, importantTo);
184292
+ if (to4.includes(" ")) {
184293
+ acc.set("\\." + importantFrom, "." + importantTo.replace(/ /g, "."));
184294
+ }
184295
+ }
184296
+ return acc;
184297
+ }, /* @__PURE__ */ new Map());
184298
+ return Array.from(map2.entries()).map(([from, to4]) => ({ from, to: to4 }));
184299
+ }
184300
+ function addFromRegExps(rawMigrations) {
184301
+ const classChars = ["-", "\\w", "!", ":"].join("|");
184302
+ return rawMigrations.map((migration) => ({
184303
+ ...migration,
184304
+ fromRegExp: new RegExp(`(?<!${classChars})${migration.from}(?!${classChars})`, "g")
184305
+ }));
184306
+ }
184307
+ function sortMigrations(unsortedMigrations) {
184308
+ return unsortedMigrations.slice().sort((a3, b6) => {
184309
+ if (a3.from.length < b6.from.length)
184310
+ return 1;
184311
+ if (a3.from.length > b6.from.length)
184312
+ return -1;
184313
+ return 0;
184314
+ });
184315
+ }
184316
+ async function parseMigrations(obj) {
184317
+ try {
184318
+ return sortMigrations(addFromRegExps(addImportantVariants(filterOutNonStringValues(obj))));
184319
+ } catch (error) {
184320
+ console.error(error.message);
184321
+ return [];
184322
+ }
184323
+ }
184324
+ function runMigrations(contents, migrationsToDo) {
184325
+ let newContents = contents;
184326
+ for (const { fromRegExp, to: to4 } of migrationsToDo) {
184327
+ newContents = newContents.replaceAll(fromRegExp, to4);
184328
+ }
184329
+ return newContents;
184330
+ }
184331
+
184241
184332
  // bin/migrate_custom_utils_to_tw.mjs
184242
184333
  function createRewriter(config, migrationsToDo) {
184243
184334
  const { tailwindConfig, dryRun } = config;
184244
184335
  return async function rewrite(file) {
184245
184336
  const contents = await readFile3(file, { encoding: "utf8" });
184246
- let newContents = contents;
184247
- for (const { fromRegExp, to: to4 } of migrationsToDo) {
184248
- newContents = newContents.replaceAll(fromRegExp, to4);
184249
- }
184337
+ let newContents = runMigrations(contents, migrationsToDo);
184250
184338
  if (contents === newContents) {
184251
184339
  console.warn(`No changes to ${file}`);
184252
184340
  return;
@@ -184315,50 +184403,6 @@ function validateMigrations(processedMigrations) {
184315
184403
  }
184316
184404
  return true;
184317
184405
  }
184318
- function legacyClassToImportant(klass) {
184319
- return klass.endsWith("!") ? klass : `${klass}!`;
184320
- }
184321
- function tailwindClassToImportant(klass) {
184322
- return klass.includes("!gl-") ? klass : klass.replace(/(^|:)(-?gl-)/, "$1!$2");
184323
- }
184324
- function filterOutNonStringValues(rawMigrations) {
184325
- return Object.entries(rawMigrations).filter(([, to4]) => typeof to4 === "string");
184326
- }
184327
- function addImportantVariants(rawMigrations) {
184328
- const map2 = rawMigrations.reduce((acc, [from, to4]) => {
184329
- acc.set(from, to4);
184330
- const importantFrom = legacyClassToImportant(from);
184331
- if (!Object.hasOwn(rawMigrations, importantFrom)) {
184332
- acc.set(importantFrom, tailwindClassToImportant(to4));
184333
- }
184334
- return acc;
184335
- }, /* @__PURE__ */ new Map());
184336
- return Array.from(map2.entries()).map(([from, to4]) => ({ from, to: to4 }));
184337
- }
184338
- function addFromRegExps(rawMigrations) {
184339
- const classChars = ["-", "\\w", "!", ":"].join("|");
184340
- return rawMigrations.map((migration) => ({
184341
- ...migration,
184342
- fromRegExp: new RegExp(`(?<!${classChars})${migration.from}(?!${classChars})`, "g")
184343
- }));
184344
- }
184345
- function sortMigrations(unsortedMigrations) {
184346
- return unsortedMigrations.slice().sort((a3, b6) => {
184347
- if (a3.from.length < b6.from.length)
184348
- return 1;
184349
- if (a3.from.length > b6.from.length)
184350
- return -1;
184351
- return 0;
184352
- });
184353
- }
184354
- async function parseMigrations(obj) {
184355
- try {
184356
- return sortMigrations(addFromRegExps(addImportantVariants(filterOutNonStringValues(obj))));
184357
- } catch (error) {
184358
- console.error(error.message);
184359
- return [];
184360
- }
184361
- }
184362
184406
  async function getFilesAndDirectories(directories, dryRun) {
184363
184407
  const directoriesPattern = directories.length === 0 ? process.cwd() : directories.length === 1 ? directories[0] : `{${directories.join(",")}}`;
184364
184408
  const extensions = ["haml", "rb", "vue", "js", "snap", "html"];
@@ -12,7 +12,10 @@ import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
12
12
  * https://echarts.apache.org/en/api.html#echartsInstance.resize
13
13
  */
14
14
  const sizeValidator = size => Number.isFinite(size) || size === 'auto' || size == null;
15
- const isChartWithToolbox = options => (options === null || options === void 0 ? void 0 : options.toolbox) !== undefined;
15
+ const isChartWithToolbox = options => {
16
+ var _options$toolbox;
17
+ return Boolean(options === null || options === void 0 ? void 0 : (_options$toolbox = options.toolbox) === null || _options$toolbox === void 0 ? void 0 : _options$toolbox.show);
18
+ };
16
19
  const increaseChartGridTop = (options, increaseBy) => {
17
20
  var _options$grid;
18
21
  return {
@@ -1,25 +1,7 @@
1
1
  import times from 'lodash/times';
2
2
  import { SERIES_NAME, SERIES_NAME_SHORT } from '../stories_constants';
3
- import { marqueeSelectionSvgPath, redoSvgPath, clearAllSvgPath, downloadSvgPath } from '../svgs/svg_paths';
4
3
  import { colorFromDefaultPalette } from './theme';
5
4
 
6
- const toolbox = {
7
- feature: {
8
- dataZoom: {
9
- icon: {
10
- zoom: marqueeSelectionSvgPath,
11
- back: redoSvgPath
12
- }
13
- },
14
- restore: {
15
- icon: clearAllSvgPath
16
- },
17
- saveAsImage: {
18
- icon: downloadSvgPath
19
- }
20
- }
21
- };
22
-
23
5
  /**
24
6
  * Generates series data for usage in chart examples
25
7
  *
@@ -39,4 +21,4 @@ const generateSeriesData = function () {
39
21
  }));
40
22
  };
41
23
 
42
- export { generateSeriesData, toolbox };
24
+ export { generateSeriesData };
@@ -1,5 +1,5 @@
1
1
  import { GRAY_600, GRAY_200, GRAY_50, GRAY_300, GRAY_100, DATA_VIZ_BLUE_200, DATA_VIZ_BLUE_400, DATA_VIZ_BLUE_600, DATA_VIZ_BLUE_800, GRAY_900, GRAY_500, DATA_VIZ_BLUE_500, DATA_VIZ_BLUE_900, DATA_VIZ_ORANGE_500, DATA_VIZ_ORANGE_600, DATA_VIZ_AQUA_500, DATA_VIZ_GREEN_600, DATA_VIZ_MAGENTA_500, DATA_VIZ_BLUE_700, DATA_VIZ_ORANGE_800, DATA_VIZ_AQUA_700, DATA_VIZ_GREEN_800, DATA_VIZ_MAGENTA_700, DATA_VIZ_ORANGE_950, DATA_VIZ_AQUA_900, DATA_VIZ_GREEN_950, DATA_VIZ_MAGENTA_900, DATA_VIZ_ORANGE_700, DATA_VIZ_AQUA_600, DATA_VIZ_GREEN_700, DATA_VIZ_MAGENTA_600, DATA_VIZ_ORANGE_900, DATA_VIZ_AQUA_800, DATA_VIZ_GREEN_900, DATA_VIZ_MAGENTA_800, DATA_VIZ_BLUE_950, DATA_VIZ_AQUA_950, DATA_VIZ_GREEN_500, DATA_VIZ_MAGENTA_950, DATA_VIZ_ORANGE_400, DATA_VIZ_GREEN_400, DATA_VIZ_BLUE_300, DATA_VIZ_ORANGE_200, DATA_VIZ_AQUA_300, DATA_VIZ_GREEN_200, DATA_VIZ_MAGENTA_300, DATA_VIZ_BLUE_100, DATA_VIZ_ORANGE_50, DATA_VIZ_AQUA_100, DATA_VIZ_GREEN_50, DATA_VIZ_MAGENTA_100, DATA_VIZ_ORANGE_300, DATA_VIZ_AQUA_400, DATA_VIZ_GREEN_300, DATA_VIZ_MAGENTA_400, DATA_VIZ_ORANGE_100, DATA_VIZ_AQUA_200, DATA_VIZ_GREEN_100, DATA_VIZ_MAGENTA_200, DATA_VIZ_BLUE_50, DATA_VIZ_AQUA_50, DATA_VIZ_MAGENTA_50, RED_500, WHITE } from '../../tokens/build/js/tokens';
2
- import { scrollHandleSvgPath } from '../svgs/svg_paths';
2
+ import { scrollHandleSvgPath, marqueeSelectionSvgPath, redoSvgPath, clearAllSvgPath, downloadSvgPath } from '../svgs/svg_paths';
3
3
  import { hexToRgba } from '../utils';
4
4
 
5
5
  const GL_BORDER_RADIUS_BASE = '0.25rem';
@@ -141,14 +141,20 @@ const createTheme = function () {
141
141
  title: {
142
142
  zoom: 'Click to zoom in on a portion of the graph',
143
143
  back: 'Remove selection'
144
+ },
145
+ icon: {
146
+ zoom: marqueeSelectionSvgPath,
147
+ back: redoSvgPath
144
148
  }
145
149
  },
146
150
  restore: {
147
- title: 'Remove all selections and return chart to default state'
151
+ title: 'Remove all selections and return chart to default state',
152
+ icon: clearAllSvgPath
148
153
  },
149
154
  saveAsImage: {
150
155
  title: 'Save chart as an image',
151
- name: 'graph'
156
+ name: 'graph',
157
+ icon: downloadSvgPath
152
158
  }
153
159
  }
154
160
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "86.11.1",
3
+ "version": "86.12.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -17,7 +17,7 @@ import { debounceByAnimationFrame } from '../../../utils/utils';
17
17
  */
18
18
  const sizeValidator = (size) => Number.isFinite(size) || size === 'auto' || size == null;
19
19
 
20
- const isChartWithToolbox = (options) => options?.toolbox !== undefined;
20
+ const isChartWithToolbox = (options) => Boolean(options?.toolbox?.show);
21
21
 
22
22
  const increaseChartGridTop = (options, increaseBy) => ({
23
23
  ...options,
@@ -1,31 +1,7 @@
1
1
  import times from 'lodash/times';
2
2
  import { SERIES_NAME, SERIES_NAME_SHORT } from '../stories_constants';
3
-
4
- import {
5
- marqueeSelectionSvgPath,
6
- redoSvgPath,
7
- clearAllSvgPath,
8
- downloadSvgPath,
9
- } from '../svgs/svg_paths';
10
3
  import { colorFromDefaultPalette } from './theme';
11
4
 
12
- export const toolbox = {
13
- feature: {
14
- dataZoom: {
15
- icon: {
16
- zoom: marqueeSelectionSvgPath,
17
- back: redoSvgPath,
18
- },
19
- },
20
- restore: {
21
- icon: clearAllSvgPath,
22
- },
23
- saveAsImage: {
24
- icon: downloadSvgPath,
25
- },
26
- },
27
- };
28
-
29
5
  /**
30
6
  * Generates series data for usage in chart examples
31
7
  *
@@ -64,7 +64,13 @@ import {
64
64
  DATA_VIZ_ORANGE_950,
65
65
  DATA_VIZ_ORANGE_900,
66
66
  } from '../../tokens/build/js/tokens';
67
- import { scrollHandleSvgPath } from '../svgs/svg_paths';
67
+ import {
68
+ scrollHandleSvgPath,
69
+ marqueeSelectionSvgPath,
70
+ redoSvgPath,
71
+ clearAllSvgPath,
72
+ downloadSvgPath,
73
+ } from '../svgs/svg_paths';
68
74
  import { hexToRgba } from '../utils';
69
75
 
70
76
  const GL_BORDER_RADIUS_BASE = '0.25rem';
@@ -285,13 +291,19 @@ export const createTheme = (options = {}) => ({
285
291
  zoom: 'Click to zoom in on a portion of the graph',
286
292
  back: 'Remove selection',
287
293
  },
294
+ icon: {
295
+ zoom: marqueeSelectionSvgPath,
296
+ back: redoSvgPath,
297
+ },
288
298
  },
289
299
  restore: {
290
300
  title: 'Remove all selections and return chart to default state',
301
+ icon: clearAllSvgPath,
291
302
  },
292
303
  saveAsImage: {
293
304
  title: 'Save chart as an image',
294
305
  name: 'graph',
306
+ icon: downloadSvgPath,
295
307
  },
296
308
  },
297
309
  },