@pingux/astro 2.39.0 → 2.40.0-alpha.1
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/TreeView/InsertionIndicator.js +50 -0
- package/lib/cjs/components/TreeView/TreeView.js +227 -34
- package/lib/cjs/components/TreeView/TreeView.stories.js +3 -2
- package/lib/cjs/components/TreeView/TreeView.styles.js +26 -6
- package/lib/cjs/components/TreeView/TreeView.test.js +258 -8
- package/lib/cjs/components/TreeView/TreeViewItem.js +28 -56
- package/lib/cjs/components/TreeView/TreeViewKeyboardDelegate.test.js +19 -0
- package/lib/cjs/components/TreeView/TreeViewRow.js +123 -32
- package/lib/cjs/components/TreeView/TreeViewSection.js +33 -67
- package/lib/cjs/recipes/PanelContent.stories.js +66 -33
- package/lib/cjs/utils/testUtils/dndMocks.js +232 -0
- package/lib/components/TreeView/InsertionIndicator.js +41 -0
- package/lib/components/TreeView/TreeView.js +224 -34
- package/lib/components/TreeView/TreeView.stories.js +3 -2
- package/lib/components/TreeView/TreeView.styles.js +26 -6
- package/lib/components/TreeView/TreeView.test.js +262 -7
- package/lib/components/TreeView/TreeViewItem.js +29 -57
- package/lib/components/TreeView/TreeViewKeyboardDelegate.test.js +19 -0
- package/lib/components/TreeView/TreeViewRow.js +129 -38
- package/lib/components/TreeView/TreeViewSection.js +34 -68
- package/lib/recipes/PanelContent.stories.js +58 -25
- package/lib/utils/testUtils/dndMocks.js +218 -0
- package/package.json +4 -1
@@ -1,3 +1,12 @@
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
3
|
+
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
4
|
+
var _excluded = ["title", "mainIcon", "lastIcon", "item", "items", "isExpanded", "isDragging", "onKeyDown"];
|
5
|
+
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; }
|
6
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context3 = ownKeys(Object(source))).call(_context3, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
7
|
+
import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
|
8
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
9
|
+
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
1
10
|
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
2
11
|
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
3
12
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
@@ -6,23 +15,21 @@ import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/inst
|
|
6
15
|
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
7
16
|
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
8
17
|
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
9
|
-
import
|
10
|
-
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
11
|
-
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
12
|
-
var _excluded = ["title", "mainIcon", "lastIcon", "item", "items", "isExpanded", "isSelected", "isDisabled", "isParentFocused", "iconButtonProps"];
|
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
|
-
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
|
-
import React, { forwardRef, useImperativeHandle, useRef } from 'react';
|
18
|
+
import React, { forwardRef, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
16
19
|
import FolderIcon from '@pingux/mdi-react/FolderIcon';
|
17
20
|
import LockIcon from '@pingux/mdi-react/LockIcon';
|
18
21
|
import MenuDownIcon from '@pingux/mdi-react/MenuDownIcon';
|
19
22
|
import MenuRight from '@pingux/mdi-react/MenuRightIcon';
|
20
|
-
import {
|
23
|
+
import { useDraggableItem, useDroppableItem } from '@react-aria/dnd';
|
24
|
+
import { useFocusRing } from '@react-aria/focus';
|
25
|
+
import { useHover } from '@react-aria/interactions';
|
26
|
+
import { useOption } from '@react-aria/listbox';
|
21
27
|
import { mergeProps } from '@react-aria/utils';
|
22
28
|
import PropTypes from 'prop-types';
|
23
29
|
import { useTreeViewContext } from '../../context/TreeViewContext';
|
24
30
|
import { useStatusClasses } from '../../hooks';
|
25
31
|
import { Box, Icon, IconButtonToggle, Text } from '../../index';
|
32
|
+
import { addRefToArrayHelper, removeRefFromArrayHelper } from './TreeViewSection';
|
26
33
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
27
34
|
var TreeViewRow = /*#__PURE__*/forwardRef(function (props, ref) {
|
28
35
|
var title = props.title,
|
@@ -33,10 +40,8 @@ var TreeViewRow = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
33
40
|
item = props.item,
|
34
41
|
items = props.items,
|
35
42
|
isExpanded = props.isExpanded,
|
36
|
-
|
37
|
-
|
38
|
-
isParentFocused = props.isParentFocused,
|
39
|
-
iconButtonProps = props.iconButtonProps,
|
43
|
+
isDragging = props.isDragging,
|
44
|
+
_onKeyDown = props.onKeyDown,
|
40
45
|
others = _objectWithoutProperties(props, _excluded);
|
41
46
|
var treeRowRef = useRef();
|
42
47
|
/* istanbul ignore next */
|
@@ -46,34 +51,112 @@ var TreeViewRow = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
46
51
|
var key = item.key;
|
47
52
|
var _useTreeViewContext = useTreeViewContext(),
|
48
53
|
state = _useTreeViewContext.state,
|
49
|
-
|
54
|
+
dragState = _useTreeViewContext.dragState,
|
55
|
+
dropState = _useTreeViewContext.dropState,
|
56
|
+
refArray = _useTreeViewContext.refArray,
|
57
|
+
setRefs = _useTreeViewContext.setRefs,
|
58
|
+
tree = _useTreeViewContext.tree,
|
59
|
+
setLastFocusedItem = _useTreeViewContext.setLastFocusedItem,
|
60
|
+
lastFocusedItem = _useTreeViewContext.lastFocusedItem,
|
61
|
+
flatKeyArray = _useTreeViewContext.flatKeyArray,
|
62
|
+
targetKey = _useTreeViewContext.targetKey,
|
63
|
+
keyBeingDragged = _useTreeViewContext.keyBeingDragged;
|
64
|
+
var addRefToArray = function addRefToArray(thisKey, thisRef) {
|
65
|
+
setRefs(function (prev) {
|
66
|
+
return addRefToArrayHelper(prev, thisKey, thisRef);
|
67
|
+
});
|
68
|
+
};
|
69
|
+
var removeRefFromArray = function removeRefFromArray() {
|
70
|
+
setRefs(function (prev) {
|
71
|
+
return removeRefFromArrayHelper(prev, key);
|
72
|
+
});
|
73
|
+
};
|
74
|
+
|
75
|
+
// this runs on mount
|
76
|
+
useEffect(function () {
|
77
|
+
addRefToArray(key, treeRowRef);
|
78
|
+
}, []);
|
79
|
+
|
80
|
+
// cleanup, that runs on dismount.
|
81
|
+
useEffect(function () {
|
82
|
+
return function () {
|
83
|
+
return removeRefFromArray(key, refArray);
|
84
|
+
};
|
85
|
+
}, []);
|
50
86
|
var _useHover = useHover({}),
|
51
87
|
hoverProps = _useHover.hoverProps,
|
52
88
|
isHovered = _useHover.isHovered;
|
53
|
-
var pressIcon = function pressIcon(
|
89
|
+
var pressIcon = function pressIcon() {
|
54
90
|
state.toggleKey(item.key);
|
55
|
-
if (iconButtonProps !== null && iconButtonProps !== void 0 && iconButtonProps.onPress) {
|
56
|
-
iconButtonProps.onPress(e);
|
57
|
-
}
|
58
91
|
};
|
92
|
+
var _useOption = useOption({
|
93
|
+
key: key
|
94
|
+
}, state, treeRowRef),
|
95
|
+
optionProps = _useOption.optionProps,
|
96
|
+
isDisabled = _useOption.isDisabled,
|
97
|
+
isSelected = _useOption.isSelected;
|
59
98
|
var pressRow = function pressRow() {
|
99
|
+
if (isSelected) {
|
100
|
+
tree.setSelectedKeys([]);
|
101
|
+
return;
|
102
|
+
}
|
60
103
|
tree.setSelectedKeys([item.key]);
|
61
104
|
};
|
62
|
-
var
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
105
|
+
var _useDroppableItem = useDroppableItem({
|
106
|
+
target: {
|
107
|
+
type: 'item',
|
108
|
+
key: item.key,
|
109
|
+
dropPosition: 'on'
|
110
|
+
}
|
111
|
+
}, dropState, treeRowRef),
|
112
|
+
dropProps = _useDroppableItem.dropProps,
|
113
|
+
isDropTarget = _useDroppableItem.isDropTarget;
|
114
|
+
var _useDraggableItem = useDraggableItem({
|
115
|
+
hasDragButton: true,
|
116
|
+
key: item.key
|
117
|
+
}, dragState),
|
118
|
+
dragProps = _useDraggableItem.dragProps;
|
119
|
+
var _useFocusRing = useFocusRing(),
|
120
|
+
focusProps = _useFocusRing.focusProps,
|
121
|
+
isFocused = _useFocusRing.isFocused;
|
122
|
+
var _useFocusRing2 = useFocusRing({
|
123
|
+
within: true
|
124
|
+
}),
|
125
|
+
focusWithinProps = _useFocusRing2.focusProps,
|
126
|
+
isFocusedWithin = _useFocusRing2.isFocused;
|
127
|
+
|
128
|
+
// we do not allow for items to be dropped on themselves, or on their children
|
129
|
+
var validateDropTarget = function validateDropTarget() {
|
130
|
+
var _foundTargetItem$pare, _context;
|
131
|
+
var foundTargetItem = _findInstanceProperty(flatKeyArray).call(flatKeyArray, function (_item) {
|
132
|
+
return _item.key === targetKey;
|
133
|
+
});
|
134
|
+
if (!isDropTarget || foundTargetItem !== null && foundTargetItem !== void 0 && (_foundTargetItem$pare = foundTargetItem.parentKeys) !== null && _foundTargetItem$pare !== void 0 && _includesInstanceProperty(_foundTargetItem$pare).call(_foundTargetItem$pare, keyBeingDragged) || foundTargetItem.key === keyBeingDragged || _includesInstanceProperty(_context = _Array$from(state.disabledKeys)).call(_context, foundTargetItem.key)) {
|
135
|
+
return false;
|
136
|
+
}
|
137
|
+
if (isDropTarget) {
|
138
|
+
return true;
|
139
|
+
}
|
140
|
+
return false;
|
141
|
+
};
|
142
|
+
var isValidDropTarget = useMemo(function () {
|
143
|
+
return validateDropTarget();
|
144
|
+
}, [targetKey, isDropTarget]);
|
68
145
|
var _useStatusClasses = useStatusClasses('', {
|
69
146
|
isHovered: isHovered,
|
70
147
|
isSelected: isSelected,
|
71
148
|
isExpanded: isExpanded,
|
72
|
-
|
73
|
-
|
149
|
+
isDisabled: isDisabled,
|
150
|
+
isDragging: isDragging,
|
151
|
+
isDropTarget: isValidDropTarget,
|
152
|
+
isFocused: isFocused
|
74
153
|
}),
|
75
154
|
classNames = _useStatusClasses.classNames;
|
76
|
-
var mergedProps = mergeProps(hoverProps,
|
155
|
+
var mergedProps = mergeProps(hoverProps, others, optionProps, dragProps, dropProps, focusProps, focusWithinProps, {
|
156
|
+
onFocus: function onFocus() {
|
157
|
+
setLastFocusedItem(key);
|
158
|
+
}
|
159
|
+
});
|
77
160
|
return ___EmotionJSX(Box, _extends({
|
78
161
|
ref: treeRowRef,
|
79
162
|
isRow: true,
|
@@ -85,10 +168,20 @@ var TreeViewRow = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
85
168
|
border: 'none'
|
86
169
|
}
|
87
170
|
},
|
171
|
+
variant: "treeView.rowWrapper",
|
88
172
|
className: classNames,
|
89
173
|
key: "".concat(key, " box"),
|
90
|
-
|
91
|
-
}, mergedProps
|
174
|
+
"data-droptarget": isDropTarget
|
175
|
+
}, mergedProps, {
|
176
|
+
role: "gridcell",
|
177
|
+
tabIndex: "-1"
|
178
|
+
}, lastFocusedItem === key && {
|
179
|
+
tabIndex: 0
|
180
|
+
}, {
|
181
|
+
onKeyDown: function onKeyDown(e) {
|
182
|
+
_onKeyDown(e);
|
183
|
+
}
|
184
|
+
}), (items === null || items === void 0 ? void 0 : items.length) > 0 && ___EmotionJSX(IconButtonToggle, {
|
92
185
|
onToggle: pressIcon,
|
93
186
|
isToggled: isExpanded,
|
94
187
|
defaultIcon: MenuRight,
|
@@ -97,12 +190,11 @@ var TreeViewRow = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
97
190
|
size: 25,
|
98
191
|
title: "".concat(title, " expand or collapse button")
|
99
192
|
},
|
100
|
-
buttonProps: _objectSpread(
|
101
|
-
'aria-label': "".concat(title, " expand or collapse button")
|
102
|
-
|
193
|
+
buttonProps: _objectSpread({
|
194
|
+
'aria-label': "".concat(title, " expand or collapse button"),
|
195
|
+
tabIndex: '-1'
|
196
|
+
}, lastFocusedItem === key && isFocusedWithin && {
|
103
197
|
tabIndex: 0
|
104
|
-
}), !isParentFocused && {
|
105
|
-
tabIndex: -1
|
106
198
|
})
|
107
199
|
}), ___EmotionJSX(Box, {
|
108
200
|
isRow: true,
|
@@ -112,7 +204,8 @@ var TreeViewRow = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
112
204
|
variant: "treeView.treeRow",
|
113
205
|
sx: !items && {
|
114
206
|
ml: '36px'
|
115
|
-
}
|
207
|
+
},
|
208
|
+
onClick: pressRow
|
116
209
|
}, ___EmotionJSX(Icon, {
|
117
210
|
color: "focus",
|
118
211
|
icon: mainIcon,
|
@@ -131,14 +224,12 @@ var TreeViewRow = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
131
224
|
});
|
132
225
|
TreeViewRow.propTypes = {
|
133
226
|
isSelected: PropTypes.bool,
|
227
|
+
isDragging: PropTypes.bool,
|
228
|
+
onKeyDown: PropTypes.func,
|
134
229
|
isDisabled: PropTypes.bool,
|
135
230
|
isExpanded: PropTypes.bool,
|
136
|
-
isParentFocused: PropTypes.bool,
|
137
231
|
title: PropTypes.string,
|
138
232
|
items: PropTypes.arrayOf(PropTypes.shape({})),
|
139
|
-
iconButtonProps: PropTypes.shape({
|
140
|
-
onPress: PropTypes.func
|
141
|
-
}),
|
142
233
|
item: PropTypes.shape({
|
143
234
|
key: PropTypes.string
|
144
235
|
}),
|
@@ -1,17 +1,14 @@
|
|
1
|
-
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
1
|
import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
|
3
2
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
4
3
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
5
4
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
6
5
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
7
|
-
import React, { forwardRef,
|
8
|
-
import { useFocusRing } from '@react-aria/focus';
|
6
|
+
import React, { forwardRef, useImperativeHandle, useRef } from 'react';
|
9
7
|
import { useOption } from '@react-aria/listbox';
|
10
|
-
import { mergeProps } from '@react-aria/utils';
|
11
8
|
import PropTypes from 'prop-types';
|
12
9
|
import { useTreeViewContext } from '../../context/TreeViewContext';
|
13
|
-
import { useStatusClasses } from '../../hooks';
|
14
10
|
import { Box, TreeViewItem } from '../../index';
|
11
|
+
import InsertionIndicator from './InsertionIndicator';
|
15
12
|
import { SectionOrItemRender } from './TreeView';
|
16
13
|
import { sectionPressHandlers } from './TreeViewKeyboardDelegate';
|
17
14
|
import TreeViewRow from './TreeViewRow';
|
@@ -59,12 +56,11 @@ export var onKeyDownSection = function onKeyDownSection(e, state, key, tree, isS
|
|
59
56
|
}
|
60
57
|
break;
|
61
58
|
case 40:
|
62
|
-
sectionPressHandlers.onDownPress(e, key, refArray, flatKeyArray);
|
63
59
|
e.preventDefault();
|
64
60
|
e.stopPropagation();
|
61
|
+
sectionPressHandlers.onDownPress(e, key, refArray, flatKeyArray);
|
65
62
|
break;
|
66
63
|
default:
|
67
|
-
/* istanbul ignore next */
|
68
64
|
break;
|
69
65
|
}
|
70
66
|
};
|
@@ -113,85 +109,48 @@ var TreeViewSection = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
113
109
|
state = _useTreeViewContext.state,
|
114
110
|
tree = _useTreeViewContext.tree,
|
115
111
|
refArray = _useTreeViewContext.refArray,
|
116
|
-
setRefs = _useTreeViewContext.setRefs,
|
117
112
|
flatKeyArray = _useTreeViewContext.flatKeyArray,
|
118
|
-
|
119
|
-
|
120
|
-
|
113
|
+
dragState = _useTreeViewContext.dragState,
|
114
|
+
dropState = _useTreeViewContext.dropState,
|
115
|
+
pageLength = _useTreeViewContext.pageLength;
|
121
116
|
var _useOption = useOption({
|
122
117
|
key: key
|
123
118
|
}, state, treeSectionRef),
|
124
|
-
|
125
|
-
isDisabled = _useOption.isDisabled
|
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;
|
119
|
+
isSelected = _useOption.isSelected,
|
120
|
+
isDisabled = _useOption.isDisabled;
|
135
121
|
var isExpanded = state.expandedKeys.has(key);
|
122
|
+
var isDragging = dragState.isDragging(item.key);
|
136
123
|
var onKeyDownFunction = function onKeyDownFunction(e) {
|
137
|
-
onKeyDownSection(e, state, key, tree, isSelected, isExpanded, focusManager, flatKeyArray, refArray, pageLength,
|
124
|
+
onKeyDownSection(e, state, key, tree, isSelected, isExpanded, focusManager, flatKeyArray, refArray, pageLength, true);
|
138
125
|
if (onKeyDown) {
|
139
126
|
onKeyDown(e, key);
|
140
127
|
}
|
141
128
|
};
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
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;
|
171
|
-
return ___EmotionJSX(Box, _extends({
|
129
|
+
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(InsertionIndicator, {
|
130
|
+
target: {
|
131
|
+
type: 'item',
|
132
|
+
key: item.key,
|
133
|
+
dropPosition: 'before'
|
134
|
+
},
|
135
|
+
dropState: dropState
|
136
|
+
}), ___EmotionJSX(Box, {
|
172
137
|
ref: treeSectionRef,
|
173
138
|
"aria-expanded": isExpanded,
|
174
|
-
"aria-disabled": isDisabled
|
175
|
-
}, mergedProps, {
|
139
|
+
"aria-disabled": isDisabled,
|
176
140
|
role: "row",
|
177
141
|
variant: "treeView.wrapper",
|
178
|
-
className: classNames,
|
179
142
|
"aria-selected": isSelected,
|
143
|
+
tabIndex: "-1",
|
180
144
|
"aria-level": level,
|
181
145
|
"aria-setsize": setSize,
|
182
|
-
"aria-posinset": position + 1
|
183
|
-
|
184
|
-
return onKeyDownFunction(e);
|
185
|
-
},
|
186
|
-
tabIndex: lastFocusedItem === key ? 0 : -1
|
187
|
-
}), ___EmotionJSX(TreeViewRow, {
|
146
|
+
"aria-posinset": position + 1
|
147
|
+
}, ___EmotionJSX(TreeViewRow, {
|
188
148
|
item: item,
|
189
149
|
title: title,
|
190
150
|
items: items,
|
151
|
+
isDragging: isDragging,
|
191
152
|
isExpanded: isExpanded,
|
192
|
-
|
193
|
-
isDisabled: isDisabled,
|
194
|
-
isParentFocused: isFocusedWithin
|
153
|
+
onKeyDown: onKeyDownFunction
|
195
154
|
}), isExpanded && ___EmotionJSX(Box, {
|
196
155
|
role: "rowgroup",
|
197
156
|
key: "".concat(item.key, " ul"),
|
@@ -202,8 +161,8 @@ var TreeViewSection = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
202
161
|
}
|
203
162
|
}
|
204
163
|
}, _mapInstanceProperty(_context3 = _Array$from(items)).call(_context3, function (_item, _index) {
|
205
|
-
var _item$
|
206
|
-
return SectionOrItemRender(((_item$
|
164
|
+
var _item$children;
|
165
|
+
return SectionOrItemRender(((_item$children = _item.children) === null || _item$children === void 0 ? void 0 : _item$children.length) > 0, ___EmotionJSX(TreeViewSection, {
|
207
166
|
item: _item,
|
208
167
|
items: _item.children,
|
209
168
|
title: _item.value.title,
|
@@ -221,7 +180,14 @@ var TreeViewSection = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
221
180
|
position: _index,
|
222
181
|
setSize: items.length
|
223
182
|
}));
|
224
|
-
})))
|
183
|
+
}))), ___EmotionJSX(InsertionIndicator, {
|
184
|
+
target: {
|
185
|
+
type: 'item',
|
186
|
+
key: item.key,
|
187
|
+
dropPosition: 'after'
|
188
|
+
},
|
189
|
+
dropState: dropState
|
190
|
+
}));
|
225
191
|
});
|
226
192
|
TreeViewSection.propTypes = {
|
227
193
|
items: PropTypes.arrayOf(PropTypes.shape({})),
|
@@ -1,13 +1,13 @@
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
2
3
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
3
4
|
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
4
|
-
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
5
5
|
import React, { useRef } from 'react';
|
6
|
-
import
|
6
|
+
import ChevronRightIcon from '@pingux/mdi-react/ChevronRightIcon';
|
7
7
|
import PencilIcon from '@pingux/mdi-react/PencilIcon';
|
8
8
|
import PlusIcon from '@pingux/mdi-react/PlusIcon';
|
9
9
|
import { useOverlayPanelState } from '../hooks';
|
10
|
-
import { AccordionGroup, Badge, Box, Button, ButtonBar, CheckboxField, EditButton, Icon, Image, ImageUploadField, NoticeIcon, OverlayPanel, OverlayProvider, PanelHeader, PanelHeaderCloseButton, PanelHeaderMenu, PanelHeaderSwitchField, SelectField, Tab, Tabs, Text, TextField } from '../index';
|
10
|
+
import { AccordionGroup, Badge, Box, Breadcrumbs, Button, ButtonBar, CheckboxField, EditButton, Icon, Image, ImageUploadField, Item, NoticeIcon, OverlayPanel, OverlayProvider, PanelHeader, PanelHeaderCloseButton, PanelHeaderMenu, PanelHeaderSwitchField, SelectField, Tab, Tabs, Text, TextField } from '../index';
|
11
11
|
import { FIGMA_LINKS } from '../utils/designUtils/figmaLinks.ts';
|
12
12
|
import UserImage from '../utils/devUtils/assets/UserImage.png';
|
13
13
|
import statuses from '../utils/devUtils/constants/statuses';
|
@@ -93,12 +93,46 @@ var data = {
|
|
93
93
|
}
|
94
94
|
};
|
95
95
|
var OverlayWrapper = function OverlayWrapper(_ref) {
|
96
|
-
var
|
96
|
+
var _context, _context2, _context3;
|
97
|
+
var children = _ref.children,
|
98
|
+
isEditPanel = _ref.isEditPanel;
|
97
99
|
var _useOverlayPanelState = useOverlayPanelState({
|
98
100
|
isDefaultOpen: true
|
99
101
|
}),
|
100
102
|
state = _useOverlayPanelState.state;
|
101
103
|
var triggerRef = useRef();
|
104
|
+
var personalInfo = data.personalInfo;
|
105
|
+
var fields = personalInfo.fields;
|
106
|
+
var renderBreadcrumbs = ___EmotionJSX(Breadcrumbs, {
|
107
|
+
icon: ChevronRightIcon
|
108
|
+
}, ___EmotionJSX(Item, {
|
109
|
+
"aria-label": personalInfo.label,
|
110
|
+
href: "https://www.pingidentity.com",
|
111
|
+
key: personalInfo.key,
|
112
|
+
variant: "buttons.link"
|
113
|
+
}, _concatInstanceProperty(_context = "".concat(fields[0].value, " ")).call(_context, fields[1].value)), ___EmotionJSX(Item, {
|
114
|
+
"aria-label": "Edit",
|
115
|
+
key: "editKey",
|
116
|
+
variant: "buttons.link"
|
117
|
+
}, "Edit"));
|
118
|
+
var image = {
|
119
|
+
src: UserImage,
|
120
|
+
alt: 'user image'
|
121
|
+
};
|
122
|
+
var panelHeaderProps = isEditPanel ? {
|
123
|
+
data: {
|
124
|
+
image: image
|
125
|
+
},
|
126
|
+
slots: {
|
127
|
+
rightOfData: renderBreadcrumbs
|
128
|
+
}
|
129
|
+
} : {
|
130
|
+
data: {
|
131
|
+
image: image,
|
132
|
+
text: _concatInstanceProperty(_context2 = "".concat(fields[0].value, " ")).call(_context2, fields[1].value),
|
133
|
+
subtext: _concatInstanceProperty(_context3 = "".concat(fields[0].value.toLowerCase())).call(_context3, fields[1].value.toLowerCase())
|
134
|
+
}
|
135
|
+
};
|
102
136
|
return ___EmotionJSX(OverlayProvider, null, ___EmotionJSX(Button, {
|
103
137
|
ref: triggerRef,
|
104
138
|
onPress: state.open
|
@@ -107,21 +141,18 @@ var OverlayWrapper = function OverlayWrapper(_ref) {
|
|
107
141
|
isTransitioning: state.isTransitioning,
|
108
142
|
size: "large",
|
109
143
|
p: "0"
|
110
|
-
}, ___EmotionJSX(PanelHeader, {
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
subtext: data.personalInfo.fields[1].value
|
118
|
-
}
|
119
|
-
}, ___EmotionJSX(PanelHeaderSwitchField, null), ___EmotionJSX(PanelHeaderMenu, null), ___EmotionJSX(PanelHeaderCloseButton, {
|
144
|
+
}, ___EmotionJSX(PanelHeader, panelHeaderProps, !isEditPanel && ___EmotionJSX(PanelHeaderSwitchField, null), !isEditPanel && ___EmotionJSX(PanelHeaderMenu, null, ___EmotionJSX(Item, {
|
145
|
+
key: "enable"
|
146
|
+
}, "Enable user"), ___EmotionJSX(Item, {
|
147
|
+
key: "disable"
|
148
|
+
}, "Disable user"), ___EmotionJSX(Item, {
|
149
|
+
key: "delete"
|
150
|
+
}, "Delete user")), ___EmotionJSX(PanelHeaderCloseButton, {
|
120
151
|
onPress: state.close
|
121
152
|
})), children));
|
122
153
|
};
|
123
154
|
export var DisplayPanel = function DisplayPanel() {
|
124
|
-
var
|
155
|
+
var _context4, _context5;
|
125
156
|
var renderProfileTab = ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Box, {
|
126
157
|
isRow: true,
|
127
158
|
gap: "md",
|
@@ -135,12 +166,12 @@ export var DisplayPanel = function DisplayPanel() {
|
|
135
166
|
isRow: true,
|
136
167
|
justifyContent: "space-between"
|
137
168
|
}, ___EmotionJSX(AccordionGroup, {
|
138
|
-
defaultExpandedKeys: _mapInstanceProperty(
|
169
|
+
defaultExpandedKeys: _mapInstanceProperty(_context4 = _Object$keys(data)).call(_context4, function (item) {
|
139
170
|
return data[item].key;
|
140
171
|
}),
|
141
172
|
labelHeadingTag: "h2"
|
142
|
-
}, _mapInstanceProperty(
|
143
|
-
var
|
173
|
+
}, _mapInstanceProperty(_context5 = _Object$keys(data)).call(_context5, function (item) {
|
174
|
+
var _context6;
|
144
175
|
return ___EmotionJSX(Item, {
|
145
176
|
"data-id": data[item].label,
|
146
177
|
key: data[item].key,
|
@@ -159,7 +190,7 @@ export var DisplayPanel = function DisplayPanel() {
|
|
159
190
|
}), data[item].badges && ___EmotionJSX(Box, {
|
160
191
|
isRow: true,
|
161
192
|
gap: "sm"
|
162
|
-
}, _mapInstanceProperty(
|
193
|
+
}, _mapInstanceProperty(_context6 = data[item].badges).call(_context6, function (badge) {
|
163
194
|
return ___EmotionJSX(Badge, {
|
164
195
|
label: badge,
|
165
196
|
variant: "defaultBadge",
|
@@ -349,8 +380,10 @@ var editData = {
|
|
349
380
|
}
|
350
381
|
};
|
351
382
|
export var EditPanel = function EditPanel() {
|
352
|
-
var
|
353
|
-
return ___EmotionJSX(OverlayWrapper,
|
383
|
+
var _context7, _context8, _context9;
|
384
|
+
return ___EmotionJSX(OverlayWrapper, {
|
385
|
+
isEditPanel: true
|
386
|
+
}, ___EmotionJSX(Box, {
|
354
387
|
p: "lg",
|
355
388
|
pb: "0"
|
356
389
|
}, ___EmotionJSX(Box, {
|
@@ -368,12 +401,12 @@ export var EditPanel = function EditPanel() {
|
|
368
401
|
}, ___EmotionJSX(Item, {
|
369
402
|
key: "population"
|
370
403
|
}, "Denver"))), ___EmotionJSX(AccordionGroup, {
|
371
|
-
defaultExpandedKeys: _concatInstanceProperty(
|
404
|
+
defaultExpandedKeys: _concatInstanceProperty(_context7 = []).call(_context7, _mapInstanceProperty(_context8 = _Object$keys(editData)).call(_context8, function (item) {
|
372
405
|
return editData[item].key;
|
373
406
|
}), ['preferencesKey', 'customAttributesKey', 'jsonAttributesKey']),
|
374
407
|
labelHeadingTag: "h2"
|
375
|
-
}, _mapInstanceProperty(
|
376
|
-
var
|
408
|
+
}, _mapInstanceProperty(_context9 = _Object$keys(editData)).call(_context9, function (item) {
|
409
|
+
var _context10;
|
377
410
|
return ___EmotionJSX(Item, {
|
378
411
|
"data-id": editData[item].label,
|
379
412
|
key: editData[item].key,
|
@@ -387,7 +420,7 @@ export var EditPanel = function EditPanel() {
|
|
387
420
|
previewHeight: 40,
|
388
421
|
previewWidth: 40,
|
389
422
|
previewImage: UserImage
|
390
|
-
}), _mapInstanceProperty(
|
423
|
+
}), _mapInstanceProperty(_context10 = editData[item].fields).call(_context10, function (_ref5) {
|
391
424
|
var label = _ref5.label,
|
392
425
|
value = _ref5.value,
|
393
426
|
slot = _ref5.slot;
|