forked from microsoft/fluentui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[web-components] add combobox as a new component, add filled style fo…
…r select (microsoft#17307) * add combobox as a new web component * Change files * add filled apeparance * update api report and export combobox from root
- Loading branch information
1 parent
c6aca67
commit ac5b5fe
Showing
10 changed files
with
481 additions
and
2 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@fluentui-web-components-545bf68d-0de1-4229-ae74-8ec9197f53e8.json
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 @@ | ||
{ | ||
"type": "minor", | ||
"comment": "add combobox as a new web component", | ||
"packageName": "@fluentui/web-components", | ||
"email": "chhol@microsoft.com", | ||
"dependentChangeType": "patch" | ||
} |
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,10 @@ | ||
import '../design-system-provider'; | ||
import '../listbox-option'; | ||
import Examples from './fixtures/base.html'; | ||
import './index'; | ||
|
||
export default { | ||
title: 'Combobox', | ||
}; | ||
|
||
export const Combobox = () => Examples; |
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,40 @@ | ||
import { css } from '@microsoft/fast-element'; | ||
import { disabledCursor, focusVisible } from '@microsoft/fast-foundation'; | ||
import { SelectStyles } from '../select/select.styles'; | ||
|
||
export const ComboboxStyles = css` | ||
${SelectStyles} | ||
:host(:empty) .listbox { | ||
display: none; | ||
} | ||
:host([disabled]) *, | ||
:host([disabled]) { | ||
cursor: ${disabledCursor}; | ||
user-select: none; | ||
} | ||
:host(:active) .selected-value { | ||
user-select: none; | ||
} | ||
.selected-value { | ||
-webkit-appearance: none; | ||
background: transparent; | ||
border: none; | ||
color: inherit; | ||
font-size: var(--type-ramp-base-font-size); | ||
line-height: var(--type-ramp-base-line-height); | ||
height: calc(100% - (var(--outline-width) * 1px)); | ||
margin: auto 0; | ||
width: 100%; | ||
} | ||
.selected-value:hover, | ||
.selected-value:${focusVisible}, | ||
.selected-value:disabled, | ||
.selected-value:active { | ||
outline: none; | ||
} | ||
`; |
269 changes: 269 additions & 0 deletions
269
packages/web-components/src/combobox/fixtures/base.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,269 @@ | ||
<fluent-design-system-provider use-defaults> | ||
<h1>Combobox</h1> | ||
|
||
<h2>Default</h2> | ||
<fluent-combobox id="combobox"> | ||
<fluent-option>Please Please Me</fluent-option> | ||
<fluent-option>With The Beatles</fluent-option> | ||
<fluent-option>A Hard Day's Night</fluent-option> | ||
<fluent-option>Beatles for Sale</fluent-option> | ||
<fluent-option>Help!</fluent-option> | ||
<fluent-option>Rubber Soul</fluent-option> | ||
<fluent-option>Revolver</fluent-option> | ||
<fluent-option>Sgt. Pepper's Lonely Hearts Club Band</fluent-option> | ||
<fluent-option>Magical Mystery Tour</fluent-option> | ||
<fluent-option>The Beatles</fluent-option> | ||
<fluent-option>Yellow Submarine</fluent-option> | ||
<fluent-option>Abbey Road</fluent-option> | ||
<fluent-option>Let It Be</fluent-option> | ||
</fluent-combobox> | ||
|
||
<h2>Filled</h2> | ||
<fluent-combobox id="combobox" filled> | ||
<fluent-option>Please Please Me</fluent-option> | ||
<fluent-option>With The Beatles</fluent-option> | ||
<fluent-option>A Hard Day's Night</fluent-option> | ||
<fluent-option>Beatles for Sale</fluent-option> | ||
<fluent-option>Help!</fluent-option> | ||
<fluent-option>Rubber Soul</fluent-option> | ||
<fluent-option>Revolver</fluent-option> | ||
<fluent-option>Sgt. Pepper's Lonely Hearts Club Band</fluent-option> | ||
<fluent-option>Magical Mystery Tour</fluent-option> | ||
<fluent-option>The Beatles</fluent-option> | ||
<fluent-option>Yellow Submarine</fluent-option> | ||
<fluent-option>Abbey Road</fluent-option> | ||
<fluent-option>Let It Be</fluent-option> | ||
</fluent-combobox> | ||
|
||
<h2>Default Selected</h2> | ||
<fluent-combobox id="combobox-with-default"> | ||
<fluent-option>William Hartnell</fluent-option> | ||
<fluent-option>Patrick Troughton</fluent-option> | ||
<fluent-option>Jon Pertwee</fluent-option> | ||
<fluent-option>Tom Baker</fluent-option> | ||
<fluent-option>Peter Davidson</fluent-option> | ||
<fluent-option>Colin Baker</fluent-option> | ||
<fluent-option>Sylvester McCoy</fluent-option> | ||
<fluent-option>Paul McGann</fluent-option> | ||
<fluent-option>Christopher Eccleston</fluent-option> | ||
<fluent-option>David Tenant</fluent-option> | ||
<fluent-option>Matt Smith</fluent-option> | ||
<fluent-option>Peter Capaldi</fluent-option> | ||
<fluent-option selected>Jodie Whittaker</fluent-option> | ||
</fluent-combobox> | ||
|
||
<h2>Initial Value</h2> | ||
<fluent-combobox id="combobox-with-initial-value" value="Christopher Eccleston"> | ||
<fluent-option>William Hartnell</fluent-option> | ||
<fluent-option>Patrick Troughton</fluent-option> | ||
<fluent-option>Jon Pertwee</fluent-option> | ||
<fluent-option>Tom Baker</fluent-option> | ||
<fluent-option>Peter Davidson</fluent-option> | ||
<fluent-option>Colin Baker</fluent-option> | ||
<fluent-option>Sylvester McCoy</fluent-option> | ||
<fluent-option>Paul McGann</fluent-option> | ||
<fluent-option>Christopher Eccleston</fluent-option> | ||
<fluent-option>David Tenant</fluent-option> | ||
<fluent-option>Matt Smith</fluent-option> | ||
<fluent-option>Peter Capaldi</fluent-option> | ||
<fluent-option>Jodie Whittaker</fluent-option> | ||
</fluent-combobox> | ||
|
||
<h2>Combobox with Autocomplete</h2> | ||
|
||
<h3>Inline Autocomplete</h3> | ||
<fluent-combobox id="combobox-with-inline-autocomplete" autocomplete="inline"> | ||
<fluent-option>William Hartnell</fluent-option> | ||
<fluent-option>Patrick Troughton</fluent-option> | ||
<fluent-option>Jon Pertwee</fluent-option> | ||
<fluent-option>Tom Baker</fluent-option> | ||
<fluent-option>Peter Davidson</fluent-option> | ||
<fluent-option>Colin Baker</fluent-option> | ||
<fluent-option>Sylvester McCoy</fluent-option> | ||
<fluent-option>Paul McGann</fluent-option> | ||
<fluent-option>Christopher Eccleston</fluent-option> | ||
<fluent-option>David Tenant</fluent-option> | ||
<fluent-option>Matt Smith</fluent-option> | ||
<fluent-option>Peter Capaldi</fluent-option> | ||
<fluent-option>Jodie Whittaker</fluent-option> | ||
</fluent-combobox> | ||
|
||
<h3>List Autocomplete</h3> | ||
<fluent-combobox id="combobox-with-list-autocomplete" autocomplete="list"> | ||
<fluent-option>William Hartnell</fluent-option> | ||
<fluent-option>Patrick Troughton</fluent-option> | ||
<fluent-option>Jon Pertwee</fluent-option> | ||
<fluent-option>Tom Baker</fluent-option> | ||
<fluent-option>Peter Davidson</fluent-option> | ||
<fluent-option>Colin Baker</fluent-option> | ||
<fluent-option>Sylvester McCoy</fluent-option> | ||
<fluent-option>Paul McGann</fluent-option> | ||
<fluent-option>Christopher Eccleston</fluent-option> | ||
<fluent-option>David Tenant</fluent-option> | ||
<fluent-option>Matt Smith</fluent-option> | ||
<fluent-option>Peter Capaldi</fluent-option> | ||
<fluent-option>Jodie Whittaker</fluent-option> | ||
</fluent-combobox> | ||
|
||
<h3>Both Autocomplete</h3> | ||
<fluent-combobox id="combobox-with-both-autocomplete" autocomplete="both"> | ||
<fluent-option>William Hartnell</fluent-option> | ||
<fluent-option>Patrick Troughton</fluent-option> | ||
<fluent-option>Jon Pertwee</fluent-option> | ||
<fluent-option>Tom Baker</fluent-option> | ||
<fluent-option>Peter Davidson</fluent-option> | ||
<fluent-option>Colin Baker</fluent-option> | ||
<fluent-option>Sylvester McCoy</fluent-option> | ||
<fluent-option>Paul McGann</fluent-option> | ||
<fluent-option>Christopher Eccleston</fluent-option> | ||
<fluent-option>David Tenant</fluent-option> | ||
<fluent-option>Matt Smith</fluent-option> | ||
<fluent-option>Peter Capaldi</fluent-option> | ||
<fluent-option>Jodie Whittaker</fluent-option> | ||
</fluent-combobox> | ||
|
||
<h2>Disabled Combobox</h2> | ||
<fluent-combobox disabled> | ||
<fluent-option>Extra Small</fluent-option> | ||
<fluent-option>Small</fluent-option> | ||
<fluent-option>Medium</fluent-option> | ||
<fluent-option>Large</fluent-option> | ||
<fluent-option>Extra Large</fluent-option> | ||
</fluent-combobox> | ||
|
||
<h2>Combobox with disabled items</h2> | ||
|
||
<h3>Combobox with alternating disabled items</h3> | ||
<fluent-combobox id="combobox-with-every-other-disabled"> | ||
<fluent-option>Extra Small</fluent-option> | ||
<fluent-option disabled>Small</fluent-option> | ||
<fluent-option>Medium</fluent-option> | ||
<fluent-option disabled>Large</fluent-option> | ||
<fluent-option>Extra Large</fluent-option> | ||
</fluent-combobox> | ||
|
||
<h3>Combobox with adjacent disabled items at start of list</h3> | ||
<fluent-combobox id="combobox-with-adjacent-disabled-start"> | ||
<fluent-option disabled>Extra Small</fluent-option> | ||
<fluent-option disabled>Small</fluent-option> | ||
<fluent-option>Medium</fluent-option> | ||
<fluent-option>Large</fluent-option> | ||
<fluent-option>Extra Large</fluent-option> | ||
</fluent-combobox> | ||
|
||
<h3>Combobox with adjacent disabled items in middle of list</h3> | ||
<fluent-combobox id="combobox-with-adjacent-disabled-middle"> | ||
<fluent-option>Extra Small</fluent-option> | ||
<fluent-option disabled>Small</fluent-option> | ||
<fluent-option disabled>Medium</fluent-option> | ||
<fluent-option>Large</fluent-option> | ||
<fluent-option>Extra Large</fluent-option> | ||
</fluent-combobox> | ||
|
||
<h3>Combobox with adjacent disabled items at end of list</h3> | ||
<fluent-combobox id="combobox-with-adjacent-disabled-end"> | ||
<fluent-option>Extra Small</fluent-option> | ||
<fluent-option>Small</fluent-option> | ||
<fluent-option>Medium</fluent-option> | ||
<fluent-option disabled>Large</fluent-option> | ||
<fluent-option disabled>Extra Large</fluent-option> | ||
</fluent-combobox> | ||
|
||
<h3>Combobox with all but one item disabled</h3> | ||
<fluent-combobox id="combobox-with-all-but-one-disabled"> | ||
<fluent-option disabled>Extra Small</fluent-option> | ||
<fluent-option disabled>Small</fluent-option> | ||
<fluent-option disabled>Medium</fluent-option> | ||
<fluent-option disabled>Large</fluent-option> | ||
<fluent-option>Extra Large</fluent-option> | ||
</fluent-combobox> | ||
|
||
<h3>Combobox with all items disabled</h3> | ||
<fluent-combobox id="combobox-with-all-disabled"> | ||
<fluent-option disabled>Extra Small</fluent-option> | ||
<fluent-option disabled>Small</fluent-option> | ||
<fluent-option disabled>Medium</fluent-option> | ||
<fluent-option disabled>Large</fluent-option> | ||
<fluent-option disabled>Extra Large</fluent-option> | ||
</fluent-combobox> | ||
|
||
<h2>Combobox with placeholder</h2> | ||
<fluent-combobox placeholder="Please select a size" id="combobox-with-placeholder"> | ||
<fluent-option>Extra Small</fluent-option> | ||
<fluent-option>Small</fluent-option> | ||
<fluent-option>Medium</fluent-option> | ||
<fluent-option>Large</fluent-option> | ||
<fluent-option>Extra Large</fluent-option> | ||
</fluent-combobox> | ||
|
||
<h2>Combobox with no items</h2> | ||
<fluent-combobox id="combobox-with-no-items"></fluent-combobox> | ||
|
||
<h2>Combobox with long list</h2> | ||
<fluent-combobox id="combobox-with-long-list" autocomplete="both"> | ||
<fluent-option>Alabama</fluent-option> | ||
<fluent-option>Alaska</fluent-option> | ||
<fluent-option>Arizona</fluent-option> | ||
<fluent-option>Arkansas</fluent-option> | ||
<fluent-option>California</fluent-option> | ||
<fluent-option>Colorado</fluent-option> | ||
<fluent-option>Connecticut</fluent-option> | ||
<fluent-option>Delaware</fluent-option> | ||
<fluent-option>Florida</fluent-option> | ||
<fluent-option>Georgia</fluent-option> | ||
<fluent-option>Hawaii</fluent-option> | ||
<fluent-option>Idaho</fluent-option> | ||
<fluent-option>Illinois</fluent-option> | ||
<fluent-option>Indiana</fluent-option> | ||
<fluent-option>Iowa</fluent-option> | ||
<fluent-option>Kansas</fluent-option> | ||
<fluent-option>Kentucky</fluent-option> | ||
<fluent-option>Louisiana</fluent-option> | ||
<fluent-option>Maine</fluent-option> | ||
<fluent-option>Maryland</fluent-option> | ||
<fluent-option>Massachussets</fluent-option> | ||
<fluent-option>Michigain</fluent-option> | ||
<fluent-option>Minnesota</fluent-option> | ||
<fluent-option>Mississippi</fluent-option> | ||
<fluent-option>Missouri</fluent-option> | ||
<fluent-option>Montana</fluent-option> | ||
<fluent-option>Nebraska</fluent-option> | ||
<fluent-option>Nevada</fluent-option> | ||
<fluent-option>New Hampshire</fluent-option> | ||
<fluent-option>New Jersey</fluent-option> | ||
<fluent-option>New Mexico</fluent-option> | ||
<fluent-option>New York</fluent-option> | ||
<fluent-option>North Carolina</fluent-option> | ||
<fluent-option>North Dakota</fluent-option> | ||
<fluent-option>Ohio</fluent-option> | ||
<fluent-option>Oklahoma</fluent-option> | ||
<fluent-option>Oregon</fluent-option> | ||
<fluent-option>Pennsylvania</fluent-option> | ||
<fluent-option>Rhode Island</fluent-option> | ||
<fluent-option>South Carolina</fluent-option> | ||
<fluent-option>South Dakota</fluent-option> | ||
<fluent-option>Texas</fluent-option> | ||
<fluent-option>Tennessee</fluent-option> | ||
<fluent-option>Utah</fluent-option> | ||
<fluent-option>Vermont</fluent-option> | ||
<fluent-option>Virginia</fluent-option> | ||
<fluent-option>Washington</fluent-option> | ||
<fluent-option>Wisconsin</fluent-option> | ||
<fluent-option>West Virginia</fluent-option> | ||
<fluent-option>Wyoming</fluent-option> | ||
</fluent-combobox> | ||
|
||
<h2>Forced positions</h2> | ||
|
||
<h3>Combobox with forced position above</h3> | ||
<fluent-combobox id="combobox-with-forced-position-above" position="above"> | ||
<fluent-option>Position forced above</fluent-option> | ||
<fluent-option>Option Two</fluent-option> | ||
</fluent-combobox> | ||
|
||
<h3>Combobox with forced position below</h3> | ||
<fluent-combobox id="combobox-with-forced-position-below" position="below"> | ||
<fluent-option>Position forced below</fluent-option> | ||
<fluent-option>Option Two</fluent-option> | ||
</fluent-combobox> | ||
</fluent-design-system-provider> |
Oops, something went wrong.