@gitlab/ui 37.1.0 → 37.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/components/base/form/form_group/form_group.documentation.js +2 -6
  3. package/dist/components/base/form/form_input_group/form_input_group.documentation.js +2 -26
  4. package/dist/components/base/form/form_input_group/form_input_group.js +7 -0
  5. package/dist/components/base/loading_icon/loading_icon.js +1 -1
  6. package/dist/components/base/pagination/pagination.js +22 -2
  7. package/dist/components/base/path/path.js +9 -3
  8. package/dist/components/base/search_box_by_click/search_box_by_click.documentation.js +2 -80
  9. package/dist/components/base/search_box_by_click/search_box_by_click.js +60 -1
  10. package/dist/components/base/search_box_by_type/search_box_by_type.documentation.js +2 -20
  11. package/dist/components/base/search_box_by_type/search_box_by_type.js +19 -5
  12. package/dist/directives/hover_load/hover_load.documentation.js +1 -1
  13. package/dist/directives/resize_observer/resize_observer.documentation.js +2 -5
  14. package/dist/directives/safe_html/safe_html.documentation.js +1 -1
  15. package/dist/directives/safe_link/safe_link.documentation.js +2 -3
  16. package/dist/index.css +1 -1
  17. package/dist/index.css.map +1 -1
  18. package/dist/utility_classes.css +1 -1
  19. package/dist/utility_classes.css.map +1 -1
  20. package/documentation/documented_stories.js +8 -0
  21. package/package.json +1 -1
  22. package/src/components/base/button/button.scss +5 -9
  23. package/src/components/base/form/form_group/form_group.documentation.js +0 -3
  24. package/src/components/base/form/form_group/form_group.md +0 -2
  25. package/src/components/base/form/form_group/form_group.stories.js +106 -145
  26. package/src/components/base/form/form_input_group/form_input_group.documentation.js +0 -28
  27. package/src/components/base/form/form_input_group/form_input_group.md +0 -4
  28. package/src/components/base/form/form_input_group/form_input_group.stories.js +84 -62
  29. package/src/components/base/form/form_input_group/form_input_group.vue +9 -0
  30. package/src/components/base/loading_icon/loading_icon.vue +1 -1
  31. package/src/components/base/pagination/pagination.spec.js +9 -2
  32. package/src/components/base/pagination/pagination.vue +22 -6
  33. package/src/components/base/path/path.spec.js +12 -0
  34. package/src/components/base/path/path.vue +8 -3
  35. package/src/components/base/search_box_by_click/search_box_by_click.documentation.js +0 -90
  36. package/src/components/base/search_box_by_click/search_box_by_click.md +0 -2
  37. package/src/components/base/search_box_by_click/search_box_by_click.stories.js +91 -48
  38. package/src/components/base/search_box_by_click/search_box_by_click.vue +50 -1
  39. package/src/components/base/search_box_by_type/search_box_by_type.documentation.js +0 -18
  40. package/src/components/base/search_box_by_type/search_box_by_type.md +0 -2
  41. package/src/components/base/search_box_by_type/search_box_by_type.stories.js +49 -43
  42. package/src/components/base/search_box_by_type/search_box_by_type.vue +16 -6
  43. package/src/components/base/tabs/tabs/tabs.stories.js +2 -4
  44. package/src/directives/hover_load/hover_load.md +0 -2
  45. package/src/directives/hover_load/hover_load.stories.js +39 -34
  46. package/src/directives/resize_observer/resize_observer.documentation.js +0 -2
  47. package/src/directives/resize_observer/resize_observer.md +0 -6
  48. package/src/directives/resize_observer/resize_observer.stories.js +70 -51
  49. package/src/directives/safe_html/safe_html.md +0 -4
  50. package/src/directives/safe_html/safe_html.stories.js +53 -44
  51. package/src/directives/safe_link/safe_link.documentation.js +0 -1
  52. package/src/directives/safe_link/safe_link.md +0 -4
  53. package/src/directives/safe_link/safe_link.stories.js +31 -30
  54. package/src/scss/utilities.scss +8 -0
  55. package/src/scss/utility-mixins/background.scss +4 -0
  56. package/dist/components/base/form/form_group/examples/form_group/form_group.basic.example.js +0 -38
  57. package/dist/components/base/form/form_group/examples/form_group/form_group.disabled.example.js +0 -48
  58. package/dist/components/base/form/form_group/examples/form_group/form_group.textarea.example.js +0 -48
  59. package/dist/components/base/form/form_group/examples/form_group/form_group.validation.example.js +0 -66
  60. package/dist/components/base/form/form_group/examples/form_group/index.js +0 -27
  61. package/dist/components/base/form/form_input_group/examples/form_input_group.basic.example.js +0 -38
  62. package/dist/components/base/form/form_input_group/examples/form_input_group.predefined_options.example.js +0 -54
  63. package/dist/components/base/form/form_input_group/examples/form_input_group.predefined_reactive.example.js +0 -55
  64. package/dist/components/base/form/form_input_group/examples/form_input_group.reactive.example.js +0 -48
  65. package/dist/components/base/form/form_input_group/examples/index.js +0 -27
  66. package/dist/components/base/search_box_by_click/examples/index.js +0 -22
  67. package/dist/components/base/search_box_by_click/examples/search_box_by_click.default.example.js +0 -48
  68. package/dist/components/base/search_box_by_click/examples/search_box_by_click.history.example.js +0 -51
  69. package/dist/components/base/search_box_by_click/examples/search_box_by_click.v_model.example.js +0 -54
  70. package/dist/components/base/search_box_by_type/examples/index.js +0 -17
  71. package/dist/components/base/search_box_by_type/examples/search_box_by_type.default.example.js +0 -48
  72. package/dist/components/base/search_box_by_type/examples/search_box_by_type.loading.example.js +0 -65
  73. package/dist/directives/resize_observer/examples/index.js +0 -12
  74. package/dist/directives/resize_observer/examples/resize_observer.basic.example.js +0 -62
  75. package/src/components/base/form/form_group/examples/form_group/form_group.basic.example.vue +0 -11
  76. package/src/components/base/form/form_group/examples/form_group/form_group.disabled.example.vue +0 -21
  77. package/src/components/base/form/form_group/examples/form_group/form_group.textarea.example.vue +0 -15
  78. package/src/components/base/form/form_group/examples/form_group/form_group.validation.example.vue +0 -36
  79. package/src/components/base/form/form_group/examples/form_group/index.js +0 -32
  80. package/src/components/base/form/form_input_group/examples/form_input_group.basic.example.vue +0 -10
  81. package/src/components/base/form/form_input_group/examples/form_input_group.predefined_options.example.vue +0 -25
  82. package/src/components/base/form/form_input_group/examples/form_input_group.predefined_reactive.example.vue +0 -32
  83. package/src/components/base/form/form_input_group/examples/form_input_group.reactive.example.vue +0 -25
  84. package/src/components/base/form/form_input_group/examples/index.js +0 -32
  85. package/src/components/base/search_box_by_click/examples/index.js +0 -26
  86. package/src/components/base/search_box_by_click/examples/search_box_by_click.default.example.vue +0 -14
  87. package/src/components/base/search_box_by_click/examples/search_box_by_click.history.example.vue +0 -23
  88. package/src/components/base/search_box_by_click/examples/search_box_by_click.v_model.example.vue +0 -23
  89. package/src/components/base/search_box_by_type/examples/index.js +0 -20
  90. package/src/components/base/search_box_by_type/examples/search_box_by_type.default.example.vue +0 -14
  91. package/src/components/base/search_box_by_type/examples/search_box_by_type.loading.example.vue +0 -34
  92. package/src/directives/resize_observer/examples/index.js +0 -14
  93. package/src/directives/resize_observer/examples/resize_observer.basic.example.vue +0 -21
