@xqmsg/ui-core 0.22.3 → 0.23.1-rc.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.
Files changed (40) hide show
  1. package/dist/components/form/FormTypes.d.ts +2 -0
  2. package/dist/components/input/StackedCheckbox/StackedCheckbox.d.ts +3 -2
  3. package/dist/components/input/StackedInput/StackedInput.d.ts +1 -0
  4. package/dist/components/input/StackedPilledInput/index.d.ts +2 -0
  5. package/dist/components/input/StackedTextarea/StackedTextarea.d.ts +3 -0
  6. package/dist/components/input/components/token/index.d.ts +1 -0
  7. package/dist/components/input/index.d.ts +3 -2
  8. package/dist/components/select/index.d.ts +27 -0
  9. package/dist/index.d.ts +1 -0
  10. package/dist/theme/components/button.d.ts +116 -0
  11. package/dist/theme/components/checkbox.d.ts +28 -0
  12. package/dist/theme/components/input.d.ts +12 -0
  13. package/dist/theme/components/select.d.ts +12 -0
  14. package/dist/theme/components/textarea.d.ts +66 -0
  15. package/dist/ui-core.cjs.development.js +330 -55
  16. package/dist/ui-core.cjs.development.js.map +1 -1
  17. package/dist/ui-core.cjs.production.min.js +1 -1
  18. package/dist/ui-core.cjs.production.min.js.map +1 -1
  19. package/dist/ui-core.esm.js +332 -58
  20. package/dist/ui-core.esm.js.map +1 -1
  21. package/package.json +2 -1
  22. package/src/components/button/Button.stories.tsx +92 -27
  23. package/src/components/form/FormTypes.ts +2 -0
  24. package/src/components/form/section/index.tsx +2 -0
  25. package/src/components/input/Input.stories.tsx +66 -0
  26. package/src/components/input/StackedCheckbox/StackedCheckbox.tsx +12 -4
  27. package/src/components/input/StackedInput/StackedInput.tsx +5 -0
  28. package/src/components/input/StackedPilledInput/index.tsx +287 -251
  29. package/src/components/input/StackedTextarea/StackedTextarea.tsx +29 -5
  30. package/src/components/input/components/dropdown/index.tsx +1 -1
  31. package/src/components/input/components/token/index.tsx +6 -5
  32. package/src/components/input/index.tsx +22 -9
  33. package/src/components/select/index.tsx +184 -0
  34. package/src/components/tabs/TabsWrapper.stories.tsx +1 -1
  35. package/src/index.tsx +3 -0
  36. package/src/theme/components/button.ts +67 -0
  37. package/src/theme/components/checkbox.ts +25 -0
  38. package/src/theme/components/input.ts +15 -1
  39. package/src/theme/components/textarea.ts +20 -0
  40. package/src/theme/customXQChakraTheme.ts +2 -0
@@ -17,6 +17,8 @@ export interface StackedPilledInputProps extends InputFieldProps {
17
17
  setError: UseFormSetError<FieldValues>;
18
18
  clearErrors: UseFormClearErrors<FieldValues>;
19
19
  control: Control<FieldValues, any>;
20
+ separators?: string[];
21
+ variant?: string;
20
22
  }
21
23
 
