@basic-ui/core 0.0.38 → 0.0.39
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.map +1 -1
- package/build/esm/Accordion/Accordion.d.ts +1 -1
- package/build/esm/Accordion/Accordion.js +23 -17
- package/build/esm/Accordion/Accordion.js.map +1 -1
- package/build/esm/Accordion/AccordionBody.d.ts +1 -1
- package/build/esm/Accordion/AccordionBody.js +24 -15
- package/build/esm/Accordion/AccordionBody.js.map +1 -1
- package/build/esm/Accordion/AccordionHeader.d.ts +1 -1
- package/build/esm/Accordion/AccordionHeader.js +46 -31
- package/build/esm/Accordion/AccordionHeader.js.map +1 -1
- package/build/esm/Accordion/AccordionItem.d.ts +1 -1
- package/build/esm/Accordion/AccordionItem.js +17 -16
- package/build/esm/Accordion/AccordionItem.js.map +1 -1
- package/build/esm/Accordion/context.d.ts +1 -1
- package/build/esm/Accordion/context.js +12 -10
- package/build/esm/Accordion/context.js.map +1 -1
- package/build/esm/CheckBox/CheckBox.d.ts +1 -1
- package/build/esm/CheckBox/CheckBox.js +20 -12
- package/build/esm/CheckBox/CheckBox.js.map +1 -1
- package/build/esm/ComboBox/Combobox.d.ts +1 -1
- package/build/esm/ComboBox/Combobox.js +53 -46
- package/build/esm/ComboBox/Combobox.js.map +1 -1
- package/build/esm/ComboBox/ComboboxButton.d.ts +1 -1
- package/build/esm/ComboBox/ComboboxButton.js +20 -20
- package/build/esm/ComboBox/ComboboxButton.js.map +1 -1
- package/build/esm/ComboBox/ComboboxInput.d.ts +1 -1
- package/build/esm/ComboBox/ComboboxInput.js +53 -50
- package/build/esm/ComboBox/ComboboxInput.js.map +1 -1
- package/build/esm/ComboBox/ComboboxLabel.d.ts +1 -1
- package/build/esm/ComboBox/ComboboxLabel.js +12 -12
- package/build/esm/ComboBox/ComboboxLabel.js.map +1 -1
- package/build/esm/ComboBox/ComboboxList.d.ts +1 -1
- package/build/esm/ComboBox/ComboboxList.js +16 -17
- package/build/esm/ComboBox/ComboboxList.js.map +1 -1
- package/build/esm/ComboBox/ComboboxOption.d.ts +1 -1
- package/build/esm/ComboBox/ComboboxOption.js +32 -34
- package/build/esm/ComboBox/ComboboxOption.js.map +1 -1
- package/build/esm/ComboBox/ComboboxPopover.d.ts +1 -1
- package/build/esm/ComboBox/ComboboxPopover.js +16 -17
- package/build/esm/ComboBox/ComboboxPopover.js.map +1 -1
- package/build/esm/ComboBox/context.d.ts +3 -3
- package/build/esm/ComboBox/context.js +6 -5
- package/build/esm/ComboBox/context.js.map +1 -1
- package/build/esm/ComboBox/hooks.d.ts +1 -1
- 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 +1 -1
- package/build/esm/FocusLock/FocusLock.js +18 -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.js +10 -11
- package/build/esm/FocusLock/useFocusLock.js.map +1 -1
- package/build/esm/List/List.d.ts +1 -1
- package/build/esm/List/List.js +6 -6
- package/build/esm/List/List.js.map +1 -1
- package/build/esm/List/ListItem.d.ts +1 -1
- package/build/esm/List/ListItem.js +6 -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 +1 -1
- package/build/esm/Menu/Menu.js +30 -21
- package/build/esm/Menu/Menu.js.map +1 -1
- package/build/esm/Menu/MenuButton.d.ts +1 -1
- package/build/esm/Menu/MenuButton.js +28 -24
- package/build/esm/Menu/MenuButton.js.map +1 -1
- package/build/esm/Menu/MenuItem.d.ts +1 -1
- package/build/esm/Menu/MenuItem.js +24 -24
- package/build/esm/Menu/MenuItem.js.map +1 -1
- package/build/esm/Menu/MenuList.d.ts +1 -1
- package/build/esm/Menu/MenuList.js +62 -45
- package/build/esm/Menu/MenuList.js.map +1 -1
- package/build/esm/Menu/MenuPopover.d.ts +2 -2
- package/build/esm/Menu/MenuPopover.js +9 -10
- package/build/esm/Menu/MenuPopover.js.map +1 -1
- package/build/esm/Menu/context.d.ts +1 -1
- package/build/esm/Menu/context.js +11 -8
- package/build/esm/Menu/context.js.map +1 -1
- package/build/esm/Modal/Modal.d.ts +2 -2
- package/build/esm/Modal/Modal.js +12 -10
- package/build/esm/Modal/Modal.js.map +1 -1
- package/build/esm/Modal/ModalBackdrop.d.ts +1 -1
- package/build/esm/Modal/ModalBackdrop.js +21 -19
- package/build/esm/Modal/ModalBackdrop.js.map +1 -1
- package/build/esm/Popper/Popper.d.ts +2 -2
- package/build/esm/Popper/Popper.js +47 -37
- package/build/esm/Popper/Popper.js.map +1 -1
- package/build/esm/Popper/PopperArrow.d.ts +1 -1
- package/build/esm/Popper/PopperArrow.js +9 -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 +2 -2
- package/build/esm/RadioButton/RadioButton.js +13 -13
- package/build/esm/RadioButton/RadioButton.js.map +1 -1
- package/build/esm/RadioButton/RadioGroup.d.ts +2 -2
- package/build/esm/RadioButton/RadioGroup.js +23 -16
- package/build/esm/RadioButton/RadioGroup.js.map +1 -1
- package/build/esm/RadioButton/context.js +6 -5
- package/build/esm/RadioButton/context.js.map +1 -1
- package/build/esm/SkipNav/SkipNav.d.ts +1 -1
- package/build/esm/SkipNav/SkipNav.js +6 -6
- package/build/esm/SkipNav/SkipNav.js.map +1 -1
- package/build/esm/Spinner/Spinner.d.ts +1 -1
- package/build/esm/Spinner/Spinner.js +42 -31
- package/build/esm/Spinner/Spinner.js.map +1 -1
- package/build/esm/Spinner/SpinnerButton.d.ts +1 -1
- package/build/esm/Spinner/SpinnerButton.js +12 -12
- package/build/esm/Spinner/SpinnerButton.js.map +1 -1
- package/build/esm/Spinner/context.js +6 -5
- package/build/esm/Spinner/context.js.map +1 -1
- package/build/esm/Tabs/Tab.d.ts +1 -1
- package/build/esm/Tabs/Tab.js +30 -29
- package/build/esm/Tabs/Tab.js.map +1 -1
- package/build/esm/Tabs/TabList.d.ts +1 -1
- package/build/esm/Tabs/TabList.js +25 -21
- package/build/esm/Tabs/TabList.js.map +1 -1
- package/build/esm/Tabs/TabPanel.d.ts +1 -1
- package/build/esm/Tabs/TabPanel.js +13 -12
- package/build/esm/Tabs/TabPanel.js.map +1 -1
- package/build/esm/Tabs/TabPanels.d.ts +1 -1
- package/build/esm/Tabs/TabPanels.js +14 -12
- package/build/esm/Tabs/TabPanels.js.map +1 -1
- package/build/esm/Tabs/Tabs.d.ts +1 -1
- package/build/esm/Tabs/Tabs.js +28 -14
- package/build/esm/Tabs/Tabs.js.map +1 -1
- package/build/esm/Tabs/context.d.ts +1 -1
- package/build/esm/Tabs/context.js +12 -10
- package/build/esm/Tabs/context.js.map +1 -1
- package/build/esm/Tooltip/Tooltip.d.ts +2 -1
- package/build/esm/Tooltip/Tooltip.js +17 -15
- 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 +1 -1
- package/build/esm/Tooltip/useTooltip.js +31 -29
- package/build/esm/Tooltip/useTooltip.js.map +1 -1
- 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 +1 -1
- 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.js +13 -9
- package/build/esm/hooks/useFocusState.js.map +1 -1
- package/build/esm/hooks/useGestureHandlers.js +59 -63
- package/build/esm/hooks/useGestureHandlers.js.map +1 -1
- package/build/esm/hooks/useMeasure.js +13 -7
- package/build/esm/hooks/useMeasure.js.map +1 -1
- 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.js +7 -3
- package/build/esm/utils/wrapEvent.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/Accordion/Accordion.story.tsx +1 -0
- package/src/Accordion/Accordion.tsx +4 -2
- package/src/Accordion/AccordionBody.tsx +4 -4
- package/src/Accordion/AccordionHeader.tsx +7 -8
- package/src/Accordion/AccordionItem.tsx +4 -2
- package/src/Accordion/context.ts +2 -1
- package/src/CheckBox/CheckBox.tsx +2 -1
- package/src/ComboBox/ComboBox.story.tsx +3 -3
- package/src/ComboBox/Combobox.tsx +8 -10
- package/src/ComboBox/ComboboxButton.tsx +4 -9
- package/src/ComboBox/ComboboxInput.tsx +2 -1
- package/src/ComboBox/ComboboxLabel.tsx +2 -1
- package/src/ComboBox/ComboboxList.tsx +2 -1
- package/src/ComboBox/ComboboxOption.tsx +1 -1
- package/src/ComboBox/ComboboxPopover.tsx +2 -1
- package/src/ComboBox/context.ts +4 -3
- package/src/ComboBox/hooks.tsx +6 -9
- package/src/FocusLock/FocusLock.tsx +2 -1
- package/src/FocusLock/useFocusLock.ts +1 -0
- package/src/List/List.tsx +1 -1
- package/src/List/ListItem.tsx +1 -1
- package/src/Menu/Menu.story.tsx +6 -5
- package/src/Menu/Menu.tsx +4 -2
- package/src/Menu/MenuButton.tsx +4 -8
- package/src/Menu/MenuItem.tsx +2 -1
- package/src/Menu/MenuList.tsx +4 -8
- package/src/Menu/MenuPopover.tsx +4 -2
- package/src/Menu/context.ts +2 -1
- package/src/Modal/Modal.story.tsx +1 -0
- package/src/Modal/Modal.tsx +4 -2
- package/src/Modal/ModalBackdrop.tsx +2 -1
- package/src/Modal/NavDrawer.story.tsx +3 -3
- package/src/Popper/Popper.story.tsx +3 -4
- package/src/Popper/Popper.tsx +8 -7
- package/src/Popper/PopperArrow.tsx +2 -1
- 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 +4 -2
- package/src/RadioButton/RadioGroup.tsx +4 -2
- package/src/SkipNav/SkipNav.tsx +1 -1
- package/src/Spinner/Spinner.story.tsx +1 -0
- package/src/Spinner/Spinner.tsx +2 -1
- package/src/Spinner/SpinnerButton.tsx +2 -1
- package/src/Tabs/Tab.story.tsx +1 -0
- package/src/Tabs/Tab.tsx +4 -4
- package/src/Tabs/TabList.tsx +2 -1
- package/src/Tabs/TabPanel.tsx +2 -1
- package/src/Tabs/TabPanels.tsx +1 -1
- package/src/Tabs/Tabs.tsx +2 -1
- package/src/Tabs/context.ts +2 -1
- package/src/Tooltip/Tooltip.story.tsx +2 -1
- package/src/Tooltip/Tooltip.tsx +3 -7
- package/src/Tooltip/stateMachine.ts +1 -1
- package/src/Tooltip/useTooltip.ts +3 -1
- package/src/hooks/useAutoFocus.ts +1 -0
- package/src/hooks/useChildrenCounter.ts +2 -1
- package/src/hooks/useControlledState.ts +3 -1
- package/src/hooks/useFocusReturn.ts +2 -1
- package/src/hooks/useFocusState.ts +1 -0
- package/src/hooks/useReducerMachine.ts +2 -1
- package/src/hooks/useScope.ts +2 -1
- package/src/utils/assignRef.ts +1 -1
- package/build/esm/hooks/useId.d.ts +0 -3
- package/build/esm/hooks/useId.js +0 -16
- package/build/esm/hooks/useId.js.map +0 -1
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { forwardRef, useRef, useMemo, useId } from 'react';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
ActionTypes,
|
|
9
|
-
} from './hooks';
|
|
10
|
-
import { ComboBoxProvider, ComboBoxContextProps } from './context';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
import type { ActionTypes } from './hooks';
|
|
5
|
+
import { stateChart, comboboxReducer, isVisible, INIT } from './hooks';
|
|
6
|
+
import type { ComboBoxContextProps } from './context';
|
|
7
|
+
import { ComboBoxProvider } from './context';
|
|
11
8
|
import { useReducerMachine } from '../hooks/useReducerMachine';
|
|
12
|
-
import { Scope
|
|
9
|
+
import type { Scope } from '../hooks';
|
|
10
|
+
import { getScope } from '../hooks';
|
|
13
11
|
|
|
14
12
|
export type SelectEventHandler = (
|
|
15
13
|
text: string,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
3
4
|
import { useComboBoxContext } from './context';
|
|
4
5
|
import { useKeyDown, IDLE, OPEN_WITH_BUTTON, CLOSE_WITH_BUTTON } from './hooks';
|
|
5
6
|
import { wrapEvent } from '../utils/wrapEvent';
|
|
@@ -21,14 +22,8 @@ export const ComboboxButton = forwardRef<
|
|
|
21
22
|
{ as: Comp = 'button', innerAs, onClick, onKeyDown, ...props },
|
|
22
23
|
ref
|
|
23
24
|
) {
|
|
24
|
-
const {
|
|
25
|
-
|
|
26
|
-
data,
|
|
27
|
-
state,
|
|
28
|
-
buttonRef,
|
|
29
|
-
listboxIdRef,
|
|
30
|
-
isVisible,
|
|
31
|
-
} = useComboBoxContext();
|
|
25
|
+
const { transition, data, state, buttonRef, listboxIdRef, isVisible } =
|
|
26
|
+
useComboBoxContext();
|
|
32
27
|
|
|
33
28
|
const handleKeyDown = useKeyDown();
|
|
34
29
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
2
2
|
import { forwardRef, useEffect, useRef } from 'react';
|
|
3
|
+
import * as React from 'react';
|
|
3
4
|
|
|
4
|
-
import type * as React from 'react';
|
|
5
5
|
import { SELECT_WITH_CLICK, CLEAR_SELECTION } from './hooks';
|
|
6
6
|
import { wrapEvent } from '../utils/wrapEvent';
|
|
7
7
|
import { useComboBoxContext } from './context';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
3
4
|
import { useKeyDown, useBlur } from './hooks';
|
|
4
5
|
import { wrapEvent } from '../utils/wrapEvent';
|
|
5
6
|
import { assignMultipleRefs } from '../utils/assignRef';
|
package/src/ComboBox/context.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createContext, useContext } from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
|
|
3
|
+
import type { ActionTypes, StateTypes, ReducerState } from './hooks';
|
|
4
|
+
import type { SelectEventHandler } from './Combobox';
|
|
5
|
+
import type { Scope } from '../hooks';
|
|
5
6
|
|
|
6
7
|
export interface ComboBoxContextProps {
|
|
7
8
|
data: Omit<ReducerState, 'state'>;
|
package/src/ComboBox/hooks.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
2
2
|
/* eslint-disable default-case */
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
import type {
|
|
5
6
|
StateChart as GenericStateChart,
|
|
6
7
|
StateMachineState,
|
|
7
8
|
} from '../hooks/useReducerMachine';
|
|
@@ -357,10 +358,8 @@ export function useKeyDown() {
|
|
|
357
358
|
}
|
|
358
359
|
case 'Enter': {
|
|
359
360
|
if (state === NAVIGATING && navigationItem !== '') {
|
|
360
|
-
const {
|
|
361
|
-
|
|
362
|
-
text: navigationText,
|
|
363
|
-
} = optionsRef.current[navigationItem];
|
|
361
|
+
const { value: navigationValue, text: navigationText } =
|
|
362
|
+
optionsRef.current[navigationItem];
|
|
364
363
|
|
|
365
364
|
// don't want to submit forms
|
|
366
365
|
event.preventDefault();
|
|
@@ -408,10 +407,8 @@ export function useBlur() {
|
|
|
408
407
|
transition(BLUR, { text: stateText, item: '' });
|
|
409
408
|
} else {
|
|
410
409
|
// select the currently selected item
|
|
411
|
-
const {
|
|
412
|
-
|
|
413
|
-
text: navigationText,
|
|
414
|
-
} = optionsRef.current[navigationItem];
|
|
410
|
+
const { value: navigationValue, text: navigationText } =
|
|
411
|
+
optionsRef.current[navigationItem];
|
|
415
412
|
|
|
416
413
|
onSelect &&
|
|
417
414
|
onSelect(navigationText, navigationItem, navigationValue);
|
package/src/List/List.tsx
CHANGED
package/src/List/ListItem.tsx
CHANGED
package/src/Menu/Menu.story.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
-
import
|
|
3
|
-
import { Menu, MenuButton, MenuItem, MenuList, MenuPopover } from './';
|
|
2
|
+
import * as React from 'react';
|
|
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 {
|
|
@@ -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,6 +1,8 @@
|
|
|
1
1
|
import { forwardRef, useRef, Fragment, useId } from 'react';
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
import type { MenuContextProps } from './context';
|
|
5
|
+
import { MenuProvider } from './context';
|
|
4
6
|
import { useControlledState } from '../hooks';
|
|
5
7
|
|
|
6
8
|
export interface MenuProps {
|
package/src/Menu/MenuButton.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { forwardRef, useId } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
3
4
|
import { useMenuContext } from './context';
|
|
4
5
|
import { wrapEvent } from '../utils/wrapEvent';
|
|
5
6
|
|
|
@@ -23,13 +24,8 @@ export const MenuButton = forwardRef<HTMLButtonElement, MenuButtonProps>(
|
|
|
23
24
|
disabled,
|
|
24
25
|
...otherProps
|
|
25
26
|
} = props;
|
|
26
|
-
const {
|
|
27
|
-
|
|
28
|
-
openWithArrowKeyRef,
|
|
29
|
-
open,
|
|
30
|
-
buttonRef,
|
|
31
|
-
onChange,
|
|
32
|
-
} = useMenuContext();
|
|
27
|
+
const { menuListIdRef, openWithArrowKeyRef, open, buttonRef, onChange } =
|
|
28
|
+
useMenuContext();
|
|
33
29
|
|
|
34
30
|
const buttonIdGenerated = useId();
|
|
35
31
|
const buttonId = preferredId || buttonIdGenerated;
|
package/src/Menu/MenuItem.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { forwardRef, useRef, useId } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
3
4
|
import { useMenuContext, useMenuListContext } from './context';
|
|
4
5
|
import { assignMultipleRefs } from '../utils/assignRef';
|
|
5
6
|
import { wrapEvent } from '../utils';
|
package/src/Menu/MenuList.tsx
CHANGED
|
@@ -5,7 +5,8 @@ import {
|
|
|
5
5
|
useState,
|
|
6
6
|
useLayoutEffect,
|
|
7
7
|
} from 'react';
|
|
8
|
-
import
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
|
|
9
10
|
import { useMenuContext, MenuListProvider } from './context';
|
|
10
11
|
import { assignMultipleRefs } from '../utils/assignRef';
|
|
11
12
|
import { useOnClickOutside } from '../hooks/useOnClickOutside';
|
|
@@ -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
|
package/src/Menu/MenuPopover.tsx
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import * as React from 'react';
|
|
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'> {
|
package/src/Menu/context.ts
CHANGED
package/src/Modal/Modal.tsx
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { ReactNode
|
|
2
|
-
import
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { forwardRef, useRef } from 'react';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
3
5
|
import { useAutoFocus, useFocusReturn, useRemoveBodyScroll } from '../hooks';
|
|
4
6
|
import { FocusLock } from '../FocusLock';
|
|
5
7
|
import { assignMultipleRefs } from '../utils';
|
|
@@ -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
|
@@ -6,22 +6,23 @@ import {
|
|
|
6
6
|
useMemo,
|
|
7
7
|
memo,
|
|
8
8
|
} from 'react';
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import { PopperProvider, PopperContextProps } from './context';
|
|
12
|
-
import { Portal } from '../Portal';
|
|
13
|
-
|
|
14
|
-
import {
|
|
9
|
+
import * as React from 'react';
|
|
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
|
|
package/src/Popper/context.ts
CHANGED
package/src/Portal/Portal.tsx
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
import type { RadioValue } from './context';
|
|
5
|
+
import { useRadioGroupContext } from './context';
|
|
4
6
|
import { wrapEvent } from '../utils';
|
|
5
7
|
|
|
6
8
|
export interface RadioButtonProps
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { forwardRef, useId } from 'react';
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
import type { RadioValue } from './context';
|
|
5
|
+
import { RadioGroupProvider } from './context';
|
|
4
6
|
import { useControlledState } from '../hooks';
|
|
5
7
|
|
|
6
8
|
export interface RadioGroupProps
|
package/src/SkipNav/SkipNav.tsx
CHANGED
package/src/Spinner/Spinner.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { forwardRef, useState, useRef } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
3
4
|
import { SpinnerProvider } from './context';
|
|
4
5
|
import { clamp as clampFunc } from '../utils/clamp';
|
|
5
6
|
import { wrapEvent, assignMultipleRefs } from '../utils';
|
package/src/Tabs/Tab.story.tsx
CHANGED
package/src/Tabs/Tab.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { forwardRef, useRef } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
3
4
|
import { useTabsContext, useTabListContext } from './context';
|
|
4
5
|
import { assignMultipleRefs, getCircularIndex, wrapEvent } from '../utils';
|
|
5
6
|
import { scopeQuery } from './scopeQuery';
|
|
@@ -59,9 +60,8 @@ export const Tab = forwardRef<HTMLButtonElement, TabProps>(function Tab(
|
|
|
59
60
|
const navigateIndex = (desiredIndex: number, isLast: boolean) => {
|
|
60
61
|
const delta = e.key === right || e.key === first ? 1 : -1;
|
|
61
62
|
|
|
62
|
-
const allTabs =
|
|
63
|
-
scopeQuery
|
|
64
|
-
);
|
|
63
|
+
const allTabs =
|
|
64
|
+
tabListContext.tabsScope.current.queryAllNodes(scopeQuery);
|
|
65
65
|
const currentIndex = ref.current ? allTabs.indexOf(ref.current) : -1;
|
|
66
66
|
|
|
67
67
|
const nextIndex = getNextIndex(
|
package/src/Tabs/TabList.tsx
CHANGED
|
@@ -6,7 +6,8 @@ import {
|
|
|
6
6
|
cloneElement,
|
|
7
7
|
useId,
|
|
8
8
|
} from 'react';
|
|
9
|
-
import
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
|
|
10
11
|
import { TabListProvider, useTabsContext } from './context';
|
|
11
12
|
import { useScope } from '../hooks';
|
|
12
13
|
import { assignMultipleRefs } from '../utils';
|
package/src/Tabs/TabPanel.tsx
CHANGED
package/src/Tabs/TabPanels.tsx
CHANGED
package/src/Tabs/Tabs.tsx
CHANGED
package/src/Tabs/context.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, { useRef, forwardRef } from 'react';
|
|
2
|
+
|
|
2
3
|
import { Tooltip } from './';
|
|
3
4
|
import { Popper } from '../Popper/Popper';
|
|
4
|
-
import { InjectedTooltipProps } from './useTooltip';
|
|
5
|
+
import type { InjectedTooltipProps } from './useTooltip';
|
|
5
6
|
import './styles.css';
|
|
6
7
|
|
|
7
8
|
export default {
|
package/src/Tooltip/Tooltip.tsx
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Children,
|
|
5
|
-
ReactElement,
|
|
6
|
-
RefAttributes,
|
|
7
|
-
} from 'react';
|
|
1
|
+
import type { ReactElement, RefAttributes } from 'react';
|
|
2
|
+
import React, { forwardRef, cloneElement, Children } from 'react';
|
|
3
|
+
|
|
8
4
|
import { useTooltip } from './useTooltip';
|
|
9
5
|
export type { InjectedTooltipProps } from './useTooltip';
|
|
10
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createSubscription } from '../utils/createSubscription';
|
|
2
|
-
import { StateChart as GenericStateChart } from '../hooks/useReducerMachine';
|
|
2
|
+
import type { StateChart as GenericStateChart } from '../hooks/useReducerMachine';
|
|
3
3
|
|
|
4
4
|
////////////////////////////////////////////////////////////////////////////////
|
|
5
5
|
// Timeouts:
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { RefAttributes } from 'react';
|
|
2
|
+
import { useRef, useEffect, useState, useId } from 'react';
|
|
3
|
+
|
|
2
4
|
import { assignMultipleRefs } from '../utils/assignRef';
|
|
3
5
|
import { wrapEvent } from '../utils/wrapEvent';
|
|
4
6
|
import {
|