@gitlab/ui 36.5.1 → 37.0.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 (85) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/components/base/alert/alert.js +1 -11
  3. package/dist/components/base/card/card.js +1 -1
  4. package/dist/components/base/form/form_radio_group/form_radio_group.documentation.js +2 -48
  5. package/dist/components/base/form/form_radio_group/form_radio_group.js +22 -2
  6. package/dist/components/base/pagination/pagination.js +1 -1
  7. package/dist/components/charts/area/area.documentation.js +1 -7
  8. package/dist/components/charts/heatmap/heatmap.documentation.js +0 -3
  9. package/dist/components/charts/line/line.documentation.js +2 -5
  10. package/dist/components/charts/series_label/series_label.documentation.js +2 -5
  11. package/dist/index.css +2 -2
  12. package/dist/index.css.map +1 -1
  13. package/dist/utility_classes.css +1 -1
  14. package/dist/utility_classes.css.map +1 -1
  15. package/dist/utils/stories_utils.js +13 -1
  16. package/documentation/documented_stories.js +5 -0
  17. package/package.json +13 -13
  18. package/scss_to_js/scss_variables.js +1 -0
  19. package/scss_to_js/scss_variables.json +5 -0
  20. package/src/components/base/accordion/accordion.stories.js +2 -1
  21. package/src/components/base/alert/alert.scss +0 -38
  22. package/src/components/base/alert/alert.spec.js +0 -1
  23. package/src/components/base/alert/alert.stories.js +0 -8
  24. package/src/components/base/alert/alert.vue +30 -41
  25. package/src/components/base/badge/badge.stories.js +4 -24
  26. package/src/components/base/card/card.vue +2 -2
  27. package/src/components/base/daterange_picker/daterange_picker.stories.js +10 -35
  28. package/src/components/base/form/form_radio_group/form_radio_group.documentation.js +0 -48
  29. package/src/components/base/form/form_radio_group/form_radio_group.md +0 -2
  30. package/src/components/base/form/form_radio_group/form_radio_group.stories.js +50 -29
  31. package/src/components/base/form/form_radio_group/form_radio_group.vue +22 -2
  32. package/src/components/base/icon/icon.stories.js +2 -5
  33. package/src/components/base/paginated_list/__snapshots__/paginated_list.spec.js.snap +10 -10
  34. package/src/components/base/pagination/pagination.stories.js +5 -1
  35. package/src/components/base/pagination/pagination.vue +1 -1
  36. package/src/components/base/toggle/toggle.stories.js +2 -3
  37. package/src/components/charts/area/area.documentation.js +0 -5
  38. package/src/components/charts/area/area.stories.js +127 -127
  39. package/src/components/charts/bar/bar.stories.js +8 -5
  40. package/src/components/charts/heatmap/heatmap.documentation.js +0 -2
  41. package/src/components/charts/heatmap/heatmap.stories.js +58 -44
  42. package/src/components/charts/line/line.documentation.js +0 -2
  43. package/src/components/charts/line/line.md +0 -2
  44. package/src/components/charts/line/line.stories.js +124 -113
  45. package/src/components/charts/series_label/series_label.documentation.js +0 -2
  46. package/src/components/charts/series_label/series_label.md +0 -2
  47. package/src/components/charts/series_label/series_label.stories.js +62 -59
  48. package/src/scss/utilities.scss +40 -0
  49. package/src/scss/utility-mixins/border.scss +21 -0
  50. package/src/scss/variables.scss +2 -0
  51. package/src/utils/stories_utils.js +6 -0
  52. package/src/utils/stories_utils.spec.js +18 -0
  53. package/dist/components/base/form/form_radio_group/examples/form_radio_group.options_array.example.js +0 -59
  54. package/dist/components/base/form/form_radio_group/examples/form_radio_group.slots.example.js +0 -48
  55. package/dist/components/base/form/form_radio_group/examples/index.js +0 -17
  56. package/dist/components/charts/area/examples/area.basic.example.js +0 -45
  57. package/dist/components/charts/area/examples/area.basic_plus.example.js +0 -53
  58. package/dist/components/charts/area/examples/index.js +0 -19
  59. package/dist/components/charts/heatmap/examples/heatmap.custom_options.example.js +0 -79
  60. package/dist/components/charts/heatmap/examples/heatmap.hourly.example.js +0 -70
  61. package/dist/components/charts/heatmap/examples/heatmap.responsive.example.js +0 -70
  62. package/dist/components/charts/heatmap/examples/heatmap.totals.example.js +0 -62
  63. package/dist/components/charts/heatmap/examples/index.js +0 -31
  64. package/dist/components/charts/line/examples/index.js +0 -19
  65. package/dist/components/charts/line/examples/line.basic.example.js +0 -45
  66. package/dist/components/charts/line/examples/line.series.example.js +0 -53
  67. package/dist/components/charts/series_label/examples/index.js +0 -13
  68. package/dist/components/charts/series_label/examples/series_label.basic.example.js +0 -38
  69. package/src/components/base/form/form_radio_group/examples/form_radio_group.options_array.example.vue +0 -27
  70. package/src/components/base/form/form_radio_group/examples/form_radio_group.slots.example.vue +0 -21
  71. package/src/components/base/form/form_radio_group/examples/index.js +0 -20
  72. package/src/components/charts/area/area.md +0 -1
  73. package/src/components/charts/area/examples/area.basic.example.vue +0 -14
  74. package/src/components/charts/area/examples/area.basic_plus.example.vue +0 -25
  75. package/src/components/charts/area/examples/index.js +0 -22
  76. package/src/components/charts/heatmap/examples/heatmap.custom_options.example.vue +0 -70
  77. package/src/components/charts/heatmap/examples/heatmap.hourly.example.vue +0 -62
  78. package/src/components/charts/heatmap/examples/heatmap.responsive.example.vue +0 -63
  79. package/src/components/charts/heatmap/examples/heatmap.totals.example.vue +0 -38
  80. package/src/components/charts/heatmap/examples/index.js +0 -36
  81. package/src/components/charts/line/examples/index.js +0 -22
  82. package/src/components/charts/line/examples/line.basic.example.vue +0 -14
  83. package/src/components/charts/line/examples/line.series.example.vue +0 -25
  84. package/src/components/charts/series_label/examples/index.js +0 -15
  85. package/src/components/charts/series_label/examples/series_label.basic.example.vue +0 -3
