@pequity/squirrel 7.0.3 → 7.1.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/README.md +1 -1
- package/dist/cjs/chunks/p-btn.js +22 -26
- package/dist/cjs/chunks/p-select-btn.js +1 -1
- package/dist/cjs/p-chips.js +2 -3
- package/dist/cjs/p-icon.js +2 -1
- package/dist/cjs/p-input-search.js +93 -82
- package/dist/es/chunks/p-btn.js +23 -27
- package/dist/es/chunks/p-select-btn.js +1 -1
- package/dist/es/p-chips.js +2 -3
- package/dist/es/p-icon.js +2 -1
- package/dist/es/p-input-search.js +93 -82
- package/dist/squirrel/components/p-btn/p-btn.vue.d.ts +6 -6
- package/dist/squirrel/components/p-chips/p-chips.vue.d.ts +0 -2
- package/dist/squirrel/components/p-icon/p-icon.types.d.ts +1 -0
- package/dist/squirrel/components/p-input-search/p-input-search.vue.d.ts +7 -164
- package/dist/squirrel.css +2 -76
- package/package.json +23 -20
- package/squirrel/components/p-btn/p-btn.spec.js +33 -35
- package/squirrel/components/p-btn/p-btn.vue +24 -28
- package/squirrel/components/p-chips/p-chips.vue +0 -1
- package/squirrel/components/p-dropdown-select/p-dropdown-select.spec.js +1 -1
- package/squirrel/components/p-icon/p-icon.types.ts +1 -0
- package/squirrel/components/p-input-search/p-input-search.spec.js +4 -4
- package/squirrel/components/p-input-search/p-input-search.vue +77 -137
- package/squirrel/components/p-select-btn/p-select-btn.vue +1 -1
- package/squirrel/components/p-select-list/p-select-list.spec.js +1 -1
- package/squirrel/assets/clear-input-faded.svg +0 -10
- package/squirrel/assets/clear-input-hovered.svg +0 -10
- package/squirrel/assets/magnifying-glass.svg +0 -10
|
@@ -2,6 +2,7 @@ import PBtn from '@squirrel/components/p-btn/p-btn.vue';
|
|
|
2
2
|
import { sanitizeUrl } from '@squirrel/utils/sanitization';
|
|
3
3
|
import { createWrapperFor } from '@tests/vitest.helpers';
|
|
4
4
|
import { describe } from 'vitest';
|
|
5
|
+
import { ref } from 'vue';
|
|
5
6
|
|
|
6
7
|
vi.mock('@squirrel/utils/sanitization', () => {
|
|
7
8
|
return {
|
|
@@ -109,43 +110,40 @@ describe('PBtn.vue', () => {
|
|
|
109
110
|
expect(button.text()).toContain(`This is a button`);
|
|
110
111
|
});
|
|
111
112
|
|
|
112
|
-
it.each([
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
113
|
+
it.each(['https://pequity.com/', { name: 'home', params: { id: 1 } }])(
|
|
114
|
+
'gets disabled when the link points to %s',
|
|
115
|
+
async (to) => {
|
|
116
|
+
const wrapper = createWrapperFor(
|
|
117
|
+
{
|
|
118
|
+
template: `
|
|
119
|
+
<PBtn :disabled="disabled" :to="to" >Button</PBtn>
|
|
120
|
+
<button class="set-disabled" @click="disabled = true" :to="to">Set disabled</button>
|
|
121
|
+
`,
|
|
122
|
+
components: { PBtn },
|
|
123
|
+
setup() {
|
|
124
|
+
const disabled = ref(null);
|
|
125
|
+
|
|
126
|
+
return { disabled, to };
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
global: {
|
|
131
|
+
stubs: { RouterLink: { template: '<a class="router-link-stub"><slot /></a>' } },
|
|
132
|
+
},
|
|
133
|
+
}
|
|
134
|
+
);
|
|
132
135
|
|
|
133
|
-
|
|
134
|
-
expect(wrapper.emitted().click).toBeFalsy();
|
|
135
|
-
}
|
|
136
|
-
expect(button.attributes()).toHaveProperty('disabled');
|
|
137
|
-
expect(button.attributes()['aria-disabled']).toBe('true');
|
|
136
|
+
const pBtn = await wrapper.findComponent({ name: 'PBtn' });
|
|
138
137
|
|
|
139
|
-
|
|
138
|
+
expect(pBtn.attributes()).not.toHaveProperty('disabled');
|
|
139
|
+
expect(pBtn.attributes()['aria-disabled']).toBe('false');
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
await wrapper.find('.set-disabled').trigger('click');
|
|
142
142
|
|
|
143
|
-
|
|
144
|
-
expect(
|
|
143
|
+
expect(pBtn.attributes().disabled).toBe('true');
|
|
144
|
+
expect(pBtn.attributes()['aria-disabled']).toBe('true');
|
|
145
145
|
}
|
|
146
|
-
|
|
147
|
-
expect(button.attributes()['aria-disabled']).toBe('false');
|
|
148
|
-
});
|
|
146
|
+
);
|
|
149
147
|
|
|
150
148
|
it('has a loading state', async () => {
|
|
151
149
|
const wrapper = createWrapperFor(PBtn, {
|
|
@@ -257,7 +255,7 @@ describe('PBtn.vue', () => {
|
|
|
257
255
|
|
|
258
256
|
describe('icon button', () => {
|
|
259
257
|
it.each([
|
|
260
|
-
['sm', ['shrink-0', 'text-
|
|
258
|
+
['sm', ['shrink-0', 'text-base', 'p-0.5']],
|
|
261
259
|
['md', ['shrink-0', 'text-xl']],
|
|
262
260
|
['lg', ['shrink-0', 'text-2xl']],
|
|
263
261
|
])('renders a button with icon of size %s', async (size, classes) => {
|
|
@@ -273,7 +271,7 @@ describe('PBtn.vue', () => {
|
|
|
273
271
|
});
|
|
274
272
|
|
|
275
273
|
it.each([
|
|
276
|
-
['sm', ['shrink-0', 'text-
|
|
274
|
+
['sm', ['shrink-0', 'text-base', 'p-0.5']],
|
|
277
275
|
['md', ['shrink-0', 'text-xl']],
|
|
278
276
|
['lg', ['shrink-0', 'text-2xl']],
|
|
279
277
|
])('renders a button with a right icon of size %s', async (size, classes) => {
|
|
@@ -289,7 +287,7 @@ describe('PBtn.vue', () => {
|
|
|
289
287
|
});
|
|
290
288
|
|
|
291
289
|
it.each([
|
|
292
|
-
['sm', ['shrink-0', 'text-
|
|
290
|
+
['sm', ['shrink-0', 'text-base', 'p-0.5'], ['has-[.slot-wrapper:empty]:px-1.5']],
|
|
293
291
|
['md', ['shrink-0', 'text-xl'], ['has-[.slot-wrapper:empty]:px-2.5']],
|
|
294
292
|
['lg', ['shrink-0', 'text-2xl'], ['has-[.slot-wrapper:empty]:px-3']],
|
|
295
293
|
])('renders a button with an icon without text of size %s', async (size, classes, buttonClasses) => {
|
|
@@ -1,26 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<a
|
|
3
|
-
v-if="typeof to === 'string' && isExternalLink(to)"
|
|
4
|
-
v-bind="$attrs"
|
|
5
|
-
:href="sanitizeUrl(to)"
|
|
6
|
-
target="_blank"
|
|
7
|
-
:class="classes.button"
|
|
8
|
-
:disabled="!!$attrs.disabled ? true : null"
|
|
9
|
-
:aria-disabled="!!$attrs.disabled"
|
|
10
|
-
>
|
|
11
|
-
<slot></slot>
|
|
12
|
-
</a>
|
|
13
|
-
<Component
|
|
14
|
-
:is="to ? 'RouterLink' : 'button'"
|
|
15
|
-
v-else
|
|
16
|
-
:type="to ? null : nativeType"
|
|
17
|
-
:to="to ? to : null"
|
|
18
|
-
:aria-selected="selected"
|
|
19
|
-
:class="classes.button"
|
|
20
|
-
v-bind="$attrs"
|
|
21
|
-
:disabled="!!$attrs.disabled || loading ? true : null"
|
|
22
|
-
:aria-disabled="$attrs.disabled"
|
|
23
|
-
>
|
|
2
|
+
<Component :is="isExternal ? 'a' : to ? 'RouterLink' : 'button'" v-bind="btnAttrs" :class="classes.button">
|
|
24
3
|
<div :class="[{ invisible: loading }, classes.content]">
|
|
25
4
|
<PIcon v-if="icon" :icon="icon" :class="classes.icon" />
|
|
26
5
|
<span class="slot-wrapper empty:hidden">
|
|
@@ -28,7 +7,7 @@
|
|
|
28
7
|
</span>
|
|
29
8
|
<PIcon v-if="iconRight" :icon="iconRight" :class="classes.icon" />
|
|
30
9
|
</div>
|
|
31
|
-
<PRingLoader v-if="loading" :size="
|
|
10
|
+
<PRingLoader v-if="loading" :size="LOADER_SIZES[props.size]" :class="classes.loader" />
|
|
32
11
|
</Component>
|
|
33
12
|
</template>
|
|
34
13
|
|
|
@@ -39,7 +18,7 @@ import PRingLoader from '@squirrel/components/p-ring-loader/p-ring-loader.vue';
|
|
|
39
18
|
import { isExternalLink } from '@squirrel/utils/link';
|
|
40
19
|
import { sanitizeUrl } from '@squirrel/utils/sanitization';
|
|
41
20
|
import { tv, type VariantProps } from 'tailwind-variants';
|
|
42
|
-
import { computed, type PropType } from 'vue';
|
|
21
|
+
import { computed, type PropType, useAttrs } from 'vue';
|
|
43
22
|
import { type RouteLocationRaw } from 'vue-router';
|
|
44
23
|
|
|
45
24
|
type Icon = InstanceType<typeof PIcon>['$props']['icon'];
|
|
@@ -86,7 +65,7 @@ const btnClasses = {
|
|
|
86
65
|
sm: {
|
|
87
66
|
button: 'px-3 has-[.slot-wrapper:empty]:px-1.5 py-1.5 text-sm leading-5',
|
|
88
67
|
content: 'gap-1',
|
|
89
|
-
icon: 'text-
|
|
68
|
+
icon: 'text-base p-0.5',
|
|
90
69
|
},
|
|
91
70
|
md: {
|
|
92
71
|
button: 'px-6 has-[.slot-wrapper:empty]:px-2.5 has-[.slot-wrapper:empty]:py-2.5 py-2 text-base',
|
|
@@ -119,9 +98,10 @@ type ButtonType = NonNullable<VariantProps<typeof btn>['type']>;
|
|
|
119
98
|
<script setup lang="ts">
|
|
120
99
|
defineOptions({
|
|
121
100
|
name: 'PBtn',
|
|
122
|
-
inheritAttrs: false,
|
|
123
101
|
});
|
|
124
102
|
|
|
103
|
+
const attrs = useAttrs();
|
|
104
|
+
|
|
125
105
|
const props = defineProps({
|
|
126
106
|
/**
|
|
127
107
|
* The button style e.g primary, secondary, primary-outline, secondary-outline, error, success, primary-link
|
|
@@ -197,7 +177,23 @@ const classes = computed(() => {
|
|
|
197
177
|
return { button: button(), content: content(), loader: loader(), icon: icon() };
|
|
198
178
|
});
|
|
199
179
|
|
|
200
|
-
const
|
|
201
|
-
|
|
180
|
+
const isExternal = computed(() => isExternalLink(String(props.to)));
|
|
181
|
+
|
|
182
|
+
const btnAttrs = computed(() => {
|
|
183
|
+
const res: Record<string, unknown> = {
|
|
184
|
+
target: isExternal.value ? '_blank' : null,
|
|
185
|
+
to: !isExternal.value && props.to ? props.to : null,
|
|
186
|
+
type: props.to ? null : props.nativeType,
|
|
187
|
+
disabled: attrs.disabled || props.loading ? '' : null,
|
|
188
|
+
'aria-selected': !isExternal.value ? props.selected : false,
|
|
189
|
+
'aria-disabled': attrs.disabled || props.loading,
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
// We need to add the href attribute conditionally so that it doesn't override the RouterLink's href
|
|
193
|
+
if (isExternal.value) {
|
|
194
|
+
res.href = sanitizeUrl(String(props.to));
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return res;
|
|
202
198
|
});
|
|
203
199
|
</script>
|
|
@@ -595,7 +595,7 @@ describe('PDropdownSelect.vue', () => {
|
|
|
595
595
|
|
|
596
596
|
await wrapper.findByText('ff-a57d-beba44884da2').trigger('click');
|
|
597
597
|
|
|
598
|
-
await wrapper.find('button
|
|
598
|
+
await wrapper.find('button[aria-label="Clear search input"]').trigger('click');
|
|
599
599
|
|
|
600
600
|
const newItems = wrapper.findAll('[p-select-list-option-item]');
|
|
601
601
|
|
|
@@ -8,12 +8,12 @@ describe('PInputSearch.vue', () => {
|
|
|
8
8
|
const input = await wrapper.find('input');
|
|
9
9
|
const button = wrapper.find('button.cursor-pointer');
|
|
10
10
|
const icons = wrapper.findAll('i');
|
|
11
|
-
const searchIcon = wrapper.
|
|
11
|
+
const searchIcon = wrapper.findComponent({ name: 'PIcon' });
|
|
12
12
|
const enterIcon = wrapper.find('i.enter');
|
|
13
13
|
|
|
14
14
|
expect(input.exists()).toBe(true);
|
|
15
15
|
expect(button.exists()).toBe(false);
|
|
16
|
-
expect(icons.length).toBe(
|
|
16
|
+
expect(icons.length).toBe(0);
|
|
17
17
|
expect(searchIcon.exists()).toBe(true);
|
|
18
18
|
expect(enterIcon.exists()).toBe(false);
|
|
19
19
|
});
|
|
@@ -39,7 +39,7 @@ describe('PInputSearch.vue', () => {
|
|
|
39
39
|
|
|
40
40
|
await wrapper.find('input').setValue('test');
|
|
41
41
|
|
|
42
|
-
const button = await wrapper.find('button
|
|
42
|
+
const button = await wrapper.find('button[aria-label="Clear search input"]');
|
|
43
43
|
|
|
44
44
|
expect(button.exists()).toBe(true);
|
|
45
45
|
});
|
|
@@ -78,7 +78,7 @@ describe('PInputSearch.vue', () => {
|
|
|
78
78
|
const icons = await wrapper.findAll('i');
|
|
79
79
|
const enterIcon = wrapper.find('i.enter.v-popper--has-tooltip');
|
|
80
80
|
|
|
81
|
-
expect(icons.length).toBe(
|
|
81
|
+
expect(icons.length).toBe(1);
|
|
82
82
|
expect(enterIcon.exists()).toBe(true);
|
|
83
83
|
});
|
|
84
84
|
});
|
|
@@ -11,173 +11,113 @@
|
|
|
11
11
|
@keydown.enter="keydownEnter"
|
|
12
12
|
>
|
|
13
13
|
<template #prefix>
|
|
14
|
-
<
|
|
14
|
+
<PIcon icon="search" class="absolute text-p-gray-40" :class="searchIconClasses[size]" />
|
|
15
15
|
</template>
|
|
16
16
|
<template #suffix>
|
|
17
17
|
<i
|
|
18
18
|
v-if="query && showEnterIcon && showEnterIconOnFocus"
|
|
19
19
|
v-tooltip.bottom="{ content: 'Press enter to search', delay: { show: 100, hide: 0 } }"
|
|
20
|
-
class="
|
|
21
|
-
:class="enterIconClasses"
|
|
20
|
+
class="enter absolute bg-no-repeat outline-none"
|
|
21
|
+
:class="enterIconClasses[size]"
|
|
22
22
|
></i>
|
|
23
23
|
<button
|
|
24
24
|
v-if="query"
|
|
25
25
|
role="button"
|
|
26
26
|
aria-label="Clear search input"
|
|
27
|
-
class="
|
|
28
|
-
:class="clearIconClasses"
|
|
27
|
+
class="absolute cursor-pointer"
|
|
28
|
+
:class="clearIconClasses[size]"
|
|
29
29
|
@click="clearSearch"
|
|
30
|
-
|
|
30
|
+
>
|
|
31
|
+
<PIcon icon="cancel-circle" class="text-p-gray-40 hover:text-p-gray-50" />
|
|
32
|
+
</button>
|
|
31
33
|
</template>
|
|
32
34
|
</PInput>
|
|
33
35
|
</template>
|
|
34
36
|
|
|
35
|
-
<script lang="ts">
|
|
37
|
+
<script setup lang="ts">
|
|
36
38
|
import { type Size, SIZES } from '@squirrel/components/p-btn/p-btn.types';
|
|
39
|
+
import PIcon from '@squirrel/components/p-icon/p-icon.vue';
|
|
37
40
|
import PInput from '@squirrel/components/p-input/p-input.vue';
|
|
38
|
-
import {
|
|
41
|
+
import { type PropType, ref, useTemplateRef, watch } from 'vue';
|
|
39
42
|
|
|
40
43
|
type PInputInstance = InstanceType<typeof PInput>;
|
|
41
44
|
|
|
42
|
-
|
|
45
|
+
defineOptions({
|
|
43
46
|
name: 'PInputSearch',
|
|
44
|
-
components: {
|
|
45
|
-
PInput,
|
|
46
|
-
},
|
|
47
47
|
inheritAttrs: false,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
},
|
|
60
|
-
showEnterIcon: {
|
|
61
|
-
type: Boolean,
|
|
62
|
-
default: false,
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
emits: ['update:modelValue', 'enter'],
|
|
66
|
-
data() {
|
|
67
|
-
return {
|
|
68
|
-
query: this.modelValue,
|
|
69
|
-
showEnterIconOnFocus: false,
|
|
70
|
-
};
|
|
71
|
-
},
|
|
72
|
-
computed: {
|
|
73
|
-
searchIconClasses() {
|
|
74
|
-
return `search search-${this.size}`;
|
|
75
|
-
},
|
|
76
|
-
enterIconClasses() {
|
|
77
|
-
return `enter enter-${this.size}`;
|
|
78
|
-
},
|
|
79
|
-
clearIconClasses() {
|
|
80
|
-
return `clear clear-${this.size}`;
|
|
81
|
-
},
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const emit = defineEmits<{
|
|
51
|
+
'update:modelValue': [value: string];
|
|
52
|
+
enter: [value: string];
|
|
53
|
+
}>();
|
|
54
|
+
|
|
55
|
+
const props = defineProps({
|
|
56
|
+
modelValue: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: '',
|
|
82
59
|
},
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
this.$emit('update:modelValue', value);
|
|
60
|
+
size: {
|
|
61
|
+
type: String as PropType<Size>,
|
|
62
|
+
default: 'md',
|
|
63
|
+
validator(value: Size) {
|
|
64
|
+
return SIZES.includes(value);
|
|
89
65
|
},
|
|
90
66
|
},
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
requestAnimationFrame(() => {
|
|
95
|
-
(this.$refs.searchInput as PInputInstance)?.$el.querySelector('input').focus();
|
|
96
|
-
});
|
|
97
|
-
},
|
|
98
|
-
keydownEnter() {
|
|
99
|
-
this.$emit('enter', this.query);
|
|
100
|
-
},
|
|
67
|
+
showEnterIcon: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: false,
|
|
101
70
|
},
|
|
102
71
|
});
|
|
72
|
+
|
|
73
|
+
// Data
|
|
74
|
+
const searchIconClasses = {
|
|
75
|
+
sm: 'text-xs top-2.5 left-2',
|
|
76
|
+
md: 'text-base top-3 left-3',
|
|
77
|
+
lg: 'text-lg top-4 left-5',
|
|
78
|
+
} as const;
|
|
79
|
+
const clearIconClasses = {
|
|
80
|
+
sm: 'text-base top-1.5 right-2',
|
|
81
|
+
md: 'text-xl top-2 right-2.5',
|
|
82
|
+
lg: 'text-3xl top-[5px] right-2.5',
|
|
83
|
+
} as const;
|
|
84
|
+
const enterIconClasses = {
|
|
85
|
+
sm: 'bg-[length:1rem_1rem] w-[1rem] h-[1rem] right-7 top-2',
|
|
86
|
+
md: 'bg-[length:1.5rem_1.5rem] w-[1.5rem] h-[1.5rem] right-9 top-2',
|
|
87
|
+
lg: 'bg-[length:2rem_2rem] w-[2rem] h-[2rem] right-[46px] top-2',
|
|
88
|
+
} as const;
|
|
89
|
+
const showEnterIconOnFocus = ref(false);
|
|
90
|
+
const searchInput = useTemplateRef<PInputInstance>('searchInput');
|
|
91
|
+
const query = ref(props.modelValue);
|
|
92
|
+
|
|
93
|
+
// Watchers
|
|
94
|
+
watch(
|
|
95
|
+
() => props.modelValue,
|
|
96
|
+
(nV) => {
|
|
97
|
+
query.value = nV;
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
watch(query, (nV) => {
|
|
102
|
+
emit('update:modelValue', nV);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// Methods
|
|
106
|
+
const clearSearch = () => {
|
|
107
|
+
query.value = '';
|
|
108
|
+
|
|
109
|
+
requestAnimationFrame(() => {
|
|
110
|
+
searchInput.value?.$el.querySelector('input').focus();
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const keydownEnter = () => {
|
|
115
|
+
emit('enter', query.value);
|
|
116
|
+
};
|
|
103
117
|
</script>
|
|
104
118
|
|
|
105
119
|
<style scoped lang="scss">
|
|
106
|
-
.
|
|
107
|
-
background-image: url('@squirrel/assets/clear-input-faded.svg');
|
|
108
|
-
background-position: center center;
|
|
109
|
-
transition: background-image 0.4s;
|
|
110
|
-
}
|
|
111
|
-
.icon.clear-sm {
|
|
112
|
-
background-size: 0.875rem 0.875rem;
|
|
113
|
-
width: 0.875rem;
|
|
114
|
-
height: 0.875rem;
|
|
115
|
-
bottom: 0.5rem;
|
|
116
|
-
right: 0.375rem;
|
|
117
|
-
}
|
|
118
|
-
.icon.clear-md {
|
|
119
|
-
background-size: 1rem 1rem;
|
|
120
|
-
height: 1rem;
|
|
121
|
-
width: 1rem;
|
|
122
|
-
bottom: 0.75rem;
|
|
123
|
-
right: 0.5rem;
|
|
124
|
-
}
|
|
125
|
-
.icon.clear-lg {
|
|
126
|
-
background-size: 1rem 1rem;
|
|
127
|
-
height: 1rem;
|
|
128
|
-
width: 1rem;
|
|
129
|
-
bottom: 1rem;
|
|
130
|
-
right: 0.5rem;
|
|
131
|
-
}
|
|
132
|
-
.icon.clear:hover {
|
|
133
|
-
background-image: url('@squirrel/assets/clear-input-hovered.svg');
|
|
134
|
-
}
|
|
135
|
-
.icon.search {
|
|
136
|
-
background-image: url('@squirrel/assets/magnifying-glass.svg');
|
|
137
|
-
}
|
|
138
|
-
.icon.search-sm {
|
|
139
|
-
background-size: 0.75rem 0.75rem;
|
|
140
|
-
left: 0.5rem;
|
|
141
|
-
bottom: 0.625rem;
|
|
142
|
-
width: 0.75rem;
|
|
143
|
-
height: 0.75rem;
|
|
144
|
-
}
|
|
145
|
-
.icon.search-md {
|
|
146
|
-
background-size: 1rem 1rem;
|
|
147
|
-
width: 1rem;
|
|
148
|
-
height: 1rem;
|
|
149
|
-
left: 0.75rem;
|
|
150
|
-
bottom: 0.75rem;
|
|
151
|
-
}
|
|
152
|
-
.icon.search-lg {
|
|
153
|
-
background-size: 1rem 1rem;
|
|
154
|
-
width: 1rem;
|
|
155
|
-
height: 1rem;
|
|
156
|
-
left: 1.125rem;
|
|
157
|
-
bottom: 1rem;
|
|
158
|
-
}
|
|
159
|
-
.icon.enter {
|
|
120
|
+
.enter {
|
|
160
121
|
background-image: url('@squirrel/assets/keyboard-press-enter.svg');
|
|
161
122
|
}
|
|
162
|
-
.icon.enter-sm {
|
|
163
|
-
background-size: 1rem 1rem;
|
|
164
|
-
width: 1rem;
|
|
165
|
-
height: 1rem;
|
|
166
|
-
right: 1.5rem;
|
|
167
|
-
bottom: 0.5rem;
|
|
168
|
-
}
|
|
169
|
-
.icon.enter-md {
|
|
170
|
-
background-size: 1.5rem 1.5rem;
|
|
171
|
-
width: 1.5rem;
|
|
172
|
-
height: 1.5rem;
|
|
173
|
-
right: 2.0625rem;
|
|
174
|
-
bottom: 0.5rem;
|
|
175
|
-
}
|
|
176
|
-
.icon.enter-lg {
|
|
177
|
-
background-size: 1.5rem 1.5rem;
|
|
178
|
-
width: 1.5rem;
|
|
179
|
-
height: 1.5rem;
|
|
180
|
-
right: 2.5rem;
|
|
181
|
-
bottom: 0.75rem;
|
|
182
|
-
}
|
|
183
123
|
</style>
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
:size="size"
|
|
11
11
|
type="secondary-outline-blue"
|
|
12
12
|
:disabled="item.disabled"
|
|
13
|
-
:icon="String(item.icon)"
|
|
13
|
+
:icon="item.icon ? String(item.icon) : ''"
|
|
14
14
|
:class="{
|
|
15
15
|
'rounded-none': index !== 0 && index !== items.length - 1 && items.length > 1,
|
|
16
16
|
'rounded-br-none rounded-tr-none': index === 0 && items.length > 1,
|
|
@@ -471,7 +471,7 @@ describe('PSelectList.vue', () => {
|
|
|
471
471
|
|
|
472
472
|
await wrapper.findByText('ff-a57d-beba44884da2').trigger('click');
|
|
473
473
|
|
|
474
|
-
await wrapper.find('button
|
|
474
|
+
await wrapper.find('button[aria-label="Clear search input"]').trigger('click');
|
|
475
475
|
|
|
476
476
|
const newItems = wrapper.findAll('[p-select-list-option-item]');
|
|
477
477
|
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<g clip-path="url(#clip0_1634_880)">
|
|
3
|
-
<path d="M16 8C16 6.41775 15.5308 4.87104 14.6518 3.55544C13.7727 2.23985 12.5233 1.21447 11.0615 0.608967C9.59966 0.00346629 7.99113 -0.15496 6.43928 0.153721C4.88743 0.462403 3.46197 1.22433 2.34315 2.34315C1.22433 3.46197 0.462403 4.88743 0.153721 6.43928C-0.15496 7.99113 0.00346629 9.59966 0.608967 11.0615C1.21447 12.5233 2.23985 13.7727 3.55544 14.6518C4.87104 15.5308 6.41775 16 8 16C10.1217 16 12.1566 15.1571 13.6569 13.6569C15.1571 12.1566 16 10.1217 16 8ZM11.14 10.1867C11.2642 10.3116 11.3339 10.4805 11.3339 10.6567C11.3339 10.8328 11.2642 11.0018 11.14 11.1267C11.078 11.1892 11.0043 11.2388 10.9231 11.2726C10.8418 11.3064 10.7547 11.3239 10.6667 11.3239C10.5787 11.3239 10.4915 11.3064 10.4103 11.2726C10.329 11.2388 10.2553 11.1892 10.1933 11.1267L8.12 9.05334C8.08809 9.02429 8.04649 9.0082 8.00334 9.0082C7.96019 9.0082 7.91858 9.02429 7.88667 9.05334L5.81334 11.1267C5.6858 11.2359 5.52175 11.293 5.35397 11.2865C5.18618 11.28 5.02702 11.2104 4.90829 11.0917C4.78957 10.973 4.72001 10.8138 4.71353 10.646C4.70705 10.4783 4.76412 10.3142 4.87334 10.1867L6.94667 8.11334C6.97572 8.08142 6.99181 8.03982 6.99181 7.99667C6.99181 7.95352 6.97572 7.91192 6.94667 7.88L4.87334 5.80667C4.81085 5.7447 4.76126 5.67096 4.72741 5.58972C4.69356 5.50848 4.67614 5.42135 4.67614 5.33334C4.67614 5.24533 4.69356 5.15819 4.72741 5.07695C4.76126 4.99571 4.81085 4.92198 4.87334 4.86C4.99825 4.73584 5.16721 4.66614 5.34334 4.66614C5.51946 4.66614 5.68843 4.73584 5.81334 4.86L7.88667 6.93334C7.90163 6.94928 7.91971 6.96199 7.93977 6.97068C7.95984 6.97936 7.98147 6.98384 8.00334 6.98384C8.0252 6.98384 8.04684 6.97936 8.0669 6.97068C8.08697 6.96199 8.10504 6.94928 8.12 6.93334L10.1933 4.86C10.2555 4.79784 10.3293 4.74854 10.4105 4.7149C10.4917 4.68126 10.5788 4.66394 10.6667 4.66394C10.7546 4.66394 10.8416 4.68126 10.9228 4.7149C11.0041 4.74854 11.0778 4.79784 11.14 4.86C11.2022 4.92216 11.2515 4.99596 11.2851 5.07717C11.3188 5.15839 11.3361 5.24543 11.3361 5.33334C11.3361 5.42124 11.3188 5.50829 11.2851 5.5895C11.2515 5.67072 11.2022 5.74451 11.14 5.80667L9.06667 7.88C9.05073 7.89497 9.03802 7.91304 9.02933 7.93311C9.02065 7.95317 9.01616 7.97481 9.01616 7.99667C9.01616 8.01854 9.02065 8.04017 9.02933 8.06024C9.03802 8.0803 9.05073 8.09837 9.06667 8.11334L11.14 10.1867Z" fill="#A0AEC0"/>
|
|
4
|
-
</g>
|
|
5
|
-
<defs>
|
|
6
|
-
<clipPath id="clip0_1634_880">
|
|
7
|
-
<rect width="16" height="16" fill="white"/>
|
|
8
|
-
</clipPath>
|
|
9
|
-
</defs>
|
|
10
|
-
</svg>
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<g clip-path="url(#clip0_1634_896)">
|
|
3
|
-
<path d="M16 8C16 6.41775 15.5308 4.87104 14.6518 3.55544C13.7727 2.23985 12.5233 1.21447 11.0615 0.608967C9.59966 0.00346629 7.99113 -0.15496 6.43928 0.153721C4.88743 0.462403 3.46197 1.22433 2.34315 2.34315C1.22433 3.46197 0.462403 4.88743 0.153721 6.43928C-0.15496 7.99113 0.00346629 9.59966 0.608967 11.0615C1.21447 12.5233 2.23985 13.7727 3.55544 14.6518C4.87104 15.5308 6.41775 16 8 16C10.1217 16 12.1566 15.1571 13.6569 13.6569C15.1571 12.1566 16 10.1217 16 8ZM11.14 10.1867C11.2642 10.3116 11.3339 10.4805 11.3339 10.6567C11.3339 10.8328 11.2642 11.0018 11.14 11.1267C11.078 11.1892 11.0043 11.2388 10.9231 11.2726C10.8418 11.3064 10.7547 11.3239 10.6667 11.3239C10.5787 11.3239 10.4915 11.3064 10.4103 11.2726C10.329 11.2388 10.2553 11.1892 10.1933 11.1267L8.12 9.05334C8.08809 9.02429 8.04649 9.0082 8.00334 9.0082C7.96019 9.0082 7.91858 9.02429 7.88667 9.05334L5.81334 11.1267C5.6858 11.2359 5.52175 11.293 5.35397 11.2865C5.18618 11.28 5.02702 11.2104 4.90829 11.0917C4.78957 10.973 4.72001 10.8138 4.71353 10.646C4.70705 10.4783 4.76412 10.3142 4.87334 10.1867L6.94667 8.11334C6.97572 8.08142 6.99181 8.03982 6.99181 7.99667C6.99181 7.95352 6.97572 7.91192 6.94667 7.88L4.87334 5.80667C4.81085 5.7447 4.76126 5.67096 4.72741 5.58972C4.69356 5.50848 4.67614 5.42135 4.67614 5.33334C4.67614 5.24533 4.69356 5.15819 4.72741 5.07695C4.76126 4.99571 4.81085 4.92198 4.87334 4.86C4.99825 4.73584 5.16721 4.66614 5.34334 4.66614C5.51946 4.66614 5.68843 4.73584 5.81334 4.86L7.88667 6.93334C7.90163 6.94928 7.91971 6.96199 7.93977 6.97068C7.95984 6.97936 7.98147 6.98384 8.00334 6.98384C8.0252 6.98384 8.04684 6.97936 8.0669 6.97068C8.08697 6.96199 8.10504 6.94928 8.12 6.93334L10.1933 4.86C10.2555 4.79784 10.3293 4.74854 10.4105 4.7149C10.4917 4.68126 10.5788 4.66394 10.6667 4.66394C10.7546 4.66394 10.8416 4.68126 10.9228 4.7149C11.0041 4.74854 11.0778 4.79784 11.14 4.86C11.2022 4.92216 11.2515 4.99596 11.2851 5.07717C11.3188 5.15839 11.3361 5.24543 11.3361 5.33334C11.3361 5.42124 11.3188 5.50829 11.2851 5.5895C11.2515 5.67072 11.2022 5.74451 11.14 5.80667L9.06667 7.88C9.05073 7.89497 9.03802 7.91304 9.02933 7.93311C9.02065 7.95317 9.01616 7.97481 9.01616 7.99667C9.01616 8.01854 9.02065 8.04017 9.02933 8.06024C9.03802 8.0803 9.05073 8.09837 9.06667 8.11334L11.14 10.1867Z" fill="#424E6E"/>
|
|
4
|
-
</g>
|
|
5
|
-
<defs>
|
|
6
|
-
<clipPath id="clip0_1634_896">
|
|
7
|
-
<rect width="16" height="16" fill="white"/>
|
|
8
|
-
</clipPath>
|
|
9
|
-
</defs>
|
|
10
|
-
</svg>
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<g clip-path="url(#clip0_9127_330342)">
|
|
3
|
-
<path d="M11.705 10.295L9.38501 8.00004C10.0193 7.0497 10.3178 5.91467 10.2331 4.77526C10.1484 3.63584 9.68546 2.5574 8.91771 1.71124C8.14996 0.86508 7.12147 0.299735 5.99563 0.105014C4.8698 -0.0897079 3.71117 0.0973621 2.70383 0.636506C1.69648 1.17565 0.898177 2.03595 0.435738 3.08073C-0.0267015 4.12552 -0.126757 5.29487 0.151467 6.40303C0.429691 7.51119 1.07024 8.4946 1.97135 9.19704C2.87246 9.89948 3.98246 10.2807 5.12501 10.28C6.13901 10.2811 7.13002 9.97801 7.97001 9.41004L10.295 11.735C10.4824 11.9213 10.7358 12.0258 11 12.0258C11.2642 12.0258 11.5176 11.9213 11.705 11.735C11.8018 11.6418 11.8788 11.5299 11.9314 11.4062C11.9839 11.2825 12.011 11.1495 12.011 11.015C12.011 10.8806 11.9839 10.7476 11.9314 10.6239C11.8788 10.5002 11.8018 10.3883 11.705 10.295ZM5.12501 1.50004C5.84176 1.50004 6.54241 1.71251 7.13843 2.11061C7.73445 2.50871 8.19908 3.07456 8.47359 3.73666C8.74811 4.39875 8.82019 5.12736 8.68072 5.8304C8.54125 6.53345 8.1965 7.17937 7.69004 7.68653C7.18357 8.19369 6.53813 8.53934 5.83527 8.67977C5.13242 8.82021 4.40371 8.74913 3.74125 8.47553C3.07878 8.20193 2.51228 7.73808 2.11336 7.14261C1.71444 6.54714 1.501 5.84678 1.50001 5.13004C1.50001 4.16817 1.88177 3.24562 2.56145 2.565C3.24112 1.88439 4.16314 1.50136 5.12501 1.50004Z" fill="#718096"/>
|
|
4
|
-
</g>
|
|
5
|
-
<defs>
|
|
6
|
-
<clipPath id="clip0_9127_330342">
|
|
7
|
-
<rect width="12" height="12" fill="white"/>
|
|
8
|
-
</clipPath>
|
|
9
|
-
</defs>
|
|
10
|
-
</svg>
|