Skip to content
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

fix(alert-dialog): add Alert Dialog package #3501

Merged
merged 77 commits into from
Sep 8, 2023
Merged

Conversation

Rajdeepc
Copy link
Contributor

@Rajdeepc Rajdeepc commented Jul 31, 2023

Description

New Alert Dialog Component

Related issue(s)

Motivation and context

How has this been tested?

  • Test case 1
    1. Go here
    2. Do this
  • Test case 2
    1. Go here
    2. Do this

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (minor updates related to the tooling or maintenance of the repository, does not impact compiled assets)

Checklist

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • If my change required a change to the documentation, I have updated the documentation in this pull request.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices

Best practices

This repository uses conventional commit syntax for each commit message; note that the GitHub UI does not use this by default so be cautious when accepting suggested changes. Avoid the "Update branch" button on the pull request and opt instead for rebasing your branch against main.

@Rajdeepc Rajdeepc added the WIP label Jul 31, 2023
@Rajdeepc Rajdeepc linked an issue Aug 7, 2023 that may be closed by this pull request
@Rajdeepc Rajdeepc marked this pull request as ready for review August 9, 2023 16:37
@github-actions
Copy link

github-actions bot commented Aug 9, 2023

Tachometer results

Chrome

accordion permalink

Version Bytes Avg Time vs remote vs branch
npm latest 405 kB 417.67ms - 427.53ms - unsure 🔍
-2% - +2%
-6.64ms - +6.88ms
branch 400 kB 417.85ms - 427.11ms unsure 🔍
-2% - +2%
-6.88ms - +6.64ms
-

action-bar permalink

Version Bytes Avg Time vs remote vs branch
npm latest 476 kB 196.41ms - 201.01ms - unsure 🔍
-1% - +3%
-2.52ms - +5.02ms
branch 471 kB 194.47ms - 200.45ms unsure 🔍
-3% - +1%
-5.02ms - +2.52ms
-

action-button permalink

Version Bytes Avg Time vs remote vs branch
npm latest 506 kB 370.10ms - 376.98ms - unsure 🔍
-2% - +1%
-7.38ms - +3.19ms
branch 501 kB 371.62ms - 379.65ms unsure 🔍
-1% - +2%
-3.19ms - +7.38ms
-

action-group permalink

Version Bytes Avg Time vs remote vs branch
npm latest 527 kB 213.08ms - 219.62ms - unsure 🔍
-2% - +2%
-3.42ms - +5.09ms
branch 522 kB 212.79ms - 218.23ms unsure 🔍
-2% - +2%
-5.09ms - +3.42ms
-

action-menu permalink

Version Bytes Avg Time vs remote vs branch
npm latest 624 kB 391.61ms - 401.28ms - unsure 🔍
-3% - +1%
-10.83ms - +3.39ms
branch 620 kB 394.95ms - 405.38ms unsure 🔍
-1% - +3%
-3.39ms - +10.83ms
-
Firefox

accordion permalink

Version Bytes Avg Time vs remote vs branch
npm latest 405 kB 530.35ms - 552.05ms - unsure 🔍
-2% - +3%
-12.82ms - +14.70ms
branch 400 kB 531.79ms - 548.73ms unsure 🔍
-3% - +2%
-14.70ms - +12.82ms
-

action-bar permalink

Version Bytes Avg Time vs remote vs branch
npm latest 476 kB 340.95ms - 366.89ms - unsure 🔍
-5% - +6%
-15.99ms - +19.67ms
branch 471 kB 339.84ms - 364.32ms unsure 🔍
-6% - +5%
-19.67ms - +15.99ms
-

action-button permalink

Version Bytes Avg Time vs remote vs branch
npm latest 506 kB 499.96ms - 529.84ms - unsure 🔍
-1% - +6%
-7.42ms - +29.18ms
branch 501 kB 493.44ms - 514.60ms unsure 🔍
-6% - +1%
-29.18ms - +7.42ms
-

