@pingux/astro 2.41.0 → 2.42.0-alpha.0
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/Card/Card.d.ts +4 -0
- package/lib/cjs/components/Card/Card.js +10 -51
- package/lib/cjs/components/Card/Card.stories.d.ts +24 -0
- package/lib/cjs/components/Card/Card.stories.js +13 -12
- package/lib/cjs/components/Card/Card.styles.d.ts +44 -0
- package/lib/cjs/components/Card/cardAttributes.d.ts +1 -0
- package/lib/cjs/components/Card/cardAttributes.js +33 -0
- package/lib/cjs/components/Card/index.d.ts +1 -0
- 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/hooks/useField/useField.d.ts +1 -0
- package/lib/cjs/types/box.d.ts +2 -0
- package/lib/cjs/types/card.d.ts +5 -0
- package/lib/cjs/types/card.js +6 -0
- package/lib/cjs/types/index.d.ts +1 -0
- package/lib/cjs/types/index.js +21 -10
- package/lib/components/Card/Card.js +11 -52
- package/lib/components/Card/Card.stories.js +14 -12
- package/lib/components/Card/cardAttributes.js +25 -0
- 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/types/card.js +1 -0
- package/lib/types/index.js +1 -0
- package/package.json +1 -1
@@ -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,
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/lib/types/index.js
CHANGED