Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added borderless attr for power select #479

Merged
merged 6 commits into from
Mar 12, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addon/components/o-s-s/power-select.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div
class="upf-power-select fx-1 fx-col"
class="upf-power-select fx-1 fx-col {{if @borderless 'upf-power-select--borderless'}}"
data-toggle="oss-dropdown"
{{did-insert this.registerContainer}}
{{did-insert (fn this.ensureBlockPresence (has-block "selected-item") (has-block "option-item"))}}
Expand Down
14 changes: 13 additions & 1 deletion addon/components/o-s-s/power-select.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ export default {
},
control: { type: 'boolean' }
},
borderless: {
description: 'Hide the border around the dropdown component',
table: {
type: {
summary: 'boolean'
},
defaultValue: { summary: 'false' }
},
control: { type: 'boolean' }
},
loadingMore: {
description: 'Display loading more state in the list of items',
table: {
Expand Down Expand Up @@ -123,6 +133,7 @@ const defaultArgs = {
selectedItems: FAKE_SELECTED_ITEMS,
loading: false,
loadingMore: false,
borderless: false,
placeholder: 'My placeholder',
searchPlaceholder: 'My search placeholder',
addressableAs: undefined,
Expand All @@ -135,7 +146,8 @@ const Template = (args) => ({
template: hbs`
<div style="display: flex; justify-content: center; background-color: white; border-radius: 4px">
<OSS::PowerSelect class='padding-sm' @selectedItems={{this.selectedItems}} @items={{this.items}}
@onSearch={{this.onSearch}} @onChange={{this.onChange}} @loading={{this.loading}}
@onSearch={{this.onSearch}} @onChange={{this.onChange}} @loading={{this.loading}}
@borderless={{this.borderless}}
@loadingMore={{this.loadingMore}} @placeholder={{this.placeholder}} @searchPlaceholder={{this.searchPlaceholder}}
@onBottomReached={{this.onBottomReached}} @addressableAs={{this.addressableAs}}>
<:selected-item as |selectedItem|>
Expand Down
1 change: 1 addition & 0 deletions addon/components/o-s-s/power-select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ interface OSSPowerSelectArgs extends BaseDropdownArgs {
onChange: (item: any, operation: OperationType) => void;
onSearch?: (keyword: string) => void;
onBottomReached?: () => void;
borderless?: boolean;
}

const DEFAULT_PLACEHOLDER = 'Select an item';
Expand Down
6 changes: 6 additions & 0 deletions app/styles/power-select.less
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
}
}

&--borderless {
.array-input-container {
border: none;
}
}

.upf-power-infinite-select-container {
position: relative;
height: 100%;
Expand Down
16 changes: 16 additions & 0 deletions tests/integration/components/o-s-s/power-select-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ module('Integration | Component | o-s-s/power-select', function (hooks) {
assert.dom('.upf-power-select').hasAttribute('open');
});

test('without a border when @borderless is true', async function (assert) {
await render(hbs`
<OSS::PowerSelect @selectedItems={{this.selectedItems}} @items={{this.items}}
@onSearch={{this.onSearch}} @borderless={{true}}>
<:selected-item as |selectedItem|>
{{selectedItem}}
</:selected-item>
<:option-item as |item|>
{{item}}
</:option-item>
</OSS::PowerSelect>
`);

assert.dom('.upf-power-select').hasClass('upf-power-select--borderless');
});

test('custom empty state is properly rendered', async function (assert) {
await render(hbs`
<OSS::PowerSelect @selectedItems={{this.selectedItems}} @items={{this.items}}
Expand Down
Loading