@@ -77,6 +77,7 @@ export const setupStorybookReadme = () =>
77
77
  'GlSorting',
78
78
  'GlSortingItem',
79
79
  'GlIcon',
80
+ 'GlSafeLinkDirective',
80
81
  'GlDashboardSkeleton',
81
82
  'GlToggle',
82
83
  'GlNavbar',
@@ -92,6 +93,7 @@ export const setupStorybookReadme = () =>
92
93
  'GlIntersperse',
93
94
  'GlFormSelect',
94
95
  'GlDaterangePicker',
96
+ 'GlFormGroup',
95
97
  'GlAvatarLabeled',
96
98
  'GlBarChart',
97
99
  'GlCarousel',
@@ -107,12 +109,15 @@ export const setupStorybookReadme = () =>
107
109
  'GlPagination',
108
110
  'GlSkeletonLoader',
109
111
  'GlLabel',
112
+ 'GlHoverLoadDirective',
110
113
  'GlStackedColumnChart',
111
114
  'GlDiscreteScatterChart',
115
+ 'GlResizeObserverDirective',
112
116
  'GlFormCombobox',
113
117
  'GlChartTooltip',
114
118
  'GlInputGroupText',
115
119
  'GlGaugeChart',
120
+ 'GlSafeHtmlDirective',
116
121
  'GlFormRadio',
