-
Notifications
You must be signed in to change notification settings - Fork 50
Button/Link/CTA - Updates for the interactive elements #217
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
Merged
Merged
Changes from 117 commits
Commits
Show all changes
126 commits
Select commit
Hold shift + click to select a range
370777f
added generic βinteractiveβ component
didoo 23d61b0
updated the `dropdown/list-item/interactive` to use the new `interactβ¦
didoo 891adea
added documentation page for `interactive` component
didoo 647008f
small update
didoo f098f5c
small commit to open the main PR
didoo 686f5ce
added integration tests for the βinteractiveβ element
didoo 9c269f4
removed leftover import
didoo fababb7
small updates to the documentation page for βinteractiveβ
didoo 295bfd5
removed empty backing class for βinteractiveβ
didoo 4199bdb
small update to the documentation
didoo 5464c8d
small updates to the integration tests
didoo db12345
added one more integration test to the βinteractiveβ component
didoo e2cbe81
updated the button to use the new interactive generic component
didoo 393f330
fixed underline of text on links
didoo 6b8441a
improved assertion guards in `button` to work differently between butβ¦
didoo 0c87f75
added special visual treatment to alert the developer if a `href` HTMβ¦
didoo 011de8d
updated documentation page for βbuttonβ
didoo abd2aac
updated integration tests for βbuttonβ
didoo 9627d5d
skipped failing test in "ember-lts-3.24"
didoo cf58529
Merge branch 'spike-interactive-generic-component' into spike-button-β¦
didoo 9e68782
skipped failing test in "ember-lts-3.24"
didoo 81d5878
entirely removed `Link/LinkTo::CTA` from the HDS components
didoo 25223ec
skipped another failing test in "ember-lts-3.24"
didoo 821a86b
Merge branch 'spike-button-with-link-support' into spike-remove-link-CTA
didoo 1cdd811
linting
didoo e12dd44
added handling of `@isHrefExternal` to the `Interactive` generic compβ¦
didoo 3544a8d
updated documentation following introduction of `@isHrefExternal`
didoo cf71762
Merge branch 'spike-interactive-generic-component' into spike-button-β¦
didoo b0bc06f
updated documentation following the introduction of the `@isHrefExterβ¦
didoo 934a3d5
forgot default
didoo 4bf4572
small changes
didoo 4446bd9
Merge branch 'main' into spike-interactive-generic-component
didoo fda0103
updated `dropdown/list-item/interactive` after merge of `main` branch
didoo 9fd6809
aligned documentation with most recent format for accessibility
didoo 524dce0
Merge branch 'main' into spike-BUTTON-LINK-CTA-main
didoo d42043b
Merge branch 'spike-BUTTON-LINK-CTA-main' into spike-interactive-geneβ¦
didoo 61f54d9
updated integration tests for `interactive` component
didoo 29f79fe
Merge branch 'spike-interactive-generic-component' into spike-button-β¦
didoo e104fbf
added missing `isHrefExternal` to Button component
didoo c812e39
Merge branch 'spike-button-with-link-support' into spike-remove-link-CTA
didoo 987aee3
removed `LinkTo::Standalone` component
didoo 2062833
updated the `Link:Standalone` to use the new interactive generic compβ¦
didoo b4dac77
unified documentation page for `Link::Standalone`
didoo 8c8e2ce
updated integration tests for `Link:Standalone`
didoo 7926217
Merge branch 'main' into spike-BUTTON-LINK-CTA-main
didoo d0aa0d6
Merge branch 'spike-BUTTON-LINK-CTA-main' into spike-interactive-geneβ¦
didoo c8106a9
Merge branch 'spike-interactive-generic-component' into spike-button-β¦
didoo 9c1289f
Merge branch 'spike-interactive-generic-component' into spike-unify-lβ¦
didoo 65aadbb
added `Link::Inline` component
didoo c2a7e1d
added documentation page for `Link::Inline`
didoo 5035d6a
added tests (integration + percy) for `Link::Inline`
didoo c4a1e4a
small updates to integration tests for `Link::Standalone` for consistβ¦
didoo f580744
added icon support to βlink-inlineβ
didoo 96ea039
improved icon alignment
didoo 37f2c96
updated CSS for `Link::Inline` according to new designs
didoo 952e25c
Merge branch 'spike-link-inline' into spike-add-icon-to-link-inline
didoo 8faea6c
added missing test for `Button` component
didoo f43fae3
Merge pull request #216 from hashicorp/spike-interactive-generic-compβ¦
didoo 59d8e60
Merge branch 'spike-BUTTON-LINK-CTA-main' into spike-unify-link-standβ¦
didoo dba115f
Merge branch 'spike-BUTTON-LINK-CTA-main' into spike-button-with-linkβ¦
didoo 3d8afbe
Merge branch 'spike-BUTTON-LINK-CTA-main' into spike-link-inline
didoo 3a86700
Merge branch 'spike-BUTTON-LINK-CTA-main' into spike-remove-link-CTA
didoo 229c5b1
Merge branch 'spike-link-inline' into spike-add-icon-to-link-inline
didoo 0d54c25
Merge pull request #227 from hashicorp/spike-unify-link-standalone
didoo a4151bb
updated the `interactive` base component, to reduce issues with whiteβ¦
didoo 45930b6
updated the `Link::Inline` template to reduce issues with whitespaces
didoo aee3d7e
small tweaks to the styling of the `Link::Inline`
didoo 18eef3c
Merge branch 'spike-link-inline' into spike-add-icon-to-link-inline +β¦
didoo 9983a13
changed default icon position for `Link::Inline` to `trailing` (likelβ¦
didoo 7d86c6d
updated documentation for `Link::Inline`
didoo 6e2da93
updated tests for `Link::Inline`
didoo d3af5ef
Merge pull request #255 from hashicorp/spike-add-icon-to-link-inline
didoo 384a88b
Merge branch 'main' into spike-BUTTON-LINK-CTA-main
didoo c73fdec
removed `LinkTo::Standalone` from `Alert` and `Toast` contextual compβ¦
didoo 568de83
updated `Alert` and `Toast` documentation pages to fix errors for `Liβ¦
didoo 0a963a4
Merge branch 'spike-BUTTON-LINK-CTA-main' into spike-button-with-linkβ¦
didoo 18d5662
Merge branch 'spike-BUTTON-LINK-CTA-main' into spike-remove-link-CTA
didoo 6957ff5
Merge remote-tracking branch 'origin/spike-BUTTON-LINK-CTA-main' intoβ¦
didoo 4e13bcf
added a comment
didoo 4d1897e
linting
didoo ff0ba40
fixed integration test
didoo 84388c5
Merge branch 'spike-BUTTON-LINK-CTA-main' into spike-remove-link-CTA
didoo f65348b
Merge branch 'spike-BUTTON-LINK-CTA-main' into spike-button-with-linkβ¦
didoo a8e5a2c
Merge branch 'spike-BUTTON-LINK-CTA-main' into spike-link-inline
didoo 5571f30
Merge branch 'spike-button-with-link-support' into spike-remove-link-CTA
didoo ea4602e
added missing anchors to the page
didoo 64d9a5e
updated color according to design specs
didoo 5e82573
removed underline on focus as per design specs
didoo 1e08d27
linting
didoo cc4dcd7
Enable interactive links to be actioned using space
alex-ju 07dd76e
Test the dispatch of a click event when pressing space key on an inteβ¦
alex-ju e59543b
Merge pull request #291 from hashicorp/alex-ju/action-interactive-linβ¦
alex-ju 532e00f
Merge branch 'main' into spike-BUTTON-LINK-CTA-main
didoo 1969434
Merge branch 'spike-BUTTON-LINK-CTA-main' into spike-button-with-linkβ¦
didoo 6df24f1
Merge branch 'spike-BUTTON-LINK-CTA-main' into spike-link-inline
didoo de89138
Merge branch 'spike-button-with-link-support' into spike-remove-link-CTA
didoo 2535a1d
re-added the underline to the text when `Hds::Button` is a link
didoo 228e891
removed the `@type` argument in favour of the native `type` attributeβ¦
didoo 2836b6f
updated documentation after removing `@type` argument
didoo e782b79
updated tests after removing `@type` argument
didoo 00573b5
removed extra test
didoo 6926071
Merge branch 'main' into spike-BUTTON-LINK-CTA-main
didoo 54ef3b7
Merge branch 'spike-BUTTON-LINK-CTA-main' into spike-button-with-linkβ¦
didoo 6f0a49c
Merge branch 'spike-BUTTON-LINK-CTA-main' into spike-link-inline
didoo ccf9988
Merge branch 'spike-button-with-link-support' into spike-remove-link-CTA
didoo 1680f17
Merge branch 'main' into spike-BUTTON-LINK-CTA-main
didoo 885e398
Merge branch 'spike-BUTTON-LINK-CTA-main' into spike-button-with-linkβ¦
didoo 237e1cb
Merge branch 'spike-button-with-link-support' into spike-remove-link-CTA
didoo dff380e
Merge pull request #221 from hashicorp/spike-remove-link-CTA
didoo fa79875
Merge pull request #220 from hashicorp/spike-button-with-link-support
didoo f362d7e
Merge branch 'spike-BUTTON-LINK-CTA-main' into spike-link-inline
didoo b658213
Merge branch 'main' into spike-BUTTON-LINK-CTA-main
didoo 650b9aa
Merge branch 'spike-BUTTON-LINK-CTA-main' into spike-link-inline
didoo 210edd1
changeset
didoo 61d3a0b
Merge pull request #231 from hashicorp/spike-link-inline
didoo 0a47087
Merge branch 'main' into spike-BUTTON-LINK-CTA-main
didoo 264c497
hiding the βLinkCTAβ banner until we decide if we want to keep it or β¦
didoo 5829e9b
Apply suggestions from code review
didoo c9a8df5
updated documentation following heatherβs feedback
didoo 48159a6
linting
didoo 8cdc3b6
small update to the βnoticeβ message on top of the `Disclosure` and `β¦
didoo eeb4564
adds a11y info to button documentation
MelSumner 59b8ac1
Merge pull request #315 from hashicorp/melsumner/button-a11y
MelSumner eb74108
Merge branch 'main' into spike-BUTTON-LINK-CTA-main
didoo 32c837c
fixed missed standalone link attribute
didoo 0ca2179
updated link pages to use new mock status
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
This file contains hidden or 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,28 @@ | ||
| --- | ||
| "@hashicorp/design-system-components": minor | ||
| --- | ||
|
|
||
| # Interactive | ||
| - Introduced `<Hds::Interactive>` (a generic, "utility" component used internally by all the interactive elements like buttons and links) | ||
|
|
||
| # Button | ||
| - updated the button API to handle also links as `<a>`/`<LinkTo/LinkToExternal>` | ||
| - it can be used in place of the `<Hds::Link/LinkTo::CTA>` component (see below) | ||
| - when the button is a link | ||
| - the text is underlined for differentiation with a normal button - β οΈ **Visual change!** | ||
| - the button responds to `space` key event | ||
| - removed the `@type` argument from the API in favour of the `type` native attribute - π¨ **Breaking change!** | ||
|
|
||
| #Link/LinkTo::CTA | ||
| - removed the `<Hds::Link/LinkTo::CTA>` component, in favour of `<Hds::Button>` component (see above) - π¨ **Breaking change!** | ||
|
|
||
| # Link::Inline | ||
| - added the `<Hds::Link::Inline>` component (with API very similar to the `<Hds::Link::Standalone>`) | ||
|
|
||
| # Dropdown | ||
| - Updated the `Dropdown::ListItem::Interactive` to use the new `<Hds::Interactive>` component | ||
|
|
||
| # Alert/Toast components | ||
| - Removed the `<LinkTo::Standalone>` action (now you can use directly `<Link::Standalone>`) | ||
|
|
||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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
61 changes: 20 additions & 41 deletions
61
packages/components/addon/components/hds/dropdown/list-item/interactive.hbs
This file contains hidden or 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,44 +1,23 @@ | ||
| <li class={{this.classNames}}> | ||
| {{#if @route}} | ||
| <LinkTo | ||
| class="{{if @state (concat 'is-' @state)}}" | ||
| @current-when={{@current-when}} | ||
| @models={{hds-link-to-models @model @models}} | ||
| @query={{hds-link-to-query @query}} | ||
| @replace={{@replace}} | ||
| @route={{@route}} | ||
| ...attributes | ||
| > | ||
| {{#if @icon}} | ||
| <div class="hds-dropdown-list-item__interactive-icon"> | ||
| <FlightIcon @name={{@icon}} @isInlineBlock={{false}} /> | ||
| </div> | ||
| {{/if}} | ||
| <div class="hds-dropdown-list-item__interactive-text hds-typography-body-200 hds-font-weight-medium"> | ||
| {{this.text}} | ||
| <Hds::Interactive | ||
| class="{{if @state (concat 'is-' @state)}}" | ||
| @current-when={{@current-when}} | ||
| @models={{hds-link-to-models @model @models}} | ||
| @query={{hds-link-to-query @query}} | ||
| @replace={{@replace}} | ||
| @route={{@route}} | ||
| @isRouteExternal={{@isRouteExternal}} | ||
| @href={{@href}} | ||
| @isHrefExternal={{@isHrefExternal}} | ||
| ...attributes | ||
| > | ||
| {{#if @icon}} | ||
| <div class="hds-dropdown-list-item__interactive-icon"> | ||
| <FlightIcon @name={{@icon}} @isInlineBlock={{false}} /> | ||
| </div> | ||
| </LinkTo> | ||
| {{else if @href}} | ||
| <a target="_blank" rel="noopener noreferrer" href={{@href}} class="{{if @state (concat 'is-' @state)}}"> | ||
| {{#if @icon}} | ||
| <div class="hds-dropdown-list-item__interactive-icon"> | ||
| <FlightIcon @name={{@icon}} @isInlineBlock={{false}} /> | ||
| </div> | ||
| {{/if}} | ||
| <div class="hds-dropdown-list-item__interactive-text hds-typography-body-200 hds-font-weight-medium"> | ||
| {{this.text}} | ||
| </div> | ||
| </a> | ||
| {{else}} | ||
| <button class="{{if @state (concat 'is-' @state)}}" type="button" ...attributes> | ||
| {{#if @icon}} | ||
| <div class="hds-dropdown-list-item__interactive-icon"> | ||
| <FlightIcon @name={{@icon}} @isInlineBlock={{false}} /> | ||
| </div> | ||
| {{/if}} | ||
| <div class="hds-dropdown-list-item__interactive-text hds-typography-body-200 hds-font-weight-medium"> | ||
| {{this.text}} | ||
| </div> | ||
| </button> | ||
| {{/if}} | ||
| {{/if}} | ||
| <div class="hds-dropdown-list-item__interactive-text hds-typography-body-200 hds-font-weight-medium"> | ||
| {{this.text}} | ||
| </div> | ||
| </Hds::Interactive> | ||
| </li> |
33 changes: 33 additions & 0 deletions
33
packages/components/addon/components/hds/interactive/index.hbs
This file contains hidden or 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,33 @@ | ||
| {{! IMPORTANT: we removed the newlines before/after the yield to reduce the issues with unexpected whitespaces (see https://github.com/hashicorp/design-system/pull/231#issuecomment-1123502499) }} | ||
| {{! NOTICE: we can't support the direct use of the "href" HTML attribute via ...attributes in the <a> elements, because we need to rely on the "@href" Ember argument to differentiate between different types of generated output }} | ||
| {{#if @route}} | ||
| {{#if this.isRouteExternal}} | ||
| <LinkToExternal | ||
| @current-when={{@current-when}} | ||
| @models={{hds-link-to-models @model @models}} | ||
| @query={{hds-link-to-query @query}} | ||
| @replace={{@replace}} | ||
| @route={{@route}} | ||
| ...attributes | ||
| >{{yield}}</LinkToExternal> | ||
| {{else}} | ||
| <LinkTo | ||
| @current-when={{@current-when}} | ||
| @models={{hds-link-to-models @model @models}} | ||
| @query={{hds-link-to-query @query}} | ||
| @replace={{@replace}} | ||
| @route={{@route}} | ||
| ...attributes | ||
| >{{yield}}</LinkTo> | ||
| {{/if}} | ||
| {{else if @href}} | ||
| {{#if this.isHrefExternal}} | ||
| <a target="_blank" rel="noopener noreferrer" ...attributes href={{@href}} {{on "keyup" this.onKeyUp}}>{{yield}}</a> | ||
| {{else}} | ||
| <a ...attributes href={{@href}} {{on "keyup" this.onKeyUp}}>{{yield}}</a> | ||
| {{/if}} | ||
| {{else}} | ||
| <button type="button" ...attributes> | ||
| {{yield}} | ||
| </button> | ||
| {{/if}} |
33 changes: 33 additions & 0 deletions
33
packages/components/addon/components/hds/interactive/index.js
This file contains hidden or 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,33 @@ | ||
| import Component from '@glimmer/component'; | ||
| import { action } from '@ember/object'; | ||
|
|
||
| export default class HdsInteractiveComponent extends Component { | ||
| /** | ||
| * Determines if a @href value is "external" (it adds target="_blank" rel="noopener noreferrer") | ||
| * | ||
| * @param isHrefExternal | ||
| * @type boolean | ||
| * @default true | ||
| */ | ||
| get isHrefExternal() { | ||
| return this.args.isHrefExternal ?? true; | ||
| } | ||
|
|
||
| /** | ||
| * Determines if a @route value is "external" (uses the LinkToExternal component instead of LinkTo) | ||
| * | ||
| * @param isRouteExternal | ||
| * @type boolean | ||
| * @default false | ||
| */ | ||
| get isRouteExternal() { | ||
| return this.args.isRouteExternal ?? false; | ||
| } | ||
|
|
||
| @action | ||
| onKeyUp(event) { | ||
| if (event.key === ' ' || event.code === 'Space') { | ||
| event.target.click(); | ||
| } | ||
| } | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.