22
24
  /**
@@ -25,302 +27,336 @@ export interface StackedPilledInputProps extends InputFieldProps {
25
27
  const StackedPilledInput = React.forwardRef<
26
28
  HTMLInputElement,
27
29
  StackedPilledInputProps
28
- >(({ name, setValue, control, placeholder, disabled }, _ref) => {
29
- const watchedValue = useWatch({ control, name: name as string });
30
- const [lastestFormValueToArray, setLatestFormValueToArray] = useState<
31
- string[]
32
- >([]);
33
-
34
- const inputRef = useRef<HTMLInputElement>(null);
35
- const inputWrapperRef = useRef(null);
36
- const scrollRef = useRef<HTMLDivElement>(null);
37
-
38
- const [tokenIndex, setTokenIndex] = useState<number | null>(null);
39
- const [isFocussed, setIsFocussed] = useState(false);
40
- const [localValue, setLocalValue] = useState('');
41
-
42
- const latestTokenElement = document.getElementById(
43
- `${name}_token_${lastestFormValueToArray.length - 1}`
44
- );
45
-
46
- // gets latest watched form value (common delimited) from RHF state and creates a list
47
- useEffect(() => {
48
- if (watchedValue !== undefined && !watchedValue.length) {
49
- setLatestFormValueToArray([]);
50
- }
51
-
52
- if (watchedValue !== undefined && watchedValue?.length) {
53
- setLatestFormValueToArray(watchedValue.split(',').filter(Boolean));
54
-
55
- if (latestTokenElement) {
56
- latestTokenElement.scrollIntoView({
57
- block: 'end',
58
- inline: 'center',
59
- behavior: 'smooth',
60
- });
30
+ >(
31
+ (
32
+ {
33
+ name,
34
+ setValue,
35
+ control,
36
+ placeholder,
37
+ disabled,
38
+ separators = ['Enter', ' ', ',', ';', 'Tab'],
39
+ variant,
40
+ },
41
+ _ref
42
+ ) => {
43
+ const watchedValue = useWatch({ control, name: name as string });
44
+ const [lastestFormValueToArray, setLatestFormValueToArray] = useState<
45
+ string[]
46
+ >([]);
47
+
48
+ const inputRef = useRef<HTMLInputElement>(null);
49
+ const inputWrapperRef = useRef(null);
50
+ const scrollRef = useRef<HTMLDivElement>(null);
51
+
52
+ const [tokenIndex, setTokenIndex] = useState<number | null>(null);
53
+ const [isFocussed, setIsFocussed] = useState(false);
54
+ const [localValue, setLocalValue] = useState('');
55
+
56
+ const latestTokenElement = document.getElementById(
57
+ `${name}_token_${lastestFormValueToArray.length - 1}`
58
+ );
59
+
60
+ // gets latest watched form value (common delimited) from RHF state and creates a list
61
+ useEffect(() => {
62
+ if (watchedValue !== undefined && !watchedValue.length) {
63
+ setLatestFormValueToArray([]);
61
64
  }
62
- }
63
- }, [latestTokenElement, watchedValue]);
64
-
65
- const onHandleKeyDown = (e: React.KeyboardEvent) => {
66
- if (e.key === 'Enter') {
67
- e.stopPropagation();
68
- e.preventDefault();
69
- }
70
-
71
- if (
72
- (e.key === ' ' ||
73
- e.key === 'Enter' ||
74
- e.key === ',' ||
75
- e.key === 'Tab') &&
76
- localValue.trim().length
77
- ) {
78
- if (
79
- e.key === 'Enter' &&
80
- !localValue.trim().length &&
81
- tokenIndex !== null
82
- ) {
83
- setLocalValue(lastestFormValueToArray[tokenIndex]);
84
65
 
85
- const filteredUniqueValues = Array.from(
86
- new Set(
87
- lastestFormValueToArray.filter(
88
- value => value !== lastestFormValueToArray[tokenIndex]
89
- )
90
- )
66
+ if (watchedValue !== undefined && watchedValue?.length) {
67
+ setLatestFormValueToArray(
68
+ watchedValue
69
+ .split(';')
70
+ .join(',')
71
+ .split(',')
72
+ .filter(Boolean)
91
73
  );
92
74
 
93
- setValue(name as string, filteredUniqueValues.toString(), {
94
- shouldValidate: true,
95
- shouldDirty: true,
96
- });
75
+ if (latestTokenElement) {
76
+ latestTokenElement.scrollIntoView({
77
+ block: 'end',
78
+ inline: 'center',
79
+ behavior: 'smooth',
80
+ });
81
+ }
82
+ }
83
+ }, [latestTokenElement, watchedValue]);
97
84
 
98
- return setTokenIndex(null);
85
+ const handleOnChange = (e: React.ChangeEvent<HTMLInputElement>) => {
86
+ if (tokenIndex === null) {
87
+ setLocalValue(
88
+ e.target.value
89
+ .trim()
90
+ .replace(',', '')
91
+ .replace(';', '').length
92
+ ? e.target.value
93
+ : ''
94
+ );
99
95
  }
96
+ };
100
97
 
101
- const filteredUniqueValues = Array.from(
102
- new Set([...lastestFormValueToArray, ...localValue.trim().split(',')])
103
- );
98
+ const onHandleKeyDown = (e: React.KeyboardEvent) => {
99
+ if (e.key === 'Enter') {
100
+ e.stopPropagation();
101
+ e.preventDefault();
102
+ }
104
103
 
105
- setLocalValue('');
104
+ if (separators.includes(e.key)) {
105
+ if (
106
+ e.key === 'Enter' &&
107
+ !localValue.trim().length &&
108
+ tokenIndex !== null
109
+ ) {
110
+ setLocalValue(lastestFormValueToArray[tokenIndex]);
111
+
112
+ const filteredUniqueValues = Array.from(
113
+ new Set(
114
+ lastestFormValueToArray.filter(
115
+ value => value !== lastestFormValueToArray[tokenIndex]
116
+ )
117
+ )
118
+ );
106
119
 
107
- return setValue(name as string, filteredUniqueValues.toString(), {
108
- shouldValidate: true,
109
- shouldDirty: true,
110
- });
111
- }
120
+ setValue(name as string, filteredUniqueValues.toString(), {
121
+ shouldValidate: true,
122
+ shouldDirty: true,
123
+ });
112
124
 
113
- if (!localValue.trim().length && lastestFormValueToArray.length) {
114
- if (e.key === 'Backspace' && tokenIndex !== null) {
115
- setLocalValue(
116
- lastestFormValueToArray[tokenIndex].substring(
117
- 0,
118
- lastestFormValueToArray[tokenIndex].length
119
- )
120
- );
125
+ return setTokenIndex(null);
126
+ }
121
127
 
122
128
  const filteredUniqueValues = Array.from(
123
- new Set(
124
- [...lastestFormValueToArray].filter(
125
- value => value !== lastestFormValueToArray[tokenIndex]
126
- )
127
- )
129
+ new Set([
130
+ ...lastestFormValueToArray,
131
+ ...localValue
132
+ .trim()
133
+ .split(';')
134
+ .join(',')
135
+ .split(','),
136
+ ])
128
137
  );
129
138
 
130
- setValue(name as string, filteredUniqueValues.toString(), {
139
+ setLocalValue('');
140
+
141
+ return setValue(name as string, filteredUniqueValues.toString(), {
131
142
  shouldValidate: true,
132
143
  shouldDirty: true,
133
144
  });
134
-
135
- return setTokenIndex(null);
136
145
  }
137
146
 
138
- if (e.key === 'ArrowLeft') {
139
- if (tokenIndex === 0) return;
147
+ if (!localValue.trim().length && lastestFormValueToArray.length) {
148
+ if (e.key === 'Backspace' && tokenIndex !== null) {
149
+ setLocalValue(
150
+ lastestFormValueToArray[tokenIndex].substring(
151
+ 0,
152
+ lastestFormValueToArray[tokenIndex].length
153
+ )
154
+ );
155
+
156
+ const filteredUniqueValues = Array.from(
157
+ new Set(
158
+ [...lastestFormValueToArray].filter(
159
+ value => value !== lastestFormValueToArray[tokenIndex]
160
+ )
161
+ )
162
+ );
163
+
164
+ setValue(name as string, filteredUniqueValues.toString(), {
165
+ shouldValidate: true,
166
+ shouldDirty: true,
167
+ });
140
168
 
141
- if (!tokenIndex) {
142
- return setTokenIndex(lastestFormValueToArray.length - 1);
169
+ return setTokenIndex(null);
143
170
  }
144
171
 
145
- setTokenIndex(prevTokenIndex => (prevTokenIndex as number) - 1);
172
+ if (e.key === 'ArrowLeft') {
173
+ if (tokenIndex === 0) return;
146
174
 
147
- const tokenElement = document.getElementById(
148
- `${name}_token_${tokenIndex}`
149
- );
175
+ if (!tokenIndex) {
176
+ return setTokenIndex(lastestFormValueToArray.length - 1);
177
+ }
150
178
 
151
- if (!tokenElement || !scrollRef.current) return;
179
+ setTokenIndex(prevTokenIndex => (prevTokenIndex as number) - 1);
152
180
 
153
- return scrollRef.current.scrollBy({
154
- left: -1 * tokenElement.getBoundingClientRect().width,
155
- behavior: 'smooth',
156
- });
157
- }
181
+ const tokenElement = document.getElementById(
182
+ `${name}_token_${tokenIndex}`
183
+ );
158
184
 
159
- if (e.key === 'ArrowRight') {
160
- if (tokenIndex === null) return;
185
+ if (!tokenElement || !scrollRef.current) return;
161
186
 
162
- if (tokenIndex === lastestFormValueToArray.length - 1) {
163
- return setTokenIndex(null);
187
+ return scrollRef.current.scrollBy({
188
+ left: -1 * tokenElement.getBoundingClientRect().width,
189
+ behavior: 'smooth',
190
+ });
164
191
  }
165
- setTokenIndex(prevTokenIndex => (prevTokenIndex as number) + 1);
166
-
167
- const tokenElement = document.getElementById(
168
- `${name}_token_${tokenIndex}`
169
- );
170
192
 
171
- if (!tokenElement || !scrollRef.current) return;
193
+ if (e.key === 'ArrowRight') {
194
+ if (tokenIndex === null) return;
172
195
 
173
- return scrollRef.current.scrollBy({
174
- left: tokenElement.getBoundingClientRect().width,
175
- behavior: 'smooth',
176
- });
177
- }
178
- }
179
- };
196
+ if (tokenIndex === lastestFormValueToArray.length - 1) {
197
+ return setTokenIndex(null);
198
+ }
199
+ setTokenIndex(prevTokenIndex => (prevTokenIndex as number) + 1);
180
200
 
181
- const onRemoveTag = (index: number) => {
182
- const filteredUniqueValues = lastestFormValueToArray.filter(
183
- (_, i) => i !== index
184
- );
201
+ const tokenElement = document.getElementById(
202
+ `${name}_token_${tokenIndex}`
203
+ );
185
204
 
186
- setLatestFormValueToArray(filteredUniqueValues);
205
+ if (!tokenElement || !scrollRef.current) return;
187
206
 
188
- setValue(name as string, filteredUniqueValues.toString(), {
189
- shouldValidate: true,
190
- shouldDirty: true,
191
- });
192
- };
207
+ return scrollRef.current.scrollBy({
208
+ left: tokenElement.getBoundingClientRect().width,
209
+ behavior: 'smooth',
210
+ });
211
+ }
212
+ }
213
+ };
193
214
 
194
- const onBlur = () => {
195
- if (localValue.trim().length) {
196
- const filteredUniqueValues = Array.from(
197
- new Set([...lastestFormValueToArray, ...localValue.trim().split(',')])
215
+ const onRemoveTag = (index: number) => {
216
+ const filteredUniqueValues = lastestFormValueToArray.filter(
217
+ (_, i) => i !== index
198
218
  );
199
219
 
220
+ setLatestFormValueToArray(filteredUniqueValues);
221
+
200
222
  setValue(name as string, filteredUniqueValues.toString(), {
201
223
  shouldValidate: true,
202
224
  shouldDirty: true,
203
225
  });
204
- setLocalValue('');
205
- }
206
- setIsFocussed(false);
207
- };
208
-
209
- useOutsideClick({
210
- ref: inputWrapperRef,
211
- handler: () => {
212
- onBlur();
213
- },
214
- });
215
-
216
- return (
217
- <Box position="relative">
218
- <Flex
219
- fontSize="13px"
220
- border={isFocussed ? '2px solid' : '.5px solid'}
221
- borderColor={isFocussed ? colors.border.focus : colors.border.default}
222
- pl="8px"
223
- borderRadius="4px"
224
- alignItems="center"
225
- justifyContent="space-between"
226
- onClick={() => {
227
- if (isFocussed && tokenIndex !== null) {
228
- setTokenIndex(null);
229
- }
226
+ };
230
227
 
231
- if (!disabled) {
232
- inputRef.current?.focus();
233
- }
234
- }}
235
- bg={disabled ? colors.fill.light.quaternary : '#ffffff'}
236
- cursor={disabled ? 'not-allowed' : 'pointer'}
237
- ref={inputWrapperRef}
238
- h="26px"
239
- >
228
+ const onBlur = () => {
229
+ if (localValue.trim().length) {
230
+ const filteredUniqueValues = Array.from(
231
+ new Set([...lastestFormValueToArray, ...localValue.trim().split(',')])
232
+ );
233
+
234
+ setValue(name as string, filteredUniqueValues.toString(), {
235
+ shouldValidate: true,
236
+ shouldDirty: true,
237
+ });
238
+ setLocalValue('');
239
+ }
240
+ setIsFocussed(false);
241
+ };
242
+
243
+ useOutsideClick({
244
+ ref: inputWrapperRef,
245
+ handler: () => {
246
+ onBlur();
247
+ },
248
+ });
249
+ const isMobile = variant === 'mobile';
250
+
251
+ return (
252
+ <Box position="relative">
240
253
  <Flex
241
- h="100%"
254
+ fontSize={isMobile ? '17px' : '13px'}
255
+ border={isFocussed ? '2px solid' : '.5px solid'}
256
+ borderColor={isFocussed ? colors.border.focus : colors.border.default}
257
+ pl="8px"
258
+ borderRadius={isMobile ? '0' : '4px'}
242
259
  alignItems="center"
243
- overflowX="scroll"
244
- overflowY="hidden"
245
- maxWidth={isFocussed ? '80%' : '100%'}
246
- style={{
247
- scrollbarWidth: 'none' /* Firefox */,
248
- msOverflowStyle: 'none',
260
+ justifyContent="space-between"
261
+ onClick={() => {
262
+ if (isFocussed && tokenIndex !== null) {
263
+ setTokenIndex(null);
264
+ }
265
+
266
+ if (!disabled) {
267
+ inputRef.current?.focus();
268
+ }
249
269
  }}
