@eccenca/gui-elements 23.7.0-rc.0 → 23.7.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/dist/cjs/cmem/markdown/Markdown.js +1 -1
- package/dist/cjs/cmem/markdown/Markdown.js.map +1 -1
- package/dist/cjs/common/index.js +2 -0
- package/dist/cjs/common/index.js.map +1 -1
- package/dist/cjs/common/utils/getScrollParent.js +24 -0
- package/dist/cjs/common/utils/getScrollParent.js.map +1 -0
- package/dist/cjs/components/AutocompleteField/AutoCompleteField.js +19 -2
- package/dist/cjs/components/AutocompleteField/AutoCompleteField.js.map +1 -1
- package/dist/cjs/components/Breadcrumb/BreadcrumbList.js +1 -1
- package/dist/cjs/components/Breadcrumb/BreadcrumbList.js.map +1 -1
- package/dist/cjs/components/Card/Card.js +3 -1
- package/dist/cjs/components/Card/Card.js.map +1 -1
- package/dist/cjs/components/MultiSelect/MultiSelect.js +6 -5
- package/dist/cjs/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/cjs/components/Sticky/StickyTarget.js +85 -0
- package/dist/cjs/components/Sticky/StickyTarget.js.map +1 -0
- package/dist/cjs/components/Sticky/index.js +14 -0
- package/dist/cjs/components/Sticky/index.js.map +1 -0
- package/dist/cjs/components/TextField/TextArea.js +85 -8
- package/dist/cjs/components/TextField/TextArea.js.map +1 -1
- package/dist/cjs/components/index.js +1 -0
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/esm/cmem/markdown/Markdown.js +1 -1
- package/dist/esm/cmem/markdown/Markdown.js.map +1 -1
- package/dist/esm/common/index.js +2 -0
- package/dist/esm/common/index.js.map +1 -1
- package/dist/esm/common/utils/getScrollParent.js +20 -0
- package/dist/esm/common/utils/getScrollParent.js.map +1 -0
- package/dist/esm/components/AutocompleteField/AutoCompleteField.js +27 -2
- package/dist/esm/components/AutocompleteField/AutoCompleteField.js.map +1 -1
- package/dist/esm/components/Breadcrumb/BreadcrumbList.js +1 -1
- package/dist/esm/components/Breadcrumb/BreadcrumbList.js.map +1 -1
- package/dist/esm/components/Card/Card.js +4 -2
- package/dist/esm/components/Card/Card.js.map +1 -1
- package/dist/esm/components/MultiSelect/MultiSelect.js +6 -5
- package/dist/esm/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/esm/components/Sticky/StickyTarget.js +89 -0
- package/dist/esm/components/Sticky/StickyTarget.js.map +1 -0
- package/dist/esm/components/Sticky/index.js +2 -0
- package/dist/esm/components/Sticky/index.js.map +1 -0
- package/dist/esm/components/TextField/TextArea.js +86 -9
- package/dist/esm/components/TextField/TextArea.js.map +1 -1
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/types/common/index.d.ts +2 -0
- package/dist/types/common/utils/getScrollParent.d.ts +9 -0
- package/dist/types/components/AutocompleteField/AutoCompleteField.d.ts +2 -0
- package/dist/types/components/Breadcrumb/BreadcrumbList.d.ts +2 -1
- package/dist/types/components/Card/Card.d.ts +8 -2
- package/dist/types/components/Sticky/StickyTarget.d.ts +32 -0
- package/dist/types/components/Sticky/index.d.ts +1 -0
- package/dist/types/components/TextField/TextArea.d.ts +28 -3
- package/dist/types/components/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/cmem/markdown/Markdown.tsx +1 -1
- package/src/common/index.ts +3 -0
- package/src/common/utils/getScrollParent.ts +20 -0
- package/src/components/Application/application.scss +0 -1
- package/src/components/AutocompleteField/AutoCompleteField.tsx +28 -0
- package/src/components/AutocompleteField/autocompletefield.scss +1 -1
- package/src/components/Breadcrumb/BreadcrumbList.tsx +3 -3
- package/src/components/Card/Card.tsx +15 -3
- package/src/components/Card/card.scss +6 -1
- package/src/components/Icon/stories/Icon.stories.tsx +1 -1
- package/src/components/MultiSelect/MultiSelect.tsx +8 -4
- package/src/components/MultiSuggestField/MultiSuggestField.stories.tsx +76 -1
- package/src/components/MultiSuggestField/tests/MultiSuggestField.test.tsx +297 -109
- package/src/components/Sticky/StickyTarget.tsx +119 -0
- package/src/components/Sticky/index.ts +1 -0
- package/src/components/Sticky/sticky.scss +69 -0
- package/src/components/Sticky/stories/StickyTarget.stories.tsx +63 -0
- package/src/components/TextField/TextArea.tsx +174 -12
- package/src/components/TextField/stories/TextArea.stories.tsx +39 -12
- package/src/components/TextField/textfield.scss +78 -11
- package/src/components/index.scss +1 -0
- package/src/components/index.ts +1 -0
- package/src/includes/blueprintjs/_requisits.scss +1 -1
- package/src/includes/blueprintjs/_variables.scss +3 -172
- package/src/includes/carbon-components/_requisits.scss +1 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { LoremIpsum } from "react-lorem-ipsum";
|
|
3
|
+
import { Meta, Story } from "@storybook/react";
|
|
4
|
+
|
|
5
|
+
import { HtmlContentBlock, StickyTarget } from "../../../../index";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: "Components/StickyTarget",
|
|
9
|
+
component: StickyTarget,
|
|
10
|
+
argTypes: {},
|
|
11
|
+
} as Meta<typeof StickyTarget>;
|
|
12
|
+
|
|
13
|
+
const Template: Story<typeof StickyTarget> = (args) => (
|
|
14
|
+
<div style={{ height: "10rem", overflow: "auto", position: "relative" }}>
|
|
15
|
+
<HtmlContentBlock>
|
|
16
|
+
{args.getConnectedElement && args.to !== "bottom" && (
|
|
17
|
+
<p
|
|
18
|
+
id="connected-element"
|
|
19
|
+
style={{ background: "red", color: "white", padding: "0.5rem", position: "fixed", top: "20px" }}
|
|
20
|
+
>
|
|
21
|
+
Top element.
|
|
22
|
+
</p>
|
|
23
|
+
)}
|
|
24
|
+
<LoremIpsum p={3} avgSentencesPerParagraph={5} random={false} />
|
|
25
|
+
<StickyTarget {...args} style={args.to === "bottom" ? { zIndex: 2 } : undefined}>
|
|
26
|
+
<p style={{ color: "red", padding: "0.5rem" }}>First sticky element.</p>
|
|
27
|
+
</StickyTarget>
|
|
28
|
+
<LoremIpsum p={5} avgSentencesPerParagraph={5} random={false} />
|
|
29
|
+
<div>
|
|
30
|
+
<StickyTarget {...args}>
|
|
31
|
+
<p style={{ color: "green", padding: "0.5rem" }}>Sticky element.</p>
|
|
32
|
+
</StickyTarget>
|
|
33
|
+
<LoremIpsum p={5} avgSentencesPerParagraph={5} random={false} />
|
|
34
|
+
</div>
|
|
35
|
+
<StickyTarget {...args}>
|
|
36
|
+
<p style={{ color: "blue", padding: "0.5rem" }}>Another sticky element.</p>
|
|
37
|
+
</StickyTarget>
|
|
38
|
+
<LoremIpsum p={5} avgSentencesPerParagraph={5} random={false} />
|
|
39
|
+
{args.getConnectedElement && args.to === "bottom" && (
|
|
40
|
+
<p
|
|
41
|
+
id="connected-element"
|
|
42
|
+
style={{ background: "red", color: "white", padding: "0.5rem", position: "fixed", bottom: "20px" }}
|
|
43
|
+
>
|
|
44
|
+
Bottom element.
|
|
45
|
+
</p>
|
|
46
|
+
)}
|
|
47
|
+
</HtmlContentBlock>
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
export const Default = Template.bind({});
|
|
52
|
+
Default.args = {
|
|
53
|
+
className: "stickytarget-extraclass",
|
|
54
|
+
"data-test-id": "stickytarget-test-id",
|
|
55
|
+
"data-testid": "stickytarget-testid",
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const ConnectedElement = Template.bind({});
|
|
59
|
+
ConnectedElement.args = {
|
|
60
|
+
getConnectedElement: () => {
|
|
61
|
+
return window.document.getElementById("connected-element") || false;
|
|
62
|
+
},
|
|
63
|
+
};
|
|
@@ -1,35 +1,63 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import {
|
|
3
|
+
Classes as BlueprintClassNames,
|
|
3
4
|
Intent as BlueprintIntent,
|
|
5
|
+
MaybeElement,
|
|
4
6
|
TextArea as BlueprintTextArea,
|
|
5
7
|
TextAreaProps as BlueprintTextAreaProps,
|
|
6
8
|
} from "@blueprintjs/core";
|
|
7
9
|
|
|
10
|
+
import { Definitions as IntentDefinitions, IntentTypes } from "../../common/Intent";
|
|
8
11
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
12
|
+
import { Icon } from "../Icon";
|
|
13
|
+
import { ValidIconName } from "../Icon/canonicalIconNames";
|
|
9
14
|
|
|
10
15
|
import { InvisibleCharacterWarningProps, useTextValidation } from "./useTextValidation";
|
|
11
16
|
|
|
12
|
-
export interface TextAreaProps extends
|
|
17
|
+
export interface TextAreaProps extends Omit<BlueprintTextAreaProps, "intent"> {
|
|
13
18
|
/**
|
|
14
19
|
* when set to true the input takes a blue border color
|
|
20
|
+
* @deprecated Use the `intent` property.
|
|
15
21
|
*/
|
|
16
22
|
hasStatePrimary?: boolean;
|
|
17
23
|
/**
|
|
18
24
|
* when set to true the input takes a green border color
|
|
25
|
+
* @deprecated Use the `intent` property.
|
|
19
26
|
*/
|
|
20
27
|
hasStateSuccess?: boolean;
|
|
21
28
|
/**
|
|
22
29
|
* when set to true the input takes an orange border color
|
|
30
|
+
* @deprecated Use the `intent` property.
|
|
23
31
|
*/
|
|
24
32
|
hasStateWarning?: boolean;
|
|
25
33
|
/**
|
|
26
34
|
* when set to true the input takes a red border color
|
|
35
|
+
* @deprecated Use the `intent` property.
|
|
27
36
|
*/
|
|
28
37
|
hasStateDanger?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Intent state of the text area.
|
|
40
|
+
*/
|
|
41
|
+
intent?: IntentTypes | "edited" | "removed";
|
|
29
42
|
/**
|
|
30
43
|
* If set, allows to be informed of invisible, hard to spot characters in the string value.
|
|
31
44
|
*/
|
|
32
45
|
invisibleCharacterWarning?: InvisibleCharacterWarningProps;
|
|
46
|
+
/**
|
|
47
|
+
* Left aligned icon, can be a canonical icon name or an `Icon` element.
|
|
48
|
+
* This will update left padding on the text area.
|
|
49
|
+
*/
|
|
50
|
+
leftIcon?: ValidIconName | MaybeElement;
|
|
51
|
+
/**
|
|
52
|
+
* Element to render on right side of text area. Should be not too large.
|
|
53
|
+
* This will update right padding on the text area.
|
|
54
|
+
*/
|
|
55
|
+
rightElement?: JSX.Element;
|
|
56
|
+
/**
|
|
57
|
+
* Add HTML properties to the wrapper element.
|
|
58
|
+
* The element wraps `TextArea` in case of a given `wrapperDivProps`, `leftIcon` or `rightElement` property.
|
|
59
|
+
*/
|
|
60
|
+
wrapperDivProps?: Omit<React.HTMLAttributes<HTMLDivElement>, "children">;
|
|
33
61
|
}
|
|
34
62
|
|
|
35
63
|
export const TextArea = ({
|
|
@@ -40,38 +68,172 @@ export const TextArea = ({
|
|
|
40
68
|
hasStateDanger = false,
|
|
41
69
|
rows = 5,
|
|
42
70
|
invisibleCharacterWarning,
|
|
71
|
+
leftIcon,
|
|
72
|
+
rightElement,
|
|
73
|
+
wrapperDivProps,
|
|
43
74
|
...otherProps
|
|
44
75
|
}: TextAreaProps) => {
|
|
45
|
-
|
|
76
|
+
const textAreaCallback = React.useCallback(
|
|
77
|
+
(textAreaElement: HTMLTextAreaElement) => {
|
|
78
|
+
if (textAreaElement && typeof textAreaElement === "object") {
|
|
79
|
+
let textAreaStyle: CSSStyleDeclaration;
|
|
80
|
+
if (!textAreaElement.dataset.processed) {
|
|
81
|
+
textAreaStyle = getComputedStyle(textAreaElement);
|
|
82
|
+
textAreaElement.dataset.processed = "yes";
|
|
83
|
+
textAreaElement.dataset.paddingtop = textAreaStyle.paddingTop ?? "0px";
|
|
84
|
+
textAreaElement.dataset.paddingleft = textAreaStyle.paddingLeft ?? "0px";
|
|
85
|
+
textAreaElement.dataset.paddingright = textAreaStyle.paddingRight ?? "0px";
|
|
86
|
+
} else {
|
|
87
|
+
textAreaStyle = {
|
|
88
|
+
paddingTop: textAreaElement.dataset.paddingtop ?? "0px",
|
|
89
|
+
paddingLeft: textAreaElement.dataset.paddingleft ?? "0px",
|
|
90
|
+
paddingRight: textAreaElement.dataset.paddingright ?? "0px",
|
|
91
|
+
} as CSSStyleDeclaration;
|
|
92
|
+
}
|
|
93
|
+
const textAreaElementRect = textAreaElement.getBoundingClientRect();
|
|
94
|
+
const wrapperElement = textAreaElement.parentElement;
|
|
95
|
+
|
|
96
|
+
if (leftIcon && wrapperElement) {
|
|
97
|
+
const leftIconElement = wrapperElement.querySelector(`.${eccgui}-textarea__icon`) as HTMLElement;
|
|
98
|
+
const leftIconElementRect = leftIconElement.getBoundingClientRect();
|
|
99
|
+
if (
|
|
100
|
+
parseInt(textAreaStyle.paddingTop, 10) * 2 + (leftIconElementRect.height ?? 0) <=
|
|
101
|
+
(textAreaElementRect.height ?? 0)
|
|
102
|
+
) {
|
|
103
|
+
leftIconElement.style.setProperty("top", textAreaStyle.paddingTop);
|
|
104
|
+
} else {
|
|
105
|
+
leftIconElement.style.setProperty(
|
|
106
|
+
"top",
|
|
107
|
+
`${((textAreaElementRect.height ?? 0) - (leftIconElementRect.height ?? 0)) * 0.5}px`
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
leftIconElement.style.setProperty("left", textAreaStyle.paddingLeft);
|
|
111
|
+
textAreaElement.style.setProperty(
|
|
112
|
+
"padding-left",
|
|
113
|
+
`calc(${leftIconElementRect.width ? 2 : 1} * ${textAreaStyle.paddingLeft} + ${
|
|
114
|
+
leftIconElementRect.width ?? 0
|
|
115
|
+
}px)`
|
|
116
|
+
);
|
|
117
|
+
leftIconElement.addEventListener("click", (_event: MouseEvent) => {
|
|
118
|
+
textAreaElement.focus();
|
|
119
|
+
}); //onclick((_event: MouseEvent) => {textAreaElement.dispatchEvent("click")})
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (rightElement && wrapperElement) {
|
|
123
|
+
const rightElementElement = wrapperElement.querySelector(
|
|
124
|
+
`.${eccgui}-textarea__options`
|
|
125
|
+
) as HTMLElement;
|
|
126
|
+
const rightElementElementRect = rightElementElement.getBoundingClientRect();
|
|
127
|
+
if (
|
|
128
|
+
parseInt(textAreaStyle.paddingTop, 10) * 2 + (rightElementElementRect.height ?? 0) <=
|
|
129
|
+
(textAreaElementRect.height ?? 0)
|
|
130
|
+
) {
|
|
131
|
+
rightElementElement.style.setProperty("top", textAreaStyle.paddingTop);
|
|
132
|
+
} else {
|
|
133
|
+
rightElementElement.style.setProperty(
|
|
134
|
+
"top",
|
|
135
|
+
`${((textAreaElementRect.height ?? 0) - (rightElementElementRect.height ?? 0)) * 0.5}px`
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
rightElementElement.style.setProperty("right", textAreaStyle.paddingRight);
|
|
139
|
+
textAreaElement.style.setProperty(
|
|
140
|
+
"padding-right",
|
|
141
|
+
`calc(${rightElementElementRect.width ? 2 : 1} * ${textAreaStyle.paddingRight} + ${
|
|
142
|
+
rightElementElementRect.width ?? 0
|
|
143
|
+
}px)`
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
[leftIcon, rightElement]
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
let deprecatedIntent;
|
|
46
152
|
switch (true) {
|
|
47
153
|
case hasStatePrimary:
|
|
48
|
-
|
|
154
|
+
deprecatedIntent = IntentDefinitions.PRIMARY;
|
|
49
155
|
break;
|
|
50
156
|
case hasStateSuccess:
|
|
51
|
-
|
|
157
|
+
deprecatedIntent = IntentDefinitions.SUCCESS;
|
|
52
158
|
break;
|
|
53
159
|
case hasStateWarning:
|
|
54
|
-
|
|
160
|
+
deprecatedIntent = IntentDefinitions.WARNING;
|
|
55
161
|
break;
|
|
56
162
|
case hasStateDanger:
|
|
57
|
-
|
|
163
|
+
deprecatedIntent = IntentDefinitions.DANGER;
|
|
58
164
|
break;
|
|
59
165
|
default:
|
|
60
166
|
break;
|
|
61
167
|
}
|
|
62
168
|
|
|
63
|
-
const
|
|
169
|
+
const { intent = deprecatedIntent, ...otherBlueprintTextAreaProps } = otherProps;
|
|
64
170
|
|
|
65
|
-
|
|
171
|
+
let iconIntent;
|
|
172
|
+
switch (intent) {
|
|
173
|
+
case "edited":
|
|
174
|
+
iconIntent = IntentDefinitions.INFO;
|
|
175
|
+
break;
|
|
176
|
+
case "removed":
|
|
177
|
+
iconIntent = IntentDefinitions.DANGER;
|
|
178
|
+
break;
|
|
179
|
+
default:
|
|
180
|
+
iconIntent = intent as IntentTypes;
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const maybeWrappedOnChange = useTextValidation({ ...otherBlueprintTextAreaProps, invisibleCharacterWarning });
|
|
185
|
+
|
|
186
|
+
const textarea = (
|
|
66
187
|
<BlueprintTextArea
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
188
|
+
inputRef={textAreaCallback}
|
|
189
|
+
className={
|
|
190
|
+
`${eccgui}-textarea` +
|
|
191
|
+
(intent ? ` ${eccgui}-intent--${intent}` : "") +
|
|
192
|
+
(className ? ` ${className}` : "")
|
|
193
|
+
}
|
|
194
|
+
intent={
|
|
195
|
+
intent && !["info", "edited", "removed", "neutral"].includes(intent)
|
|
196
|
+
? (intent as BlueprintIntent)
|
|
197
|
+
: undefined
|
|
198
|
+
}
|
|
199
|
+
spellCheck={intent === "removed" ? false : undefined}
|
|
200
|
+
rows={
|
|
201
|
+
rows && !otherBlueprintTextAreaProps.autoResize && !otherBlueprintTextAreaProps.growVertically
|
|
202
|
+
? rows
|
|
203
|
+
: 1
|
|
204
|
+
}
|
|
205
|
+
{...otherBlueprintTextAreaProps}
|
|
71
206
|
dir={"auto"}
|
|
72
207
|
onChange={maybeWrappedOnChange}
|
|
73
208
|
/>
|
|
74
209
|
);
|
|
210
|
+
|
|
211
|
+
const { className: wrapperClassName, ...otherWrapperDivProps } = wrapperDivProps ?? {};
|
|
212
|
+
|
|
213
|
+
return wrapperDivProps || leftIcon || rightElement ? (
|
|
214
|
+
<div
|
|
215
|
+
className={`${eccgui}-textarea__wrapper` + (wrapperClassName ? ` ${wrapperClassName}` : "")}
|
|
216
|
+
{...otherWrapperDivProps}
|
|
217
|
+
>
|
|
218
|
+
{textarea}
|
|
219
|
+
{leftIcon && (
|
|
220
|
+
<div className={`${eccgui}-textarea__icon`}>
|
|
221
|
+
{typeof leftIcon === "string" ? (
|
|
222
|
+
<Icon
|
|
223
|
+
name={leftIcon as ValidIconName}
|
|
224
|
+
className={BlueprintClassNames.ICON}
|
|
225
|
+
intent={iconIntent as IntentTypes | undefined}
|
|
226
|
+
/>
|
|
227
|
+
) : (
|
|
228
|
+
<span className={BlueprintClassNames.ICON}>{leftIcon}</span>
|
|
229
|
+
)}
|
|
230
|
+
</div>
|
|
231
|
+
)}
|
|
232
|
+
{rightElement && <div className={`${eccgui}-textarea__options`}>{rightElement}</div>}
|
|
233
|
+
</div>
|
|
234
|
+
) : (
|
|
235
|
+
textarea
|
|
236
|
+
);
|
|
75
237
|
};
|
|
76
238
|
|
|
77
239
|
export default TextArea;
|
|
@@ -1,22 +1,49 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { Meta, StoryFn } from "@storybook/react";
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { helpersArgTypes } from "../../../../.storybook/helpers";
|
|
5
|
+
|
|
6
|
+
import { Button, IconButton, TextArea } from "./../../../../index";
|
|
7
|
+
type TextAreaType = typeof TextArea;
|
|
6
8
|
|
|
7
9
|
export default {
|
|
8
10
|
title: "Forms/TextArea",
|
|
9
|
-
component:
|
|
10
|
-
argTypes: {
|
|
11
|
-
|
|
11
|
+
component: TextArea,
|
|
12
|
+
argTypes: {
|
|
13
|
+
leftIcon: {
|
|
14
|
+
...helpersArgTypes.exampleIcon,
|
|
15
|
+
},
|
|
16
|
+
rightElement: {
|
|
17
|
+
control: helpersArgTypes.exampleIcon.control,
|
|
18
|
+
options: [...helpersArgTypes.exampleIcon.options, "Button element", "2 Icon buttons"],
|
|
19
|
+
mapping: {
|
|
20
|
+
...helpersArgTypes.exampleIcon.mapping,
|
|
21
|
+
"Button element": (
|
|
22
|
+
<Button small onClick={() => alert("clicked")}>
|
|
23
|
+
Button label
|
|
24
|
+
</Button>
|
|
25
|
+
),
|
|
26
|
+
"2 Icon buttons": (
|
|
27
|
+
<>
|
|
28
|
+
<IconButton name={"item-comment"} onClick={() => alert("1 clicked")} text="Button 1" />
|
|
29
|
+
<IconButton name={"item-edit"} onClick={() => alert("2 clicked")} text="Button 2" />
|
|
30
|
+
</>
|
|
31
|
+
),
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
intent: {
|
|
35
|
+
...helpersArgTypes.exampleIntent,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
} as Meta<TextAreaType>;
|
|
12
39
|
|
|
13
|
-
const Template:
|
|
40
|
+
const Template: StoryFn<TextAreaType> = (args) => <TextArea {...args}></TextArea>;
|
|
14
41
|
|
|
15
42
|
export const Default = Template.bind({});
|
|
16
43
|
Default.args = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
44
|
+
rows: 10,
|
|
45
|
+
wrapperDivProps: {
|
|
46
|
+
"data-test-id": "textarea-test-id",
|
|
47
|
+
"data-testid": "textarea-testid",
|
|
48
|
+
},
|
|
22
49
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@use "sass:math";
|
|
2
|
+
@use "sass:color";
|
|
2
3
|
|
|
3
4
|
// own vars
|
|
4
5
|
$eccgui-size-textfield-height-small: $eccgui-size-block-whitespace * 2 !default;
|
|
@@ -57,23 +58,31 @@ $input-button-height-small: math.div($eccgui-size-textfield-height-small, $eccgu
|
|
|
57
58
|
|
|
58
59
|
// enhancements
|
|
59
60
|
|
|
60
|
-
|
|
61
|
+
$eccgui-map-intent-bgcolors: (
|
|
62
|
+
"primary": $eccgui-color-info-background,
|
|
63
|
+
"success": $eccgui-color-success-background,
|
|
64
|
+
"warning": $eccgui-color-warning-background,
|
|
65
|
+
"danger": $eccgui-color-danger-background,
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
@mixin intent-state-flash-animation($state, $bgcolor, $mixratio: 24%) {
|
|
61
69
|
@keyframes intent-state-flash-#{$state} {
|
|
62
70
|
0% {
|
|
63
|
-
background-color: mix($bgcolor, $eccgui-color-textfield-background, $mixratio);
|
|
71
|
+
background-color: color.mix($bgcolor, $eccgui-color-textfield-background, $mixratio);
|
|
64
72
|
}
|
|
73
|
+
|
|
65
74
|
39% {
|
|
66
75
|
background-color: $bgcolor;
|
|
67
76
|
}
|
|
77
|
+
|
|
68
78
|
100% {
|
|
69
|
-
background-color: mix($bgcolor, $eccgui-color-textfield-background, $mixratio);
|
|
79
|
+
background-color: color.mix($bgcolor, $eccgui-color-textfield-background, $mixratio);
|
|
70
80
|
}
|
|
71
81
|
}
|
|
82
|
+
}
|
|
72
83
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
animation-name: intent-state-flash-#{$state};
|
|
76
|
-
}
|
|
84
|
+
@each $each-intent, $each-bgcolor in $eccgui-map-intent-bgcolors {
|
|
85
|
+
@include intent-state-flash-animation($each-intent, $each-bgcolor);
|
|
77
86
|
}
|
|
78
87
|
|
|
79
88
|
.#{$ns}-input {
|
|
@@ -82,10 +91,12 @@ $input-button-height-small: math.div($eccgui-size-textfield-height-small, $eccgu
|
|
|
82
91
|
animation-delay: 0.5s;
|
|
83
92
|
}
|
|
84
93
|
|
|
85
|
-
@
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
94
|
+
@each $each-intent, $each-bgcolor in $eccgui-map-intent-bgcolors {
|
|
95
|
+
.#{$ns}-input-group.#{$ns}-intent-#{$each-intent} & {
|
|
96
|
+
background-color: color.mix($each-bgcolor, $eccgui-color-textfield-background, 24%);
|
|
97
|
+
animation-name: intent-state-flash-#{$each-intent};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
89
100
|
|
|
90
101
|
.#{$ns}-input-group.#{$eccgui}-intent--info & {
|
|
91
102
|
@include pt-input-intent($eccgui-color-info-text);
|
|
@@ -114,6 +125,62 @@ $input-button-height-small: math.div($eccgui-size-textfield-height-small, $eccgu
|
|
|
114
125
|
|
|
115
126
|
.#{$eccgui}-textarea {
|
|
116
127
|
width: 100%;
|
|
128
|
+
|
|
129
|
+
&[class*="#{$eccgui}-intent--"] {
|
|
130
|
+
animation-duration: 1s;
|
|
131
|
+
animation-delay: 0.5s;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@each $each-intent, $each-bgcolor in $eccgui-map-intent-bgcolors {
|
|
135
|
+
&.#{$eccgui}-intent--#{$each-intent} {
|
|
136
|
+
background-color: color.mix($each-bgcolor, $eccgui-color-textfield-background, 24%);
|
|
137
|
+
animation-name: intent-state-flash-#{$each-intent};
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
&.#{$eccgui}-intent--info {
|
|
142
|
+
@include pt-input-intent($eccgui-color-info-text);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
&.#{$eccgui}-intent--accent {
|
|
146
|
+
@include pt-input-intent($eccgui-color-primary);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&.#{$eccgui}-intent--neutral {
|
|
150
|
+
@include pt-input-intent($eccgui-color-workspace-text);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
&.#{$eccgui}-intent--edited {
|
|
154
|
+
@include pt-input-intent($eccgui-color-info-text);
|
|
155
|
+
|
|
156
|
+
color: $eccgui-color-info-text;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
&.#{$eccgui}-intent--removed {
|
|
160
|
+
@include pt-input-intent($eccgui-color-danger-text);
|
|
161
|
+
|
|
162
|
+
text-decoration: line-through $eccgui-color-danger-text 2px;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
&.#{$ns}-text-area-auto-resize {
|
|
166
|
+
height: unset;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.#{$eccgui}-textarea__wrapper {
|
|
171
|
+
position: relative;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.#{$eccgui}-textarea__icon {
|
|
175
|
+
position: absolute;
|
|
176
|
+
top: 0;
|
|
177
|
+
left: 0;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.#{$eccgui}-textarea__options {
|
|
181
|
+
position: absolute;
|
|
182
|
+
top: 0;
|
|
183
|
+
right: 0;
|
|
117
184
|
}
|
|
118
185
|
|
|
119
186
|
.#{$eccgui}-textfield--justifyclearance {
|
package/src/components/index.ts
CHANGED
|
@@ -36,6 +36,7 @@ export * from "./Separation/Divider";
|
|
|
36
36
|
export * from "./Separation/Spacing";
|
|
37
37
|
export * from "./Skeleton/Skeleton";
|
|
38
38
|
export * from "./Spinner/Spinner";
|
|
39
|
+
export * from "./Sticky";
|
|
39
40
|
export * from "./Structure";
|
|
40
41
|
export * from "./Switch/Switch";
|
|
41
42
|
export * from "./Table";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
@import "~@blueprintjs/colors/src/colors";
|
|
2
|
-
@import "~@blueprintjs/core/src/common/variables";
|
|
2
|
+
@import "~@blueprintjs/core/src/common/variables-extended";
|
|
3
3
|
|
|
4
4
|
// future home for $icon-classes var @import "~@blueprintjs/core/src/common/variables-extended";
|
|
5
5
|
@import "~@blueprintjs/core/src/common/react-transition";
|