@@ -9,5 +9,17 @@ const SERIES_NAME = {
9
9
  [SERIES_NAME_LONG]: 'Series name long. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tincidunt interdum sapien ut blandit. Nulla fermentum nisi id euismod vulputate. END',
10
10
  [SERIES_NAME_LONG_WITHOUT_SPACES]: 'Series_name_long._Lorem_ipsum_dolor_sit_amet,_consectetur_adipiscing_elit._Sed_tincidunt_interdum_sapien_ut_blandit._Nulla_fermentum_nisi_id_euismod_vulputate._END'
11
11
  };
12
+ /**
13
+ * Builds the parameters object disable one or multiple controls.
14
+ */
15
+
16
+ const disableControls = function () {
17
+ let controls = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
18
+ return Object.fromEntries(controls.map(control => [control, {
19
+ control: {
20
+ disable: true
21
+ }
22
+ }]));
23
+ };
12
24
 
13
- export { SERIES_NAME, SERIES_NAME_LONG, SERIES_NAME_LONG_WITHOUT_SPACES, SERIES_NAME_SHORT };
25
+ export { SERIES_NAME, SERIES_NAME_LONG, SERIES_NAME_LONG_WITHOUT_SPACES, SERIES_NAME_SHORT, disableControls };
@@ -129,6 +129,11 @@ export const setupStorybookReadme = () =>
129
129
  'GlPopover',
130
130
  'GlSingleStat',
131
131
  'GlDrawer',
