@gitlab/ui 32.45.0 → 32.45.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/config.js +15 -3
  3. package/dist/components/base/label/label.documentation.js +2 -9
  4. package/dist/components/base/label/label.js +23 -1
  5. package/dist/components/base/skeleton_loader/skeleton_loader.documentation.js +2 -28
  6. package/dist/components/base/skeleton_loader/skeleton_loader.js +30 -0
  7. package/dist/config.js +15 -3
  8. package/documentation/documented_stories.js +2 -0
  9. package/package.json +1 -1
  10. package/src/components/base/label/label.documentation.js +2 -12
  11. package/src/components/base/label/label.md +2 -7
  12. package/src/components/base/label/label.stories.js +66 -92
  13. package/src/components/base/label/label.vue +22 -2
  14. package/src/components/base/skeleton_loader/skeleton_loader.documentation.js +0 -27
  15. package/src/components/base/skeleton_loader/skeleton_loader.md +0 -2
  16. package/src/components/base/skeleton_loader/skeleton_loader.stories.js +23 -9
  17. package/src/components/base/skeleton_loader/skeleton_loader.vue +24 -0
  18. package/dist/components/base/label/examples/index.js +0 -19
  19. package/dist/components/base/label/examples/label.basic.example.js +0 -38
  20. package/dist/components/base/label/examples/label.scoped.example.js +0 -38
  21. package/dist/components/base/skeleton_loader/examples/ci_header_skeleton.basic.example.js +0 -38
  22. package/dist/components/base/skeleton_loader/examples/default_skeleton.basic.example.js +0 -38
  23. package/dist/components/base/skeleton_loader/examples/default_skeleton_custom_props.basic.example.js +0 -38
  24. package/dist/components/base/skeleton_loader/examples/index.js +0 -37
  25. package/dist/components/base/skeleton_loader/examples/issue_card_skeleton.basic.example.js +0 -38
  26. package/dist/components/base/skeleton_loader/examples/job_log_skeleton.basic.example.js +0 -38
  27. package/src/components/base/label/examples/index.js +0 -22
  28. package/src/components/base/label/examples/label.basic.example.vue +0 -3
  29. package/src/components/base/label/examples/label.scoped.example.vue +0 -3
  30. package/src/components/base/skeleton_loader/examples/ci_header_skeleton.basic.example.vue +0 -10
  31. package/src/components/base/skeleton_loader/examples/default_skeleton.basic.example.vue +0 -3
  32. package/src/components/base/skeleton_loader/examples/default_skeleton_custom_props.basic.example.vue +0 -9
  33. package/src/components/base/skeleton_loader/examples/index.js +0 -44
  34. package/src/components/base/skeleton_loader/examples/issue_card_skeleton.basic.example.vue +0 -26
  35. package/src/components/base/skeleton_loader/examples/job_log_skeleton.basic.example.vue +0 -13
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [32.45.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v32.45.0...v32.45.1) (2021-12-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Guard against nonexistent localStorage ([248f7b7](https://gitlab.com/gitlab-org/gitlab-ui/commit/248f7b7c662a8011c27c05dc14a6aaca4d752e33))
7
+
1
8
  # [32.45.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v32.44.0...v32.45.0) (2021-12-10)
2
9
 
3
10
 
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,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,
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 = () => {
@@ -100,6 +100,8 @@ export const setupStorybookReadme = () =>
100
100
  'GlAvatar',
101
101
  'GlAvatarLink',
102
102
  'GlPagination',
103
+ 'GlSkeletonLoader',
104
+ 'GlLabel',
103
105
  ],
104
106
  components: {
105
107
  GlComponentDocumentation,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "32.45.0",
3
+ "version": "32.45.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -1,16 +1,6 @@
1
- import examples from './examples';
1
+ import description from './label.vue';
2
2
 
3
3
  export default {
4
4
  followsDesignSystem: true,
5
- examples,
6
- events: [
7
- {
8
- event: 'click',
9
- description: 'Emitted when label is clicked',
10
- },
11
- {
12
- event: 'close',
13
- description: 'Emitted when x is clicked',
14
- },
15
- ],
5
+ description,
16
6
  };
@@ -1,15 +1,10 @@
1
- # Label
2
-
3
- <!-- STORY -->
4
- ## Usage
5
-
6
1
  Labels are editable objects that allow users to manually categorize other objects, like issues,
7
2
  merge requests, and epics. They have a name, description, and a customizable background color.
8
3
  They provide a quick way to recognize which categories the labeled object belongs to.
9
4
 
10
5
  ## Using the component
11
6
 
12
- ~~~js
7
+ ```js
13
8
  <gl-label
14
9
  background-color="#D9C2EE"
15
10
  title="Label content"
@@ -18,4 +13,4 @@ They provide a quick way to recognize which categories the labeled object belong
18
13
  tooltipPlacement="top"
19
14
  target="http://some.url"
20
15
  />
21
- ~~~
16
+ ```
@@ -1,110 +1,84 @@
1
- import { withKnobs, text, color, select, boolean } from '@storybook/addon-knobs';
2
- import { documentedStoriesOf } from '../../../../documentation/documented_stories';
3
1
  import { GlLabel } from '../../../../index';
4
2
  import { labelSizeOptions, tooltipPlacements } from '../../../utils/constants';
5
3
  import readme from './label.md';
6
4
 
7
- const components = {
8
- GlLabel,
9
- };
5
+ const template = `
6
+ <div class="gl-display-flex">
7
+ <gl-label
8
+ :background-color="backgroundColor"
9
+ :size="size"
10
+ :title="title"
11
+ :description="description"
12
+ :tooltip-placement="tooltipPlacement"
13
+ :target="target"
14
+ :scoped="scoped"
15
+ :show-close-button="showCloseButton"
16
+ :disabled="disabled"
17
+ />
18
+ </div>`;
19
+
20
+ const Template = (args, { argTypes }) => ({
21
+ components: { GlLabel },
22
+ props: Object.keys(argTypes),
23
+ template,
24
+ });
10
25
 
11
26
  const generateProps = ({
12
27
  title = 'Label title',
13
28
  size = labelSizeOptions.default,
14
29
  tooltipPlacement = tooltipPlacements.top,
15
30
  scoped = false,
31
+ description = '',
32
+ target = '#',
33
+ backgroundColor = '#D9C2EE',
16
34
  showCloseButton = false,
17
- } = {}) => {
18
- const props = {
19
- backgroundColor: {
20
- default: color('Background color', '#D9C2EE'),
21
- },
22
- title: {
23
- default: text('Label title', title),
35
+ disabled = false,
36
+ } = {}) => ({
37
+ backgroundColor,
38
+ title,
39
+ description,
40
+ size,
41
+ tooltipPlacement,
42
+ target,
43
+ scoped,
44
+ showCloseButton,
45
+ disabled,
46
+ });
47
+
48
+ export const Default = Template.bind({});
49
+ Default.args = generateProps();
50
+
51
+ export const Scoped = Template.bind({});
52
+ Scoped.args = generateProps({ title: 'scoped::label', scoped: true });
53
+
54
+ export const WithCloseButton = Template.bind({});
55
+ WithCloseButton.args = generateProps({ showCloseButton: true });
56
+
57
+ export default {
58
+ title: 'base/label',
59
+ component: GlLabel,
60
+ parameters: {
61
+ knobs: { disable: true },
62
+ docs: {
63
+ description: {
64
+ component: readme,
65
+ },
24
66
  },
25
- description: {
26
- default: text('Label description', ''),
67
+ },
68
+ argTypes: {
69
+ backgroundColor: {
70
+ control: {
71
+ type: 'color',
72
+ },
27
73
  },
28
74
  size: {
29
- type: String,
30
- default: select('Size', labelSizeOptions, size),
75
+ options: labelSizeOptions,
31
76
  },
32
77
  tooltipPlacement: {
33
- type: String,
34
- default: select('Tooltip Placement', tooltipPlacements, tooltipPlacement),
35
- },
36
- target: {
37
- default: text('Link to label target', '#'),
38
- },
39
- scoped: {
40
- default: boolean('Label is scoped', scoped),
41
- },
42
- showCloseButton: {
43
- default: boolean('Show close button', showCloseButton),
78
+ options: tooltipPlacements,
79
+ control: {
80
+ type: 'select',
81
+ },
44
82
  },
45
- disabled: {
46
- default: boolean('Close button disabled', false),
47
- },
48
- };
49
-
50
- return props;
83
+ },
51
84
  };
52
-
53
- documentedStoriesOf('base/label', readme)
54
- .addDecorator(withKnobs)
55
- .add('default', () => ({
56
- props: generateProps(),
57
- components,
58
- template: `
59
- <div class="gl-display-flex">
60
- <gl-label
61
- :background-color="backgroundColor"
62
- :size="size"
63
- :title="title"
64
- :description="description"
65
- :tooltip-placement="tooltipPlacement"
66
- :target="target"
67
- :scoped="scoped"
68
- :show-close-button="showCloseButton"
69
- :disabled="disabled"
70
- />
71
- </div>`,
72
- }))
73
- .add('scoped', () => ({
74
- props: generateProps({ title: 'scoped::label', scoped: true }),
75
- components,
76
- template: `
77
- <div class="gl-display-flex">
78
- <gl-label
79
- :background-color="backgroundColor"
80
- :size="size"
81
- :title="title"
82
- :description="description"
83
- :tooltip-placement="tooltipPlacement"
84
- :target="target"
85
- :scoped="scoped"
86
- :show-close-button="showCloseButton"
87
- :disabled="disabled"
88
- />
89
- </div>
90
- `,
91
- }))
92
- .add('with close button', () => ({
93
- props: generateProps({ showCloseButton: true }),
94
- components,
95
- template: `
96
- <div class="gl-display-flex">
97
- <gl-label
98
- :background-color="backgroundColor"
99
- :size="size"
100
- :title="title"
101
- :description="description"
102
- :tooltip-placement="tooltipPlacement"
103
- :target="target"
104
- :scoped="scoped"
105
- :show-close-button="showCloseButton"
106
- :disabled="disabled"
107
- />
108
- </div>
109
- `,
110
- }));
@@ -96,6 +96,26 @@ export default {
96
96
  this.splitScopedLabelIndex = this.title.lastIndexOf('::');
97
97
  },
98
98
  },
99
+ methods: {
100
+ onClick(e) {
101
+ /**
102
+ * Emitted when label is clicked
103
+ *
104
+ * @event click
105
+ * @type {object}
106
+ */
107
+ this.$emit('click', e);
108
+ },
109
+ onClose(e) {
110
+ /**
111
+ * Emitted when x is clicked
112
+ *
113
+ * @event close
114
+ * @type {object}
115
+ */
116
+ this.$emit('close', e);
117
+ },
118
+ },
99
119
  };
100
120
  </script>
101
121
 
@@ -106,7 +126,7 @@ export default {
106
126
  :class="cssClasses"
107
127
  :style="cssVariables"
108
128
  v-bind="$attrs"
109
- @click="$emit('click', $event)"
129
+ @click="onClick"
110
130
  >
111
131
  <gl-link :href="target" class="gl-label-link">
112
132
  <span class="gl-label-text">
@@ -122,7 +142,7 @@ export default {
122
142
  label="Remove label"
123
143
  variant="reset"
124
144
  :disabled="disabled"
125
- @click="$emit('close', $event)"
145
+ @click="onClose"
126
146
  />
127
147
  <gl-tooltip
128
148
  v-if="description"
@@ -1,33 +1,6 @@
1
- import examples from './examples';
2
1
  import * as description from './skeleton_loader.md';
3
2
 
4
3
  export default {
5
4
  followsDesignSystem: true,
6
5
  description,
7
- examples,
8
- propsInfo: {
9
- width: {
10
- additionalInfo:
11
- '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',
12
- },
13
- height: {
14
- additionalInfo:
15
- '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',
16
- },
17
- uniqueKey: {
18
- additionalInfo: 'Defaults to unique id',
19
- },
20
- preserveAspectRatio: {
21
- additionalInfo: 'Aspect ratio option of <svg/>',
22
- },
23
- baseUrl: {
24
- 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.`,
25
- },
26
- lines: {
27
- additionalInfo: 'Number of lines to show when using the default skeleton',
28
- },
29
- equalWidthLines: {
30
- additionalInfo: 'If the default skeleton lines should all be the same width',
31
- },
32
- },
33
6
  };
@@ -1,5 +1,3 @@
1
- ## Usage
2
-
3
1
  Skeleton loaders are to be used when pages or sections can be progressively populated with content,
4
2
  such as text and images, as they become available. Generally speaking the first batch of content
5
3
  will be the lightest to load and is followed by secondary and tertiary content batches. Each loading
@@ -1,14 +1,9 @@
1
- import { documentedStoriesOf } from '../../../../documentation/documented_stories';
2
1
  import { GlSkeletonLoader } from '../../../../index';
3
2
  import readme from './skeleton_loader.md';
4
3
 
5
- const components = {
6
- GlSkeletonLoader,
7
- };
8
-
9
- documentedStoriesOf('base/skeleton-loader', readme).add('default', () => ({
10
- props: {},
11
- components,
4
+ const Template = (args) => ({
5
+ components: { GlSkeletonLoader },
6
+ props: Object.keys(args),
12
7
  template: `
13
8
  <div style="background: #fff; border: 1px solid #dfdfdf; box-shadow: 0 1px 2px rgba(0,0,0,0.1); width: 359px; height: 135px; padding: 1rem; border-radius: 0.25rem;">
14
9
  <div style="width: 327px; height: 102px;">
@@ -24,4 +19,23 @@ documentedStoriesOf('base/skeleton-loader', readme).add('default', () => ({
24
19
  </gl-skeleton-loader>
25
20
  </div>
26
21
  </div>`,
27
- }));
22
+ });
23
+
24
+ export const Default = Template.bind({});
25
+ Default.args = {};
26
+
27
+ export default {
28
+ title: 'base/skeleton-loader',
29
+ component: GlSkeletonLoader,
30
+ parameters: {
31
+ knobs: { disable: true },
32
+ docs: {
33
+ description: {
34
+ component: readme,
35
+ },
36
+ },
37
+ controls: {
38
+ disable: true,
39
+ },
40
+ },
41
+ };
@@ -13,36 +13,60 @@ export default {
13
13
  name: 'GlSkeletonLoader',
14
14
  functional: true,
15
15
  props: {
16
+ /**
17
+ * It will be set in the viewbox attr in the <svg />.
18
+ * Defaults to 400 when skeleton is passed via the slot. Defaults to 235 when default skeleton is used
19
+ */
16
20
  width: {
17
21
  type: Number,
18
22
  default: null,
19
23
  required: false,
20
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
+ */
21
29
  height: {
22
30
  type: Number,
23
31
  default: null,
24
32
  required: false,
25
33
  },
34
+ /**
35
+ * Aspect ratio option of <svg/>
36
+ */
26
37
  preserveAspectRatio: {
27
38
  type: String,
28
39
  default: 'xMidYMid meet',
29
40
  required: false,
30
41
  },
42
+ /**
43
+ * Required if you're using <base url="/" /> in your <head />. Defaults to an empty string.
44
+ * This prop is common used as: <gl-skeleton-loader :base-url="$route.fullPath" /> which will fill the SVG attribute with the relative path.
45
+ */
31
46
  baseUrl: {
32
47
  type: String,
33
48
  default: '',
34
49
  required: false,
35
50
  },
51
+ /**
52
+ * Defaults to unique id
53
+ */
36
54
  uniqueKey: {
37
55
  type: String,
38
56
  default: () => uid(),
39
57
  required: false,
40
58
  },
59
+ /**
60
+ * Number of lines to show when using the default skeleton
61
+ */
41
62
  lines: {
42
63
  type: Number,
43
64
  default: 3,
44
65
  required: false,
45
66
  },
67
+ /**
68
+ * If the default skeleton lines should all be the same width
69
+ */
46
70
  equalWidthLines: {
47
71
  type: Boolean,
48
72
  default: false,
@@ -1,19 +0,0 @@
1
- import LabelBasicExample from './label.basic.example';
2
- import LabelScopedExample from './label.scoped.example';
3
-
4
- var index = [{
5
- name: 'Label',
6
- items: [{
7
- id: 'label-basic',
8
- name: 'default',
9
- description: 'Basic Label',
10
- component: LabelBasicExample
11
- }, {
12
- id: 'label-scoped',
13
- name: 'scoped',
14
- description: 'Scoped::Label',
15
- component: LabelScopedExample
16
- }]
17
- }];
18
-
19
- export default index;
@@ -1,38 +0,0 @@
1
- import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
2
-
3
- /* script */
4
-
5
- /* template */
6
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-label',{attrs:{"target":"#","background-color":"#D9C2EE","title":"Basic Label"}})};
7
- var __vue_staticRenderFns__ = [];
8
-
9
- /* style */
10
- const __vue_inject_styles__ = undefined;
11
- /* scoped */
12
- const __vue_scope_id__ = undefined;
13
- /* module identifier */
14
- const __vue_module_identifier__ = undefined;
15
- /* functional template */
16
- const __vue_is_functional_template__ = false;
17
- /* style inject */
18
-
19
- /* style inject SSR */
20
-
21
- /* style inject shadow dom */
22
-
23
-
24
-
25
- const __vue_component__ = __vue_normalize__(
26
- { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
27
- __vue_inject_styles__,
28
- {},
29
- __vue_scope_id__,
30
- __vue_is_functional_template__,
31
- __vue_module_identifier__,
32
- false,
33
- undefined,
34
- undefined,
35
- undefined
36
- );
37
-
38
- export default __vue_component__;
@@ -1,38 +0,0 @@
1
- import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
2
-
3
- /* script */
4
-
5
- /* template */
6
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-label',{attrs:{"target":"#","background-color":"#D9C2EE","title":"Basic::Label","scoped":""}})};
7
- var __vue_staticRenderFns__ = [];
8
-
9
- /* style */
10
- const __vue_inject_styles__ = undefined;
11
- /* scoped */
12
- const __vue_scope_id__ = undefined;
13
- /* module identifier */
14
- const __vue_module_identifier__ = undefined;
15
- /* functional template */
16
- const __vue_is_functional_template__ = false;
17
- /* style inject */
18
-
19
- /* style inject SSR */
20
-
21
- /* style inject shadow dom */
22
-
23
-
24
-
25
- const __vue_component__ = __vue_normalize__(
26
- { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
27
- __vue_inject_styles__,
28
- {},
29
- __vue_scope_id__,
30
- __vue_is_functional_template__,
31
- __vue_module_identifier__,
32
- false,
33
- undefined,
34
- undefined,
35
- undefined
36
- );
37
-
38
- export default __vue_component__;
@@ -1,38 +0,0 @@
1
- import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
2
-
3
- /* script */
4
-
5
- /* template */
6
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticStyle:{"width":"575px","height":"24px"}},[_c('gl-skeleton-loader',{attrs:{"width":575,"height":24}},[_c('rect',{attrs:{"width":"86","height":"24","rx":"4"}}),_vm._v(" "),_c('rect',{attrs:{"x":"94","y":"4","width":"300","height":"16","rx":"4"}}),_vm._v(" "),_c('rect',{attrs:{"x":"430","y":"4","width":"145","height":"16","rx":"4"}}),_vm._v(" "),_c('circle',{attrs:{"cx":"414","cy":"12","r":"12"}})])],1)};
7
- var __vue_staticRenderFns__ = [];
8
-
9
- /* style */
10
- const __vue_inject_styles__ = undefined;
11
- /* scoped */
12
- const __vue_scope_id__ = undefined;
13
- /* module identifier */
14
- const __vue_module_identifier__ = undefined;
15
- /* functional template */
16
- const __vue_is_functional_template__ = false;
17
- /* style inject */
18
-
19
- /* style inject SSR */
20
-
21
- /* style inject shadow dom */
22
-
23
-
24
-
25
- const __vue_component__ = __vue_normalize__(
26
- { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
27
- __vue_inject_styles__,
28
- {},
29
- __vue_scope_id__,
30
- __vue_is_functional_template__,
31
- __vue_module_identifier__,
32
- false,
33
- undefined,
34
- undefined,
35
- undefined
36
- );
37
-
38
- export default __vue_component__;
@@ -1,38 +0,0 @@
1
- import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
2
-
3
- /* script */
4
-
5
- /* template */
6
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-skeleton-loader')};
7
- var __vue_staticRenderFns__ = [];
8
-
9
- /* style */
10
- const __vue_inject_styles__ = undefined;
11
- /* scoped */
12
- const __vue_scope_id__ = undefined;
13
- /* module identifier */
14
- const __vue_module_identifier__ = undefined;
15
- /* functional template */
16
- const __vue_is_functional_template__ = false;
17
- /* style inject */
18
-
19
- /* style inject SSR */
20
-
21
- /* style inject shadow dom */
22
-
23
-
24
-
25
- const __vue_component__ = __vue_normalize__(
26
- { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
27
- __vue_inject_styles__,
28
- {},
29
- __vue_scope_id__,
30
- __vue_is_functional_template__,
31
- __vue_module_identifier__,
32
- false,
33
- undefined,
34
- undefined,
35
- undefined
36
- );
37
-
38
- export default __vue_component__;
@@ -1,38 +0,0 @@
1
- import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
2
-
3
- /* script */
4
-
5
- /* template */
6
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('gl-skeleton-loader',{attrs:{"preserve-aspect-ratio":"none","equal-width-lines":"","lines":5,"width":600,"height":66}})};
7
- var __vue_staticRenderFns__ = [];
8
-
9
- /* style */
10
- const __vue_inject_styles__ = undefined;
11
- /* scoped */
12
- const __vue_scope_id__ = undefined;
13
- /* module identifier */
14
- const __vue_module_identifier__ = undefined;
15
- /* functional template */
16
- const __vue_is_functional_template__ = false;
17
- /* style inject */
18
-
19
- /* style inject SSR */
20
-
21
- /* style inject shadow dom */
22
-
23
-
24
-
25
- const __vue_component__ = __vue_normalize__(
26
- { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
27
- __vue_inject_styles__,
28
- {},
29
- __vue_scope_id__,
30
- __vue_is_functional_template__,
31
- __vue_module_identifier__,
32
- false,
33
- undefined,
34
- undefined,
35
- undefined
36
- );
37
-
38
- export default __vue_component__;
@@ -1,37 +0,0 @@
1
- import CiHeaderSkeletonBasicExample from './ci_header_skeleton.basic.example';
2
- import DefaultSkeletonBasicExample from './default_skeleton.basic.example';
3
- import DefaultSkeletonCustomPropsBasicExample from './default_skeleton_custom_props.basic.example';
4
- import IssueCardSkeletonBasicExample from './issue_card_skeleton.basic.example';
5
- import JobLogSkeletonBasicExample from './job_log_skeleton.basic.example';
6
-
7
- var index = [{
8
- name: 'Basic',
9
- items: [{
10
- id: 'default-skeleton-basic',
11
- name: 'Default',
12
- description: 'Default Skeleton',
13
- component: DefaultSkeletonBasicExample
14
- }, {
15
- id: 'default-skeleton-custom-width-basic',
16
- name: 'Default With Custom Props',
17
- description: 'Default Skeleton With `preserve-aspect-ratio`, `lines`, `equal-width-lines`, `width` and `height` props set',
18
- component: DefaultSkeletonCustomPropsBasicExample
19
- }, {
20
- id: 'issue-card-skeleton-basic',
21
- name: 'Issue Board Card',
22
- description: 'Basic Issue Card Skeleton',
23
- component: IssueCardSkeletonBasicExample
24
- }, {
25
- id: 'job-log-skeleton-basic',
26
- name: 'Job Log',
27
- description: 'Basic Job Log Skeleton',
28
- component: JobLogSkeletonBasicExample
29
- }, {
30
- id: 'ci-header-skeleton-basic',
31
- name: 'CI Header',
32
- description: 'Basic CI Header Skeleton',
33
- component: CiHeaderSkeletonBasicExample
34
- }]
35
- }];
36
-
37
- export default index;
@@ -1,38 +0,0 @@
1
- import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
2
-
3
- /* script */
4
-
5
- /* template */
6
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticStyle:{"background":"#fff","border":"1px solid #dfdfdf","box-shadow":"0 1px 2px rgba(0, 0, 0, 0.1)","width":"359px","height":"135px","padding":"1rem","border-radius":"0.25rem"}},[_c('div',{staticStyle:{"width":"327px","height":"102px"}},[_c('gl-skeleton-loader',{attrs:{"width":327,"height":102}},[_c('rect',{attrs:{"width":"276","height":"16","rx":"4"}}),_vm._v(" "),_c('rect',{attrs:{"y":"18","width":"237","height":"16","rx":"4"}}),_vm._v(" "),_c('rect',{attrs:{"y":"42","width":"118","height":"16","rx":"8"}}),_vm._v(" "),_c('rect',{attrs:{"x":"122","y":"42","width":"130","height":"16","rx":"8"}}),_vm._v(" "),_c('rect',{attrs:{"y":"62","width":"106","height":"16","rx":"8"}}),_vm._v(" "),_c('rect',{attrs:{"x":"110","y":"62","width":"56","height":"16","rx":"8"}}),_vm._v(" "),_c('rect',{attrs:{"x":"256","y":"42","width":"71","height":"16","rx":"8"}}),_vm._v(" "),_c('rect',{attrs:{"y":"86","width":"38","height":"16","rx":"4"}})])],1)])};
7
- var __vue_staticRenderFns__ = [];
8
-
9
- /* style */
10
- const __vue_inject_styles__ = undefined;
11
- /* scoped */
12
- const __vue_scope_id__ = undefined;
13
- /* module identifier */
14
- const __vue_module_identifier__ = undefined;
15
- /* functional template */
16
- const __vue_is_functional_template__ = false;
17
- /* style inject */
18
-
19
- /* style inject SSR */
20
-
21
- /* style inject shadow dom */
22
-
23
-
24
-
25
- const __vue_component__ = __vue_normalize__(
26
- { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
27
- __vue_inject_styles__,
28
- {},
29
- __vue_scope_id__,
30
- __vue_is_functional_template__,
31
- __vue_module_identifier__,
32
- false,
33
- undefined,
34
- undefined,
35
- undefined
36
- );
37
-
38
- export default __vue_component__;
@@ -1,38 +0,0 @@
1
- import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
2
-
3
- /* script */
4
-
5
- /* template */
6
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticStyle:{"background":"#000","padding":"16px","border-radius":"0.25rem","width":"865px","height":"175px"}},[_c('div',{staticStyle:{"width":"830px","height":"113px"}},[_c('gl-skeleton-loader',{attrs:{"width":830,"height":113}},[_c('rect',{attrs:{"width":"540","height":"16","rx":"4"}}),_vm._v(" "),_c('rect',{attrs:{"y":"49","width":"701","height":"16","rx":"4"}}),_vm._v(" "),_c('rect',{attrs:{"y":"24","width":"830","height":"16","rx":"4"}}),_vm._v(" "),_c('rect',{attrs:{"y":"73","width":"540","height":"16","rx":"4"}}),_vm._v(" "),_c('rect',{attrs:{"y":"97","width":"639","height":"16","rx":"4"}})])],1)])};
7
- var __vue_staticRenderFns__ = [];
8
-
9
- /* style */
10
- const __vue_inject_styles__ = undefined;
11
- /* scoped */
12
- const __vue_scope_id__ = undefined;
13
- /* module identifier */
14
- const __vue_module_identifier__ = undefined;
15
- /* functional template */
16
- const __vue_is_functional_template__ = false;
17
- /* style inject */
18
-
19
- /* style inject SSR */
20
-
21
- /* style inject shadow dom */
22
-
23
-
24
-
25
- const __vue_component__ = __vue_normalize__(
26
- { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
27
- __vue_inject_styles__,
28
- {},
29
- __vue_scope_id__,
30
- __vue_is_functional_template__,
31
- __vue_module_identifier__,
32
- false,
33
- undefined,
34
- undefined,
35
- undefined
36
- );
37
-
38
- export default __vue_component__;
@@ -1,22 +0,0 @@
1
- import LabelBasicExample from './label.basic.example.vue';
2
- import LabelScopedExample from './label.scoped.example.vue';
3
-
4
- export default [
5
- {
6
- name: 'Label',
7
- items: [
8
- {
9
- id: 'label-basic',
10
- name: 'default',
11
- description: 'Basic Label',
12
- component: LabelBasicExample,
13
- },
14
- {
15
- id: 'label-scoped',
16
- name: 'scoped',
17
- description: 'Scoped::Label',
18
- component: LabelScopedExample,
19
- },
20
- ],
21
- },
22
- ];
@@ -1,3 +0,0 @@
1
- <template>
2
- <gl-label target="#" background-color="#D9C2EE" title="Basic Label" />
3
- </template>
@@ -1,3 +0,0 @@
1
- <template>
2
- <gl-label target="#" background-color="#D9C2EE" title="Basic::Label" scoped />
3
- </template>
@@ -1,10 +0,0 @@
1
- <template>
2
- <div style="width: 575px; height: 24px">
3
- <gl-skeleton-loader :width="575" :height="24">
4
- <rect width="86" height="24" rx="4" />
5
- <rect x="94" y="4" width="300" height="16" rx="4" />
6
- <rect x="430" y="4" width="145" height="16" rx="4" />
7
- <circle cx="414" cy="12" r="12" />
8
- </gl-skeleton-loader>
9
- </div>
10
- </template>
@@ -1,3 +0,0 @@
1
- <template>
2
- <gl-skeleton-loader />
3
- </template>
@@ -1,9 +0,0 @@
1
- <template>
2
- <gl-skeleton-loader
3
- preserve-aspect-ratio="none"
4
- equal-width-lines
5
- :lines="5"
6
- :width="600"
7
- :height="66"
8
- />
9
- </template>
@@ -1,44 +0,0 @@
1
- import CiHeaderSkeletonBasicExample from './ci_header_skeleton.basic.example.vue';
2
- import DefaultSkeletonBasicExample from './default_skeleton.basic.example.vue';
3
- import DefaultSkeletonCustomPropsBasicExample from './default_skeleton_custom_props.basic.example.vue';
4
- import IssueCardSkeletonBasicExample from './issue_card_skeleton.basic.example.vue';
5
- import JobLogSkeletonBasicExample from './job_log_skeleton.basic.example.vue';
6
-
7
- export default [
8
- {
9
- name: 'Basic',
10
- items: [
11
- {
12
- id: 'default-skeleton-basic',
13
- name: 'Default',
14
- description: 'Default Skeleton',
15
- component: DefaultSkeletonBasicExample,
16
- },
17
- {
18
- id: 'default-skeleton-custom-width-basic',
19
- name: 'Default With Custom Props',
20
- description:
21
- 'Default Skeleton With `preserve-aspect-ratio`, `lines`, `equal-width-lines`, `width` and `height` props set',
22
- component: DefaultSkeletonCustomPropsBasicExample,
23
- },
24
- {
25
- id: 'issue-card-skeleton-basic',
26
- name: 'Issue Board Card',
27
- description: 'Basic Issue Card Skeleton',
28
- component: IssueCardSkeletonBasicExample,
29
- },
30
- {
31
- id: 'job-log-skeleton-basic',
32
- name: 'Job Log',
33
- description: 'Basic Job Log Skeleton',
34
- component: JobLogSkeletonBasicExample,
35
- },
36
- {
37
- id: 'ci-header-skeleton-basic',
38
- name: 'CI Header',
39
- description: 'Basic CI Header Skeleton',
40
- component: CiHeaderSkeletonBasicExample,
41
- },
42
- ],
43
- },
44
- ];
@@ -1,26 +0,0 @@
1
- <template>
2
- <div
3
- style="
4
- background: #fff;
5
- border: 1px solid #dfdfdf;
6
- box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
7
- width: 359px;
8
- height: 135px;
9
- padding: 1rem;
10
- border-radius: 0.25rem;
11
- "
12
- >
13
- <div style="width: 327px; height: 102px">
14
- <gl-skeleton-loader :width="327" :height="102">
15
- <rect width="276" height="16" rx="4" />
16
- <rect y="18" width="237" height="16" rx="4" />
17
- <rect y="42" width="118" height="16" rx="8" />
18
- <rect x="122" y="42" width="130" height="16" rx="8" />
19
- <rect y="62" width="106" height="16" rx="8" />
20
- <rect x="110" y="62" width="56" height="16" rx="8" />
21
- <rect x="256" y="42" width="71" height="16" rx="8" />
22
- <rect y="86" width="38" height="16" rx="4" />
23
- </gl-skeleton-loader>
24
- </div>
25
- </div>
26
- </template>
@@ -1,13 +0,0 @@
1
- <template>
2
- <div style="background: #000; padding: 16px; border-radius: 0.25rem; width: 865px; height: 175px">
3
- <div style="width: 830px; height: 113px">
4
- <gl-skeleton-loader :width="830" :height="113">
5
- <rect width="540" height="16" rx="4" />
6
- <rect y="49" width="701" height="16" rx="4" />
7
- <rect y="24" width="830" height="16" rx="4" />
8
- <rect y="73" width="540" height="16" rx="4" />
9
- <rect y="97" width="639" height="16" rx="4" />
10
- </gl-skeleton-loader>
11
- </div>
12
- </div>
13
- </template>