Skip to content

Commit

Permalink
feat(combobox): Add new grouped variant (#3050)
Browse files Browse the repository at this point in the history
* feat(combobox): Add grouped combobox variant

* Feature parity

* Revert changed files that shouldnt have changed

* Fix regressions and cleaned up jsx files

* Add new TOC

* Cleanup, add documentation, update snapshots

* docs(combobox): Base combobox docs first pass

* docs(combobox) autocomplete docs first pass

* Autocomplete and lookup docs and fixes to listbox focused options

* Start Grouped Combobox by adding aria-controls and updateing the entity switcher label

* Wrap docblock examples in <Example />, apply unique IDs to all combobox and listbox

* Add tests for combobox

* Update snapshots

* Update IDs on grouped example

* Update snapshots

* Update snapshots

* Update snapshots

* Fix VNU

* Update snapshots

* Update snapshots and documentation
  • Loading branch information
brandonferrua committed Feb 8, 2018
1 parent 9bc8b0d commit 6c79edd
Show file tree
Hide file tree
Showing 112 changed files with 43,165 additions and 441 deletions.
640 changes: 640 additions & 0 deletions test/__tests__/__snapshots__/Combobox_Autocomplete.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

614 changes: 614 additions & 0 deletions test/__tests__/__snapshots__/Combobox_Autocomplete_Entity.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1,025 changes: 1,025 additions & 0 deletions test/__tests__/__snapshots__/Combobox_Autocomplete_Multiple_selections.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1,255 changes: 1,255 additions & 0 deletions test/__tests__/__snapshots__/Combobox_Base.json

Large diffs are not rendered by default.

1,260 changes: 1,260 additions & 0 deletions test/__tests__/__snapshots__/Combobox_Displaying_Options.json

Large diffs are not rendered by default.

2,197 changes: 2,197 additions & 0 deletions test/__tests__/__snapshots__/Combobox_Grouped.json

Large diffs are not rendered by default.

3,853 changes: 3,853 additions & 0 deletions test/__tests__/__snapshots__/Combobox_Grouped_Collapsed_pills.json

Large diffs are not rendered by default.

3,815 changes: 3,815 additions & 0 deletions test/__tests__/__snapshots__/Combobox_Grouped_Expanded_pills.json

Large diffs are not rendered by default.

912 changes: 912 additions & 0 deletions test/__tests__/__snapshots__/Combobox_Grouped_Options.json

Large diffs are not rendered by default.

1,865 changes: 1,865 additions & 0 deletions test/__tests__/__snapshots__/Combobox_Grouped_Scoping_text_variant.json

Large diffs are not rendered by default.

2,637 changes: 2,637 additions & 0 deletions test/__tests__/__snapshots__/Combobox_Grouped_Selecting_options.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2,247 changes: 2,247 additions & 0 deletions test/__tests__/__snapshots__/Combobox_Grouped_User_input.json

Large diffs are not rendered by default.

1,265 changes: 1,265 additions & 0 deletions test/__tests__/__snapshots__/Combobox_Handling_focus.json

Large diffs are not rendered by default.

1,288 changes: 1,288 additions & 0 deletions test/__tests__/__snapshots__/Combobox_Multiple_Selections.json

Large diffs are not rendered by default.

1,594 changes: 1,594 additions & 0 deletions test/__tests__/__snapshots__/Combobox_Multiple_selection_closed.json

Large diffs are not rendered by default.

78 changes: 78 additions & 0 deletions test/__tests__/__snapshots__/Combobox_Selecting_an_Option.json

Large diffs are not rendered by default.

1,284 changes: 1,284 additions & 0 deletions test/__tests__/__snapshots__/Combobox_Single_Selection.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/__tests__/__snapshots__/base_global_header.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1,275 changes: 910 additions & 365 deletions ui/components/combobox/__tests__/index.spec.js

Large diffs are not rendered by default.

220 changes: 203 additions & 17 deletions ui/components/combobox/base/_index.scss
Expand Up @@ -24,6 +24,14 @@
&.slds-is-open .slds-dropdown {
display: block;
}

&.slds-has-selection {

.slds-combobox__input-value,
.slds-combobox__input-value:focus {
box-shadow: 0 0 0 2px #fff inset, 0 0 0 3px $color-border inset;
}
}
}

/**
Expand Down Expand Up @@ -56,8 +64,10 @@
font-size: inherit;
font-weight: $font-weight-regular;

&:focus {
&:focus,
&.slds-has-focus {
border-color: $color-border-brand-primary;
box-shadow: $shadow-button-focus;
}

&[disabled] {
Expand Down Expand Up @@ -114,6 +124,10 @@
flex-wrap: wrap;
align-items: center;

li {
display: flex;
}

li + li {
padding-left: $spacing-xxx-small;
}
Expand Down Expand Up @@ -169,6 +183,21 @@
cursor: default;
}

/**
* Modifies the listbox option if it contains an entity object
*
* @selector .slds-listbox__option_entity
* @restrict .slds-listbox__option
*/
.slds-listbox__option_entity,
.slds-listbox__option--entity {
padding: $spacing-xx-small $spacing-small;

.slds-media__figure {
margin-right: $spacing-x-small;
}
}

