|
32 | 32 | /* eslint-disable jsx-a11y/no-static-element-interactions */
|
33 | 33 |
|
34 | 34 | import * as React from "react";
|
35 |
| -import { |
36 |
| - createNamedContext, |
37 |
| - forwardRefWithAs, |
38 |
| - isFunction, |
39 |
| - useCheckStyles, |
40 |
| - useForkedRef, |
41 |
| - wrapEvent, |
42 |
| -} from "@reach/utils"; |
| 35 | +import { createNamedContext } from "@reach/utils/context"; |
| 36 | +import { forwardRefWithAs } from "@reach/utils/polymorphic"; |
| 37 | +import { isFunction } from "@reach/utils/type-check"; |
| 38 | +import { useCheckStyles } from "@reach/utils/dev-utils"; |
| 39 | +import { useComposedRefs } from "@reach/utils/compose-refs"; |
| 40 | +import { composeEventHandlers } from "@reach/utils/compose-event-handlers"; |
43 | 41 | import {
|
44 | 42 | internal_checkedPropToStateValue as checkedPropToStateValue,
|
45 | 43 | internal_useControlledSwitchWarning as useControlledSwitchWarning,
|
@@ -121,7 +119,7 @@ const CustomCheckboxContainer = forwardRefWithAs<
|
121 | 119 | data-reach-custom-checkbox-container=""
|
122 | 120 | data-focused={focused ? "" : undefined}
|
123 | 121 | data-state={checkedPropToStateValue(stateData.checked)}
|
124 |
| - onClick={wrapEvent(onClick, handleClick)} |
| 122 | + onClick={composeEventHandlers(onClick, handleClick)} |
125 | 123 | >
|
126 | 124 | {isFunction(children)
|
127 | 125 | ? children({
|
@@ -229,7 +227,7 @@ const CustomCheckboxInput = forwardRefWithAs<CustomCheckboxInputProps, "input">(
|
229 | 227 | setFocused,
|
230 | 228 | } = useCustomCheckboxContext();
|
231 | 229 |
|
232 |
| - let ref = useForkedRef(forwardedRef, inputRef); |
| 230 | + let ref = useComposedRefs(forwardedRef, inputRef); |
233 | 231 | let mounted = React.useRef(true);
|
234 | 232 |
|
235 | 233 | function handleBlur() {
|
@@ -260,8 +258,8 @@ const CustomCheckboxInput = forwardRefWithAs<CustomCheckboxInputProps, "input">(
|
260 | 258 | type="checkbox"
|
261 | 259 | data-reach-custom-checkbox-input=""
|
262 | 260 | data-focused={focused ? "" : undefined}
|
263 |
| - onBlur={wrapEvent(onBlur, handleBlur)} |
264 |
| - onFocus={wrapEvent(onFocus, handleFocus)} |
| 261 | + onBlur={composeEventHandlers(onBlur, handleBlur)} |
| 262 | + onFocus={composeEventHandlers(onFocus, handleFocus)} |
265 | 263 | />
|
266 | 264 | );
|
267 | 265 | }
|
|
0 commit comments