-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dropdown component, list items #68
Merged
MelSumner
merged 72 commits into
melsumner/dropdown-component
from
melsumner/dropdown-items
Mar 29, 2022
Merged
Changes from all commits
Commits
Show all changes
72 commits
Select commit
Hold shift + click to select a range
8cf0850
dropdown toggles, initial commit
MelSumner 00177d8
added a few more notes
MelSumner 6906efc
dropdown list items, initial commit
MelSumner 070e0aa
updated toggle component to pass action as a named arg
MelSumner ab96583
Merge remote-tracking branch 'origin/melsumner/dropdown-toggle' into β¦
MelSumner b8e9151
added separator
MelSumner 7839fe4
updated pseudo styles
MelSumner b762356
refined separator styles
MelSumner 2ca2562
refactored link as grid for icon positioning
MelSumner a918e0f
added colors for critical focus
MelSumner 195ef9c
commented out dropdown nav for now
MelSumner 96c5dcb
streamlined size conditional in template for toggle
MelSumner b9aff42
Merge remote-tracking branch 'origin/melsumner/dropdown-component' inβ¦
MelSumner b103dd0
refactored toggle to be consistent with other button-like components
MelSumner 8c927a8
Merge remote-tracking branch 'origin/melsumner/dropdown-toggle' into β¦
MelSumner 2807de7
linting and formatting doc seem to be conflicting
MelSumner dfd6e20
updates to toggle
MelSumner d2b27db
Merge remote-tracking branch 'origin/melsumner/dropdown-toggle' into β¦
MelSumner 8ca9936
removed comment in βbreadcrumbβ main component
didoo 57dc207
updated βBreadcrumbβ documentation
didoo 4cbad74
Merge pull request #111 from hashicorp/breadcrumb-remove-commment-andβ¦
didoo f7fb86a
added missing helpers for βcolorβ and βtypographyβ in βcomponentsβ paβ¦
didoo 2be0808
changeset
didoo 8148213
adds accessibility statement to app footer (#109)
MelSumner c46dab8
Merge pull request #112 from hashicorp/add-missing-css-helpers
didoo b516e9c
Version Packages
github-actions[bot] 178a313
Merge pull request #113 from hashicorp/changeset-release/main
didoo 0986f60
updated the showcase for the βDropdown/Toggleβ to show all the possibβ¦
didoo 2f4d71b
updated the βDropdown/Toggleβ to use the βHds::Buttonβ component
didoo 5f3af41
updated classname
didoo 4d78e13
started refactoring JS and HBS of the βDropdown/Toggleβ
didoo bd86493
finalized styling for the βDropdown/Toggleβ
didoo 5d7c724
added z-index isolation to the βButtonβ component
didoo e78f6df
changeset
didoo f9e7041
updated comment in CSS for βDropdownβ
didoo 1888c01
fixed index page
didoo 446cf73
commented import to avoid linting error
didoo f4f86de
Merge branch 'melsumner/dropdown-toggle' into melsumner/dropdown-items
didoo 4df5cde
added showcase for βDropdown/Listβ to show all the possible variants β¦
didoo dc1b57e
started refactoring JS and HBS of the βDropdown/ListItemβ
didoo 0982e19
used βrepeatβ in all the βgrid-template-columsβ declarations
didoo 0c90605
Merge branch 'melsumner/dropdown-toggle' into melsumner/dropdown-items
didoo 30cfee4
refactored styling for links
didoo 3b6193e
split the βDropdown::Toggleβ in specialized sub-components
didoo 8416756
Merge pull request #117 from hashicorp/fix-focus-visibility-in-dummy-β¦
didoo f6b5272
small fixes
didoo 6054e2d
Merge remote-tracking branch 'origin/melsumner/dropdown-toggle' into β¦
didoo 17f5ac2
Merge branch 'main' into melsumner/dropdown-toggle
didoo 397d25d
Merge branch 'main' into melsumner/dropdown-items
didoo 53f1b59
applied filter to avatar image when user toggle is disabled
didoo 5f85126
added missing handling of @isDisabled param for toggle
didoo 7f2c6d9
added handling of βisOpenβ in toggle
didoo 3e13dd6
Merge remote-tracking branch 'origin/melsumner/dropdown-toggle' into β¦
didoo 53f30ea
added missing z-index to the dropdown menu
didoo 105a62d
handling of states for showcase
didoo f6a4754
removed disabled state from βitem/linkβ
didoo c431818
finalized focus state
didoo fa2d67d
fine tuned list items according to latest design specs
didoo cf72582
cleanup
didoo 079f12e
Merge remote-tracking branch 'origin/melsumner/dropdown-component' inβ¦
MelSumner 945a23c
resolved leftovers from merge conflict
MelSumner 6596c73
Merge branch 'melsumner/dropdown-items' of https://github.com/hashicoβ¦
MelSumner f447309
Removed unused files, re-named items per design
MelSumner c0850ca
where did our auto-linter fixer go?
MelSumner 5bedfe1
resolved issue where correct class wasn't being applied
MelSumner 809ecd1
refactored "is-state" for dummy app
MelSumner f746174
yet another linter fix
MelSumner f2c2c3c
added comments for myself, will remove b4 ship
MelSumner eaf8d43
fixed βDropdownβ list items
didoo 9d0266b
linting
didoo 59ed231
fixed βDropdownβ toggles
didoo 9ccc571
small cleanup
didoo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
packages/components/addon/components/hds/dropdown/list-item.hbs
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,48 @@ | ||
{{#if (eq this.item "heading")}} | ||
<li class={{this.classNames}}> | ||
{{@text}} | ||
</li> | ||
|
||
{{else if (eq this.item "help-text")}} | ||
<li class={{this.classNames}}> | ||
{{@text}} | ||
</li> | ||
|
||
{{else if (eq this.item "separator")}} | ||
<li class={{this.classNames}} role="separator"></li> | ||
|
||
{{else if (eq this.item "copy-item")}} | ||
{{! TODO!! add the copy-item element here }} | ||
<li class={{this.classNames}}> | ||
copy item will go here | ||
</li> | ||
|
||
{{else if (eq this.item "link")}} | ||
<li class={{this.classNames}}> | ||
{{#if @route}} | ||
{{! // TODO consider approach }} | ||
<LinkTo @route={{@route}} class="is-{{@state}}"> | ||
{{#if @icon}} | ||
<div class="hds-dropdown-list-item__link-icon"> | ||
<FlightIcon @name={{@icon}} /> | ||
</div> | ||
{{/if}} | ||
<div class="hds-dropdown-list-item__link-text"> | ||
{{@text}} | ||
</div> | ||
</LinkTo> | ||
{{else}} | ||
<a target="_blank" rel="noopener noreferrer" href={{@href}} class="is-{{@state}}"> | ||
{{#if @icon}} | ||
<div class="hds-dropdown-list-item__link-icon"> | ||
<FlightIcon @name={{@icon}} /> | ||
</div> | ||
{{/if}} | ||
<div class="hds-dropdown-list-item__link_text"> | ||
{{@text}} | ||
</div> | ||
</a> | ||
{{/if}} | ||
</li> | ||
|
||
{{/if}} |
88 changes: 88 additions & 0 deletions
88
packages/components/addon/components/hds/dropdown/list-item.js
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,88 @@ | ||
import Component from '@glimmer/component'; | ||
import { assert } from '@ember/debug'; | ||
|
||
export const DEFAULT_COLOR = 'action'; | ||
export const DEFAULT_ITEM = 'link'; | ||
export const COLORS = ['action', 'critical']; | ||
export const ITEMS = ['heading', 'help-text', 'separator', 'copy-item', 'link']; | ||
|
||
export default class HdsDropdownListItemComponent extends Component { | ||
/** | ||
* @param text | ||
* @type {string} | ||
* @description The text of the item. If no text value is defined an error will be thrown. | ||
*/ | ||
get text() { | ||
let { text } = this.args; | ||
|
||
assert( | ||
'@text for "Hds::Dropdown::ListItem" must have a valid value', | ||
text !== undefined | ||
); | ||
|
||
return text; | ||
} | ||
|
||
/** | ||
* @param color | ||
* @type {string} | ||
* @default primary | ||
* @description Determines the color of the item | ||
*/ | ||
get color() { | ||
let { color = DEFAULT_COLOR } = this.args; | ||
|
||
assert( | ||
`@color for "Hds::Dropdown::ListItem" must be one of the following: ${COLORS.join( | ||
', ' | ||
)}; received: ${color}`, | ||
COLORS.includes(color) | ||
); | ||
|
||
return color; | ||
} | ||
|
||
/** | ||
* TODO if color is critical, it MUST have an icon | ||
*/ | ||
|
||
/** | ||
* @param item | ||
* @type {string} | ||
* @default link | ||
* @description Determines the type of item to show | ||
*/ | ||
get item() { | ||
let { item = DEFAULT_ITEM } = this.args; | ||
|
||
assert( | ||
`@item for "Hds::Dropdown::ListItem" must be one of the following: ${ITEMS.join( | ||
', ' | ||
)}; received: ${item}`, | ||
ITEMS.includes(item) | ||
); | ||
|
||
return item; | ||
} | ||
|
||
/** | ||
* Get the class names to apply to the component. | ||
* @method classNames | ||
* @return {string} The "class" attribute to apply to the component. | ||
*/ | ||
get classNames() { | ||
let classes = ['hds-dropdown-list-item']; | ||
|
||
// add a class based on the @item argument | ||
if (this.item) { | ||
classes.push(`hds-dropdown-list-item--${this.item}`); | ||
} | ||
|
||
// add a class based on the @color argument | ||
if (this.item === 'link' && this.color) { | ||
classes.push(`hds-dropdown-list-item--color-${this.color}`); | ||
} | ||
|
||
return classes.join(' '); | ||
} | ||
} |
8 changes: 2 additions & 6 deletions
8
packages/components/addon/components/hds/dropdown/toggle-button.hbs
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
File renamed without changes.
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
4 changes: 2 additions & 2 deletions
4
packages/components/addon/components/hds/dropdown/toggle-user.hbs
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
2 changes: 1 addition & 1 deletion
2
...s/app/components/hds/disclosure/toggle.js β .../app/components/hds/dropdown/list-item.js
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 +1 @@ | ||
export { default } from '@hashicorp/design-system-components/components/hds/disclosure/toggle'; | ||
export { default } from '@hashicorp/design-system-components/components/hds/dropdown/list-item'; |
2 changes: 1 addition & 1 deletion
2
...pp/components/hds/dropdown/toggle-more.js β ...omponents/hds/dropdown/toggle-overflow.js
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 +1 @@ | ||
export { default } from '@hashicorp/design-system-components/components/hds/dropdown/toggle-more'; | ||
export { default } from '@hashicorp/design-system-components/components/hds/dropdown/toggle-overflow'; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[non-blocker] I am not sure we're going to implement the
copy-item
in the first release (see comments in #84) so if you want to remove any reference to it in this PR or in the feature branch, is totally OK for me