@gitlab/ui 66.1.0 → 66.3.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,17 @@
1
+ # [66.3.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v66.2.0...v66.3.0) (2023-08-30)
2
+
3
+
4
+ ### Features
5
+
6
+ * accept generic translations at configuration time ([c3e04c7](https://gitlab.com/gitlab-org/gitlab-ui/commit/c3e04c7b72db211bcf3b34c9c47dc42214d1b3db))
7
+
8
+ # [66.2.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v66.1.0...v66.2.0) (2023-08-30)
9
+
10
+
11
+ ### Features
12
+
13
+ * **css:** Add -gl-mb-n8 util class ([b484bfb](https://gitlab.com/gitlab-org/gitlab-ui/commit/b484bfb4c00c39e495055914a4ada0a9842563b9))
14
+
1
15
  # [66.1.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v66.0.1...v66.1.0) (2023-08-29)
2
16
 
3
17
 
package/dist/charts.js CHANGED
@@ -1,4 +1,3 @@
1
- import setConfigs from './config';
2
1
  export { default as GlChart } from './components/charts/chart/chart';
3
2
  export { default as GlAreaChart } from './components/charts/area/area';
4
3
  export { default as GlBarChart } from './components/charts/bar/bar';
@@ -13,6 +12,3 @@ export { default as GlStackedColumnChart } from './components/charts/stacked_col
13
12
  export { default as GlDiscreteScatterChart } from './components/charts/discrete_scatter/discrete_scatter';
14
13
  export { default as GlSingleStat } from './components/charts/single_stat/single_stat';
15
14
  export { default as GlSparklineChart } from './components/charts/sparkline/sparkline';
16
-
17
- // Add config files
18
- setConfigs();
@@ -2,6 +2,7 @@ import GlClearIconButton from '../../shared_components/clear_icon_button/clear_i
2
2
  import GlFormInput from '../form/form_input/form_input';
3
3
  import GlIcon from '../icon/icon';
4
4
  import GlLoadingIcon from '../loading_icon/loading_icon';
5
+ import { translate } from '../../../utils/i18n';
5
6
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
6
7
 
7
8
  var script = {
@@ -34,7 +35,7 @@ var script = {
34
35
  clearButtonTitle: {
35
36
  type: String,
36
37
  required: false,
37
- default: 'Clear'
38
+ default: () => translate('GlSearchBoxByType.clearButtonTitle', 'Clear')
38
39
  },
39
40
  /**
40
41
  * If provided and true, disables the input and controls
@@ -65,7 +66,7 @@ var script = {
65
66
  inputAttributes() {
66
67
  const attributes = {
67
68
  type: 'search',
68
- placeholder: 'Search',
69
+ placeholder: translate('GlSearchBoxByType.input.placeholder', 'Search'),
69
70
  ...this.$attrs
70
71
  };
71
72
  if (!attributes['aria-label']) {
@@ -1,5 +1,6 @@
1
1
  import { GlTooltipDirective } from '../../../directives/tooltip';
2
2
  import GlButton from '../../base/button/button';
3
+ import { translate } from '../../../utils/i18n';
3
4
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
4
5
 
5
6
  var script = {
@@ -14,7 +15,7 @@ var script = {
14
15
  title: {
15
16
  type: String,
16
17
  required: false,
17
- default: 'Clear'
18
+ default: () => translate('ClearIconButton.title', 'Clear')
18
19
  },
19
20
  tooltipContainer: {
20
21
  required: false,
package/dist/config.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { BVConfigPlugin } from 'bootstrap-vue/esm/index.js';
2
2
  import Vue from 'vue';
3
+ import translationKeys from '../translations.json';
3
4
  import { tooltipDelay } from './utils/constants';
4
5
 
5
6
  const bFormTextGlobalConfig = {
@@ -28,11 +29,51 @@ try {
28
29
  } catch (e) {
29
30
  // localStorage doesn't exist (or the value is not properly formatted)
30
31
  }
31
- const setConfigs = () => {
32
+ const i18n = translationKeys;
33
+ let configured = false;
34
+
35
+ /**
36
+ * Set GitLab UI configuration.
37
+ *
38
+ * @typedef {object} GitLabUIConfiguration
39
+ * @template TValue=string
40
+ * @property {undefined | Object} translations Generic translations for component labels to fall back to.
41
+ * @property {boolean} disableTranslations Whether translation capabilities should be disabled. Suppresses the warning about missing translations.
42
+ */
43
+ const setConfigs = function () {
44
+ let {
45
+ translations
46
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
47
+ if (configured) {
48
+ if (process.env.NODE_ENV === 'development') {
49
+ throw new Error('GitLab UI can only be configured once!');
50
+ }
51
+ return;
52
+ }
53
+ configured = true;
32
54
  Vue.use(BVConfigPlugin, {
33
55
  BFormText: bFormTextGlobalConfig,
34
56
  BTooltip: tooltipGlobalConfig
35
57
  });
58
+ if (typeof translations === 'object') {
59
+ if (process.env.NODE_ENV === 'development') {
60
+ const undefinedTranslationKeys = Object.keys(i18n).reduce((acc, current) => {
61
+ if (!(current in translations)) {
62
+ acc.push(current);
63
+ }
64
+ return acc;
65
+ }, []);
66
+ if (undefinedTranslationKeys.length) {
67
+ /* eslint-disable no-console */
68
+ console.warn('[@gitlab/ui] The following translations have not been given, so will fall back to their default US English strings:');
69
+ console.table(undefinedTranslationKeys);
70
+ /* eslint-enable no-console */
71
+ }
72
+ }
73
+
74
+ Object.assign(i18n, translations);
75
+ }
36
76
  };
37
77
 
38
78
  export default setConfigs;
79
+ export { i18n };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 29 Aug 2023 11:48:40 GMT
3
+ * Generated on Wed, 30 Aug 2023 06:58:09 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 29 Aug 2023 11:48:40 GMT
3
+ * Generated on Wed, 30 Aug 2023 06:58:09 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 29 Aug 2023 11:48:40 GMT
3
+ * Generated on Wed, 30 Aug 2023 06:58:09 GMT
4
4
  */
5
5
 
6
6
  export const BLACK = "#fff";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 29 Aug 2023 11:48:40 GMT
3
+ * Generated on Wed, 30 Aug 2023 06:58:09 GMT
4
4
  */
5
5
 
6
6
  export const BLACK = "#000";
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Tue, 29 Aug 2023 11:48:40 GMT
3
+ // Generated on Wed, 30 Aug 2023 06:58:09 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, 29 Aug 2023 11:48:40 GMT
3
+ // Generated on Wed, 30 Aug 2023 06:58:09 GMT
4
4
 
5
5
  $brand-gray-05: #2b2838 !default;
6
6
  $brand-gray-04: #45424d !default;