@pingux/astro 2.32.0-alpha.10 → 2.32.0-alpha.11
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/lib/cjs/components/ImageUploadField/ImageUploadField.test.js +47 -14
- package/lib/cjs/components/TreeView/TreeView.js +99 -11
- package/lib/cjs/components/TreeView/TreeView.stories.js +23 -10
- package/lib/cjs/components/TreeView/TreeView.styles.js +22 -2
- package/lib/cjs/components/TreeView/TreeView.test.js +91 -11
- package/lib/cjs/components/TreeView/TreeViewItem.js +112 -14
- package/lib/cjs/components/TreeView/TreeViewKeyboardDelegate.js +200 -0
- package/lib/cjs/components/TreeView/TreeViewKeyboardDelegate.test.js +511 -0
- package/lib/cjs/components/TreeView/TreeViewRow.js +20 -5
- package/lib/cjs/components/TreeView/TreeViewSection.js +164 -16
- package/lib/cjs/components/TreeView/TreeViewWrapper.js +40 -0
- package/lib/cjs/hooks/useImageUploadState/index.d.ts +1 -0
- package/lib/cjs/hooks/useImageUploadState/useImageUploadState.d.ts +28 -0
- package/lib/cjs/hooks/useImageUploadState/useImageUploadState.js +9 -6
- package/lib/cjs/hooks/useModalState/index.d.ts +1 -0
- package/lib/cjs/hooks/useModalState/useModalState.d.ts +21 -0
- package/lib/cjs/hooks/useModalState/useModalState.js +0 -9
- package/lib/cjs/hooks/useModalState/useModalState.test.d.ts +1 -0
- package/lib/components/ImageUploadField/ImageUploadField.test.js +47 -14
- package/lib/components/TreeView/TreeView.js +100 -12
- package/lib/components/TreeView/TreeView.stories.js +23 -10
- package/lib/components/TreeView/TreeView.styles.js +22 -2
- package/lib/components/TreeView/TreeView.test.js +92 -12
- package/lib/components/TreeView/TreeViewItem.js +111 -14
- package/lib/components/TreeView/TreeViewKeyboardDelegate.js +176 -0
- package/lib/components/TreeView/TreeViewKeyboardDelegate.test.js +496 -0
- package/lib/components/TreeView/TreeViewRow.js +20 -5
- package/lib/components/TreeView/TreeViewSection.js +161 -16
- package/lib/components/TreeView/TreeViewWrapper.js +31 -0
- package/lib/hooks/useImageUploadState/useImageUploadState.js +9 -6
- package/lib/hooks/useModalState/useModalState.js +0 -10
- package/package.json +1 -1
@@ -9,7 +9,7 @@ import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object
|
|
9
9
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
10
10
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
11
11
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
12
|
-
var _excluded = ["title", "mainIcon", "lastIcon", "item", "items", "isExpanded", "isSelected", "isDisabled", "iconButtonProps"];
|
12
|
+
var _excluded = ["title", "mainIcon", "lastIcon", "item", "items", "isExpanded", "isSelected", "isDisabled", "isParentFocused", "iconButtonProps"];
|
13
13
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
14
14
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
15
15
|
import React, { forwardRef, useImperativeHandle, useRef } from 'react';
|
@@ -35,6 +35,7 @@ var TreeViewRow = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
35
35
|
isExpanded = props.isExpanded,
|
36
36
|
isSelected = props.isSelected,
|
37
37
|
isDisabled = props.isDisabled,
|
38
|
+
isParentFocused = props.isParentFocused,
|
38
39
|
iconButtonProps = props.iconButtonProps,
|
39
40
|
others = _objectWithoutProperties(props, _excluded);
|
40
41
|
var treeRowRef = useRef();
|
@@ -73,13 +74,19 @@ var TreeViewRow = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
73
74
|
}),
|
74
75
|
classNames = _useStatusClasses.classNames;
|
75
76
|
var mergedProps = mergeProps(hoverProps, pressProps, others);
|
77
|
+
|
78
|
+
// console.log(`ROW: ${key} has parent focus: ${isParentFocused}`)
|
79
|
+
|
76
80
|
return ___EmotionJSX(Box, _extends({
|
77
81
|
ref: treeRowRef,
|
78
82
|
isRow: true,
|
79
83
|
alignItems: "center",
|
80
84
|
gap: "xs",
|
81
85
|
sx: {
|
82
|
-
flexGrow: 1
|
86
|
+
flexGrow: 1,
|
87
|
+
'& :focus': {
|
88
|
+
border: 'none'
|
89
|
+
}
|
83
90
|
},
|
84
91
|
className: classNames,
|
85
92
|
key: "".concat(key, " box")
|
@@ -92,15 +99,22 @@ var TreeViewRow = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
92
99
|
size: 25,
|
93
100
|
title: "".concat(title, " expand or collapse button")
|
94
101
|
},
|
95
|
-
buttonProps: {
|
102
|
+
buttonProps: _objectSpread(_objectSpread({
|
96
103
|
'aria-label': "".concat(title, " expand or collapse button")
|
97
|
-
}
|
104
|
+
}, isParentFocused && {
|
105
|
+
tabIndex: 0
|
106
|
+
}), !isParentFocused && {
|
107
|
+
tabIndex: -1
|
108
|
+
})
|
98
109
|
}), ___EmotionJSX(Box, {
|
99
110
|
isRow: true,
|
100
111
|
className: classNames,
|
101
112
|
alignItems: "center",
|
102
113
|
gap: "xs",
|
103
|
-
variant: "treeView.treeRow"
|
114
|
+
variant: "treeView.treeRow",
|
115
|
+
sx: !items && {
|
116
|
+
ml: '36px'
|
117
|
+
}
|
104
118
|
}, ___EmotionJSX(Icon, {
|
105
119
|
color: "focus",
|
106
120
|
icon: mainIcon,
|
@@ -121,6 +135,7 @@ TreeViewRow.propTypes = {
|
|
121
135
|
isSelected: PropTypes.bool,
|
122
136
|
isDisabled: PropTypes.bool,
|
123
137
|
isExpanded: PropTypes.bool,
|
138
|
+
isParentFocused: PropTypes.bool,
|
124
139
|
title: PropTypes.string,
|
125
140
|
items: PropTypes.arrayOf(PropTypes.shape({})),
|
126
141
|
iconButtonProps: PropTypes.shape({
|
@@ -1,19 +1,105 @@
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
|
+
import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
|
3
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
4
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
2
5
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
3
6
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
4
|
-
import React, { forwardRef, useImperativeHandle, useRef } from 'react';
|
7
|
+
import React, { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
8
|
+
import { useFocusRing } from '@react-aria/focus';
|
5
9
|
import { useOption } from '@react-aria/listbox';
|
10
|
+
import { mergeProps } from '@react-aria/utils';
|
6
11
|
import PropTypes from 'prop-types';
|
7
12
|
import { useTreeViewContext } from '../../context/TreeViewContext';
|
13
|
+
import { useStatusClasses } from '../../hooks';
|
8
14
|
import { Box, TreeViewItem } from '../../index';
|
9
15
|
import { SectionOrItemRender } from './TreeView';
|
16
|
+
import { sectionPressHandlers } from './TreeViewKeyboardDelegate';
|
10
17
|
import TreeViewRow from './TreeViewRow';
|
11
18
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
19
|
+
export var onKeyDownSection = function onKeyDownSection(e, state, key, tree, isSelected, isExpanded, focusManager, flatKeyArray, refArray, pageLength, isFocused) {
|
20
|
+
switch (e.which) {
|
21
|
+
case 9:
|
22
|
+
if (isFocused) {
|
23
|
+
sectionPressHandlers.onTabPress(e, refArray, focusManager, true, key);
|
24
|
+
}
|
25
|
+
break;
|
26
|
+
case 13:
|
27
|
+
sectionPressHandlers.onEnterPress(e, state, key);
|
28
|
+
break;
|
29
|
+
case 32:
|
30
|
+
sectionPressHandlers.onSpacePress(e, tree, key, isSelected);
|
31
|
+
break;
|
32
|
+
case 33:
|
33
|
+
sectionPressHandlers.onPageUpPress(e, key, flatKeyArray, refArray, pageLength);
|
34
|
+
break;
|
35
|
+
case 34:
|
36
|
+
sectionPressHandlers.onPageDownPress(e, key, flatKeyArray, refArray, pageLength);
|
37
|
+
break;
|
38
|
+
case 36:
|
39
|
+
sectionPressHandlers.onHomePress(key, flatKeyArray, refArray);
|
40
|
+
e.preventDefault();
|
41
|
+
e.stopPropagation();
|
42
|
+
break;
|
43
|
+
case 35:
|
44
|
+
sectionPressHandlers.onEndPress(key, flatKeyArray, refArray);
|
45
|
+
e.preventDefault();
|
46
|
+
e.stopPropagation();
|
47
|
+
break;
|
48
|
+
case 37:
|
49
|
+
sectionPressHandlers.onLeftPress(e, focusManager, state, key, isExpanded, refArray);
|
50
|
+
break;
|
51
|
+
case 38:
|
52
|
+
sectionPressHandlers.onUpPress(e, key, refArray, flatKeyArray);
|
53
|
+
e.preventDefault();
|
54
|
+
e.stopPropagation();
|
55
|
+
break;
|
56
|
+
case 39:
|
57
|
+
if (isFocused) {
|
58
|
+
sectionPressHandlers.onRightPress(e, focusManager, state, key, isExpanded, refArray);
|
59
|
+
}
|
60
|
+
break;
|
61
|
+
case 40:
|
62
|
+
sectionPressHandlers.onDownPress(e, key, refArray, flatKeyArray);
|
63
|
+
e.preventDefault();
|
64
|
+
e.stopPropagation();
|
65
|
+
break;
|
66
|
+
default:
|
67
|
+
/* istanbul ignore next */
|
68
|
+
break;
|
69
|
+
}
|
70
|
+
};
|
71
|
+
export var removeRefFromArrayHelper = function removeRefFromArrayHelper(prevState, keyToRemove) {
|
72
|
+
if (_someInstanceProperty(prevState).call(prevState, function (item) {
|
73
|
+
return item.key === keyToRemove;
|
74
|
+
})) {
|
75
|
+
var _context;
|
76
|
+
var newArray = _concatInstanceProperty(_context = []).call(_context, _filterInstanceProperty(prevState).call(prevState, function (_item) {
|
77
|
+
return _item.key !== keyToRemove;
|
78
|
+
}));
|
79
|
+
return newArray;
|
80
|
+
}
|
81
|
+
return prevState;
|
82
|
+
};
|
83
|
+
export var addRefToArrayHelper = function addRefToArrayHelper(prevState, keyToAdd, refToAdd) {
|
84
|
+
if (!_someInstanceProperty(prevState).call(prevState, function (i) {
|
85
|
+
return i.key === keyToAdd;
|
86
|
+
})) {
|
87
|
+
var _context2;
|
88
|
+
var thisObj = {
|
89
|
+
key: keyToAdd,
|
90
|
+
thisRef: refToAdd
|
91
|
+
};
|
92
|
+
return _concatInstanceProperty(_context2 = []).call(_context2, prevState, [thisObj]);
|
93
|
+
}
|
94
|
+
return prevState;
|
95
|
+
};
|
12
96
|
var TreeViewSection = /*#__PURE__*/forwardRef(function (props, ref) {
|
13
|
-
var
|
97
|
+
var _context3;
|
14
98
|
var item = props.item,
|
15
99
|
items = props.items,
|
16
100
|
title = props.title,
|
101
|
+
focusManager = props.focusManager,
|
102
|
+
onKeyDown = props.onKeyDown,
|
17
103
|
level = props.level,
|
18
104
|
position = props.position,
|
19
105
|
setSize = props.setSize;
|
@@ -24,51 +110,107 @@ var TreeViewSection = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
24
110
|
return treeSectionRef.current;
|
25
111
|
});
|
26
112
|
var _useTreeViewContext = useTreeViewContext(),
|
27
|
-
state = _useTreeViewContext.state
|
113
|
+
state = _useTreeViewContext.state,
|
114
|
+
tree = _useTreeViewContext.tree,
|
115
|
+
refArray = _useTreeViewContext.refArray,
|
116
|
+
setRefs = _useTreeViewContext.setRefs,
|
117
|
+
flatKeyArray = _useTreeViewContext.flatKeyArray,
|
118
|
+
pageLength = _useTreeViewContext.pageLength,
|
119
|
+
setLastFocusedItem = _useTreeViewContext.setLastFocusedItem,
|
120
|
+
lastFocusedItem = _useTreeViewContext.lastFocusedItem;
|
28
121
|
var _useOption = useOption({
|
29
122
|
key: key
|
30
123
|
}, state, treeSectionRef),
|
31
124
|
optionProps = _useOption.optionProps,
|
32
125
|
isDisabled = _useOption.isDisabled,
|
33
126
|
isSelected = _useOption.isSelected;
|
127
|
+
var _useFocusRing = useFocusRing(),
|
128
|
+
focusProps = _useFocusRing.focusProps,
|
129
|
+
isFocused = _useFocusRing.isFocused;
|
130
|
+
var _useFocusRing2 = useFocusRing({
|
131
|
+
within: true
|
132
|
+
}),
|
133
|
+
focusPropsWithin = _useFocusRing2.focusProps,
|
134
|
+
isFocusedWithin = _useFocusRing2.isFocused;
|
34
135
|
var isExpanded = state.expandedKeys.has(key);
|
136
|
+
var onKeyDownFunction = function onKeyDownFunction(e) {
|
137
|
+
onKeyDownSection(e, state, key, tree, isSelected, isExpanded, focusManager, flatKeyArray, refArray, pageLength, isFocused);
|
138
|
+
if (onKeyDown) {
|
139
|
+
onKeyDown(e, key);
|
140
|
+
}
|
141
|
+
};
|
142
|
+
var addRefToArray = function addRefToArray(thisKey, thisRef) {
|
143
|
+
setRefs(function (prev) {
|
144
|
+
return addRefToArrayHelper(prev, thisKey, thisRef);
|
145
|
+
});
|
146
|
+
};
|
147
|
+
var removeRefFromArray = function removeRefFromArray() {
|
148
|
+
setRefs(function (prev) {
|
149
|
+
return removeRefFromArrayHelper(prev, key);
|
150
|
+
});
|
151
|
+
};
|
152
|
+
|
153
|
+
// adds and removes refs on mount and dismount
|
154
|
+
useEffect(function () {
|
155
|
+
// this runs on mount
|
156
|
+
addRefToArray(key, treeSectionRef);
|
157
|
+
return function () {
|
158
|
+
// this runs on cleanup
|
159
|
+
removeRefFromArray(key, refArray);
|
160
|
+
};
|
161
|
+
}, []);
|
162
|
+
var mergedProps = mergeProps(focusPropsWithin, focusProps, optionProps, {
|
163
|
+
onFocus: function onFocus() {
|
164
|
+
return setLastFocusedItem(key);
|
165
|
+
}
|
166
|
+
});
|
167
|
+
var _useStatusClasses = useStatusClasses('', {
|
168
|
+
isFocused: isFocused
|
169
|
+
}),
|
170
|
+
classNames = _useStatusClasses.classNames;
|
35
171
|
return ___EmotionJSX(Box, _extends({
|
36
172
|
ref: treeSectionRef,
|
37
173
|
as: "li",
|
38
|
-
sx: {
|
39
|
-
':not(:last-child)': {
|
40
|
-
pb: 'sm'
|
41
|
-
}
|
42
|
-
},
|
43
174
|
"aria-expanded": isExpanded,
|
44
|
-
"aria-disabled": isDisabled
|
175
|
+
"aria-disabled": isDisabled
|
176
|
+
}, mergedProps, {
|
177
|
+
role: "treeitem",
|
178
|
+
variant: "treeView.wrapper",
|
179
|
+
className: classNames,
|
180
|
+
"aria-selected": isSelected,
|
45
181
|
"aria-level": level,
|
46
182
|
"aria-setsize": setSize,
|
47
|
-
"aria-posinset": position + 1
|
48
|
-
|
49
|
-
|
50
|
-
|
183
|
+
"aria-posinset": position + 1,
|
184
|
+
onKeyDown: function onKeyDown(e) {
|
185
|
+
return onKeyDownFunction(e);
|
186
|
+
},
|
187
|
+
tabIndex: lastFocusedItem === key ? 0 : -1
|
51
188
|
}), ___EmotionJSX(TreeViewRow, {
|
52
189
|
item: item,
|
53
190
|
title: title,
|
54
191
|
items: items,
|
55
192
|
isExpanded: isExpanded,
|
56
193
|
isSelected: isSelected,
|
57
|
-
isDisabled: isDisabled
|
194
|
+
isDisabled: isDisabled,
|
195
|
+
isParentFocused: isFocusedWithin
|
58
196
|
}), isExpanded && ___EmotionJSX(Box, {
|
59
197
|
as: "ul",
|
60
198
|
role: "group",
|
61
199
|
key: "".concat(item.key, " ul"),
|
62
200
|
sx: {
|
63
|
-
pl: 'md'
|
201
|
+
pl: 'md',
|
202
|
+
'& :focus': {
|
203
|
+
border: 'none'
|
204
|
+
}
|
64
205
|
}
|
65
|
-
}, _mapInstanceProperty(
|
206
|
+
}, _mapInstanceProperty(_context3 = _Array$from(items)).call(_context3, function (_item, _index) {
|
66
207
|
var _item$value$items;
|
67
208
|
return SectionOrItemRender(((_item$value$items = _item.value.items) === null || _item$value$items === void 0 ? void 0 : _item$value$items.length) > 0, ___EmotionJSX(TreeViewSection, {
|
68
209
|
item: _item,
|
69
210
|
items: _item.children,
|
70
211
|
title: _item.value.title,
|
71
212
|
key: _item.value.title,
|
213
|
+
focusManager: focusManager,
|
72
214
|
level: level + 1,
|
73
215
|
position: _index,
|
74
216
|
setSize: items.length
|
@@ -76,6 +218,7 @@ var TreeViewSection = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
76
218
|
item: _item,
|
77
219
|
title: _item.value.title,
|
78
220
|
key: _item.value.title,
|
221
|
+
focusManager: focusManager,
|
79
222
|
level: level + 1,
|
80
223
|
position: _index,
|
81
224
|
setSize: items.length
|
@@ -88,6 +231,8 @@ TreeViewSection.propTypes = {
|
|
88
231
|
key: PropTypes.string
|
89
232
|
}),
|
90
233
|
title: PropTypes.string,
|
234
|
+
focusManager: PropTypes.shape({}),
|
235
|
+
onKeyDown: PropTypes.func,
|
91
236
|
level: PropTypes.number,
|
92
237
|
position: PropTypes.number,
|
93
238
|
setSize: PropTypes.number
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
2
|
+
import React from 'react';
|
3
|
+
import { FocusScope, useFocusManager } from '@react-aria/focus';
|
4
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
5
|
+
var TreeViewWrapper = function TreeViewWrapper(props) {
|
6
|
+
var children = props.children;
|
7
|
+
var items = _mapInstanceProperty(children).call(children, function (child) {
|
8
|
+
return {
|
9
|
+
item: child,
|
10
|
+
key: child.key
|
11
|
+
};
|
12
|
+
});
|
13
|
+
return ___EmotionJSX(FocusScope, {
|
14
|
+
restoreFocus: false,
|
15
|
+
contain: false
|
16
|
+
}, _mapInstanceProperty(items).call(items, function (_ref) {
|
17
|
+
var item = _ref.item,
|
18
|
+
key = _ref.key;
|
19
|
+
return ___EmotionJSX(FocusableItem, {
|
20
|
+
key: key
|
21
|
+
}, item);
|
22
|
+
}));
|
23
|
+
};
|
24
|
+
var FocusableItem = function FocusableItem(props) {
|
25
|
+
var focusManager = useFocusManager();
|
26
|
+
var childWithFocusHandle = /*#__PURE__*/React.cloneElement(props.children, {
|
27
|
+
focusManager: focusManager
|
28
|
+
});
|
29
|
+
return childWithFocusHandle;
|
30
|
+
};
|
31
|
+
export default TreeViewWrapper;
|
@@ -35,11 +35,15 @@ var useImageUploadState = function useImageUploadState(inputRef) {
|
|
35
35
|
if (previewImage && previewImage !== defaultPreviewImage) {
|
36
36
|
setIsMenuOpen(true);
|
37
37
|
} else {
|
38
|
-
|
38
|
+
var _inputRef$current;
|
39
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.click();
|
39
40
|
}
|
40
41
|
}, [defaultPreviewImage, previewImage, inputRef]);
|
41
42
|
var handleInputChange = useCallback(function (event) {
|
42
43
|
var _event$target;
|
44
|
+
if (!event.target.files) {
|
45
|
+
return;
|
46
|
+
}
|
43
47
|
var eventFileType = (_event$target = event.target) === null || _event$target === void 0 || (_event$target = _event$target.files[0]) === null || _event$target === void 0 || (_event$target = _event$target.type) === null || _event$target === void 0 ? void 0 : _event$target.split('/')[0];
|
44
48
|
if (fileTypes !== null && fileTypes !== void 0 && _includesInstanceProperty(fileTypes).call(fileTypes, eventFileType)) {
|
45
49
|
if (onChange && typeof onChange === 'function') {
|
@@ -52,9 +56,8 @@ var useImageUploadState = function useImageUploadState(inputRef) {
|
|
52
56
|
var _event$target2;
|
53
57
|
setIsImageType(true);
|
54
58
|
var reader = new FileReader();
|
55
|
-
reader.onload = function (
|
56
|
-
|
57
|
-
setPreviewImage(result);
|
59
|
+
reader.onload = function () {
|
60
|
+
setPreviewImage(reader.result);
|
58
61
|
};
|
59
62
|
reader.readAsDataURL((_event$target2 = event.target) === null || _event$target2 === void 0 ? void 0 : _event$target2.files[0]);
|
60
63
|
} else {
|
@@ -76,8 +79,8 @@ var useImageUploadState = function useImageUploadState(inputRef) {
|
|
76
79
|
return setPreviewImage(defaultPreviewImage);
|
77
80
|
}, [defaultPreviewImage]);
|
78
81
|
var showFileDialog = useCallback(function () {
|
79
|
-
var _inputRef$
|
80
|
-
return inputRef === null || inputRef === void 0 || (_inputRef$
|
82
|
+
var _inputRef$current2;
|
83
|
+
return inputRef === null || inputRef === void 0 || (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.click();
|
81
84
|
}, [inputRef]);
|
82
85
|
var handleLabelClick = useCallback(function (e) {
|
83
86
|
e.preventDefault();
|
@@ -1,14 +1,4 @@
|
|
1
1
|
import { useOverlayTriggerState } from 'react-stately';
|
2
|
-
|
3
|
-
/**
|
4
|
-
* Returns state-related data and functions for use with a Modal component.
|
5
|
-
* @param {Object} [props] Properties provided to the state
|
6
|
-
* @param {Boolean} [props.isDefaultOpen] Whether the modal is open by default (uncontrolled).
|
7
|
-
* @param {Boolean} [props.isOpen] Whether the modal is currently open (controlled).
|
8
|
-
* @param {Function} [props.onOpenChange] Handler that is called when the open state changes.
|
9
|
-
* `(isOpen: boolean) => void`
|
10
|
-
* @returns {Object} `{ isOpen: Boolean, open: Function, close: Function, toggle: Function }`
|
11
|
-
*/
|
12
2
|
var useModalState = function useModalState() {
|
13
3
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
14
4
|
var isDefaultOpen = props.isDefaultOpen,
|