Skip to content

Commit 8b3b46f

Browse files
authored
Merge pull request #479 from upfluence/oc/DRA-2333
Added borderless attr for power select
2 parents 667a886 + afee941 commit 8b3b46f

File tree

5 files changed

+60
-2
lines changed

5 files changed

+60
-2
lines changed

addon/components/o-s-s/power-select.hbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div
2-
class="upf-power-select fx-1 fx-col"
2+
class="upf-power-select fx-1 fx-col {{if @borderless 'upf-power-select--borderless'}}"
33
data-toggle="oss-dropdown"
44
{{did-insert this.registerContainer}}
55
{{did-insert (fn this.ensureBlockPresence (has-block "selected-item") (has-block "option-item"))}}

addon/components/o-s-s/power-select.stories.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ export default {
4040
},
4141
control: { type: 'boolean' }
4242
},
43+
borderless: {
44+
description: 'Hide the border around the dropdown component',
45+
table: {
46+
type: {
47+
summary: 'boolean'
48+
},
49+
defaultValue: { summary: 'false' }
50+
},
51+
control: { type: 'boolean' }
52+
},
4353
loadingMore: {
4454
description: 'Display loading more state in the list of items',
4555
table: {
@@ -123,6 +133,7 @@ const defaultArgs = {
123133
selectedItems: FAKE_SELECTED_ITEMS,
124134
loading: false,
125135
loadingMore: false,
136+
borderless: false,
126137
placeholder: 'My placeholder',
127138
searchPlaceholder: 'My search placeholder',
128139
addressableAs: undefined,
@@ -135,7 +146,8 @@ const Template = (args) => ({
135146
template: hbs`
136147
<div style="display: flex; justify-content: center; background-color: white; border-radius: 4px">
137148
<OSS::PowerSelect class='padding-sm' @selectedItems={{this.selectedItems}} @items={{this.items}}
138-
@onSearch={{this.onSearch}} @onChange={{this.onChange}} @loading={{this.loading}}
149+
@onSearch={{this.onSearch}} @onChange={{this.onChange}} @loading={{this.loading}}
150+
@borderless={{this.borderless}}
139151
@loadingMore={{this.loadingMore}} @placeholder={{this.placeholder}} @searchPlaceholder={{this.searchPlaceholder}}
140152
@onBottomReached={{this.onBottomReached}} @addressableAs={{this.addressableAs}}>
141153
<:selected-item as |selectedItem|>

addon/components/o-s-s/power-select.ts

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ interface OSSPowerSelectArgs extends BaseDropdownArgs {
1818
onChange: (item: any, operation: OperationType) => void;
1919
onSearch?: (keyword: string) => void;
2020
onBottomReached?: () => void;
21+
borderless?: boolean;
2122
}
2223

2324
const DEFAULT_PLACEHOLDER = 'Select an item';

app/styles/power-select.less

+29
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,35 @@
1616
}
1717
}
1818

19+
&--borderless {
20+
.array-input-container {
21+
border-color: transparent;
22+
background-color: transparent;
23+
&.active {
24+
&:hover {
25+
&:not(.array-input-container--disabled) {
26+
background-color: var(--color-gray-100);
27+
border: 1px solid var(--color-border-default);
28+
}
29+
}
30+
&:not(.array-input-container--disabled) {
31+
box-shadow: none;
32+
background-color: var(--color-gray-100);
33+
border: 1px solid var(--color-border-default);
34+
transition-duration: 0ms;
35+
}
36+
}
37+
&:hover {
38+
&:not(.array-input-container--disabled) {
39+
box-shadow: none;
40+
border-color: transparent;
41+
background-color: transparent;
42+
transition-duration: 0ms;
43+
}
44+
}
45+
}
46+
}
47+
1948
.upf-power-infinite-select-container {
2049
position: relative;
2150
height: 100%;

tests/integration/components/o-s-s/power-select-test.ts

+16
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@ module('Integration | Component | o-s-s/power-select', function (hooks) {
3939
assert.dom('.upf-power-select').hasAttribute('open');
4040
});
4141

42+
test('without a border when @borderless is true', async function (assert) {
43+
await render(hbs`
44+
<OSS::PowerSelect @selectedItems={{this.selectedItems}} @items={{this.items}}
45+
@onSearch={{this.onSearch}} @borderless={{true}}>
46+
<:selected-item as |selectedItem|>
47+
{{selectedItem}}
48+
</:selected-item>
49+
<:option-item as |item|>
50+
{{item}}
51+
</:option-item>
52+
</OSS::PowerSelect>
53+
`);
54+
55+
assert.dom('.upf-power-select').hasClass('upf-power-select--borderless');
56+
});
57+
4258
test('custom empty state is properly rendered', async function (assert) {
4359
await render(hbs`
4460
<OSS::PowerSelect @selectedItems={{this.selectedItems}} @items={{this.items}}

0 commit comments

Comments
 (0)