@xqmsg/ui-core 0.24.4 → 0.24.6

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
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.24.4",
2
+ "version": "0.24.6",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -4,7 +4,6 @@ import { InputFieldProps } from '../InputTypes';
4
4
 
5
5
  export interface StackedInputProps extends InputFieldProps {
6
6
  isRequired?: boolean;
7
- allowDefault?: boolean;
8
7
  leftElement?: React.ReactNode;
9
8
  rightElement?: React.ReactNode;
10
9
  variant?: string;
@@ -22,7 +21,6 @@ const StackedInput = React.forwardRef<HTMLInputElement, StackedInputProps>(
22
21
  rightElement,
23
22
  leftElement,
24
23
  defaultValue,
25
- allowDefault,
26
24
  variant,
27
25
  label,
28
26
  ...props
@@ -44,12 +42,6 @@ const StackedInput = React.forwardRef<HTMLInputElement, StackedInputProps>(
44
42
  defaultValue={defaultValue}
45
43
  fontSize={isMobile ? '17px' : '13px'}
46
44
  variant={variant}
47
- onKeyDown={e => {
48
- if (e.key === 'Enter' && !allowDefault) {
49
- e.stopPropagation();
50
- e.preventDefault();
51
- }
52
- }}
53
45
  />
54
46
  {rightElement && rightElement}
55
47
  </InputGroup>
@@ -20,6 +20,7 @@ export interface StackedPilledInputProps extends InputFieldProps {
20
20
  separators?: string[];
21
21
  variant?: string;
22
22
  label?: string;
23
+ truncatePillLength?: number;
23
24
  }
24
25
 
25
26
  /**
@@ -39,6 +40,7 @@ const StackedPilledInput = React.forwardRef<
39
40
  separators = ['Enter', ' ', ',', ';', 'Tab'],
40
41
  variant,
41
42
  label,
43
+ truncatePillLength,
42
44
  },
43
45
  _ref
44
46
  ) => {
@@ -332,6 +334,7 @@ const StackedPilledInput = React.forwardRef<
332
334
  onRemoveTag(index);
333
335
  }}
334
336
  isMobile={isMobile}
337
+ truncateLength={truncatePillLength}
335
338
  />
336
339
  </Box>
337
340
  ))
@@ -4,7 +4,6 @@ import { TextareaFieldProps } from '../InputTypes';
4
4
 
5
5
  export interface StackedTextareaProps extends TextareaFieldProps {
6
6
  isRequired?: boolean;
7
- allowDefault?: boolean;
8
7
  variant: string;
9
8
  label?: string;
10
9
  }
@@ -15,7 +14,7 @@ export interface StackedTextareaProps extends TextareaFieldProps {
15
14
  const StackedTextarea = React.forwardRef<
16
15
  HTMLTextAreaElement,
17
16
  StackedTextareaProps
18
- >(({ isRequired, allowDefault, variant, label, ...props }, _ref) => {
17
+ >(({ isRequired, variant, label, ...props }, _ref) => {
19
18
  const isMobile = variant === 'mobile';
20
19
  if (isMobile) {
21
20
  return (
@@ -26,30 +25,11 @@ const StackedTextarea = React.forwardRef<
26
25
  variant={variant}
27
26
  fontSize="17px"
28
27
  placeholder={label ?? ''}
29
- onKeyDown={e => {
30
- if (e.key === 'Enter' && !allowDefault) {
31
- e.stopPropagation();
32
- e.preventDefault();
33
- }
34
- }}
35
28
  />
36
29
  </Flex>
37
30
  );
38
31
  }
39
- return (
40
- <Textarea
41
- ref={_ref}
42
- {...props}
43
- variant={variant}
44
- fontSize="13px"
45
- onKeyDown={e => {
46
- if (e.key === 'Enter' && !allowDefault) {
47
- e.stopPropagation();
48
- e.preventDefault();
49
- }
50
- }}
51
- />
52
- );
32
+ return <Textarea ref={_ref} {...props} variant={variant} fontSize="13px" />;
53
33
  });
54
34
 
55
35
  export default StackedTextarea;
@@ -8,10 +8,16 @@ export interface TokenProps {
8
8
  label: any;
9
9
  onDelete: any;
10
10
  isMobile?: boolean;
11
+ truncateLength?: number;
11
12
  }
12
13
 
13
14
  // For v1 we are truncating the label at 15 characters to avoid overflow
14
- const Token: React.FC<TokenProps> = ({ label, onDelete, isMobile = false }) => {
15
+ const Token: React.FC<TokenProps> = ({
16
+ label,
17
+ onDelete,
18
+ isMobile = false,
19
+ truncateLength = 15,
20
+ }) => {
15
21
  return (
16
22
  <Flex
17
23
  key={label}
@@ -33,7 +39,7 @@ const Token: React.FC<TokenProps> = ({ label, onDelete, isMobile = false }) => {
33
39
  pr="4px"
34
40
  >
35
41
  {truncate(label.trim(), {
36
- length: 15,
42
+ length: truncateLength,
37
43
  omission: '...',
38
44
  })}
39
45
  </Text>
@@ -47,11 +47,11 @@ export interface InputProps<T extends FieldValues = FieldValues>
47
47
  setError: UseFormSetError<T>;
48
48
  clearErrors: UseFormClearErrors<T>;
49
49
  leftElement?: React.ReactNode;
50
- allowDefault?: boolean;
51
50
  rightElement?: React.ReactNode;
52
51
  variant?: string;
53
52
  separators?: string[];
54
53
  loadingOptions?: boolean;
54
+ truncatePillLength?: number;
55
55
  }
56
56
 
57
57
  /**
@@ -78,7 +78,6 @@ export function Input<T extends FieldValues>({
78
78
  disabled,
79
79
  rightElement,
80
80
  leftElement,
81
- allowDefault,
82
81
  variant = 'default',
83
82
  onChange,
84
83
  setValue,
@@ -86,6 +85,7 @@ export function Input<T extends FieldValues>({
86
85
  clearErrors,
87
86
  separators,
88
87
  loadingOptions = false,
88
+ truncatePillLength,
89
89
  }: InputProps<T>) {
90
90
  function selectedInputField<T extends Element = Element>(
91
91
  onChange: ((e: ChangeEvent<T>) => void) | ((v?: string) => void),
@@ -113,7 +113,6 @@ export function Input<T extends FieldValues>({
113
113
  disabled={disabled}
114
114
  defaultValue={defaultValue}
115
115
  value={value}
116
- allowDefault={allowDefault}
117
116
  variant={variant}
118
117
  label={label as string}
119
118
  />
@@ -235,6 +234,7 @@ export function Input<T extends FieldValues>({
235
234
  variant={variant}
236
235
  label={label}
237
236
  separators={separators}
237
+ truncatePillLength={truncatePillLength}
238
238
  />
239
239
  );
240
240
  case 'switch':
@@ -38,7 +38,6 @@ export interface SelectNativeProps<T extends FieldValues>
38
38
  setValue: UseFormSetValue<T>;
39
39
  setError: UseFormSetError<T>;
40
40
  clearErrors: UseFormClearErrors<T>;
41
- allowDefault?: boolean;
42
41
  }
43
42
 
44
43
  /**