@gitlab/ui 111.5.0 → 111.7.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 (45) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/components/base/accordion/accordion.js +4 -5
  3. package/dist/components/base/accordion/accordion_item.js +45 -17
  4. package/dist/components/base/accordion/constants.js +3 -0
  5. package/dist/components/base/datepicker/datepicker.js +2 -1
  6. package/dist/components/base/link/link.js +18 -9
  7. package/dist/components/charts/chart/chart.js +29 -23
  8. package/dist/config.js +10 -2
  9. package/dist/utils/charts/config.js +1 -4
  10. package/dist/vendor/bootstrap-vue/src/constants/components.js +1 -7
  11. package/package.json +3 -3
  12. package/src/components/base/accordion/accordion.vue +4 -6
  13. package/src/components/base/accordion/accordion_item.vue +57 -26
  14. package/src/components/base/accordion/constants.js +1 -0
  15. package/src/components/base/datepicker/datepicker.vue +2 -1
  16. package/src/components/base/link/link.vue +17 -5
  17. package/src/components/charts/chart/chart.vue +17 -20
  18. package/src/config.js +10 -1
  19. package/src/utils/charts/config.js +0 -3
  20. package/src/vendor/bootstrap-vue/src/constants/components.js +0 -6
  21. package/dist/vendor/bootstrap-vue/src/components/form-input/form-input.js +0 -157
  22. package/dist/vendor/bootstrap-vue/src/components/form-input/index.js +0 -1
  23. package/dist/vendor/bootstrap-vue/src/components/input-group/index.js +0 -5
  24. package/dist/vendor/bootstrap-vue/src/components/input-group/input-group-addon.js +0 -44
  25. package/dist/vendor/bootstrap-vue/src/components/input-group/input-group-append.js +0 -34
  26. package/dist/vendor/bootstrap-vue/src/components/input-group/input-group-prepend.js +0 -34
  27. package/dist/vendor/bootstrap-vue/src/components/input-group/input-group-text.js +0 -31
  28. package/dist/vendor/bootstrap-vue/src/components/input-group/input-group.js +0 -75
  29. package/src/vendor/bootstrap-vue/src/components/form-input/README.md +0 -612
  30. package/src/vendor/bootstrap-vue/src/components/form-input/form-input.js +0 -168
  31. package/src/vendor/bootstrap-vue/src/components/form-input/form-input.spec.js +0 -989
  32. package/src/vendor/bootstrap-vue/src/components/form-input/index.js +0 -3
  33. package/src/vendor/bootstrap-vue/src/components/form-input/package.json +0 -135
  34. package/src/vendor/bootstrap-vue/src/components/input-group/README.md +0 -329
  35. package/src/vendor/bootstrap-vue/src/components/input-group/index.js +0 -7
  36. package/src/vendor/bootstrap-vue/src/components/input-group/input-group-addon.js +0 -43
  37. package/src/vendor/bootstrap-vue/src/components/input-group/input-group-append.js +0 -31
  38. package/src/vendor/bootstrap-vue/src/components/input-group/input-group-append.spec.js +0 -84
  39. package/src/vendor/bootstrap-vue/src/components/input-group/input-group-prepend.js +0 -31
  40. package/src/vendor/bootstrap-vue/src/components/input-group/input-group-prepend.spec.js +0 -84
  41. package/src/vendor/bootstrap-vue/src/components/input-group/input-group-text.js +0 -31
  42. package/src/vendor/bootstrap-vue/src/components/input-group/input-group-text.spec.js +0 -45
  43. package/src/vendor/bootstrap-vue/src/components/input-group/input-group.js +0 -73
  44. package/src/vendor/bootstrap-vue/src/components/input-group/input-group.spec.js +0 -153
  45. package/src/vendor/bootstrap-vue/src/components/input-group/package.json +0 -109
@@ -1,6 +1,7 @@
1
1
  <!-- eslint-disable vue/multi-word-component-names -->
2
2
  <script>
3
3
  import * as echarts from 'echarts';
