-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(vwc-badge): deprecates slot in favor of props (#986)
* feat(vwc-badge): deprecates slot in favor of props * fixes icon typo * validate icon requirement * icon trailing * icon leading trailing * added icons tests * all tests pass * update badge ui test * added readme * migrate connotation test to UI * update ui tests * reflect trailingicon * Update components/badge/readme.md Co-authored-by: Yonatan Kra <yonatan.kra@vonage.com> * readme format * flaky test fixed * fix flaky test * fix flacky tests Co-authored-by: Yonatan Kra <yonatan.kra@vonage.com>
- Loading branch information
1 parent
45fe21d
commit 3513345
Showing
13 changed files
with
338 additions
and
197 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,100 @@ | ||
# `badge` | ||
|
||
#### `should internal contents` | ||
#### `should match internal contents` | ||
|
||
```html | ||
<slot> | ||
</slot> | ||
|
||
``` | ||
|
||
#### `should match internal contents (legacy)` | ||
|
||
```html | ||
<span class="vwc-badge"> | ||
<slot> | ||
</slot> | ||
</span> | ||
|
||
``` | ||
|
||
## `icons` | ||
|
||
#### `should have icons when icons are set` | ||
|
||
```html | ||
<span class="vwc-badge"> | ||
<vwc-icon | ||
class="icon icon--leading" | ||
type="thumbs-down-line" | ||
> | ||
</vwc-icon> | ||
<slot> | ||
</slot> | ||
<vwc-icon | ||
class="icon icon--trailing" | ||
type="thumbs-up-line" | ||
> | ||
</vwc-icon> | ||
</span> | ||
|
||
``` | ||
|
||
#### `should have icons added when icons are set dynamically (property)` | ||
|
||
```html | ||
<span class="vwc-badge"> | ||
<vwc-icon | ||
class="icon icon--leading" | ||
type="thumbs-down-line" | ||
> | ||
</vwc-icon> | ||
<slot> | ||
</slot> | ||
<vwc-icon | ||
class="icon icon--trailing" | ||
type="thumbs-down-line" | ||
> | ||
</vwc-icon> | ||
</span> | ||
|
||
``` | ||
|
||
#### `should have icons added when icons are set dynamically (attribute)` | ||
|
||
```html | ||
<span class="vwc-badge"> | ||
<vwc-icon | ||
class="icon icon--leading" | ||
type="thumbs-down-line" | ||
> | ||
</vwc-icon> | ||
<slot> | ||
</slot> | ||
<vwc-icon | ||
class="icon icon--trailing" | ||
type="thumbs-up-line" | ||
> | ||
</vwc-icon> | ||
</span> | ||
|
||
``` | ||
|
||
#### `should have icons removed when icons are unset (property)` | ||
|
||
```html | ||
<span class="vwc-badge"> | ||
<slot> | ||
</slot> | ||
</span> | ||
|
||
``` | ||
|
||
#### `should have icon removed when icon is unset (attribute)` | ||
|
||
```html | ||
<span class="vwc-badge"> | ||
<slot> | ||
</slot> | ||
</span> | ||
|
||
``` | ||
|
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 |
---|---|---|
@@ -1,51 +1,23 @@ | ||
# vwc-select | ||
# vwc-badge | ||
|
||
This component is an extension of [<mwc-select>](https://github.com/material-components/material-components-web-components/tree/master/packages/select) | ||
Represents a badge custom element. | ||
badge is a label that holds small amounts of information. A badge can be used to display unread notifications, or to label a block of text. Badges don’t work for navigation because they can't include a hyperlink. | ||
|
||
## Properties | ||
|
||
| Property | Modifiers | Type | Description | | ||
|---------------------------|-----------|--------------------------------------------------|--------------------------------------------------| | ||
| `disabled` | | `boolean` | | | ||
| `floatingLabelFoundation` | | `MDCFloatingLabelFoundation \| undefined` | | | ||
| `helper` | | `string` | | | ||
| `icon` | | `string` | | | ||
| `index` | readonly | `number` | | | ||
| `items` | readonly | `ListItemBase[]` | | | ||
| `label` | | `string` | | | ||
| `lineRippleFoundation` | | `MDCLineRippleFoundation \| undefined` | | | ||
| `naturalMenuWidth` | | `boolean` | | | ||
| `outlined` | | `boolean` | | | ||
| `required` | | `boolean` | | | ||
| `ripple` | readonly | `RippleInterface \| Promise<RippleInterface \| null> \| undefined` | Implement ripple getter for Ripple integration with mwc-formfield | | ||
| `selected` | readonly | `ListItemBase \| null` | | | ||
| `validateOnInitialRender` | | `boolean` | | | ||
| `validationMessage` | | `string` | | | ||
| `validity` | readonly | `ValidityState` | | | ||
| `validityTransform` | | `((value: string, nativeValidity: ValidityState) => Partial<ValidityState>) \| null` | | | ||
| `value` | | `string` | | | ||
| Property | Attribute | Type | Default | | ||
| -------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | -------- | | ||
| `connotation` | `connotation` | `Connotation.Primary \| Connotation.CTA \| Connotation.Success \| Connotation.Alert \| Connotation.Warning \| Connotation.Info \| undefined` | | | ||
| `dense` | `dense` | `boolean` | false | | ||
| `enlarged` | `enlarged` | `boolean` | false | | ||
| `icon` | `icon` | `string \| undefined` | | | ||
| `iconTrailing` | `iconTrailing` | `string \| undefined` | | | ||
| `layout` | `layout` | `Layout.Filled \| Layout.Outlined \| Layout.Soft` | "filled" | | ||
| `shape` | `shape` | `Shape.Rounded \| Shape.Pill \| undefined` | | | ||
| `text` | `text` | `string \| undefined` | | | ||
|
||
## Methods | ||
## Slots | ||
|
||
| Method | Type | | ||
|---------------------|--------------------------------------------------| | ||
| `blur` | `(): void` | | ||
| `checkValidity` | `(): boolean` | | ||
| `click` | `(): void` | | ||
| `focus` | `(): void` | | ||
| `layout` | `(updateItems?: boolean \| undefined): Promise<void>` | | ||
| `reportValidity` | `(): boolean` | | ||
| `select` | `(index: number): void` | | ||
| `setAriaLabel` | `(label: string): void` | | ||
| `setCustomValidity` | `(message: string): void` | | ||
|
||
## Events | ||
|
||
| Event | Description | | ||
|------------|------------------| | ||
| `action` | {ActionDetail} | | ||
| `change` | | | ||
| `closed` | | | ||
| `invalid` | | | ||
| `opened` | | | ||
| `selected` | {SelectedDetail} | | ||
| Name | Description | | ||
| --------- | ------------------------------------------------------------------------------------------------------ | | ||
| _default_ | This is a default/unnamed slot to assign text content. *deprecated* please use _text_ property instead | |
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
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,14 @@ | ||
export default { | ||
sourcePath: '../readme.md', | ||
outputName: 'badge-introduction', | ||
story: { | ||
title: 'Alpha/Components/Badge/Introduction', | ||
name: 'Introduction', | ||
parameters: { | ||
options: { | ||
showPanel: false, | ||
isToolshown: false | ||
} | ||
} | ||
} | ||
}; |
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
Oops, something went wrong.