250
- sx={{
251
- '::-webkit-scrollbar': {
252
- display: 'none',
253
- },
254
- }}
255
- ref={scrollRef}
256
- zIndex={100}
257
- onKeyDown={onHandleKeyDown}
270
+ bg={disabled ? colors.fill.light.quaternary : '#ffffff'}
271
+ cursor={disabled ? 'not-allowed' : 'pointer'}
272
+ ref={inputWrapperRef}
273
+ h={isMobile ? '48px' : '26px'}
258
274
  >
259
- {lastestFormValueToArray.length
260
- ? lastestFormValueToArray.map((label, index) => (
261
- <Box
262
- key={index}
263
- mr="4px"
264
- border={
265
- tokenIndex === index
266
- ? `1px solid ${colors.border.focus}`
267
- : 'none'
268
- }
269
- borderRadius="full"
270
- onClick={() => setTokenIndex(index)}
271
- width="100%"
272
- id={`${name}_token_${index}`}
273
- >
274
- <Token
275
- label={label}
276
- onDelete={(e: any) => {
277
- e.stopPropagation();
278
- e.preventDefault();
279
- onRemoveTag(index);
280
- }}
281
- />
282
- </Box>
283
- ))
284
- : null}
285
- {!lastestFormValueToArray.length && !isFocussed ? (
286
- <Text color={colors.label.secondary.light} fontSize="13px">
287
- {placeholder}
288
- </Text>
289
- ) : null}
290
- </Flex>
291
- {!disabled && (
292
- <Flex flex={1} minWidth={isFocussed && !tokenIndex ? '20%' : 0}>
293
- <Input
294
- onKeyDown={onHandleKeyDown}
295
- type="text"
296
- padding={0}
297
- alignContent="flex-start"
298
- float="right"
299
- border="none"
300
- height="auto"
301
- color={tokenIndex !== null ? 'transparent' : colors.label.primary}
302
- _focus={{ boxShadow: 'none !important' }}
303
- value={localValue}
304
- onChange={e =>
305
- tokenIndex === null &&
306
- setLocalValue(
307
- e.target.value.trim().replace(',', '').length
308
- ? e.target.value
309
- : ''
310
- )
311
- }
312
- ref={inputRef}
313
- onFocus={() => setIsFocussed(true)}
314
- onBlur={() => {
315
- setIsFocussed(false);
316
- return setTokenIndex(null);
317
- }}
318
- />
275
+ <Flex
276
+ h="100%"
277
+ alignItems="center"
278
+ overflowX="scroll"
279
+ overflowY="hidden"
280
+ maxWidth={isFocussed ? '80%' : '100%'}
281
+ style={{
282
+ scrollbarWidth: 'none' /* Firefox */,
283
+ msOverflowStyle: 'none',
284
+ }}
285
+ sx={{
286
+ '::-webkit-scrollbar': {
287
+ display: 'none',
288
+ },
289
+ }}
290
+ ref={scrollRef}
291
+ zIndex={100}
292
+ onKeyDown={onHandleKeyDown}
293
+ >
294
+ {lastestFormValueToArray.length
295
+ ? lastestFormValueToArray.map((label, index) => (
296
+ <Box
297
+ key={index}
298
+ mr="4px"
299
+ border={
300
+ tokenIndex === index
301
+ ? `1px solid ${colors.border.focus}`
302
+ : 'none'
303
+ }
304
+ borderRadius="full"
305
+ onClick={() => setTokenIndex(index)}
306
+ width="100%"
307
+ id={`${name}_token_${index}`}
308
+ >
309
+ <Token
310
+ label={label}
311
+ onDelete={(e: any) => {
312
+ e.stopPropagation();
313
+ e.preventDefault();
314
+ onRemoveTag(index);
315
+ }}
316
+ isMobile={isMobile}
317
+ />
318
+ </Box>
319
+ ))
320
+ : null}
321
+ {!lastestFormValueToArray.length && !isFocussed ? (
322
+ <Text
323
+ color={colors.label.secondary.light}
324
+ fontSize={isMobile ? '17px' : '13px'}
325
+ >
326
+ {placeholder}
327
+ </Text>
328
+ ) : null}
319
329
  </Flex>
320
- )}
321
- </Flex>
322
- </Box>
323
- );
324
- });
330
+ {!disabled && (
331
+ <Flex flex={1} minWidth={isFocussed && !tokenIndex ? '20%' : 0}>
332
+ <Input
333
+ onKeyDown={onHandleKeyDown}
334
+ type="text"
335
+ padding={0}
336
+ alignContent="flex-start"
337
+ float="right"
338
+ border="none"
339
+ height="auto"
340
+ color={
341
+ tokenIndex !== null ? 'transparent' : colors.label.primary
342
+ }
343
+ _focus={{ boxShadow: 'none !important' }}
344
+ value={localValue}
345
+ onChange={handleOnChange}
346
+ ref={inputRef}
347
+ onFocus={() => setIsFocussed(true)}
348
+ onBlur={() => {
349
+ setIsFocussed(false);
350
+ return setTokenIndex(null);
351
+ }}
352
+ variant={variant}
353
+ />
354
+ </Flex>
355
+ )}
356
+ </Flex>
357
+ </Box>
358
+ );
359
+ }
360
+ );
325
361
 
