-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui5-menu-separator): add new component (#8871)
New component that can be slotted with menu items intended to separate the items with a line. BREAKING CHANGE: `startsSection` property removed from MenuItems Before: <ui5-menu> <ui5-menu-item text="Item A"></ui5-menu-item> <ui5-menu-item text="Item B" starts-section></ui5-menu-item> </ui5-menu> Now: <ui5-menu> <ui5-menu-item text="Item A"></ui5-menu-item> <ui5-menu-separator></ui5-menu-separator> <ui5-menu-item text="Item B"></ui5-menu-item> </ui5-menu> Related to: #8461
- Loading branch information
Showing
12 changed files
with
163 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<ui5-li-custom | ||
class="{{classes.main}}" | ||
role="separator" | ||
disabled | ||
> | ||
</ui5-li-custom> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js"; | ||
import property from "@ui5/webcomponents-base/dist/decorators/property.js"; | ||
import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js"; | ||
import type { ClassMap } from "@ui5/webcomponents-base/dist/types.js"; | ||
import menuSeparatorTemplate from "./generated/templates/MenuSeparatorTemplate.lit.js"; | ||
import menuSeparatorCss from "./generated/themes/MenuSeparator.css.js"; | ||
import ListItemBase from "./ListItemBase.js"; | ||
import ListItemCustom from "./ListItemCustom.js"; | ||
import type { IMenuItem } from "./Menu.js"; | ||
/** | ||
* @class | ||
* The `ui5-menu-separator` represents a horizontal line to separate menu items inside a `ui5-menu`. | ||
* @constructor | ||
* @extends ListItemBase | ||
* @implements {IMenuItem} | ||
* @public | ||
* @since 2.0 | ||
*/ | ||
@customElement({ | ||
tag: "ui5-menu-separator", | ||
renderer: litRender, | ||
styles: [menuSeparatorCss], | ||
template: menuSeparatorTemplate, | ||
dependencies: [ | ||
ListItemCustom, | ||
], | ||
}) | ||
|
||
class MenuSeparator extends ListItemBase implements IMenuItem { | ||
/** | ||
* **Note:** This property is inherited and not supported. If set, it won't take any effect. | ||
* @default false | ||
* @public | ||
*/ | ||
@property({ type: Boolean }) | ||
declare selected: boolean; | ||
|
||
get isSeparator() { | ||
return true; | ||
} | ||
|
||
get classes(): ClassMap { | ||
return { | ||
main: { | ||
"ui5-menu-separator": true, | ||
}, | ||
}; | ||
} | ||
|
||
/** | ||
* @override | ||
*/ | ||
get _focusable() { | ||
return false; | ||
} | ||
|
||
/** | ||
* @override | ||
*/ | ||
get _pressable() { | ||
return false; | ||
} | ||
} | ||
MenuSeparator.define(); | ||
|
||
export default MenuSeparator; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
:host { | ||
border-top: 0.0625rem solid var(--sapGroup_ContentBorderColor); | ||
min-height: 0.125rem; | ||
} | ||
|
||
.ui5-menu-separator { | ||
border: inherit; | ||
min-height: inherit; | ||
background: inherit; | ||
opacity: 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
packages/website/docs/_components_pages/main/Menu/MenuSeparator.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
slug: ../../MenuSeparator | ||
--- | ||
|
||
<%COMPONENT_OVERVIEW%> | ||
|
||
<%COMPONENT_METADATA%> |
Oops, something went wrong.