132
+ 'GlHeatmap',
133
+ 'GlFormRadioGroup',
134
+ 'GlChartSeriesLabel',
135
+ 'GlAreaChart',
136
+ 'GlLineChart',
132
137
  ],
133
138
  components: {
134
139
  GlComponentDocumentation,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "36.5.1",
3
+ "version": "37.0.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -58,7 +58,7 @@
58
58
  "@babel/standalone": "^7.0.0",
59
59
  "bootstrap-vue": "2.20.1",
60
60
  "copy-to-clipboard": "^3.0.8",
61
- "dompurify": "^2.3.5",
61
+ "dompurify": "^2.3.6",
62
62
  "echarts": "^5.2.1",
63
63
  "highlight.js": "^10.6.0",
64
64
  "iframe-resizer": "^4.3.2",
@@ -76,7 +76,8 @@
76
76
  "vue": "^2.6.10"
77
77
  },
78
78
  "resolutions": {
79
- "chokidar": "^3.5.2"
79
+ "chokidar": "^3.5.2",
80
+ "sane": "^5.0.1"
80
81
  },
81
82
  "devDependencies": {
82
83
  "@arkweid/lefthook": "^0.7.6",
@@ -84,19 +85,19 @@
84
85
  "@babel/preset-env": "^7.10.2",
85
86
  "@gitlab/eslint-plugin": "10.0.2",
86
87
  "@gitlab/stylelint-config": "4.0.0",
87
- "@gitlab/svgs": "2.5.0",
88
+ "@gitlab/svgs": "2.6.0",
88
89
  "@rollup/plugin-commonjs": "^11.1.0",
89
90
  "@rollup/plugin-node-resolve": "^7.1.3",
90
91
  "@rollup/plugin-replace": "^2.3.2",
91
- "@storybook/addon-a11y": "6.4.15",
92
- "@storybook/addon-docs": "6.4.15",
93
- "@storybook/addon-essentials": "6.4.15",
92
+ "@storybook/addon-a11y": "6.4.19",
93
+ "@storybook/addon-docs": "6.4.19",
94
+ "@storybook/addon-essentials": "6.4.19",
94
95
  "@storybook/addon-knobs": "6.4.0",
95
- "@storybook/addon-storyshots": "6.4.15",
96
- "@storybook/addon-storyshots-puppeteer": "6.4.15",
97
- "@storybook/addon-viewport": "6.4.15",
98
- "@storybook/theming": "6.4.15",
99
- "@storybook/vue": "6.4.15",
96
+ "@storybook/addon-storyshots": "6.4.19",
97
+ "@storybook/addon-storyshots-puppeteer": "6.4.19",
98
+ "@storybook/addon-viewport": "6.4.19",
99
+ "@storybook/theming": "6.4.19",
100
+ "@storybook/vue": "6.4.19",
100
101
  "@vue/test-utils": "1.3.0",
101
102
  "autoprefixer": "^9.7.6",
102
103
  "babel-jest": "^26.6.3",
@@ -122,7 +123,6 @@
122
123
  "mockdate": "^2.0.5",
123
124
  "node-sass": "^4.14.1",
124
125
  "node-sass-magic-importer": "^5.3.2",
125
- "nodemon": "^1.11.0",
126
126
  "npm-run-all": "^4.1.5",
127
127
  "pikaday": "^1.8.0",
128
128
  "plop": "^2.5.4",
@@ -276,6 +276,7 @@ export const glFontSizeMonospaceSm = '0.6875rem'
276
276
  export const glMonospaceFont = 'Menlo, DejaVu Sans Mono, Liberation Mono, Consolas, Ubuntu Mono, Courier New, andale mono, lucida console, monospace'
277
277
  export const glRegularFont = '-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Noto Sans, Ubuntu, Cantarell, Helvetica Neue, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji'
278
278
  export const glFonts = '("monospace": "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace, "regular": -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Ubuntu, Cantarell, "Helvetica Neue", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji")'
279
+ export const borderColor = '#dbdbdb'
279
280
  export const glBorderSize1 = '1px'
280
281
  export const glBorderSize2 = '2px'
281
282
  export const glBorderSize3 = '3px'
@@ -1441,6 +1441,11 @@
1441
1441
  ],
