diff --git a/.changeset/thirty-toys-prove.md b/.changeset/thirty-toys-prove.md new file mode 100644 index 000000000..d68162899 --- /dev/null +++ b/.changeset/thirty-toys-prove.md @@ -0,0 +1,7 @@ +--- +"@orbit-ui/transition-components": major +--- + +- Alert is now dismissable by default. This is potentially a breaking change if you we're not expecting the alert to be closable. To fix this, either add `dismissable={false}` to the Alert, or handle the `onClose` event handler. + +- Dialog small size has been slightly reduced by 84px. diff --git a/.storybook/components/component-info/ComponentInfo.tsx b/.storybook/components/component-info/ComponentInfo.tsx index 20fd16d9c..30e8a92fd 100644 --- a/.storybook/components/component-info/ComponentInfo.tsx +++ b/.storybook/components/component-info/ComponentInfo.tsx @@ -29,7 +29,7 @@ const ExtendLinks = { }; -export interface ComponentInfoProps extends ComponentProps<"dl">{ +export interface ComponentInfoProps extends ComponentProps<"dl"> { usage: string | { sharegate: string; }; diff --git a/packages/components/src/alert/docs/Alert.stories.mdx b/packages/components/src/alert/docs/Alert.stories.mdx index bd99a131a..9486d4a33 100644 --- a/packages/components/src/alert/docs/Alert.stories.mdx +++ b/packages/components/src/alert/docs/Alert.stories.mdx @@ -155,38 +155,18 @@ Use a destructive alert to confirm a permanent change, like deleting data. -### Warning +### Not Dismissable -Use a warning alert to inform of a significant change. +An alert can be undismissable. - + - Low carburant - The space shuttle will be out of fuel in an hour. - - - - - -### Negative - -Use a negative alert to inform that something went wrong, like a server error. - - - - - - Network error Something went wrong while connecting to NASA network. Please try again in a few minutes. diff --git a/packages/components/src/alert/src/Alert.css b/packages/components/src/alert/src/Alert.css index cc954ec56..dc1a84ff9 100644 --- a/packages/components/src/alert/src/Alert.css +++ b/packages/components/src/alert/src/Alert.css @@ -1,7 +1,29 @@ -.o-ui-alert-warning-icon { - color: var(--hop-warning-icon-weak); +.o-ui-alert-button-group > .o-ui-button { + max-width: 50%; + width: 50%; + flex-grow: 1; + flex-basis: 0; } -.o-ui-alert-negative-icon { - color: var(--hop-danger-icon-weak); +.o-ui-alert-heading { + text-align: left; + width: 100%; +} + +.o-ui-alert-content { + text-align: left; +} + +/* We need to determine a sensitive max-width to wrap - 360px seems like a good point */ +@media all and (max-width: 40rem) { + .o-ui-alert-button-group > .o-ui-button { + max-width: 100%; + width: 100%; + } + .o-ui-alert-heading { + text-align: center; + } + .o-ui-alert-content { + text-align: center; + } } diff --git a/packages/components/src/alert/src/Alert.tsx b/packages/components/src/alert/src/Alert.tsx index 96d78b56f..88d779baa 100644 --- a/packages/components/src/alert/src/Alert.tsx +++ b/packages/components/src/alert/src/Alert.tsx @@ -1,13 +1,11 @@ import { AbstractDialogProps, Dialog, useDialogTriggerContext } from "../../dialog"; import { Button, ButtonGroup } from "../../button"; import { ComponentProps, MouseEvent, forwardRef, useMemo } from "react"; -import { Header } from "../../placeholders"; -import { WarningIcon } from "@hopper-ui/icons"; import { OmitInternalProps, isNil, isNilOrEmpty, mergeProps, useChainedEventCallback, useSlots } from "../../shared"; const DefaultElement = "section"; -export interface InnerAlertProps extends Omit, "dismissable"> { +export interface InnerAlertProps extends AbstractDialogProps { /** * The button to focus by default when the alert open. */ @@ -53,7 +51,7 @@ export interface InnerAlertProps extends Omit { @@ -101,18 +104,6 @@ export function InnerAlert({ } }); - const warningIconMarkup = variant === "warning" && ( -
- -
- ); - - const negativeIconMarkup = variant === "negative" && ( -
- -
- ); - const primaryButtonMarkup = (