@qualtrics/ui-react 2.85.2 → 2.85.4
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/CHANGELOG.md +17 -0
- package/dist/__node_modules/@radix-ui/primitive/dist/index.js +14 -3
- package/dist/__node_modules/@radix-ui/primitive/dist/internal/is-development.false.js +4 -0
- package/dist/__node_modules/@radix-ui/react-arrow/dist/index.js +7 -4
- package/dist/__node_modules/@radix-ui/react-collection/dist/index.js +58 -39
- package/dist/__node_modules/@radix-ui/react-compose-refs/dist/index.js +8 -1
- package/dist/__node_modules/@radix-ui/react-context/dist/index.js +35 -12
- package/dist/__node_modules/@radix-ui/react-direction/dist/index.js +10 -3
- package/dist/__node_modules/@radix-ui/react-dismissable-layer/dist/index.js +172 -41
- package/dist/__node_modules/@radix-ui/react-dropdown-menu/dist/index.js +58 -61
- package/dist/__node_modules/@radix-ui/react-focus-guards/dist/index.js +30 -6
- package/dist/__node_modules/@radix-ui/react-focus-scope/dist/index.js +33 -9
- package/dist/__node_modules/@radix-ui/react-id/dist/index.js +6 -0
- package/dist/__node_modules/@radix-ui/react-menu/dist/index.js +107 -79
- package/dist/__node_modules/@radix-ui/react-popper/dist/index.js +79 -38
- package/dist/__node_modules/@radix-ui/react-portal/dist/index.js +9 -6
- package/dist/__node_modules/@radix-ui/react-presence/dist/index.js +71 -12
- package/dist/__node_modules/@radix-ui/react-primitive/dist/index.js +6 -0
- package/dist/__node_modules/@radix-ui/react-roving-focus/dist/index.js +36 -12
- package/dist/__node_modules/@radix-ui/react-slot/dist/index.js +85 -54
- package/dist/__node_modules/@radix-ui/react-use-callback-ref/dist/index.js +6 -1
- package/dist/__node_modules/@radix-ui/react-use-controllable-state/dist/index.js +14 -4
- package/dist/__node_modules/@radix-ui/react-use-effect-event/dist/index.js +6 -1
- package/dist/__node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +37 -0
- package/dist/__node_modules/@radix-ui/react-use-layout-effect/dist/index.js +1 -1
- package/dist/__node_modules/@radix-ui/react-use-size/dist/index.js +6 -0
- package/dist/__shared/cjs/{index-e03dac36.js → index-08198ff4.js} +140 -136
- package/dist/__shared/cjs/{index-507024ee.js → index-e51bbd75.js} +3 -3
- package/dist/components/Accordion/Accordion2.js +3 -3
- package/dist/components/Button/Button.js +3 -3
- package/dist/components/ButtonGroup/ButtonGroup2.js +3 -3
- package/dist/components/Checkbox/Checkbox2.js +3 -3
- package/dist/components/ColorPicker/ColorPicker2.js +3 -3
- package/dist/components/Combobox/Combobox2.js +3 -3
- package/dist/components/ConfigPane/ConfigPane.js +6 -2
- package/dist/components/ConfigPane/ConfigPane2.js +3 -3
- package/dist/components/Divider/Divider2.js +3 -3
- package/dist/components/Dropdown/ChildIndexContext/reach-descendants.js +1 -1
- package/dist/components/Dropdown/Dropdown2.js +3 -3
- package/dist/components/FilePicker/FilePicker2.js +3 -3
- package/dist/components/FormField/Caption.js +3 -3
- package/dist/components/FormField/FormField2.js +3 -3
- package/dist/components/FullScreenTakeover/FullScreenTakeover2.js +3 -3
- package/dist/components/IconButton/IconButton2.js +3 -3
- package/dist/components/InlineInput/InlineInput2.js +3 -3
- package/dist/components/Input/Input2.js +3 -3
- package/dist/components/InputGroup/InputGroup2.js +3 -3
- package/dist/components/Label/Label2.js +3 -3
- package/dist/components/Link/Link2.js +3 -3
- package/dist/components/LoadingSpinner/LoadingSpinner2.js +3 -3
- package/dist/components/LogicEditor/LogicEditor2.js +3 -3
- package/dist/components/Modal/Modal2.js +3 -3
- package/dist/components/NewMenu/NewMenu.js +3 -3
- package/dist/components/NumberStepper/NumberStepper2.js +3 -3
- package/dist/components/PageLayout/PageLayout.js +3 -3
- package/dist/components/Pagination/Pagination2.js +3 -3
- package/dist/components/Popover/Popover2.js +3 -3
- package/dist/components/QuickSearch/QuickSearch2.js +3 -3
- package/dist/components/Radio/Radio2.js +3 -3
- package/dist/components/SearchInput/SearchInput2.js +3 -3
- package/dist/components/SidebarNav/SidebarNav2.js +3 -3
- package/dist/components/Slider/Slider2.js +3 -3
- package/dist/components/Switch/Switch2.js +3 -3
- package/dist/components/Table/Table2.js +3 -3
- package/dist/components/Tabs/Tabs2.js +3 -3
- package/dist/components/Tooltip/Tooltip2.js +3 -3
- package/dist/components/deprecated_ColorPicker/ColorPicker2.js +3 -3
- package/dist/components/deprecated_NumberStepper/NumberStepper2.js +3 -3
- package/dist/components/deprecated_Tabs/Tabs2.js +3 -3
- package/dist/components/deprecated_Toolbar/Toolbar2.js +3 -3
- package/dist/design-tokens/less/typography.js +3 -3
- package/dist/hooks/useOverlay/useOverlay2.js +3 -3
- package/dist/hooks/useScreenReaderAnnouncement/useScreenReaderAnnouncement2.js +3 -3
- package/dist/icons/Icon.js +3 -3
- package/dist/icons/index.js +1 -1
- package/dist/index.es.js +1 -1
- package/dist/index.js +3 -3
- package/dist/next/AdvancedTable/AdvancedTable2.js +3 -3
- package/dist/next/CollapsibleSearchInput/CollapsibleSearchInput2.js +3 -3
- package/dist/next/Combobox/Combobox2.js +3 -3
- package/dist/next/Drawer/Drawer2.js +3 -3
- package/dist/next/FilterAnchor/FilterAnchor2.js +3 -3
- package/dist/next/Form/FormFields/InputField.js +3 -3
- package/dist/next/Indicator/Indicator2.js +3 -3
- package/dist/next/Input/Input2.js +3 -3
- package/dist/next/LoadingSpinner/LoadingSpinner2.js +3 -3
- package/dist/next/Menu/Hooks/useFlyoutNode.js +48 -0
- package/dist/next/Menu/Menu2.js +3 -3
- package/dist/next/Menu/MenuButton.js +4 -3
- package/dist/next/Menu/MenuItem.js +3 -2
- package/dist/next/Menu/MenuPane.js +17 -16
- package/dist/next/Menu/PaneChildren.js +15 -10
- package/dist/next/Menu/SubMenu.js +17 -16
- package/dist/next/PhoneNumberInput/PhoneNumberInput2.js +3 -3
- package/dist/next/Select/Select2.js +3 -3
- package/dist/next/SplitButton/SplitButton2.js +3 -3
- package/dist/next/TimePicker/TimePicker2.js +3 -3
- package/dist/next/ToggleButton/styles.js +3 -3
- package/dist/next/index.js +1055 -519
- package/dist/utils/Flyout/Flyout2.js +3 -3
- package/icons/package.json +4 -4
- package/next/package.json +5 -5
- package/package.json +14 -14
- package/dist/__node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +0 -23
|
@@ -1,78 +1,87 @@
|
|
|
1
1
|
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { useComposedRefs } from '../../react-compose-refs/dist/index.js';
|
|
4
4
|
|
|
5
|
-
const _excluded = ["children"]
|
|
6
|
-
|
|
5
|
+
const _excluded = ["children"];
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
8
|
+
value,
|
|
9
|
+
configurable: true
|
|
10
|
+
});
|
|
7
11
|
// @__NO_SIDE_EFFECTS__
|
|
8
12
|
function createSlot(ownerName) {
|
|
9
|
-
const SlotClone = /* @__PURE__ */createSlotClone(ownerName);
|
|
10
13
|
const Slot2 = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
11
|
-
|
|
14
|
+
var _slottableElement$pro;
|
|
15
|
+
let children = props.children,
|
|
12
16
|
slotProps = _objectWithoutProperties(props, _excluded);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (child === slottable) {
|
|
19
|
-
if (React.Children.count(newElement) > 1) return React.Children.only(null);
|
|
20
|
-
return /*#__PURE__*/React.isValidElement(newElement) ? newElement.props.children : null;
|
|
21
|
-
} else {
|
|
22
|
-
return child;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
return /* @__PURE__ */React.createElement(SlotClone, {
|
|
26
|
-
...slotProps,
|
|
27
|
-
ref: forwardedRef,
|
|
28
|
-
children: /*#__PURE__*/React.isValidElement(newElement) ? /*#__PURE__*/React.cloneElement(newElement, void 0, newChildren) : null
|
|
29
|
-
});
|
|
17
|
+
let slottableElement = null;
|
|
18
|
+
let hasSlottable = false;
|
|
19
|
+
const newChildren = [];
|
|
20
|
+
if (isLazyComponent(children) && typeof use === "function") {
|
|
21
|
+
children = use(children._payload);
|
|
30
22
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
React.Children.forEach(children, maybeSlottable => {
|
|
24
|
+
if (isSlottable(maybeSlottable)) {
|
|
25
|
+
var _slottableElement;
|
|
26
|
+
hasSlottable = true;
|
|
27
|
+
const slottable = maybeSlottable;
|
|
28
|
+
let child = "child" in slottable.props ? slottable.props.child : slottable.props.children;
|
|
29
|
+
if (isLazyComponent(child) && typeof use === "function") {
|
|
30
|
+
child = use(child._payload);
|
|
31
|
+
}
|
|
32
|
+
slottableElement = getSlottableElementFromSlottable(slottable, child);
|
|
33
|
+
newChildren.push((_slottableElement = slottableElement) === null || _slottableElement === void 0 || (_slottableElement = _slottableElement.props) === null || _slottableElement === void 0 ? void 0 : _slottableElement.children);
|
|
34
|
+
} else {
|
|
35
|
+
newChildren.push(maybeSlottable);
|
|
36
|
+
}
|
|
35
37
|
});
|
|
38
|
+
if (slottableElement) {
|
|
39
|
+
slottableElement = /*#__PURE__*/React.cloneElement(slottableElement, void 0, newChildren);
|
|
40
|
+
} else if (
|
|
41
|
+
// A `Slottable` was found but it didn't resolve to a single element (e.g.
|
|
42
|
+
// it wrapped multiple elements, text, or a render-prop `child` that
|
|
43
|
+
// wasn't an element). Don't fall back to treating the `Slottable` wrapper
|
|
44
|
+
// itself as the slot target — throw a descriptive error below instead.
|
|
45
|
+
!hasSlottable && React.Children.count(children) === 1 && /*#__PURE__*/React.isValidElement(children)) {
|
|
46
|
+
slottableElement = children;
|
|
47
|
+
}
|
|
48
|
+
const slottableElementRef = slottableElement ? getElementRef(slottableElement) : void 0;
|
|
49
|
+
const composedRef = useComposedRefs(forwardedRef, slottableElementRef);
|
|
50
|
+
if (!slottableElement) {
|
|
51
|
+
if (children || children === 0) {
|
|
52
|
+
throw new Error(hasSlottable ? createSlottableError(ownerName) : createSlotError(ownerName));
|
|
53
|
+
}
|
|
54
|
+
return children;
|
|
55
|
+
}
|
|
56
|
+
const mergedProps = mergeProps(slotProps, (_slottableElement$pro = slottableElement.props) !== null && _slottableElement$pro !== void 0 ? _slottableElement$pro : {});
|
|
57
|
+
if (slottableElement.type !== React.Fragment) {
|
|
58
|
+
mergedProps.ref = forwardedRef ? composedRef : slottableElementRef;
|
|
59
|
+
}
|
|
60
|
+
return /*#__PURE__*/React.cloneElement(slottableElement, mergedProps);
|
|
36
61
|
});
|
|
37
62
|
Slot2.displayName = "".concat(ownerName, ".Slot");
|
|
38
63
|
return Slot2;
|
|
39
64
|
}
|
|
65
|
+
__name(createSlot, "createSlot");
|
|
40
66
|
var Slot = /* @__PURE__ */createSlot("Slot");
|
|
41
|
-
|
|
42
|
-
function createSlotClone(ownerName) {
|
|
43
|
-
const SlotClone = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {
|
|
44
|
-
const children = props.children,
|
|
45
|
-
slotProps = _objectWithoutProperties(props, _excluded2);
|
|
46
|
-
if (/*#__PURE__*/React.isValidElement(children)) {
|
|
47
|
-
const childrenRef = getElementRef(children);
|
|
48
|
-
const props2 = mergeProps(slotProps, children.props);
|
|
49
|
-
if (children.type !== React.Fragment) {
|
|
50
|
-
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
51
|
-
}
|
|
52
|
-
return /*#__PURE__*/React.cloneElement(children, props2);
|
|
53
|
-
}
|
|
54
|
-
return React.Children.count(children) > 1 ? React.Children.only(null) : null;
|
|
55
|
-
});
|
|
56
|
-
SlotClone.displayName = "".concat(ownerName, ".SlotClone");
|
|
57
|
-
return SlotClone;
|
|
58
|
-
}
|
|
59
|
-
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
67
|
+
var SLOTTABLE_IDENTIFIER = Symbol.for("radix.slottable");
|
|
60
68
|
// @__NO_SIDE_EFFECTS__
|
|
61
69
|
function createSlottable(ownerName) {
|
|
62
|
-
const Slottable2 =
|
|
63
|
-
let children = _ref.children;
|
|
64
|
-
return /* @__PURE__ */React.createElement(React.Fragment, {
|
|
65
|
-
children
|
|
66
|
-
});
|
|
67
|
-
};
|
|
70
|
+
const Slottable2 = /* @__PURE__ */__name(props => "child" in props ? props.children(props.child) : props.children, "Slottable");
|
|
68
71
|
Slottable2.displayName = "".concat(ownerName, ".Slottable");
|
|
69
72
|
Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
|
|
70
73
|
return Slottable2;
|
|
71
74
|
}
|
|
75
|
+
__name(createSlottable, "createSlottable");
|
|
72
76
|
var Slottable = /* @__PURE__ */createSlottable("Slottable");
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
var getSlottableElementFromSlottable = /* @__PURE__ */__name((slottable, child) => {
|
|
78
|
+
if ("child" in slottable.props) {
|
|
79
|
+
const child2 = slottable.props.child;
|
|
80
|
+
if (! /*#__PURE__*/React.isValidElement(child2)) return null;
|
|
81
|
+
return /*#__PURE__*/React.cloneElement(child2, void 0, slottable.props.children(child2.props.children));
|
|
82
|
+
}
|
|
83
|
+
return /*#__PURE__*/React.isValidElement(child) ? child : null;
|
|
84
|
+
}, "getSlottableElementFromSlottable");
|
|
76
85
|
function mergeProps(slotProps, childProps) {
|
|
77
86
|
const overrideProps = {
|
|
78
87
|
...childProps
|
|
@@ -105,6 +114,7 @@ function mergeProps(slotProps, childProps) {
|
|
|
105
114
|
...overrideProps
|
|
106
115
|
};
|
|
107
116
|
}
|
|
117
|
+
__name(mergeProps, "mergeProps");
|
|
108
118
|
function getElementRef(element) {
|
|
109
119
|
var _Object$getOwnPropert, _Object$getOwnPropert2;
|
|
110
120
|
let getter = (_Object$getOwnPropert = Object.getOwnPropertyDescriptor(element.props, "ref")) === null || _Object$getOwnPropert === void 0 ? void 0 : _Object$getOwnPropert.get;
|
|
@@ -119,5 +129,26 @@ function getElementRef(element) {
|
|
|
119
129
|
}
|
|
120
130
|
return element.props.ref || element.ref;
|
|
121
131
|
}
|
|
132
|
+
__name(getElementRef, "getElementRef");
|
|
133
|
+
function isSlottable(child) {
|
|
134
|
+
return /*#__PURE__*/React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
135
|
+
}
|
|
136
|
+
__name(isSlottable, "isSlottable");
|
|
137
|
+
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
138
|
+
function isLazyComponent(element) {
|
|
139
|
+
return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
|
|
140
|
+
}
|
|
141
|
+
__name(isLazyComponent, "isLazyComponent");
|
|
142
|
+
function isPromiseLike(value) {
|
|
143
|
+
return typeof value === "object" && value !== null && "then" in value;
|
|
144
|
+
}
|
|
145
|
+
__name(isPromiseLike, "isPromiseLike");
|
|
146
|
+
var createSlotError = /* @__PURE__ */__name(ownerName => {
|
|
147
|
+
return "".concat(ownerName, " failed to slot onto its children. Expected a single React element child or `Slottable`.");
|
|
148
|
+
}, "createSlotError");
|
|
149
|
+
var createSlottableError = /* @__PURE__ */__name(ownerName => {
|
|
150
|
+
return "".concat(ownerName, " failed to slot onto its `Slottable`. Expected `Slottable` to receive a single React element child.");
|
|
151
|
+
}, "createSlottableError");
|
|
152
|
+
var use = React[" use ".trim().toString()];
|
|
122
153
|
|
|
123
154
|
export { Slot as Root, Slot, Slottable, createSlot, createSlottable };
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
5
|
+
value,
|
|
6
|
+
configurable: true
|
|
7
|
+
});
|
|
4
8
|
function useCallbackRef(callback) {
|
|
5
9
|
const callbackRef = React.useRef(callback);
|
|
6
10
|
React.useEffect(() => {
|
|
@@ -14,5 +18,6 @@ function useCallbackRef(callback) {
|
|
|
14
18
|
return (_callbackRef$current = callbackRef.current) === null || _callbackRef$current === void 0 ? void 0 : _callbackRef$current.call(callbackRef, ...args);
|
|
15
19
|
}, []);
|
|
16
20
|
}
|
|
21
|
+
__name(useCallbackRef, "useCallbackRef");
|
|
17
22
|
|
|
18
23
|
export { useCallbackRef };
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { IS_DEVELOPMENT } from '../../primitive/dist/internal/is-development.false.js';
|
|
3
4
|
import { useLayoutEffect as useLayoutEffect2 } from '../../react-use-layout-effect/dist/index.js';
|
|
4
5
|
import { useEffectEvent } from '../../react-use-effect-event/dist/index.js';
|
|
5
6
|
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
9
|
+
value,
|
|
10
|
+
configurable: true
|
|
11
|
+
});
|
|
6
12
|
var useInsertionEffect = React[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
|
|
7
13
|
function useControllableState(_ref) {
|
|
8
14
|
let prop = _ref.prop,
|
|
9
15
|
defaultProp = _ref.defaultProp,
|
|
10
16
|
_ref$onChange = _ref.onChange,
|
|
11
|
-
onChange = _ref$onChange === void 0 ? () => {} : _ref$onChange,
|
|
17
|
+
onChange = _ref$onChange === void 0 ? /* @__PURE__ */__name(() => {}, "onChange") : _ref$onChange,
|
|
12
18
|
caller = _ref.caller;
|
|
13
19
|
const _useUncontrolledState = useUncontrolledState({
|
|
14
20
|
defaultProp,
|
|
@@ -20,7 +26,7 @@ function useControllableState(_ref) {
|
|
|
20
26
|
onChangeRef = _useUncontrolledState2[2];
|
|
21
27
|
const isControlled = prop !== void 0;
|
|
22
28
|
const value = isControlled ? prop : uncontrolledProp;
|
|
23
|
-
if (
|
|
29
|
+
if (IS_DEVELOPMENT) {
|
|
24
30
|
const isControlledRef = React.useRef(prop !== void 0);
|
|
25
31
|
React.useEffect(() => {
|
|
26
32
|
const wasControlled = isControlledRef.current;
|
|
@@ -45,6 +51,7 @@ function useControllableState(_ref) {
|
|
|
45
51
|
}, [isControlled, prop, setUncontrolledProp, onChangeRef]);
|
|
46
52
|
return [value, setValue];
|
|
47
53
|
}
|
|
54
|
+
__name(useControllableState, "useControllableState");
|
|
48
55
|
function useUncontrolledState(_ref2) {
|
|
49
56
|
let defaultProp = _ref2.defaultProp,
|
|
50
57
|
onChange = _ref2.onChange;
|
|
@@ -66,9 +73,11 @@ function useUncontrolledState(_ref2) {
|
|
|
66
73
|
}, [value, prevValueRef]);
|
|
67
74
|
return [value, setValue, onChangeRef];
|
|
68
75
|
}
|
|
76
|
+
__name(useUncontrolledState, "useUncontrolledState");
|
|
69
77
|
function isFunction(value) {
|
|
70
78
|
return typeof value === "function";
|
|
71
79
|
}
|
|
80
|
+
__name(isFunction, "isFunction");
|
|
72
81
|
var SYNC_STATE = Symbol("RADIX:SYNC_STATE");
|
|
73
82
|
function useControllableStateReducer(reducer, userArgs, initialArg, init) {
|
|
74
83
|
const controlledState = userArgs.prop,
|
|
@@ -77,7 +86,7 @@ function useControllableStateReducer(reducer, userArgs, initialArg, init) {
|
|
|
77
86
|
caller = userArgs.caller;
|
|
78
87
|
const isControlled = controlledState !== void 0;
|
|
79
88
|
const onChange = useEffectEvent(onChangeProp);
|
|
80
|
-
if (
|
|
89
|
+
if (IS_DEVELOPMENT) {
|
|
81
90
|
const isControlledRef = React.useRef(controlledState !== void 0);
|
|
82
91
|
React.useEffect(() => {
|
|
83
92
|
const wasControlled = isControlledRef.current;
|
|
@@ -121,7 +130,7 @@ function useControllableStateReducer(reducer, userArgs, initialArg, init) {
|
|
|
121
130
|
onChange(uncontrolledState);
|
|
122
131
|
}
|
|
123
132
|
}
|
|
124
|
-
}, [
|
|
133
|
+
}, [uncontrolledState, prevValueRef, isControlled]);
|
|
125
134
|
const state = React.useMemo(() => {
|
|
126
135
|
const isControlled2 = controlledState !== void 0;
|
|
127
136
|
if (isControlled2) {
|
|
@@ -142,5 +151,6 @@ function useControllableStateReducer(reducer, userArgs, initialArg, init) {
|
|
|
142
151
|
}, [controlledState, internalState.state, isControlled]);
|
|
143
152
|
return [state, dispatch];
|
|
144
153
|
}
|
|
154
|
+
__name(useControllableStateReducer, "useControllableStateReducer");
|
|
145
155
|
|
|
146
156
|
export { useControllableState, useControllableStateReducer };
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { useLayoutEffect as useLayoutEffect2 } from '../../react-use-layout-effect/dist/index.js';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
6
|
+
value,
|
|
7
|
+
configurable: true
|
|
8
|
+
});
|
|
5
9
|
var useReactEffectEvent = React[" useEffectEvent ".trim().toString()];
|
|
6
10
|
var useReactInsertionEffect = React[" useInsertionEffect ".trim().toString()];
|
|
7
11
|
function useEffectEvent(callback) {
|
|
@@ -28,5 +32,6 @@ function useEffectEvent(callback) {
|
|
|
28
32
|
return (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.call(ref, ...args);
|
|
29
33
|
}, []);
|
|
30
34
|
}
|
|
35
|
+
__name(useEffectEvent, "useEffectEvent");
|
|
31
36
|
|
|
32
37
|
export { useEffectEvent };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
6
|
+
value,
|
|
7
|
+
configurable: true
|
|
8
|
+
});
|
|
9
|
+
var _isHydrated = false;
|
|
10
|
+
function useIsHydrated() {
|
|
11
|
+
const _React$useState = React.useState(_isHydrated),
|
|
12
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
13
|
+
isHydrated = _React$useState2[0],
|
|
14
|
+
setIsHydrated = _React$useState2[1];
|
|
15
|
+
React.useEffect(() => {
|
|
16
|
+
if (!_isHydrated) {
|
|
17
|
+
_isHydrated = true;
|
|
18
|
+
setIsHydrated(true);
|
|
19
|
+
}
|
|
20
|
+
}, []);
|
|
21
|
+
return isHydrated;
|
|
22
|
+
}
|
|
23
|
+
__name(useIsHydrated, "useIsHydrated");
|
|
24
|
+
|
|
25
|
+
// src/use-is-hydrated.tsx
|
|
26
|
+
var useReactSyncExternalStore = React[" useSyncExternalStore ".trim().toString()];
|
|
27
|
+
function subscribe() {
|
|
28
|
+
return () => {};
|
|
29
|
+
}
|
|
30
|
+
__name(subscribe, "subscribe");
|
|
31
|
+
function useIsHydratedModern() {
|
|
32
|
+
return useReactSyncExternalStore(subscribe, () => true, () => false);
|
|
33
|
+
}
|
|
34
|
+
__name(useIsHydratedModern, "useIsHydratedModern");
|
|
35
|
+
var useIsHydrated2 = typeof useReactSyncExternalStore === "function" ? useIsHydratedModern : useIsHydrated;
|
|
36
|
+
|
|
37
|
+
export { useIsHydrated2 as useIsHydrated };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
//
|
|
3
|
+
// src/use-layout-effect.tsx
|
|
4
4
|
var useLayoutEffect2 = globalThis !== null && globalThis !== void 0 && globalThis.document ? React.useLayoutEffect : () => {};
|
|
5
5
|
|
|
6
6
|
export { useLayoutEffect2 as useLayoutEffect };
|
|
@@ -2,6 +2,11 @@ import _slicedToArray from '@babel/runtime-corejs3/helpers/slicedToArray';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useLayoutEffect as useLayoutEffect2 } from '../../react-use-layout-effect/dist/index.js';
|
|
4
4
|
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
7
|
+
value,
|
|
8
|
+
configurable: true
|
|
9
|
+
});
|
|
5
10
|
function useSize(element) {
|
|
6
11
|
const _React$useState = React.useState(void 0),
|
|
7
12
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -47,5 +52,6 @@ function useSize(element) {
|
|
|
47
52
|
}, [element]);
|
|
48
53
|
return size;
|
|
49
54
|
}
|
|
55
|
+
__name(useSize, "useSize");
|
|
50
56
|
|
|
51
57
|
export { useSize };
|