@bitrise/bitkit 12.93.1-alpha.2 → 12.94.0
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/package.json
CHANGED
|
@@ -14,7 +14,7 @@ import Tag from '../../Tag/Tag';
|
|
|
14
14
|
import Text from '../../Text/Text';
|
|
15
15
|
|
|
16
16
|
type UsedFormControlProps = Omit<FormControlProps, 'label' | 'onBlur' | 'onChange'>;
|
|
17
|
-
export interface
|
|
17
|
+
export interface TagsInputProps extends UsedFormControlProps {
|
|
18
18
|
label?: string;
|
|
19
19
|
placeholder?: string;
|
|
20
20
|
value: string[];
|
|
@@ -27,7 +27,7 @@ export interface ChipInputProps extends UsedFormControlProps {
|
|
|
27
27
|
helperText?: ReactNode;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
const
|
|
30
|
+
const TagsInput = ({
|
|
31
31
|
errorText,
|
|
32
32
|
helperText,
|
|
33
33
|
invalidValues = [],
|
|
@@ -39,9 +39,15 @@ const ChipInput = ({
|
|
|
39
39
|
separator = /[, ]/,
|
|
40
40
|
value,
|
|
41
41
|
...rest
|
|
42
|
-
}:
|
|
43
|
-
const theme = useStyleConfig('
|
|
42
|
+
}: TagsInputProps) => {
|
|
43
|
+
const theme = useStyleConfig('TagsInput');
|
|
44
44
|
const keyupHandler: KeyboardEventHandler<HTMLInputElement> = (ev) => {
|
|
45
|
+
const target = ev.currentTarget;
|
|
46
|
+
if (ev.key === 'Backspace' && target.value.length === 0) {
|
|
47
|
+
onRemove(value[value.length - 1]);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const keydownHandler: KeyboardEventHandler<HTMLInputElement> = (ev) => {
|
|
45
51
|
const target = ev.currentTarget;
|
|
46
52
|
if (ev.key.match(separator)) {
|
|
47
53
|
ev.preventDefault();
|
|
@@ -52,8 +58,6 @@ const ChipInput = ({
|
|
|
52
58
|
}
|
|
53
59
|
target.value = '';
|
|
54
60
|
}
|
|
55
|
-
} else if (ev.key === 'Backspace' && target.value.length === 0) {
|
|
56
|
-
onRemove(value[value.length - 1]);
|
|
57
61
|
}
|
|
58
62
|
};
|
|
59
63
|
const pasteEventHandler: ClipboardEventHandler<HTMLInputElement> = (ev) => {
|
|
@@ -131,7 +135,8 @@ const ChipInput = ({
|
|
|
131
135
|
_focusVisible={{ boxShadow: 'none' }}
|
|
132
136
|
flexGrow="1"
|
|
133
137
|
id={id}
|
|
134
|
-
onKeyDown={
|
|
138
|
+
onKeyDown={keydownHandler}
|
|
139
|
+
onKeyUp={keyupHandler}
|
|
135
140
|
onPaste={pasteEventHandler}
|
|
136
141
|
/>
|
|
137
142
|
{isInvalid && <Icon color="icon.negative" name="ErrorCircleFilled" position="absolute" right="16" />}
|
|
@@ -142,4 +147,4 @@ const ChipInput = ({
|
|
|
142
147
|
);
|
|
143
148
|
};
|
|
144
149
|
|
|
145
|
-
export default
|
|
150
|
+
export default TagsInput;
|
package/src/index.ts
CHANGED
|
@@ -334,5 +334,5 @@ export * from './Components/Filter/Filter.types';
|
|
|
334
334
|
export type { DateInputProps } from './Components/Form/DateInput/DateInput';
|
|
335
335
|
export { default as DateInput } from './Components/Form/DateInput/DateInput';
|
|
336
336
|
|
|
337
|
-
export type {
|
|
338
|
-
export { default as
|
|
337
|
+
export type { TagsInputProps } from './Components/Form/TagsInput/TagsInput';
|
|
338
|
+
export { default as TagsInput } from './Components/Form/TagsInput/TagsInput';
|
package/src/theme.ts
CHANGED
|
@@ -54,7 +54,7 @@ import zIndices from './Foundations/Zindex/Zindex';
|
|
|
54
54
|
import Toggletip from './Components/Toggletip/Toggletip.theme';
|
|
55
55
|
import FilterSwitch from './Components/Filter/FilterSwitch/FilterSwitch.theme';
|
|
56
56
|
import { colors, semanticTokens } from './tokens/tokens';
|
|
57
|
-
import
|
|
57
|
+
import TagsInput from './Components/Form/TagsInput/TagsInput.theme';
|
|
58
58
|
|
|
59
59
|
const theme = {
|
|
60
60
|
breakpoints,
|
|
@@ -79,7 +79,6 @@ const theme = {
|
|
|
79
79
|
FilterSwitch,
|
|
80
80
|
...Form,
|
|
81
81
|
Alert,
|
|
82
|
-
ChipInput,
|
|
83
82
|
CloseButton,
|
|
84
83
|
CodeBlock,
|
|
85
84
|
CodeSnippet,
|
|
@@ -109,6 +108,7 @@ const theme = {
|
|
|
109
108
|
Table,
|
|
110
109
|
Tabs,
|
|
111
110
|
Tag,
|
|
111
|
+
TagsInput,
|
|
112
112
|
Text,
|
|
113
113
|
Textarea,
|
|
114
114
|
Toggletip,
|
|
File without changes
|