/**
* Modifies the listbox option if it contains an plain object or string
*
Expand All @@ -180,18 +209,12 @@
padding: $spacing-x-small $spacing-small;
}

/**
* Modifies the listbox option if it contains an entity object
*
* @selector .slds-listbox__option_entity
* @restrict .slds-listbox__option
*/
.slds-listbox__option_entity,
.slds-listbox__option--entity {
padding: $spacing-xx-small $spacing-small;
.slds-listbox__option_term {
padding: $spacing-x-small $spacing-small;

.slds-media__figure {
margin-right: $spacing-x-small;
margin-left: $spacing-xx-small;
margin-right: $spacing-small;
}
}

Expand Down Expand Up @@ -308,6 +331,174 @@
padding: $spacing-xxx-small;
}

/**
* @summary Modifier that identifies the combobox as the object switcher, applies specific interactions for its context
* @selector .slds-combobox_object-switcher
* @restrict .slds-combobox-group div
*/
.slds-combobox_object-switcher {
flex-shrink: 0;

.slds-combobox__input {
width: 120px;
transition: width 80ms linear;

&:focus,
&.slds-has-focus {
width: 150px;
}
}
}

/**
* @summary Input field within a combobox
*
* @selector .slds-combobox__input
* @restrict .slds-combobox input
*/
.slds-combobox__input {
/**
* @summary Force focus state of the input
*
* @selector .slds-has-focus
* @restrict .slds-combobox__input
*/
&.slds-has-focus {
border-color: $color-border-input-active;
box-shadow: $shadow-button-focus;
}
}

/**
* @summary Container for a combobox group
*
* @name combobox-group
* @selector .slds-combobox-group
* @restrict div
* @variant
*/
.slds-combobox-group {
display: flex;
flex-direction: row;

.slds-combobox_container {
flex: 1 1 auto;
}

.slds-combobox__input {
border-radius: 0;
margin-left: -1px;
margin-right: -1px;

&:focus,
&.slds-has-focus {
position: relative;
z-index: 1;
}
}

/**
* @summary Modifier that notifies the combobox group that a selection has been made
*
* @selector .slds-has-selection
* @restrict .slds-combobox-group, .slds-combobox_container
*/
&.slds-has-selection {

.slds-combobox-addon_start .slds-combobox__input {
border-bottom-left-radius: 0;
}

.slds-combobox-addon_end .slds-combobox__input {
border-bottom-right-radius: 0;
}

~ .slds-listbox_selection-group {
display: flex;
position: relative;
border: 1px solid $color-border;
border-top: 0;
border-bottom-left-radius: $border-radius-medium;
border-bottom-right-radius: $border-radius-medium;
left: -1px;
}
}

.slds-listbox_horizontal li + li {
padding: $spacing-xxx-small;
}
}

/**
* @summary The container of pill selections found inside of a combobox group
* @selector .slds-listbox_selection-group
* @restrict .slds-listbox
* @modifier
*/
.slds-listbox_selection-group {
padding: 0;
padding-right: 3.75rem;
height: calc(#{$height-input} + #{$border-width-thin});
overflow: hidden;

/**
* @summary Expanded state of a selection group
* @selector .slds-is-expanded
* @restrict .slds-listbox_selection-group
* @modifier
*/
&.slds-is-expanded {
height: auto;
padding: 0;
}

.slds-listbox-item {
padding: $spacing-xxx-small;
line-height: 1;
}

/**
* @summary Toggle button to show all of the pill selections
* @selector .slds-listbox-toggle
* @restrict .slds-listbox_selection-group
*/
.slds-listbox-toggle {
position: absolute;
right: $spacing-x-small;
top: $spacing-x-small;

.slds-button {
line-height: 1;
}
}
}

/**
* @summary The first combobox in the combobox group
* @selector .sldss-combobox-addon_start
* @restrict .slds-combobox-group div
* @modifier
*/
.slds-combobox-addon_start .slds-combobox__input {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}

/**
* @summary The last combobox in the combobox group
* @selector .sldss-combobox-addon_end
* @restrict .slds-combobox-group div
* @modifier
*/
.slds-combobox-addon_end .slds-combobox__input {
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}

/**
* If combo has a selection model that requires a listbox of pills to be displayed
* inside of a combobox
Expand All @@ -322,12 +513,6 @@
border: $border-width-thin solid $color-border;
border-radius: $border-radius-medium;

/**
* Input field within a combobox
*
* @selector .slds-combobox__input
* @restrict .slds-combobox input
*/
.slds-combobox__input {
min-height: $height-pill;
line-height: $height-pill;
Expand Down Expand Up @@ -378,6 +563,7 @@

[role="listbox"] {
display: inline-flex;
padding: 0;
}

.slds-combobox__input[value],
Expand Down

0 comments on commit 6c79edd

Please sign in to comment.