@basic-ui/core 0.0.38 → 0.0.41
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/build/cjs/index.js +1 -1
- package/build/cjs/index.js.map +1 -1
- package/build/esm/Accordion/Accordion.d.ts +7 -7
- package/build/esm/Accordion/Accordion.js +22 -17
- package/build/esm/Accordion/Accordion.js.map +1 -1
- package/build/esm/Accordion/AccordionBody.d.ts +5 -5
- package/build/esm/Accordion/AccordionBody.js +23 -15
- package/build/esm/Accordion/AccordionBody.js.map +1 -1
- package/build/esm/Accordion/AccordionHeader.d.ts +6 -6
- package/build/esm/Accordion/AccordionHeader.js +45 -31
- package/build/esm/Accordion/AccordionHeader.js.map +1 -1
- package/build/esm/Accordion/AccordionItem.d.ts +7 -7
- package/build/esm/Accordion/AccordionItem.js +16 -16
- package/build/esm/Accordion/AccordionItem.js.map +1 -1
- package/build/esm/Accordion/context.d.ts +4 -4
- package/build/esm/Accordion/context.js +12 -10
- package/build/esm/Accordion/context.js.map +1 -1
- package/build/esm/CheckBox/CheckBox.d.ts +6 -6
- package/build/esm/CheckBox/CheckBox.js +19 -12
- package/build/esm/CheckBox/CheckBox.js.map +1 -1
- package/build/esm/ComboBox/Combobox.d.ts +10 -10
- package/build/esm/ComboBox/Combobox.js +52 -46
- package/build/esm/ComboBox/Combobox.js.map +1 -1
- package/build/esm/ComboBox/ComboboxButton.d.ts +8 -8
- package/build/esm/ComboBox/ComboboxButton.js +19 -20
- package/build/esm/ComboBox/ComboboxButton.js.map +1 -1
- package/build/esm/ComboBox/ComboboxInput.d.ts +10 -10
- package/build/esm/ComboBox/ComboboxInput.js +52 -50
- package/build/esm/ComboBox/ComboboxInput.js.map +1 -1
- package/build/esm/ComboBox/ComboboxLabel.d.ts +5 -5
- package/build/esm/ComboBox/ComboboxLabel.js +11 -12
- package/build/esm/ComboBox/ComboboxLabel.js.map +1 -1
- package/build/esm/ComboBox/ComboboxList.d.ts +6 -6
- package/build/esm/ComboBox/ComboboxList.js +15 -17
- package/build/esm/ComboBox/ComboboxList.js.map +1 -1
- package/build/esm/ComboBox/ComboboxOption.d.ts +7 -7
- package/build/esm/ComboBox/ComboboxOption.js +31 -34
- package/build/esm/ComboBox/ComboboxOption.js.map +1 -1
- package/build/esm/ComboBox/ComboboxPopover.d.ts +8 -8
- package/build/esm/ComboBox/ComboboxPopover.js +15 -17
- package/build/esm/ComboBox/ComboboxPopover.js.map +1 -1
- package/build/esm/ComboBox/context.d.ts +13 -13
- package/build/esm/ComboBox/context.js +6 -5
- package/build/esm/ComboBox/context.js.map +1 -1
- package/build/esm/ComboBox/hooks.d.ts +4 -4
- package/build/esm/ComboBox/hooks.js +82 -115
- package/build/esm/ComboBox/hooks.js.map +1 -1
- package/build/esm/ComboBox/makeHash.js +3 -3
- package/build/esm/ComboBox/makeHash.js.map +1 -1
- package/build/esm/FocusLock/FocusLock.d.ts +7 -7
- package/build/esm/FocusLock/FocusLock.js +17 -16
- package/build/esm/FocusLock/FocusLock.js.map +1 -1
- package/build/esm/FocusLock/tabUtils.js +4 -4
- package/build/esm/FocusLock/tabUtils.js.map +1 -1
- package/build/esm/FocusLock/useFocusLock.d.ts +4 -4
- package/build/esm/FocusLock/useFocusLock.js +10 -11
- package/build/esm/FocusLock/useFocusLock.js.map +1 -1
- package/build/esm/List/List.d.ts +6 -6
- package/build/esm/List/List.js +5 -6
- package/build/esm/List/List.js.map +1 -1
- package/build/esm/List/ListItem.d.ts +6 -6
- package/build/esm/List/ListItem.js +5 -6
- package/build/esm/List/ListItem.js.map +1 -1
- package/build/esm/List/context.js +3 -3
- package/build/esm/List/context.js.map +1 -1
- package/build/esm/Menu/Menu.d.ts +6 -6
- package/build/esm/Menu/Menu.js +29 -21
- package/build/esm/Menu/Menu.js.map +1 -1
- package/build/esm/Menu/MenuButton.d.ts +10 -10
- package/build/esm/Menu/MenuButton.js +27 -24
- package/build/esm/Menu/MenuButton.js.map +1 -1
- package/build/esm/Menu/MenuItem.d.ts +6 -6
- package/build/esm/Menu/MenuItem.js +23 -24
- package/build/esm/Menu/MenuItem.js.map +1 -1
- package/build/esm/Menu/MenuList.d.ts +5 -5
- package/build/esm/Menu/MenuList.js +61 -45
- package/build/esm/Menu/MenuList.js.map +1 -1
- package/build/esm/Menu/MenuPopover.d.ts +6 -6
- package/build/esm/Menu/MenuPopover.js +8 -10
- package/build/esm/Menu/MenuPopover.js.map +1 -1
- package/build/esm/Menu/context.d.ts +2 -2
- package/build/esm/Menu/context.js +11 -8
- package/build/esm/Menu/context.js.map +1 -1
- package/build/esm/Modal/Modal.d.ts +6 -7
- package/build/esm/Modal/Modal.js +11 -10
- package/build/esm/Modal/Modal.js.map +1 -1
- package/build/esm/Modal/ModalBackdrop.d.ts +6 -6
- package/build/esm/Modal/ModalBackdrop.js +20 -19
- package/build/esm/Modal/ModalBackdrop.js.map +1 -1
- package/build/esm/Popper/Popper.d.ts +8 -8
- package/build/esm/Popper/Popper.js +46 -37
- package/build/esm/Popper/Popper.js.map +1 -1
- package/build/esm/Popper/PopperArrow.d.ts +5 -5
- package/build/esm/Popper/PopperArrow.js +8 -9
- package/build/esm/Popper/PopperArrow.js.map +1 -1
- package/build/esm/Popper/context.d.ts +1 -1
- package/build/esm/Popper/context.js +5 -3
- package/build/esm/Popper/context.js.map +1 -1
- package/build/esm/Portal/Portal.d.ts +1 -1
- package/build/esm/Portal/Portal.js +6 -5
- package/build/esm/Portal/Portal.js.map +1 -1
- package/build/esm/RadioButton/RadioButton.d.ts +7 -7
- package/build/esm/RadioButton/RadioButton.js +12 -13
- package/build/esm/RadioButton/RadioButton.js.map +1 -1
- package/build/esm/RadioButton/RadioGroup.d.ts +8 -8
- package/build/esm/RadioButton/RadioGroup.js +22 -16
- package/build/esm/RadioButton/RadioGroup.js.map +1 -1
- package/build/esm/RadioButton/context.d.ts +2 -2
- package/build/esm/RadioButton/context.js +6 -5
- package/build/esm/RadioButton/context.js.map +1 -1
- package/build/esm/SkipNav/SkipNav.d.ts +6 -6
- package/build/esm/SkipNav/SkipNav.js +5 -6
- package/build/esm/SkipNav/SkipNav.js.map +1 -1
- package/build/esm/Spinner/Spinner.d.ts +7 -7
- package/build/esm/Spinner/Spinner.js +41 -31
- package/build/esm/Spinner/Spinner.js.map +1 -1
- package/build/esm/Spinner/SpinnerButton.d.ts +6 -6
- package/build/esm/Spinner/SpinnerButton.js +11 -12
- package/build/esm/Spinner/SpinnerButton.js.map +1 -1
- package/build/esm/Spinner/context.d.ts +2 -2
- package/build/esm/Spinner/context.js +6 -5
- package/build/esm/Spinner/context.js.map +1 -1
- package/build/esm/Tabs/Tab.d.ts +6 -6
- package/build/esm/Tabs/Tab.js +29 -29
- package/build/esm/Tabs/Tab.js.map +1 -1
- package/build/esm/Tabs/TabList.d.ts +6 -6
- package/build/esm/Tabs/TabList.js +24 -21
- package/build/esm/Tabs/TabList.js.map +1 -1
- package/build/esm/Tabs/TabPanel.d.ts +6 -6
- package/build/esm/Tabs/TabPanel.js +12 -12
- package/build/esm/Tabs/TabPanel.js.map +1 -1
- package/build/esm/Tabs/TabPanels.d.ts +5 -5
- package/build/esm/Tabs/TabPanels.js +13 -12
- package/build/esm/Tabs/TabPanels.js.map +1 -1
- package/build/esm/Tabs/Tabs.d.ts +6 -6
- package/build/esm/Tabs/Tabs.js +27 -14
- package/build/esm/Tabs/Tabs.js.map +1 -1
- package/build/esm/Tabs/context.d.ts +3 -3
- package/build/esm/Tabs/context.js +12 -10
- package/build/esm/Tabs/context.js.map +1 -1
- package/build/esm/Tooltip/Tooltip.d.ts +7 -7
- package/build/esm/Tooltip/Tooltip.js +18 -16
- package/build/esm/Tooltip/Tooltip.js.map +1 -1
- package/build/esm/Tooltip/stateMachine.js +56 -80
- package/build/esm/Tooltip/stateMachine.js.map +1 -1
- package/build/esm/Tooltip/useTooltip.d.ts +7 -7
- package/build/esm/Tooltip/useTooltip.js +32 -30
- package/build/esm/Tooltip/useTooltip.js.map +1 -1
- package/build/esm/hooks/useAutoFocus.d.ts +2 -2
- package/build/esm/hooks/useAutoFocus.js +1 -1
- package/build/esm/hooks/useAutoFocus.js.map +1 -1
- package/build/esm/hooks/useChildrenCounter.d.ts +1 -1
- package/build/esm/hooks/useChildrenCounter.js +6 -4
- package/build/esm/hooks/useChildrenCounter.js.map +1 -1
- package/build/esm/hooks/useControlledState.d.ts +3 -7
- package/build/esm/hooks/useControlledState.js +7 -2
- package/build/esm/hooks/useControlledState.js.map +1 -1
- package/build/esm/hooks/useFocusReturn.d.ts +1 -1
- package/build/esm/hooks/useFocusReturn.js +6 -6
- package/build/esm/hooks/useFocusReturn.js.map +1 -1
- package/build/esm/hooks/useFocusState.d.ts +3 -3
- package/build/esm/hooks/useFocusState.js +13 -9
- package/build/esm/hooks/useFocusState.js.map +1 -1
- package/build/esm/hooks/useGestureHandlers.d.ts +5 -5
- package/build/esm/hooks/useGestureHandlers.js +59 -63
- package/build/esm/hooks/useGestureHandlers.js.map +1 -1
- package/build/esm/hooks/useMeasure.d.ts +2 -2
- package/build/esm/hooks/useMeasure.js +13 -7
- package/build/esm/hooks/useMeasure.js.map +1 -1
- package/build/esm/hooks/useOnClickOutside.d.ts +2 -2
- package/build/esm/hooks/useOnClickOutside.js +5 -4
- package/build/esm/hooks/useOnClickOutside.js.map +1 -1
- package/build/esm/hooks/useOnKeyDown.js +4 -3
- package/build/esm/hooks/useOnKeyDown.js.map +1 -1
- package/build/esm/hooks/useReducerMachine.d.ts +1 -1
- package/build/esm/hooks/useReducerMachine.js +13 -10
- package/build/esm/hooks/useReducerMachine.js.map +1 -1
- package/build/esm/hooks/useRemoveBodyScroll.js +4 -4
- package/build/esm/hooks/useRemoveBodyScroll.js.map +1 -1
- package/build/esm/hooks/useScope.d.ts +1 -1
- package/build/esm/hooks/useScope.js +10 -12
- package/build/esm/hooks/useScope.js.map +1 -1
- package/build/esm/hooks/useThrottle.js +10 -5
- package/build/esm/hooks/useThrottle.js.map +1 -1
- package/build/esm/utils/assignRef.d.ts +1 -1
- package/build/esm/utils/assignRef.js +7 -3
- package/build/esm/utils/assignRef.js.map +1 -1
- package/build/esm/utils/createSubscription.js +7 -5
- package/build/esm/utils/createSubscription.js.map +1 -1
- package/build/esm/utils/rubberBandClamp.js +5 -2
- package/build/esm/utils/rubberBandClamp.js.map +1 -1
- package/build/esm/utils/wrapEvent.d.ts +3 -3
- package/build/esm/utils/wrapEvent.js +7 -3
- package/build/esm/utils/wrapEvent.js.map +1 -1
- package/build/tsconfig-build.tsbuildinfo +1 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/Accordion/Accordion.story.tsx +1 -0
- package/src/Accordion/Accordion.tsx +15 -7
- package/src/Accordion/AccordionBody.tsx +7 -8
- package/src/Accordion/AccordionHeader.tsx +35 -33
- package/src/Accordion/AccordionItem.tsx +15 -7
- package/src/Accordion/context.ts +5 -3
- package/src/CheckBox/CheckBox.tsx +6 -6
- package/src/ComboBox/ComboBox.story.tsx +5 -5
- package/src/ComboBox/Combobox.tsx +12 -17
- package/src/ComboBox/ComboboxButton.tsx +16 -15
- package/src/ComboBox/ComboboxInput.tsx +19 -10
- package/src/ComboBox/ComboboxLabel.tsx +5 -4
- package/src/ComboBox/ComboboxList.tsx +6 -6
- package/src/ComboBox/ComboboxOption.tsx +11 -7
- package/src/ComboBox/ComboboxPopover.tsx +14 -8
- package/src/ComboBox/context.ts +14 -12
- package/src/ComboBox/hooks.tsx +9 -11
- package/src/FocusLock/FocusLock.tsx +14 -7
- package/src/FocusLock/useFocusLock.ts +5 -3
- package/src/List/List.tsx +5 -5
- package/src/List/ListItem.tsx +5 -5
- package/src/Menu/Menu.story.tsx +7 -6
- package/src/Menu/Menu.tsx +16 -8
- package/src/Menu/MenuButton.tsx +15 -16
- package/src/Menu/MenuItem.tsx +15 -10
- package/src/Menu/MenuList.tsx +8 -12
- package/src/Menu/MenuPopover.tsx +7 -5
- package/src/Menu/context.ts +10 -4
- package/src/Modal/Modal.story.tsx +1 -0
- package/src/Modal/Modal.tsx +12 -6
- package/src/Modal/ModalBackdrop.tsx +15 -9
- package/src/Modal/NavDrawer.story.tsx +3 -3
- package/src/Popper/Popper.story.tsx +3 -4
- package/src/Popper/Popper.tsx +13 -12
- package/src/Popper/PopperArrow.tsx +5 -4
- package/src/Popper/context.ts +2 -1
- package/src/Portal/Portal.tsx +1 -1
- package/src/RadioButton/RadioButton.story.tsx +1 -0
- package/src/RadioButton/RadioButton.tsx +14 -7
- package/src/RadioButton/RadioGroup.tsx +14 -10
- package/src/RadioButton/context.ts +2 -4
- package/src/SkipNav/SkipNav.tsx +5 -5
- package/src/Spinner/Spinner.story.tsx +1 -0
- package/src/Spinner/Spinner.tsx +14 -9
- package/src/Spinner/SpinnerButton.tsx +12 -6
- package/src/Spinner/context.ts +2 -3
- package/src/Tabs/Tab.story.tsx +1 -0
- package/src/Tabs/Tab.tsx +16 -11
- package/src/Tabs/TabList.tsx +6 -5
- package/src/Tabs/TabPanel.tsx +6 -5
- package/src/Tabs/TabPanels.tsx +4 -4
- package/src/Tabs/Tabs.tsx +6 -7
- package/src/Tabs/context.ts +4 -4
- package/src/Tooltip/Tooltip.story.tsx +3 -2
- package/src/Tooltip/Tooltip.tsx +11 -9
- package/src/Tooltip/stateMachine.ts +1 -1
- package/src/Tooltip/useTooltip.ts +19 -10
- package/src/hooks/useAutoFocus.ts +3 -1
- package/src/hooks/useChildrenCounter.ts +2 -1
- package/src/hooks/useControlledState.ts +7 -8
- package/src/hooks/useFocusReturn.ts +2 -1
- package/src/hooks/useFocusState.ts +4 -2
- package/src/hooks/useGestureHandlers.ts +11 -7
- package/src/hooks/useMeasure.ts +2 -1
- package/src/hooks/useOnClickOutside.ts +2 -2
- package/src/hooks/useReducerMachine.ts +2 -1
- package/src/hooks/useScope.ts +2 -1
- package/src/utils/assignRef.ts +1 -1
- package/src/utils/wrapEvent.ts +4 -5
package/src/Menu/Menu.story.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { MouseEvent } from 'react';
|
|
1
2
|
import { useState } from 'react';
|
|
2
|
-
import type * as React from 'react';
|
|
3
|
-
import { Menu, MenuButton, MenuItem, MenuList, MenuPopover } from './';
|
|
4
3
|
import { animated, useSpring } from 'react-spring';
|
|
4
|
+
|
|
5
|
+
import { Menu, MenuButton, MenuItem, MenuList, MenuPopover } from './';
|
|
5
6
|
import './styles.css';
|
|
6
7
|
|
|
7
8
|
export default {
|
|
@@ -13,7 +14,7 @@ const noop = () => {
|
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
const Wrapper = ({ children }) => {
|
|
16
|
-
const handleLinkClick = (e:
|
|
17
|
+
const handleLinkClick = (e: MouseEvent<HTMLAnchorElement>) => {
|
|
17
18
|
console.log('Clicked ' + e.currentTarget.innerText);
|
|
18
19
|
e.preventDefault();
|
|
19
20
|
};
|
|
@@ -91,10 +92,10 @@ const MenuControlledWithAnimation = () => {
|
|
|
91
92
|
<MenuList
|
|
92
93
|
as={animated.ul}
|
|
93
94
|
style={{
|
|
94
|
-
opacity:
|
|
95
|
-
transform:
|
|
95
|
+
opacity: opacity as unknown as number,
|
|
96
|
+
transform: scale.to(
|
|
96
97
|
(x) => `scale(${x}, ${x * x})`
|
|
97
|
-
) as unknown
|
|
98
|
+
) as unknown as string,
|
|
98
99
|
}}
|
|
99
100
|
>
|
|
100
101
|
<MenuItem>Dog</MenuItem>
|
package/src/Menu/Menu.tsx
CHANGED
|
@@ -1,17 +1,25 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
KeyboardEvent,
|
|
3
|
+
MouseEvent,
|
|
4
|
+
PointerEvent,
|
|
5
|
+
ReactNode,
|
|
6
|
+
ElementType,
|
|
7
|
+
} from 'react';
|
|
1
8
|
import { forwardRef, useRef, Fragment, useId } from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
9
|
+
|
|
10
|
+
import type { MenuContextProps } from './context';
|
|
11
|
+
import { MenuProvider } from './context';
|
|
4
12
|
import { useControlledState } from '../hooks';
|
|
5
13
|
|
|
6
14
|
export interface MenuProps {
|
|
7
|
-
as?:
|
|
8
|
-
innerAs?:
|
|
9
|
-
children?:
|
|
15
|
+
as?: ElementType<any>;
|
|
16
|
+
innerAs?: ElementType<any>;
|
|
17
|
+
children?: ReactNode;
|
|
10
18
|
onChange?: (
|
|
11
19
|
e:
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
20
|
+
| KeyboardEvent<HTMLElement>
|
|
21
|
+
| MouseEvent<HTMLElement>
|
|
22
|
+
| PointerEvent<HTMLElement>,
|
|
15
23
|
isOpen: boolean
|
|
16
24
|
) => void;
|
|
17
25
|
open?: boolean;
|
package/src/Menu/MenuButton.tsx
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ButtonHTMLAttributes,
|
|
3
|
+
ElementType,
|
|
4
|
+
KeyboardEvent,
|
|
5
|
+
MouseEvent,
|
|
6
|
+
} from 'react';
|
|
1
7
|
import { forwardRef, useId } from 'react';
|
|
2
|
-
|
|
8
|
+
|
|
3
9
|
import { useMenuContext } from './context';
|
|
4
10
|
import { wrapEvent } from '../utils/wrapEvent';
|
|
5
11
|
|
|
6
|
-
export type MenuButtonProps =
|
|
7
|
-
as?:
|
|
8
|
-
innerAs?:
|
|
12
|
+
export type MenuButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
13
|
+
as?: ElementType<any>;
|
|
14
|
+
innerAs?: ElementType<any>;
|
|
9
15
|
onClick?: (
|
|
10
|
-
e:
|
|
11
|
-
| React.MouseEvent<HTMLButtonElement>
|
|
12
|
-
| React.KeyboardEvent<HTMLButtonElement>
|
|
16
|
+
e: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>
|
|
13
17
|
) => void;
|
|
14
18
|
};
|
|
15
19
|
|
|
@@ -23,18 +27,13 @@ export const MenuButton = forwardRef<HTMLButtonElement, MenuButtonProps>(
|
|
|
23
27
|
disabled,
|
|
24
28
|
...otherProps
|
|
25
29
|
} = props;
|
|
26
|
-
const {
|
|
27
|
-
|
|
28
|
-
openWithArrowKeyRef,
|
|
29
|
-
open,
|
|
30
|
-
buttonRef,
|
|
31
|
-
onChange,
|
|
32
|
-
} = useMenuContext();
|
|
30
|
+
const { menuListIdRef, openWithArrowKeyRef, open, buttonRef, onChange } =
|
|
31
|
+
useMenuContext();
|
|
33
32
|
|
|
34
33
|
const buttonIdGenerated = useId();
|
|
35
34
|
const buttonId = preferredId || buttonIdGenerated;
|
|
36
35
|
|
|
37
|
-
const handleKeyDown = (e:
|
|
36
|
+
const handleKeyDown = (e: KeyboardEvent<HTMLButtonElement>) => {
|
|
38
37
|
if (disabled) {
|
|
39
38
|
return;
|
|
40
39
|
}
|
|
@@ -54,7 +53,7 @@ export const MenuButton = forwardRef<HTMLButtonElement, MenuButtonProps>(
|
|
|
54
53
|
}
|
|
55
54
|
};
|
|
56
55
|
|
|
57
|
-
const handleClick = (e:
|
|
56
|
+
const handleClick = (e: MouseEvent<HTMLButtonElement>) => {
|
|
58
57
|
if (disabled) {
|
|
59
58
|
return;
|
|
60
59
|
}
|
package/src/Menu/MenuItem.tsx
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
LiHTMLAttributes,
|
|
3
|
+
ElementType,
|
|
4
|
+
MouseEvent,
|
|
5
|
+
KeyboardEvent,
|
|
6
|
+
KeyboardEventHandler,
|
|
7
|
+
} from 'react';
|
|
1
8
|
import { forwardRef, useRef, useId } from 'react';
|
|
2
|
-
|
|
9
|
+
|
|
3
10
|
import { useMenuContext, useMenuListContext } from './context';
|
|
4
11
|
import { assignMultipleRefs } from '../utils/assignRef';
|
|
5
12
|
import { wrapEvent } from '../utils';
|
|
6
13
|
|
|
7
|
-
export interface MenuItemProps extends
|
|
8
|
-
as?:
|
|
9
|
-
innerAs?:
|
|
14
|
+
export interface MenuItemProps extends LiHTMLAttributes<HTMLLIElement> {
|
|
15
|
+
as?: ElementType<any>;
|
|
16
|
+
innerAs?: ElementType<any>;
|
|
10
17
|
onSelect?: (
|
|
11
|
-
e:
|
|
18
|
+
e: MouseEvent<HTMLLIElement> | KeyboardEvent<HTMLLIElement>
|
|
12
19
|
) => void;
|
|
13
20
|
disabled?: boolean;
|
|
14
21
|
}
|
|
@@ -34,16 +41,14 @@ export const MenuItem = forwardRef<any, MenuItemProps>(function MenuItem(
|
|
|
34
41
|
|
|
35
42
|
const handleSelect = wrapEvent(
|
|
36
43
|
onSelect,
|
|
37
|
-
(
|
|
38
|
-
e: React.KeyboardEvent<HTMLLIElement> | React.MouseEvent<HTMLLIElement>
|
|
39
|
-
) => {
|
|
44
|
+
(e: KeyboardEvent<HTMLLIElement> | MouseEvent<HTMLLIElement>) => {
|
|
40
45
|
onChange && onChange(e, false);
|
|
41
46
|
buttonRef.current?.focus();
|
|
42
47
|
e.preventDefault();
|
|
43
48
|
}
|
|
44
49
|
);
|
|
45
50
|
|
|
46
|
-
const handleClick = (e:
|
|
51
|
+
const handleClick = (e: MouseEvent<HTMLLIElement>) => {
|
|
47
52
|
if (!disabled) {
|
|
48
53
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
49
54
|
onNavigate && onNavigate(ref.current!);
|
|
@@ -51,7 +56,7 @@ export const MenuItem = forwardRef<any, MenuItemProps>(function MenuItem(
|
|
|
51
56
|
}
|
|
52
57
|
};
|
|
53
58
|
|
|
54
|
-
const handleKeyDown:
|
|
59
|
+
const handleKeyDown: KeyboardEventHandler<HTMLLIElement> = (e) => {
|
|
55
60
|
switch (e.key) {
|
|
56
61
|
case 'Enter':
|
|
57
62
|
case ' ':
|
package/src/Menu/MenuList.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { HTMLAttributes, ElementType, KeyboardEvent } from 'react';
|
|
1
2
|
import {
|
|
2
3
|
forwardRef,
|
|
3
4
|
useEffect,
|
|
@@ -5,7 +6,7 @@ import {
|
|
|
5
6
|
useState,
|
|
6
7
|
useLayoutEffect,
|
|
7
8
|
} from 'react';
|
|
8
|
-
|
|
9
|
+
|
|
9
10
|
import { useMenuContext, MenuListProvider } from './context';
|
|
10
11
|
import { assignMultipleRefs } from '../utils/assignRef';
|
|
11
12
|
import { useOnClickOutside } from '../hooks/useOnClickOutside';
|
|
@@ -16,9 +17,9 @@ import { getCircularIndex, wrapEvent } from '../utils';
|
|
|
16
17
|
const useEnhancedEffect =
|
|
17
18
|
typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
18
19
|
|
|
19
|
-
export interface MenuListProps extends
|
|
20
|
-
as?:
|
|
21
|
-
innerAs?:
|
|
20
|
+
export interface MenuListProps extends HTMLAttributes<HTMLUListElement> {
|
|
21
|
+
as?: ElementType<any>;
|
|
22
|
+
innerAs?: ElementType<any>;
|
|
22
23
|
defaultActiveItemValue?: string;
|
|
23
24
|
}
|
|
24
25
|
|
|
@@ -32,13 +33,8 @@ export const MenuList = forwardRef<HTMLUListElement, MenuListProps>(
|
|
|
32
33
|
...otherProps
|
|
33
34
|
} = props;
|
|
34
35
|
|
|
35
|
-
const {
|
|
36
|
-
|
|
37
|
-
buttonRef,
|
|
38
|
-
onChange,
|
|
39
|
-
openWithArrowKeyRef,
|
|
40
|
-
open,
|
|
41
|
-
} = useMenuContext();
|
|
36
|
+
const { menuListIdRef, buttonRef, onChange, openWithArrowKeyRef, open } =
|
|
37
|
+
useMenuContext();
|
|
42
38
|
|
|
43
39
|
const [navigationItem, setNavigationItem] = useState<
|
|
44
40
|
HTMLElement | undefined
|
|
@@ -105,7 +101,7 @@ export const MenuList = forwardRef<HTMLUListElement, MenuListProps>(
|
|
|
105
101
|
true
|
|
106
102
|
);
|
|
107
103
|
|
|
108
|
-
function handleKeyDown(e:
|
|
104
|
+
function handleKeyDown(e: KeyboardEvent<HTMLUListElement>) {
|
|
109
105
|
switch (e.key) {
|
|
110
106
|
case 'Escape':
|
|
111
107
|
case 'Tab': {
|
package/src/Menu/MenuPopover.tsx
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import type { ElementType, ReactNode } from 'react';
|
|
1
2
|
import { forwardRef } from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
3
|
+
|
|
4
|
+
import type { PopperProps } from '../Popper';
|
|
5
|
+
import { Popper } from '../Popper';
|
|
4
6
|
import { useMenuContext } from './context';
|
|
5
7
|
|
|
6
8
|
export interface MenuPopoverProps extends Omit<PopperProps, 'anchorEl'> {
|
|
7
|
-
as?:
|
|
8
|
-
innerAs?:
|
|
9
|
-
children?:
|
|
9
|
+
as?: ElementType<any>;
|
|
10
|
+
innerAs?: ElementType<any>;
|
|
11
|
+
children?: ReactNode;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
export const MenuPopover = forwardRef<HTMLDivElement, MenuPopoverProps>(
|
package/src/Menu/context.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
|
+
KeyboardEvent,
|
|
3
|
+
MouseEvent,
|
|
4
|
+
MutableRefObject,
|
|
5
|
+
PointerEvent,
|
|
6
|
+
} from 'react';
|
|
7
|
+
import { createContext, useContext } from 'react';
|
|
2
8
|
|
|
3
9
|
export type ItemObject = { text: string; value: any; id: string | undefined };
|
|
4
10
|
|
|
@@ -9,9 +15,9 @@ export interface MenuContextProps {
|
|
|
9
15
|
openWithArrowKeyRef: MutableRefObject<string | null>;
|
|
10
16
|
onChange?: (
|
|
11
17
|
e:
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
18
|
+
| KeyboardEvent<HTMLElement>
|
|
19
|
+
| MouseEvent<HTMLElement>
|
|
20
|
+
| PointerEvent<HTMLElement>,
|
|
15
21
|
isOpen: boolean
|
|
16
22
|
) => void;
|
|
17
23
|
open: boolean;
|
package/src/Modal/Modal.tsx
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type {
|
|
2
|
+
CSSProperties,
|
|
3
|
+
ElementType,
|
|
4
|
+
HTMLAttributes,
|
|
5
|
+
ReactNode,
|
|
6
|
+
} from 'react';
|
|
7
|
+
import { forwardRef, useRef } from 'react';
|
|
8
|
+
|
|
3
9
|
import { useAutoFocus, useFocusReturn, useRemoveBodyScroll } from '../hooks';
|
|
4
10
|
import { FocusLock } from '../FocusLock';
|
|
5
11
|
import { assignMultipleRefs } from '../utils';
|
|
6
12
|
|
|
7
|
-
export interface ModalProps extends
|
|
8
|
-
as?:
|
|
9
|
-
innerAs?:
|
|
13
|
+
export interface ModalProps extends HTMLAttributes<HTMLDivElement> {
|
|
14
|
+
as?: ElementType<any>;
|
|
15
|
+
innerAs?: ElementType<any>;
|
|
10
16
|
children?: ReactNode;
|
|
11
|
-
style?:
|
|
17
|
+
style?: CSSProperties;
|
|
12
18
|
trapFocus?: boolean;
|
|
13
19
|
}
|
|
14
20
|
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
HTMLAttributes,
|
|
3
|
+
ElementType,
|
|
4
|
+
CSSProperties,
|
|
5
|
+
MouseEvent,
|
|
6
|
+
KeyboardEvent,
|
|
7
|
+
} from 'react';
|
|
1
8
|
import { useRef, forwardRef } from 'react';
|
|
2
|
-
|
|
9
|
+
|
|
3
10
|
import { assignMultipleRefs } from '../utils/assignRef';
|
|
4
11
|
import { wrapEvent } from '../utils/wrapEvent';
|
|
5
12
|
|
|
6
|
-
export interface ModalBackdropProps
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
innerAs?: React.ElementType<any>;
|
|
13
|
+
export interface ModalBackdropProps extends HTMLAttributes<HTMLDivElement> {
|
|
14
|
+
as?: ElementType<any>;
|
|
15
|
+
innerAs?: ElementType<any>;
|
|
10
16
|
onClose?: () => void;
|
|
11
|
-
style?:
|
|
17
|
+
style?: CSSProperties;
|
|
12
18
|
disableCloseOnClick?: boolean;
|
|
13
19
|
disableEscapeKeyDown?: boolean;
|
|
14
20
|
}
|
|
@@ -30,7 +36,7 @@ export const ModalBackdrop = forwardRef<HTMLDivElement, ModalBackdropProps>(
|
|
|
30
36
|
const ref = useRef();
|
|
31
37
|
const mouseDownTargetRef = useRef<EventTarget | null>(null);
|
|
32
38
|
|
|
33
|
-
const handleClick = (e:
|
|
39
|
+
const handleClick = (e: MouseEvent<HTMLDivElement>) => {
|
|
34
40
|
// Ignore the events not coming from the "backdrop"
|
|
35
41
|
// We don't want to close the dialog when clicking the dialog content.
|
|
36
42
|
if (e.target !== e.currentTarget) {
|
|
@@ -47,11 +53,11 @@ export const ModalBackdrop = forwardRef<HTMLDivElement, ModalBackdropProps>(
|
|
|
47
53
|
e.stopPropagation();
|
|
48
54
|
};
|
|
49
55
|
|
|
50
|
-
const handleMouseDown = (e:
|
|
56
|
+
const handleMouseDown = (e: MouseEvent<HTMLDivElement>) => {
|
|
51
57
|
mouseDownTargetRef.current = e.target;
|
|
52
58
|
};
|
|
53
59
|
|
|
54
|
-
const handleKeyDown = (e:
|
|
60
|
+
const handleKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {
|
|
55
61
|
if (e.key === 'Escape') {
|
|
56
62
|
!disableEscapeKeyDown && onClose?.();
|
|
57
63
|
e.stopPropagation();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { useSpring, animated } from 'react-spring';
|
|
3
|
+
|
|
3
4
|
import { Modal, ModalBackdrop } from './';
|
|
4
5
|
import { Portal } from '../Portal';
|
|
5
6
|
import './styles.css';
|
|
@@ -65,9 +66,8 @@ const Wrapper = ({ children }) => {
|
|
|
65
66
|
|
|
66
67
|
const SimpleModalControlledAnimated = () => {
|
|
67
68
|
const [open, setOpen] = useState(false);
|
|
68
|
-
const [pointerEvents, setPointerEvents] =
|
|
69
|
-
'none'
|
|
70
|
-
);
|
|
69
|
+
const [pointerEvents, setPointerEvents] =
|
|
70
|
+
useState<PointerEventsProperty>('none');
|
|
71
71
|
const [{ transformX, opacity }, set] = useSpring(() => ({
|
|
72
72
|
transformX: -120,
|
|
73
73
|
opacity: 0,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useRef, useState, useEffect } from 'react';
|
|
2
2
|
import { useSpring, animated } from 'react-spring';
|
|
3
|
+
|
|
3
4
|
import { Popper } from './Popper';
|
|
4
5
|
import { PopperArrow } from './PopperArrow';
|
|
5
6
|
import './styles.css';
|
|
@@ -160,9 +161,7 @@ function Menu() {
|
|
|
160
161
|
);
|
|
161
162
|
}
|
|
162
163
|
|
|
163
|
-
const PopperFixedExample = (
|
|
164
|
-
const ref = useRef<any>(null);
|
|
165
|
-
|
|
164
|
+
const PopperFixedExample = () => {
|
|
166
165
|
return (
|
|
167
166
|
<>
|
|
168
167
|
<div
|
|
@@ -259,6 +258,6 @@ export const AllPointsWithArrow = () => (
|
|
|
259
258
|
<PopperExample showAll={true} showArrow={true} />
|
|
260
259
|
);
|
|
261
260
|
|
|
262
|
-
export const FixedPopperAllPoints = () => <PopperFixedExample
|
|
261
|
+
export const FixedPopperAllPoints = () => <PopperFixedExample />;
|
|
263
262
|
export const RerenderingPopper = () => <RerenderingPopperExample />;
|
|
264
263
|
export const JumpingPopper = () => <JumpingPopperExample />;
|
package/src/Popper/Popper.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { HTMLAttributes, ElementType, RefObject, ReactNode } from 'react';
|
|
1
2
|
import {
|
|
2
3
|
forwardRef,
|
|
3
4
|
useRef,
|
|
@@ -6,22 +7,22 @@ import {
|
|
|
6
7
|
useMemo,
|
|
7
8
|
memo,
|
|
8
9
|
} from 'react';
|
|
9
|
-
import type
|
|
10
|
-
import { assignMultipleRefs } from '../utils/assignRef';
|
|
11
|
-
import { PopperProvider, PopperContextProps } from './context';
|
|
12
|
-
import { Portal } from '../Portal';
|
|
13
|
-
|
|
14
|
-
import {
|
|
10
|
+
import type {
|
|
15
11
|
Placement,
|
|
16
12
|
Modifier,
|
|
17
13
|
PositioningStrategy,
|
|
18
14
|
Instance,
|
|
19
15
|
Rect,
|
|
20
|
-
createPopper,
|
|
21
16
|
} from '@popperjs/core';
|
|
17
|
+
import { createPopper } from '@popperjs/core';
|
|
22
18
|
import type { OffsetModifier } from '@popperjs/core/lib/modifiers/offset';
|
|
23
19
|
import type { ArrowModifier } from '@popperjs/core/lib/modifiers/arrow';
|
|
24
20
|
|
|
21
|
+
import { assignMultipleRefs } from '../utils/assignRef';
|
|
22
|
+
import type { PopperContextProps } from './context';
|
|
23
|
+
import { PopperProvider } from './context';
|
|
24
|
+
import { Portal } from '../Portal';
|
|
25
|
+
|
|
25
26
|
const useEnhancedEffect =
|
|
26
27
|
typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
27
28
|
|
|
@@ -31,11 +32,11 @@ export type OffsetsFunction = (arg0: {
|
|
|
31
32
|
placement: Placement;
|
|
32
33
|
}) => [number | null | undefined, number | null | undefined];
|
|
33
34
|
|
|
34
|
-
export interface PopperProps extends
|
|
35
|
-
as?:
|
|
36
|
-
innerAs?:
|
|
37
|
-
anchorEl:
|
|
38
|
-
children?:
|
|
35
|
+
export interface PopperProps extends HTMLAttributes<HTMLDivElement> {
|
|
36
|
+
as?: ElementType<any>;
|
|
37
|
+
innerAs?: ElementType<any>;
|
|
38
|
+
anchorEl: RefObject<HTMLElement>;
|
|
39
|
+
children?: ReactNode;
|
|
39
40
|
placement?: Placement;
|
|
40
41
|
strategy?: PositioningStrategy;
|
|
41
42
|
modifiers?: Array<Partial<Modifier<any, any>>>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import type { ElementType, HTMLAttributes } from 'react';
|
|
1
2
|
import { forwardRef } from 'react';
|
|
2
|
-
|
|
3
|
+
|
|
3
4
|
import { usePopperContext } from './context';
|
|
4
5
|
import { assignRef } from '../utils/assignRef';
|
|
5
6
|
|
|
6
|
-
export interface PopperArrowProps extends
|
|
7
|
-
as?:
|
|
8
|
-
innerAs?:
|
|
7
|
+
export interface PopperArrowProps extends HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
as?: ElementType<any>;
|
|
9
|
+
innerAs?: ElementType<any>;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export const PopperArrow = forwardRef<HTMLDivElement, PopperArrowProps>(
|
package/src/Popper/context.ts
CHANGED
package/src/Portal/Portal.tsx
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ChangeEvent,
|
|
3
|
+
ElementType,
|
|
4
|
+
InputHTMLAttributes,
|
|
5
|
+
ReactNode,
|
|
6
|
+
} from 'react';
|
|
1
7
|
import { forwardRef } from 'react';
|
|
2
|
-
|
|
3
|
-
import { RadioValue
|
|
8
|
+
|
|
9
|
+
import type { RadioValue } from './context';
|
|
10
|
+
import { useRadioGroupContext } from './context';
|
|
4
11
|
import { wrapEvent } from '../utils';
|
|
5
12
|
|
|
6
13
|
export interface RadioButtonProps
|
|
7
|
-
extends Omit<
|
|
8
|
-
as?:
|
|
9
|
-
innerAs?:
|
|
10
|
-
children?:
|
|
14
|
+
extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value'> {
|
|
15
|
+
as?: ElementType<any>;
|
|
16
|
+
innerAs?: ElementType<any>;
|
|
17
|
+
children?: ReactNode;
|
|
11
18
|
checked?: boolean;
|
|
12
19
|
value: RadioValue;
|
|
13
20
|
}
|
|
@@ -24,7 +31,7 @@ export const RadioButton = forwardRef<HTMLInputElement, RadioButtonProps>(
|
|
|
24
31
|
} = props;
|
|
25
32
|
const radioGroupContext = useRadioGroupContext();
|
|
26
33
|
|
|
27
|
-
const handleChange = (e:
|
|
34
|
+
const handleChange = (e: ChangeEvent<HTMLInputElement>) => {
|
|
28
35
|
radioGroupContext?.onChange?.(e, valueProp);
|
|
29
36
|
};
|
|
30
37
|
|
|
@@ -1,23 +1,27 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ChangeEvent,
|
|
3
|
+
ElementType,
|
|
4
|
+
HTMLAttributes,
|
|
5
|
+
ReactNode,
|
|
6
|
+
} from 'react';
|
|
1
7
|
import { forwardRef, useId } from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
8
|
+
|
|
9
|
+
import type { RadioValue } from './context';
|
|
10
|
+
import { RadioGroupProvider } from './context';
|
|
4
11
|
import { useControlledState } from '../hooks';
|
|
5
12
|
|
|
6
13
|
export interface RadioGroupProps
|
|
7
14
|
extends Omit<
|
|
8
|
-
|
|
15
|
+
HTMLAttributes<HTMLDivElement>,
|
|
9
16
|
'onChange' | 'value' | 'defaultValue'
|
|
10
17
|
> {
|
|
11
|
-
as?:
|
|
12
|
-
innerAs?:
|
|
13
|
-
children?:
|
|
18
|
+
as?: ElementType<any>;
|
|
19
|
+
innerAs?: ElementType<any>;
|
|
20
|
+
children?: ReactNode;
|
|
14
21
|
value?: RadioValue;
|
|
15
22
|
defaultValue?: RadioValue;
|
|
16
23
|
name?: string;
|
|
17
|
-
onChange?: (
|
|
18
|
-
e: React.ChangeEvent<HTMLInputElement>,
|
|
19
|
-
value: RadioValue
|
|
20
|
-
) => void;
|
|
24
|
+
onChange?: (e: ChangeEvent<HTMLInputElement>, value: RadioValue) => void;
|
|
21
25
|
}
|
|
22
26
|
|
|
23
27
|
export const RadioGroup = forwardRef<HTMLDivElement, RadioGroupProps>(
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ChangeEvent } from 'react';
|
|
1
2
|
import { createContext, useContext } from 'react';
|
|
2
3
|
|
|
3
4
|
export type RadioValue = string | number | boolean;
|
|
@@ -5,10 +6,7 @@ export type RadioValue = string | number | boolean;
|
|
|
5
6
|
// RadioGroup Component
|
|
6
7
|
export interface RadioGroupContextProps {
|
|
7
8
|
value: RadioValue | undefined;
|
|
8
|
-
onChange?: (
|
|
9
|
-
e: React.ChangeEvent<HTMLInputElement>,
|
|
10
|
-
value: RadioValue
|
|
11
|
-
) => void;
|
|
9
|
+
onChange?: (e: ChangeEvent<HTMLInputElement>, value: RadioValue) => void;
|
|
12
10
|
name: string | undefined;
|
|
13
11
|
}
|
|
14
12
|
|
package/src/SkipNav/SkipNav.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import type { ElementType, HTMLAttributes, ReactNode } from 'react';
|
|
1
2
|
import { forwardRef } from 'react';
|
|
2
|
-
import type * as React from 'react';
|
|
3
3
|
|
|
4
|
-
export interface SkipNavProps extends
|
|
5
|
-
as?:
|
|
6
|
-
innerAs?:
|
|
7
|
-
children?:
|
|
4
|
+
export interface SkipNavProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
as?: ElementType<any>;
|
|
6
|
+
innerAs?: ElementType<any>;
|
|
7
|
+
children?: ReactNode;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export const SkipNav = forwardRef<HTMLDivElement, SkipNavProps>(
|
package/src/Spinner/Spinner.tsx
CHANGED
|
@@ -1,22 +1,27 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
HTMLAttributes,
|
|
3
|
+
ElementType,
|
|
4
|
+
ReactNode,
|
|
5
|
+
MouseEvent,
|
|
6
|
+
KeyboardEvent,
|
|
7
|
+
} from 'react';
|
|
1
8
|
import { forwardRef, useState, useRef } from 'react';
|
|
2
|
-
|
|
9
|
+
|
|
3
10
|
import { SpinnerProvider } from './context';
|
|
4
11
|
import { clamp as clampFunc } from '../utils/clamp';
|
|
5
12
|
import { wrapEvent, assignMultipleRefs } from '../utils';
|
|
6
13
|
|
|
7
14
|
export interface SpinnerProps
|
|
8
|
-
extends Omit<
|
|
9
|
-
as?:
|
|
10
|
-
innerAs?:
|
|
11
|
-
children?:
|
|
15
|
+
extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
16
|
+
as?: ElementType<any>;
|
|
17
|
+
innerAs?: ElementType<any>;
|
|
18
|
+
children?: ReactNode;
|
|
12
19
|
value?: number;
|
|
13
20
|
minValue?: number;
|
|
14
21
|
maxValue?: number;
|
|
15
22
|
stepSize?: number;
|
|
16
23
|
onChange?: (
|
|
17
|
-
e:
|
|
18
|
-
| React.MouseEvent<HTMLButtonElement>
|
|
19
|
-
| React.KeyboardEvent<HTMLDivElement>,
|
|
24
|
+
e: MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLDivElement>,
|
|
20
25
|
value: number
|
|
21
26
|
) => void;
|
|
22
27
|
}
|
|
@@ -40,7 +45,7 @@ export const Spinner = forwardRef<HTMLDivElement, SpinnerProps>(
|
|
|
40
45
|
|
|
41
46
|
const clamp = (value: number) => clampFunc(value, minValue, maxValue);
|
|
42
47
|
|
|
43
|
-
const handleKeyDown = (e:
|
|
48
|
+
const handleKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {
|
|
44
49
|
let nextValue = value;
|
|
45
50
|
switch (e.key) {
|
|
46
51
|
case 'ArrowUp':
|