@basic-ui/core 0.0.53 → 0.0.56
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 +278 -505
- package/build/cjs/index.js.map +1 -1
- package/build/esm/Accordion/Accordion.js +20 -29
- package/build/esm/Accordion/Accordion.js.map +1 -1
- package/build/esm/Accordion/AccordionBody.js +18 -32
- package/build/esm/Accordion/AccordionBody.js.map +1 -1
- package/build/esm/Accordion/AccordionHeader.js +37 -74
- package/build/esm/Accordion/AccordionHeader.js.map +1 -1
- package/build/esm/Accordion/AccordionItem.js +19 -22
- package/build/esm/Accordion/AccordionItem.js.map +1 -1
- package/build/esm/Accordion/context.js +16 -13
- package/build/esm/Accordion/context.js.map +1 -1
- package/build/esm/Accordion/index.js.map +1 -1
- package/build/esm/Accordion/scopeQuery.js.map +1 -1
- package/build/esm/CheckBox/CheckBox.js +15 -25
- package/build/esm/CheckBox/CheckBox.js.map +1 -1
- package/build/esm/CheckBox/index.js.map +1 -1
- package/build/esm/ComboBox/Combobox.d.ts +7 -7
- package/build/esm/ComboBox/Combobox.js +52 -59
- package/build/esm/ComboBox/Combobox.js.map +1 -1
- package/build/esm/ComboBox/ComboboxButton.js +23 -28
- package/build/esm/ComboBox/ComboboxButton.js.map +1 -1
- package/build/esm/ComboBox/ComboboxInput.js +67 -70
- package/build/esm/ComboBox/ComboboxInput.js.map +1 -1
- package/build/esm/ComboBox/ComboboxLabel.js +15 -17
- package/build/esm/ComboBox/ComboboxLabel.js.map +1 -1
- package/build/esm/ComboBox/ComboboxList.js +19 -20
- package/build/esm/ComboBox/ComboboxList.js.map +1 -1
- package/build/esm/ComboBox/ComboboxOption.js +41 -45
- package/build/esm/ComboBox/ComboboxOption.js.map +1 -1
- package/build/esm/ComboBox/ComboboxPopover.js +22 -21
- package/build/esm/ComboBox/ComboboxPopover.js.map +1 -1
- package/build/esm/ComboBox/cities.js.map +1 -1
- package/build/esm/ComboBox/context.js +5 -6
- package/build/esm/ComboBox/context.js.map +1 -1
- package/build/esm/ComboBox/hooks.d.ts +2 -2
- package/build/esm/ComboBox/hooks.js +175 -148
- package/build/esm/ComboBox/hooks.js.map +1 -1
- package/build/esm/ComboBox/index.js.map +1 -1
- package/build/esm/ComboBox/makeHash.js +3 -6
- package/build/esm/ComboBox/makeHash.js.map +1 -1
- package/build/esm/ComboBox/scopeQuery.js.map +1 -1
- package/build/esm/FocusLock/FocusLock.js +26 -32
- package/build/esm/FocusLock/FocusLock.js.map +1 -1
- package/build/esm/FocusLock/index.js.map +1 -1
- package/build/esm/FocusLock/tabUtils.js +5 -7
- package/build/esm/FocusLock/tabUtils.js.map +1 -1
- package/build/esm/FocusLock/useFocusLock.js +14 -19
- package/build/esm/FocusLock/useFocusLock.js.map +1 -1
- package/build/esm/List/List.js +9 -11
- package/build/esm/List/List.js.map +1 -1
- package/build/esm/List/ListItem.js +9 -11
- package/build/esm/List/ListItem.js.map +1 -1
- package/build/esm/List/context.js +6 -6
- package/build/esm/List/context.js.map +1 -1
- package/build/esm/List/index.js.map +1 -1
- package/build/esm/Menu/ContextMenuTrigger.d.ts +4 -4
- package/build/esm/Menu/ContextMenuTrigger.js +32 -37
- package/build/esm/Menu/ContextMenuTrigger.js.map +1 -1
- package/build/esm/Menu/Menu.js +33 -49
- package/build/esm/Menu/Menu.js.map +1 -1
- package/build/esm/Menu/MenuButton.d.ts +4 -4
- package/build/esm/Menu/MenuButton.js +28 -44
- package/build/esm/Menu/MenuButton.js.map +1 -1
- package/build/esm/Menu/MenuItem.js +29 -38
- package/build/esm/Menu/MenuItem.js.map +1 -1
- package/build/esm/Menu/MenuList.js +61 -116
- package/build/esm/Menu/MenuList.js.map +1 -1
- package/build/esm/Menu/MenuPopover.js +16 -19
- package/build/esm/Menu/MenuPopover.js.map +1 -1
- package/build/esm/Menu/context.d.ts +1 -1
- package/build/esm/Menu/context.js +14 -12
- package/build/esm/Menu/context.js.map +1 -1
- package/build/esm/Menu/fixtures/countryList.js +1 -1
- package/build/esm/Menu/fixtures/countryList.js.map +1 -1
- package/build/esm/Menu/index.js.map +1 -1
- package/build/esm/Menu/scope.js.map +1 -1
- package/build/esm/Modal/Modal.js +13 -18
- package/build/esm/Modal/Modal.js.map +1 -1
- package/build/esm/Modal/ModalBackdrop.js +24 -33
- package/build/esm/Modal/ModalBackdrop.js.map +1 -1
- package/build/esm/Modal/index.js.map +1 -1
- package/build/esm/Popper/Popper.d.ts +3 -3
- package/build/esm/Popper/Popper.js +44 -61
- package/build/esm/Popper/Popper.js.map +1 -1
- package/build/esm/Popper/PopperArrow.js +11 -16
- package/build/esm/Popper/PopperArrow.js.map +1 -1
- package/build/esm/Popper/context.js +3 -5
- package/build/esm/Popper/context.js.map +1 -1
- package/build/esm/Popper/index.js.map +1 -1
- package/build/esm/Portal/Portal.js +9 -11
- package/build/esm/Portal/Portal.js.map +1 -1
- package/build/esm/Portal/PortalSelectorProvider.d.ts +3 -3
- package/build/esm/Portal/PortalSelectorProvider.js +6 -4
- package/build/esm/Portal/PortalSelectorProvider.js.map +1 -1
- package/build/esm/Portal/index.js.map +1 -1
- package/build/esm/RadioButton/RadioButton.js +17 -23
- package/build/esm/RadioButton/RadioButton.js.map +1 -1
- package/build/esm/RadioButton/RadioGroup.js +19 -28
- package/build/esm/RadioButton/RadioGroup.js.map +1 -1
- package/build/esm/RadioButton/context.d.ts +1 -1
- package/build/esm/RadioButton/context.js +8 -6
- package/build/esm/RadioButton/context.js.map +1 -1
- package/build/esm/RadioButton/index.js.map +1 -1
- package/build/esm/SkipNav/SkipNav.js +9 -11
- package/build/esm/SkipNav/SkipNav.js.map +1 -1
- package/build/esm/SkipNav/index.js.map +1 -1
- package/build/esm/Slider/Slider.d.ts +7 -7
- package/build/esm/Slider/Slider.js +340 -407
- package/build/esm/Slider/Slider.js.map +1 -1
- package/build/esm/Slider/index.js.map +1 -1
- package/build/esm/Spinner/Spinner.js +31 -59
- package/build/esm/Spinner/Spinner.js.map +1 -1
- package/build/esm/Spinner/SpinnerButton.js +14 -19
- package/build/esm/Spinner/SpinnerButton.js.map +1 -1
- package/build/esm/Spinner/context.js +8 -7
- package/build/esm/Spinner/context.js.map +1 -1
- package/build/esm/Spinner/index.js.map +1 -1
- package/build/esm/Tabs/Tab.js +32 -50
- package/build/esm/Tabs/Tab.js.map +1 -1
- package/build/esm/Tabs/TabList.js +24 -34
- package/build/esm/Tabs/TabList.js.map +1 -1
- package/build/esm/Tabs/TabPanel.js +16 -23
- package/build/esm/Tabs/TabPanel.js.map +1 -1
- package/build/esm/Tabs/TabPanels.js +15 -20
- package/build/esm/Tabs/TabPanels.js.map +1 -1
- package/build/esm/Tabs/Tabs.js +17 -33
- package/build/esm/Tabs/Tabs.js.map +1 -1
- package/build/esm/Tabs/context.js +16 -13
- package/build/esm/Tabs/context.js.map +1 -1
- package/build/esm/Tabs/index.js.map +1 -1
- package/build/esm/Tabs/scopeQuery.js.map +1 -1
- package/build/esm/Tooltip/Tooltip.d.ts +2 -2
- package/build/esm/Tooltip/Tooltip.js +20 -30
- package/build/esm/Tooltip/Tooltip.js.map +1 -1
- package/build/esm/Tooltip/index.js.map +1 -1
- package/build/esm/Tooltip/stateMachine.d.ts +2 -2
- package/build/esm/Tooltip/stateMachine.js +95 -81
- package/build/esm/Tooltip/stateMachine.js.map +1 -1
- package/build/esm/Tooltip/useTooltip.d.ts +2 -2
- package/build/esm/Tooltip/useTooltip.js +38 -50
- package/build/esm/Tooltip/useTooltip.js.map +1 -1
- package/build/esm/hooks/index.js.map +1 -1
- package/build/esm/hooks/useAutoFocus.js +3 -3
- package/build/esm/hooks/useAutoFocus.js.map +1 -1
- package/build/esm/hooks/useChildrenCounter.js +6 -8
- package/build/esm/hooks/useChildrenCounter.js.map +1 -1
- package/build/esm/hooks/useControlledState.js +6 -16
- package/build/esm/hooks/useControlledState.js.map +1 -1
- package/build/esm/hooks/useFocusReturn.js +8 -12
- package/build/esm/hooks/useFocusReturn.js.map +1 -1
- package/build/esm/hooks/useFocusState.d.ts +2 -2
- package/build/esm/hooks/useFocusState.js +9 -15
- package/build/esm/hooks/useFocusState.js.map +1 -1
- package/build/esm/hooks/useGestureHandlers.d.ts +1 -1
- package/build/esm/hooks/useGestureHandlers.js +80 -100
- package/build/esm/hooks/useGestureHandlers.js.map +1 -1
- package/build/esm/hooks/useMeasure.js +7 -15
- package/build/esm/hooks/useMeasure.js.map +1 -1
- package/build/esm/hooks/useOnClickOutside.js +4 -6
- package/build/esm/hooks/useOnClickOutside.js.map +1 -1
- package/build/esm/hooks/useOnKeyDown.js +3 -4
- package/build/esm/hooks/useOnKeyDown.js.map +1 -1
- package/build/esm/hooks/useReducerMachine.d.ts +1 -1
- package/build/esm/hooks/useReducerMachine.js +15 -26
- package/build/esm/hooks/useReducerMachine.js.map +1 -1
- package/build/esm/hooks/useRemoveBodyScroll.js +9 -14
- package/build/esm/hooks/useRemoveBodyScroll.js.map +1 -1
- package/build/esm/hooks/useScope.d.ts +2 -2
- package/build/esm/hooks/useScope.js +12 -14
- package/build/esm/hooks/useScope.js.map +1 -1
- package/build/esm/hooks/useThrottle.js +5 -10
- package/build/esm/hooks/useThrottle.js.map +1 -1
- package/build/esm/index.js +4 -2
- package/build/esm/index.js.map +1 -1
- package/build/esm/styles.d.js +2 -0
- package/build/esm/styles.d.js.map +1 -0
- package/build/esm/utils/assign-ref.js +3 -5
- package/build/esm/utils/assign-ref.js.map +1 -1
- package/build/esm/utils/can-use-dom.js.map +1 -1
- package/build/esm/utils/clamp.js.map +1 -1
- package/build/esm/utils/context.d.ts +1 -1
- package/build/esm/utils/context.js +13 -20
- package/build/esm/utils/context.js.map +1 -1
- package/build/esm/utils/create-subscription.js +5 -10
- package/build/esm/utils/create-subscription.js.map +1 -1
- package/build/esm/utils/get-circular-index.js +0 -1
- package/build/esm/utils/get-circular-index.js.map +1 -1
- package/build/esm/utils/index.js.map +1 -1
- package/build/esm/utils/is-right-click.js.map +1 -1
- package/build/esm/utils/owner-document.js +1 -1
- package/build/esm/utils/owner-document.js.map +1 -1
- package/build/esm/utils/polymorphic.d.ts +10 -10
- package/build/esm/utils/polymorphic.js.map +1 -1
- package/build/esm/utils/rubber-band-clamp.js +2 -5
- package/build/esm/utils/rubber-band-clamp.js.map +1 -1
- package/build/esm/utils/use-stable-callback.js +8 -10
- package/build/esm/utils/use-stable-callback.js.map +1 -1
- package/build/esm/utils/wrap-event.d.ts +1 -1
- package/build/esm/utils/wrap-event.js +2 -5
- package/build/esm/utils/wrap-event.js.map +1 -1
- package/build/tsconfig-build.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/src/Accordion/Accordion.tsx +1 -1
- package/src/Accordion/AccordionBody.tsx +1 -1
- package/src/Accordion/AccordionHeader.tsx +1 -2
- package/src/ComboBox/Combobox.tsx +2 -2
- package/src/ComboBox/ComboboxList.tsx +1 -1
- package/src/ComboBox/ComboboxOption.tsx +0 -1
- package/src/ComboBox/hooks.tsx +0 -3
- package/src/FocusLock/useFocusLock.ts +0 -1
- package/src/Menu/Menu.tsx +2 -3
- package/src/Menu/MenuItem.tsx +1 -2
- package/src/Menu/MenuList.tsx +4 -4
- package/src/Modal/Modal.story.tsx +11 -7
- package/src/Modal/ModalBackdrop.tsx +1 -1
- package/src/Modal/NavDrawer.story.tsx +9 -6
- package/src/Popper/Popper.story.tsx +23 -7
- package/src/Popper/Popper.tsx +2 -2
- package/src/RadioButton/RadioButton.story.tsx +2 -1
- package/src/Slider/Slider.tsx +6 -11
- package/src/Spinner/Spinner.tsx +1 -1
- package/src/Tabs/TabList.tsx +1 -1
- package/src/Tooltip/Tooltip.tsx +8 -5
- package/src/Tooltip/useTooltip.ts +1 -1
- package/src/hooks/useControlledState.ts +1 -6
- package/src/hooks/useGestureHandlers.ts +0 -4
- package/src/hooks/useRemoveBodyScroll.ts +0 -1
- package/src/hooks/useScope.ts +1 -1
- package/src/styles.d.ts +1 -0
- package/src/utils/polymorphic.ts +14 -10
- package/src/utils/use-stable-callback.ts +0 -1
- package/build/esm/Carousel/Carousel.d.ts +0 -9
- package/build/esm/Carousel/Carousel.js +0 -38
- package/build/esm/Carousel/Carousel.js.map +0 -1
- package/build/esm/Carousel/Fader.d.ts +0 -14
- package/build/esm/Carousel/Fader.js +0 -76
- package/build/esm/Carousel/Fader.js.map +0 -1
- package/build/esm/Carousel/FaderItem.d.ts +0 -5
- package/build/esm/Carousel/FaderItem.js +0 -16
- package/build/esm/Carousel/FaderItem.js.map +0 -1
- package/build/esm/Carousel/Preloader.d.ts +0 -7
- package/build/esm/Carousel/Preloader.js +0 -70
- package/build/esm/Carousel/Preloader.js.map +0 -1
- package/build/esm/Carousel/Slider.d.ts +0 -14
- package/build/esm/Carousel/Slider.js +0 -212
- package/build/esm/Carousel/Slider.js.map +0 -1
- package/build/esm/Carousel/SliderItem.d.ts +0 -12
- package/build/esm/Carousel/SliderItem.js +0 -41
- package/build/esm/Carousel/SliderItem.js.map +0 -1
- package/build/esm/Carousel/context.d.ts +0 -10
- package/build/esm/Carousel/context.js +0 -8
- package/build/esm/Carousel/context.js.map +0 -1
- package/build/esm/Carousel/getSliderParams.d.ts +0 -9
- package/build/esm/Carousel/getSliderParams.js +0 -85
- package/build/esm/Carousel/getSliderParams.js.map +0 -1
- package/build/esm/Carousel/index.d.ts +0 -7
- package/build/esm/Carousel/index.js +0 -8
- package/build/esm/Carousel/index.js.map +0 -1
- package/build/esm/Carousel/useCarouselGestures.d.ts +0 -30
- package/build/esm/Carousel/useCarouselGestures.js +0 -33
- package/build/esm/Carousel/useCarouselGestures.js.map +0 -1
- package/build/esm/DatePicker/DatePicker.d.ts +0 -24
- package/build/esm/DatePicker/DatePicker.js +0 -101
- package/build/esm/DatePicker/DatePicker.js.map +0 -1
- package/build/esm/DatePicker/DatePickerSelect.d.ts +0 -8
- package/build/esm/DatePicker/DatePickerSelect.js +0 -201
- package/build/esm/DatePicker/DatePickerSelect.js.map +0 -1
- package/build/esm/DatePicker/RangeDatePicker.d.ts +0 -28
- package/build/esm/DatePicker/RangeDatePicker.js +0 -94
- package/build/esm/DatePicker/RangeDatePicker.js.map +0 -1
- package/build/esm/DatePicker/adjustDates.d.ts +0 -4
- package/build/esm/DatePicker/adjustDates.js +0 -18
- package/build/esm/DatePicker/adjustDates.js.map +0 -1
- package/build/esm/DatePicker/contexts.d.ts +0 -31
- package/build/esm/DatePicker/contexts.js +0 -15
- package/build/esm/DatePicker/contexts.js.map +0 -1
- package/build/esm/DatePicker/dateTypes.d.ts +0 -2
- package/build/esm/DatePicker/dateTypes.js +0 -2
- package/build/esm/DatePicker/dateTypes.js.map +0 -1
- package/build/esm/DatePicker/hooks.d.ts +0 -36
- package/build/esm/DatePicker/hooks.js +0 -98
- package/build/esm/DatePicker/hooks.js.map +0 -1
- package/build/esm/DatePicker/index.d.ts +0 -5
- package/build/esm/DatePicker/index.js +0 -6
- package/build/esm/DatePicker/index.js.map +0 -1
- package/build/esm/hooks/useId.d.ts +0 -1
- package/build/esm/hooks/useId.js +0 -25
- package/build/esm/hooks/useId.js.map +0 -1
- package/build/esm/utils/assignRef.d.ts +0 -3
- package/build/esm/utils/assignRef.js +0 -25
- package/build/esm/utils/assignRef.js.map +0 -1
- package/build/esm/utils/getCircularIndex.d.ts +0 -1
- package/build/esm/utils/getCircularIndex.js +0 -8
- package/build/esm/utils/getCircularIndex.js.map +0 -1
- package/build/esm/utils/rubberBandClamp.d.ts +0 -2
- package/build/esm/utils/rubberBandClamp.js +0 -20
- package/build/esm/utils/rubberBandClamp.js.map +0 -1
- package/build/esm/utils/wrapEvent.d.ts +0 -3
- package/build/esm/utils/wrapEvent.js +0 -16
- package/build/esm/utils/wrapEvent.js.map +0 -1
- package/build/tsconfig.tsbuildinfo +0 -7270
|
@@ -1,42 +1,32 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["as", "innerAs", "children", "disabled"],
|
|
5
|
-
_excluded2 = ["visible"];
|
|
6
1
|
import { forwardRef, cloneElement, Children } from 'react';
|
|
7
2
|
import { useTooltip } from './useTooltip';
|
|
8
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
childProps = _useTooltip2[0],
|
|
25
|
-
_useTooltip2$ = _useTooltip2[1],
|
|
26
|
-
visible = _useTooltip2$.visible,
|
|
27
|
-
tooltipProps = _objectWithoutProperties(_useTooltip2$, _excluded2);
|
|
28
|
-
|
|
3
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
export const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, forwardedRef) {
|
|
5
|
+
const {
|
|
6
|
+
as: Comp = 'div',
|
|
7
|
+
innerAs,
|
|
8
|
+
children,
|
|
9
|
+
disabled = false,
|
|
10
|
+
...otherProps
|
|
11
|
+
} = props;
|
|
12
|
+
const child = Children.only(children);
|
|
13
|
+
// React 19: ref lives in props. React <=18: ref lives on element directly.
|
|
14
|
+
const childRef = child.props.ref ?? child.ref;
|
|
15
|
+
const [childProps, {
|
|
16
|
+
visible,
|
|
17
|
+
...tooltipProps
|
|
18
|
+
}] = useTooltip(child.props, childRef, otherProps);
|
|
29
19
|
if (disabled) {
|
|
30
20
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
31
21
|
children: child
|
|
32
22
|
});
|
|
33
23
|
}
|
|
34
|
-
|
|
35
24
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
36
|
-
children: [/*#__PURE__*/cloneElement(child, childProps), visible && /*#__PURE__*/_jsx(Comp,
|
|
25
|
+
children: [/*#__PURE__*/cloneElement(child, childProps), visible && /*#__PURE__*/_jsx(Comp, {
|
|
37
26
|
as: innerAs,
|
|
38
|
-
ref: forwardedRef
|
|
39
|
-
|
|
27
|
+
ref: forwardedRef,
|
|
28
|
+
...tooltipProps
|
|
29
|
+
})]
|
|
40
30
|
});
|
|
41
31
|
});
|
|
42
32
|
//# sourceMappingURL=Tooltip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","names":["forwardRef","cloneElement","Children","useTooltip","Tooltip","props","forwardedRef","as","Comp","innerAs","children","disabled","otherProps","child","only","ref","childProps","visible","tooltipProps"],"sources":["../../../src/Tooltip/Tooltip.tsx"],"sourcesContent":["import type {\n ElementType,\n HTMLAttributes,\n ReactElement,\n ReactNode,\n
|
|
1
|
+
{"version":3,"file":"Tooltip.js","names":["forwardRef","cloneElement","Children","useTooltip","Fragment","_Fragment","jsx","_jsx","jsxs","_jsxs","Tooltip","props","forwardedRef","as","Comp","innerAs","children","disabled","otherProps","child","only","childRef","ref","childProps","visible","tooltipProps"],"sources":["../../../src/Tooltip/Tooltip.tsx"],"sourcesContent":["import type {\n ElementType,\n HTMLAttributes,\n ReactElement,\n ReactNode,\n Ref,\n} from 'react';\nimport { forwardRef, cloneElement, Children } from 'react';\n\nimport { useTooltip } from './useTooltip';\nexport type { InjectedTooltipProps } from './useTooltip';\n\nexport interface TooltipProps extends HTMLAttributes<HTMLDivElement> {\n as?: ElementType<any>;\n innerAs?: ElementType<any>;\n children?: ReactNode;\n label: ReactNode;\n disabled?: boolean;\n}\n\nexport const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(\n function Tooltip(props, forwardedRef) {\n const {\n as: Comp = 'div',\n innerAs,\n children,\n disabled = false,\n ...otherProps\n } = props;\n const child = Children.only(children) as ReactElement<\n HTMLAttributes<HTMLElement>\n >;\n // React 19: ref lives in props. React <=18: ref lives on element directly.\n const childRef =\n (child.props as { ref?: Ref<HTMLElement> }).ref ?? (child as any).ref;\n const [childProps, { visible, ...tooltipProps }] = useTooltip(\n child.props,\n childRef,\n otherProps\n );\n\n if (disabled) {\n return <>{child}</>;\n }\n\n return (\n <>\n {cloneElement(child, childProps)}\n {visible && <Comp as={innerAs} ref={forwardedRef} {...tooltipProps} />}\n </>\n );\n }\n);\n"],"mappings":"AAOA,SAASA,UAAU,EAAEC,YAAY,EAAEC,QAAQ,QAAQ,OAAO;AAE1D,SAASC,UAAU,QAAQ,cAAc;AAAC,SAAAC,QAAA,IAAAC,SAAA,EAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAW1C,OAAO,MAAMC,OAAO,gBAAGV,UAAU,CAC/B,SAASU,OAAOA,CAACC,KAAK,EAAEC,YAAY,EAAE;EACpC,MAAM;IACJC,EAAE,EAAEC,IAAI,GAAG,KAAK;IAChBC,OAAO;IACPC,QAAQ;IACRC,QAAQ,GAAG,KAAK;IAChB,GAAGC;EACL,CAAC,GAAGP,KAAK;EACT,MAAMQ,KAAK,GAAGjB,QAAQ,CAACkB,IAAI,CAACJ,QAAQ,CAEnC;EACD;EACA,MAAMK,QAAQ,GACXF,KAAK,CAACR,KAAK,CAAgCW,GAAG,IAAKH,KAAK,CAASG,GAAG;EACvE,MAAM,CAACC,UAAU,EAAE;IAAEC,OAAO;IAAE,GAAGC;EAAa,CAAC,CAAC,GAAGtB,UAAU,CAC3DgB,KAAK,CAACR,KAAK,EACXU,QAAQ,EACRH,UACF,CAAC;EAED,IAAID,QAAQ,EAAE;IACZ,oBAAOV,IAAA,CAAAF,SAAA;MAAAW,QAAA,EAAGG;IAAK,CAAG,CAAC;EACrB;EAEA,oBACEV,KAAA,CAAAJ,SAAA;IAAAW,QAAA,gBACGf,YAAY,CAACkB,KAAK,EAAEI,UAAU,CAAC,EAC/BC,OAAO,iBAAIjB,IAAA,CAACO,IAAI;MAACD,EAAE,EAAEE,OAAQ;MAACO,GAAG,EAAEV,YAAa;MAAA,GAAKa;IAAY,CAAG,CAAC;EAAA,CACtE,CAAC;AAEP,CACF,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/Tooltip/index.ts"],"sourcesContent":["export * from './Tooltip';\n"],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/Tooltip/index.ts"],"sourcesContent":["export * from './Tooltip';\n"],"mappings":"AAAA,cAAc,WAAW","ignoreList":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type TooltipStates = 'IDLE' | 'FOCUSED' | 'VISIBLE' | 'LEAVING_VISIBLE' | 'DISMISSED';
|
|
2
2
|
export declare const Idle: "IDLE";
|
|
3
3
|
export declare const Focused: "FOCUSED";
|
|
4
4
|
export declare const Visible: "VISIBLE";
|
|
5
5
|
export declare const LeavingVisible: "LEAVING_VISIBLE";
|
|
6
6
|
export declare const Dismissed: "DISMISSED";
|
|
7
|
-
export
|
|
7
|
+
export type TooltipEventTypes = 'BLUR' | 'FOCUS' | 'GLOBAL_MOUSE_MOVE' | 'MOUSE_DOWN' | 'MOUSE_ENTER' | 'MOUSE_LEAVE' | 'MOUSE_MOVE' | 'REST' | 'SELECT_WITH_KEYBOARD' | 'TIME_COMPLETE';
|
|
8
8
|
export declare const Blur: "BLUR";
|
|
9
9
|
export declare const Focus: "FOCUS";
|
|
10
10
|
export declare const GlobalMouseMove: "GLOBAL_MOUSE_MOVE";
|
|
@@ -1,111 +1,129 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
|
|
4
|
-
var _on, _on2, _on3, _on4, _on5, _states;
|
|
5
|
-
|
|
6
1
|
import { createSubscription } from '../utils/create-subscription';
|
|
7
2
|
////////////////////////////////////////////////////////////////////////////////
|
|
8
3
|
// Timeouts:
|
|
4
|
+
|
|
9
5
|
// Manages when the user "rests" on an element. Keeps the interface from being
|
|
10
6
|
// flashing tooltips all the time as the user moves the mouse around the screen.
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
let restTimeout;
|
|
13
8
|
function startRestTimer() {
|
|
14
9
|
clearTimeout(restTimeout);
|
|
15
|
-
restTimeout = setTimeout(
|
|
10
|
+
restTimeout = setTimeout(() => {
|
|
16
11
|
send(Rest, undefined);
|
|
17
12
|
}, 200);
|
|
18
13
|
}
|
|
19
|
-
|
|
20
14
|
function clearRestTimer() {
|
|
21
15
|
clearTimeout(restTimeout);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var leavingVisibleTimer;
|
|
16
|
+
}
|
|
26
17
|
|
|
18
|
+
// Manages the delay to hide the tooltip after rest leaves.
|
|
19
|
+
let leavingVisibleTimer;
|
|
27
20
|
function startLeavingVisibleTimer() {
|
|
28
21
|
clearTimeout(leavingVisibleTimer);
|
|
29
|
-
leavingVisibleTimer = setTimeout(
|
|
30
|
-
return send(TimeComplete, undefined);
|
|
31
|
-
}, 100);
|
|
22
|
+
leavingVisibleTimer = setTimeout(() => send(TimeComplete, undefined), 100);
|
|
32
23
|
}
|
|
33
|
-
|
|
34
24
|
function clearLeavingVisibleTimer() {
|
|
35
25
|
clearTimeout(leavingVisibleTimer);
|
|
36
|
-
}
|
|
37
|
-
// State machine
|
|
26
|
+
}
|
|
38
27
|
|
|
28
|
+
////////////////////////////////////////////////////////////////////////////////
|
|
29
|
+
// State machine
|
|
39
30
|
|
|
40
31
|
// Nothing goin' on
|
|
41
|
-
export
|
|
42
|
-
|
|
43
|
-
export
|
|
44
|
-
|
|
45
|
-
export
|
|
46
|
-
|
|
47
|
-
export
|
|
32
|
+
export const Idle = 'IDLE';
|
|
33
|
+
// We're considering showing the tooltip, but we're gonna wait a sec
|
|
34
|
+
export const Focused = 'FOCUSED';
|
|
35
|
+
// It's on!
|
|
36
|
+
export const Visible = 'VISIBLE';
|
|
37
|
+
// Focus has left, but we want to keep it visible for a sec
|
|
38
|
+
export const LeavingVisible = 'LEAVING_VISIBLE';
|
|
39
|
+
// The user clicked the tool, so we want to hide the thing, we can't just use
|
|
48
40
|
// IDLE because we need to ignore mousemove, etc.
|
|
49
|
-
|
|
50
|
-
export
|
|
51
|
-
export
|
|
52
|
-
export
|
|
53
|
-
export
|
|
54
|
-
export
|
|
55
|
-
export
|
|
56
|
-
export
|
|
57
|
-
export
|
|
58
|
-
export
|
|
59
|
-
export
|
|
60
|
-
export
|
|
61
|
-
export
|
|
62
|
-
export var state = {
|
|
41
|
+
export const Dismissed = 'DISMISSED';
|
|
42
|
+
export const Blur = 'BLUR';
|
|
43
|
+
export const Focus = 'FOCUS';
|
|
44
|
+
export const GlobalMouseMove = 'GLOBAL_MOUSE_MOVE';
|
|
45
|
+
export const MouseDown = 'MOUSE_DOWN';
|
|
46
|
+
export const MouseEnter = 'MOUSE_ENTER';
|
|
47
|
+
export const MouseLeave = 'MOUSE_LEAVE';
|
|
48
|
+
export const MouseMove = 'MOUSE_MOVE';
|
|
49
|
+
export const Rest = 'REST';
|
|
50
|
+
export const SelectWithKeyboard = 'SELECT_WITH_KEYBOARD';
|
|
51
|
+
export const TimeComplete = 'TIME_COMPLETE';
|
|
52
|
+
export const subscription = createSubscription();
|
|
53
|
+
export const state = {
|
|
63
54
|
current: {
|
|
64
55
|
state: Idle,
|
|
65
56
|
id: ''
|
|
66
57
|
}
|
|
67
58
|
};
|
|
68
|
-
|
|
69
59
|
function clearContextId() {
|
|
70
60
|
state.current.id = '';
|
|
71
61
|
}
|
|
72
|
-
|
|
73
|
-
var chart = {
|
|
62
|
+
const chart = {
|
|
74
63
|
initial: Idle,
|
|
75
|
-
states:
|
|
76
|
-
|
|
77
|
-
|
|
64
|
+
states: {
|
|
65
|
+
[Idle]: {
|
|
66
|
+
enter: () => {
|
|
67
|
+
clearContextId();
|
|
68
|
+
},
|
|
69
|
+
on: {
|
|
70
|
+
[MouseEnter]: Focused,
|
|
71
|
+
[Focus]: Visible
|
|
72
|
+
}
|
|
78
73
|
},
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
74
|
+
[Focused]: {
|
|
75
|
+
enter: startRestTimer,
|
|
76
|
+
leave: clearRestTimer,
|
|
77
|
+
on: {
|
|
78
|
+
[MouseMove]: Focused,
|
|
79
|
+
[MouseLeave]: Idle,
|
|
80
|
+
[MouseDown]: Dismissed,
|
|
81
|
+
[Blur]: Idle,
|
|
82
|
+
[Rest]: Visible
|
|
83
|
+
}
|
|
89
84
|
},
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
85
|
+
[Visible]: {
|
|
86
|
+
on: {
|
|
87
|
+
[Focus]: Focused,
|
|
88
|
+
[MouseEnter]: Focused,
|
|
89
|
+
[MouseLeave]: LeavingVisible,
|
|
90
|
+
[Blur]: LeavingVisible,
|
|
91
|
+
[MouseDown]: Dismissed,
|
|
92
|
+
[SelectWithKeyboard]: Dismissed,
|
|
93
|
+
[GlobalMouseMove]: LeavingVisible
|
|
94
|
+
}
|
|
93
95
|
},
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
[LeavingVisible]: {
|
|
97
|
+
enter: () => {
|
|
98
|
+
startLeavingVisibleTimer();
|
|
99
|
+
},
|
|
100
|
+
leave: () => {
|
|
101
|
+
clearLeavingVisibleTimer();
|
|
102
|
+
clearContextId();
|
|
103
|
+
},
|
|
104
|
+
on: {
|
|
105
|
+
[MouseEnter]: Visible,
|
|
106
|
+
[Focus]: Visible,
|
|
107
|
+
[TimeComplete]: Idle
|
|
108
|
+
}
|
|
98
109
|
},
|
|
99
|
-
|
|
100
|
-
|
|
110
|
+
[Dismissed]: {
|
|
111
|
+
leave: () => {
|
|
112
|
+
clearContextId();
|
|
113
|
+
},
|
|
114
|
+
on: {
|
|
115
|
+
[MouseLeave]: Idle,
|
|
116
|
+
[Blur]: Idle
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
101
120
|
};
|
|
102
|
-
|
|
103
121
|
function transition(currentState, event, payload) {
|
|
104
|
-
|
|
122
|
+
const currentStateValue = currentState.state;
|
|
123
|
+
const stateDef = chart.states[currentState.state];
|
|
124
|
+
const nextState = stateDef?.on?.[event];
|
|
105
125
|
|
|
106
|
-
|
|
107
|
-
var stateDef = chart.states[currentState.state];
|
|
108
|
-
var nextState = stateDef === null || stateDef === void 0 ? void 0 : (_stateDef$on = stateDef.on) === null || _stateDef$on === void 0 ? void 0 : _stateDef$on[event]; // Really useful for debugging
|
|
126
|
+
// Really useful for debugging
|
|
109
127
|
// console.log({
|
|
110
128
|
// event,
|
|
111
129
|
// state: state.current.state,
|
|
@@ -116,26 +134,22 @@ function transition(currentState, event, payload) {
|
|
|
116
134
|
if (!nextState) {
|
|
117
135
|
return currentState;
|
|
118
136
|
}
|
|
119
|
-
|
|
120
137
|
if (stateDef && stateDef.leave) {
|
|
121
138
|
stateDef.leave(currentStateValue, payload);
|
|
122
139
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
var nextDef = chart.states[nextStateValue];
|
|
126
|
-
|
|
140
|
+
const nextStateValue = nextState;
|
|
141
|
+
const nextDef = chart.states[nextStateValue];
|
|
127
142
|
if (nextDef && nextDef.enter) {
|
|
128
143
|
nextDef.enter(nextStateValue, payload);
|
|
129
144
|
}
|
|
130
|
-
|
|
131
|
-
|
|
145
|
+
return {
|
|
146
|
+
...currentState,
|
|
147
|
+
...payload,
|
|
132
148
|
state: nextStateValue
|
|
133
|
-
}
|
|
149
|
+
};
|
|
134
150
|
}
|
|
135
|
-
|
|
136
151
|
export function send(event, payload) {
|
|
137
|
-
|
|
138
|
-
|
|
152
|
+
const nextState = transition(state.current, event, payload);
|
|
139
153
|
if (state.current !== nextState) {
|
|
140
154
|
state.current = nextState;
|
|
141
155
|
subscription.notify();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stateMachine.js","names":["createSubscription","restTimeout","startRestTimer","clearTimeout","setTimeout","send","Rest","undefined","clearRestTimer","leavingVisibleTimer","startLeavingVisibleTimer","TimeComplete","clearLeavingVisibleTimer","Idle","Focused","Visible","LeavingVisible","Dismissed","Blur","Focus","GlobalMouseMove","MouseDown","MouseEnter","MouseLeave","MouseMove","SelectWithKeyboard","subscription","state","current","id","clearContextId","chart","initial","states","enter","on","leave","transition","currentState","event","payload","currentStateValue","stateDef","nextState","nextStateValue","nextDef","notify"],"sources":["../../../src/Tooltip/stateMachine.ts"],"sourcesContent":["import { createSubscription } from '../utils/create-subscription';\nimport type { StateChart as GenericStateChart } from '../hooks/useReducerMachine';\n\n////////////////////////////////////////////////////////////////////////////////\n// Timeouts:\n\n// Manages when the user \"rests\" on an element. Keeps the interface from being\n// flashing tooltips all the time as the user moves the mouse around the screen.\nlet restTimeout: NodeJS.Timeout;\nfunction startRestTimer() {\n clearTimeout(restTimeout);\n restTimeout = setTimeout(() => {\n send(Rest, undefined);\n }, 200);\n}\n\nfunction clearRestTimer() {\n clearTimeout(restTimeout);\n}\n\n// Manages the delay to hide the tooltip after rest leaves.\nlet leavingVisibleTimer: NodeJS.Timeout;\nfunction startLeavingVisibleTimer() {\n clearTimeout(leavingVisibleTimer);\n leavingVisibleTimer = setTimeout(() => send(TimeComplete, undefined), 100);\n}\n\nfunction clearLeavingVisibleTimer() {\n clearTimeout(leavingVisibleTimer);\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// State machine\n\nexport type TooltipStates =\n | 'IDLE'\n | 'FOCUSED'\n | 'VISIBLE'\n | 'LEAVING_VISIBLE'\n | 'DISMISSED';\n\n// Nothing goin' on\nexport const Idle = 'IDLE' as const;\n// We're considering showing the tooltip, but we're gonna wait a sec\nexport const Focused = 'FOCUSED' as const;\n// It's on!\nexport const Visible = 'VISIBLE' as const;\n// Focus has left, but we want to keep it visible for a sec\nexport const LeavingVisible = 'LEAVING_VISIBLE' as const;\n// The user clicked the tool, so we want to hide the thing, we can't just use\n// IDLE because we need to ignore mousemove, etc.\nexport const Dismissed = 'DISMISSED' as const;\n\nexport type TooltipEventTypes =\n | 'BLUR'\n | 'FOCUS'\n | 'GLOBAL_MOUSE_MOVE'\n | 'MOUSE_DOWN'\n | 'MOUSE_ENTER'\n | 'MOUSE_LEAVE'\n | 'MOUSE_MOVE'\n | 'REST'\n | 'SELECT_WITH_KEYBOARD'\n | 'TIME_COMPLETE';\n\nexport const Blur = 'BLUR' as const;\nexport const Focus = 'FOCUS' as const;\nexport const GlobalMouseMove = 'GLOBAL_MOUSE_MOVE' as const;\nexport const MouseDown = 'MOUSE_DOWN' as const;\nexport const MouseEnter = 'MOUSE_ENTER' as const;\nexport const MouseLeave = 'MOUSE_LEAVE' as const;\nexport const MouseMove = 'MOUSE_MOVE' as const;\nexport const Rest = 'REST' as const;\nexport const SelectWithKeyboard = 'SELECT_WITH_KEYBOARD' as const;\nexport const TimeComplete = 'TIME_COMPLETE' as const;\n\nexport const subscription = createSubscription();\nexport const state = {\n current: {\n state: Idle as TooltipStates,\n id: '',\n },\n};\n\nfunction clearContextId() {\n state.current.id = '';\n}\n\nconst chart: GenericStateChart<TooltipStates, TooltipEventTypes> = {\n initial: Idle,\n states: {\n [Idle]: {\n enter: () => {\n clearContextId();\n },\n on: {\n [MouseEnter]: Focused,\n [Focus]: Visible,\n },\n },\n [Focused]: {\n enter: startRestTimer,\n leave: clearRestTimer,\n on: {\n [MouseMove]: Focused,\n [MouseLeave]: Idle,\n [MouseDown]: Dismissed,\n [Blur]: Idle,\n [Rest]: Visible,\n },\n },\n [Visible]: {\n on: {\n [Focus]: Focused,\n [MouseEnter]: Focused,\n [MouseLeave]: LeavingVisible,\n [Blur]: LeavingVisible,\n [MouseDown]: Dismissed,\n [SelectWithKeyboard]: Dismissed,\n [GlobalMouseMove]: LeavingVisible,\n },\n },\n [LeavingVisible]: {\n enter: () => {\n startLeavingVisibleTimer();\n },\n leave: () => {\n clearLeavingVisibleTimer();\n clearContextId();\n },\n on: {\n [MouseEnter]: Visible,\n [Focus]: Visible,\n [TimeComplete]: Idle,\n },\n },\n [Dismissed]: {\n leave: () => {\n clearContextId();\n },\n on: {\n [MouseLeave]: Idle,\n [Blur]: Idle,\n },\n },\n },\n};\n\nfunction transition(\n currentState: typeof state['current'],\n event: TooltipEventTypes,\n payload?: Omit<typeof state['current'], 'state'>\n): typeof state['current'] {\n const currentStateValue = currentState.state;\n const stateDef = chart.states[currentState.state];\n const nextState = stateDef?.on?.[event];\n\n // Really useful for debugging\n // console.log({\n // event,\n // state: state.current.state,\n // id: state.current.id,\n // nextState,\n // });\n\n if (!nextState) {\n return currentState;\n }\n\n if (stateDef && stateDef.leave) {\n stateDef.leave(currentStateValue, payload);\n }\n\n const nextStateValue = nextState;\n const nextDef = chart.states[nextStateValue];\n if (nextDef && nextDef.enter) {\n nextDef.enter(nextStateValue, payload);\n }\n\n return { ...currentState, ...payload, state: nextStateValue };\n}\n\nexport function send<T extends TooltipEventTypes>(\n event: T,\n payload?: Omit<typeof state['current'], 'state'>\n) {\n const nextState = transition(state.current, event, payload);\n if (state.current !== nextState) {\n state.current = nextState;\n subscription.notify();\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"stateMachine.js","names":["createSubscription","restTimeout","startRestTimer","clearTimeout","setTimeout","send","Rest","undefined","clearRestTimer","leavingVisibleTimer","startLeavingVisibleTimer","TimeComplete","clearLeavingVisibleTimer","Idle","Focused","Visible","LeavingVisible","Dismissed","Blur","Focus","GlobalMouseMove","MouseDown","MouseEnter","MouseLeave","MouseMove","SelectWithKeyboard","subscription","state","current","id","clearContextId","chart","initial","states","enter","on","leave","transition","currentState","event","payload","currentStateValue","stateDef","nextState","nextStateValue","nextDef","notify"],"sources":["../../../src/Tooltip/stateMachine.ts"],"sourcesContent":["import { createSubscription } from '../utils/create-subscription';\nimport type { StateChart as GenericStateChart } from '../hooks/useReducerMachine';\n\n////////////////////////////////////////////////////////////////////////////////\n// Timeouts:\n\n// Manages when the user \"rests\" on an element. Keeps the interface from being\n// flashing tooltips all the time as the user moves the mouse around the screen.\nlet restTimeout: NodeJS.Timeout;\nfunction startRestTimer() {\n clearTimeout(restTimeout);\n restTimeout = setTimeout(() => {\n send(Rest, undefined);\n }, 200);\n}\n\nfunction clearRestTimer() {\n clearTimeout(restTimeout);\n}\n\n// Manages the delay to hide the tooltip after rest leaves.\nlet leavingVisibleTimer: NodeJS.Timeout;\nfunction startLeavingVisibleTimer() {\n clearTimeout(leavingVisibleTimer);\n leavingVisibleTimer = setTimeout(() => send(TimeComplete, undefined), 100);\n}\n\nfunction clearLeavingVisibleTimer() {\n clearTimeout(leavingVisibleTimer);\n}\n\n////////////////////////////////////////////////////////////////////////////////\n// State machine\n\nexport type TooltipStates =\n | 'IDLE'\n | 'FOCUSED'\n | 'VISIBLE'\n | 'LEAVING_VISIBLE'\n | 'DISMISSED';\n\n// Nothing goin' on\nexport const Idle = 'IDLE' as const;\n// We're considering showing the tooltip, but we're gonna wait a sec\nexport const Focused = 'FOCUSED' as const;\n// It's on!\nexport const Visible = 'VISIBLE' as const;\n// Focus has left, but we want to keep it visible for a sec\nexport const LeavingVisible = 'LEAVING_VISIBLE' as const;\n// The user clicked the tool, so we want to hide the thing, we can't just use\n// IDLE because we need to ignore mousemove, etc.\nexport const Dismissed = 'DISMISSED' as const;\n\nexport type TooltipEventTypes =\n | 'BLUR'\n | 'FOCUS'\n | 'GLOBAL_MOUSE_MOVE'\n | 'MOUSE_DOWN'\n | 'MOUSE_ENTER'\n | 'MOUSE_LEAVE'\n | 'MOUSE_MOVE'\n | 'REST'\n | 'SELECT_WITH_KEYBOARD'\n | 'TIME_COMPLETE';\n\nexport const Blur = 'BLUR' as const;\nexport const Focus = 'FOCUS' as const;\nexport const GlobalMouseMove = 'GLOBAL_MOUSE_MOVE' as const;\nexport const MouseDown = 'MOUSE_DOWN' as const;\nexport const MouseEnter = 'MOUSE_ENTER' as const;\nexport const MouseLeave = 'MOUSE_LEAVE' as const;\nexport const MouseMove = 'MOUSE_MOVE' as const;\nexport const Rest = 'REST' as const;\nexport const SelectWithKeyboard = 'SELECT_WITH_KEYBOARD' as const;\nexport const TimeComplete = 'TIME_COMPLETE' as const;\n\nexport const subscription = createSubscription();\nexport const state = {\n current: {\n state: Idle as TooltipStates,\n id: '',\n },\n};\n\nfunction clearContextId() {\n state.current.id = '';\n}\n\nconst chart: GenericStateChart<TooltipStates, TooltipEventTypes> = {\n initial: Idle,\n states: {\n [Idle]: {\n enter: () => {\n clearContextId();\n },\n on: {\n [MouseEnter]: Focused,\n [Focus]: Visible,\n },\n },\n [Focused]: {\n enter: startRestTimer,\n leave: clearRestTimer,\n on: {\n [MouseMove]: Focused,\n [MouseLeave]: Idle,\n [MouseDown]: Dismissed,\n [Blur]: Idle,\n [Rest]: Visible,\n },\n },\n [Visible]: {\n on: {\n [Focus]: Focused,\n [MouseEnter]: Focused,\n [MouseLeave]: LeavingVisible,\n [Blur]: LeavingVisible,\n [MouseDown]: Dismissed,\n [SelectWithKeyboard]: Dismissed,\n [GlobalMouseMove]: LeavingVisible,\n },\n },\n [LeavingVisible]: {\n enter: () => {\n startLeavingVisibleTimer();\n },\n leave: () => {\n clearLeavingVisibleTimer();\n clearContextId();\n },\n on: {\n [MouseEnter]: Visible,\n [Focus]: Visible,\n [TimeComplete]: Idle,\n },\n },\n [Dismissed]: {\n leave: () => {\n clearContextId();\n },\n on: {\n [MouseLeave]: Idle,\n [Blur]: Idle,\n },\n },\n },\n};\n\nfunction transition(\n currentState: typeof state['current'],\n event: TooltipEventTypes,\n payload?: Omit<typeof state['current'], 'state'>\n): typeof state['current'] {\n const currentStateValue = currentState.state;\n const stateDef = chart.states[currentState.state];\n const nextState = stateDef?.on?.[event];\n\n // Really useful for debugging\n // console.log({\n // event,\n // state: state.current.state,\n // id: state.current.id,\n // nextState,\n // });\n\n if (!nextState) {\n return currentState;\n }\n\n if (stateDef && stateDef.leave) {\n stateDef.leave(currentStateValue, payload);\n }\n\n const nextStateValue = nextState;\n const nextDef = chart.states[nextStateValue];\n if (nextDef && nextDef.enter) {\n nextDef.enter(nextStateValue, payload);\n }\n\n return { ...currentState, ...payload, state: nextStateValue };\n}\n\nexport function send<T extends TooltipEventTypes>(\n event: T,\n payload?: Omit<typeof state['current'], 'state'>\n) {\n const nextState = transition(state.current, event, payload);\n if (state.current !== nextState) {\n state.current = nextState;\n subscription.notify();\n }\n}\n"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,8BAA8B;AAGjE;AACA;;AAEA;AACA;AACA,IAAIC,WAA2B;AAC/B,SAASC,cAAcA,CAAA,EAAG;EACxBC,YAAY,CAACF,WAAW,CAAC;EACzBA,WAAW,GAAGG,UAAU,CAAC,MAAM;IAC7BC,IAAI,CAACC,IAAI,EAAEC,SAAS,CAAC;EACvB,CAAC,EAAE,GAAG,CAAC;AACT;AAEA,SAASC,cAAcA,CAAA,EAAG;EACxBL,YAAY,CAACF,WAAW,CAAC;AAC3B;;AAEA;AACA,IAAIQ,mBAAmC;AACvC,SAASC,wBAAwBA,CAAA,EAAG;EAClCP,YAAY,CAACM,mBAAmB,CAAC;EACjCA,mBAAmB,GAAGL,UAAU,CAAC,MAAMC,IAAI,CAACM,YAAY,EAAEJ,SAAS,CAAC,EAAE,GAAG,CAAC;AAC5E;AAEA,SAASK,wBAAwBA,CAAA,EAAG;EAClCT,YAAY,CAACM,mBAAmB,CAAC;AACnC;;AAEA;AACA;;AASA;AACA,OAAO,MAAMI,IAAI,GAAG,MAAe;AACnC;AACA,OAAO,MAAMC,OAAO,GAAG,SAAkB;AACzC;AACA,OAAO,MAAMC,OAAO,GAAG,SAAkB;AACzC;AACA,OAAO,MAAMC,cAAc,GAAG,iBAA0B;AACxD;AACA;AACA,OAAO,MAAMC,SAAS,GAAG,WAAoB;AAc7C,OAAO,MAAMC,IAAI,GAAG,MAAe;AACnC,OAAO,MAAMC,KAAK,GAAG,OAAgB;AACrC,OAAO,MAAMC,eAAe,GAAG,mBAA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AAE;IAC5BW,OAAO,CAACX,KAAK,CAACU,cAAc,EAAEJ,OAAO,CAAC;EACxC;EAEA,OAAO;IAAE,GAAGF,YAAY;IAAE,GAAGE,OAAO;IAAEb,KAAK,EAAEiB;EAAe,CAAC;AAC/D;AAEA,OAAO,SAASvC,IAAIA,CAClBkC,KAAQ,EACRC,OAAgD,EAChD;EACA,MAAMG,SAAS,GAAGN,UAAU,CAACV,KAAK,CAACC,OAAO,EAAEW,KAAK,EAAEC,OAAO,CAAC;EAC3D,IAAIb,KAAK,CAACC,OAAO,KAAKe,SAAS,EAAE;IAC/BhB,KAAK,CAACC,OAAO,GAAGe,SAAS;IACzBjB,YAAY,CAACoB,MAAM,CAAC,CAAC;EACvB;AACF","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { HTMLAttributes, ReactNode, Ref, RefAttributes, RefObject } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export type ChildProps = HTMLAttributes<HTMLElement> & RefAttributes<HTMLElement>;
|
|
3
3
|
export interface InjectedTooltipProps extends HTMLAttributes<HTMLElement> {
|
|
4
|
-
anchorEl: RefObject<HTMLElement>;
|
|
4
|
+
anchorEl: RefObject<HTMLElement | null>;
|
|
5
5
|
visible: boolean;
|
|
6
6
|
children?: ReactNode;
|
|
7
7
|
}
|
|
@@ -1,87 +1,74 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
-
var _excluded = ["label", "onMouseEnter", "onMouseLeave", "onMouseMove"];
|
|
5
1
|
import { useRef, useEffect, useState, useId } from 'react';
|
|
6
2
|
import { assignMultipleRefs } from '../utils/assign-ref';
|
|
7
3
|
import { wrapEvent } from '../utils/wrap-event';
|
|
8
4
|
import { send, state, subscription, Blur, Focus, LeavingVisible, MouseDown, MouseEnter, MouseLeave, MouseMove, SelectWithKeyboard, Visible } from './stateMachine';
|
|
9
5
|
export function useTooltip(childProps, childRef, tooltipProps) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var id = useId();
|
|
25
|
-
useEffect(function () {
|
|
26
|
-
subscription.subscribe(function () {
|
|
6
|
+
const {
|
|
7
|
+
onMouseEnter,
|
|
8
|
+
onMouseLeave,
|
|
9
|
+
onMouseMove,
|
|
10
|
+
onMouseDown,
|
|
11
|
+
onKeyDown,
|
|
12
|
+
onFocus,
|
|
13
|
+
onBlur
|
|
14
|
+
} = childProps;
|
|
15
|
+
const anchorEl = useRef(null);
|
|
16
|
+
const [visible, setVisible] = useState(false);
|
|
17
|
+
const id = useId();
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
subscription.subscribe(() => {
|
|
27
20
|
setVisible((state.current.state === Visible || state.current.state === LeavingVisible) && state.current.id === id);
|
|
28
21
|
});
|
|
29
22
|
}, [id]);
|
|
30
|
-
|
|
31
23
|
function handleMouseEnter() {
|
|
32
24
|
send(MouseEnter, {
|
|
33
|
-
id
|
|
25
|
+
id
|
|
34
26
|
});
|
|
35
27
|
}
|
|
36
|
-
|
|
37
28
|
function handleMouseMove() {
|
|
38
29
|
send(MouseMove, {
|
|
39
|
-
id
|
|
30
|
+
id
|
|
40
31
|
});
|
|
41
32
|
}
|
|
42
|
-
|
|
43
33
|
function handleMouseLeave() {
|
|
44
34
|
send(MouseLeave);
|
|
45
35
|
}
|
|
46
|
-
|
|
47
36
|
function handleMouseDown() {
|
|
48
37
|
// Allow quick click from one tool to another
|
|
49
38
|
if (state.current.id === id) {
|
|
50
39
|
send(MouseDown);
|
|
51
40
|
}
|
|
52
41
|
}
|
|
53
|
-
|
|
54
42
|
function handleFocus() {
|
|
55
43
|
send(Focus, {
|
|
56
|
-
id
|
|
44
|
+
id
|
|
57
45
|
});
|
|
58
46
|
}
|
|
59
|
-
|
|
60
47
|
function handleBlur() {
|
|
61
48
|
// Allow quick click from one tool to another
|
|
62
49
|
if (state.current.id === id) {
|
|
63
50
|
send(Blur, undefined);
|
|
64
51
|
}
|
|
65
52
|
}
|
|
66
|
-
|
|
67
53
|
function handleKeyDown(event) {
|
|
68
54
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
69
55
|
send(SelectWithKeyboard);
|
|
70
56
|
}
|
|
71
57
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return [
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
'aria-
|
|
84
|
-
|
|
58
|
+
const {
|
|
59
|
+
label: children,
|
|
60
|
+
onMouseEnter: tooltipOnMouseEnter,
|
|
61
|
+
onMouseLeave: tooltipOnMouseLeave,
|
|
62
|
+
onMouseMove: tooltipOnMouseMove,
|
|
63
|
+
...otherTooltipProps
|
|
64
|
+
} = tooltipProps;
|
|
65
|
+
const tooltipId = `tooltip-${id}`;
|
|
66
|
+
return [{
|
|
67
|
+
...childProps,
|
|
68
|
+
ref: assignMultipleRefs(childRef, anchorEl),
|
|
69
|
+
...(visible && !childProps['aria-label'] && {
|
|
70
|
+
'aria-describedby': tooltipId
|
|
71
|
+
}),
|
|
85
72
|
onMouseEnter: wrapEvent(onMouseEnter, handleMouseEnter),
|
|
86
73
|
onMouseLeave: wrapEvent(onMouseLeave, handleMouseLeave),
|
|
87
74
|
onMouseMove: wrapEvent(onMouseMove, handleMouseMove),
|
|
@@ -89,15 +76,16 @@ export function useTooltip(childProps, childRef, tooltipProps) {
|
|
|
89
76
|
onFocus: wrapEvent(onFocus, handleFocus),
|
|
90
77
|
onBlur: wrapEvent(onBlur, handleBlur),
|
|
91
78
|
onKeyDown: wrapEvent(onKeyDown, handleKeyDown)
|
|
92
|
-
}
|
|
79
|
+
}, {
|
|
93
80
|
id: tooltipId,
|
|
94
|
-
anchorEl
|
|
95
|
-
visible
|
|
96
|
-
children
|
|
81
|
+
anchorEl,
|
|
82
|
+
visible,
|
|
83
|
+
children,
|
|
97
84
|
onMouseEnter: wrapEvent(tooltipOnMouseEnter, handleMouseEnter),
|
|
98
85
|
onMouseLeave: wrapEvent(tooltipOnMouseLeave, handleMouseLeave),
|
|
99
86
|
onMouseMove: wrapEvent(tooltipOnMouseMove, handleMouseMove),
|
|
100
|
-
role: 'tooltip'
|
|
101
|
-
|
|
87
|
+
role: 'tooltip',
|
|
88
|
+
...otherTooltipProps
|
|
89
|
+
}];
|
|
102
90
|
}
|
|
103
91
|
//# sourceMappingURL=useTooltip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTooltip.js","names":["useRef","useEffect","useState","useId","assignMultipleRefs","wrapEvent","send","state","subscription","Blur","Focus","LeavingVisible","MouseDown","MouseEnter","MouseLeave","MouseMove","SelectWithKeyboard","Visible","useTooltip","childProps","childRef","tooltipProps","onMouseEnter","onMouseLeave","onMouseMove","onMouseDown","onKeyDown","onFocus","onBlur","anchorEl","visible","setVisible","id","subscribe","current","handleMouseEnter","handleMouseMove","handleMouseLeave","handleMouseDown","handleFocus","handleBlur","undefined","handleKeyDown","event","key","
|
|
1
|
+
{"version":3,"file":"useTooltip.js","names":["useRef","useEffect","useState","useId","assignMultipleRefs","wrapEvent","send","state","subscription","Blur","Focus","LeavingVisible","MouseDown","MouseEnter","MouseLeave","MouseMove","SelectWithKeyboard","Visible","useTooltip","childProps","childRef","tooltipProps","onMouseEnter","onMouseLeave","onMouseMove","onMouseDown","onKeyDown","onFocus","onBlur","anchorEl","visible","setVisible","id","subscribe","current","handleMouseEnter","handleMouseMove","handleMouseLeave","handleMouseDown","handleFocus","handleBlur","undefined","handleKeyDown","event","key","label","children","tooltipOnMouseEnter","tooltipOnMouseLeave","tooltipOnMouseMove","otherTooltipProps","tooltipId","ref","role"],"sources":["../../../src/Tooltip/useTooltip.ts"],"sourcesContent":["import type {\n HTMLAttributes,\n KeyboardEvent,\n ReactNode,\n Ref,\n RefAttributes,\n RefObject,\n} from 'react';\nimport { useRef, useEffect, useState, useId } from 'react';\n\nimport { assignMultipleRefs } from '../utils/assign-ref';\nimport { wrapEvent } from '../utils/wrap-event';\nimport {\n send,\n state,\n subscription,\n Blur,\n Focus,\n LeavingVisible,\n MouseDown,\n MouseEnter,\n MouseLeave,\n MouseMove,\n SelectWithKeyboard,\n Visible,\n} from './stateMachine';\n\nexport type ChildProps = HTMLAttributes<HTMLElement> &\n RefAttributes<HTMLElement>;\n\nexport interface InjectedTooltipProps extends HTMLAttributes<HTMLElement> {\n anchorEl: RefObject<HTMLElement | null>;\n visible: boolean;\n children?: ReactNode;\n}\n\nexport function useTooltip(\n childProps: ChildProps,\n childRef: Ref<HTMLElement> | undefined,\n tooltipProps: HTMLAttributes<HTMLElement> & { label?: ReactNode }\n): [ChildProps, InjectedTooltipProps] {\n const {\n onMouseEnter,\n onMouseLeave,\n onMouseMove,\n onMouseDown,\n onKeyDown,\n onFocus,\n onBlur,\n } = childProps;\n const anchorEl = useRef<HTMLElement>(null);\n const [visible, setVisible] = useState(false);\n const id = useId();\n\n useEffect(() => {\n subscription.subscribe(() => {\n setVisible(\n (state.current.state === Visible ||\n state.current.state === LeavingVisible) &&\n state.current.id === id\n );\n });\n }, [id]);\n\n function handleMouseEnter() {\n send(MouseEnter, { id });\n }\n\n function handleMouseMove() {\n send(MouseMove, { id });\n }\n\n function handleMouseLeave() {\n send(MouseLeave);\n }\n\n function handleMouseDown() {\n // Allow quick click from one tool to another\n if (state.current.id === id) {\n send(MouseDown);\n }\n }\n\n function handleFocus() {\n send(Focus, { id });\n }\n\n function handleBlur() {\n // Allow quick click from one tool to another\n if (state.current.id === id) {\n send(Blur, undefined);\n }\n }\n\n function handleKeyDown(event: KeyboardEvent<HTMLElement>) {\n if (event.key === 'Enter' || event.key === ' ') {\n send(SelectWithKeyboard);\n }\n }\n\n const {\n label: children,\n onMouseEnter: tooltipOnMouseEnter,\n onMouseLeave: tooltipOnMouseLeave,\n onMouseMove: tooltipOnMouseMove,\n ...otherTooltipProps\n } = tooltipProps;\n\n const tooltipId = `tooltip-${id}`;\n return [\n {\n ...childProps,\n ref: assignMultipleRefs(childRef, anchorEl),\n ...(visible &&\n !childProps['aria-label'] && { 'aria-describedby': tooltipId }),\n onMouseEnter: wrapEvent(onMouseEnter, handleMouseEnter),\n onMouseLeave: wrapEvent(onMouseLeave, handleMouseLeave),\n onMouseMove: wrapEvent(onMouseMove, handleMouseMove),\n onMouseDown: wrapEvent(onMouseDown, handleMouseDown),\n onFocus: wrapEvent(onFocus, handleFocus),\n onBlur: wrapEvent(onBlur, handleBlur),\n onKeyDown: wrapEvent(onKeyDown, handleKeyDown),\n },\n {\n id: tooltipId,\n anchorEl,\n visible,\n children,\n onMouseEnter: wrapEvent(tooltipOnMouseEnter, handleMouseEnter),\n onMouseLeave: wrapEvent(tooltipOnMouseLeave, handleMouseLeave),\n onMouseMove: wrapEvent(tooltipOnMouseMove, handleMouseMove),\n role: 'tooltip',\n ...otherTooltipProps,\n },\n ];\n}\n"],"mappings":"AAQA,SAASA,MAAM,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,KAAK,QAAQ,OAAO;AAE1D,SAASC,kBAAkB,QAAQ,qBAAqB;AACxD,SAASC,SAAS,QAAQ,qBAAqB;AAC/C,SACEC,IAAI,EACJC,KAAK,EACLC,YAAY,EACZC,IAAI,EACJC,KAAK,EACLC,cAAc,EACdC,SAAS,EACTC,UAAU,EACVC,UAAU,EACVC,SAAS,EACTC,kBAAkB,EAClBC,OAAO,QACF,gBAAgB;AAWvB,OAAO,SAASC,UAAUA,CACxBC,UAAsB,EACtBC,QAAsC,EACtCC,YAAiE,EAC7B;EACpC,MAAM;IACJC,YAAY;IACZC,YAAY;IACZC,WAAW;IACXC,WAAW;IACXC,SAA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AW,EAAEnB,SAAS,CAAC4C,kBAAkB,EAAEb,eAAe,CAAC;IAC3DiB,IAAI,EAAE,SAAS;IACf,GAAGH;EACL,CAAC,CACF;AACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/hooks/index.ts"],"sourcesContent":["export * from './useAutoFocus';\nexport * from './useControlledState';\nexport * from './useChildrenCounter';\nexport * from './useFocusReturn';\nexport * from './useFocusState';\nexport * from './useOnClickOutside';\nexport * from './useOnKeyDown';\nexport * from './useReducerMachine';\nexport * from './useRemoveBodyScroll';\nexport * from './useThrottle';\nexport * from './useMeasure';\nexport * from './useGestureHandlers';\nexport * from './useScope';\n"],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/hooks/index.ts"],"sourcesContent":["export * from './useAutoFocus';\nexport * from './useControlledState';\nexport * from './useChildrenCounter';\nexport * from './useFocusReturn';\nexport * from './useFocusState';\nexport * from './useOnClickOutside';\nexport * from './useOnKeyDown';\nexport * from './useReducerMachine';\nexport * from './useRemoveBodyScroll';\nexport * from './useThrottle';\nexport * from './useMeasure';\nexport * from './useGestureHandlers';\nexport * from './useScope';\n"],"mappings":"AAAA,cAAc,gBAAgB;AAC9B,cAAc,sBAAsB;AACpC,cAAc,sBAAsB;AACpC,cAAc,kBAAkB;AAChC,cAAc,iBAAiB;AAC/B,cAAc,qBAAqB;AACnC,cAAc,gBAAgB;AAC9B,cAAc,qBAAqB;AACnC,cAAc,uBAAuB;AACrC,cAAc,eAAe;AAC7B,cAAc,cAAc;AAC5B,cAAc,sBAAsB;AACpC,cAAc,YAAY","ignoreList":[]}
|