1442
1442
  "compiledValue": "(\"monospace\": \"Menlo\", \"DejaVu Sans Mono\", \"Liberation Mono\", \"Consolas\", \"Ubuntu Mono\", \"Courier New\", \"andale mono\", \"lucida console\", monospace, \"regular\": -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Noto Sans\", Ubuntu, Cantarell, \"Helvetica Neue\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\")"
1443
1443
  },
1444
+ {
1445
+ "name": "$border-color",
1446
+ "value": "$gray-100",
1447
+ "compiledValue": "#dbdbdb"
1448
+ },
1444
1449
  {
1445
1450
  "name": "$gl-border-size-1",
1446
1451
  "value": "1px",
@@ -1,3 +1,4 @@
1
+ import { disableControls } from '../../../utils/stories_utils';
1
2
  import readme from './accordion.md';
2
3
  import GlAccordion from './accordion.vue';
3
4
  import GlAccordionItem from './accordion_item.vue';
@@ -63,6 +64,6 @@ export default {
63
64
  options: [1, 2, 3, 4, 5, 6],
64
65
  },
65
66
  },
66
- autoCollapse: { control: { disable: true } },
67
+ ...disableControls(['autoCollapse']),
67
68
  },
68
69
  };
@@ -85,44 +85,6 @@
85
85
  @include gl-right-4;
86
86
  }
87
87
 
