@gitlab/ui 32.55.0 → 32.59.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.
@@ -116,6 +116,7 @@ export const setupStorybookReadme = () =>
116
116
  'GlModal',
117
117
  'GlKeysetPagination',
118
118
  'GlForm',
119
+ 'GlTable',
119
120
  ],
120
121
  components: {
121
122
  GlComponentDocumentation,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "32.55.0",
3
+ "version": "32.59.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -1,9 +1,6 @@
1
- import examples from './examples';
2
1
  import description from './table.md';
3
2
 
4
3
  export default {
5
4
  followsDesignSystem: false,
6
5
  description,
7
- examples,
8
- bootstrapComponent: 'b-table',
9
6
  };
@@ -1,13 +1,6 @@
1
- import { withKnobs, boolean, select, text } from '@storybook/addon-knobs';
2
- import { documentedStoriesOf } from '../../../../documentation/documented_stories';
3
1
  import { GlTable } from '../../../../index';
4
- import { variantOptions } from '../../../utils/constants';
5
2
  import readme from './table.md';
6
3
 
7
- const components = {
8
- GlTable,
9
- };
10
-
11
4
  const tableItems = [
12
5
  {
13
6
  column_one: 'test',
@@ -23,75 +16,96 @@ const tableItems = [
23
16
  },
24
17
  ];
25
18
 
26
- function generateProps() {
27
- const props = {
28
- fixed: {
29
- type: Boolean,
30
- default: boolean('fixed', false),
31
- },
32
- footClone: {
33
- type: Boolean,
34
- default: boolean('foot-clone', false),
19
+ const generateProps = ({ fixed = false, footClone = false, stacked = false } = {}) => ({
20
+ fixed,
21
+ footClone,
22
+ stacked,
23
+ });
24
+
25
+ export const Default = (args, { argTypes }) => ({
26
+ props: Object.keys(argTypes),
27
+ template: `
28
+ <gl-table
29
+ :items="$options.items"
30
+ :fields="$options.fields"
31
+ :fixed="fixed"
32
+ :stacked="stacked"
33
+ :foot-clone="footClone"
34
+ hover
35
+ selectable
36
+ selected-variant="primary"
37
+ />
38
+ `,
39
+ fields: [
40
+ {
41
+ key: 'column_one',
42
+ label: 'Column One',
43
+ variant: 'secondary',
44
+ sortable: false,
45
+ isRowHeader: false,
35
46
  },
36
- stacked: {
37
- type: [String, Boolean],
38
- default: select('stacked', ['sm', 'md', 'lg', 'xl', true, false], false),
47
+ {
48
+ key: 'col_2',
49
+ label: 'Column 2',
50
+ formatter: (value) => value,
39
51
  },
40
- };
52
+ ],
53
+ items: tableItems,
54
+ });
55
+ Default.args = generateProps();
41
56
 
42
- return props;
43
- }
44
-
45
- documentedStoriesOf('base/table/table', readme)
46
- .addDecorator(withKnobs)
47
- .add('default', () => ({
48
- components,
49
- props: generateProps(),
50
- template: `
51
- <gl-table
52
- :items="$options.items"
53
- :fields="$options.fields"
54
- :fixed="fixed"
55
- :stacked="stacked"
56
- :foot-clone="footClone"
57
- hover
58
- selectable
59
- selected-variant="primary"
60
- />
61
- `,
62
- fields: [
63
- {
64
- key: 'column_one',
65
- label: 'Column One',
66
- variant: select('variant', variantOptions, variantOptions.secondary),
67
- sortable: boolean('sortable', false),
68
- isRowHeader: boolean('isRowHeader', false),
69
- },
70
- {
71
- key: 'col_2',
72
- label: 'Column 2',
73
- formatter: (value) => `${text('formatterExample', '$')}${value}`,
74
- },
75
- ],
76
- items: tableItems,
77
- }))
78
- .add('empty', () => ({
79
- components,
80
- template: `
57
+ export const Empty = (args, { argTypes }) => ({
58
+ props: Object.keys(argTypes),
59
+ template: `
81
60
  <gl-table show-empty />
82
61
  `,
83
- }))
84
- .add('with filter', () => ({
85
- components,
86
- template: `<div class="gl-line-height-normal">
62
+ });
63
+ Empty.parameters = { controls: { disable: true } };
64
+
65
+ export const WithFilter = (args, { argTypes }) => ({
66
+ props: Object.keys(argTypes),
67
+ template: `<div class="gl-line-height-normal">
87
68
  <gl-form-input v-model="filter" placeholder="Type to search" />
88
69
  <br />
89
- <gl-table :items="$options.items" :fields="$options.fields" :filter=filter />
90
- </div>`,
91
- items: tableItems,
92
- data() {
93
- return {
94
- filter: null,
95
- };
70
+ <gl-table
71
+ :items="$options.items"
72
+ :fields="$options.fields"
73
+ :filter=filter
74
+ :fixed="fixed"
75
+ :stacked="stacked"
76
+ :foot-clone="footClone"
77
+ hover
78
+ selectable
79
+ selected-variant="primary"
80
+ />
81
+ </div>`,
82
+ items: tableItems,
83
+ data() {
84
+ return {
85
+ filter: null,
86
+ };
87
+ },
88
+ });
89
+ WithFilter.args = generateProps();
90
+
91
+ export default {
92
+ title: 'base/table/table',
93
+ component: GlTable,
94
+ parameters: {
95
+ bootstrapComponent: 'b-table',
96
+ knobs: { disable: true },
97
+ docs: {
98
+ description: {
99
+ component: readme,
100
+ },
96
101
  },
97
- }));
102
+ },
103
+ argTypes: {
104
+ stacked: {
105
+ control: {
106
+ type: 'select',
107
+ options: ['sm', 'md', 'lg', 'xl', true, false],
108
+ },
109
+ },
110
+ },
111
+ };