-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui5-color-picker): add simplified display mode (#10153)
Introducing a new property `displayMode` for the `ui5-color-picker` allowing users to select between the `default` (classic) color picker or the new `simplified` color picker. The simplified picker does not include the RGB inputs and alpha slider. You can create a color picker in simplified mode as follows: <ui5-color-picker display-mode="Simplified"></ui5-color-picker> Fixes: #9979
- Loading branch information
Showing
9 changed files
with
160 additions
and
57 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { html } from "lit"; | ||
import "../../src/ColorPicker.js"; | ||
import type ColorPicker from "../../src/ColorPicker.js"; | ||
|
||
describe("Color Picker tests", () => { | ||
it("should not display color channel inputs and alpha slider in simplified mode", () => { | ||
cy.mount(html`<ui5-color-picker display-mode="Simplified"></ui5-color-picker>`); | ||
|
||
cy.get("ui5-color-picker") | ||
.as("colorPicker"); | ||
|
||
cy.get<ColorPicker>("@colorPicker") | ||
.shadow() | ||
.find(".ui5-color-picker-hex-input") | ||
.should("exist"); | ||
|
||
cy.get<ColorPicker>("@colorPicker") | ||
.shadow() | ||
.find("#red") | ||
.should("not.exist"); | ||
|
||
cy.get<ColorPicker>("@colorPicker") | ||
.shadow() | ||
.find("#alpha") | ||
.should("not.exist"); | ||
}); | ||
}); |
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,19 @@ | ||
/** | ||
* ColorPicker display modes. | ||
* @public | ||
*/ | ||
enum ColorPickerDisplayMode { | ||
/** | ||
* Default display mode. Includes all color picker features. | ||
* @public | ||
*/ | ||
Default = "Default", | ||
|
||
/** | ||
* Simplified display mode. Doesn't include alpha slider and inputs for RGB values. | ||
* @public | ||
*/ | ||
Simplified = "Simplified", | ||
} | ||
|
||
export default ColorPickerDisplayMode; |
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
4 changes: 4 additions & 0 deletions
4
packages/website/docs/_samples/main/ColorPicker/Simplified/Simplified.md
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,4 @@ | ||
import html from '!!raw-loader!./sample.html'; | ||
import js from '!!raw-loader!./main.js'; | ||
|
||
<Editor html={html} js={js} /> |
1 change: 1 addition & 0 deletions
1
packages/website/docs/_samples/main/ColorPicker/Simplified/main.js
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 @@ | ||
import "@ui5/webcomponents/dist/ColorPicker.js"; |
20 changes: 20 additions & 0 deletions
20
packages/website/docs/_samples/main/ColorPicker/Simplified/sample.html
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,20 @@ | ||
<!-- playground-fold --> | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Sample</title> | ||
</head> | ||
|
||
<body style="background-color: var(--sapBackgroundColor)"> | ||
<!-- playground-fold-end --> | ||
|
||
<ui5-color-picker display-mode="Simplified" value="#F6A192">Picker</ui5-color-picker> | ||
<!-- playground-fold --> | ||
<script type="module" src="main.js"></script> | ||
</body> | ||
|
||
</html> | ||
<!-- playground-fold-end --> |