Skip to content

Commit 05e5cb6

Browse files
committed
rebuild storybook files
1 parent 057b0f6 commit 05e5cb6

File tree

7 files changed

+36
-28
lines changed

7 files changed

+36
-28
lines changed

docs/asset-manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"files": {
3-
"main.js": "./main.644d968d.iframe.bundle.js",
3+
"main.js": "./main.2b2021dd.iframe.bundle.js",
44
"runtime~main.js": "./runtime~main.f398e60b.iframe.bundle.js",
55
"vendors~main.js": "./vendors~main.dacc63da.iframe.bundle.js",
66
"vendors~main.js.map": "./vendors~main.dacc63da.iframe.bundle.js.map",
@@ -10,6 +10,6 @@
1010
"entrypoints": [
1111
"runtime~main.f398e60b.iframe.bundle.js",
1212
"vendors~main.dacc63da.iframe.bundle.js",
13-
"main.644d968d.iframe.bundle.js"
13+
"main.2b2021dd.iframe.bundle.js"
1414
]
1515
}

docs/iframe.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,4 @@
130130

131131

132132

133-
window['FRAMEWORK_OPTIONS'] = {};</script><script src="runtime~main.f398e60b.iframe.bundle.js"></script><script src="vendors~main.dacc63da.iframe.bundle.js"></script><script src="main.644d968d.iframe.bundle.js"></script></body></html>
133+
window['FRAMEWORK_OPTIONS'] = {};</script><script src="runtime~main.f398e60b.iframe.bundle.js"></script><script src="vendors~main.dacc63da.iframe.bundle.js"></script><script src="main.2b2021dd.iframe.bundle.js"></script></body></html>

docs/main.2b2021dd.iframe.bundle.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/main.644d968d.iframe.bundle.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/Select.tsx

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -342,11 +342,11 @@ const Select = forwardRef<SelectRef, SelectProps>((
342342
? menuOptions.findIndex((x) => x.isSelected)
343343
: -1;
344344

345-
const index = (selectedIndex > -1)
345+
const index = selectedIndex > -1
346346
? selectedIndex
347-
: (position === OptionIndexEnum.FIRST)
348-
? 0
349-
: (menuOptions.length - 1);
347+
: position === OptionIndexEnum.FIRST
348+
? 0
349+
: menuOptions.length - 1;
350350

351351
!menuOpenRef.current && setMenuOpen(true);
352352
setFocusedOption({ index, ...menuOptions[index] });
@@ -366,7 +366,9 @@ const Select = forwardRef<SelectRef, SelectProps>((
366366
}
367367

368368
// Use 'blurInputOnSelect' if defined, otherwise evaluate to true if current device is touch-device
369-
const blurControl = isBoolean(blurInputOnSelect) ? blurInputOnSelect : IS_TOUCH_DEVICE;
369+
const blurControl = isBoolean(blurInputOnSelect)
370+
? blurInputOnSelect
371+
: IS_TOUCH_DEVICE;
370372

371373
if (blurControl) {
372374
blurInput();
@@ -533,6 +535,13 @@ const Select = forwardRef<SelectRef, SelectProps>((
533535
scrollToItemIndex(index);
534536
};
535537

538+
const handleVerticalKeySubRoutine = (key: string): void => {
539+
const downKey = key === 'ArrowDown';
540+
const downUpIndex = downKey ? OptionIndexEnum.DOWN : OptionIndexEnum.UP;
541+
const posIndex = downKey ? OptionIndexEnum.FIRST : OptionIndexEnum.LAST;
542+
menuOpen ? focusOptionOnArrowKey(downUpIndex) : openMenuAndFocusOption(posIndex);
543+
};
544+
536545
const handleOnKeyDown = (e: KeyboardEvent<HTMLDivElement>): void => {
537546
if (isDisabled) return;
538547

@@ -544,25 +553,22 @@ const Select = forwardRef<SelectRef, SelectProps>((
544553
switch (e.key) {
545554
case 'ArrowDown':
546555
case 'ArrowUp': {
547-
const downKey = e.key === 'ArrowDown';
548-
menuOpen
549-
? focusOptionOnArrowKey(downKey ? OptionIndexEnum.DOWN : OptionIndexEnum.UP)
550-
: openMenuAndFocusOption(downKey ? OptionIndexEnum.FIRST : OptionIndexEnum.LAST);
551-
556+
handleVerticalKeySubRoutine(e.key);
552557
break;
553558
}
554559
case 'ArrowLeft':
555560
case 'ArrowRight': {
556561
if (!isMulti || inputValue || renderMultiOptions) return;
557-
focusValueOnArrowKey(e.key === 'ArrowLeft' ? ValueIndexEnum.PREVIOUS : ValueIndexEnum.NEXT);
558562

563+
const leftRightIndex = e.key === 'ArrowLeft' ? ValueIndexEnum.PREVIOUS : ValueIndexEnum.NEXT;
564+
focusValueOnArrowKey(leftRightIndex);
559565
break;
560566
}
561567
// Handle spacebar keydown events
562568
case ' ': {
563-
if (inputValue) {
564-
return;
565-
} else if (!menuOpen) {
569+
if (inputValue) return;
570+
571+
if (!menuOpen) {
566572
openMenuAndFocusOption(OptionIndexEnum.FIRST);
567573
} else if (!focusedOption.data) {
568574
return;
@@ -605,14 +611,13 @@ const Select = forwardRef<SelectRef, SelectProps>((
605611
setFocusedMultiValue(nexFocusedMultiValue);
606612
} else {
607613
if (!backspaceClearsValue) return;
614+
if (!isArrayWithLength(selectedOption)) break;
608615

609-
if (isArrayWithLength(selectedOption)) {
610-
if (isMulti && !renderMultiOptions) {
611-
const { value } = selectedOption[selectedOption.length - 1];
612-
removeSelectedOption(value);
613-
} else if (isClearable) {
614-
setSelectedOption(EMPTY_ARRAY);
615-
}
616+
if (isMulti && !renderMultiOptions) {
617+
const { value } = selectedOption[selectedOption.length - 1];
618+
removeSelectedOption(value);
619+
} else if (isClearable) {
620+
setSelectedOption(EMPTY_ARRAY);
616621
}
617622
}
618623

src/utils/menu.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ const _overflowRegExp = /(auto|scroll)/;
4242
* @private
4343
*/
4444
function isScrollableStyle({overflow, overflowX, overflowY}: CSSStyleDeclaration): boolean {
45-
const overflowTestStr = overflow + overflowX + overflowY;
46-
45+
const overflowTestStr = `${overflow}${overflowX}${overflowY}`;
4746
return _overflowRegExp.test(overflowTestStr);
4847
}
4948

src/utils/misc.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,11 @@ export const normalizeValue = (
103103
getOptionValue: (data: OptionData) => ReactText,
104104
getOptionLabel: (data: OptionData) => ReactText
105105
): SelectedOption[] => {
106-
const initialValues = Array.isArray(value) ? value : isPlainObject(value) ? [value] : EMPTY_ARRAY;
106+
const initialValues = Array.isArray(value)
107+
? value
108+
: isPlainObject(value)
109+
? [value]
110+
: EMPTY_ARRAY;
107111

108112
if (!isArrayWithLength(initialValues)) {
109113
return initialValues;

0 commit comments

Comments
 (0)