@gitlab/ui 32.18.0 → 32.20.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.
- package/CHANGELOG.md +28 -0
- package/dist/components/base/accordion/accordion.js +7 -0
- package/dist/components/base/accordion/accordion_item.js +11 -0
- package/dist/components/base/alert/alert.js +3 -3
- package/dist/components/base/button/button.documentation.js +17 -1
- package/dist/components/base/button/button.js +10 -10
- package/dist/components/base/card/card.documentation.js +2 -26
- package/dist/components/base/card/card.js +11 -0
- package/dist/components/base/daterange_picker/daterange_picker.js +43 -1
- package/dist/components/base/dropdown/dropdown.js +9 -9
- package/dist/components/base/form/form_checkbox/form_checkbox.documentation.js +2 -14
- package/dist/components/base/form/form_checkbox/form_checkbox.js +21 -1
- package/dist/components/base/form/form_checkbox/form_checkbox_group.js +2 -2
- package/dist/components/base/form/form_input_group/form_input_group.js +1 -1
- package/dist/components/base/form/form_input_group/form_input_group_mixin.js +2 -2
- package/dist/components/base/form/form_radio_group/form_radio_group.js +2 -2
- package/dist/components/base/tabs/tabs/examples/tabs.basic.example.js +1 -1
- package/dist/components/base/tabs/tabs/examples/tabs.counterbadges.example.js +1 -1
- package/dist/components/base/tabs/tabs/examples/tabs.custom_title.example.js +1 -1
- package/dist/components/base/tabs/tabs/examples/tabs.disabled.example.js +1 -1
- package/dist/components/base/tabs/tabs/examples/tabs.justified.example.js +1 -1
- package/dist/components/base/tabs/tabs/examples/tabs.scrollable.example.js +2 -2
- package/dist/components/base/tabs/tabs/examples/tabs.styles_only.example.js +1 -1
- package/dist/components/base/tabs/tabs/tabs.documentation.js +1 -1
- package/dist/components/charts/single_stat/single_stat.js +1 -1
- package/dist/components/mixins/button_mixin.js +4 -4
- package/dist/directives/safe_html/safe_html.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +1 -1
- package/dist/utility_classes.css +1 -1
- package/dist/utility_classes.css.map +1 -1
- package/dist/utils/charts/mock_data.js +0 -2
- package/dist/utils/constants.js +8 -8
- package/dist/utils/use_fake_date.js +4 -4
- package/dist/utils/validation_utils.js +0 -2
- package/documentation/components_documentation.js +0 -3
- package/documentation/documented_stories.js +5 -0
- package/index.js +1 -1
- package/package.json +11 -11
- package/src/components/base/accordion/accordion.md +0 -4
- package/src/components/base/accordion/accordion.stories.js +58 -20
- package/src/components/base/accordion/accordion.vue +7 -0
- package/src/components/base/accordion/accordion_item.md +0 -4
- package/src/components/base/accordion/accordion_item.stories.js +56 -11
- package/src/components/base/accordion/accordion_item.vue +10 -0
- package/src/components/base/alert/alert.spec.js +3 -3
- package/src/components/base/alert/alert.vue +3 -3
- package/src/components/base/badge/badge.scss +1 -0
- package/src/components/base/button/button.documentation.js +18 -0
- package/src/components/base/button/button.stories.js +13 -13
- package/src/components/base/button/button.vue +15 -15
- package/src/components/base/card/card.documentation.js +0 -27
- package/src/components/base/card/card.md +0 -4
- package/src/components/base/card/card.stories.js +32 -18
- package/src/components/base/card/card.vue +12 -0
- package/src/components/base/datepicker/datepicker.stories.js +1 -1
- package/src/components/base/daterange_picker/daterange_picker.md +0 -4
- package/src/components/base/daterange_picker/daterange_picker.stories.js +151 -88
- package/src/components/base/daterange_picker/daterange_picker.vue +43 -4
- package/src/components/base/dropdown/dropdown.stories.js +5 -5
- package/src/components/base/dropdown/dropdown.vue +12 -12
- package/src/components/base/form/form_checkbox/form_checkbox.documentation.js +0 -15
- package/src/components/base/form/form_checkbox/form_checkbox.md +2 -4
- package/src/components/base/form/form_checkbox/form_checkbox.stories.js +31 -39
- package/src/components/base/form/form_checkbox/form_checkbox.vue +21 -6
- package/src/components/base/form/form_checkbox/form_checkbox_group.vue +1 -1
- package/src/components/base/form/form_input_group/form_input_group.vue +1 -1
- package/src/components/base/form/form_input_group/form_input_group_mixin.js +1 -1
- package/src/components/base/form/form_radio_group/form_radio_group.vue +1 -1
- package/src/components/base/tabs/tabs/examples/tabs.basic.example.vue +2 -2
- package/src/components/base/tabs/tabs/examples/tabs.counterbadges.example.vue +9 -6
- package/src/components/base/tabs/tabs/examples/tabs.custom_title.example.vue +3 -3
- package/src/components/base/tabs/tabs/examples/tabs.disabled.example.vue +3 -3
- package/src/components/base/tabs/tabs/examples/tabs.justified.example.vue +2 -2
- package/src/components/base/tabs/tabs/examples/tabs.scrollable.example.vue +2 -2
- package/src/components/base/tabs/tabs/examples/tabs.styles_only.example.vue +4 -4
- package/src/components/base/tabs/tabs/tabs.md +8 -8
- package/src/components/base/tabs/tabs/tabs.stories.js +42 -40
- package/src/components/charts/single_stat/single_stat.vue +5 -1
- package/src/components/mixins/button_mixin.js +3 -3
- package/src/directives/safe_html/safe_html.js +1 -3
- package/src/directives/safe_html/safe_html.spec.js +1 -1
- package/src/scss/utilities.scss +8 -0
- package/src/scss/utility-mixins/sizing.scss +4 -0
- package/src/utils/charts/mock_data.js +0 -2
- package/src/utils/constants.js +7 -7
- package/src/utils/use_fake_date.js +2 -2
- package/src/utils/validation_utils.js +0 -2
- package/dist/components/base/accordion/accordion.documentation.js +0 -20
- package/dist/components/base/accordion/accordion_item.documentation.js +0 -22
- package/dist/components/base/accordion/examples/accordion.auto_collapse.example.js +0 -38
- package/dist/components/base/accordion/examples/accordion.basic.example.js +0 -38
- package/dist/components/base/accordion/examples/accordion.initial_visible.example.js +0 -38
- package/dist/components/base/accordion/examples/index.js +0 -25
- package/dist/components/base/card/examples/card.basic.example.js +0 -38
- package/dist/components/base/card/examples/card.headerfooter.example.js +0 -38
- package/dist/components/base/card/examples/index.js +0 -19
- package/dist/components/base/daterange_picker/daterange_picker.documentation.js +0 -29
- package/dist/components/base/daterange_picker/examples/daterange_picker.basic.example.js +0 -49
- package/dist/components/base/daterange_picker/examples/index.js +0 -12
- package/dist/components/base/form/form_checkbox/examples/form_checkbox.checked.example.js +0 -48
- package/dist/components/base/form/form_checkbox/examples/form_checkbox.checked_disabled.example.js +0 -48
- package/dist/components/base/form/form_checkbox/examples/form_checkbox.disabled.example.js +0 -38
- package/dist/components/base/form/form_checkbox/examples/form_checkbox.help.example.js +0 -38
- package/dist/components/base/form/form_checkbox/examples/form_checkbox.indeterminant.example.js +0 -38
- package/dist/components/base/form/form_checkbox/examples/form_checkbox.unchecked.example.js +0 -38
- package/dist/components/base/form/form_checkbox/examples/form_checkbox.values.example.js +0 -48
- package/dist/components/base/form/form_checkbox/examples/form_checkbox_group.options_array.example.js +0 -58
- package/dist/components/base/form/form_checkbox/examples/form_checkbox_group.slots.example.js +0 -38
- package/dist/components/base/form/form_checkbox/examples/index.js +0 -55
- package/src/components/base/accordion/accordion.documentation.js +0 -19
- package/src/components/base/accordion/accordion_item.documentation.js +0 -20
- package/src/components/base/accordion/examples/accordion.auto_collapse.example.vue +0 -16
- package/src/components/base/accordion/examples/accordion.basic.example.vue +0 -17
- package/src/components/base/accordion/examples/accordion.initial_visible.example.vue +0 -16
- package/src/components/base/accordion/examples/index.js +0 -29
- package/src/components/base/card/examples/card.basic.example.vue +0 -3
- package/src/components/base/card/examples/card.headerfooter.example.vue +0 -11
- package/src/components/base/card/examples/index.js +0 -22
- package/src/components/base/daterange_picker/daterange_picker.documentation.js +0 -34
- package/src/components/base/daterange_picker/examples/daterange_picker.basic.example.vue +0 -13
- package/src/components/base/daterange_picker/examples/index.js +0 -14
- package/src/components/base/form/form_checkbox/examples/form_checkbox.checked.example.vue +0 -13
- package/src/components/base/form/form_checkbox/examples/form_checkbox.checked_disabled.example.vue +0 -13
- package/src/components/base/form/form_checkbox/examples/form_checkbox.disabled.example.vue +0 -3
- package/src/components/base/form/form_checkbox/examples/form_checkbox.help.example.vue +0 -6
- package/src/components/base/form/form_checkbox/examples/form_checkbox.indeterminant.example.vue +0 -3
- package/src/components/base/form/form_checkbox/examples/form_checkbox.unchecked.example.vue +0 -3
- package/src/components/base/form/form_checkbox/examples/form_checkbox.values.example.vue +0 -15
- package/src/components/base/form/form_checkbox/examples/form_checkbox_group.options_array.example.vue +0 -27
- package/src/components/base/form/form_checkbox/examples/form_checkbox_group.slots.example.vue +0 -11
- package/src/components/base/form/form_checkbox/examples/index.js +0 -67
|
@@ -205,7 +205,5 @@ const mockSecondaryTrendlineData = [{
|
|
|
205
205
|
name: 'Median line',
|
|
206
206
|
data: [['Joe', 220], ['Sarah', 392], ['Tom', 291], ['Mary', 594], ['Mike', 320], ['Ben', 230], ['Jane', 120], ['Anne', 290]]
|
|
207
207
|
}];
|
|
208
|
-
var mock_data = {};
|
|
209
208
|
|
|
210
|
-
export default mock_data;
|
|
211
209
|
export { mockAnnotationsConfigs, mockAnnotationsSeries, mockDefaultBarChartConfig, mockDefaultBarData, mockDefaultChartOptions, mockDefaultDataZoomConfig, mockDefaultLineChartConfig, mockDefaultLineData, mockDefaultStackedBarData, mockDefaultStackedLineData, mockRawBarData, mockSecondaryBarData, mockSecondaryData, mockSecondaryTrendlineData };
|
package/dist/utils/constants.js
CHANGED
|
@@ -69,12 +69,12 @@ const formStateOptions = {
|
|
|
69
69
|
valid: true,
|
|
70
70
|
invalid: false
|
|
71
71
|
};
|
|
72
|
-
const
|
|
72
|
+
const buttonCategoryOptions = {
|
|
73
73
|
primary: 'primary',
|
|
74
74
|
secondary: 'secondary',
|
|
75
75
|
tertiary: 'tertiary'
|
|
76
76
|
};
|
|
77
|
-
const
|
|
77
|
+
const buttonVariantOptions = {
|
|
78
78
|
default: 'default',
|
|
79
79
|
confirm: 'confirm',
|
|
80
80
|
info: 'info (deprecated)',
|
|
@@ -93,9 +93,9 @@ const newButtonVariantOptions = {
|
|
|
93
93
|
reset: 'gl-reset'
|
|
94
94
|
};
|
|
95
95
|
const badgeForButtonOptions = {
|
|
96
|
-
[
|
|
97
|
-
[
|
|
98
|
-
[
|
|
96
|
+
[buttonVariantOptions.default]: badgeVariantOptions.neutral,
|
|
97
|
+
[buttonVariantOptions.confirm]: badgeVariantOptions.info,
|
|
98
|
+
[buttonVariantOptions.danger]: badgeVariantOptions.danger
|
|
99
99
|
};
|
|
100
100
|
const newDropdownVariantOptions = {
|
|
101
101
|
default: 'default',
|
|
@@ -106,11 +106,11 @@ const newDropdownVariantOptions = {
|
|
|
106
106
|
danger: 'danger',
|
|
107
107
|
link: 'link'
|
|
108
108
|
};
|
|
109
|
-
const
|
|
109
|
+
const buttonSizeOptions = {
|
|
110
110
|
small: 'small',
|
|
111
111
|
medium: 'medium'
|
|
112
112
|
};
|
|
113
|
-
const
|
|
113
|
+
const buttonSizeOptionsMap = {
|
|
114
114
|
small: 'sm',
|
|
115
115
|
medium: 'md'
|
|
116
116
|
}; // size options all have corresponding styles (e.g. .s12 defined in icon.scss)
|
|
@@ -251,4 +251,4 @@ const loadingIconSizes = {
|
|
|
251
251
|
'xl (64x64)': 'xl'
|
|
252
252
|
};
|
|
253
253
|
|
|
254
|
-
export { COMMA, alertVariantIconMap, alertVariantOptions, alignOptions, avatarShapeOptions, avatarSizeOptions, avatarsInlineSizeOptions, badgeForButtonOptions, badgeSizeOptions, badgeVariantOptions, bannerVariants, colorThemes, columnOptions, defaultDateFormat, drawerVariants, focusableTags, formInputSizes, formStateOptions, glThemes, iconSizeOptions, keyboard, labelColorOptions, labelSizeOptions, loadingIconSizes, maxZIndex, modalButtonDefaults, modalSizeOptions,
|
|
254
|
+
export { COMMA, alertVariantIconMap, alertVariantOptions, alignOptions, avatarShapeOptions, avatarSizeOptions, avatarsInlineSizeOptions, badgeForButtonOptions, badgeSizeOptions, badgeVariantOptions, bannerVariants, buttonCategoryOptions, buttonSizeOptions, buttonSizeOptionsMap, buttonVariantOptions, colorThemes, columnOptions, defaultDateFormat, drawerVariants, focusableTags, formInputSizes, formStateOptions, glThemes, iconSizeOptions, keyboard, labelColorOptions, labelSizeOptions, loadingIconSizes, maxZIndex, modalButtonDefaults, modalSizeOptions, newDropdownVariantOptions, popoverPlacements, resizeDebounceTime, sizeOptions, sizeOptionsWithNoDefault, tabsButtonDefaults, targetOptions, toggleLabelPosition, tokenVariants, tooltipActionEvents, tooltipDelay, tooltipPlacements, triggerVariantOptions, truncateOptions, variantCssColorMap, variantOptions, variantOptionsWithNoDefault, viewModeOptions };
|
|
@@ -6,14 +6,14 @@ import MockDate from 'mockdate';
|
|
|
6
6
|
*
|
|
7
7
|
* Usage:
|
|
8
8
|
*
|
|
9
|
-
* import useFakeDate from '../../../../tests/utils/use_fake_date';
|
|
9
|
+
* import { useFakeDate } from '../../../../tests/utils/use_fake_date';
|
|
10
10
|
* documentedStoriesOf('some|story')
|
|
11
11
|
* .add('default', () => ({
|
|
12
12
|
* mixins: [useFakeDate()],
|
|
13
13
|
* })
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
const useFakeDate = () => {
|
|
17
17
|
if (process.env.IS_VISUAL_TEST) {
|
|
18
18
|
return {
|
|
19
19
|
created() {
|
|
@@ -28,6 +28,6 @@ var use_fake_date = (() => {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
return {};
|
|
31
|
-
}
|
|
31
|
+
};
|
|
32
32
|
|
|
33
|
-
export
|
|
33
|
+
export { useFakeDate };
|
|
@@ -73,7 +73,6 @@ export { default as GlLabelDocumentation } from '../src/components/base/label/la
|
|
|
73
73
|
export { default as GlDatepickerDocumentation } from '../src/components/base/datepicker/datepicker.documentation';
|
|
74
74
|
export { default as GlTokenDocumentation } from '../src/components/base/token/token.documentation';
|
|
75
75
|
export { default as GlToggleDocumentation } from '../src/components/base/toggle/toggle.documentation';
|
|
76
|
-
export { default as GlDaterangePickerDocumentation } from '../src/components/base/daterange_picker/daterange_picker.documentation';
|
|
77
76
|
export { default as GlSortingDocumentation } from '../src/components/base/sorting/sorting.documentation';
|
|
78
77
|
export { default as GlSortingItemDocumentation } from '../src/components/base/sorting/sorting_item.documentation';
|
|
79
78
|
export { default as GlInfiniteScrollDocumentation } from '../src/components/base/infinite_scroll/infinite_scroll.documentation';
|
|
@@ -93,8 +92,6 @@ export { default as GlFilteredSearchTokenSegmentDocumentation } from '../src/com
|
|
|
93
92
|
export { default as GlFilteredSearchDocumentation } from '../src/components/base/filtered_search/filtered_search.documentation';
|
|
94
93
|
export { default as GlBroadcastMessageDocumentation } from '../src/components/base/broadcast_message/broadcast_message.documentation';
|
|
95
94
|
export { default as GlCollapseDocumentation } from '../src/components/base/collapse/collapse.documentation';
|
|
96
|
-
export { default as GlAccordionDocumentation } from '../src/components/base/accordion/accordion.documentation';
|
|
97
|
-
export { default as GlAccordionItemDocumentation } from '../src/components/base/accordion/accordion_item.documentation';
|
|
98
95
|
export { default as GlCarouselDocumentation } from '../src/components/base/carousel/carousel.documentation';
|
|
99
96
|
export { default as GlSafeLinkDirectiveDocumentation } from '../src/directives/safe_link/safe_link.documentation';
|
|
100
97
|
export { default as GlSafeHtmlDirectiveDocumentation } from '../src/directives/safe_html/safe_html.documentation';
|
|
@@ -84,6 +84,11 @@ export const setupStorybookReadme = () =>
|
|
|
84
84
|
'GlFriendlyWrap',
|
|
85
85
|
'GlLoadingIcon',
|
|
86
86
|
'GlDeprecatedSkeletonLoading',
|
|
87
|
+
'GlCard',
|
|
88
|
+
'GlFormCheckbox',
|
|
89
|
+
'GlAccordion',
|
|
90
|
+
'GlAccordionItem',
|
|
91
|
+
'GlDaterangePicker',
|
|
87
92
|
],
|
|
88
93
|
components: {
|
|
89
94
|
GlComponentDocumentation,
|
package/index.js
CHANGED
|
@@ -106,6 +106,6 @@ export { default as GlTooltipDirective } from './src/directives/tooltip';
|
|
|
106
106
|
export { default as GlResizeObserverDirective } from './src/directives/resize_observer/resize_observer';
|
|
107
107
|
export { default as GlCollapseToggleDirective } from './src/directives/collapse_toggle';
|
|
108
108
|
export { SafeLinkDirective as GlSafeLinkDirective } from './src/directives/safe_link/safe_link';
|
|
109
|
-
export {
|
|
109
|
+
export { SafeHtmlDirective as GlSafeHtmlDirective } from './src/directives/safe_html/safe_html';
|
|
110
110
|
export { OutsideDirective as GlOutsideDirective } from './src/directives/outside/outside';
|
|
111
111
|
export { HoverLoadDirective as GlHoverLoadDirective } from './src/directives/hover_load/hover_load';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "32.
|
|
3
|
+
"version": "32.20.1",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@babel/standalone": "^7.0.0",
|
|
61
|
-
"bootstrap-vue": "2.
|
|
61
|
+
"bootstrap-vue": "2.20.1",
|
|
62
62
|
"copy-to-clipboard": "^3.0.8",
|
|
63
63
|
"dompurify": "^2.3.3",
|
|
64
64
|
"echarts": "^4.9.0",
|
|
@@ -84,19 +84,19 @@
|
|
|
84
84
|
"@babel/preset-env": "^7.10.2",
|
|
85
85
|
"@gitlab/eslint-plugin": "9.4.0",
|
|
86
86
|
"@gitlab/stylelint-config": "2.3.0",
|
|
87
|
-
"@gitlab/svgs": "1.
|
|
87
|
+
"@gitlab/svgs": "1.218.0",
|
|
88
88
|
"@rollup/plugin-commonjs": "^11.1.0",
|
|
89
89
|
"@rollup/plugin-node-resolve": "^7.1.3",
|
|
90
90
|
"@rollup/plugin-replace": "^2.3.2",
|
|
91
|
-
"@storybook/addon-a11y": "6.3.
|
|
92
|
-
"@storybook/addon-docs": "6.3.
|
|
93
|
-
"@storybook/addon-essentials": "6.3.
|
|
91
|
+
"@storybook/addon-a11y": "6.3.12",
|
|
92
|
+
"@storybook/addon-docs": "6.3.12",
|
|
93
|
+
"@storybook/addon-essentials": "6.3.12",
|
|
94
94
|
"@storybook/addon-knobs": "6.3.1",
|
|
95
|
-
"@storybook/addon-storyshots": "6.3.
|
|
96
|
-
"@storybook/addon-storyshots-puppeteer": "6.3.
|
|
97
|
-
"@storybook/addon-viewport": "6.3.
|
|
98
|
-
"@storybook/theming": "6.3.
|
|
99
|
-
"@storybook/vue": "6.3.
|
|
95
|
+
"@storybook/addon-storyshots": "6.3.12",
|
|
96
|
+
"@storybook/addon-storyshots-puppeteer": "6.3.12",
|
|
97
|
+
"@storybook/addon-viewport": "6.3.12",
|
|
98
|
+
"@storybook/theming": "6.3.12",
|
|
99
|
+
"@storybook/vue": "6.3.12",
|
|
100
100
|
"@vue/test-utils": "1.1.3",
|
|
101
101
|
"autoprefixer": "^9.7.6",
|
|
102
102
|
"babel-jest": "^26.6.3",
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
# GlAccordion
|
|
2
|
-
|
|
3
|
-
<!-- STORY -->
|
|
4
|
-
|
|
5
1
|
Accordions are used to group similar content and hide or show it depending on user needs or
|
|
6
2
|
preferences. Accordions give users more granular control over the interface and help digest content
|
|
7
3
|
in stages, rather than all at once.
|
|
@@ -1,30 +1,68 @@
|
|
|
1
|
-
import { documentedStoriesOf } from '../../../../documentation/documented_stories';
|
|
2
1
|
import readme from './accordion.md';
|
|
3
2
|
import GlAccordion from './accordion.vue';
|
|
4
3
|
import GlAccordionItem from './accordion_item.vue';
|
|
5
4
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
documentedStoriesOf('base/accordion', readme).add('default', () => ({
|
|
12
|
-
components,
|
|
13
|
-
template: `
|
|
14
|
-
<gl-accordion :header-level="3">
|
|
15
|
-
<gl-accordion-item title="Item 1">
|
|
5
|
+
const template = `
|
|
6
|
+
<gl-accordion :auto-collapse="autoCollapse" :header-level="headerLevel">
|
|
7
|
+
<gl-accordion-item title="Item 1" :header-level="headerLevel">
|
|
16
8
|
Each accordion can be expanded or collapsed independently of others.
|
|
17
9
|
</gl-accordion-item>
|
|
18
10
|
|
|
19
|
-
<gl-accordion-item title="Item 2">
|
|
20
|
-
If you want the other accordion items to collapse when one is open, please see
|
|
21
|
-
<code>Collapse Other</code> example.
|
|
22
|
-
</gl-accordion-item>
|
|
23
|
-
|
|
24
|
-
<gl-accordion-item title="Item 3">
|
|
11
|
+
<gl-accordion-item title="Item 2" :header-level="headerLevel">
|
|
25
12
|
If you want to have an accordion item to be initially visible, please see
|
|
26
|
-
<code>
|
|
13
|
+
<code>Initially Expanded</code> example for the <code>GLAccordionItem</code>.
|
|
14
|
+
</gl-accordion-item>
|
|
15
|
+
|
|
16
|
+
<gl-accordion-item title="Item 3" :header-level="headerLevel" :visible="autoCollapse">
|
|
17
|
+
If you want the other accordion items to collapse when one is open, please see
|
|
18
|
+
<code>Auto Collapse</code> example.
|
|
27
19
|
</gl-accordion-item>
|
|
28
20
|
</gl-accordion>
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
const defaultValue = (prop) => GlAccordion.props[prop].default;
|
|
24
|
+
|
|
25
|
+
const generateProps = ({ autoCollapse = defaultValue('autoCollapse'), headerLevel = 3 } = {}) => ({
|
|
26
|
+
autoCollapse,
|
|
27
|
+
headerLevel,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const Template = (args) => ({
|
|
31
|
+
components: {
|
|
32
|
+
GlAccordion,
|
|
33
|
+
GlAccordionItem,
|
|
34
|
+
},
|
|
35
|
+
props: Object.keys(args),
|
|
36
|
+
template,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export const Default = Template.bind({});
|
|
40
|
+
Default.args = generateProps();
|
|
41
|
+
|
|
42
|
+
export const AutoCollapse = Template.bind({});
|
|
43
|
+
AutoCollapse.args = generateProps({ autoCollapse: true });
|
|
44
|
+
|
|
45
|
+
export default {
|
|
46
|
+
followsDesignSystem: true,
|
|
47
|
+
title: 'base/accordion',
|
|
48
|
+
component: GlAccordion,
|
|
49
|
+
parameters: {
|
|
50
|
+
bootstrapComponent: 'b-collapse',
|
|
51
|
+
storyshots: { disable: true },
|
|
52
|
+
knobs: { disable: true },
|
|
53
|
+
docs: {
|
|
54
|
+
description: {
|
|
55
|
+
component: readme,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
argTypes: {
|
|
60
|
+
headerLevel: {
|
|
61
|
+
control: {
|
|
62
|
+
type: 'select',
|
|
63
|
+
options: [1, 2, 3, 4, 5, 6],
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
autoCollapse: { control: { disable: true } },
|
|
67
|
+
},
|
|
68
|
+
};
|
|
@@ -10,11 +10,17 @@ export default {
|
|
|
10
10
|
};
|
|
11
11
|
},
|
|
12
12
|
props: {
|
|
13
|
+
/*
|
|
14
|
+
When true, will have the effect of closing other accordion items when one accordion item is visible.
|
|
15
|
+
*/
|
|
13
16
|
autoCollapse: {
|
|
14
17
|
type: Boolean,
|
|
15
18
|
required: false,
|
|
16
19
|
default: false,
|
|
17
20
|
},
|
|
21
|
+
/*
|
|
22
|
+
The header tag used in the accordion (h1/h2/h3/h4/h5/h6). This overrides the value provided by GlAccordion. For accessibility this should be set to an appropriate value in the context where the accordion is used.
|
|
23
|
+
*/
|
|
18
24
|
headerLevel: {
|
|
19
25
|
type: Number,
|
|
20
26
|
required: true,
|
|
@@ -28,6 +34,7 @@ export default {
|
|
|
28
34
|
|
|
29
35
|
<template>
|
|
30
36
|
<div>
|
|
37
|
+
<!-- @slot `GLAccordionItem`s list -->
|
|
31
38
|
<slot></slot>
|
|
32
39
|
</div>
|
|
33
40
|
</template>
|
|
@@ -1,16 +1,61 @@
|
|
|
1
|
-
import { documentedStoriesOf } from '../../../../documentation/documented_stories';
|
|
2
1
|
import readme from './accordion_item.md';
|
|
3
2
|
import GlAccordionItem from './accordion_item.vue';
|
|
4
3
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
documentedStoriesOf('base/accordion/accordion-item', readme).add('default', () => ({
|
|
10
|
-
components,
|
|
11
|
-
template: `
|
|
12
|
-
<gl-accordion-item title="Item 1" visible>
|
|
4
|
+
const template = `
|
|
5
|
+
<gl-accordion-item :title="title" :visible="visible" :header-level="headerLevel">
|
|
13
6
|
Lorem ipsum dolor sit amet consectetur adipisicing elit. Delectus, maiores.
|
|
14
7
|
</gl-accordion-item>
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
`;
|
|
9
|
+
|
|
10
|
+
const defaultValue = (prop) => GlAccordionItem.props[prop].default;
|
|
11
|
+
|
|
12
|
+
const generateProps = ({
|
|
13
|
+
visible = defaultValue('visible'),
|
|
14
|
+
headerLevel = 3,
|
|
15
|
+
title = 'Accordion Item Title',
|
|
16
|
+
} = {}) => ({
|
|
17
|
+
visible,
|
|
18
|
+
headerLevel,
|
|
19
|
+
title,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const Template = (args) => ({
|
|
23
|
+
components: {
|
|
24
|
+
GlAccordionItem,
|
|
25
|
+
},
|
|
26
|
+
props: Object.keys(args),
|
|
27
|
+
template,
|
|
28
|
+
provide: {
|
|
29
|
+
defaultHeaderLevel: defaultValue('headerLevel'),
|
|
30
|
+
accordionSetId: '1',
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export const Default = Template.bind({});
|
|
35
|
+
Default.args = generateProps();
|
|
36
|
+
|
|
37
|
+
export const InitiallyExpanded = Template.bind({});
|
|
38
|
+
InitiallyExpanded.args = generateProps({ visible: true, title: 'Item Content Initially Expanded' });
|
|
39
|
+
|
|
40
|
+
export default {
|
|
41
|
+
title: 'base/accordion/accordion-item',
|
|
42
|
+
component: GlAccordionItem,
|
|
43
|
+
bootstrapComponent: 'b-collapse',
|
|
44
|
+
parameters: {
|
|
45
|
+
storyshots: { disable: true },
|
|
46
|
+
knobs: { disable: true },
|
|
47
|
+
docs: {
|
|
48
|
+
description: {
|
|
49
|
+
component: readme,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
argTypes: {
|
|
54
|
+
headerLevel: {
|
|
55
|
+
control: {
|
|
56
|
+
type: 'select',
|
|
57
|
+
options: [1, 2, 3, 4, 5, 6],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
};
|
|
@@ -16,15 +16,24 @@ export default {
|
|
|
16
16
|
inject: ['accordionSetId', 'defaultHeaderLevel'],
|
|
17
17
|
inheritAttrs: false,
|
|
18
18
|
props: {
|
|
19
|
+
/*
|
|
20
|
+
Used to set the title of accordion link
|
|
21
|
+
*/
|
|
19
22
|
title: {
|
|
20
23
|
type: String,
|
|
21
24
|
required: true,
|
|
22
25
|
},
|
|
26
|
+
/*
|
|
27
|
+
When set, it will ensure the accordion item is initially visible
|
|
28
|
+
*/
|
|
23
29
|
visible: {
|
|
24
30
|
type: Boolean,
|
|
25
31
|
default: false,
|
|
26
32
|
required: false,
|
|
27
33
|
},
|
|
34
|
+
/*
|
|
35
|
+
The header tag used in the accordion (h1/h2/h3/h4/h5/h6). This overrides the value provided by GlAccordion. For accessibility this should be set to an appropriate value in the context where the accordion is used.,
|
|
36
|
+
*/
|
|
28
37
|
headerLevel: {
|
|
29
38
|
type: Number,
|
|
30
39
|
required: false,
|
|
@@ -75,6 +84,7 @@ export default {
|
|
|
75
84
|
class="gl-mt-3 gl-font-base"
|
|
76
85
|
:data-testid="`accordion-item-collapse-${accordionItemId}`"
|
|
77
86
|
>
|
|
87
|
+
<!-- @slot Item content -->
|
|
78
88
|
<slot></slot>
|
|
79
89
|
</b-collapse>
|
|
80
90
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { shallowMount } from '@vue/test-utils';
|
|
2
|
-
import {
|
|
2
|
+
import { buttonCategoryOptions } from '../../../utils/constants';
|
|
3
3
|
import GlAlert from './alert.vue';
|
|
4
4
|
|
|
5
5
|
const DummyComponent = {
|
|
@@ -89,7 +89,7 @@ describe('Alert component', () => {
|
|
|
89
89
|
|
|
90
90
|
const props = button.props();
|
|
91
91
|
expect('href' in props).toBe(false);
|
|
92
|
-
expect(props.category).toEqual(
|
|
92
|
+
expect(props.category).toEqual(buttonCategoryOptions.primary);
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
it('emits a primaryAction event when primary button is clicked', () => {
|
|
@@ -126,7 +126,7 @@ describe('Alert component', () => {
|
|
|
126
126
|
|
|
127
127
|
const attrs = button.attributes();
|
|
128
128
|
expect('href' in attrs).toBe(false);
|
|
129
|
-
expect(attrs.category).toEqual(
|
|
129
|
+
expect(attrs.category).toEqual(buttonCategoryOptions.secondary);
|
|
130
130
|
});
|
|
131
131
|
|
|
132
132
|
it('emits a secondaryAction event when secondary button is clicked', () => {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
alertVariantOptions,
|
|
4
4
|
alertVariantIconMap,
|
|
5
|
-
|
|
5
|
+
buttonCategoryOptions,
|
|
6
6
|
} from '../../../utils/constants';
|
|
7
7
|
import CloseButton from '../../shared_components/close_button/close_button.vue';
|
|
8
8
|
import GlButton from '../button/button.vue';
|
|
@@ -102,7 +102,7 @@ export default {
|
|
|
102
102
|
attrs: {
|
|
103
103
|
href: this.primaryButtonLink,
|
|
104
104
|
variant: 'confirm',
|
|
105
|
-
category:
|
|
105
|
+
category: buttonCategoryOptions.primary,
|
|
106
106
|
},
|
|
107
107
|
listeners: {
|
|
108
108
|
click: this.primaryButtonClicked,
|
|
@@ -113,7 +113,7 @@ export default {
|
|
|
113
113
|
attrs: {
|
|
114
114
|
href: this.secondaryButtonLink,
|
|
115
115
|
variant: 'default',
|
|
116
|
-
category:
|
|
116
|
+
category: buttonCategoryOptions.secondary,
|
|
117
117
|
},
|
|
118
118
|
listeners: {
|
|
119
119
|
click: this.secondaryButtonClicked,
|
|
@@ -3,4 +3,22 @@ import description from './button.md';
|
|
|
3
3
|
export default {
|
|
4
4
|
description,
|
|
5
5
|
followsDesignSystem: true,
|
|
6
|
+
bootstrapComponent: 'b-button',
|
|
7
|
+
bootstrapPropsInfo: {
|
|
8
|
+
category: {
|
|
9
|
+
enum: 'buttonCategoryOptions',
|
|
10
|
+
},
|
|
11
|
+
variant: {
|
|
12
|
+
enum: 'buttonVariantOptions',
|
|
13
|
+
},
|
|
14
|
+
size: {
|
|
15
|
+
enum: 'buttonSizeOptions',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
events: [
|
|
19
|
+
{
|
|
20
|
+
event: 'click',
|
|
21
|
+
description: 'Emitted when clicked on button',
|
|
22
|
+
},
|
|
23
|
+
],
|
|
6
24
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { GlButton } from '../../../../index';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
newButtonSizeOptions,
|
|
3
|
+
buttonCategoryOptions,
|
|
4
|
+
buttonVariantOptions,
|
|
6
5
|
badgeForButtonOptions,
|
|
6
|
+
buttonSizeOptions,
|
|
7
7
|
targetOptions,
|
|
8
8
|
} from '../../../utils/constants';
|
|
9
9
|
import readme from './button.md';
|
|
@@ -105,8 +105,8 @@ export const IconButton = (args, { argTypes }) => ({
|
|
|
105
105
|
`,
|
|
106
106
|
});
|
|
107
107
|
IconButton.args = generateProps({
|
|
108
|
-
category:
|
|
109
|
-
variant:
|
|
108
|
+
category: buttonCategoryOptions.primary,
|
|
109
|
+
variant: buttonVariantOptions.danger,
|
|
110
110
|
});
|
|
111
111
|
|
|
112
112
|
export const DropdownButton = (args, { argTypes }) => ({
|
|
@@ -186,7 +186,7 @@ export const DropdownIconOnlyButton = (args, { argTypes }) => ({
|
|
|
186
186
|
`),
|
|
187
187
|
});
|
|
188
188
|
DropdownIconOnlyButton.args = generateProps({
|
|
189
|
-
category:
|
|
189
|
+
category: buttonCategoryOptions.tertiary,
|
|
190
190
|
});
|
|
191
191
|
|
|
192
192
|
export const DropdownSplitButton = (args, { argTypes }) => ({
|
|
@@ -356,10 +356,10 @@ LabelButton.parameters = { controls: { disable: true } };
|
|
|
356
356
|
export const AllVariantsAndCategories = (args, { argTypes = {} }) => ({
|
|
357
357
|
props: Object.keys(argTypes),
|
|
358
358
|
components,
|
|
359
|
-
variants: Object.keys(
|
|
360
|
-
(variant) => !
|
|
359
|
+
variants: Object.keys(buttonVariantOptions).filter(
|
|
360
|
+
(variant) => !buttonVariantOptions[variant].includes('deprecated')
|
|
361
361
|
),
|
|
362
|
-
categories:
|
|
362
|
+
categories: buttonCategoryOptions,
|
|
363
363
|
style: {
|
|
364
364
|
display: 'grid',
|
|
365
365
|
gridTemplateColumns: 'repeat(3, 150px)',
|
|
@@ -453,7 +453,7 @@ export const Badges = (args, { argTypes = {} }) => ({
|
|
|
453
453
|
props: Object.keys(argTypes),
|
|
454
454
|
components,
|
|
455
455
|
variants: Object.keys(badgeForButtonOptions),
|
|
456
|
-
categories:
|
|
456
|
+
categories: buttonCategoryOptions,
|
|
457
457
|
style: {
|
|
458
458
|
display: 'grid',
|
|
459
459
|
gridTemplateColumns: 'repeat(3, 200px)',
|
|
@@ -513,19 +513,19 @@ export default {
|
|
|
513
513
|
category: {
|
|
514
514
|
control: {
|
|
515
515
|
type: 'select',
|
|
516
|
-
options:
|
|
516
|
+
options: buttonCategoryOptions,
|
|
517
517
|
},
|
|
518
518
|
},
|
|
519
519
|
variant: {
|
|
520
520
|
control: {
|
|
521
521
|
type: 'select',
|
|
522
|
-
options:
|
|
522
|
+
options: buttonVariantOptions,
|
|
523
523
|
},
|
|
524
524
|
},
|
|
525
525
|
size: {
|
|
526
526
|
control: {
|
|
527
527
|
type: 'select',
|
|
528
|
-
options:
|
|
528
|
+
options: buttonSizeOptions,
|
|
529
529
|
},
|
|
530
530
|
},
|
|
531
531
|
target: {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { BButton } from 'bootstrap-vue';
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
buttonCategoryOptions,
|
|
5
|
+
buttonVariantOptions,
|
|
6
|
+
buttonSizeOptions,
|
|
7
|
+
buttonSizeOptionsMap,
|
|
8
8
|
} from '../../../utils/constants';
|
|
9
9
|
import { logWarning } from '../../../utils/utils';
|
|
10
10
|
import { SafeLinkMixin } from '../../mixins/safe_link_mixin';
|
|
@@ -22,20 +22,20 @@ export default {
|
|
|
22
22
|
category: {
|
|
23
23
|
type: String,
|
|
24
24
|
required: false,
|
|
25
|
-
default:
|
|
26
|
-
validator: (value) => Object.keys(
|
|
25
|
+
default: buttonCategoryOptions.primary,
|
|
26
|
+
validator: (value) => Object.keys(buttonCategoryOptions).includes(value),
|
|
27
27
|
},
|
|
28
28
|
variant: {
|
|
29
29
|
type: String,
|
|
30
30
|
required: false,
|
|
31
|
-
default:
|
|
32
|
-
validator: (value) => Object.keys(
|
|
31
|
+
default: buttonVariantOptions.default,
|
|
32
|
+
validator: (value) => Object.keys(buttonVariantOptions).includes(value),
|
|
33
33
|
},
|
|
34
34
|
size: {
|
|
35
35
|
type: String,
|
|
36
36
|
required: false,
|
|
37
|
-
default:
|
|
38
|
-
validator: (value) => Object.keys(
|
|
37
|
+
default: buttonSizeOptions.medium,
|
|
38
|
+
validator: (value) => Object.keys(buttonSizeOptions).includes(value),
|
|
39
39
|
},
|
|
40
40
|
selected: {
|
|
41
41
|
type: Boolean,
|
|
@@ -81,14 +81,14 @@ export default {
|
|
|
81
81
|
buttonClasses() {
|
|
82
82
|
const classes = ['gl-button'];
|
|
83
83
|
const nonCategoryVariants = [
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
buttonVariantOptions.dashed,
|
|
85
|
+
buttonVariantOptions.link,
|
|
86
|
+
buttonVariantOptions.reset,
|
|
87
87
|
];
|
|
88
88
|
|
|
89
89
|
if (
|
|
90
90
|
!nonCategoryVariants.includes(this.variant) &&
|
|
91
|
-
this.category !==
|
|
91
|
+
this.category !== buttonCategoryOptions.primary
|
|
92
92
|
) {
|
|
93
93
|
classes.push(`btn-${this.variant}-${this.category}`);
|
|
94
94
|
}
|
|
@@ -106,7 +106,7 @@ export default {
|
|
|
106
106
|
return classes;
|
|
107
107
|
},
|
|
108
108
|
buttonSize() {
|
|
109
|
-
return
|
|
109
|
+
return buttonSizeOptionsMap[this.size];
|
|
110
110
|
},
|
|
111
111
|
},
|
|
112
112
|
mounted() {
|