326
362
  export default StackedPilledInput;
@@ -1,8 +1,12 @@
1
1
  import React from 'react';
2
- import { Textarea } from '@chakra-ui/react';
2
+ import { Flex, Textarea } from '@chakra-ui/react';
3
3
  import { TextareaFieldProps } from '../InputTypes';
4
4
 
5
- export interface StackedTextareaProps extends TextareaFieldProps {}
5
+ export interface StackedTextareaProps extends TextareaFieldProps {
6
+ isRequired?: boolean;
7
+ allowDefault?: boolean;
8
+ variant: string;
9
+ }
6
10
 
7
11
  /**
8
12
  * A functional React component utilized to render the `StackedTextarea` component.
@@ -10,14 +14,34 @@ export interface StackedTextareaProps extends TextareaFieldProps {}
10
14
  const StackedTextarea = React.forwardRef<
11
15
  HTMLTextAreaElement,
12
16
  StackedTextareaProps
13
- >(({ ...props }, _ref) => {
17
+ >(({ isRequired, allowDefault, variant, ...props }, _ref) => {
18
+ if (variant === 'mobile') {
19
+ return (
20
+ <Flex>
21
+ {allowDefault}
22
+ <Textarea
23
+ ref={_ref}
24
+ {...props}
25
+ variant={variant}
26
+ fontSize="17px"
27
+ onKeyDown={e => {
28
+ if (e.key === 'Enter' && !allowDefault) {
29
+ e.stopPropagation();
30
+ e.preventDefault();
31
+ }
32
+ }}
33
+ />
34
+ </Flex>
35
+ );
36
+ }
14
37
  return (
15
38
  <Textarea
16
39
  ref={_ref}
17
40
  {...props}
18
- fontSize="13px"
41
+ variant={variant}
42
+ fontSize={variant === '' ? '13px' : '17px'}
19
43
  onKeyDown={e => {
20
- if (e.key === 'Enter') {
44
+ if (e.key === 'Enter' && !allowDefault) {
21
45
  e.stopPropagation();
22
46
  e.preventDefault();
23
47
  }
@@ -23,7 +23,7 @@ export const Dropdown: React.FC<DropdownProps> = ({
23
23
  }) => {
24
24
  const DropdownContent = useMemo(() => {
25
25
  return options.map((option, idx) => (
26
- <Box key={idx} width="100%">
26
+ <Box key={idx} width="100%" role="combobox">
27
27
  {option.value === 'section_header' &&
28
28
  options[idx + 1] &&
29
29
  options[idx + 1].value !== 'section_header' && (