@gitlab/ui 32.44.0 → 32.47.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 (93) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/config.js +15 -3
  3. package/dist/components/base/form/form_combobox/form_combobox.documentation.js +2 -9
  4. package/dist/components/base/form/form_combobox/form_combobox.js +5 -0
  5. package/dist/components/base/form/form_group/form_group.js +11 -1
  6. package/dist/components/base/form/input_group_text/input_group_text.documentation.js +1 -5
  7. package/dist/components/base/label/label.documentation.js +2 -9
  8. package/dist/components/base/label/label.js +23 -1
  9. package/dist/components/base/skeleton_loader/skeleton_loader.documentation.js +2 -28
  10. package/dist/components/base/skeleton_loader/skeleton_loader.js +30 -0
  11. package/dist/components/charts/chart/chart.js +17 -4
  12. package/dist/components/charts/discrete_scatter/discrete_scatter.documentation.js +1 -7
  13. package/dist/components/charts/heatmap/heatmap.js +1 -9
  14. package/dist/components/charts/sparkline/sparkline.js +1 -1
  15. package/dist/components/charts/stacked_column/stacked_column.documentation.js +2 -5
  16. package/dist/components/charts/tooltip/tooltip.documentation.js +1 -5
  17. package/dist/config.js +15 -3
  18. package/dist/index.css +1 -1
  19. package/dist/index.css.map +1 -1
  20. package/dist/utility_classes.css +1 -1
  21. package/dist/utility_classes.css.map +1 -1
  22. package/documentation/documented_stories.js +7 -0
  23. package/package.json +1 -1
  24. package/src/components/base/form/form_combobox/form_combobox.documentation.js +0 -8
  25. package/src/components/base/form/form_combobox/form_combobox.md +0 -2
  26. package/src/components/base/form/form_combobox/form_combobox.stories.js +30 -30
  27. package/src/components/base/form/form_combobox/form_combobox.vue +4 -0
  28. package/src/components/base/form/form_group/form_group.scss +4 -0
  29. package/src/components/base/form/form_group/form_group.spec.js +66 -64
  30. package/src/components/base/form/form_group/form_group.stories.js +36 -13
  31. package/src/components/base/form/form_group/form_group.vue +15 -2
  32. package/src/components/base/form/input_group_text/input_group_text.documentation.js +0 -3
  33. package/src/components/base/form/input_group_text/input_group_text.stories.js +24 -18
  34. package/src/components/base/label/label.documentation.js +2 -12
  35. package/src/components/base/label/label.md +2 -7
  36. package/src/components/base/label/label.stories.js +66 -92
  37. package/src/components/base/label/label.vue +22 -2
  38. package/src/components/base/skeleton_loader/skeleton_loader.documentation.js +0 -27
  39. package/src/components/base/skeleton_loader/skeleton_loader.md +0 -2
  40. package/src/components/base/skeleton_loader/skeleton_loader.stories.js +23 -9
  41. package/src/components/base/skeleton_loader/skeleton_loader.vue +24 -0
  42. package/src/components/charts/chart/chart.spec.js +33 -4
  43. package/src/components/charts/chart/chart.vue +16 -4
  44. package/src/components/charts/discrete_scatter/discrete_scatter.documentation.js +0 -5
  45. package/src/components/charts/discrete_scatter/discrete_scatter.stories.js +34 -46
  46. package/src/components/charts/heatmap/heatmap.vue +2 -9
  47. package/src/components/charts/sparkline/sparkline.vue +7 -1
  48. package/src/components/charts/stacked_column/stacked_column.documentation.js +0 -2
  49. package/src/components/charts/stacked_column/stacked_column.md +0 -2
  50. package/src/components/charts/stacked_column/stacked_column.stories.js +74 -99
  51. package/src/components/charts/tooltip/tooltip.documentation.js +0 -3
  52. package/src/components/charts/tooltip/tooltip.stories.js +59 -44
  53. package/src/scss/utilities.scss +8 -0
  54. package/src/scss/utility-mixins/transform.scss +4 -0
  55. package/dist/components/base/form/form_combobox/examples/form_combobox.basic.example.js +0 -50
  56. package/dist/components/base/form/form_combobox/examples/index.js +0 -13
  57. package/dist/components/base/form/input_group_text/examples/index.js +0 -13
  58. package/dist/components/base/form/input_group_text/examples/input_group_text.basic.example.js +0 -38
  59. package/dist/components/base/label/examples/index.js +0 -19
  60. package/dist/components/base/label/examples/label.basic.example.js +0 -38
  61. package/dist/components/base/label/examples/label.scoped.example.js +0 -38
  62. package/dist/components/base/skeleton_loader/examples/ci_header_skeleton.basic.example.js +0 -38
  63. package/dist/components/base/skeleton_loader/examples/default_skeleton.basic.example.js +0 -38
  64. package/dist/components/base/skeleton_loader/examples/default_skeleton_custom_props.basic.example.js +0 -38
  65. package/dist/components/base/skeleton_loader/examples/index.js +0 -37
  66. package/dist/components/base/skeleton_loader/examples/issue_card_skeleton.basic.example.js +0 -38
  67. package/dist/components/base/skeleton_loader/examples/job_log_skeleton.basic.example.js +0 -38
  68. package/dist/components/charts/discrete_scatter/examples/discrete_scatter.basic.example.js +0 -51
  69. package/dist/components/charts/discrete_scatter/examples/index.js +0 -13
  70. package/dist/components/charts/stacked_column/examples/index.js +0 -13
  71. package/dist/components/charts/stacked_column/examples/stacked_column.basic.example.js +0 -46
  72. package/dist/components/charts/tooltip/examples/chart_tooltip.basic.example.js +0 -54
  73. package/dist/components/charts/tooltip/examples/index.js +0 -13
  74. package/src/components/base/form/form_combobox/examples/form_combobox.basic.example.vue +0 -31
  75. package/src/components/base/form/form_combobox/examples/index.js +0 -15
  76. package/src/components/base/form/input_group_text/examples/index.js +0 -15
  77. package/src/components/base/form/input_group_text/examples/input_group_text.basic.example.vue +0 -3
  78. package/src/components/base/label/examples/index.js +0 -22
  79. package/src/components/base/label/examples/label.basic.example.vue +0 -3
  80. package/src/components/base/label/examples/label.scoped.example.vue +0 -3
  81. package/src/components/base/skeleton_loader/examples/ci_header_skeleton.basic.example.vue +0 -10
  82. package/src/components/base/skeleton_loader/examples/default_skeleton.basic.example.vue +0 -3
  83. package/src/components/base/skeleton_loader/examples/default_skeleton_custom_props.basic.example.vue +0 -9
  84. package/src/components/base/skeleton_loader/examples/index.js +0 -44
  85. package/src/components/base/skeleton_loader/examples/issue_card_skeleton.basic.example.vue +0 -26
  86. package/src/components/base/skeleton_loader/examples/job_log_skeleton.basic.example.vue +0 -13
  87. package/src/components/charts/discrete_scatter/discrete_scatter.md +0 -1
  88. package/src/components/charts/discrete_scatter/examples/discrete_scatter.basic.example.vue +0 -31
  89. package/src/components/charts/discrete_scatter/examples/index.js +0 -15
  90. package/src/components/charts/stacked_column/examples/index.js +0 -15
  91. package/src/components/charts/stacked_column/examples/stacked_column.basic.example.vue +0 -18
  92. package/src/components/charts/tooltip/examples/chart_tooltip.basic.example.vue +0 -32
  93. package/src/components/charts/tooltip/examples/index.js +0 -15
