Skip to content

Commit

Permalink
feat(core/split-button): add close behavior (#1292)
Browse files Browse the repository at this point in the history
  • Loading branch information
nuke-ellington authored May 23, 2024
1 parent fb48f05 commit c1d4f7d
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 3 deletions.
8 changes: 8 additions & 0 deletions .changeset/thin-spiders-press.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@siemens/ix": patch
"@siemens/ix-angular": patch
"@siemens/ix-vue": patch

---

feat(core/split-button): add close behavior
4 changes: 2 additions & 2 deletions packages/angular/src/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2016,14 +2016,14 @@ export declare interface IxSpinner extends Components.IxSpinner {}


@ProxyCmp({
inputs: ['disabled', 'ghost', 'icon', 'label', 'outline', 'placement', 'splitIcon', 'variant']
inputs: ['closeBehavior', 'disabled', 'ghost', 'icon', 'label', 'outline', 'placement', 'splitIcon', 'variant']
})
@Component({
selector: 'ix-split-button',
changeDetection: ChangeDetectionStrategy.OnPush,
template: '<ng-content></ng-content>',
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
inputs: ['disabled', 'ghost', 'icon', 'label', 'outline', 'placement', 'splitIcon', 'variant'],
inputs: ['closeBehavior', 'disabled', 'ghost', 'icon', 'label', 'outline', 'placement', 'splitIcon', 'variant'],
})
export class IxSplitButton {
protected el: HTMLElement;
Expand Down
10 changes: 10 additions & 0 deletions packages/core/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1977,6 +1977,11 @@ export namespace Components {
"variant": 'primary' | 'secondary';
}
interface IxSplitButton {
/**
* Controls if the dropdown will be closed in response to a click event depending on the position of the event relative to the dropdown.
* @since 2.3.0
*/
"closeBehavior": CloseBehavior;
/**
* Disabled
*/
Expand Down Expand Up @@ -6172,6 +6177,11 @@ declare namespace LocalJSX {
"variant"?: 'primary' | 'secondary';
}
interface IxSplitButton {
/**
* Controls if the dropdown will be closed in response to a click event depending on the position of the event relative to the dropdown.
* @since 2.3.0
*/
"closeBehavior"?: CloseBehavior;
/**
* Disabled
*/
Expand Down
12 changes: 11 additions & 1 deletion packages/core/src/components/split-button/split-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
} from '@stencil/core';
import { ButtonVariant } from '../button/button';
import { AlignedPlacement } from '../dropdown/placement';
import { CloseBehavior } from '../dropdown/dropdown-controller';

export type SplitButtonVariant = ButtonVariant;

Expand All @@ -35,6 +36,12 @@ export class SplitButton {
*/
@Prop() variant: SplitButtonVariant = 'primary';

/**
* Controls if the dropdown will be closed in response to a click event depending on the position of the event relative to the dropdown.
* @since 2.3.0
*/
@Prop() closeBehavior: CloseBehavior = 'both';

/**
* Button outline variant
*/
Expand Down Expand Up @@ -126,7 +133,10 @@ export class SplitButton {
></ix-icon-button>
</div>

<ix-dropdown ref={(r) => (this.dropdownElement = r)}>
<ix-dropdown
ref={(r) => (this.dropdownElement = r)}
closeBehavior={this.closeBehavior}
>
<slot></slot>
</ix-dropdown>
</Host>
Expand Down
1 change: 1 addition & 0 deletions packages/vue/src/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,7 @@ export const IxSpinner = /*@__PURE__*/ defineContainer<JSX.IxSpinner>('ix-spinne

export const IxSplitButton = /*@__PURE__*/ defineContainer<JSX.IxSplitButton>('ix-split-button', defineIxSplitButton, [
'variant',
'closeBehavior',
'outline',
'ghost',
'label',
Expand Down

0 comments on commit c1d4f7d

Please sign in to comment.