@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.
@@ -2,7 +2,6 @@ import React from 'react';
2
2
  import { InputFieldProps } from '../InputTypes';
3
3
  export interface StackedInputProps extends InputFieldProps {
4
4
  isRequired?: boolean;
5
- allowDefault?: boolean;
6
5
  leftElement?: React.ReactNode;
7
6
  rightElement?: React.ReactNode;
8
7
  variant?: string;
@@ -9,6 +9,7 @@ export interface StackedPilledInputProps extends InputFieldProps {
9
9
  separators?: string[];
10
10
  variant?: string;
11
11
  label?: string;
12
+ truncatePillLength?: number;
12
13
  }
13
14
  /**
14
15
  * A functional React component utilized to render the `StackedPilledInput` component.
@@ -2,7 +2,6 @@ import React from 'react';
2
2
  import { TextareaFieldProps } from '../InputTypes';
3
3
  export interface StackedTextareaProps extends TextareaFieldProps {
4
4
  isRequired?: boolean;
5
- allowDefault?: boolean;
6
5
  variant: string;
7
6
  label?: string;
8
7
  }
@@ -3,6 +3,7 @@ export interface TokenProps {
3
3
  label: any;
4
4
  onDelete: any;
5
5
  isMobile?: boolean;
6
+ truncateLength?: number;
6
7
  }
7
8
  declare const Token: React.FC<TokenProps>;
8
9
  export default Token;
@@ -21,14 +21,14 @@ export interface InputProps<T extends FieldValues = FieldValues> extends Validat
21
21
  setError: UseFormSetError<T>;
22
22
  clearErrors: UseFormClearErrors<T>;
23
23
  leftElement?: React.ReactNode;
24
- allowDefault?: boolean;
25
24
  rightElement?: React.ReactNode;
26
25
  variant?: string;
27
26
  separators?: string[];
28
27
  loadingOptions?: boolean;
28
+ truncatePillLength?: number;
29
29
  }
30
30
  /**
31
31
  * A functional React component utilized to render the `Input` component. Utilizes a switch statement
32
32
  * to render the correct input based on the `inputType`.
33
33
  */
34
- export declare function Input<T extends FieldValues>({ inputType, label, ariaLabel, className, placeholder, name, helperText, options, tooltipText, isInvalid, errorText, isRequired, maxLength, defaultValue, fullOptions, control, disabled, rightElement, leftElement, allowDefault, variant, onChange, setValue, setError, clearErrors, separators, loadingOptions, }: InputProps<T>): React.JSX.Element;
34
+ export declare function Input<T extends FieldValues>({ inputType, label, ariaLabel, className, placeholder, name, helperText, options, tooltipText, isInvalid, errorText, isRequired, maxLength, defaultValue, fullOptions, control, disabled, rightElement, leftElement, variant, onChange, setValue, setError, clearErrors, separators, loadingOptions, truncatePillLength, }: InputProps<T>): React.JSX.Element;
@@ -20,7 +20,6 @@ export interface SelectNativeProps<T extends FieldValues> extends ValidationProp
20
20
  setValue: UseFormSetValue<T>;
21
21
  setError: UseFormSetError<T>;
22
22
  clearErrors: UseFormClearErrors<T>;
23
- allowDefault?: boolean;
24
23
  }
25
24
  /**
26
25
  * A functional React component utilized to render the `SelectNative` component.
@@ -814,7 +814,7 @@ function _objectWithoutPropertiesLoose(source, excluded) {
814
814
  return target;
815
815
  }
816
816
 
817
- var _excluded = ["type", "isRequired", "rightElement", "leftElement", "defaultValue", "allowDefault", "variant", "label"];
817
+ var _excluded = ["type", "isRequired", "rightElement", "leftElement", "defaultValue", "variant", "label"];
818
818
  /**
819
819
  * A functional React component utilized to render the `StackedInput` component.
820
820
  */
@@ -825,7 +825,6 @@ var StackedInput = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref)
825
825
  rightElement = _ref2.rightElement,
826
826
  leftElement = _ref2.leftElement,
827
827
  defaultValue = _ref2.defaultValue,
828
- allowDefault = _ref2.allowDefault,
829
828
  variant = _ref2.variant,
830
829
  label = _ref2.label,
831
830
  props = _objectWithoutPropertiesLoose(_ref2, _excluded);
@@ -838,13 +837,7 @@ var StackedInput = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref)
838
837
  ref: _ref,
839
838
  defaultValue: defaultValue,
840
839
  fontSize: isMobile ? '17px' : '13px',
841
- variant: variant,
842
- onKeyDown: function onKeyDown(e) {
843
- if (e.key === 'Enter' && !allowDefault) {
844
- e.stopPropagation();
845
- e.preventDefault();
846
- }
847
- }
840
+ variant: variant
848
841
  })), rightElement && rightElement);
849
842
  });
850
843
 
@@ -1222,13 +1215,12 @@ var StackedSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref
1222
1215
  }));
1223
1216
  });
1224
1217
 
1225
- var _excluded$2 = ["isRequired", "allowDefault", "variant", "label"];
1218
+ var _excluded$2 = ["isRequired", "variant", "label"];
1226
1219
  /**
1227
1220
  * A functional React component utilized to render the `StackedTextarea` component.
1228
1221
  */
