Skip to content

Commit b67db11

Browse files
committed
added version to deprecated comments and explicit replacements, added info intent to notification
1 parent 7d1f1ee commit b67db11

7 files changed

Lines changed: 25 additions & 32 deletions

File tree

src/components/Button/Button.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export default {
2020
},
2121
intent: {
2222
...helpersArgTypes.exampleIntent,
23+
options: ["UNDEFINED", "primary", "success", "warning", "danger"],
2324
},
2425
},
2526
} as Meta<typeof Button>;

src/components/Button/Button.tsx

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
ButtonProps as BlueprintButtonProps,
77
Intent as BlueprintIntent,
88
} from "@blueprintjs/core";
9-
import { IntentTypes } from "common/Intent";
109

1110
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
1211
import { ValidIconName } from "../Icon/canonicalIconNames";
@@ -16,10 +15,6 @@ import Badge, { BadgeProps } from "./../Badge/Badge";
1615
import Tooltip, { TooltipProps } from "./../Tooltip/Tooltip";
1716

1817
interface AdditionalButtonProps {
19-
/**
20-
* Intent state of the button.
21-
*/
22-
intent?: IntentTypes;
2318
/**
2419
* Always use this when the button triggers an affirmative action, e.g. confirm a process.
2520
* The button is displayed with primary color scheme.
@@ -28,33 +23,31 @@ interface AdditionalButtonProps {
2823
/**
2924
* Always use this when the button triggers an disruptive action, e.g. delete or remove.
3025
* The button is displayed with primary color scheme.
31-
* @deprecated use `intent` instead.
3226
*/
3327
disruptive?: boolean;
3428
/**
3529
* Use this when a button is important enough to highlight it in a set of other buttons.
3630
* The button is displayed with primary color scheme.
37-
* @deprecated use `intent` instead.
3831
*/
3932
elevated?: boolean;
4033
/**
4134
* The button is displayed with primary color scheme.
42-
* @deprecated use `intent` instead.
35+
* @deprecated (v25) use `intent="primary"` instead.
4336
*/
4437
hasStatePrimary?: boolean;
4538
/**
4639
* The button is displayed with success (some type of green) color scheme.
47-
* @deprecated use `intent` instead.
40+
* @deprecated (v25) use `intent="success"` instead.
4841
*/
4942
hasStateSuccess?: boolean;
5043
/**
5144
* The button is displayed with warning (some type of orange) color scheme.
52-
* @deprecated use `intent` instead.
45+
* @deprecated (v25) use `intent="warning"` instead.
5346
*/
5447
hasStateWarning?: boolean;
5548
/**
5649
* The button is displayed with danger (some type of red) color scheme.
57-
* @deprecated use `intent` instead.
50+
* @deprecated (v25) use `intent="danger"` instead.
5851
*/
5952
hasStateDanger?: boolean;
6053
/**
@@ -84,12 +77,10 @@ interface AdditionalButtonProps {
8477
//target?: string;
8578
}
8679

87-
interface ExtendedButtonProps
88-
extends AdditionalButtonProps,
89-
Omit<BlueprintButtonProps, "icon" | "rightIcon" | "intent"> {}
80+
interface ExtendedButtonProps extends AdditionalButtonProps, Omit<BlueprintButtonProps, "icon" | "rightIcon"> {}
9081
interface ExtendedAnchorButtonProps
9182
extends AdditionalButtonProps,
92-
Omit<BlueprintAnchorButtonProps, "icon" | "rightIcon" | "intent"> {}
83+
Omit<BlueprintAnchorButtonProps, "icon" | "rightIcon"> {}
9384

9485
export type ButtonProps = ExtendedButtonProps & ExtendedAnchorButtonProps;
9586

src/components/Form/FieldItem.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,25 @@ export interface FieldItemProps extends React.HTMLAttributes<HTMLDivElement>, Te
1818
/**
1919
* Set primary state.
2020
* This is not routed through automatically.
21-
* @deprecated use `intent` instead.
21+
* @deprecated (v25) use `intent="primary"` instead.
2222
*/
2323
hasStatePrimary?: boolean;
2424
/**
2525
* Set success state.
2626
* This is not routed through automatically.
27-
* @deprecated use `intent` instead.
27+
* @deprecated (v25) use `intent="success"` instead.
2828
*/
2929
hasStateSuccess?: boolean;
3030
/**
3131
* Set warning state.
3232
* This is not routed through automatically.
33-
* @deprecated use `intent` instead.
33+
* @deprecated (v25) use `intent="warning"` instead.
3434
*/
3535
hasStateWarning?: boolean;
3636
/**
3737
* Set danger state.
3838
* This is not routed through automatically.
39-
* @deprecated use `intent` instead.
39+
* @deprecated (v25) use `intent="danger"` instead.
4040
*/
4141
hasStateDanger?: boolean;
4242
/**

src/components/Form/FieldSet.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@ export interface FieldSetProps extends Omit<React.FieldsetHTMLAttributes<HTMLFie
1111
boxed?: boolean;
1212
/**
1313
* The fieldsetsection is displayed with primary color scheme.
14-
* @deprecated use `intent` instead.
14+
* @deprecated (v25) use `intent="primary"` instead.
1515
*/
1616
hasStatePrimary?: boolean;
1717
/**
1818
* The fieldset section is displayed with success (some type of green) color scheme.
19-
* @deprecated use `intent` instead.
19+
* @deprecated (v25) use `intent="success"` instead.
2020
*/
2121
hasStateSuccess?: boolean;
2222
/**
2323
* The fieldset section is displayed with warning (some type of orange) color scheme.
24-
* @deprecated use `intent` instead.
24+
* @deprecated (v25) use `intent="warning"` instead.
2525
*/
2626
hasStateWarning?: boolean;
2727
/**
2828
* The fieldsetsection is displayed with danger (some type of red) color scheme.
29-
* @deprecated use `intent` instead.
29+
* @deprecated (v25) use `intent="danger"` instead.
3030
*/
3131
hasStateDanger?: boolean;
3232
/**

src/components/Notification/Notification.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default {
1717
},
1818
intent: {
1919
...helpersArgTypes.exampleIntent,
20-
options: ["UNDEFINED", "success", "warning", "danger", "neutral"],
20+
options: ["UNDEFINED", "success", "warning", "danger", "neutral", "info"],
2121
},
2222
},
2323
} as Meta<typeof Notification>;

src/components/Notification/Notification.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,28 @@ export interface NotificationProps
2828
/**
2929
* Intent state of the notification.
3030
*/
31-
intent?: Extract<IntentTypes, "neutral" | "success" | "warning" | "danger">;
31+
intent?: Extract<IntentTypes, "neutral" | "success" | "warning" | "danger" | "info">;
3232
/**
3333
* Notification has a neutral color scheme.
34+
* @deprecated (v25) use `intent="neutral"` instead.
3435
*/
3536
neutral?: boolean;
3637
/**
3738
* Notification is a success info.
3839
* This defines the colorization and the icon symbol.
39-
* @deprecated use `intent` instead.
40+
* @deprecated (v25) use `intent="success"` instead.
4041
*/
4142
success?: boolean;
4243
/**
4344
* Notification is a warning alert.
4445
* This defines the colorization and the icon symbol.
45-
* @deprecated use `intent` instead.
46+
* @deprecated (v25) use `intent="warning"` instead.
4647
*/
4748
warning?: boolean;
4849
/**
4950
* Notification is a danger alert.
5051
* This defines the colorization and the icon symbol.
51-
* @deprecated use `intent` instead.
52+
* @deprecated (v25) use `intent="danger"` instead.
5253
*/
5354
danger?: boolean;
5455
/**
@@ -88,7 +89,7 @@ export const Notification = ({
8889
wrapperProps,
8990
"data-test-id": dataTestId,
9091
"data-testid": dataTestid,
91-
intent,
92+
intent = "info",
9293
...otherProps
9394
}: NotificationProps) => {
9495
let intentLevel: string = IntentClassNames.INFO;
@@ -113,7 +114,7 @@ export const Notification = ({
113114

114115
const intents: Array<NotificationProps["intent"]> = ["success", "warning", "danger"];
115116
const intentClass = intent ? " " + IntentClassNames[intent.toUpperCase()] : "";
116-
const intentIconSymbol = intents.includes(intent) ? `state-${intent}` : "";
117+
const intentIconSymbol = intents.includes(intent) ? `state-${intent}` : "state-info";
117118

118119
let notificationIcon = icon !== false ? icon : undefined;
119120
if (icon !== false && !notificationIcon && (!!iconSymbol || !!intentIconSymbol)) {

src/components/Spinner/Spinner.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ type Intent = "inherit" | "primary" | "success" | "warning" | "danger";
1717
export interface SpinnerProps extends Omit<BlueprintSpinnerProps, "size" | "intent"> {
1818
/**
1919
* intent value or a valid css color definition
20-
* @deprecated use `intent` instead.
20+
* @deprecated (v25) use `intent` instead.
2121
*/
2222
color?: Intent | string;
2323
/**
2424
* Intent state of the field item.
2525
*/
26-
intent?: Intent | string;
26+
intent?: Intent;
2727
/**
2828
* Additional CSS class names.
2929
*/

0 commit comments

Comments
 (0)