@pingux/astro 2.42.0-alpha.1 → 2.42.0-alpha.2
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/TreeView.js +10 -5
- package/lib/cjs/components/TreeView/TreeView.stories.js +169 -3
- package/lib/cjs/components/TreeView/TreeView.test.js +130 -9
- package/lib/cjs/components/TreeView/TreeViewRow.js +5 -3
- package/lib/cjs/components/TreeView/TreeViewSection.js +32 -3
- package/lib/cjs/recipes/LinkedListView.stories.js +6 -2
- package/lib/cjs/recipes/PanelContent.stories.js +1 -1
- package/lib/components/TreeView/TreeView.js +10 -5
- package/lib/components/TreeView/TreeView.stories.js +161 -1
- package/lib/components/TreeView/TreeView.test.js +130 -9
- package/lib/components/TreeView/TreeViewRow.js +5 -3
- package/lib/components/TreeView/TreeViewSection.js +34 -5
- package/lib/recipes/LinkedListView.stories.js +7 -3
- package/lib/recipes/PanelContent.stories.js +1 -1
- package/package.json +1 -1
@@ -1,7 +1,7 @@
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
2
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
3
3
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
4
|
-
var _excluded = ["title", "mainIcon", "lastIcon", "item", "items", "isExpanded", "isDragging", "onKeyDown"];
|
4
|
+
var _excluded = ["title", "mainIcon", "lastIcon", "item", "items", "isExpanded", "hasChildren", "isDragging", "onKeyDown"];
|
5
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
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
7
|
import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
|
@@ -40,6 +40,7 @@ var TreeViewRow = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
40
40
|
item = props.item,
|
41
41
|
items = props.items,
|
42
42
|
isExpanded = props.isExpanded,
|
43
|
+
hasChildren = props.hasChildren,
|
43
44
|
isDragging = props.isDragging,
|
44
45
|
_onKeyDown = props.onKeyDown,
|
45
46
|
others = _objectWithoutProperties(props, _excluded);
|
@@ -181,7 +182,7 @@ var TreeViewRow = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
181
182
|
onKeyDown: function onKeyDown(e) {
|
182
183
|
_onKeyDown(e);
|
183
184
|
}
|
184
|
-
}), (items === null || items === void 0 ? void 0 : items.length) > 0 && ___EmotionJSX(IconButtonToggle, {
|
185
|
+
}), ((items === null || items === void 0 ? void 0 : items.length) > 0 || hasChildren) && ___EmotionJSX(IconButtonToggle, {
|
185
186
|
onToggle: pressIcon,
|
186
187
|
isToggled: isExpanded,
|
187
188
|
defaultIcon: MenuRight,
|
@@ -234,6 +235,7 @@ TreeViewRow.propTypes = {
|
|
234
235
|
key: PropTypes.string
|
235
236
|
}),
|
236
237
|
mainIcon: PropTypes.elementType,
|
237
|
-
lastIcon: PropTypes.elementType
|
238
|
+
lastIcon: PropTypes.elementType,
|
239
|
+
hasChildren: PropTypes.bool
|
238
240
|
};
|
239
241
|
export default TreeViewRow;
|
@@ -1,13 +1,16 @@
|
|
1
|
+
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
1
2
|
import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
|
2
3
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
3
4
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
5
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
4
6
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
5
7
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
6
|
-
import React, { forwardRef, useImperativeHandle, useRef } from 'react';
|
8
|
+
import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
7
9
|
import { useOption } from '@react-aria/listbox';
|
10
|
+
import { VisuallyHidden } from '@react-aria/visually-hidden';
|
8
11
|
import PropTypes from 'prop-types';
|
9
12
|
import { useTreeViewContext } from '../../context/TreeViewContext';
|
10
|
-
import { Box, TreeViewItem } from '../../index';
|
13
|
+
import { Box, Loader, TreeViewItem } from '../../index';
|
11
14
|
import InsertionIndicator from './InsertionIndicator';
|
12
15
|
import { SectionOrItemRender } from './TreeView';
|
13
16
|
import { sectionPressHandlers } from './TreeViewKeyboardDelegate';
|
@@ -94,6 +97,8 @@ var TreeViewSection = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
94
97
|
var item = props.item,
|
95
98
|
items = props.items,
|
96
99
|
title = props.title,
|
100
|
+
hasChildren = props.hasChildren,
|
101
|
+
loadingNodes = props.loadingNodes,
|
97
102
|
focusManager = props.focusManager,
|
98
103
|
onKeyDown = props.onKeyDown,
|
99
104
|
level = props.level,
|
@@ -101,6 +106,7 @@ var TreeViewSection = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
101
106
|
setSize = props.setSize;
|
102
107
|
var key = item.key;
|
103
108
|
var treeSectionRef = useRef();
|
109
|
+
|
104
110
|
/* istanbul ignore next */
|
105
111
|
useImperativeHandle(ref, function () {
|
106
112
|
return treeSectionRef.current;
|
@@ -120,6 +126,17 @@ var TreeViewSection = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
120
126
|
isDisabled = _useOption.isDisabled;
|
121
127
|
var isExpanded = state.expandedKeys.has(key);
|
122
128
|
var isDragging = dragState.isDragging(item.key);
|
129
|
+
var _useState = useState(),
|
130
|
+
_useState2 = _slicedToArray(_useState, 2),
|
131
|
+
loaderState = _useState2[0],
|
132
|
+
setLoaderState = _useState2[1];
|
133
|
+
useEffect(function () {
|
134
|
+
if (loadingNodes) {
|
135
|
+
_forEachInstanceProperty(loadingNodes).call(loadingNodes, function (loader) {
|
136
|
+
if (loader.node === title) setLoaderState(loader.loadingState);
|
137
|
+
});
|
138
|
+
}
|
139
|
+
}, [loadingNodes, title]);
|
123
140
|
var onKeyDownFunction = function onKeyDownFunction(e) {
|
124
141
|
onKeyDownSection(e, state, key, tree, isSelected, isExpanded, focusManager, flatKeyArray, refArray, pageLength, true);
|
125
142
|
if (onKeyDown) {
|
@@ -150,7 +167,8 @@ var TreeViewSection = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
150
167
|
items: items,
|
151
168
|
isDragging: isDragging,
|
152
169
|
isExpanded: isExpanded,
|
153
|
-
onKeyDown: onKeyDownFunction
|
170
|
+
onKeyDown: onKeyDownFunction,
|
171
|
+
hasChildren: hasChildren
|
154
172
|
}), isExpanded && ___EmotionJSX(Box, {
|
155
173
|
role: "rowgroup",
|
156
174
|
key: "".concat(item.key, " ul"),
|
@@ -160,13 +178,22 @@ var TreeViewSection = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
160
178
|
border: 'none'
|
161
179
|
}
|
162
180
|
}
|
163
|
-
},
|
181
|
+
}, ___EmotionJSX(VisuallyHidden, {
|
182
|
+
"aria-live": "polite"
|
183
|
+
}, loaderState === false && (isExpanded && items.length > 0 ? ' Loading successful' : 'Loading unsuccessful')), loaderState ? ___EmotionJSX(Loader, {
|
184
|
+
color: "active",
|
185
|
+
ml: "31px"
|
186
|
+
}) : _mapInstanceProperty(_context3 = _Array$from(items)).call(_context3, function (_item, _index) {
|
164
187
|
var _item$children;
|
165
|
-
return SectionOrItemRender(
|
188
|
+
return SectionOrItemRender(
|
189
|
+
// _item.value.items?.length > 0 || _item.value.items,
|
190
|
+
((_item$children = _item.children) === null || _item$children === void 0 ? void 0 : _item$children.length) > 0 || _item.value.items, ___EmotionJSX(TreeViewSection, {
|
166
191
|
item: _item,
|
167
192
|
items: _item.children,
|
168
193
|
title: _item.value.title,
|
169
194
|
key: _item.value.title,
|
195
|
+
hasChildren: _item.value.items && true,
|
196
|
+
loadingNodes: loadingNodes,
|
170
197
|
focusManager: focusManager,
|
171
198
|
level: level + 1,
|
172
199
|
position: _index,
|
@@ -195,6 +222,8 @@ TreeViewSection.propTypes = {
|
|
195
222
|
key: PropTypes.string
|
196
223
|
}),
|
197
224
|
title: PropTypes.string,
|
225
|
+
hasChildren: PropTypes.bool,
|
226
|
+
loadingNodes: PropTypes.arrayOf(PropTypes.shape({})),
|
198
227
|
focusManager: PropTypes.shape({}),
|
199
228
|
onKeyDown: PropTypes.func,
|
200
229
|
level: PropTypes.number,
|
@@ -5,8 +5,9 @@ import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/inst
|
|
5
5
|
import _findIndexInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find-index";
|
6
6
|
import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/splice";
|
7
7
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
8
|
-
import React, { useRef, useState } from 'react';
|
8
|
+
import React, { useMemo, useRef, useState } from 'react';
|
9
9
|
import DotsVerticalIcon from '@pingux/mdi-react/DotsVerticalIcon';
|
10
|
+
import { v4 as uuid } from 'uuid';
|
10
11
|
import useOverlappingMenuHoverState from '../hooks/useOverlappingMenuHoverState';
|
11
12
|
import { Badge, Box, Icon, IconButton, Item, ListItem, ListView, Menu, PopoverMenu, Separator, Text } from '../index';
|
12
13
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
@@ -223,14 +224,17 @@ export var Default = function Default(_ref) {
|
|
223
224
|
|
224
225
|
// the vector shield and key icon.
|
225
226
|
var ShieldIcon = function ShieldIcon(props) {
|
227
|
+
var id = useMemo(function () {
|
228
|
+
return uuid();
|
229
|
+
}, []);
|
226
230
|
return ___EmotionJSX("svg", _extends({
|
227
231
|
width: "19",
|
228
232
|
height: "23",
|
229
233
|
viewBox: "0 0 19 23",
|
230
234
|
xmlns: "http://www.w3.org/2000/svg",
|
231
|
-
"aria-labelledby": "shield-icon-title"
|
235
|
+
"aria-labelledby": "shield-icon-title-".concat(id)
|
232
236
|
}, props), ___EmotionJSX("title", {
|
233
|
-
id: "shield-icon-title"
|
237
|
+
id: "shield-icon-title-".concat(id)
|
234
238
|
}, "Shield Icon"), ___EmotionJSX("path", {
|
235
239
|
d: "M9.5 7.33342C9.77627 7.33342 10.0412 7.44316 10.2366 7.63851C10.4319 7.83386 10.5417 8.09881 10.5417 8.37508C10.5417 8.65135 10.4319 8.9163 10.2366 9.11165C10.0412 9.307 9.77627 9.41675 9.5 9.41675C9.22373 9.41675 8.95878 9.307 8.76343 9.11165C8.56808 8.9163 8.45833 8.65135 8.45833 8.37508C8.45833 8.09881 8.56808 7.83386 8.76343 7.63851C8.95878 7.44316 9.22373 7.33342 9.5 7.33342ZM18.875 10.4584C18.875 16.2397 14.875 21.6459 9.5 22.9584C4.125 21.6459 0.125 16.2397 0.125 10.4584V4.20842L9.5 0.041748L18.875 4.20842V10.4584ZM9.5 5.25008C8.6712 5.25008 7.87634 5.57932 7.29029 6.16537C6.70424 6.75142 6.375 7.54628 6.375 8.37508C6.375 9.73967 7.23958 10.8959 8.45833 11.323V17.7501H10.5417V15.6667H12.625V13.5834H10.5417V11.323C11.7604 10.8959 12.625 9.73967 12.625 8.37508C12.625 7.54628 12.2958 6.75142 11.7097 6.16537C11.1237 5.57932 10.3288 5.25008 9.5 5.25008Z"
|
236
240
|
}));
|
@@ -13,7 +13,7 @@ import UserImage from '../utils/devUtils/assets/UserImage.png';
|
|
13
13
|
import statuses from '../utils/devUtils/constants/statuses';
|
14
14
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
15
15
|
export default {
|
16
|
-
title: '
|
16
|
+
title: 'Recipes/Panel Content',
|
17
17
|
parameters: {
|
18
18
|
docs: {
|
19
19
|
source: {
|