@gitlab/ui 52.8.0 → 52.9.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.
- package/CHANGELOG.md +8 -0
- package/dist/components/base/search_box_by_type/search_box_by_type.js +9 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/package.json +1 -1
- package/src/components/base/search_box_by_type/search_box_by_type.scss +30 -2
- package/src/components/base/search_box_by_type/search_box_by_type.spec.js +14 -0
- package/src/components/base/search_box_by_type/search_box_by_type.stories.js +9 -0
- package/src/components/base/search_box_by_type/search_box_by_type.vue +10 -2
- package/dist/components/base/search_box_by_type/index.js +0 -1
- package/src/components/base/search_box_by_type/index.js +0 -0
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
$gl-search-box-by-type-search-icon-size: 16px;
|
|
1
2
|
$gl-search-box-by-type-input-padding: 3.5 * $grid-size;
|
|
2
3
|
|
|
3
4
|
.gl-search-box-by-type-search-icon {
|
|
4
|
-
@include gl-m-3;
|
|
5
5
|
@include gl-text-gray-500;
|
|
6
6
|
@include gl-w-5;
|
|
7
7
|
@include gl-absolute;
|
|
8
|
+
@include gl-left-3;
|
|
9
|
+
top: calc(50% - #{$gl-search-box-by-type-search-icon-size} / 2);
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
.gl-search-box-by-type {
|
|
@@ -33,11 +35,37 @@ $gl-search-box-by-type-input-padding: 3.5 * $grid-size;
|
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
|
|
38
|
+
.gl-search-box-by-type-input-borderless,
|
|
39
|
+
.gl-search-box-by-type-input-borderless.gl-form-input {
|
|
40
|
+
@include gl-border-none;
|
|
41
|
+
@include gl-font-base;
|
|
42
|
+
@include gl-h-auto;
|
|
43
|
+
@include gl-line-height-normal;
|
|
44
|
+
@include gl-pl-7;
|
|
45
|
+
@include gl-py-4;
|
|
46
|
+
@include gl-shadow-none;
|
|
47
|
+
@include gl-w-full;
|
|
48
|
+
border-radius: 0;
|
|
49
|
+
padding-right: calc(#{$gl-spacing-scale-6} + #{$gl-spacing-scale-2});
|
|
50
|
+
|
|
51
|
+
&:not(.form-control-plaintext):focus {
|
|
52
|
+
@include gl-focus($inset: true);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&::placeholder {
|
|
56
|
+
@include gl-text-gray-400;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&::-webkit-search-cancel-button {
|
|
60
|
+
@include gl-display-none;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
36
64
|
.gl-search-box-by-type-right-icons {
|
|
37
65
|
@include gl-display-flex;
|
|
38
66
|
@include gl-align-items-center;
|
|
39
67
|
@include gl-line-height-0;
|
|
40
|
-
@include gl-right-
|
|
68
|
+
@include gl-right-2;
|
|
41
69
|
@include gl-absolute;
|
|
42
70
|
@include gl-h-full;
|
|
43
71
|
}
|
|
@@ -16,6 +16,20 @@ describe('search box by type component', () => {
|
|
|
16
16
|
const findClearIcon = () => wrapper.findComponent(ClearIcon);
|
|
17
17
|
const findInput = () => wrapper.findComponent({ ref: 'input' });
|
|
18
18
|
|
|
19
|
+
describe('borderless', () => {
|
|
20
|
+
it('renders default class on input when `borderless` prop is false', () => {
|
|
21
|
+
createComponent({ borderless: false });
|
|
22
|
+
|
|
23
|
+
expect(findInput().classes()).toContain('gl-search-box-by-type-input');
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('renders borderless class on input when `borderless` prop is true', () => {
|
|
27
|
+
createComponent({ borderless: true });
|
|
28
|
+
|
|
29
|
+
expect(findInput().classes()).toContain('gl-search-box-by-type-input-borderless');
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
19
33
|
describe('clear icon component', () => {
|
|
20
34
|
beforeEach(() => {
|
|
21
35
|
createComponent({ value: 'somevalue' });
|
|
@@ -5,6 +5,7 @@ import readme from './search_box_by_type.md';
|
|
|
5
5
|
const template = `
|
|
6
6
|
<gl-search-box-by-type
|
|
7
7
|
v-model="searchQuery"
|
|
8
|
+
:borderless="borderless"
|
|
8
9
|
:clear-button-title="clearButtonTitle"
|
|
9
10
|
:disabled="disabled"
|
|
10
11
|
:is-loading="isLoading"
|
|
@@ -15,11 +16,13 @@ const template = `
|
|
|
15
16
|
const defaultValue = (prop) => GlSearchBoxByType.props[prop].default;
|
|
16
17
|
|
|
17
18
|
const generateProps = ({
|
|
19
|
+
borderless = defaultValue('borderless'),
|
|
18
20
|
clearButtonTitle = defaultValue('clearButtonTitle'),
|
|
19
21
|
disabled = defaultValue('disabled'),
|
|
20
22
|
placeholder = 'Search',
|
|
21
23
|
isLoading = defaultValue('isLoading'),
|
|
22
24
|
} = {}) => ({
|
|
25
|
+
borderless,
|
|
23
26
|
clearButtonTitle,
|
|
24
27
|
disabled,
|
|
25
28
|
placeholder,
|
|
@@ -34,9 +37,15 @@ const Template = (args, { argTypes }) => ({
|
|
|
34
37
|
data: () => ({ searchQuery: '' }),
|
|
35
38
|
template,
|
|
36
39
|
});
|
|
40
|
+
|
|
37
41
|
export const Default = Template.bind({});
|
|
38
42
|
Default.args = generateProps();
|
|
39
43
|
|
|
44
|
+
export const Borderless = Template.bind({});
|
|
45
|
+
Borderless.args = generateProps({
|
|
46
|
+
borderless: true,
|
|
47
|
+
});
|
|
48
|
+
|
|
40
49
|
export default {
|
|
41
50
|
title: 'base/search-box-by-type',
|
|
42
51
|
component: GlSearchBoxByType,
|
|
@@ -25,6 +25,11 @@ export default {
|
|
|
25
25
|
required: false,
|
|
26
26
|
default: '',
|
|
27
27
|
},
|
|
28
|
+
borderless: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
required: false,
|
|
31
|
+
default: false,
|
|
32
|
+
},
|
|
28
33
|
clearButtonTitle: {
|
|
29
34
|
type: String,
|
|
30
35
|
required: false,
|
|
@@ -113,11 +118,14 @@ export default {
|
|
|
113
118
|
ref="input"
|
|
114
119
|
:value="value"
|
|
115
120
|
:disabled="disabled"
|
|
116
|
-
class="
|
|
121
|
+
:class="{
|
|
122
|
+
'gl-search-box-by-type-input': !borderless,
|
|
123
|
+
'gl-search-box-by-type-input-borderless': borderless,
|
|
124
|
+
}"
|
|
117
125
|
v-bind="inputAttributes"
|
|
118
126
|
v-on="inputListeners"
|
|
119
127
|
/>
|
|
120
|
-
<div class="gl-search-box-by-type-right-icons">
|
|
128
|
+
<div v-if="isLoading || showClearButton" class="gl-search-box-by-type-right-icons">
|
|
121
129
|
<gl-loading-icon v-if="isLoading" class="gl-search-box-by-type-loading-icon" />
|
|
122
130
|
<gl-clear-icon-button
|
|
123
131
|
v-if="showClearButton"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
File without changes
|