Skip to content

Commit 5dcbecb

Browse files
committed
use only our own exported type/enum of blueprint intent states
1 parent 40bfdb9 commit 5dcbecb

5 files changed

Lines changed: 15 additions & 14 deletions

File tree

src/common/Intent/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ import { Intent as BlueprintIntent } from "@blueprintjs/core";
22

33
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
44

5-
export type IntentBlueprint = BlueprintIntent;
5+
/** @deprecated (v27) use `IntentBlueprint` instead */
66
export const DefinitionsBlueprint = BlueprintIntent;
7+
export const IntentBlueprint = BlueprintIntent;
8+
export type IntentBlueprint = BlueprintIntent;
79

810
export type IntentTypes = IntentBlueprint | "neutral" | "accent" | "info";
911

1012
export const Definitions: { [key: string]: IntentTypes } = {
11-
...DefinitionsBlueprint,
13+
...IntentBlueprint,
1214
ACCENT: "accent",
1315
NEUTRAL: "neutral",
1416
INFO: "info",

src/components/Button/Button.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import {
44
AnchorButtonProps as BlueprintAnchorButtonProps,
55
Button as BlueprintButton,
66
ButtonProps as BlueprintButtonProps,
7-
Intent as BlueprintIntent,
87
} from "@blueprintjs/core";
98

9+
import { IntentBlueprint } from "../../common/Intent";
1010
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
1111
import { ValidIconName } from "../Icon/canonicalIconNames";
1212
import Icon from "../Icon/Icon";
@@ -33,7 +33,7 @@ interface AdditionalButtonProps {
3333
/**
3434
* Intent state visualized by color.
3535
*/
36-
intent?: BlueprintIntent | "accent";
36+
intent?: IntentBlueprint | "accent";
3737
/**
3838
* Content displayed in a badge that is attached to the button.
3939
* By default it is displayed `{ size: "small", position: "top-right", maxLength: 2 }` and with the same intent state of the button.
@@ -94,7 +94,7 @@ export const Button = ({
9494
intentByFunction = "accent";
9595
break;
9696
case disruptive:
97-
intentByFunction = BlueprintIntent.DANGER;
97+
intentByFunction = IntentBlueprint.DANGER;
9898
break;
9999
default:
100100
break;
@@ -111,7 +111,7 @@ export const Button = ({
111111
<ButtonType
112112
{...restProps}
113113
className={`${eccgui}-button ` + className}
114-
intent={(intent || intentByFunction) as BlueprintIntent}
114+
intent={(intent || intentByFunction) as IntentBlueprint}
115115
icon={typeof icon === "string" ? <Icon name={icon} {...iconSize} /> : icon}
116116
rightIcon={typeof rightIcon === "string" ? <Icon name={rightIcon} {...iconSize} /> : rightIcon}
117117
>

src/components/MultiSelect/MultiSelect.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import React, { useRef } from "react";
2-
import { HTMLInputProps as BlueprintHTMLInputProps, Intent as BlueprintIntent } from "@blueprintjs/core";
2+
import { HTMLInputProps as BlueprintHTMLInputProps } from "@blueprintjs/core";
33
import {
44
ItemRendererProps as BlueprintItemRendererProps,
55
MultiSelect as BlueprintMultiSelect,
66
MultiSelectProps as BlueprintMultiSelectProps,
77
} from "@blueprintjs/select";
88
import classNames from "classnames";
99

10+
import { IntentBlueprint } from "../../common/Intent";
1011
import { removeExtraSpaces } from "../../common/utils/stringUtils";
1112
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
1213
import { TestableComponent } from "../interfaces";
@@ -97,7 +98,7 @@ export interface MultiSuggestFieldCommonProps<T>
9798
/**
9899
* Intent state of the multi select.
99100
*/
100-
intent?: BlueprintIntent | "accent";
101+
intent?: IntentBlueprint | "accent";
101102
/**
102103
* Disables the input element
103104
*/

src/components/TextField/TextArea.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import React from "react";
22
import {
33
Classes as BlueprintClassNames,
4-
Intent as BlueprintIntent,
54
MaybeElement,
65
TextArea as BlueprintTextArea,
76
TextAreaProps as BlueprintTextAreaProps,
87
} from "@blueprintjs/core";
98

10-
import { Definitions as IntentDefinitions, IntentTypes } from "../../common/Intent";
9+
import { Definitions as IntentDefinitions, IntentBlueprint, IntentTypes } from "../../common/Intent";
1110
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
1211
import { Icon } from "../Icon";
1312
import { ValidIconName } from "../Icon/canonicalIconNames";
@@ -155,7 +154,7 @@ export const TextArea = ({
155154
}
156155
intent={
157156
intent && !["info", "edited", "removed", "neutral", "accent"].includes(intent)
158-
? (intent as BlueprintIntent)
157+
? (intent as IntentBlueprint)
159158
: undefined
160159
}
161160
spellCheck={intent === "removed" ? false : undefined}

src/components/TextField/TextField.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ import {
44
HTMLInputProps,
55
InputGroup as BlueprintInputGroup,
66
InputGroupProps as BlueprintInputGroupProps,
7-
Intent as BlueprintIntent,
87
MaybeElement,
98
} from "@blueprintjs/core";
109

11-
import { Definitions as IntentDefinitions, IntentTypes } from "../../common/Intent";
10+
import { Definitions as IntentDefinitions, IntentBlueprint, IntentTypes } from "../../common/Intent";
1211
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
1312
import { ValidIconName } from "../Icon/canonicalIconNames";
1413
import Icon from "../Icon/Icon";
@@ -108,7 +107,7 @@ export const TextField = ({
108107
}
109108
intent={
110109
intent && !["info", "edited", "removed", "neutral", "accent"].includes(intent)
111-
? (intent as BlueprintIntent)
110+
? (intent as IntentBlueprint)
112111
: undefined
113112
}
114113
fill={fullWidth}

0 commit comments

Comments
 (0)