@xqmsg/ui-core 0.16.7 → 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.7",
2
+ "version": "0.16.8",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -99,7 +99,7 @@ const Template: Story<InputProps<StoryFormSchema>> = args => {
99
99
 
100
100
  return (
101
101
  <Form formHandler={formHandler}>
102
- {/* <Input
102
+ <Input
103
103
  {...args}
104
104
  inputType="multi-select"
105
105
  setValue={form.setValue}
@@ -142,57 +142,7 @@ const Template: Story<InputProps<StoryFormSchema>> = args => {
142
142
  name="prop6"
143
143
  inputType="switch"
144
144
  setValue={form.setValue}
145
- /> */}
146
- <Flex
147
- flexDirection="row"
148
- alignItems="center"
149
- justifyContent="space-between"
150
- >
151
- <Grid templateColumns="repeat(8, 1fr)">
152
- <GridItem colSpan={1} pr="10px">
153
- <Input
154
- label="Long example label"
155
- inputType="text"
156
- isRequired
157
- name={`actions`}
158
- ariaLabel="{actionInput.ariaLabel}"
159
- control={form.control}
160
- setValue={form.setValue}
161
- defaultValue="{actionInput.defaultValue}"
162
- setError={form.setError}
163
- clearErrors={form.clearErrors}
164
- />
165
- </GridItem>
166
- <GridItem colSpan={1} pr="10px">
167
- <Input
168
- label="hi"
169
- inputType="text"
170
- isRequired
171
- setValue={form.setValue}
172
- name={`actions.`}
173
- ariaLabel="{adminInput.ariaLabel}"
174
- control={form.control}
175
- defaultValue="{adminInput.defaultValue}"
176
- setError={form.setError}
177
- clearErrors={form.clearErrors}
178
- />
179
- </GridItem>
180
- <GridItem colSpan={6} pr="10px">
181
- <Input
182
- inputType="text"
183
- isRequired
184
- setValue={form.setValue}
185
- name={`action`}
186
- ariaLabel="{messageInput.ariaLabel}"
187
- control={form.control}
188
- defaultValue="{messageInput.defaultValue}"
189
- setError={form.setError}
190
- clearErrors={form.clearErrors}
191
- maxLength={140}
192
- />
193
- </GridItem>
194
- </Grid>
195
- </Flex>
145
+ />
196
146
  </Form>
197
147
  );
198
148
  };
@@ -201,9 +151,6 @@ export const Default = Template.bind({});
201
151
  Default.args = {
202
152
  label: 'Input Label',
203
153
  inputType: 'text',
204
- helperText:
205
- ' M1 4.33325H15.1667M11 7.66659H16M11 10.9999H16M8.08333 7.66659H8.5M8.08333 10.9999H8.5',
206
-
207
154
  options: [
208
155
  { value: 'section_header', label: 'Section 1', sortValue: 0 },
209
156
  {
@@ -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>