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

[core] add support for more Alert props #2102

Merged
merged 3 commits into from
Feb 10, 2018
Merged

[core] add support for more Alert props #2102

merged 3 commits into from
Feb 10, 2018

Conversation

giladgray
Copy link
Contributor

Fixes #517

Changes proposed in this pull request:

  • Alert: add canEscapeKeyCancel, canOutsideClickCancel, onClose, transitionDuration props
  • onClose is single alternative to separate onCancel/onConfirm props
    • event handlers are all optional now, and handler-less usage is supported
  • tweaked warnings, added warnings for new can*Cancel props
  • did not add canEnterKeyConfirm (see Alert doesn’t have canEscapeKeyClose nor canReturnKeyConfirm #517) because it's not easy to implement (key events require focus, blah blah), and is already supported by simply tab-ing onto a button and pressing enter or space

@blueprint-bot
Copy link

Alert: add canEscapeKeyCancel, canOutsideClickCancel, onClose, transitionDuration props

Preview: documentation | landing | table

Copy link
Member

@invliD invliD left a comment

Choose a reason for hiding this comment

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

This is awesome! 🎉

@@ -9,6 +9,8 @@ const ns = "[Blueprint]";
export const CLAMP_MIN_MAX = ns + ` clamp: max cannot be less than min`;

export const ALERT_WARN_CANCEL_PROPS = ns + ` <Alert> cancelButtonText and onCancel should be set together.`;
export const ALERT_WARN_CANCEL_ESCAPE_KEY = ns + ` <Alert> canEscapeKeyCancel enabled without onCancel handler.`;
export const ALERT_WARN_CANCEL_OUTSIDE_CLICK = ns + ` <Alert> canOutsideClickCancel enbaled without onCancel handler.`;
Copy link
Member

Choose a reason for hiding this comment

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

These are misleading given onClose is also ok.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh yeah gotta update language

/**
* Handler invoked when the Alert is confirmed or canceled; see `onConfirm` and `onCancel` for more details.
* First argument is `true` if confirmed, `false` otherwise.
* This is an alternative to defining separate `onConfirm` and `onCancel` handlers.
Copy link
Contributor

Choose a reason for hiding this comment

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

why support 3 handlers when one will do? either remove this (leave the callbacks as-is) or remove the existing ones and only support onClose

Copy link
Contributor Author

@giladgray giladgray Feb 8, 2018

Choose a reason for hiding this comment

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

TagInput also has three callbacks, as does EditableText

Copy link
Contributor

Choose a reason for hiding this comment

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

alright fine 🤷‍♂️

@adidahiya adidahiya changed the title more better Alert props [core] add support for more Alert props Feb 8, 2018
@blueprint-bot
Copy link

Update errors.ts

Preview: documentation | landing | table

@blueprint-bot
Copy link

lint

Preview: documentation | landing | table

@adidahiya adidahiya merged commit 123e3bf into develop Feb 10, 2018
@adidahiya adidahiya deleted the gg/alert-props branch February 10, 2018 19:35
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.

5 participants