action-group permalink

Version Bytes Avg Time vs remote vs branch
npm latest 527 kB 318.53ms - 334.91ms - unsure 🔍
-7% - +1%
-22.96ms - +4.96ms
branch 522 kB 324.41ms - 347.03ms unsure 🔍
-2% - +7%
-4.96ms - +22.96ms
-

action-menu permalink

Version Bytes Avg Time vs remote vs branch
npm latest 624 kB 479.99ms - 505.33ms - unsure 🔍
-3% - +3%
-16.35ms - +16.79ms
branch 620 kB 481.76ms - 503.12ms unsure 🔍
-3% - +3%
-16.79ms - +16.35ms
-

@Rajdeepc Rajdeepc changed the title chore(Alert Dialog): new component migration chore(alert-dialog): new component migration Aug 9, 2023
@Rajdeepc Rajdeepc requested a review from Westbrook August 9, 2023 17:56
@Rajdeepc Rajdeepc added the in-review Label to trigger PR auto Update from main label Aug 10, 2023
@Rajdeepc
Copy link
Contributor Author

On the documentation site... Noone of the alert dialog component closes on clicking the continue button. For cases where there is a cancel button in the alert dialog this is still fine but in other variants like error there is absolutely no way to close the dialog once its open without reloading the site!

Yes there is a bug for this. Thanks for noticing this. I will pull back this PR for now since we need to discuss on the approach to this alert dialog in a more simpler way leveraging DialogBase as the base which includes the modals styles and attributes. This will make the alert dialog much more simpler.

@Rajdeepc Rajdeepc added Needs discussion Proposed UX or spec changes and removed ready-for-review labels Aug 31, 2023
@Rajdeepc Rajdeepc requested a review from TarunAdobe September 1, 2023 14:07
@Rajdeepc Rajdeepc added ready-for-review and removed Needs discussion Proposed UX or spec changes labels Sep 1, 2023
@Rajdeepc
Copy link
Contributor Author

Rajdeepc commented Sep 5, 2023

@Westbrook @najikahalsema would love to have your thoughts in this PR. I have abstracted the alert dialog logic to only surface the contents of the alert dialog so that this component can be reused in Tray / Coachmark or Popovers.

Copy link
Contributor

@Westbrook Westbrook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some smaller things for clean up.

Only big question is re: the API table that is build by extending Dialog. We may be able to suppress some thing there via:

/**
 * @private
 */
public override noDivider = false;

But, I'm not sure we've tried that in an extension before....

packages/alert-dialog/README.md Outdated Show resolved Hide resolved
packages/alert-dialog/README.md Outdated Show resolved Hide resolved
packages/alert-dialog/README.md Outdated Show resolved Hide resolved
packages/alert-dialog/package.json Outdated Show resolved Hide resolved
packages/alert-dialog/package.json Outdated Show resolved Hide resolved
packages/alert-dialog/src/AlertDialog.ts Outdated Show resolved Hide resolved
packages/alert-dialog/src/alert-dialog.css Outdated Show resolved Hide resolved
packages/alert-dialog/src/AlertDialog.ts Outdated Show resolved Hide resolved
packages/alert-dialog/stories/alert-dialog.stories.ts Outdated Show resolved Hide resolved
@Rajdeepc Rajdeepc requested a review from Westbrook September 8, 2023 09:55
Copy link
Contributor

@Westbrook Westbrook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of small polish points and then I think we're ready here.

Great work on the inversion!