package/CHANGELOG.md CHANGED
@@ -1,3 +1,32 @@
1
+ # [32.47.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v32.46.0...v32.47.0) (2021-12-13)
2
+
3
+
4
+ ### Features
5
+
6
+ * **GlInputGroupText:** Migrate storybook story ([3fb2328](https://gitlab.com/gitlab-org/gitlab-ui/commit/3fb2328829b002480149bf5654c6026ff26fd670))
7
+
8
+ # [32.46.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v32.45.1...v32.46.0) (2021-12-13)
9
+
10
+
11
+ ### Features
12
+
13
+ * **GlFormGroup:** Add optional prop to form_group ([25f8f64](https://gitlab.com/gitlab-org/gitlab-ui/commit/25f8f647261d1b3a8572602e84b1978541b1406f))
14
+
15
+ ## [32.45.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v32.45.0...v32.45.1) (2021-12-10)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * Guard against nonexistent localStorage ([248f7b7](https://gitlab.com/gitlab-org/gitlab-ui/commit/248f7b7c662a8011c27c05dc14a6aaca4d752e33))
21
+
22
+ # [32.45.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v32.44.0...v32.45.0) (2021-12-10)
23
+
24
+
25
+ ### Features
26
+
27
+ * **css:** add negative translate x axis util ([987ad52](https://gitlab.com/gitlab-org/gitlab-ui/commit/987ad521f0990ed5311075c76496d4d29d89c2f7))
28
+ * **GlChart:** Addition of GlResizeObserverDirective for charts ([7a57fed](https://gitlab.com/gitlab-org/gitlab-ui/commit/7a57fed4e5d48ec209891f0a11fc133f4bcc1ded))
29
+
1
30
  # [32.44.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v32.43.3...v32.44.0) (2021-12-09)
2
31
 
3
32
 
package/config.js CHANGED
@@ -11,10 +11,22 @@ const tooltipGlobalConfig = {
11
11
  delay: tooltipDelay,
12
12
  };
13
13
 
14
- const glTooltipDelay = localStorage.getItem('gl-tooltip-delay');
14
+ /**
15
+ * Guard against nonexistent localStorage,
16
+ * or corrupted localStorage
17
+ *
18
+ * localStorage access is not possible in certain environments like
19
+ * - in iframe usage in Chrome if embedded on another domain
20
+ * - tests / node
21
+ */
22
+ try {
23
+ const glTooltipDelay = localStorage.getItem('gl-tooltip-delay');
15
24
 
16
- if (glTooltipDelay) {
17
- tooltipGlobalConfig.delay = JSON.parse(glTooltipDelay);
25
+ if (glTooltipDelay) {
26
+ tooltipGlobalConfig.delay = JSON.parse(glTooltipDelay);
27
+ }
28
+ } catch (e) {
29
+ // localStorage doesn't exist (or the value is not properly formatted)
18
30
  }
19
31
 
20
32
  const setConfigs = () => {
@@ -1,6 +1,4 @@
1
- import examples from './examples';
2
-
3
- var form_combobox = "# GlFormCombobox\n\nUse this component to add a [`FormInput`](/?path=/story/base-form-form-input--default) component\nwith synchronous autocomplete dropdown. It behaves as follows:\n\n- Typing matches tokens; dropdown disappears when there is no match \n- Up and down arrows navigate the dropdown \n- Enter selects keyboard-highlighted item; clicking overrides this \n- Esc closes dropdown when it is open, clears field when it is not \n- Browser/native autocomplete dropdown hidden when ours is open, shows when it is not \n- Tab selects current entered text and moves to next field \n\nThis behavior based on\n[this w3c pattern](https://www.w3.org/TR/wai-aria-practices/examples/combobox/aria1.1pattern/listbox-combo.html)\nand [this accessible combobox example](https://alligator.io/vuejs/vue-a11y-autocomplete/).\n\n## Usage\n\nThe combobox accepts an array of string tokens, a `v-model`, and label text. Internally, it generates\nunique element IDs so multiple can be used on one page without clashing.\n\nOn selection it sets the input value to the selected string and emits a `value-selected` event for\nconsumption by parent components.\n\n```html\n<gl-form-combobox\n v-model=\"inputVal\"\n :token-list=\"tokens\"\n label-text=\"Combobox Label\"\n/>\n```\n\nIt does not have a loading state nor does it accept tokens other than strings. It allows for one\nselected value.\n\n### What if I need to load the options asynchronously?\n\nYou may want to look at [`GlSearchBoxByType`] or [`GlSearchBoxByClick`].\n\n### What if I need multiple options?\n\nThe [`GlTokenSelector`] may be what you need. Alternately, [`GlFilteredSearch`] will let you search\nand include tokens.\n\n## Edge cases\n\nThe algorithm to match tokens with the input is very naive. If you need to use the component with a\nvery large list of matches, you may want to update the implementation or use one of the search\ninputs, like [`GlSearchBoxByType`], [`GlSearchBoxByClick`], or [`GlFilteredSearch`].\n\n[`GlSearchBoxByType`]: https://gitlab-org.gitlab.io/gitlab-ui/?path=/story/base-search-box-by-type--default\n[`GlSearchBoxByClick`]: https://gitlab-org.gitlab.io/gitlab-ui/?path=/story/base-search-box-by-click--default\n[`GlTokenSelector`]: https://gitlab-org.gitlab.io/gitlab-ui/?path=/story/base-token-selector--default\n[`GlFilteredSearch`]: https://gitlab-org.gitlab.io/gitlab-ui/?path=/story/base-filtered-search--default\n";
1
+ var form_combobox = "Use this component to add a [`FormInput`](/?path=/story/base-form-form-input--default) component\nwith synchronous autocomplete dropdown. It behaves as follows:\n\n- Typing matches tokens; dropdown disappears when there is no match \n- Up and down arrows navigate the dropdown \n- Enter selects keyboard-highlighted item; clicking overrides this \n- Esc closes dropdown when it is open, clears field when it is not \n- Browser/native autocomplete dropdown hidden when ours is open, shows when it is not \n- Tab selects current entered text and moves to next field \n\nThis behavior based on\n[this w3c pattern](https://www.w3.org/TR/wai-aria-practices/examples/combobox/aria1.1pattern/listbox-combo.html)\nand [this accessible combobox example](https://alligator.io/vuejs/vue-a11y-autocomplete/).\n\n## Usage\n\nThe combobox accepts an array of string tokens, a `v-model`, and label text. Internally, it generates\nunique element IDs so multiple can be used on one page without clashing.\n\nOn selection it sets the input value to the selected string and emits a `value-selected` event for\nconsumption by parent components.\n\n```html\n<gl-form-combobox\n v-model=\"inputVal\"\n :token-list=\"tokens\"\n label-text=\"Combobox Label\"\n/>\n```\n\nIt does not have a loading state nor does it accept tokens other than strings. It allows for one\nselected value.\n\n### What if I need to load the options asynchronously?\n\nYou may want to look at [`GlSearchBoxByType`] or [`GlSearchBoxByClick`].\n\n### What if I need multiple options?\n\nThe [`GlTokenSelector`] may be what you need. Alternately, [`GlFilteredSearch`] will let you search\nand include tokens.\n\n## Edge cases\n\nThe algorithm to match tokens with the input is very naive. If you need to use the component with a\nvery large list of matches, you may want to update the implementation or use one of the search\ninputs, like [`GlSearchBoxByType`], [`GlSearchBoxByClick`], or [`GlFilteredSearch`].\n\n[`GlSearchBoxByType`]: https://gitlab-org.gitlab.io/gitlab-ui/?path=/story/base-search-box-by-type--default\n[`GlSearchBoxByClick`]: https://gitlab-org.gitlab.io/gitlab-ui/?path=/story/base-search-box-by-click--default\n[`GlTokenSelector`]: https://gitlab-org.gitlab.io/gitlab-ui/?path=/story/base-token-selector--default\n[`GlFilteredSearch`]: https://gitlab-org.gitlab.io/gitlab-ui/?path=/story/base-filtered-search--default\n";
4
2
 
5
3
  var description = /*#__PURE__*/Object.freeze({
6
4
  __proto__: null,
@@ -9,12 +7,7 @@ var description = /*#__PURE__*/Object.freeze({
9
7
 
10
8
  var form_combobox_documentation = {
11
9
  followsDesignSystem: true,
12
- description,
13
- examples,
14
- events: [{
15
- event: 'value-selected',
16
- description: 'Emitted when a value is selected.'
17
- }]
10
+ description
18
11
  };
19
12
 
20
13
  export default form_combobox_documentation;
@@ -141,6 +141,11 @@ var script = {
141
141
  selectToken(value) {
142
142
  this.$emit('input', value);
143
143
  this.closeSuggestions();
144
+ /**
145
+ * Emitted when a value is selected.
146
+ * @event value-selected
147
+ */
148
+
144
149
  this.$emit('value-selected', value);
145
150
  }
146
151
 
@@ -21,6 +21,16 @@ var script = {
21
21
  type: String,
22
22
  required: false,
23
23
  default: ''
24
+ },
25
+ optional: {
26
+ type: Boolean,
27
+ required: false,
28
+ default: false
29
+ },
30
+ optionalText: {
31
+ type: String,
32
+ required: false,
33
+ default: '(optional)'
24
34
  }
25
35
  },
26
36
  computed: {
@@ -58,7 +68,7 @@ var script = {
58
68
  const __vue_script__ = script;
59
69
 
60
70
  /* template */
61
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-form-group',_vm._b({staticClass:"gl-form-group",attrs:{"label-class":_vm.actualLabelClass},scopedSlots:_vm._u([(_vm.hasLabelDescription)?{key:"label",fn:function(){return [_vm._t("label",[_vm._v("\n "+_vm._s(_vm.$attrs.label)+"\n ")]),_vm._v(" "),_c('gl-form-text',{attrs:{"data-testid":"label-description"}},[_vm._t("label-description",[_vm._v(_vm._s(_vm.labelDescription))])],2)]},proxy:true}:null,_vm._l((Object.keys(_vm.$slots)),function(slot){return {key:slot,fn:function(){return [_vm._t(slot)]},proxy:true}})],null,true)},'b-form-group',_vm.$attrs,false))};
71
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-form-group',_vm._b({staticClass:"gl-form-group",attrs:{"label-class":_vm.actualLabelClass},scopedSlots:_vm._u([{key:"label",fn:function(){return [_vm._t("label",[_vm._v("\n "+_vm._s(_vm.$attrs.label)+"\n "),(_vm.optional)?_c('span',{staticClass:"optional-label",attrs:{"data-testid":"optional-label"}},[_vm._v(_vm._s(_vm.optionalText))]):_vm._e()]),_vm._v(" "),(_vm.hasLabelDescription)?_c('gl-form-text',{attrs:{"data-testid":"label-description"}},[_vm._t("label-description",[_vm._v(_vm._s(_vm.labelDescription))])],2):_vm._e()]},proxy:true},_vm._l((Object.keys(_vm.$slots)),function(slot){return {key:slot,fn:function(){return [_vm._t(slot)]},proxy:true}})],null,true)},'b-form-group',_vm.$attrs,false))};
62
72
  var __vue_staticRenderFns__ = [];
63
73
 
64
74
  /* style */
@@ -1,5 +1,3 @@
1
- import examples from './examples';
2
-
3
1
  var input_group_text = "### Under the hood\n\nUses [`BInputGroupText`](https://bootstrap-vue.org/docs/components/input-group#comp-ref-b-input-group-text)\nfrom Vue Boostrap\n";
4
2
 
5
3
  var description = /*#__PURE__*/Object.freeze({
@@ -8,9 +6,7 @@ var description = /*#__PURE__*/Object.freeze({
8
6
  });
9
7
 
10
8
  var input_group_text_documentation = {
11
- description,
12
- examples,
13
- propsInfo: {}
9
+ description
14
10
  };
15
11
 
16
12
  export default input_group_text_documentation;
@@ -1,15 +1,8 @@
1
- import examples from './examples';
1
+ import description from './label';
2
2
 
3
3
  var label_documentation = {
4
4
  followsDesignSystem: true,
5
- examples,
6
- events: [{
7
- event: 'click',
8
- description: 'Emitted when label is clicked'
9
- }, {
10
- event: 'close',
11
- description: 'Emitted when x is clicked'
12
- }]
5
+ description
13
6
  };
14
7
 
15
8
  export default label_documentation;
@@ -101,6 +101,28 @@ var script = {
101
101
  this.splitScopedLabelIndex = this.title.lastIndexOf('::');
102
102
  }
103
103
 
104
+ },
105
+ methods: {
106
+ onClick(e) {
107
+ /**
108
+ * Emitted when label is clicked
109
+ *
110
+ * @event click
111
+ * @type {object}
112
+ */
113
+ this.$emit('click', e);
114
+ },
115
+
116
+ onClose(e) {
117
+ /**
118
+ * Emitted when x is clicked
119
+ *
120
+ * @event close
121
+ * @type {object}
122
+ */
123
+ this.$emit('close', e);
124
+ }
125
+
104
126
  }
105
127
  };
106
128
 
@@ -108,7 +130,7 @@ var script = {
108
130
  const __vue_script__ = script;
109
131
 
110
132
  /* template */
111
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('span',_vm._b({ref:"labelTitle",staticClass:"gl-label",class:_vm.cssClasses,style:(_vm.cssVariables),on:{"click":function($event){return _vm.$emit('click', $event)}}},'span',_vm.$attrs,false),[_c('gl-link',{staticClass:"gl-label-link",attrs:{"href":_vm.target}},[_c('span',{staticClass:"gl-label-text"},[_vm._v("\n "+_vm._s(_vm.scopedKey)+"\n ")]),_vm._v(" "),(_vm.scoped && _vm.scopedValue)?_c('span',{staticClass:"gl-label-text-scoped"},[_vm._v("\n "+_vm._s(_vm.scopedValue)+"\n ")]):_vm._e()]),_vm._v(" "),(_vm.showCloseButton)?_c('close-button',{staticClass:"gl-label-close gl-p-0!",attrs:{"label":"Remove label","variant":"reset","disabled":_vm.disabled},on:{"click":function($event){return _vm.$emit('close', $event)}}}):_vm._e(),_vm._v(" "),(_vm.description)?_c('gl-tooltip',{attrs:{"target":function () { return _vm.$refs.labelTitle; },"placement":_vm.tooltipPlacement,"boundary":"viewport"}},[(_vm.scoped)?_c('span',{staticClass:"gl-label-tooltip-title"},[_vm._v("Scoped label")]):_vm._e(),_vm._v("\n "+_vm._s(_vm.description)+"\n ")]):_vm._e()],1)};
133
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('span',_vm._b({ref:"labelTitle",staticClass:"gl-label",class:_vm.cssClasses,style:(_vm.cssVariables),on:{"click":_vm.onClick}},'span',_vm.$attrs,false),[_c('gl-link',{staticClass:"gl-label-link",attrs:{"href":_vm.target}},[_c('span',{staticClass:"gl-label-text"},[_vm._v("\n "+_vm._s(_vm.scopedKey)+"\n ")]),_vm._v(" "),(_vm.scoped && _vm.scopedValue)?_c('span',{staticClass:"gl-label-text-scoped"},[_vm._v("\n "+_vm._s(_vm.scopedValue)+"\n ")]):_vm._e()]),_vm._v(" "),(_vm.showCloseButton)?_c('close-button',{staticClass:"gl-label-close gl-p-0!",attrs:{"label":"Remove label","variant":"reset","disabled":_vm.disabled},on:{"click":_vm.onClose}}):_vm._e(),_vm._v(" "),(_vm.description)?_c('gl-tooltip',{attrs:{"target":function () { return _vm.$refs.labelTitle; },"placement":_vm.tooltipPlacement,"boundary":"viewport"}},[(_vm.scoped)?_c('span',{staticClass:"gl-label-tooltip-title"},[_vm._v("Scoped label")]):_vm._e(),_vm._v("\n "+_vm._s(_vm.description)+"\n ")]):_vm._e()],1)};
112
134
  var __vue_staticRenderFns__ = [];
113
135
 
114
136
  /* style */
@@ -1,6 +1,4 @@
1
- import examples from './examples';
2
-
3
- var skeleton_loader = "## Usage\n\nSkeleton loaders are to be used when pages or sections can be progressively populated with content,\nsuch as text and images, as they become available. Generally speaking the first batch of content\nwill be the lightest to load and is followed by secondary and tertiary content batches. Each loading\nstep will add in more detail to the page until no skeleton loaders are present anymore. Content\nshould replace skeleton objects immediately when the data is available.\n\nThe skeleton loader component accepts shapes which in return will create a skeleton state with a\nloading animation. Any skeleton state components should be created with\n`<gl-skeleton-loader></gl-skeleton-loader>`. If no shape is passed via the slot the default skeleton\nwill be used. See \"Default\" and \"Default With Custom Props\" examples.\n\n## Progressive Loading\n\nDetermine if progressive loading is available, if it is break apart the skeleton to load data as it\nbecomes readily available. If progessive loading is not available, replace the entire skeleton when\nthe data is available.\n\n## Under the hood\n\nSkeleton Loader is a port of [vue-content-loader](https://github.com/egoist/vue-content-loader).\nSome changes have been made to the code to better suit our codebase, such as removing props and\nrefactoring into a SFC. Please take a look at their documentation and a useful [UI tool](http://danilowoz.com/create-vue-content-loader/)\nfor seeing the code output for `svg` shapes.\n";
1
+ var skeleton_loader = "Skeleton loaders are to be used when pages or sections can be progressively populated with content,\nsuch as text and images, as they become available. Generally speaking the first batch of content\nwill be the lightest to load and is followed by secondary and tertiary content batches. Each loading\nstep will add in more detail to the page until no skeleton loaders are present anymore. Content\nshould replace skeleton objects immediately when the data is available.\n\nThe skeleton loader component accepts shapes which in return will create a skeleton state with a\nloading animation. Any skeleton state components should be created with\n`<gl-skeleton-loader></gl-skeleton-loader>`. If no shape is passed via the slot the default skeleton\nwill be used. See \"Default\" and \"Default With Custom Props\" examples.\n\n## Progressive Loading\n\nDetermine if progressive loading is available, if it is break apart the skeleton to load data as it\nbecomes readily available. If progessive loading is not available, replace the entire skeleton when\nthe data is available.\n\n## Under the hood\n\nSkeleton Loader is a port of [vue-content-loader](https://github.com/egoist/vue-content-loader).\nSome changes have been made to the code to better suit our codebase, such as removing props and\nrefactoring into a SFC. Please take a look at their documentation and a useful [UI tool](http://danilowoz.com/create-vue-content-loader/)\nfor seeing the code output for `svg` shapes.\n";
4
2
 
5
3
  var description = /*#__PURE__*/Object.freeze({
6
4
  __proto__: null,
@@ -9,31 +7,7 @@ var description = /*#__PURE__*/Object.freeze({
9
7
 
10
8
  var skeleton_loader_documentation = {
11
9
  followsDesignSystem: true,
12
- description,
13
- examples,
14
- propsInfo: {
15
- width: {
16
- additionalInfo: 'It will be set in the viewbox attr in the <svg />. Defaults to 400 when skeleton is passed via the slot. Defaults to 235 when default skeleton is used'
17
- },
18
- height: {
19
- additionalInfo: 'It will be set in the viewbox attr in the <svg />. Defaults to 130 when skeleton is passed via the slot. Defaults to the combined height of the lines when default skeleton is used'
20
- },
21
- uniqueKey: {
22
- additionalInfo: 'Defaults to unique id'
23
- },
24
- preserveAspectRatio: {
25
- additionalInfo: 'Aspect ratio option of <svg/>'
26
- },
27
- baseUrl: {
28
- additionalInfo: `Required if you're using <base url="/" /> in your <head />. Defaults to an empty string. This prop is common used as: <gl-skeleton-loader :base-url="$route.fullPath" /> which will fill the SVG attribute with the relative path.`
29
- },
30
- lines: {
31
- additionalInfo: 'Number of lines to show when using the default skeleton'
32
- },
33
- equalWidthLines: {
34
- additionalInfo: 'If the default skeleton lines should all be the same width'
35
- }
36
- }
10
+ description
37
11
  };
38
12
 
39
13
  export default skeleton_loader_documentation;
@@ -12,36 +12,66 @@ var script = {
12
12
  name: 'GlSkeletonLoader',
13
13
  functional: true,
14
14
  props: {
15
+ /**
16
+ * It will be set in the viewbox attr in the <svg />.
17
+ * Defaults to 400 when skeleton is passed via the slot. Defaults to 235 when default skeleton is used
18
+ */
15
19
  width: {
16
20
  type: Number,
17
21
  default: null,
18
22
  required: false
19
23
  },
24
+
25
+ /**
26
+ * It will be set in the viewbox attr in the <svg />. Defaults to 130 when skeleton is passed via the slot.
27
+ * Defaults to the combined height of the lines when default skeleton is used
28
+ */
20
29
  height: {
21
30
  type: Number,
22
31
  default: null,
23
32
  required: false
24
33
  },
34
+
35
+ /**
36
+ * Aspect ratio option of <svg/>
37
+ */
25
38
  preserveAspectRatio: {
26
39
  type: String,
27
40
  default: 'xMidYMid meet',
28
41
  required: false
29
42
  },
43
+
44
+ /**
45
+ * Required if you're using <base url="/" /> in your <head />. Defaults to an empty string.
46
+ * This prop is common used as: <gl-skeleton-loader :base-url="$route.fullPath" /> which will fill the SVG attribute with the relative path.
47
+ */
30
48
  baseUrl: {
31
49
  type: String,
32
50
  default: '',
33
51
  required: false
34
52
  },
53
+
54
+ /**
55
+ * Defaults to unique id
56
+ */
35
57
  uniqueKey: {
36
58
  type: String,
37
59
  default: () => uid(),
38
60
  required: false
39
61
  },
62
+
63
+ /**
64
+ * Number of lines to show when using the default skeleton
65
+ */
40
66
  lines: {
41
67
  type: Number,
42
68
  default: 3,
43
69
  required: false
44
70
  },
71
+
72
+ /**
73
+ * If the default skeleton lines should all be the same width
74
+ */
45
75
  equalWidthLines: {
46
76
  type: Boolean,
47
77
  default: false,
@@ -1,9 +1,13 @@
1
1
  import * as echarts from 'echarts';
2
2
  import { validRenderers, defaultWidth, defaultHeight } from '../../../utils/charts/config';
3
3
  import createTheme, { themeName } from '../../../utils/charts/theme';
4
+ import { GlResizeObserverDirective } from '../../../directives/resize_observer/resize_observer';
4
5
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
5
6
 
6
7
  var script = {
8
+ directives: {
9
+ resizeObserver: GlResizeObserverDirective
10
+ },
7
11
  props: {
8
12
  options: {
9
13
  type: Object,
@@ -44,6 +48,11 @@ var script = {
44
48
  return validRenderers.includes(renderer);
45
49
  }
46
50
 
51
+ },
52
+ responsive: {
53
+ type: Boolean,
54
+ required: false,
55
+ default: false
47
56
  }
48
57
  },
49
58
 
@@ -89,7 +98,7 @@ var script = {
89
98
  echarts.connect(this.groupId);
90
99
  }
91
100
 
92
- this.chart.on('click', this.clickHandler);
101
+ this.chart.on('click', this.handleClick);
93
102
  /**
94
103
  * Emitted after calling `echarts.init`
95
104
  */
@@ -100,7 +109,7 @@ var script = {
100
109
  },
101
110
 
102
111
  beforeDestroy() {
103
- this.chart.off('click', this.clickHandler);
112
+ this.chart.off('click', this.handleClick);
104
113
  },
105
114
 
106
115
  methods: {
@@ -120,7 +129,7 @@ var script = {
120
129
  });
121
130
  },
122
131
 
123
- clickHandler(params) {
132
+ handleClick(params) {
124
133
  /**
125
134
  * Emitted when clicked on a data item in the chart (e.g., a bar/column).
126
135
  *
@@ -131,6 +140,10 @@ var script = {
131
140
  chart: this.chart,
132
141
  params
133
142
  });
143
+ },
144
+
145
+ handleResize() {
146
+ if (this.responsive) this.chart.resize();
134
147
  }
135
148
 
136
149
  }
@@ -140,7 +153,7 @@ var script = {
140
153
  const __vue_script__ = script;
141
154
 
142
155
  /* template */
143
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{ref:"chart"})};
156
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{directives:[{name:"resize-observer",rawName:"v-resize-observer",value:(_vm.handleResize),expression:"handleResize"}],ref:"chart"})};
144
157
  var __vue_staticRenderFns__ = [];
145
158
 
146
159
  /* style */
@@ -1,11 +1,5 @@
1
- import examples from './examples';
2
-
3
- var description = "### Scatter Chart\n";
4
-
5
1
  var discrete_scatter_documentation = {
6
- followsDesignSystem: true,
7
- description,
8
- examples
2
+ followsDesignSystem: true
9
3
  };
10
4
 
11
5
  export default discrete_scatter_documentation;
@@ -1,5 +1,4 @@
1
1
  import merge from 'lodash/merge';
2
- import { GlResizeObserverDirective } from '../../../directives/resize_observer/resize_observer';
3
2
  import { getDefaultTooltipContent } from '../../../utils/charts/config';
4
3
  import { TOOLTIP_LEFT_OFFSET } from '../../../utils/charts/constants';
5
4
  import { heatmapHues } from '../../../utils/charts/theme';
@@ -51,9 +50,6 @@ var script = {
51
50
  ChartTooltip,
52
51
  TooltipDefaultFormat
53
52
  },
54
- directives: {
55
- resizeObserver: GlResizeObserverDirective
56
- },
57
53
  mixins: [ToolboxMixin],
58
54
  props: {
59
55
  options: {
@@ -249,10 +245,6 @@ var script = {
249
245
  this.$emit('created', chart);
250
246
  },
251
247
 
252
- handleResize() {
253
- return this.responsive && this.chart.resize();
254
- },
255
-
256
248
  showHideTooltip(mouseEvent) {
257
249
  this.tooltip.show = this.chart.containPixel('grid', [mouseEvent.zrX, mouseEvent.zrY]);
258
250
  },
@@ -285,7 +277,7 @@ var script = {
285
277
  const __vue_script__ = script;
286
278
 
287
279
  /* template */
288
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{directives:[{name:"resize-observer",rawName:"v-resize-observer",value:(_vm.handleResize),expression:"handleResize"}],staticClass:"gl-heatmap"},[_c('chart',{attrs:{"options":_vm.computedOptions},on:{"created":_vm.onCreated}}),_vm._v(" "),(_vm.chart)?_c('chart-tooltip',{attrs:{"show":_vm.tooltip.show,"chart":_vm.chart,"top":_vm.tooltip.top,"left":_vm.tooltip.left},scopedSlots:_vm._u([{key:"title",fn:function(){return [(_vm.formatTooltipText)?_vm._t("tooltip-title"):_c('div',[_vm._v("\n "+_vm._s(_vm.tooltip.title)+"\n "),(_vm.computedOptions.xAxis.name)?[_vm._v("("+_vm._s(_vm.computedOptions.xAxis.name)+")")]:_vm._e()],2)]},proxy:true}],null,true)},[_vm._v(" "),(_vm.formatTooltipText)?_vm._t("tooltip-content"):_c('tooltip-default-format',{attrs:{"tooltip-content":_vm.tooltip.content}})],2):_vm._e(),_vm._v(" "),(_vm.compiledOptions)?_c('chart-legend',{style:(_vm.legendStyle),attrs:{"chart":_vm.chart,"series-info":_vm.seriesInfo,"text-style":_vm.compiledOptions.textStyle,"max-text":_vm.legendMaxText,"average-text":_vm.legendAverageText}}):_vm._e()],1)};
280
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"gl-heatmap"},[_c('chart',_vm._g(_vm._b({attrs:{"options":_vm.computedOptions},on:{"created":_vm.onCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.chart)?_c('chart-tooltip',{attrs:{"show":_vm.tooltip.show,"chart":_vm.chart,"top":_vm.tooltip.top,"left":_vm.tooltip.left},scopedSlots:_vm._u([{key:"title",fn:function(){return [(_vm.formatTooltipText)?_vm._t("tooltip-title"):_c('div',[_vm._v("\n "+_vm._s(_vm.tooltip.title)+"\n "),(_vm.computedOptions.xAxis.name)?[_vm._v("("+_vm._s(_vm.computedOptions.xAxis.name)+")")]:_vm._e()],2)]},proxy:true}],null,true)},[_vm._v(" "),(_vm.formatTooltipText)?_vm._t("tooltip-content"):_c('tooltip-default-format',{attrs:{"tooltip-content":_vm.tooltip.content}})],2):_vm._e(),_vm._v(" "),(_vm.compiledOptions)?_c('chart-legend',{style:(_vm.legendStyle),attrs:{"chart":_vm.chart,"series-info":_vm.seriesInfo,"text-style":_vm.compiledOptions.textStyle,"max-text":_vm.legendMaxText,"average-text":_vm.legendAverageText}}):_vm._e()],1)};
289
281
  var __vue_staticRenderFns__ = [];
290
282
 
291
283
  /* style */
@@ -192,7 +192,7 @@ var script = {
192
192
  const __vue_script__ = script;
193
193
 
194
194
  /* template */
195
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{directives:[{name:"resize-observer",rawName:"v-resize-observer",value:(_vm.handleResize),expression:"handleResize"}],staticClass:"gl-display-flex gl-align-items-center",on:{"mouseleave":_vm.hideTooltip}},[_vm._t("default"),_vm._v(" "),_c('div',{staticClass:"gl-flex-grow-1 gl-relative"},[_c('chart',{attrs:{"height":_vm.height,"options":_vm.options},on:{"created":_vm.onChartCreated}}),_vm._v(" "),(_vm.chartInstance)?_c('chart-tooltip',{style:({ pointerEvents: 'none' }),attrs:{"show":_vm.tooltip.show,"chart":_vm.chartInstance,"top":_vm.tooltip.position.top,"left":_vm.tooltip.position.left,"placement":"top"},scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('div',{staticClass:"gl-white-space-nowrap",attrs:{"data-testid":"tooltip-title"}},[_vm._v("\n "+_vm._s(_vm.tooltip.title)+"\n ")])]},proxy:true},{key:"default",fn:function(){return [_c('div',{staticClass:"gl-display-flex",attrs:{"data-testid":"tooltip-content"}},[(_vm.tooltipLabel)?_c('span',{staticClass:"gl-pr-6 gl-mr-auto"},[_vm._v(_vm._s(_vm.tooltipLabel))]):_vm._e(),_vm._v(" "),_c('strong',[_vm._v(_vm._s(_vm.tooltip.content))])])]},proxy:true}],null,false,2830367259)}):_vm._e()],1),_vm._v(" "),(_vm.showLastYValue)?_c('span',{staticClass:"gl-display-inline-flex gl-justify-content-center gl-ml-5",attrs:{"data-testid":"last-y-value"}},[_vm._v("\n "+_vm._s(_vm.lastYValue)+"\n ")]):_vm._e()],2)};
195
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{directives:[{name:"resize-observer",rawName:"v-resize-observer",value:(_vm.handleResize),expression:"handleResize"}],staticClass:"gl-display-flex gl-align-items-center",on:{"mouseleave":_vm.hideTooltip}},[_vm._t("default"),_vm._v(" "),_c('div',{staticClass:"gl-flex-grow-1 gl-relative"},[_c('chart',_vm._g(_vm._b({attrs:{"height":_vm.height,"options":_vm.options},on:{"created":_vm.onChartCreated}},'chart',_vm.$attrs,false),_vm.$listeners)),_vm._v(" "),(_vm.chartInstance)?_c('chart-tooltip',{style:({ pointerEvents: 'none' }),attrs:{"show":_vm.tooltip.show,"chart":_vm.chartInstance,"top":_vm.tooltip.position.top,"left":_vm.tooltip.position.left,"placement":"top"},scopedSlots:_vm._u([{key:"title",fn:function(){return [_c('div',{staticClass:"gl-white-space-nowrap",attrs:{"data-testid":"tooltip-title"}},[_vm._v("\n "+_vm._s(_vm.tooltip.title)+"\n ")])]},proxy:true},{key:"default",fn:function(){return [_c('div',{staticClass:"gl-display-flex",attrs:{"data-testid":"tooltip-content"}},[(_vm.tooltipLabel)?_c('span',{staticClass:"gl-pr-6 gl-mr-auto"},[_vm._v(_vm._s(_vm.tooltipLabel))]):_vm._e(),_vm._v(" "),_c('strong',[_vm._v(_vm._s(_vm.tooltip.content))])])]},proxy:true}],null,false,2830367259)}):_vm._e()],1),_vm._v(" "),(_vm.showLastYValue)?_c('span',{staticClass:"gl-display-inline-flex gl-justify-content-center gl-ml-5",attrs:{"data-testid":"last-y-value"}},[_vm._v("\n "+_vm._s(_vm.lastYValue)+"\n ")]):_vm._e()],2)};
196
196
  var __vue_staticRenderFns__ = [];
197
197
 
198
198
  /* style */
@@ -1,11 +1,8 @@
1
- import examples from './examples';
2
-
3
- var description = "# Stacked Column Chart\n\nThe `presentation` property allows you to change between a stacked and tiled presentation style. It\nis only setup to accept `stacked` or `tiled` as values, the default value is `tiled`.\n\nThe `stacked` presentation allows to view multiple series of the same stack as a single column,\nwhile `tiled` presents the information in multiple columns for each series of a stack.\n\n`groupBy` is a property that defines how the data is going to be grouped by for each of the series\nthat the `data` property provides. For example if the `data` property has a total of 3 series, with\n7 elements each, `groupBy` could use a 7 element array to show 7 stacked bars or 7 groups of bars\ndepending on the preference set by the `presentation` property.\n";
1
+ var description = "The `presentation` property allows you to change between a stacked and tiled presentation style. It\nis only setup to accept `stacked` or `tiled` as values, the default value is `tiled`.\n\nThe `stacked` presentation allows to view multiple series of the same stack as a single column,\nwhile `tiled` presents the information in multiple columns for each series of a stack.\n\n`groupBy` is a property that defines how the data is going to be grouped by for each of the series\nthat the `data` property provides. For example if the `data` property has a total of 3 series, with\n7 elements each, `groupBy` could use a 7 element array to show 7 stacked bars or 7 groups of bars\ndepending on the preference set by the `presentation` property.\n";
4
2
 
5
3
  var stacked_column_documentation = {
6
4
  followsDesignSystem: false,
7
- description,
8
- examples
5
+ description
9
6
  };
10
7
 
11
8
  export default stacked_column_documentation;
@@ -1,12 +1,8 @@
1
- import examples from './examples';
2
-
3
1
  var description = "### ECharts custom tooltip\n\nUses GitLab UI's `popover` component in lieu of echart's tooltip.\n";
4
2
 
5
3
  var tooltip_documentation = {
6
4
  followsDesignSystem: false,
7
- description,
8
- examples,
9
- bootstrapComponent: 'b-popover'
5
+ description
10
6
  };
11
7
 
12
8
  export default tooltip_documentation;
package/dist/config.js CHANGED
@@ -9,10 +9,22 @@ const tooltipGlobalConfig = {
9
9
  customClass: 'gl-tooltip',
10
10
  delay: tooltipDelay
11
11
  };
12
- const glTooltipDelay = localStorage.getItem('gl-tooltip-delay');
12
+ /**
13
+ * Guard against nonexistent localStorage,
14
+ * or corrupted localStorage
15
+ *
16
+ * localStorage access is not possible in certain environments like
17
+ * - in iframe usage in Chrome if embedded on another domain
18
+ * - tests / node
19
+ */
13
20
 
14
- if (glTooltipDelay) {
15
- tooltipGlobalConfig.delay = JSON.parse(glTooltipDelay);
21
+ try {
22
+ const glTooltipDelay = localStorage.getItem('gl-tooltip-delay');
23
+
24
+ if (glTooltipDelay) {
25
+ tooltipGlobalConfig.delay = JSON.parse(glTooltipDelay);
26
+ }
27
+ } catch (e) {// localStorage doesn't exist (or the value is not properly formatted)
16
28
  }
17
29
 
18
30
  const setConfigs = () => {