@pingux/astro 1.2.1 → 1.3.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/CHANGELOG.md +21 -0
- package/lib/cjs/components/AccordionGridGroup/AccordionGridGroup.js +8 -2
- package/lib/cjs/components/AccordionGridItem/AccordionGridItemBody.js +5 -2
- package/lib/cjs/components/AccordionGridItem/AccordionGridItemHeader.js +8 -3
- package/lib/cjs/components/ArrayField/ArrayField.js +213 -0
- package/lib/cjs/components/ArrayField/ArrayField.stories.js +223 -0
- package/lib/cjs/components/ArrayField/ArrayField.test.js +208 -0
- package/lib/cjs/components/ArrayField/ArrayFieldDeleteButton.js +61 -0
- package/lib/cjs/components/ArrayField/index.js +27 -0
- package/lib/cjs/components/CodeView/CodeView.js +3 -3
- package/lib/cjs/components/ListView/ListView.stories.js +3 -0
- package/lib/cjs/components/Loader/Loader.stories.js +3 -3
- package/lib/cjs/components/Modal/Modal.js +3 -0
- package/lib/cjs/components/Modal/Modal.stories.js +11 -66
- package/lib/cjs/components/NavBar/NavBar.js +30 -4
- package/lib/cjs/components/NavBar/NavBar.stories.js +70 -463
- package/lib/cjs/components/NavBar/NavBar.test.js +51 -1
- package/lib/cjs/components/NavBarSection/NavBarItem.js +137 -0
- package/lib/cjs/components/NavBarSection/NavBarItemButton.js +96 -0
- package/lib/cjs/components/NavBarSection/NavBarItemHeader.js +1 -1
- package/lib/cjs/components/NavBarSection/NavBarItemLink.js +98 -0
- package/lib/cjs/components/NavBarSection/NavBarSection.js +10 -8
- package/lib/cjs/components/NavBarSection/index.js +28 -1
- package/lib/cjs/components/SelectFieldBase/SelectFieldBase.js +8 -1
- package/lib/cjs/context/NavBarContext/index.js +20 -0
- package/lib/cjs/hooks/index.js +9 -0
- package/lib/cjs/hooks/useNavBarPress/index.js +18 -0
- package/lib/cjs/hooks/useNavBarPress/useNavBarPress.js +38 -0
- package/lib/cjs/hooks/useNavBarPress/useNavBarPress.test.js +42 -0
- package/lib/cjs/index.js +80 -58
- package/lib/cjs/styles/variants/accordion.js +39 -7
- package/lib/cjs/styles/variants/boxes.js +1 -24
- package/lib/cjs/styles/variants/buttons.js +7 -1
- package/lib/cjs/styles/variants/codeView.js +91 -0
- package/lib/cjs/styles/variants/navBar.js +68 -0
- package/lib/cjs/styles/variants/separator.js +2 -1
- package/lib/cjs/styles/variants/text.js +3 -1
- package/lib/cjs/styles/variants/variants.js +3 -0
- package/lib/components/AccordionGridGroup/AccordionGridGroup.js +7 -2
- package/lib/components/AccordionGridItem/AccordionGridItemBody.js +4 -2
- package/lib/components/AccordionGridItem/AccordionGridItemHeader.js +9 -4
- package/lib/components/ArrayField/ArrayField.js +179 -0
- package/lib/components/ArrayField/ArrayField.stories.js +196 -0
- package/lib/components/ArrayField/ArrayField.test.js +185 -0
- package/lib/components/ArrayField/ArrayFieldDeleteButton.js +43 -0
- package/lib/components/ArrayField/index.js +2 -0
- package/lib/components/CodeView/CodeView.js +2 -2
- package/lib/components/ListView/ListView.stories.js +3 -0
- package/lib/components/Loader/Loader.stories.js +1 -1
- package/lib/components/Modal/Modal.js +4 -1
- package/lib/components/Modal/Modal.stories.js +10 -59
- package/lib/components/NavBar/NavBar.js +25 -4
- package/lib/components/NavBar/NavBar.stories.js +71 -462
- package/lib/components/NavBar/NavBar.test.js +39 -2
- package/lib/components/NavBarSection/NavBarItem.js +111 -0
- package/lib/components/NavBarSection/NavBarItemButton.js +69 -0
- package/lib/components/NavBarSection/NavBarItemHeader.js +1 -1
- package/lib/components/NavBarSection/NavBarItemLink.js +71 -0
- package/lib/components/NavBarSection/NavBarSection.js +9 -8
- package/lib/components/NavBarSection/index.js +4 -1
- package/lib/components/SelectFieldBase/SelectFieldBase.js +8 -1
- package/lib/context/NavBarContext/index.js +5 -0
- package/lib/hooks/index.js +1 -0
- package/lib/hooks/useNavBarPress/index.js +1 -0
- package/lib/hooks/useNavBarPress/useNavBarPress.js +27 -0
- package/lib/hooks/useNavBarPress/useNavBarPress.test.js +36 -0
- package/lib/index.js +2 -0
- package/lib/styles/variants/accordion.js +26 -5
- package/lib/styles/variants/boxes.js +1 -24
- package/lib/styles/variants/buttons.js +7 -1
- package/lib/styles/variants/codeView.js +91 -0
- package/lib/styles/variants/navBar.js +46 -0
- package/lib/styles/variants/separator.js +2 -1
- package/lib/styles/variants/text.js +3 -1
- package/lib/styles/variants/variants.js +2 -0
- package/package.json +3 -1
- package/lib/cjs/recipes/ArrayField.stories.js +0 -169
- package/lib/recipes/ArrayField.stories.js +0 -134
@@ -1,4 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
import userEvent from '@testing-library/user-event';
|
2
3
|
import GlobeIcon from 'mdi-react/GlobeIcon';
|
3
4
|
import ViewDashboard from 'mdi-react/ViewDashboardIcon';
|
4
5
|
import AccountMultiple from 'mdi-react/AccountMultipleIcon';
|
@@ -10,13 +11,22 @@ import Verify from 'mdi-react/VerifiedIcon';
|
|
10
11
|
import NavBar from './NavBar';
|
11
12
|
import axeTest from '../../utils/testUtils/testAxe';
|
12
13
|
import { render, screen } from '../../utils/testUtils/testWrapper';
|
13
|
-
import { Box, NavBarSection } from '../../index';
|
14
|
+
import { Box, NavBarSection, NavBarItem, NavBarItemButton, NavBarItemLink } from '../../index';
|
14
15
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
15
16
|
var data = [{
|
16
17
|
icon: GlobeIcon,
|
17
18
|
key: 'Overview',
|
18
19
|
heading: 'Overview',
|
19
|
-
children: [
|
20
|
+
children: [___EmotionJSX(NavBarItemButton, {
|
21
|
+
key: "Credentials Button Users",
|
22
|
+
id: "Credentials Button Users",
|
23
|
+
"data-testid": "navItemButton"
|
24
|
+
}, "Users"), ___EmotionJSX(NavBarItemLink, {
|
25
|
+
key: "Experiences Link Roles",
|
26
|
+
id: "Experiences Link Roles",
|
27
|
+
href: "https://pingidentity.com/",
|
28
|
+
"data-testid": "navItemLink"
|
29
|
+
}, "Roles")]
|
20
30
|
}, {
|
21
31
|
icon: ViewDashboard,
|
22
32
|
key: 'Dashboard',
|
@@ -71,6 +81,12 @@ var getComponent = function getComponent() {
|
|
71
81
|
}), ___EmotionJSX(NavBarSection, {
|
72
82
|
items: secondData,
|
73
83
|
title: "test_title"
|
84
|
+
}), ___EmotionJSX(NavBarItem, {
|
85
|
+
id: "Overview",
|
86
|
+
key: "Overview",
|
87
|
+
text: "Overview",
|
88
|
+
icon: ViewDashboard,
|
89
|
+
"data-testid": "navItem"
|
74
90
|
}))));
|
75
91
|
};
|
76
92
|
|
@@ -89,4 +105,25 @@ test('should render title for itemBodies that have subTitles', function () {
|
|
89
105
|
getComponent();
|
90
106
|
var subTitle = screen.getByText('PingOne Services');
|
91
107
|
expect(subTitle).toBeInTheDocument();
|
108
|
+
});
|
109
|
+
test('should select NavIemLink', function () {
|
110
|
+
getComponent();
|
111
|
+
var link = screen.getByTestId('navItemLink');
|
112
|
+
expect(link).toBeInTheDocument();
|
113
|
+
userEvent.click(link);
|
114
|
+
expect(link).toHaveClass('is-selected');
|
115
|
+
});
|
116
|
+
test('should select NavIem', function () {
|
117
|
+
getComponent();
|
118
|
+
var item = screen.getByTestId('navItem');
|
119
|
+
expect(item).toBeInTheDocument();
|
120
|
+
userEvent.click(item);
|
121
|
+
expect(item).toHaveClass('is-selected');
|
122
|
+
});
|
123
|
+
test('should select NavIemButton', function () {
|
124
|
+
getComponent();
|
125
|
+
var button = screen.getByTestId('navItemButton');
|
126
|
+
expect(button).toBeInTheDocument();
|
127
|
+
userEvent.click(button);
|
128
|
+
expect(button).toHaveClass('is-selected');
|
92
129
|
});
|
@@ -0,0 +1,111 @@
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
2
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
3
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
4
|
+
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
5
|
+
import React, { useRef, forwardRef, useImperativeHandle } from 'react';
|
6
|
+
import PropTypes from 'prop-types';
|
7
|
+
import { useHover, usePress } from '@react-aria/interactions';
|
8
|
+
import { mergeProps } from '@react-aria/utils';
|
9
|
+
import { useFocusRing } from '@react-aria/focus';
|
10
|
+
import { Box, Icon, Text } from '../../index';
|
11
|
+
import { useStatusClasses, useNavBarPress } from '../../hooks';
|
12
|
+
import { useNavBarContext } from '../../context/NavBarContext';
|
13
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
14
|
+
var NavBarItem = /*#__PURE__*/forwardRef(function (props, ref) {
|
15
|
+
var _context, _context2;
|
16
|
+
|
17
|
+
var icon = props.icon,
|
18
|
+
text = props.text,
|
19
|
+
className = props.className,
|
20
|
+
key = props.id,
|
21
|
+
onPressCallback = props.onPress,
|
22
|
+
others = _objectWithoutProperties(props, ["icon", "text", "className", "id", "onPress"]);
|
23
|
+
|
24
|
+
var navItemRef = useRef();
|
25
|
+
/* istanbul ignore next */
|
26
|
+
|
27
|
+
useImperativeHandle(ref, function () {
|
28
|
+
return navItemRef.current;
|
29
|
+
});
|
30
|
+
|
31
|
+
var _useHover = useHover({}),
|
32
|
+
hoverProps = _useHover.hoverProps,
|
33
|
+
isHovered = _useHover.isHovered;
|
34
|
+
|
35
|
+
var _useFocusRing = useFocusRing({
|
36
|
+
within: true
|
37
|
+
}),
|
38
|
+
focusWithinProps = _useFocusRing.focusProps;
|
39
|
+
|
40
|
+
var _useFocusRing2 = useFocusRing(),
|
41
|
+
focusProps = _useFocusRing2.focusProps,
|
42
|
+
isFocusVisible = _useFocusRing2.isFocusVisible;
|
43
|
+
|
44
|
+
var state = useNavBarContext();
|
45
|
+
|
46
|
+
var isSelected = _includesInstanceProperty(_context = state.selectedKeys).call(_context, key);
|
47
|
+
|
48
|
+
var _useNavBarPress = useNavBarPress({
|
49
|
+
key: key,
|
50
|
+
onPressCallback: onPressCallback
|
51
|
+
}, state),
|
52
|
+
onNavPress = _useNavBarPress.onNavPress;
|
53
|
+
|
54
|
+
var _usePress = usePress({
|
55
|
+
ref: navItemRef,
|
56
|
+
onPress: onNavPress
|
57
|
+
}),
|
58
|
+
pressProps = _usePress.pressProps,
|
59
|
+
isPressed = _usePress.isPressed;
|
60
|
+
|
61
|
+
var mergedProps = mergeProps.apply(void 0, _concatInstanceProperty(_context2 = [pressProps, hoverProps, focusWithinProps, focusProps]).call(_context2, others));
|
62
|
+
|
63
|
+
var _useStatusClasses = useStatusClasses(className, {
|
64
|
+
isPressed: isPressed,
|
65
|
+
isHovered: isHovered,
|
66
|
+
isSelected: isSelected,
|
67
|
+
isFocused: isFocusVisible
|
68
|
+
}),
|
69
|
+
classNames = _useStatusClasses.classNames;
|
70
|
+
|
71
|
+
return ___EmotionJSX(Box, _extends({
|
72
|
+
id: key,
|
73
|
+
variant: "accordion.accordionGridNavItem",
|
74
|
+
isRow: true,
|
75
|
+
className: classNames,
|
76
|
+
ref: navItemRef
|
77
|
+
}, mergedProps, {
|
78
|
+
sx: {
|
79
|
+
maxHeight: '30px'
|
80
|
+
}
|
81
|
+
}), ___EmotionJSX(Box, {
|
82
|
+
isRow: true,
|
83
|
+
sx: {
|
84
|
+
alignItems: 'center'
|
85
|
+
}
|
86
|
+
}, icon && ___EmotionJSX(Icon, {
|
87
|
+
icon: icon,
|
88
|
+
size: 20,
|
89
|
+
sx: {
|
90
|
+
mr: '10px',
|
91
|
+
color: 'white',
|
92
|
+
fill: 'white'
|
93
|
+
}
|
94
|
+
}), ___EmotionJSX(Text, {
|
95
|
+
variant: "navBarHeaderText"
|
96
|
+
}, text)));
|
97
|
+
});
|
98
|
+
NavBarItem.propTypes = {
|
99
|
+
/** Handler that is called when the press is released over the target. */
|
100
|
+
onPress: PropTypes.func,
|
101
|
+
|
102
|
+
/** The icon to render in between each node. */
|
103
|
+
icon: PropTypes.elementType,
|
104
|
+
|
105
|
+
/** The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id). */
|
106
|
+
id: PropTypes.string,
|
107
|
+
|
108
|
+
/** Text that will render within the component */
|
109
|
+
text: PropTypes.string
|
110
|
+
};
|
111
|
+
export default NavBarItem;
|
@@ -0,0 +1,69 @@
|
|
1
|
+
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
2
|
+
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
3
|
+
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
4
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
5
|
+
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
6
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
7
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
8
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
9
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
10
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
11
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
12
|
+
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
13
|
+
|
14
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (enumerableOnly) symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
15
|
+
|
16
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context2; _forEachInstanceProperty(_context2 = ownKeys(Object(source), true)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context3; _forEachInstanceProperty(_context3 = ownKeys(Object(source))).call(_context3, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
17
|
+
|
18
|
+
import React from 'react';
|
19
|
+
import PropTypes from 'prop-types';
|
20
|
+
import { useNavBarContext } from '../../context/NavBarContext';
|
21
|
+
import { useStatusClasses, useNavBarPress } from '../../hooks';
|
22
|
+
import { Button } from '../../index';
|
23
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
24
|
+
|
25
|
+
var NavBarItemButton = function NavBarItemButton(props) {
|
26
|
+
var _context;
|
27
|
+
|
28
|
+
var className = props.className,
|
29
|
+
key = props.id,
|
30
|
+
onPressCallback = props.onPress,
|
31
|
+
sx = props.sx,
|
32
|
+
others = _objectWithoutProperties(props, ["className", "id", "onPress", "sx"]);
|
33
|
+
|
34
|
+
var state = useNavBarContext();
|
35
|
+
|
36
|
+
var isSelected = _includesInstanceProperty(_context = state.selectedKeys).call(_context, key);
|
37
|
+
|
38
|
+
var _useNavBarPress = useNavBarPress({
|
39
|
+
key: key,
|
40
|
+
onPressCallback: onPressCallback
|
41
|
+
}, state),
|
42
|
+
onNavPress = _useNavBarPress.onNavPress;
|
43
|
+
|
44
|
+
var _useStatusClasses = useStatusClasses(className, {
|
45
|
+
isSelected: isSelected
|
46
|
+
}),
|
47
|
+
classNames = _useStatusClasses.classNames;
|
48
|
+
|
49
|
+
return ___EmotionJSX(Button, _extends({
|
50
|
+
id: key,
|
51
|
+
variant: "navItemButton",
|
52
|
+
onPress: onNavPress,
|
53
|
+
className: classNames
|
54
|
+
}, others, {
|
55
|
+
sx: _objectSpread({
|
56
|
+
paddingLeft: '45px',
|
57
|
+
paddingRight: '45px'
|
58
|
+
}, sx)
|
59
|
+
}));
|
60
|
+
};
|
61
|
+
|
62
|
+
NavBarItemButton.propTypes = {
|
63
|
+
/** Handler that is called when the press is released over the target. */
|
64
|
+
onPress: PropTypes.func,
|
65
|
+
|
66
|
+
/** The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id). */
|
67
|
+
id: PropTypes.string.isRequired
|
68
|
+
};
|
69
|
+
export default NavBarItemButton;
|
@@ -7,7 +7,7 @@ var NavBarItemHeader = function NavBarItemHeader(props) {
|
|
7
7
|
var item = props.item;
|
8
8
|
var icon = item.icon;
|
9
9
|
return ___EmotionJSX(Box, {
|
10
|
-
variant: "
|
10
|
+
variant: "navBar.itemHeaderContainer",
|
11
11
|
isRow: true
|
12
12
|
}, icon && ___EmotionJSX(Icon, {
|
13
13
|
icon: icon,
|
@@ -0,0 +1,71 @@
|
|
1
|
+
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
2
|
+
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
3
|
+
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
4
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
5
|
+
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
6
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
7
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
8
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
9
|
+
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
10
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
11
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
12
|
+
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
13
|
+
|
14
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (enumerableOnly) symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
15
|
+
|
16
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context2; _forEachInstanceProperty(_context2 = ownKeys(Object(source), true)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context3; _forEachInstanceProperty(_context3 = ownKeys(Object(source))).call(_context3, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
17
|
+
|
18
|
+
import React from 'react';
|
19
|
+
import PropTypes from 'prop-types';
|
20
|
+
import { Link } from '../../index';
|
21
|
+
import { useNavBarContext } from '../../context/NavBarContext';
|
22
|
+
import { useStatusClasses, useNavBarPress } from '../../hooks';
|
23
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
24
|
+
|
25
|
+
var NavBarItemLink = function NavBarItemLink(props) {
|
26
|
+
var _context;
|
27
|
+
|
28
|
+
var className = props.className,
|
29
|
+
key = props.id,
|
30
|
+
onPressCallback = props.onPress,
|
31
|
+
others = _objectWithoutProperties(props, ["className", "id", "onPress"]);
|
32
|
+
|
33
|
+
var state = useNavBarContext();
|
34
|
+
|
35
|
+
var isSelected = _includesInstanceProperty(_context = state.selectedKeys).call(_context, key);
|
36
|
+
|
37
|
+
var _useNavBarPress = useNavBarPress({
|
38
|
+
key: key,
|
39
|
+
onPressCallback: onPressCallback
|
40
|
+
}, state),
|
41
|
+
onNavPress = _useNavBarPress.onNavPress;
|
42
|
+
|
43
|
+
var _useStatusClasses = useStatusClasses(className, {
|
44
|
+
isSelected: isSelected
|
45
|
+
}),
|
46
|
+
classNames = _useStatusClasses.classNames;
|
47
|
+
|
48
|
+
return ___EmotionJSX(Link, _extends({
|
49
|
+
id: key,
|
50
|
+
variant: "buttons.navItemButton",
|
51
|
+
className: classNames,
|
52
|
+
onPress: onNavPress
|
53
|
+
}, others, {
|
54
|
+
sx: _objectSpread({
|
55
|
+
paddingLeft: '45px',
|
56
|
+
paddingRight: '45px'
|
57
|
+
}, props.sx)
|
58
|
+
}));
|
59
|
+
};
|
60
|
+
|
61
|
+
NavBarItemLink.propTypes = {
|
62
|
+
/** Specifies the location of the URL */
|
63
|
+
href: PropTypes.string,
|
64
|
+
|
65
|
+
/** Handler that is called when the press is released over the target. */
|
66
|
+
onPress: PropTypes.func,
|
67
|
+
|
68
|
+
/** The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id). */
|
69
|
+
id: PropTypes.string.isRequired
|
70
|
+
};
|
71
|
+
export default NavBarItemLink;
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
1
2
|
import React from 'react';
|
2
3
|
import PropTypes from 'prop-types';
|
3
4
|
import { Separator, AccordionGridGroup, Text, Item, Box } from '../../index';
|
@@ -16,19 +17,19 @@ var NavBarSection = function NavBarSection(props) {
|
|
16
17
|
title = props.title,
|
17
18
|
items = props.items;
|
18
19
|
return ___EmotionJSX(React.Fragment, null, title && ___EmotionJSX(Text, {
|
19
|
-
variant: "text.navBarSubtitle"
|
20
|
-
sx: {
|
21
|
-
mt: '25px',
|
22
|
-
mb: '15px',
|
23
|
-
ml: '15px'
|
24
|
-
}
|
20
|
+
variant: "text.navBarSubtitle"
|
25
21
|
}, title), ___EmotionJSX(AccordionGridGroup, {
|
26
|
-
items: items
|
22
|
+
items: _filterInstanceProperty(items).call(items, function (i) {
|
23
|
+
return i.children;
|
24
|
+
})
|
27
25
|
}, function (item) {
|
28
26
|
return ___EmotionJSX(Item, {
|
29
27
|
headerProps: {
|
30
28
|
variant: 'accordion.accordionGridHeaderNav'
|
31
29
|
},
|
30
|
+
bodyProps: {
|
31
|
+
variant: 'navBar.sectionBody'
|
32
|
+
},
|
32
33
|
textValue: item
|
33
34
|
}, ___EmotionJSX(NavBarItemHeader, {
|
34
35
|
item: item
|
@@ -39,7 +40,7 @@ var NavBarSection = function NavBarSection(props) {
|
|
39
40
|
sx: {
|
40
41
|
pl: '15px',
|
41
42
|
pr: '15px',
|
42
|
-
|
43
|
+
my: '10px'
|
43
44
|
}
|
44
45
|
}, ___EmotionJSX(Separator, {
|
45
46
|
variant: "separator.navBarSeparator"
|
@@ -1 +1,4 @@
|
|
1
|
-
export { default } from './NavBarSection';
|
1
|
+
export { default } from './NavBarSection';
|
2
|
+
export { default as NavBarItemButton } from './NavBarItemButton';
|
3
|
+
export { default as NavBarItemLink } from './NavBarItemLink';
|
4
|
+
export { default as NavBarItem } from './NavBarItem';
|
@@ -43,6 +43,7 @@ var SelectFieldBase = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
43
43
|
name = props.name,
|
44
44
|
placeholder = props.placeholder,
|
45
45
|
status = props.status,
|
46
|
+
slots = props.slots,
|
46
47
|
columnStyleProps = props.columnStyleProps,
|
47
48
|
fieldContainerProps = props.fieldContainerProps,
|
48
49
|
fieldControlProps = props.fieldControlProps,
|
@@ -78,7 +79,7 @@ var SelectFieldBase = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
78
79
|
sx: state.isOpen ? {
|
79
80
|
transform: 'rotate(180deg)'
|
80
81
|
} : null
|
81
|
-
}))));
|
82
|
+
}))), slots === null || slots === void 0 ? void 0 : slots.inContainer);
|
82
83
|
|
83
84
|
return ___EmotionJSX(Box, _extends({
|
84
85
|
ref: ref,
|
@@ -146,6 +147,12 @@ SelectFieldBase.propTypes = {
|
|
146
147
|
})
|
147
148
|
}),
|
148
149
|
|
150
|
+
/** Provides a way to insert markup in specified places. */
|
151
|
+
slots: PropTypes.shape({
|
152
|
+
/** The given node will be inserted into the field container. */
|
153
|
+
inContainer: PropTypes.node
|
154
|
+
}),
|
155
|
+
|
149
156
|
/** Control for interaction with SelectField */
|
150
157
|
trigger: PropTypes.node,
|
151
158
|
|
package/lib/hooks/index.js
CHANGED
@@ -6,6 +6,7 @@ export { default as useLabelHeight } from './useLabelHeight';
|
|
6
6
|
export { default as useModalState } from './useModalState';
|
7
7
|
export { default as useOverlayPanelState } from './useOverlayPanelState';
|
8
8
|
export { default as usePropWarning } from './usePropWarning';
|
9
|
+
export { default as useNavBarPress } from './useNavBarPress';
|
9
10
|
export { default as useRockerButton } from './useRockerButton';
|
10
11
|
export { default as useSelectField } from './useSelectField';
|
11
12
|
export { default as useStatusClasses } from './useStatusClasses';
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './useNavBarPress';
|
@@ -0,0 +1,27 @@
|
|
1
|
+
/**
|
2
|
+
* A custom hook that will call an onPressCallback function, if the function is provided.
|
3
|
+
* @param {Object} params The accepted parameters object
|
4
|
+
* @param {string} props.key The unique identifier that is assigned to the element being pressed
|
5
|
+
* @param {Object} state The state object tracking selected keys
|
6
|
+
* @param {function} state.setSelectedKeys The function that sets the selected keys
|
7
|
+
* @callback props.onPressCallback The callback that will be called only if provided
|
8
|
+
*/
|
9
|
+
var useNavBarPress = function useNavBarPress(_ref, state) {
|
10
|
+
var key = _ref.key,
|
11
|
+
onPressCallback = _ref.onPressCallback;
|
12
|
+
var setSelectedKeys = state.setSelectedKeys;
|
13
|
+
|
14
|
+
var onNavPress = function onNavPress() {
|
15
|
+
setSelectedKeys(key);
|
16
|
+
|
17
|
+
if (onPressCallback) {
|
18
|
+
onPressCallback();
|
19
|
+
}
|
20
|
+
};
|
21
|
+
|
22
|
+
return {
|
23
|
+
onNavPress: onNavPress
|
24
|
+
};
|
25
|
+
};
|
26
|
+
|
27
|
+
export default useNavBarPress;
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { renderHook } from '@testing-library/react-hooks';
|
2
|
+
import useNavBarPress from './';
|
3
|
+
var key = 'testKey';
|
4
|
+
test('using the onPress prop works as a callback', function () {
|
5
|
+
var onPress = jest.fn();
|
6
|
+
var setSelectedKeys = jest.fn();
|
7
|
+
|
8
|
+
var _renderHook = renderHook(function () {
|
9
|
+
return useNavBarPress({
|
10
|
+
key: key,
|
11
|
+
onPressCallback: onPress
|
12
|
+
}, {
|
13
|
+
setSelectedKeys: setSelectedKeys
|
14
|
+
});
|
15
|
+
}),
|
16
|
+
result = _renderHook.result;
|
17
|
+
|
18
|
+
result.current.onNavPress();
|
19
|
+
expect(onPress).toHaveBeenCalled();
|
20
|
+
});
|
21
|
+
test('if no onPress prop there is no callback', function () {
|
22
|
+
var onPress = jest.fn();
|
23
|
+
var setSelectedKeys = jest.fn();
|
24
|
+
|
25
|
+
var _renderHook2 = renderHook(function () {
|
26
|
+
return useNavBarPress({
|
27
|
+
key: key
|
28
|
+
}, {
|
29
|
+
setSelectedKeys: setSelectedKeys
|
30
|
+
});
|
31
|
+
}),
|
32
|
+
result = _renderHook2.result;
|
33
|
+
|
34
|
+
result.current.onNavPress();
|
35
|
+
expect(onPress).not.toHaveBeenCalled();
|
36
|
+
});
|
package/lib/index.js
CHANGED
@@ -11,6 +11,8 @@ export { default as AccordionItem } from './components/AccordionItem';
|
|
11
11
|
export * from './components/AccordionItem';
|
12
12
|
export { default as AccordionGridItem } from './components/AccordionGridItem';
|
13
13
|
export * from './components/AccordionGridItem';
|
14
|
+
export { default as ArrayField } from './components/ArrayField';
|
15
|
+
export * from './components/ArrayField';
|
14
16
|
export { default as Avatar } from './components/Avatar';
|
15
17
|
export * from './components/Avatar';
|
16
18
|
export { default as Box } from './components/Box';
|
@@ -1,3 +1,17 @@
|
|
1
|
+
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
2
|
+
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
3
|
+
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
4
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
5
|
+
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
6
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
7
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
8
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
9
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
10
|
+
|
11
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (enumerableOnly) symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
12
|
+
|
13
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty(_context = ownKeys(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context2; _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
14
|
+
|
1
15
|
var accordionTitle = {
|
2
16
|
display: 'inline-block !important',
|
3
17
|
overflowWrap: 'break-word',
|
@@ -71,7 +85,6 @@ var accordionGridHeaderNav = {
|
|
71
85
|
flexGrow: 1,
|
72
86
|
fontWeight: 0,
|
73
87
|
fontSize: '16px',
|
74
|
-
mt: '5px',
|
75
88
|
'&.is-focused': {
|
76
89
|
outline: 'none',
|
77
90
|
boxShadow: 'focus',
|
@@ -79,13 +92,20 @@ var accordionGridHeaderNav = {
|
|
79
92
|
MozBoxShadow: 'focus'
|
80
93
|
},
|
81
94
|
'&.is-hovered': {
|
82
|
-
backgroundColor: 'accent.10'
|
83
|
-
boxShadow: 'inset 2px 0 0 0 white'
|
95
|
+
backgroundColor: 'accent.10'
|
84
96
|
},
|
85
97
|
'&.is-pressed': {
|
86
|
-
backgroundColor: 'accent.
|
98
|
+
backgroundColor: 'accent.5'
|
87
99
|
}
|
88
100
|
};
|
101
|
+
|
102
|
+
var accordionGridNavItem = _objectSpread(_objectSpread({}, accordionGridHeaderNav), {}, {
|
103
|
+
'&.is-selected': {
|
104
|
+
backgroundColor: 'accent.5',
|
105
|
+
boxShadow: 'inset 2px 0 0 0 white'
|
106
|
+
}
|
107
|
+
});
|
108
|
+
|
89
109
|
var accordionGridBody = {
|
90
110
|
display: 'none !important',
|
91
111
|
pl: 'sm',
|
@@ -100,5 +120,6 @@ export default {
|
|
100
120
|
accordionTitle: accordionTitle,
|
101
121
|
accordion: accordion,
|
102
122
|
accordionBody: accordionBody,
|
103
|
-
accordionGridHeaderNav: accordionGridHeaderNav
|
123
|
+
accordionGridHeaderNav: accordionGridHeaderNav,
|
124
|
+
accordionGridNavItem: accordionGridNavItem
|
104
125
|
};
|
@@ -197,26 +197,6 @@ var expandableRow = {
|
|
197
197
|
}
|
198
198
|
}
|
199
199
|
};
|
200
|
-
var navBar = {
|
201
|
-
height: '100%',
|
202
|
-
width: '230px',
|
203
|
-
position: 'absolute',
|
204
|
-
zIndex: '1',
|
205
|
-
top: '0',
|
206
|
-
left: '0',
|
207
|
-
backgroundColor: 'accent.20',
|
208
|
-
overflowY: 'hidden'
|
209
|
-
};
|
210
|
-
var navBarSectionContainer = {
|
211
|
-
height: '100%',
|
212
|
-
maxHeight: '100%',
|
213
|
-
overflowY: 'overlay !important'
|
214
|
-
};
|
215
|
-
var navBarItemHeaderContainer = {
|
216
|
-
flexGrow: 1,
|
217
|
-
alignItems: 'center',
|
218
|
-
maxWidth: '180px'
|
219
|
-
};
|
220
200
|
var datePicker = {
|
221
201
|
'.react-calendar': {
|
222
202
|
width: 280,
|
@@ -312,8 +292,5 @@ export default {
|
|
312
292
|
radioContainer: radioContainer,
|
313
293
|
scrollbox: scrollbox,
|
314
294
|
topShadowScrollbox: topShadowScrollbox,
|
315
|
-
bottomShadowScrollbox: bottomShadowScrollbox
|
316
|
-
navBar: navBar,
|
317
|
-
navBarSectionContainer: navBarSectionContainer,
|
318
|
-
navBarItemHeaderContainer: navBarItemHeaderContainer
|
295
|
+
bottomShadowScrollbox: bottomShadowScrollbox
|
319
296
|
};
|
@@ -75,8 +75,14 @@ var navItemButton = {
|
|
75
75
|
wordBreak: 'break-word',
|
76
76
|
'&.is-focused': _objectSpread({}, defaultFocus),
|
77
77
|
'&.is-hovered': {
|
78
|
-
bg: 'accent.10'
|
78
|
+
bg: 'accent.10'
|
79
|
+
},
|
80
|
+
'&.is-selected': {
|
81
|
+
bg: 'accent.5',
|
79
82
|
boxShadow: 'inset 2px 0 0 0 white'
|
83
|
+
},
|
84
|
+
'&.is-pressed': {
|
85
|
+
bg: 'accent.5'
|
80
86
|
}
|
81
87
|
};
|
82
88
|
var iconButton = {
|