packages/alert-dialog/test/benchmark/basic-test.ts Outdated Show resolved Hide resolved
'[slot="button"]',
])
) {
export class Dialog extends ObserveSlotPresence(AlertDialog, [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Make sure we add @spectrum-web-components/alert-dialog to the dependencies here.

Copy link
Contributor Author

@Rajdeepc Rajdeepc Sep 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! Will add once alert-dialog is published to the npm registry.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the wrong order of operations. All packages within the monorepo are dependable today, so there is no need to wait.. When we make a release with this change, were we not to include this dependency, users of the Dialog package couldn't update for the fact that the released version of Dialog would technically be broken unless they were to manually add a dependency on Alert Dialog locally.

tools/bundle/elements.ts Outdated Show resolved Hide resolved
Comment on lines +215 to +229
public override connectedCallback(): void {
super.connectedCallback();
window.addEventListener(
'resize',
this.shouldManageTabOrderForScrolling
);
}

public override disconnectedCallback(): void {
window.removeEventListener(
'resize',
this.shouldManageTabOrderForScrolling
);
super.disconnectedCallback();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could I get you to volunteer for a follow up change that moved this to a Resize Observer so that we can also fix #3613?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

@Rajdeepc Rajdeepc requested a review from Westbrook September 8, 2023 12:00
@Westbrook Westbrook changed the title chore(alert-dialog): new component migration fix(alert-dialog): add Alert Dialog package Sep 8, 2023
@@ -73,6 +73,7 @@
"lit-html"
],
"dependencies": {
"@spectrum-web-components/alert-dialog": "0.0.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"@spectrum-web-components/alert-dialog": "0.0.1",
"@spectrum-web-components/alert-dialog": "^0.0.1",

That or it won't get managed correctly at release time.

Copy link
Contributor

@Westbrook Westbrook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we're good to go!! Thanks for taking this on 🙇🏼

:shipit:

@Westbrook Westbrook merged commit 1062847 into main Sep 8, 2023
@Westbrook Westbrook deleted the feature/new-alertdialog branch September 8, 2023 12:22
blunteshwar pushed a commit that referenced this pull request Sep 12, 2023
* chore: first commit for alertdialog

* chore: added config for alert dialog

* chore: added spectrum-config class attributes

* chore: added alert dialog variants

* chore: added alert dialog variants

* chore: updated variants

* chore: added new alertdialog version

* chore: removed dialog dependency

* chore: added button variant

* chore: added storybook

* chore: added storybook for scroll variant

* chore: added variant tests

* chore: updated hash

* chore: reverting unused code

* chore: bump dependencies version

* chore: alert dialog alignment issue

* chore: updated golden hash

* test: testing

* chore: new golden hash

* fix: test and css

* fix: add golden hash for VRT

* chore: removed sp dialog with alert dialog base

* fix: css on scroll

* fix: updated test case

* fix: import fix

* fix: sp alert dialog base update in storybook

* chore: update icon package for alert icon css

* fix: centering issue fix from modal

* chore: update golden image hash

* chore: update golden image hash

* fix: updated tests

* chore: update golden hash

* test: updated test cases

* chore: removed unused imports

* chore: adding yarn.lock

* fix: updated stories

* chore: bump tokens version in styles

* chore: update golden image hash

* chore: update golden image hash

* chore: updated alert dialog wrapper

* chore: updated tests

* fix: overlay trigger attribute fixes after update

* fix: updated version in package.json

* fix: updated tokens version

* fix: updated tokens version

* fix: added open attribute in sp-alert-dialog-wrapper

* chore: adding tokens css

* chore: golden hash

* chore: updated storybook

* chore: updated storybook

* test: secondary test case added for buttons

* fix: css changes in alert dialog, button-group and icon

* fix: updated content in readme and toggle button text

* chore: updated golden hash

* fix: update golden hash

* chore: removed alert wrapper

* chore: update alert dialog dependency

* test: updated alert dialog unit tests

* chore: updated golden image cache

* chore: removed scroll variant and update readme

* chore: inverting the class hierarchy

* chore: removed scroll variant

* chore: update golden image cache

* chore: added alert dialog dependency in dialog

* chore: deps update @spectrum-web-components/alert-dialog to ^0.0.1

---------

Co-authored-by: Rajdeep Chandra <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create Alert Dialog component
4 participants