117
122
  'GlModal',
118
123
  'GlKeysetPagination',
@@ -127,6 +132,7 @@ export const setupStorybookReadme = () =>
127
132
  'GlColumnChart',
128
133
  'GlTruncate',
129
134
  'GlNav',
135
+ 'GlSearchBoxByType',
130
136
  'GlNavItem',
131
137
  'GlNavItemDropdown',
132
138
  'GlPopover',
@@ -137,6 +143,8 @@ export const setupStorybookReadme = () =>
137
143
  'GlChartSeriesLabel',
138
144
  'GlAreaChart',
139
145
  'GlLineChart',
146
+ 'GlFormInputGroup',
147
+ 'GlSearchBoxByClick',
140
148
  ],
141
149
  components: {
142
150
  GlComponentDocumentation,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "37.1.0",
3
+ "version": "37.4.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -108,9 +108,8 @@
108
108
  }
109
109
 
110
110
  &.selected {
111
- @include gl-bg-gray-10;
112
- box-shadow: inset 0 0 0 $gl-border-size-1 $gray-200,
113
- inset 0 $gl-border-size-2 $gl-border-size-4 $gray-200;
111
+ @include gl-bg-white;
112
+ box-shadow: inset 0 0 0 $gl-border-size-2 $gray-300;
114
113
 
115
114
  &:hover,
116
115
  &:focus {
@@ -118,20 +117,17 @@
118
117
  }
119
118
 
120
119
  &:hover {
121
- box-shadow: inset 0 0 0 $gl-border-size-2 $gray-400,
122
- inset 0 $gl-border-size-4 $gl-border-size-4 $gray-200;
120
+ box-shadow: inset 0 0 0 $gl-border-size-2 $gray-400;
123
121
  }
124
122
 
125
123
  &:focus {
126
- box-shadow: inset 0 0 0 $gl-border-size-2 $gray-400,
127
- inset 0 $gl-border-size-4 $gl-border-size-4 $gray-200, $focus-ring;
124
+ box-shadow: inset 0 0 0 $gl-border-size-2 $gray-400, $focus-ring;
128
125
  }
129
126
 
130
127
  &:active,
131
128
  &:active:focus {
132
129
  @include gl-bg-gray-100;
133
- box-shadow: inset 0 0 0 $gl-border-size-2 $gray-600,
134
- inset 0 $gl-border-size-4 $gl-border-size-4 $gray-200, $focus-ring;
130
+ box-shadow: inset 0 0 0 $gl-border-size-2 $gray-600, $focus-ring;
135
131
  }
136
132
  }
