Skip to content

Commit

Permalink
chore(docs): select page new format (VIV-2124) (#1965)
Browse files Browse the repository at this point in the history
* chore: updates select component docs

* chore: updates button eg

* chore: fixes ui tests

* chore formatting

* chore: removes unused vars

* chore: addresses pr comments

* chore: formatting
  • Loading branch information
TaylorJ76 authored Oct 31, 2024
1 parent ffcab5f commit 2afad86
Show file tree
Hide file tree
Showing 15 changed files with 1,213 additions and 415 deletions.
9 changes: 6 additions & 3 deletions apps/docs/content/_data/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
"description": "Displays icons from the Vivid Icons Library using predefined colors and sizes.",
"variations": "./libs/components/src/lib/icon/VARIATIONS.md",
"guidelines": "./libs/components/src/lib/icon/GUIDELINES.md",
"hideGuidelines": "true",
"code": "./libs/components/src/lib/icon/README.md",
"accessibility": "./libs/components/src/lib/icon/ACCESSIBILITY.md"
},
Expand Down Expand Up @@ -272,8 +271,12 @@
},
{
"title": "Select",
"page": "legacy",
"markdown": "./libs/components/src/lib/select/README.md"
"description": "Select lets users choose one option from an options menu. Consider using select when you have 4 or more options to choose from.",
"variations": "./libs/components/src/lib/select/VARIATIONS.md",
"guidelines": "./libs/components/src/lib/select/GUIDELINES.md",
"code": "./libs/components/src/lib/select/README.md",
"accessibility": "./libs/components/src/lib/select/ACCESSIBILITY.md",
"useCases": "./libs/components/src/lib/select/USE-CASES.md"
},
{
"title": "Data Grid",
Expand Down
16 changes: 8 additions & 8 deletions apps/docs/content/whats-new/monthly-updates/september-2024.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,36 @@ See the [Office Hours minutes](https://docs.google.com/document/d/1E0yvyGUzBoQFH
- An enhancement request was made for the date /range picker to include the option for an integrate time picker. This would bring it inline with a Volta version of this component
- It was agreed that we would add this request to the backlog for Q4

## Searchable Select component released to alpha
## Searchable Select Component Released to Alpha

**Announcing the new [Searchable select](/components/searchable-select) component.**

Searchable Select allows users to select one or multiple items from a list of options. It provides a search input field to filter the options.

## Data-grid: sort icon placement change
## Data-grid: Sort Icon Placement Change

The [sort icon in the header](/components/data-grid/#columndefinitions) of data-grid are now aligned closer to the header text.

## FAB: adds condensed size
## FAB: Adds Condensed Size

We have added a [condensed size](/components/fab/#size) to the FAB component.

## Icon: adds warning connotation
## Icon: Adds Warning Connotation

We have added a [warning connotation](/components/icon/#connotation) to the Icon component.

## Tabs: adds shadow to tabs list when they scroll
## Tabs: Adds Shadow to Tabs List When They Scroll

We have added a shadow to the tab list container when the number/size of tab items creates a scroll. Previously, it could be hard to see that there were more items.

## Tab: adds removable feature
## Tab: Adds Removable Feature

Adds a close button to the [tab component](/components/tab/#removable) to enable removable tabs.

## Form components: adds a condensed variation
## Form Components: Adds a Condensed Variation

Adds condensed size to [Text field](/components/text-field/#scale), [Number field](/components/number-field/#scale) and [Select](/components/select/#scale) components.

## Menu: adds position-strategy
## Menu: Adds Position Strategy

When the menu is within a container that has properties such as `transform`, `perspective`, or `container-type`, which modify its containing block, it messes with the default `fixed` position. This can be remedied by setting the `position-strategy` to `absolute`.
12 changes: 6 additions & 6 deletions libs/components/src/lib/button/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,23 +134,23 @@ If center is needed, set `--button-content-alignment: center;`.

```html preview
<vwc-button
class="vwc-button"
class="button"
dropdown-indicator
appearance="outlined-light"
label="aligned to start content"
label="Aligned to start content"
></vwc-button>
<vwc-button
class="vwc-button vwc-button-center"
class="button button-center"
dropdown-indicator
appearance="outlined-light"
label="centered content"
label="Centered content"
></vwc-button>

<style>
.vwc-button {
.button {
inline-size: 300px;
}
.vwc-button-center {
.button-center {
--button-content-alignment: center;
}
</style>
Expand Down
1 change: 1 addition & 0 deletions libs/components/src/lib/icon/ACCESSIBILITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ You must set the `aria-label` attribute on informative icons to provide an acces
<div class="number">
<vwc-icon name="fax-line" aria-label="Fax:"></vwc-icon> 0123 456 7890
</div>

<style>
.number {
display: flex;
Expand Down
5 changes: 3 additions & 2 deletions libs/components/src/lib/icon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ If the component is used without a `size`, it will use the current `font-size` v
If the component is used without a `connotation`, it will use the current text color.

```html preview
<vwc-icon id="icon" name="heart-solid"></vwc-icon>
<vwc-icon class="icon" name="heart-solid"></vwc-icon>

<style>
#icon {
.icon {
color: var(--vvd-color-announcement-400);
}
</style>
Expand Down
2 changes: 2 additions & 0 deletions libs/components/src/lib/icon/VARIATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ Use the `size` attribute to select the icon's size from a set of predefined valu
</tr>
</tbody>
</table>

<style>
table {
border-collapse: collapse;
Expand Down Expand Up @@ -207,6 +208,7 @@ Use the `connotation` attribute to select the icon's color from a set of predefi
information
</li>
</ul>

<style>
li {
list-style: none;
Expand Down
8 changes: 8 additions & 0 deletions libs/components/src/lib/select/ACCESSIBILITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Implementation

- If a `label` can not be used, always provide an `aria-label` as an alertnative. This will allow screen reader users to know the purpose of the Select.
- Never use `placeholder` text in place of a `label` or `aria-label`.<br />[The problem with placeholders](https://www.deque.com/blog/accessible-forms-the-problem-with-placeholders)

## Resources

[Select: Manual accessibility test](https://docs.google.com/spreadsheets/d/1mhYft3pTVlDMZ9eizyQHnDzlnHlUA7V8gZMp0fOj7wg/edit?gid=1175911860#gid=1175911860)
180 changes: 180 additions & 0 deletions libs/components/src/lib/select/GUIDELINES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
## Labelling

### Label

<docs-do-dont>
<docs-do slot="description" headline="Use the label attribute whenever possible" caption="It provides a description of the purpose of the Text Field to all users and it is accessibly linked to the input element.">

```html preview example
<vwc-select label="Title" placeholder="Select an option">
<vwc-option value="mr" text="Mr"></vwc-option>
<vwc-option value="mrs" text="Mrs"></vwc-option>
<vwc-option value="miss" text="Miss"></vwc-option>
<vwc-option value="ms" text="Ms"></vwc-option>
</vwc-select>
```

</docs-do>
<docs-do dont headline="Don't use the placeholder attribute as a label">

```html preview example
<vwc-select placeholder="Title">
<vwc-option value="mr" text="Mr"></vwc-option>
<vwc-option value="mrs" text="Mrs"></vwc-option>
<vwc-option value="miss" text="Miss"></vwc-option>
<vwc-option value="ms" text="Ms"></vwc-option>
</vwc-select>
```

It's bad for UX and accessibility.<br />[The problem with placeholders](https://www.deque.com/blog/accessible-forms-the-problem-with-placeholders/)

</docs-do>
</docs-do-dont>

### Helper Text

<docs-do-dont>
<docs-do slot="description" headline="Use helper text to provide extra information about the field" caption="It is visible to the user at all times and it is read out by screen readers when the user focuses on the input element.">

```html preview example 320px
<vwc-select
helper-text="We use this information in to help inform our marketing strategy"
label="Where did you hear about us?"
placeholder="Select an option"
class="marketing"
>
<vwc-option value="friend" text="A friend"></vwc-option>
<vwc-option value="net" text="Internet search"></vwc-option>
<vwc-option value="online-ad" text="Online advert"></vwc-option>
<vwc-option value="radio-ad" text="Radio advert"></vwc-option>
<vwc-option value="other" text="Other"></vwc-option>
</vwc-select>

<style>
.marketing {
min-inline-size: 250px;
}
</style>
```

</docs-do>
<docs-do dont headline="Don't use Tooltips or Toggletips for information that is vital to task completion">

```html preview example 320px
<div class="container">
<vwc-select
label="Where did you hear about us?"
placeholder="Select an option"
class="marketing"
>
<vwc-option value="friend" text="A friend"></vwc-option>
<vwc-option value="net" text="Internet search"></vwc-option>
<vwc-option value="online-ad" text="Online advert"></vwc-option>
<vwc-option value="radio-ad" text="Radio advert"></vwc-option>
<vwc-option value="other" text="Other"></vwc-option>
</vwc-select>
<vwc-toggletip placement="bottom">
<vwc-button
icon="info-line"
slot="anchor"
shape="pill"
size="condensed"
class="tooltip-btn"
></vwc-button>
We use this information in to help inform our marketing strategy
</vwc-toggletip>
</div>

<style>
.container {
position: relative;
display: inline-block;
}
.tooltip-btn {
position: absolute;
inset-block-start: -8px;
inset-inline-end: -8px;
}
</style>
```

Tooltips / Toggletips disappear, so instructions or other directly actionable information, like field requirements, shouldn’t be in a them.<br />[Tooltip guidelines](https://www.nngroup.com/articles/tooltip-guidelines/#toc-tooltip-usage-guidelines-3)

</docs-do>
</docs-do-dont>

## Scale

<docs-do-dont headline="Use condensed Selects when space is limited" reverse>

<div slot="description">

The `condensed` Text Field is useful when used inside other components (inside [data-grid-cell](/components/data-grid/#cell) or [action-group](/components/action-group/) for a [toolbar](/components/button/use-cases/#toolbars)) as they take up less space.

</div>
<docs-do>

```html preview example 270px
<div class="container">
<vwc-data-grid>
<vwc-data-grid-row row-type="header">
<vwc-data-grid-cell cell-type="columnheader"
>Marketing</vwc-data-grid-cell
>
<vwc-data-grid-cell
class="controls"
cell-type="columnheader"
></vwc-data-grid-cell>
</vwc-data-grid-row>
<vwc-data-grid-row>
<vwc-data-grid-cell>
<vwc-select
scale="condensed"
fixed-dropdown
aria-label="Where did you hear about us?"
>
<vwc-option value="friend" text="A friend"></vwc-option>
<vwc-option value="net" text="Internet"></vwc-option>
<vwc-option value="online-ad" text="Advert"></vwc-option>
<vwc-option value="other" text="Other"></vwc-option>
</vwc-select>
</vwc-data-grid-cell>
<vwc-data-grid-cell class="controls">
<vwc-button
appearance="outlined"
size="condensed"
icon="edit-line"
aria-label="Edit"
></vwc-button>
<vwc-button
appearance="outlined"
size="condensed"
icon="delete-line"
aria-label="Delete"
connotation="alert"
></vwc-button>
</vwc-data-grid-cell>
</vwc-data-grid-row>
</vwc-data-grid>
</div>

<style>
.conainer {
display: block;
padding: 8px 0;
}
.controls {
width: 92px;
}
</style>
```

</docs-do>
</docs-do-dont>

## Related Components

- [Searchable Select](/components/searchable-select/)
- [Text Field](/components/text-field/)
- [Combobox](/components/combobox/)
Loading

0 comments on commit 2afad86

Please sign in to comment.