1229
1222
  var StackedTextarea = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref) {
1230
- var allowDefault = _ref2.allowDefault,
1231
- variant = _ref2.variant,
1223
+ var variant = _ref2.variant,
1232
1224
  label = _ref2.label,
1233
1225
  props = _objectWithoutPropertiesLoose(_ref2, _excluded$2);
1234
1226
  var isMobile = variant === 'mobile';
@@ -1238,26 +1230,14 @@ var StackedTextarea = /*#__PURE__*/React__default.forwardRef(function (_ref2, _r
1238
1230
  }, props, {
1239
1231
  variant: variant,
1240
1232
  fontSize: "17px",
1241
- placeholder: label != null ? label : '',
1242
- onKeyDown: function onKeyDown(e) {
1243
- if (e.key === 'Enter' && !allowDefault) {
1244
- e.stopPropagation();
1245
- e.preventDefault();
1246
- }
1247
- }
1233
+ placeholder: label != null ? label : ''
1248
1234
  })));
1249
1235
  }
1250
1236
  return /*#__PURE__*/React__default.createElement(react.Textarea, Object.assign({
1251
1237
  ref: _ref
1252
1238
  }, props, {
1253
1239
  variant: variant,
1254
- fontSize: "13px",
1255
- onKeyDown: function onKeyDown(e) {
1256
- if (e.key === 'Enter' && !allowDefault) {
1257
- e.stopPropagation();
1258
- e.preventDefault();
1259
- }
1260
- }
1240
+ fontSize: "13px"
1261
1241
  }));
1262
1242
  });
1263
1243
 
@@ -1299,7 +1279,9 @@ var Token = function Token(_ref) {
1299
1279
  var label = _ref.label,
1300
1280
  onDelete = _ref.onDelete,
1301
1281
  _ref$isMobile = _ref.isMobile,
1302
- isMobile = _ref$isMobile === void 0 ? false : _ref$isMobile;
1282
+ isMobile = _ref$isMobile === void 0 ? false : _ref$isMobile,
1283
+ _ref$truncateLength = _ref.truncateLength,
1284
+ truncateLength = _ref$truncateLength === void 0 ? 15 : _ref$truncateLength;
1303
1285
  return /*#__PURE__*/React__default.createElement(react.Flex, {
1304
1286
  key: label,
1305
1287
  borderRadius: 'full',
@@ -1318,7 +1300,7 @@ var Token = function Token(_ref) {
1318
1300
  fontSize: isMobile ? '17px' : '13px',
1319
1301
  pr: "4px"
1320
1302
  }, lodash.truncate(label.trim(), {
1321
- length: 15,
1303
+ length: truncateLength,
1322
1304
  omission: '...'
1323
1305
  })), /*#__PURE__*/React__default.createElement(Close, {
1324
1306
  boxSize: isMobile ? '17px' : '11px',
@@ -1631,7 +1613,8 @@ var StackedPilledInput = /*#__PURE__*/React__default.forwardRef(function (_ref2,
1631
1613
  _ref2$separators = _ref2.separators,
1632
1614
  separators = _ref2$separators === void 0 ? ['Enter', ' ', ',', ';', 'Tab'] : _ref2$separators,
1633
1615
  variant = _ref2.variant,
1634
- label = _ref2.label;
1616
+ label = _ref2.label,
1617
+ truncatePillLength = _ref2.truncatePillLength;
1635
1618
  var watchedValue = reactHookForm.useWatch({
1636
1619
  control: control,
1637
1620
  name: name
@@ -1840,7 +1823,8 @@ var StackedPilledInput = /*#__PURE__*/React__default.forwardRef(function (_ref2,
1840
1823
  e.preventDefault();
1841
1824
  onRemoveTag(index);
1842
1825
  },
1843
- isMobile: isMobile
1826
+ isMobile: isMobile,
1827
+ truncateLength: truncatePillLength
1844
1828
  }));
1845
1829
  }) : null, !lastestFormValueToArray.length && !isFocussed ? /*#__PURE__*/React__default.createElement(react.Text, {
1846
1830
  color: colors.label.secondary.light,
@@ -1951,7 +1935,6 @@ function Input(_ref) {
1951
1935
  disabled = _ref.disabled,
1952
1936
  rightElement = _ref.rightElement,
1953
1937
  leftElement = _ref.leftElement,
1954
- allowDefault = _ref.allowDefault,
1955
1938
  _ref$variant = _ref.variant,
1956
1939
  variant = _ref$variant === void 0 ? 'default' : _ref$variant,
1957
1940
  onChange = _ref.onChange,
@@ -1960,7 +1943,8 @@ function Input(_ref) {
1960
1943
  clearErrors = _ref.clearErrors,
1961
1944
  separators = _ref.separators,
1962
1945
  _ref$loadingOptions = _ref.loadingOptions,
1963
- loadingOptions = _ref$loadingOptions === void 0 ? false : _ref$loadingOptions;
1946
+ loadingOptions = _ref$loadingOptions === void 0 ? false : _ref$loadingOptions,
1947
+ truncatePillLength = _ref.truncatePillLength;
1964
1948
  function selectedInputField(onChange, onBlur, ref, value) {
1965
1949
  switch (inputType) {
1966
1950
  case 'text':
@@ -1981,7 +1965,6 @@ function Input(_ref) {
1981
1965
  disabled: disabled,
1982
1966
  defaultValue: defaultValue,
1983
1967
  value: value,
1984
- allowDefault: allowDefault,
1985
1968
  variant: variant,
1986
1969
  label: label
1987
1970
  });
@@ -2090,7 +2073,8 @@ function Input(_ref) {
2090
2073
  maxLength: maxLength,
2091
2074
  variant: variant,
2092
2075
  label: label,
2093
- separators: separators
2076
+ separators: separators,
2077
+ truncatePillLength: truncatePillLength
2094
2078
  });
2095
2079
  case 'switch':
2096
2080
  return /*#__PURE__*/React__default.createElement(StackedSwitch, {