137
133
 
@@ -1,8 +1,5 @@
1
- import examples from './examples/form_group';
2
1
  import description from './form_group.md';
3
2
 
4
3
  export default {
5
4
  description,
6
- examples,
7
- bootstrapComponent: 'b-form-group',
8
5
  };
@@ -1,3 +1 @@
1
- # Form Group
2
-
3
1
  Form group adds structure to forms.
@@ -1,164 +1,125 @@
1
- import { withKnobs, text, select, boolean } from '@storybook/addon-knobs';
2
- import { documentedStoriesOf } from '../../../../../documentation/documented_stories';
3
1
  import { GlFormGroup, GlFormInput, GlFormTextarea } from '../../../../index';
4
- import { sizeOptions } from '../../../../utils/constants';
2
+ import { disableControls } from '../../../../utils/stories_utils';
5
3
  import readme from './form_group.md';
6
4
 
7
5
  const components = {
8
6
  GlFormGroup,
9
7
  };
10
8
 
11
- function generateProps({
9
+ const generateProps = ({
12
10
  id = 'group-1',
13
11
  label = 'Label Name',
14
12
  description = 'form group description',
15
- labelDescription = 'form label description',
13
+ labelDescription = '',
16
14
  optional = GlFormGroup.props.optional.default,
17
15
  optionalText = GlFormGroup.props.optionalText.default,
18
- horizontal = false,
19
- } = {}) {
20
- return {
21
- id: {
22
- type: String,
23
- default: text('id', id),
24
- },
25
- label: {
26
- type: String,
27
- default: text('label', label),
28
- },
29
- labelSize: {
30
- type: String,
31
- default: select('label-size', sizeOptions, sizeOptions.sm),
32
- },
33
- description: {
34
- type: String,
35
- default: text('description', description),
36
- },
37
- labelDescription: {
38
- type: String,
39
- default: text('label-description', labelDescription),
40
- },
41
- optional: {
42
- type: Boolean,
43
- default: boolean('optional', optional),
44
- },
45
- optionalText: {
46
- type: String,
47
- default: text('optional-text', optionalText),
48
- },
49
- horizontal: {
50
- type: Boolean,
51
- default: boolean('horizontal', horizontal),
16
+ } = {}) => ({
17
+ id,
18
+ label,
19
+ labelDescription,
20
+ optional,
21
+ optionalText,
22
+ description,
23
+ });
24
+
25
+ const wrap = (template, bindings = '') => `
26
+ <gl-form-group
27
+ :id="id + '_group'"
28
+ :label="label"
29
+ :label-description="labelDescription"
30
+ :optional="optional"
31
+ :optional-text="optionalText"
32
+ :description="description"
33
+ ${bindings}
34
+ :label-for="id">
35
+ ${template}
36
+ </gl-form-group>
37
+ `;
38
+
39
+ export const Default = (_args, { argTypes }) => ({
40
+ props: Object.keys(argTypes),
41
+ components: { ...components, GlFormInput },
42
+ template: wrap('<gl-form-input :id="id" />'),
43
+ });
44
+ Default.args = generateProps();
45
+
46
+ export const Disabled = (_args, { argTypes }) => ({
47
+ props: Object.keys(argTypes),
48
+ components: { ...components, GlFormInput },
49
+ template: wrap('<gl-form-input :id="id" type="text" value="Disabled" disabled />'),
50
+ });
51
+ Disabled.args = generateProps({ description: 'This feature is disabled' });
52
+
53
+ export const WithTextarea = (_args, { argTypes }) => ({
54
+ props: Object.keys(argTypes),
55
+ components: { ...components, GlFormTextarea },
56
+ template: wrap('<gl-form-textarea :id="id" placeholder="Enter something" />'),
57
+ });
58
+ WithTextarea.args = generateProps({
59
+ id: 'textarea2',
60
+ optional: true,
61
+ description: '',
62
+ });
63
+
64
+ export const WithLabelDescription = (_args, { argTypes }) => ({
65
+ props: Object.keys(argTypes),
66
+ components: { ...components, GlFormInput },
67
+ template: wrap('<gl-form-input :id="id" />'),
68
+ });
69
+ WithLabelDescription.args = generateProps({
70
+ optional: true,
71
+ labelDescription: 'form label description',
72
+ });
73
+
74
+ export const WithValidations = (_args, { argTypes }) => ({
75
+ props: Object.keys(argTypes),
76
+ components: { ...components, GlFormInput },
77
+ computed: {
78
+ state() {
79
+ return this.name.length >= 4;
52
80
  },
53
- };
54
- }
81
+ invalidFeedback() {
82
+ let feedbackText = 'This field is required.';
55
83
 
56
- documentedStoriesOf('base/form/form-group', readme)
57
- .addDecorator(withKnobs)
58
- .add('default', () => ({
59
- props: generateProps(),
60
- components: { ...components, GlFormInput },
61
- template: `
62
- <gl-form-group
63
- :id="id"
64
- :label="label"
65
- :label-size="labelSize"
66
- :optional="optional"
67
- :optional-text="optionalText"
68
- :description="description"
69
- :horizontal="horizontal"
70
- label-for="label1"
71
- >
72
- <gl-form-input id="input1" />
73
- </gl-form-group>
74
- `,
75
- }))
76
- .add('disabled', () => ({
77
- props: generateProps(),
78
- components: { ...components, GlFormInput },
79
- template: `
80
- <gl-form-group
81
- id="group-id"
82
- label="Label Name"
83
- label-size="sm"
84
- :optional="optional"
85
- :optional-text="optionalText"
86
- description="This feature is disabled"
87
- label-for="input1"
88
- >
89
- <gl-form-input id="input1" type="text" :disabled="true" value="Disabled" />
90
- </gl-form-group>
91
- `,
92
- }))
93
- .add('with textarea', () => ({
94
- components: { ...components, GlFormTextarea },
95
- props: generateProps({ optional: true }),
96
- template: `
97
- <gl-form-group
98
- id="group-id-textarea2"
99
- label="Label Name"
100
- label-for="textarea2"
101
- :optional="optional"
102
- :optional-text="optionalText"
103
- >
104
- <gl-form-textarea id="textarea2" placeholder="Enter something" />
105
- </gl-form-group>
106
- `,
107
- }))
108
- .add('with label description', () => ({
109
- props: generateProps({ optional: true }),
110
- components: { ...components, GlFormInput },
111
- template: `
112
- <gl-form-group
113
- :id="id"
114
- :label="label"
115
- :label-size="labelSize"
116
- :description="description"
117
- :label-description="labelDescription"
118
- :optional="optional"
119
- :optional-text="optionalText"
120
- :horizontal="horizontal"
121
- label-for="label1"
122
- >
123
- <gl-form-input id="input1" />
124
- </gl-form-group>
125
- `,
126
- }))
127
- .add('with validations', () => ({
128
- props: generateProps({ label: 'Name', description: 'Enter a first and last name.' }),
129
- components: { ...components, GlFormInput },
130
- computed: {
131
- state() {
132
- return this.name.length >= 4;
133
- },
134
- invalidFeedback() {
135
- let feedbackText = 'This field is required.';
84
+ if (this.name.length > 4) {
85
+ feedbackText = '';
86
+ } else if (this.name.length > 0) {
87
+ feedbackText = 'Enter at least 4 characters.';
88
+ }
136
89
 
137
- if (this.name.length > 4) {
138
- feedbackText = '';
139
- } else if (this.name.length > 0) {
140
- feedbackText = 'Enter at least 4 characters.';
141
- }
90
+ return feedbackText;
91
+ },
92
+ },
93
+ data() {
94
+ return {
95
+ name: '',
96
+ };
97
+ },
98
+ template: wrap(
99
+ '<gl-form-input :id="id" :state="state" v-model.trim="name" />',
100
+ ':invalid-feedback="invalidFeedback"'
101
+ ),
102
+ });
103
+ WithValidations.args = generateProps({
104
+ label: 'Name',
105
+ description: 'Enter a first and last name.',
106
+ });
142
107
 
143
- return feedbackText;
108
+ export default {
109
+ title: 'base/form/form-group',
110
+ component: GlFormGroup,
111
+ parameters: {
112
+ bootstrapComponent: 'b-form-group',
113
+ docs: {
114
+ description: {
115
+ component: readme,
144
116
  },
145
117
  },
146
- data() {
147
- return {
148
- name: '',
149
- };
118
+ },
119
+ argTypes: {
120
+ ...disableControls(['labelClass']),
121
+ label: {
122
+ control: { type: 'text' },
150
123
  },
151
- template: `
152
- <gl-form-group
153
- :id="id"
154
- :label="label"
155
- :label-size="labelSize"
156
- :description="description"
157
- :invalid-feedback="invalidFeedback"
158
- :state="state"
159
- label-for="label1"
160
- >
161
- <gl-form-input id="input1" :state="state" v-model.trim="name" />
162
- </gl-form-group>
163
- `,
164
- }));
124
+ },
125
+ };
@@ -1,34 +1,6 @@
1
- import examples from './examples';
2
1
  import description from './form_input_group.md';
3
2
 
4
3
  export default {
5
4
  followsDesignSystem: false,
6
5
  description,
7
- examples,
8
- bootstrapComponent: 'b-form-input',
9
- propsInfo: {
10
- 'select-on-click': {
11
- type: Boolean,
12
- additionalInfo: 'Automatically selects the content of the input field on click',
13
- },
14
- 'predefined-options': {
15
- type: Array,
16
- additionalInfo:
17
- 'Array of options. Each option should have `name` and `value` information: {name: "Foo", value: "Bar"})',
18
- },
19
- },
20
- slots: [
21
- {
22
- name: 'default',
23
- description: 'Allows replacement of default input field.',
24
- },
25
- {
26
- name: 'prepend',
27
- description: 'Is rendered in front of the input field.',
28
- },
29
- {
30
- name: 'append',
31
- description: 'Is rendered after the input field.',
32
- },
33
- ],
34
6
  };
@@ -1,7 +1,3 @@
1
- # Form Group Input
2
-
3
- <!-- STORY -->
4
-
5
1
  The `GlFormInputGroup` component allows one to build more advanced text
6
2
  input fields than generic `GlFormInput` when one needs that flexibility.
7
3
  Basic usage of the component:
@@ -1,73 +1,95 @@
1
- import { withKnobs, boolean, object, text } from '@storybook/addon-knobs';
2
- import { documentedStoriesOf } from '../../../../../documentation/documented_stories';
3
1
  import { GlFormInputGroup, GlInputGroupText } from '../../../../index';
2
+ import { disableControls } from '../../../../utils/stories_utils';
4
3
  import readme from './form_input_group.md';
5
4
 
6
- const components = {
7
- GlFormInputGroup,
8
- GlInputGroupText,
9
- };
10
- const predefinedOptions = [
11
- { name: 'Embed', value: 'https://embed.com' },
12
- { name: 'Share', value: 'https://share.org' },
13
- ];
5
+ const template = `
6
+ <gl-form-input-group
7
+ :readonly="readonly"
8
+ :select-on-click="selectOnClick"
9
+ :predefined-options="predefinedOptions"
10
+ :label="label"
11
+ :inputClass="inputClass">
12
+ <template #prepend v-if="prepend">
13
+ <gl-input-group-text>{{prepend}}</gl-input-group-text>
14
+ </template>
15
+ <template #append v-if="append">
16
+ <gl-input-group-text>{{append}}</gl-input-group-text>
17
+ </template>
18
+ </gl-form-input-group>
19
+ `;
14
20
 
15
- documentedStoriesOf('base/form/form-input-group', readme)
16
- .addDecorator(withKnobs)
17
- .add('default', () => ({
18
- components,
19
- props: {
20
- prepend: {
21
- default: text('Prepend text', 'Username'),
22
- },
23
- append: {
24
- default: text('Append text', 'Add'),
25
- },
26
- readonly: {
27
- default: boolean('Readonly', false),
28
- },
29
- select: {
30
- default: boolean('Select text on click', false),
21
+ const defaultValue = (prop) => GlFormInputGroup.props[prop].default;
22
+
23
+ const generateProps = ({
24
+ prepend = 'Username',
25
+ append = 'Add',
26
+ readonly = false,
27
+ selectOnClick = false,
28
+ predefinedOptions = defaultValue('predefinedOptions')(),
29
+ label = '',
30
+ inputClass = '',
31
+ } = {}) => ({
32
+ prepend,
33
+ append,
34
+ readonly,
35
+ selectOnClick,
36
+ predefinedOptions,
37
+ label,
38
+ inputClass,
39
+ });
40
+
41
+ const Template = (args, { argTypes }) => ({
42
+ components: { GlFormInputGroup, GlInputGroupText },
43
+ props: Object.keys(argTypes),
44
+ template,
45
+ });
46
+
47
+ export const Default = Template.bind({});
48
+ Default.args = generateProps();
49
+
50
+ export const PredefinedOptions = Template.bind({});
51
+ PredefinedOptions.args = generateProps({
52
+ prepend: '',
53
+ predefinedOptions: [
54
+ { name: 'Embed', value: 'https://embed.com' },
55
+ { name: 'Share', value: 'https://share.org' },
56
+ ],
57
+ });
58
+
59
+ export default {
60
+ title: 'base/form/form-input-group',
61
+ component: GlFormInputGroup,
62
+ knobs: { disabled: true },
63
+ parameters: {
64
+ bootstrapComponent: 'b-form-input',
65
+ docs: {
66
+ description: {
67
+ component: readme,
31
68
  },
32
69
  },
33
- template: `
34
- <gl-form-input-group :readonly="readonly" :select-on-click="select">
35
- <template #prepend v-if="prepend">
36
- <gl-input-group-text>{{prepend}}</gl-input-group-text>
37
- </template>
38
- <template #append v-if="append">
39
- <gl-input-group-text>{{append}}</gl-input-group-text>
40
- </template>
41
- </gl-form-input-group>
42
- `,
43
- }))
44
- .add('with predefined options', () => ({
45
- components,
46
- props: {
47
- prepend: {
48
- default: text('Prepend text', ''),
70
+ knobs: { disabled: true },
71
+ },
72
+ argTypes: {
73
+ ...disableControls(['value']),
74
+ prepend: {
75
+ control: {
76
+ type: 'text',
49
77
  },
50
- append: {
51
- default: text('Append text', 'Add'),
52
- },
53
- readonly: {
54
- default: boolean('Readonly', false),
78
+ },
79
+ append: {
80
+ control: {
81
+ type: 'text',
55
82
  },
56
- select: {
57
- default: boolean('Select text on click', false),
83
+ },
84
+ inputClass: {
85
+ control: {
86
+ type: 'text',
58
87
  },
59
- options: {
60
- default: object('Predefined options', predefinedOptions),
88
+ },
89
+ label: {
90
+ control: {
91
+ type: 'text',
61
92
  },
62
93
  },
63
- template: `
64
- <gl-form-input-group :readonly="readonly" :select-on-click="select" :predefined-options="options">
65
- <template #prepend v-if="prepend">
66
- <gl-input-group-text>{{prepend}}</gl-input-group-text>
67
- </template>
68
- <template #append v-if="append">
69
- <gl-input-group-text>{{append}}</gl-input-group-text>
70
- </template>
71
- </gl-form-input-group>
72
- `,
73
- }));
94
+ },
95
+ };
@@ -16,11 +16,17 @@ export default {
16
16
  },
17
17
  mixins: [InputGroupMixin],
18
18
  props: {
19
+ /**
20
+ * Automatically selects the content of the input field on click.
21
+ */
19
22
  selectOnClick: {
20
23
  type: Boolean,
21
24
  required: false,
22
25
  default: false,
23
26
  },
27
+ /**
28
+ * Array of options. Each option should have `name` and `value` information: {name: "Foo", value: "Bar"})
29
+ */
24
30
  predefinedOptions: {
25
31
  type: Array,
26
32
  required: false,
@@ -61,6 +67,7 @@ export default {
61
67
  <div>
62
68
  <b-input-group>
63
69
  <b-input-group-prepend v-if="activeOption || $scopedSlots.prepend">
70
+ <!-- @slot Is rendered in front of the input field. -->
64
71
  <slot name="prepend"></slot>
65
72
  <gl-dropdown v-if="activeOption" :text="activeOption">
66
73
  <gl-dropdown-item
@@ -74,6 +81,7 @@ export default {
74
81
  </gl-dropdown-item>
75
82
  </gl-dropdown>
76
83
  </b-input-group-prepend>
84
+ <!-- @slot Allows replacement of default input field. -->
77
85
  <slot>
78
86
  <b-form-input
79
87
  ref="input"
@@ -86,6 +94,7 @@ export default {
86
94
  />
87
95
  </slot>
88
96
  <b-input-group-append v-if="$scopedSlots.append">
97
+ <!-- @slot Is rendered after the input field. -->
89
98
  <slot name="append"></slot>
90
99
  </b-input-group-append>
91
100
  </b-input-group>
@@ -64,6 +64,6 @@ export default {
64
64
  </script>
65
65
  <template>
66
66
  <component :is="rootElementType" class="gl-spinner-container" role="status">
67
- <span :class="cssClasses" class="align-text-bottom" :aria-label="label"></span>
67
+ <span :class="cssClasses" class="gl-vertical-align-text-bottom!" :aria-label="label"></span>
68
68
  </component>
69
69
  </template>
@@ -16,6 +16,7 @@ const mockResizeWidth = (width) => {
16
16
  describe('pagination component', () => {
17
17
  let wrapper;
18
18
  const findButtons = () => wrapper.findAll('.page-link');
19
+ const findItems = () => wrapper.findAll('.page-item');
19
20
  const propsData = {
20
21
  value: 3,
21
22
  perPage: 5,
@@ -375,9 +376,12 @@ describe('pagination component', () => {
375
376
  value: 1,
376
377
  nextPage: 2,
377
378
  });
379
+ const prevItem = findItems().at(0);
380
+ expect(prevItem.attributes('aria-hidden')).toBe('true');
378
381
  const prevButton = findButtons().at(0);
379
382
  expect(prevButton.element.tagName).toBe('SPAN');
380
- expect(prevButton.attributes('aria-disabled')).toBe('true');
383
+ expect(prevButton.attributes('href')).toBeUndefined();
384
+ expect(prevButton.attributes('aria-label')).toBeUndefined();
381
385
  });
382
386
 
383
387
  it('disables next button when on last page', () => {
@@ -386,9 +390,12 @@ describe('pagination component', () => {
386
390
  value: 2,
387
391
  prevPage: 1,
388
392
  });
393
+ const nextItem = findItems().at(1);
394
+ expect(nextItem.attributes('aria-hidden')).toBe('true');
389
395
  const nextButton = findButtons().at(1);
390
396
  expect(nextButton.element.tagName).toBe('SPAN');
391
- expect(nextButton.attributes('aria-disabled')).toBe('true');
397
+ expect(nextButton.attributes('href')).toBeUndefined();
398
+ expect(nextButton.attributes('aria-label')).toBeUndefined();
392
399
  });
393
400
  });
394
401
  });