@pingux/astro 2.32.0-alpha.11 → 2.32.0-alpha.12
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 +14 -47
- package/lib/cjs/components/TreeView/TreeView.js +11 -99
- package/lib/cjs/components/TreeView/TreeView.stories.js +10 -23
- package/lib/cjs/components/TreeView/TreeView.styles.js +2 -22
- package/lib/cjs/components/TreeView/TreeView.test.js +11 -91
- package/lib/cjs/components/TreeView/TreeViewItem.js +14 -112
- package/lib/cjs/components/TreeView/TreeViewRow.js +5 -20
- package/lib/cjs/components/TreeView/TreeViewSection.js +16 -164
- package/lib/cjs/hooks/useImageUploadState/useImageUploadState.js +6 -9
- package/lib/cjs/hooks/useModalState/useModalState.js +9 -0
- package/lib/cjs/utils/testUtils/testWrapper.js +2 -3
- package/lib/components/ImageUploadField/ImageUploadField.test.js +14 -47
- package/lib/components/TreeView/TreeView.js +12 -100
- package/lib/components/TreeView/TreeView.stories.js +10 -23
- package/lib/components/TreeView/TreeView.styles.js +2 -22
- package/lib/components/TreeView/TreeView.test.js +12 -92
- package/lib/components/TreeView/TreeViewItem.js +14 -111
- package/lib/components/TreeView/TreeViewRow.js +5 -20
- package/lib/components/TreeView/TreeViewSection.js +16 -161
- package/lib/hooks/useImageUploadState/useImageUploadState.js +6 -9
- package/lib/hooks/useModalState/useModalState.js +10 -0
- package/lib/utils/testUtils/testWrapper.js +2 -3
- package/package.json +1 -1
- package/lib/cjs/components/TreeView/TreeViewKeyboardDelegate.js +0 -200
- package/lib/cjs/components/TreeView/TreeViewKeyboardDelegate.test.js +0 -511
- package/lib/cjs/components/TreeView/TreeViewWrapper.js +0 -40
- package/lib/cjs/hooks/useImageUploadState/index.d.ts +0 -1
- package/lib/cjs/hooks/useImageUploadState/useImageUploadState.d.ts +0 -28
- package/lib/cjs/hooks/useModalState/index.d.ts +0 -1
- package/lib/cjs/hooks/useModalState/useModalState.d.ts +0 -21
- package/lib/cjs/hooks/useModalState/useModalState.test.d.ts +0 -1
- package/lib/cjs/utils/testUtils/setupTests.d.ts +0 -4
- package/lib/cjs/utils/testUtils/testAxe.d.ts +0 -2
- package/lib/cjs/utils/testUtils/testTheme.d.ts +0 -21
- package/lib/cjs/utils/testUtils/testWrapper.d.ts +0 -5
- package/lib/components/TreeView/TreeViewKeyboardDelegate.js +0 -176
- package/lib/components/TreeView/TreeViewKeyboardDelegate.test.js +0 -496
- package/lib/components/TreeView/TreeViewWrapper.js +0 -31
@@ -1,40 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
4
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
5
|
-
_Object$defineProperty(exports, "__esModule", {
|
6
|
-
value: true
|
7
|
-
});
|
8
|
-
exports["default"] = void 0;
|
9
|
-
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
11
|
-
var _focus = require("@react-aria/focus");
|
12
|
-
var _react2 = require("@emotion/react");
|
13
|
-
var TreeViewWrapper = function TreeViewWrapper(props) {
|
14
|
-
var children = props.children;
|
15
|
-
var items = (0, _map["default"])(children).call(children, function (child) {
|
16
|
-
return {
|
17
|
-
item: child,
|
18
|
-
key: child.key
|
19
|
-
};
|
20
|
-
});
|
21
|
-
return (0, _react2.jsx)(_focus.FocusScope, {
|
22
|
-
restoreFocus: false,
|
23
|
-
contain: false
|
24
|
-
}, (0, _map["default"])(items).call(items, function (_ref) {
|
25
|
-
var item = _ref.item,
|
26
|
-
key = _ref.key;
|
27
|
-
return (0, _react2.jsx)(FocusableItem, {
|
28
|
-
key: key
|
29
|
-
}, item);
|
30
|
-
}));
|
31
|
-
};
|
32
|
-
var FocusableItem = function FocusableItem(props) {
|
33
|
-
var focusManager = (0, _focus.useFocusManager)();
|
34
|
-
var childWithFocusHandle = /*#__PURE__*/_react["default"].cloneElement(props.children, {
|
35
|
-
focusManager: focusManager
|
36
|
-
});
|
37
|
-
return childWithFocusHandle;
|
38
|
-
};
|
39
|
-
var _default = TreeViewWrapper;
|
40
|
-
exports["default"] = _default;
|
@@ -1 +0,0 @@
|
|
1
|
-
export { default as useImageUploadState } from './useImageUploadState';
|
@@ -1,28 +0,0 @@
|
|
1
|
-
import React, { RefObject } from 'react';
|
2
|
-
interface ImageUploadStateProps {
|
3
|
-
previewImage?: string;
|
4
|
-
defaultPreviewImage?: string | null;
|
5
|
-
fileTypes?: string[];
|
6
|
-
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
7
|
-
previewHeight?: string;
|
8
|
-
previewWidth?: string;
|
9
|
-
}
|
10
|
-
declare const useImageUploadState: (inputRef: RefObject<HTMLInputElement | null>, props?: ImageUploadStateProps) => {
|
11
|
-
defaultPreviewImage: string | null;
|
12
|
-
defaultPreviewNode: string | null | undefined;
|
13
|
-
fileName: string;
|
14
|
-
handleInputChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
15
|
-
handleLabelClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
16
|
-
handleOpenMenuChange: (isOpen: boolean) => void;
|
17
|
-
isImageType: boolean;
|
18
|
-
isMenuOpen: boolean;
|
19
|
-
pressPreviewButton: () => void;
|
20
|
-
previewImage: string | null;
|
21
|
-
removePreview: () => void;
|
22
|
-
showFileDialog: () => void | undefined;
|
23
|
-
widthHeightSx: {
|
24
|
-
height: string | undefined;
|
25
|
-
width: string | undefined;
|
26
|
-
};
|
27
|
-
};
|
28
|
-
export default useImageUploadState;
|
@@ -1 +0,0 @@
|
|
1
|
-
export { default } from './useModalState';
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import { OverlayTriggerState } from 'react-stately';
|
2
|
-
interface UseModalStateProps {
|
3
|
-
isDefaultOpen?: boolean;
|
4
|
-
isOpen?: boolean;
|
5
|
-
onOpenChange?: (isOpen: boolean) => void;
|
6
|
-
}
|
7
|
-
interface UseModalState {
|
8
|
-
/**
|
9
|
-
* Returns state-related data and functions for use with a Modal component.
|
10
|
-
* @param {Object} [props] Properties provided to the state
|
11
|
-
*
|
12
|
-
* `props.isDefaultOpen`: boolean - Whether the modal is open by default (uncontrolled).
|
13
|
-
* `props.isOpen`: boolean - Whether the modal is currently open (controlled).
|
14
|
-
* `props.onOpenChange`: boolean - Handler that is called when the open state changes.
|
15
|
-
*
|
16
|
-
* @returns {Object} `{ isOpen: Boolean, open: Function, close: Function, toggle: Function }`
|
17
|
-
*/
|
18
|
-
(props?: UseModalStateProps): OverlayTriggerState;
|
19
|
-
}
|
20
|
-
declare const useModalState: UseModalState;
|
21
|
-
export default useModalState;
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,21 +0,0 @@
|
|
1
|
-
declare const _default: {
|
2
|
-
fontWeights: {
|
3
|
-
0: number;
|
4
|
-
1: number;
|
5
|
-
};
|
6
|
-
fontSizes: {
|
7
|
-
md: string;
|
8
|
-
lg: string;
|
9
|
-
};
|
10
|
-
text: {
|
11
|
-
base: {
|
12
|
-
fontWeight: number;
|
13
|
-
fontSize: string;
|
14
|
-
};
|
15
|
-
title: {
|
16
|
-
fontWeight: number;
|
17
|
-
fontSize: string;
|
18
|
-
};
|
19
|
-
};
|
20
|
-
};
|
21
|
-
export default _default;
|
@@ -1,5 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { RenderOptions } from '@testing-library/react';
|
3
|
-
declare const customRender: (ui: React.ReactElement, options?: RenderOptions) => import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement>;
|
4
|
-
export * from '@testing-library/react';
|
5
|
-
export { customRender as render };
|
@@ -1,176 +0,0 @@
|
|
1
|
-
import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
|
2
|
-
import _findIndexInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find-index";
|
3
|
-
var focusPrevious = function focusPrevious(index, refArray, flatKeyList) {
|
4
|
-
if (index !== 0) {
|
5
|
-
var key = flatKeyList[index - 1].key;
|
6
|
-
var _refArray$find = _findInstanceProperty(refArray).call(refArray, function (item) {
|
7
|
-
return item.key === key;
|
8
|
-
}),
|
9
|
-
thisRef = _refArray$find.thisRef;
|
10
|
-
thisRef.current.focus();
|
11
|
-
}
|
12
|
-
};
|
13
|
-
var focusNext = function focusNext(index, refArray, flatKeyList) {
|
14
|
-
if (index !== flatKeyList.length - 1) {
|
15
|
-
var key = flatKeyList[index + 1].key;
|
16
|
-
var _refArray$find2 = _findInstanceProperty(refArray).call(refArray, function (item) {
|
17
|
-
return item.key === key;
|
18
|
-
}),
|
19
|
-
thisRef = _refArray$find2.thisRef;
|
20
|
-
thisRef.current.focus();
|
21
|
-
}
|
22
|
-
};
|
23
|
-
export var verifyIndex = function verifyIndex(thisIndex, interval, length) {
|
24
|
-
var newIndex = thisIndex + interval;
|
25
|
-
if (newIndex < 0) {
|
26
|
-
return 0;
|
27
|
-
}
|
28
|
-
if (newIndex >= length) {
|
29
|
-
return length - 1;
|
30
|
-
}
|
31
|
-
return newIndex;
|
32
|
-
};
|
33
|
-
export var onHomePress = function onHomePress(key, flatKeyArray, refArray) {
|
34
|
-
var _thisRef$current;
|
35
|
-
var firstKey = flatKeyArray[0];
|
36
|
-
if (firstKey.key === key) {
|
37
|
-
return;
|
38
|
-
}
|
39
|
-
var _refArray$find3 = _findInstanceProperty(refArray).call(refArray, function (_item) {
|
40
|
-
return _item.key === firstKey.key;
|
41
|
-
}),
|
42
|
-
thisRef = _refArray$find3.thisRef;
|
43
|
-
(_thisRef$current = thisRef.current) === null || _thisRef$current === void 0 ? void 0 : _thisRef$current.focus();
|
44
|
-
};
|
45
|
-
export var onEndPress = function onEndPress(key, flatKeyArray, refArray) {
|
46
|
-
var _thisRef$current2;
|
47
|
-
var lastKey = flatKeyArray[flatKeyArray.length - 1];
|
48
|
-
if (lastKey.key === key) {
|
49
|
-
return;
|
50
|
-
}
|
51
|
-
var _refArray$find4 = _findInstanceProperty(refArray).call(refArray, function (_item) {
|
52
|
-
return _item.key === lastKey.key;
|
53
|
-
}),
|
54
|
-
thisRef = _refArray$find4.thisRef;
|
55
|
-
(_thisRef$current2 = thisRef.current) === null || _thisRef$current2 === void 0 ? void 0 : _thisRef$current2.focus();
|
56
|
-
};
|
57
|
-
export var pageUpOrDown = function pageUpOrDown(key, flatKeyArray, refArray, pageLength) {
|
58
|
-
var _thisRef$current3;
|
59
|
-
var thisIndex = _findIndexInstanceProperty(flatKeyArray).call(flatKeyArray, function (item) {
|
60
|
-
return item.key === key;
|
61
|
-
});
|
62
|
-
var newIndex = verifyIndex(thisIndex, pageLength, flatKeyArray.length);
|
63
|
-
var foundKey = flatKeyArray[newIndex].key;
|
64
|
-
var _refArray$find5 = _findInstanceProperty(refArray).call(refArray, function (_item) {
|
65
|
-
return _item.key === foundKey;
|
66
|
-
}),
|
67
|
-
thisRef = _refArray$find5.thisRef;
|
68
|
-
(_thisRef$current3 = thisRef.current) === null || _thisRef$current3 === void 0 ? void 0 : _thisRef$current3.focus();
|
69
|
-
};
|
70
|
-
export var onEnterPress = function onEnterPress(e, state, key) {
|
71
|
-
state.toggleKey(key);
|
72
|
-
e.preventDefault();
|
73
|
-
e.stopPropagation();
|
74
|
-
};
|
75
|
-
export var onLeftPress = function onLeftPress(e, focusManager, state, key, isExpanded, refArray) {
|
76
|
-
var isEventTargetAKey = _findInstanceProperty(refArray).call(refArray, function (_item) {
|
77
|
-
return _item.thisRef.current === e.target;
|
78
|
-
});
|
79
|
-
if (isExpanded && isEventTargetAKey) {
|
80
|
-
state.toggleKey(key);
|
81
|
-
}
|
82
|
-
if (isExpanded && !isEventTargetAKey) {
|
83
|
-
focusManager.focusPrevious();
|
84
|
-
}
|
85
|
-
e.preventDefault();
|
86
|
-
e.stopPropagation();
|
87
|
-
};
|
88
|
-
export var onSpacePress = function onSpacePress(e, tree, key, isSelected) {
|
89
|
-
if (isSelected) {
|
90
|
-
tree.setSelectedKeys([]);
|
91
|
-
} else {
|
92
|
-
tree.setSelectedKeys([key]);
|
93
|
-
}
|
94
|
-
e.preventDefault();
|
95
|
-
e.stopPropagation();
|
96
|
-
};
|
97
|
-
export var onUpPress = function onUpPress(e, key, refArray, flatKeyList) {
|
98
|
-
var foundIndex = _findIndexInstanceProperty(flatKeyList).call(flatKeyList, function (item) {
|
99
|
-
return item.key === key;
|
100
|
-
});
|
101
|
-
focusPrevious(foundIndex, refArray, flatKeyList);
|
102
|
-
e.preventDefault();
|
103
|
-
e.stopPropagation();
|
104
|
-
};
|
105
|
-
export var onTabPress = function onTabPress(e, refArray, focusManager, isSection) {
|
106
|
-
var isEventTargetAKey = _findInstanceProperty(refArray).call(refArray, function (_item) {
|
107
|
-
return _item.thisRef.current === e.target;
|
108
|
-
});
|
109
|
-
if (isEventTargetAKey && isSection) {
|
110
|
-
focusManager.focusNext();
|
111
|
-
e.preventDefault();
|
112
|
-
e.stopPropagation();
|
113
|
-
}
|
114
|
-
};
|
115
|
-
export var onRightPress = function onRightPress(e, focusManager, state, key, isExpanded, refArray) {
|
116
|
-
if (!isExpanded) {
|
117
|
-
state.toggleKey(key);
|
118
|
-
return;
|
119
|
-
}
|
120
|
-
var isEventTargetAKey = _findInstanceProperty(refArray).call(refArray, function (_item) {
|
121
|
-
return _item.thisRef.current === e.target;
|
122
|
-
});
|
123
|
-
if (isExpanded && isEventTargetAKey) {
|
124
|
-
focusManager.focusNext();
|
125
|
-
}
|
126
|
-
e.preventDefault();
|
127
|
-
e.stopPropagation();
|
128
|
-
};
|
129
|
-
export var onDownPress = function onDownPress(e, key, refArray, flatKeyList) {
|
130
|
-
// find the key
|
131
|
-
var foundIndex = _findIndexInstanceProperty(flatKeyList).call(flatKeyList, function (item) {
|
132
|
-
return item.key === key;
|
133
|
-
});
|
134
|
-
focusNext(foundIndex, refArray, flatKeyList);
|
135
|
-
// check if first or last
|
136
|
-
e.preventDefault();
|
137
|
-
e.stopPropagation();
|
138
|
-
};
|
139
|
-
export var onRightLeftItemPress = function onRightLeftItemPress(e) {
|
140
|
-
e.preventDefault();
|
141
|
-
e.stopPropagation();
|
142
|
-
};
|
143
|
-
export var onPageUpPress = function onPageUpPress(e, key, flatKeyArray, refArray, pageLength) {
|
144
|
-
pageUpOrDown(key, flatKeyArray, refArray, -Math.abs(pageLength));
|
145
|
-
e.preventDefault();
|
146
|
-
e.stopPropagation();
|
147
|
-
};
|
148
|
-
export var onPageDownPress = function onPageDownPress(e, key, flatKeyArray, refArray, pageLength) {
|
149
|
-
pageUpOrDown(key, flatKeyArray, refArray, Math.abs(pageLength));
|
150
|
-
e.preventDefault();
|
151
|
-
e.stopPropagation();
|
152
|
-
};
|
153
|
-
export var sectionPressHandlers = {
|
154
|
-
onEnterPress: onEnterPress,
|
155
|
-
onSpacePress: onSpacePress,
|
156
|
-
onLeftPress: onLeftPress,
|
157
|
-
onRightPress: onRightPress,
|
158
|
-
onUpPress: onUpPress,
|
159
|
-
onDownPress: onDownPress,
|
160
|
-
onTabPress: onTabPress,
|
161
|
-
onPageUpPress: onPageUpPress,
|
162
|
-
onPageDownPress: onPageDownPress,
|
163
|
-
onHomePress: onHomePress,
|
164
|
-
onEndPress: onEndPress
|
165
|
-
};
|
166
|
-
export var itemPressHandlers = {
|
167
|
-
onSpacePress: onSpacePress,
|
168
|
-
onDownPress: onDownPress,
|
169
|
-
onUpPress: onUpPress,
|
170
|
-
onRightLeftItemPress: onRightLeftItemPress,
|
171
|
-
onTabPress: onTabPress,
|
172
|
-
onPageUpPress: onPageUpPress,
|
173
|
-
onPageDownPress: onPageDownPress,
|
174
|
-
onHomePress: onHomePress,
|
175
|
-
onEndPress: onEndPress
|
176
|
-
};
|