4
+ import merge from 'lodash/merge';
4
5
  import {
5
6
  defaultHeight,
6
7
  defaultWidth,
@@ -17,16 +18,6 @@ import { debounceByAnimationFrame } from '../../../utils/utils';
17
18
  */
18
19
  const sizeValidator = (size) => Number.isFinite(size) || size === 'auto' || size == null;
19
20
 
20
- const isChartWithToolbox = (options) => Boolean(options?.toolbox?.show);
21
-
22
- const increaseChartGridTop = (options, increaseBy) => ({
23
- ...options,
24
- grid: {
25
- ...options.grid,
26
- top: (options?.grid?.top || 0) + increaseBy,
27
- },
28
- });
29
-
30
21
  export default {
31
22
  name: 'GlChart',
32
23
  directives: {
@@ -90,10 +81,21 @@ export default {
90
81
  };
91
82
  },
92
83
  computed: {
93
- normalizedOptions() {
94
- return isChartWithToolbox(this.options)
95
- ? increaseChartGridTop(this.options, toolboxHeight)
96
- : this.options;
84
+ modifiedOptions() {
85
+ let options = { ...this.options };
86
+
87
+ // Enable aria by default
88
+ if (options.aria?.enabled === undefined) {
89
+ options = merge({}, options, { aria: { enabled: true } });
90
+ }
91
+
92
+ // Add space at the top to fit the toolbox
93
+ if (options.toolbox?.show === true) {
94
+ const top = (options.grid?.top || 0) + toolboxHeight;
95
+ options = merge({}, options, { grid: { top } });
96
+ }
97
+
98
+ return options;
97
99
  },
98
100
  },
99
101
  watch: {
@@ -143,12 +145,7 @@ export default {
143
145
  },
144
146
  methods: {
145
147
  draw() {
146
- this.chart.setOption({
147
- ...this.normalizedOptions,
148
- aria: {
149
- enabled: true,
150
- },
151
- });
148
+ this.chart.setOption(this.modifiedOptions);
152
149
  /**
153
150
  * Emitted after calling `echarts.setOption`
154
151
  */
package/src/config.js CHANGED
@@ -35,6 +35,10 @@ try {
35
35
 
36
36
  export const i18n = translationKeys;
37
37
 
38
+ export const defaultConfig = {
39
+ firstDayOfWeek: 0, // Defaults to 0 (Sunday)
40
+ };
41
+
38
42
  let configured = false;
39
43
 
40
44
  /**
@@ -43,8 +47,9 @@ let configured = false;
43
47
  * @typedef {object} GitLabUIConfiguration
44
48
  * @template TValue=string
45
49
  * @property {undefined | Object} translations Generic translations for component labels to fall back to.
50
+ * @property {undefined | Number} firstDayOfWeek Configured first day of the week, from 0 (Sunday) to 6 (Saturday).
46
51
  */
47
- const setConfigs = ({ translations } = {}) => {
52
+ const setConfigs = ({ translations, firstDayOfWeek } = {}) => {
48
53
  if (configured) {
49
54
  if (process.env.NODE_ENV === 'development') {
50
55
  throw new Error('GitLab UI can only be configured once!');
@@ -61,6 +66,10 @@ const setConfigs = ({ translations } = {}) => {
61
66
  },
62
67
  });
63
68
 
69
+ if (typeof firstDayOfWeek === 'number' && firstDayOfWeek >= 0 && firstDayOfWeek <= 6) {
70
+ defaultConfig.firstDayOfWeek = firstDayOfWeek;
71
+ }
72
+
64
73
  if (typeof translations === 'object') {
65
74
  if (process.env.NODE_ENV === 'development') {
66
75
  const undefinedTranslationKeys = Object.keys(i18n).reduce((acc, current) => {
@@ -46,9 +46,6 @@ export const defaultChartOptions = {
46
46
  grid,
47
47
  xAxis,
48
48
  yAxis,
49
- aria: {
50
- enabled: true,
51
- },
52
49
  };
53
50
 
54
51
  export const gridWithSecondaryYAxis = {
@@ -15,7 +15,6 @@ export const NAME_FORM = 'BForm'
15
15
  export const NAME_FORM_CHECKBOX = 'BFormCheckbox'
16
16
  export const NAME_FORM_CHECKBOX_GROUP = 'BFormCheckboxGroup'
17
17
  export const NAME_FORM_GROUP = 'BFormGroup'
18
- export const NAME_FORM_INPUT = 'BFormInput'
19
18
  export const NAME_FORM_INVALID_FEEDBACK = 'BFormInvalidFeedback'
20
19
  export const NAME_FORM_RADIO = 'BFormRadio'
21
20
  export const NAME_FORM_RADIO_GROUP = 'BFormRadioGroup'
@@ -26,11 +25,6 @@ export const NAME_FORM_SELECT_OPTION_GROUP = 'BFormSelectOptionGroup'
26
25
  export const NAME_FORM_TEXT = 'BFormText'
27
26
  export const NAME_FORM_TEXTAREA = 'BFormTextarea'
28
27
  export const NAME_FORM_VALID_FEEDBACK = 'BFormValidFeedback'
29
- export const NAME_INPUT_GROUP = 'BInputGroup'
30
- export const NAME_INPUT_GROUP_ADDON = 'BInputGroupAddon'
31
- export const NAME_INPUT_GROUP_APPEND = 'BInputGroupAppend'
32
- export const NAME_INPUT_GROUP_PREPEND = 'BInputGroupPrepend'
33
- export const NAME_INPUT_GROUP_TEXT = 'BInputGroupText'
34
28
  export const NAME_LINK = 'BLink'
35
29
  export const NAME_MODAL = 'BModal'
36
30
  export const NAME_NAV = 'BNav'
@@ -1,157 +0,0 @@
1
- import { extend } from '../../vue';
2
- import { NAME_FORM_INPUT } from '../../constants/components';
3
- import { PROP_TYPE_STRING, PROP_TYPE_NUMBER_STRING, PROP_TYPE_BOOLEAN } from '../../constants/props';
4
- import { arrayIncludes } from '../../utils/array';
5
- import { attemptBlur } from '../../utils/dom';
6
- import { eventOnOff, eventOff, eventOn, stopEvent } from '../../utils/events';
7
- import { sortKeys } from '../../utils/object';
8
- import { makePropsConfigurable, makeProp } from '../../utils/props';
9
- import { props as props$2, formControlMixin } from '../../mixins/form-control';
10
- import { formSelectionMixin } from '../../mixins/form-selection';
11
- import { props as props$3, formSizeMixin } from '../../mixins/form-size';
12
- import { props as props$4, formStateMixin } from '../../mixins/form-state';
13
- import { props as props$5, formTextMixin } from '../../mixins/form-text';
14
- import { formValidityMixin } from '../../mixins/form-validity';
15
- import { props as props$1, idMixin } from '../../mixins/id';
16
- import { listenersMixin } from '../../mixins/listeners';
17
-
18
- // --- Constants ---
19
-
20
- // Valid supported input types
21
- const TYPES = ['text', 'password', 'email', 'number', 'url', 'tel', 'search', 'range', 'color', 'date', 'time', 'datetime', 'datetime-local', 'month', 'week'];
22
-
23
- // --- Props ---
24
-
25
- const props = makePropsConfigurable(sortKeys({
26
- ...props$1,
27
- ...props$2,
28
- ...props$3,
29
- ...props$4,
30
- ...props$5,
31
- list: makeProp(PROP_TYPE_STRING),
32
- max: makeProp(PROP_TYPE_NUMBER_STRING),
33
- min: makeProp(PROP_TYPE_NUMBER_STRING),
34
- // Disable mousewheel to prevent wheel from changing values (i.e. number/date)
35
- noWheel: makeProp(PROP_TYPE_BOOLEAN, false),
36
- step: makeProp(PROP_TYPE_NUMBER_STRING),
37
- type: makeProp(PROP_TYPE_STRING, 'text', type => {
38
- return arrayIncludes(TYPES, type);
39
- })
40
- }), NAME_FORM_INPUT);
41
-
42
- // --- Main component ---
43
-
44
- // @vue/component
45
- const BFormInput = /*#__PURE__*/extend({
46
- name: NAME_FORM_INPUT,
47
- // Mixin order is important!
48
- mixins: [listenersMixin, idMixin, formControlMixin, formSizeMixin, formStateMixin, formTextMixin, formSelectionMixin, formValidityMixin],
49
- props,
50
- computed: {
51
- localType() {
52
- // We only allow certain types
53
- const {
54
- type
55
- } = this;
56
- return arrayIncludes(TYPES, type) ? type : 'text';
57
- },
58
- computedAttrs() {
59
- const {
60
- localType: type,
61
- name,
62
- form,
63
- disabled,
64
- placeholder,
65
- required,
66
- min,
67
- max,
68
- step
69
- } = this;
70
- return {
71
- id: this.safeId(),
72
- name,
73
- form,
74
- type,
75
- disabled,
76
- placeholder,
77
- required,
78
- autocomplete: this.autocomplete || null,
79
- readonly: this.readonly || this.plaintext,
80
- min,
81
- max,
82
- step,
83
- list: type !== 'password' ? this.list : null,
84
- 'aria-required': required ? 'true' : null,
85
- 'aria-invalid': this.computedAriaInvalid
86
- };
87
- },
88
- computedListeners() {
89
- return {
90
- ...this.bvListeners,
91
- input: this.onInput,
92
- change: this.onChange,
93
- blur: this.onBlur
94
- };
95
- }
96
- },
97
- watch: {
98
- noWheel(newValue) {
99
- this.setWheelStopper(newValue);
100
- }
101
- },
102
- mounted() {
103
- this.setWheelStopper(this.noWheel);
104
- },
105
- /* istanbul ignore next */
106
- deactivated() {
107
- // Turn off listeners when keep-alive component deactivated
108
- /* istanbul ignore next */
109
- this.setWheelStopper(false);
110
- },
111
- /* istanbul ignore next */
112
- activated() {
113
- // Turn on listeners (if no-wheel) when keep-alive component activated
114
- /* istanbul ignore next */
115
- this.setWheelStopper(this.noWheel);
116
- },
117
- beforeDestroy() {
118
- /* istanbul ignore next */
119
- this.setWheelStopper(false);
120
- },
121
- methods: {
122
- setWheelStopper(on) {
123
- const input = this.$el;
124
- // We use native events, so that we don't interfere with propagation
125
- eventOnOff(on, input, 'focus', this.onWheelFocus);
126
- eventOnOff(on, input, 'blur', this.onWheelBlur);
127
- if (!on) {
128
- eventOff(document, 'wheel', this.stopWheel);
129
- }
130
- },
131
- onWheelFocus() {
132
- eventOn(document, 'wheel', this.stopWheel);
133
- },
134
- onWheelBlur() {
135
- eventOff(document, 'wheel', this.stopWheel);
136
- },
137
- stopWheel(event) {
138
- stopEvent(event, {
139
- propagation: false
140
- });
141
- attemptBlur(this.$el);
142
- }
143
- },
144
- render(h) {
145
- return h('input', {
146
- class: this.computedClass,
147
- attrs: this.computedAttrs,
148
- domProps: {
149
- value: this.localValue
150
- },
151
- on: this.computedListeners,
152
- ref: 'input'
153
- });
154
- }
155
- });
156
-
157
- export { BFormInput, props };
@@ -1 +0,0 @@
1
- export { BFormInput } from './form-input';
@@ -1,5 +0,0 @@
1
- export { BInputGroup } from './input-group';
2
- export { BInputGroupAddon } from './input-group-addon';
3
- export { BInputGroupPrepend } from './input-group-prepend';
4
- export { BInputGroupAppend } from './input-group-append';
5
- export { BInputGroupText } from './input-group-text';
@@ -1,44 +0,0 @@
1
- import { extend, mergeData } from '../../vue';
2
- import { NAME_INPUT_GROUP_ADDON } from '../../constants/components';
3
- import { PROP_TYPE_BOOLEAN, PROP_TYPE_STRING } from '../../constants/props';
4
- import { makePropsConfigurable, makeProp } from '../../utils/props';
5
- import { BInputGroupText } from './input-group-text';
6
-
7
- // --- Props ---
8
-
9
- const props = makePropsConfigurable({
10
- append: makeProp(PROP_TYPE_BOOLEAN, false),
11
- id: makeProp(PROP_TYPE_STRING),
12
- isText: makeProp(PROP_TYPE_BOOLEAN, false),
13
- tag: makeProp(PROP_TYPE_STRING, 'div')
14
- }, NAME_INPUT_GROUP_ADDON);
15
-
16
- // --- Main component ---
17
-
18
- // @vue/component
19
- const BInputGroupAddon = /*#__PURE__*/extend({
20
- name: NAME_INPUT_GROUP_ADDON,
21
- functional: true,
22
- props,
23
- render(h, _ref) {
24
- let {
25
- props,
26
- data,
27
- children
28
- } = _ref;
29
- const {
30
- append
31
- } = props;
32
- return h(props.tag, mergeData(data, {
33
- class: {
34
- 'input-group-append': append,
35
- 'input-group-prepend': !append
36
- },
37
- attrs: {
38
- id: props.id
39
- }
40
- }), props.isText ? [h(BInputGroupText, children)] : children);
41
- }
42
- });
43
-
44
- export { BInputGroupAddon, props };
@@ -1,34 +0,0 @@
1
- import { extend, mergeData } from '../../vue';
2
- import { NAME_INPUT_GROUP_APPEND } from '../../constants/components';
3
- import { omit } from '../../utils/object';
4
- import { makePropsConfigurable } from '../../utils/props';
5
- import { props as props$1, BInputGroupAddon } from './input-group-addon';
6
-
7
- // --- Props ---
8
-
9
- const props = makePropsConfigurable(omit(props$1, ['append']), NAME_INPUT_GROUP_APPEND);
10
-
11
- // --- Main component ---
12
-
13
- // @vue/component
14
- const BInputGroupAppend = /*#__PURE__*/extend({
15
- name: NAME_INPUT_GROUP_APPEND,
16
- functional: true,
17
- props,
18
- render(h, _ref) {
19
- let {
20
- props,
21
- data,
22
- children
23
- } = _ref;
24
- // Pass all our data down to child, and set `append` to `true`
25
- return h(BInputGroupAddon, mergeData(data, {
26
- props: {
27
- ...props,
28
- append: true
29
- }
30
- }), children);
31
- }
32
- });
33
-
34
- export { BInputGroupAppend, props };
@@ -1,34 +0,0 @@
1
- import { extend, mergeData } from '../../vue';
2
- import { NAME_INPUT_GROUP_PREPEND } from '../../constants/components';
3
- import { omit } from '../../utils/object';
4
- import { makePropsConfigurable } from '../../utils/props';
5
- import { props as props$1, BInputGroupAddon } from './input-group-addon';
6
-
7
- // --- Props ---
8
-
9
- const props = makePropsConfigurable(omit(props$1, ['append']), NAME_INPUT_GROUP_PREPEND);
10
-
11
- // --- Main component ---
12
-
13
- // @vue/component
14
- const BInputGroupPrepend = /*#__PURE__*/extend({
15
- name: NAME_INPUT_GROUP_PREPEND,
16
- functional: true,
17
- props,
18
- render(h, _ref) {
19
- let {
20
- props,
21
- data,
22
- children
23
- } = _ref;
24
- // Pass all our data down to child, and set `append` to `true`
25
- return h(BInputGroupAddon, mergeData(data, {
26
- props: {
27
- ...props,
28
- append: false
29
- }
30
- }), children);
31
- }
32
- });
33
-
34
- export { BInputGroupPrepend, props };
@@ -1,31 +0,0 @@
1
- import { extend, mergeData } from '../../vue';
2
- import { NAME_INPUT_GROUP_TEXT } from '../../constants/components';
3
- import { PROP_TYPE_STRING } from '../../constants/props';
4
- import { makePropsConfigurable, makeProp } from '../../utils/props';
5
-
6
- // --- Props ---
7
-
8
- const props = makePropsConfigurable({
9
- tag: makeProp(PROP_TYPE_STRING, 'div')
10
- }, NAME_INPUT_GROUP_TEXT);
11
-
12
- // --- Main component ---
13
-
14
- // @vue/component
15
- const BInputGroupText = /*#__PURE__*/extend({
16
- name: NAME_INPUT_GROUP_TEXT,
17
- functional: true,
18
- props,
19
- render(h, _ref) {
20
- let {
21
- props,
22
- data,
23
- children
24
- } = _ref;
25
- return h(props.tag, mergeData(data, {
26
- staticClass: 'input-group-text'
27
- }), children);
28
- }
29
- });
30
-
31
- export { BInputGroupText, props };
@@ -1,75 +0,0 @@
1
- import { extend, mergeData } from '../../vue';
2
- import { NAME_INPUT_GROUP } from '../../constants/components';
3
- import { PROP_TYPE_STRING } from '../../constants/props';
4
- import { SLOT_NAME_PREPEND, SLOT_NAME_APPEND, SLOT_NAME_DEFAULT } from '../../constants/slots';
5
- import { htmlOrText } from '../../utils/html';
6
- import { hasNormalizedSlot, normalizeSlot } from '../../utils/normalize-slot';
7
- import { makePropsConfigurable, makeProp } from '../../utils/props';
8
- import { BInputGroupAppend } from './input-group-append';
9
- import { BInputGroupPrepend } from './input-group-prepend';
10
- import { BInputGroupText } from './input-group-text';
11
-
12
- // --- Props ---
13
-
14
- const props = makePropsConfigurable({
15
- append: makeProp(PROP_TYPE_STRING),
16
- appendHtml: makeProp(PROP_TYPE_STRING),
17
- id: makeProp(PROP_TYPE_STRING),
18
- prepend: makeProp(PROP_TYPE_STRING),
19
- prependHtml: makeProp(PROP_TYPE_STRING),
20
- size: makeProp(PROP_TYPE_STRING),
21
- tag: makeProp(PROP_TYPE_STRING, 'div')
22
- }, NAME_INPUT_GROUP);
23
-
24
- // --- Main component ---
25
-
26
- // @vue/component
27
- const BInputGroup = /*#__PURE__*/extend({
28
- name: NAME_INPUT_GROUP,
29
- functional: true,
30
- props,
31
- render(h, _ref) {
32
- let {
33
- props,
34
- data,
35
- slots,
36
- scopedSlots
37
- } = _ref;
38
- const {
39
- prepend,
40
- prependHtml,
41
- append,
42
- appendHtml,
43
- size
44
- } = props;
45
- const $scopedSlots = scopedSlots || {};
46
- const $slots = slots();
47
- const slotScope = {};
48
- let $prepend = h();
49
- const hasPrependSlot = hasNormalizedSlot(SLOT_NAME_PREPEND, $scopedSlots, $slots);
50
- if (hasPrependSlot || prepend || prependHtml) {
51
- $prepend = h(BInputGroupPrepend, [hasPrependSlot ? normalizeSlot(SLOT_NAME_PREPEND, slotScope, $scopedSlots, $slots) : h(BInputGroupText, {
52
- domProps: htmlOrText(prependHtml, prepend)
53
- })]);
54
- }
55
- let $append = h();
56
- const hasAppendSlot = hasNormalizedSlot(SLOT_NAME_APPEND, $scopedSlots, $slots);
57
- if (hasAppendSlot || append || appendHtml) {
58
- $append = h(BInputGroupAppend, [hasAppendSlot ? normalizeSlot(SLOT_NAME_APPEND, slotScope, $scopedSlots, $slots) : h(BInputGroupText, {
59
- domProps: htmlOrText(appendHtml, append)
60
- })]);
61
- }
62
- return h(props.tag, mergeData(data, {
63
- staticClass: 'input-group',
64
- class: {
65
- [`input-group-${size}`]: size
66
- },
67
- attrs: {
68
- id: props.id || null,
69
- role: 'group'
70
- }
71
- }), [$prepend, normalizeSlot(SLOT_NAME_DEFAULT, slotScope, $scopedSlots, $slots), $append]);
72
- }
73
- });
74
-
75
- export { BInputGroup, props };