-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ refactor(select): create option component (#1356)
* Create PR for #1354 * add new component option * add new component option * fix a11y issues * add interface of the component * add output for visuals * adjust ci * update gitignore * update base images * adjust colors and sass vars * update base images * merge --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Gery Hirschfeld <[email protected]> Co-authored-by: hirsch88 <[email protected]>
- Loading branch information
1 parent
cf9a796
commit 6fe9018
Showing
20 changed files
with
690 additions
and
2 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,5 @@ | ||
--- | ||
'@baloise/ds-core': minor | ||
--- | ||
|
||
**option**: new child component of option-list. Option list component will be used by drop-down, combobox and autocomplete. |
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,12 @@ | ||
## Testing | ||
|
||
The Baloise Design System provides a collection of custom cypress commands for the components. Moreover, some basic cypress commands like `should` or `click` have been overridden to work with the components. | ||
|
||
<a class="sb-unstyled button is-primary" href="../?path=/docs/development-testing--documentation">Go to testing guide</a> | ||
|
||
<!-- START: human documentation --> | ||
|
||
|
||
|
||
<!-- END: human documentation --> | ||
|
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,32 @@ | ||
## Theming | ||
|
||
The component can be customization by changing the CSS variables. | ||
|
||
<a class="sb-unstyled button is-primary" href="../?path=/docs/development-theming--page">Go to theming guide</a> | ||
|
||
<!-- START: human documentation --> | ||
|
||
|
||
|
||
<!-- END: human documentation --> | ||
|
||
### Variables | ||
|
||
| Variable | | ||
| ------------------------------------------ | | ||
| `--bal-option-padding-x` | | ||
| `--bal-option-min-height` | | ||
| `--bal-option-background` | | ||
| `--bal-option-background-hovered` | | ||
| `--bal-option-background-selected` | | ||
| `--bal-option-background-selected-hovered` | | ||
| `--bal-option-background-invalid` | | ||
| `--bal-option-background-invalid-hovered` | | ||
| `--bal-option-border-width` | | ||
| `--bal-option-border-color` | | ||
| `--bal-option-font-family` | | ||
| `--bal-option-font-weight` | | ||
| `--bal-option-line-height` | | ||
| `--bal-option-text-hovered` | | ||
| `--bal-option-text-pressed` | | ||
| `--bal-option-text-disabled` | |
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,13 @@ | ||
describe('bal-option', () => { | ||
context('a11y', () => { | ||
beforeEach(() => cy.platform('desktop').pageA11y('/components/bal-option/test/bal-option.a11y.html')) | ||
|
||
describe('have the AA standard', () => { | ||
it('basic', () => cy.getByTestId('basic').testA11y()) | ||
it('selected', () => cy.getByTestId('selected').testA11y()) | ||
it('focused', () => cy.getByTestId('focused').testA11y()) | ||
it('invalid', () => cy.getByTestId('invalid').testA11y()) | ||
it('disabled', () => cy.getByTestId('disabled').testA11y()) | ||
}) | ||
}) | ||
}) |
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,17 @@ | ||
describe('bal-option', () => { | ||
describe('basic', () => { | ||
beforeEach(() => cy.visit('/components/bal-option/test/bal-option.visual.html').waitForDesignSystem()) | ||
|
||
it('basic component', () => { | ||
cy.getByTestId('basic').testVisual('option-basic') | ||
}) | ||
|
||
it('listbox', () => { | ||
cy.getByTestId('listbox').testVisual('option-listbox') | ||
}) | ||
|
||
it('listbox-with-checkboxes', () => { | ||
cy.getByTestId('listbox-checkbox').testVisual('option-listbox-checkbox') | ||
}) | ||
}) | ||
}) |
Binary file added
BIN
+50.1 KB
e2e/cypress/snapshots/base/visual/bal-option.visual.cy.ts/option-basic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.77 KB
...press/snapshots/base/visual/bal-option.visual.cy.ts/option-listbox-checkbox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.33 KB
e2e/cypress/snapshots/base/visual/bal-option.visual.cy.ts/option-listbox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
28 changes: 28 additions & 0 deletions
28
packages/core/src/components/bal-option/bal-option.interfaces.ts
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,28 @@ | ||
/* eslint-disable no-unused-vars */ | ||
/* eslint-disable @typescript-eslint/no-unused-vars */ | ||
// eslint-disable-next-line @typescript-eslint/triple-slash-reference | ||
/// <reference path="../../interfaces.d.ts" /> | ||
|
||
namespace BalProps {} | ||
|
||
namespace BalEvents { | ||
export interface BalOptionCustomEvent<T> extends CustomEvent<T> { | ||
detail: T | ||
target: HTMLBalOptionElement | ||
} | ||
|
||
export interface BalOption { | ||
value: string | ||
label: string | ||
selected: boolean | ||
} | ||
|
||
export type BalOptionFocusDetail = BalOption | ||
export type BalOptionFocus = BalOptionCustomEvent<BalOptionFocusDetail> | ||
|
||
export type BalOptionBlurDetail = FocusEvent | ||
export type BalOptionBlur = BalOptionCustomEvent<BalOptionBlurDetail> | ||
|
||
export type BalOptionChangeDetail = BalOption | ||
export type BalOptionChange = BalOptionCustomEvent<BalOptionChangeDetail> | ||
} |
Oops, something went wrong.