88
- .gl-alert-max-content {
89
- @include gl-display-flex;
90
- @include gl-justify-content-center;
91
- @include gl-p-5;
92
-
93
- .gl-alert-icon {
94
- @include gl-static;
95
- @include gl-mr-5;
96
- @include gl-flex-shrink-0;
97
- }
98
-
99
- .gl-dismiss-btn {
100
- @include gl-static;
101
- @include gl-align-self-start;
102
- @include gl-ml-4;
103
- // The negative margins optically align the × with the title text and right padding
104
- margin-top: -$gl-spacing-scale-2;
105
- margin-right: -$gl-spacing-scale-2;
106
- order: 3;
107
- }
108
-
109
- .gl-alert-container {
110
- @include gl-relative;
111
- @include gl-display-flex;
112
- @include gl-justify-content-space-between;
113
- @include gl-flex-grow-1;
114
- @include gl-mx-auto;
115
- }
116
-
117
- .gl-alert-content {
118
- @include gl-flex-grow-1;
119
- }
120
- }
121
-
122
- .gl-alert-layout-limited .gl-alert-container {
123
- @include gl-layout-w-limited;
124
- }
125
-
126
88
  .gl-alert-danger {
127
89
  @include gl-bg-red-50;
128
90
 
@@ -154,7 +154,6 @@ describe('Alert component', () => {
154
154
  describe('top-level classes', () => {
155
155
  describe.each`
156
156
  prop | cssClass | presentIf
157
- ${'contained'} | ${'gl-alert-max-content'} | ${true}
158
157
  ${'sticky'} | ${'gl-alert-sticky'} | ${true}
159
158
  ${'dismissible'} | ${'gl-alert-not-dismissible'} | ${false}
160
159
  `('$cssClass', ({ prop, cssClass, presentIf }) => {
@@ -12,7 +12,6 @@ const template = `
12
12
  :secondary-button-text="secondaryButtonText"
13
13
  :primary-button-link="primaryButtonLink"
14
14
  :secondary-button-link="secondaryButtonLink"
15
- :contained="contained"
16
15
  :sticky="sticky"
17
16
  >{{ message }}</gl-alert>`;
18
17
 
@@ -27,7 +26,6 @@ const generateProps = ({
27
26
  primaryButtonLink = defaultValue('primaryButtonLink'),
28
27
  secondaryButtonText = defaultValue('secondaryButtonText'),
29
28
  secondaryButtonLink = defaultValue('secondaryButtonLink'),
30
- contained = defaultValue('contained'),
31
29
  sticky = defaultValue('sticky'),
32
30
  } = {}) => ({
33
31
  title,
@@ -39,7 +37,6 @@ const generateProps = ({
39
37
  primaryButtonLink,
40
38
  secondaryButtonText,
41
39
  secondaryButtonLink,
42
- contained,
43
40
  sticky,
44
41
  });
45
42
 
@@ -118,11 +115,6 @@ Variants.parameters = {
118
115
  storyshots: { disable: true },
119
116
  };
120
117
 
121
- export const Contained = Template.bind({});
122
- Contained.args = generateProps({
123
- contained: true,
124
- });
125
-
126
118
  export const Sticky = () => ({
127
119
  components: { GlAlert },
128
120
  variants: alertVariantOptions,
@@ -74,14 +74,6 @@ export default {
74
74
  required: false,
75
75
  default: '',
76
76
  },
77
- /**
78
- * Contained alerts have their content's width limited.
79
- */
80
- contained: {
81
- type: Boolean,
82
- required: false,
83
- default: false,
84
- },
85
77
  sticky: {
86
78
  type: Boolean,
87
79
  required: false,
@@ -171,48 +163,45 @@ export default {
171
163
  <div
172
164
  :class="[
173
165
  'gl-alert',
174
- { 'gl-alert-max-content gl-alert-layout-limited': contained },
175
166
  { 'gl-alert-sticky': sticky },
176
167
  { 'gl-alert-not-dismissible': !dismissible },
177
168
  variantClass,
178
169
  ]"
179
170
  >
180
- <div class="gl-alert-container">
181
- <gl-icon
182
- :name="iconName"
183
- :class="{ 'gl-alert-icon': true, 'gl-alert-icon-no-title': !title }"
184
- />
171
+ <gl-icon
172
+ :name="iconName"
173
+ :class="{ 'gl-alert-icon': true, 'gl-alert-icon-no-title': !title }"
174
+ />
185
175
 
186
- <close-button
187
- v-if="dismissible"
188
- ref="dismiss"
189
- class="gl-dismiss-btn"
190
- :label="dismissLabel"
191
- @click="onDismiss"
192
- />
176
+ <close-button
177
+ v-if="dismissible"
178
+ ref="dismiss"
179
+ class="gl-dismiss-btn"
180
+ :label="dismissLabel"
181
+ @click="onDismiss"
182
+ />
193
183
 
194
- <div class="gl-alert-content" role="alert">
195
- <h4 v-if="title" class="gl-alert-title">{{ title }}</h4>
184
+ <div class="gl-alert-content" role="alert">
185
+ <h4 v-if="title" class="gl-alert-title">{{ title }}</h4>
196
186
 
197
- <div class="gl-alert-body">
198
- <!-- @slot The alert message to display. -->
199
- <slot></slot>
200
- </div>
187
+ <div class="gl-alert-body">
188
+ <!-- @slot The alert message to display. -->
189
+ <slot></slot>
190
+ </div>
201
191
 
202
- <div v-if="shouldRenderActions" class="gl-alert-actions">
203
- <!-- @slot If the primary/secondary action buttons aren't flexible enough, place arbitrary content here. -->
204
- <slot name="actions">
205
- <gl-button
206
- v-for="(actionButton, index) in actionButtons"
207
- :key="index"
208
- class="gl-alert-action"
209
- v-bind="actionButton.attrs"
210
- v-on="actionButton.listeners"
211
- >
212
- {{ actionButton.text }}
213
- </gl-button>
214
- </slot>
215
- </div>
192
+ <div v-if="shouldRenderActions" class="gl-alert-actions">
193
+ <!-- @slot If the primary/secondary action buttons aren't flexible enough, place arbitrary content here. -->
194
+ <slot name="actions">
195
+ <gl-button
196
+ v-for="(actionButton, index) in actionButtons"
197
+ :key="index"
198
+ class="gl-alert-action"
199
+ v-bind="actionButton.attrs"
200
+ v-on="actionButton.listeners"
201
+ >
202
+ {{ actionButton.text }}
203
+ </gl-button>
204
+ </slot>
216
205
  </div>
217
206
  </div>
218
207
  </div>
@@ -1,6 +1,7 @@
1
1
  import iconSpriteInfo from '@gitlab/svgs/dist/icons.json';
2
2
  import { GlBadge } from '../../../index';
3
3
  import { badgeSizeOptions, badgeVariantOptions } from '../../../utils/constants';
4
+ import { disableControls } from '../../../utils/stories_utils';
4
5
  import readme from './badge.md';
5
6
 
6
7
  const template = `
@@ -61,14 +62,7 @@ export const Variants = (args, { argTypes }) => ({
61
62
  Variants.args = generateProps({
62
63
  variant: badgeVariantOptions.warning,
63
64
  });
64
- Variants.argTypes = {
65
- content: {
66
- control: { disable: true },
67
- },
68
- variant: {
69
- control: { disable: true },
70
- },
71
- };
65
+ Variants.argTypes = disableControls(['content', 'variant']);
72
66
 
73
67
  export const Actionable = (args, { argTypes }) => ({
74
68
  components: { GlBadge },
@@ -95,14 +89,7 @@ Actionable.args = generateProps({
95
89
  Actionable.parameters = {
96
90
  storyshots: { disable: true },
97
91
  };
98
- Actionable.argTypes = {
99
- content: {
100
- control: { disable: true },
101
- },
102
- variant: {
103
- control: { disable: true },
104
- },
105
- };
92
+ Actionable.argTypes = disableControls(['content', 'variant']);
106
93
 
107
94
  export const Sizes = (args, { argTypes }) => ({
108
95
  components: { GlBadge },
@@ -125,14 +112,7 @@ export const Sizes = (args, { argTypes }) => ({
125
112
  Sizes.args = generateProps({
126
113
  variant: badgeVariantOptions.danger,
127
114
  });
128
- Sizes.argTypes = {
129
- content: {
130
- control: { disable: true },
131
- },
132
- size: {
133
- control: { disable: true },
134
- },
135
- };
115
+ Sizes.argTypes = disableControls(['content', 'size']);
136
116
 
137
117
  export const BadgeIcon = (args, { argTypes }) => ({
138
118
  components: { GlBadge },
@@ -31,7 +31,7 @@ export default {
31
31
 
32
32
  <template>
33
33
  <div class="gl-card">
34
- <div v-if="this.$slots.header" class="gl-card-header" :class="headerClass">
34
+ <div v-if="$slots.header" class="gl-card-header" :class="headerClass">
35
35
  <!-- @slot The card's header content. -->
36
36
  <slot name="header"></slot>
37
37
  </div>
@@ -39,7 +39,7 @@ export default {
39
39
  <!-- @slot The card's main content. -->
40
40
  <slot></slot>
41
41
  </div>
42
- <div v-if="this.$slots.footer" class="gl-card-footer" :class="footerClass">
42
+ <div v-if="$slots.footer" class="gl-card-footer" :class="footerClass">
43
43
  <!-- @slot The card's footer content. -->
44
44
  <slot name="footer"></slot>
45
45
  </div>
@@ -1,3 +1,4 @@
1
+ import { disableControls } from '../../../utils/stories_utils';
1
2
  import readme from './daterange_picker.md';
2
3
  import GlDaterangePicker from './daterange_picker.vue';
3
4
 
@@ -121,31 +122,15 @@ export default {
121
122
  },
122
123
  },
123
124
  argTypes: {
124
- i18n: {
125
- control: {
126
- disable: true,
127
- },
128
- },
129
- startPickerTarget: {
130
- control: {
131
- disable: true,
132
- },
133
- },
134
- startPickerContainer: {
135
- control: {
136
- disable: true,
137
- },
138
- },
139
- endPickerTarget: {
140
- control: {
141
- disable: true,
142
- },
143
- },
144
- endPickerContainer: {
145
- control: {
146
- disable: true,
147
- },
148
- },
125
+ ...disableControls([
126
+ 'i18n',
127
+ 'startPickerTarget',
128
+ 'startPickerContainer',
129
+ 'endPickerTarget',
130
+ 'endPickerContainer',
131
+ 'defaultStartDate',
132
+ 'defaultEndDate',
133
+ ]),
149
134
  defaultMinDate: {
150
135
  control: {
151
136
  type: 'date',
@@ -156,15 +141,5 @@ export default {
156
141
  type: 'date',
157
142
  },
158
143
  },
159
- defaultStartDate: {
160
- control: {
161
- disable: true,
162
- },
163
- },
164
- defaultEndDate: {
165
- control: {
166
- disable: true,
167
- },
168
- },
169
144
  },
170
145
  };
@@ -1,54 +1,6 @@
1
- import examples from './examples';
2
1
  import description from './form_radio_group.md';
3
2
 
4
3
  export default {
5
4
  description,
6
- examples,
7
5
  followsDesignSystem: true,
8
- bootstrapComponent: 'b-form-radio-group',
9
- propsInfo: {
10
- options: {
11
- additionalInfo: 'Array of objects representing the radios to render',
12
- },
13
- valueField: {
14
- additionalInfo: 'Field name in the options prop that should be used for the value',
15
- },
16
- textField: {
17
- additionalInfo: 'Field name in the options prop that should be used for the text label',
18
- },
19
- htmlField: {
20
- additionalInfo:
21
- 'Field name in the options prop that should be used for the html label instead of text field. Use with caution.',
22
- },
23
- disabledField: {
24
- additionalInfo: 'Field name in the options prop that should be used for the disabled state',
25
- },
26
- checked: {
27
- additionalInfo: 'The current value of the checked radio in the group',
28
- },
29
- },
30
- events: [
31
- {
32
- event: 'input',
33
- args: [{ arg: 'checked', description: 'current selected value of radio group' }],
34
- description: 'Emitted when the selected value is changed',
35
- },
36
- {
37
- event: 'change',
38
- args: [{ arg: 'checked', description: 'current selected value of radio group' }],
39
- description: 'Emitted when the selected value is changed due to user interaction',
40
- },
41
- ],
42
- slots: [
43
- {
44
- name: 'first',
45
- description:
46
- 'Slot for GlFormRadios that will appear before radios generated from options prop',
47
- },
48
- {
49
- name: 'default',
50
- description:
51
- 'Slot for GlFormRadios that will appear after radios generated from options prop',
52
- },
53
- ],
54
6
  };
@@ -1,5 +1,3 @@
1
- # GlFormRadioGroup
2
-
3
1
  The `GlFormRadioGroup` component provides an alternative and sometimes more
4
2
  compact way of setting up a group of `GlFormRadio` components.
5
3
 
@@ -1,30 +1,16 @@
1
- import { withKnobs, object, text } from '@storybook/addon-knobs';
2
- import { documentedStoriesOf } from '../../../../../documentation/documented_stories';
3
- import { GlFormRadioGroup, GlFormRadio } from '../../../../index';
1
+ import { GlFormRadioGroup } from '../../../../index';
4
2
  import readme from './form_radio_group.md';
5
3
 
6
- const components = {
7
- GlFormRadioGroup,
8
- GlFormRadio,
9
- };
10
-
11
4
  const defaultOptions = [
12
5
  { value: 'pizza', text: 'Pizza' },
13
6
  { value: 'tacos', text: 'Tacos' },
14
7
  { value: 'burger', text: 'Burger', disabled: true },
15
8
  ];
16
-
17
- function generateProps({ name = 'radio-group-name', options = defaultOptions } = {}) {
18
- return {
19
- name: {
20
- type: String,
21
- default: text('name', name),
22
- },
23
- options: {
24
- default: object('options', options),
25
- },
26
- };
27
- }
9
+ const data = () => ({ selected: 'slot-option' });
10
+ const generateProps = ({ name = 'radio-group-name', options = defaultOptions } = {}) => ({
11
+ name,
12
+ options,
13
+ });
28
14
 
29
15
  const template = `
30
16
  <div>
@@ -45,13 +31,48 @@ const template = `
45
31
  </gl-form-radio-group>
46
32
  </div>`;
47
33
 
48
- const data = () => ({ selected: 'slot-option' });
34
+ const Template = (args, { argTypes }) => ({
35
+ components: {
36
+ GlFormRadioGroup,
37
+ },
38
+ props: Object.keys(argTypes),
39
+ template,
40
+ data,
41
+ });
42
+ export const Default = Template.bind({});
43
+ Default.args = generateProps();
49
44
 
50
- documentedStoriesOf('base/form/form-radio-group', readme)
51
- .addDecorator(withKnobs)
52
- .add('default', () => ({
53
- components,
54
- props: generateProps(),
55
- data,
56
- template,
57
- }));
45
+ export default {
46
+ title: 'base/form/form-radio-group',
47
+ component: GlFormRadioGroup,
48
+ parameters: {
49
+ knobs: { disable: true },
50
+ bootstrapComponent: 'b-form-radio-group',
51
+ docs: {
52
+ description: {
53
+ component: readme,
54
+ },
55
+ },
56
+ },
57
+ argTypes: {
58
+ options: {
59
+ description: 'Array of objects representing the radios to render',
60
+ },
61
+ valueField: {
62
+ description: 'Field name in the options prop that should be used for the value',
63
+ },
64
+ textField: {
65
+ description: 'Field name in the options prop that should be used for the text label',
66
+ },
67
+ htmlField: {
68
+ description:
69
+ 'Field name in the options prop that should be used for the html label instead of text field. Use with caution.',
70
+ },
71
+ disabledField: {
72
+ description: 'Field name in the options prop that should be used for the disabled state',
73
+ },
74
+ checked: {
75
+ description: 'The current value of the checked radio in the group',
76
+ },
77
+ },
78
+ };
@@ -17,6 +17,24 @@ export default {
17
17
  mixins: [formOptionsMixin],
18
18
  inheritAttrs: false,
19
19
  model,
20
+ methods: {
21
+ onInput(e) {
22
+ /**
23
+ * Emitted when the selected value is changed.
24
+ *
25
+ * @event input
26
+ */
27
+ this.$emit('input', e);
28
+ },
29
+ onChange(e) {
30
+ /**
31
+ * Emitted when the selected value is changed.
32
+ *
33
+ * @event change
34
+ */
35
+ this.$emit('change', e);
36
+ },
37
+ },
20
38
  };
21
39
  </script>
22
40
  <template>
@@ -25,9 +43,10 @@ export default {
25
43
  stacked
26
44
  v-bind="$attrs"
27
45
  v-on="$listeners"
28
- @input="$emit('input', $event)"
29
- @change="$emit('change', $event)"
46
+ @input="onInput"
47
+ @change="onChange"
30
48
  >
49
+ <!-- @slot Slot for GlFormRadios that will appear before radios generated from options prop -->
31
50
  <slot name="first"></slot>
32
51
  <gl-form-radio
33
52
  v-for="(option, idx) in formOptions"
@@ -38,6 +57,7 @@ export default {
38
57
  <span v-if="option.html" v-safe-html="option.html"></span>
39
58
  <span v-else>{{ option.text }}</span>
40
59
  </gl-form-radio>
60
+ <!-- @slot Slot for GlFormRadios that will appear after radios generated from options prop -->
41
61
  <slot></slot>
42
62
  </b-form-radio-group>
43
63
  </template>