@xqmsg/ui-core 0.16.6 → 0.16.8

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.16.6",
2
+ "version": "0.16.8",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -5,6 +5,7 @@ import { Input, InputProps } from '.';
5
5
  import { useFormHandler } from '../form/hooks/useFormHandler';
6
6
  import * as Yup from 'yup';
7
7
  import { Form } from '../form';
8
+ import { Flex, Grid, GridItem } from '@chakra-ui/react';
8
9
 
9
10
  const meta: Meta<InputProps<StoryFormSchema>> = {
10
11
  title: 'Input example',
@@ -58,8 +58,6 @@ const StackedMultiSelect = React.forwardRef<
58
58
  const [searchValue, setSearchValue] = useState('');
59
59
  const [debouncedSearchValue, setDebouncedSearchValue] = useState('');
60
60
 
61
- console.log({ searchValue, debouncedSearchValue });
62
-
63
61
  const boundingClientRect = dropdownRef.current?.getBoundingClientRect() as DOMRect;
64
62
 
65
63
  useEffect(() => {
@@ -74,12 +72,12 @@ const StackedMultiSelect = React.forwardRef<
74
72
 
75
73
  // gets latest watched form value (common delimited) from RHF state and creates a list
76
74
  useEffect(() => {
77
- if (watchedValue !== undefined && !watchedValue.length) {
75
+ if (watchedValue !== undefined && !watchedValue.length && !isInit) {
78
76
  setLocalValues([]);
79
77
  setIsInit(true);
80
78
  }
81
79
 
82
- if (watchedValue !== undefined && watchedValue?.length) {
80
+ if (watchedValue !== undefined && watchedValue?.length && !isInit) {
83
81
  if (shouldSideScroll) {
84
82
  (scrollRef.current as HTMLDivElement).scrollTo({
85
83
  left: scrollRef.current?.scrollWidth,
@@ -64,11 +64,10 @@ const StackedPilledInput = React.forwardRef<
64
64
 
65
65
  const onHandleKeyDown = (e: React.KeyboardEvent) => {
66
66
  if (
67
- (e.key === ' ' ||
68
- e.key === 'Enter' ||
69
- e.key === ',' ||
70
- e.key === 'Tab') &&
71
- localValue.length
67
+ e.key === ' ' ||
68
+ e.key === 'Enter' ||
69
+ e.key === ',' ||
70
+ e.key === 'Tab'
72
71
  ) {
73
72
  if (
74
73
  e.key === 'Enter' &&
@@ -221,7 +220,13 @@ const StackedPilledInput = React.forwardRef<
221
220
  setIsFocussed(false);
222
221
  };
223
222
 
224
- useOutsideClick({ ref: inputWrapperRef, handler: onBlur });
223
+ useOutsideClick({
224
+ ref: inputWrapperRef,
225
+ handler: () => {
226
+ onBlur();
227
+ console.log('hi');
228
+ },
229
+ });
225
230
 
226
231
  return (
227
232
  <Box position="relative">
@@ -234,6 +239,10 @@ const StackedPilledInput = React.forwardRef<
234
239
  alignItems="center"
235
240
  justifyContent="space-between"
236
241
  onClick={() => {
242
+ if (isFocussed && tokenIndex !== null) {
243
+ setTokenIndex(null);
244
+ }
245
+
237
246
  if (!disabled) {
238
247
  inputRef.current?.focus();
239
248
  }
@@ -270,7 +279,7 @@ const StackedPilledInput = React.forwardRef<
270
279
  : 'none'
271
280
  }
272
281
  borderRadius="full"
273
- onClick={() => isFocussed && setTokenIndex(index)}
282
+ onClick={() => setTokenIndex(index)}
274
283
  width="100%"
275
284
  id={`${name}_token_${index}`}
276
285
  >
@@ -313,7 +322,10 @@ const StackedPilledInput = React.forwardRef<
313
322
  }
314
323
  ref={inputRef}
315
324
  onFocus={() => setIsFocussed(true)}
316
- onBlur={() => setIsFocussed(false)}
325
+ onBlur={() => {
326
+ setIsFocussed(false);
327
+ return setTokenIndex(null);
328
+ }}
317
329
  />
318
330
  </Flex>
319
331
  </Flex>
@@ -18,7 +18,7 @@ export const Label: React.FC<LabelProps> = ({
18
18
  label,
19
19
  }) => {
20
20
  return (
21
- <FormLabel display="flex" alignItems="center">
21
+ <FormLabel display="flex">
22
22
  {label}
23
23
  {isRequired && (
24
24
  <Box ml={1} color={colors.label.error}>
@@ -11,11 +11,9 @@ function baseStyleRequiredIndicator() {
11
11
 
12
12
  function baseStyleHelperText() {
13
13
  return {
14
- position: 'absolute',
15
- color: colors.label.secondary.light,
16
14
  mt: 1,
17
15
  ml: 1,
18
- bottom: 0,
16
+ color: colors.label.secondary.light,
19
17
  fontSize: '13px',
20
18
  };
21
19
  }