@pingux/astro 1.1.0-alpha.10 → 1.1.0-alpha.14

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/lib/cjs/components/CodeView/CodeView.js +165 -0
  3. package/lib/cjs/components/CodeView/CodeView.stories.js +93 -0
  4. package/lib/cjs/components/CodeView/CodeView.test.js +211 -0
  5. package/lib/cjs/components/CodeView/index.js +18 -0
  6. package/lib/cjs/components/CopyText/CopyText.js +34 -11
  7. package/lib/cjs/components/NavBar/NavBar.js +38 -0
  8. package/lib/cjs/components/NavBar/NavBar.stories.js +679 -0
  9. package/lib/cjs/components/NavBar/NavBar.test.js +116 -0
  10. package/lib/cjs/components/NavBar/index.js +18 -0
  11. package/lib/cjs/components/NavBarSection/NavBarItemBody.js +56 -0
  12. package/lib/cjs/components/NavBarSection/NavBarItemHeader.js +47 -0
  13. package/lib/cjs/components/NavBarSection/NavBarSection.js +82 -0
  14. package/lib/cjs/components/NavBarSection/index.js +18 -0
  15. package/lib/cjs/components/Separator/Separator.js +1 -1
  16. package/lib/cjs/components/TooltipTrigger/TooltipTrigger.js +10 -5
  17. package/lib/cjs/index.js +84 -30
  18. package/lib/cjs/styles/variants/accordion.js +32 -1
  19. package/lib/cjs/styles/variants/boxes.js +24 -1
  20. package/lib/cjs/styles/variants/buttons.js +29 -1
  21. package/lib/cjs/styles/variants/codeView.js +80 -0
  22. package/lib/cjs/styles/variants/link.js +1 -1
  23. package/lib/cjs/styles/variants/separator.js +46 -3
  24. package/lib/cjs/styles/variants/text.js +15 -0
  25. package/lib/cjs/styles/variants/variants.js +3 -0
  26. package/lib/components/CodeView/CodeView.js +130 -0
  27. package/lib/components/CodeView/CodeView.stories.js +67 -0
  28. package/lib/components/CodeView/CodeView.test.js +171 -0
  29. package/lib/components/CodeView/index.js +1 -0
  30. package/lib/components/CopyText/CopyText.js +35 -11
  31. package/lib/components/NavBar/NavBar.js +24 -0
  32. package/lib/components/NavBar/NavBar.stories.js +650 -0
  33. package/lib/components/NavBar/NavBar.test.js +92 -0
  34. package/lib/components/NavBar/index.js +1 -0
  35. package/lib/components/NavBarSection/NavBarItemBody.js +37 -0
  36. package/lib/components/NavBarSection/NavBarItemHeader.js +31 -0
  37. package/lib/components/NavBarSection/NavBarSection.js +65 -0
  38. package/lib/components/NavBarSection/index.js +1 -0
  39. package/lib/components/Separator/Separator.js +1 -1
  40. package/lib/components/TooltipTrigger/TooltipTrigger.js +10 -5
  41. package/lib/index.js +5 -0
  42. package/lib/styles/variants/accordion.js +32 -1
  43. package/lib/styles/variants/boxes.js +24 -1
  44. package/lib/styles/variants/buttons.js +29 -1
  45. package/lib/styles/variants/codeView.js +68 -0
  46. package/lib/styles/variants/link.js +1 -1
  47. package/lib/styles/variants/separator.js +33 -1
  48. package/lib/styles/variants/text.js +15 -0
  49. package/lib/styles/variants/variants.js +2 -0
  50. package/package.json +3 -1
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
+
5
+ var _react = _interopRequireDefault(require("react"));
6
+
7
+ var _GlobeIcon = _interopRequireDefault(require("mdi-react/GlobeIcon"));
8
+
9
+ var _ViewDashboardIcon = _interopRequireDefault(require("mdi-react/ViewDashboardIcon"));
10
+
11
+ var _AccountMultipleIcon = _interopRequireDefault(require("mdi-react/AccountMultipleIcon"));
12
+
13
+ var _TransitConnectionVariantIcon = _interopRequireDefault(require("mdi-react/TransitConnectionVariantIcon"));
14
+
15
+ var _EmoticonHappyOutlineIcon = _interopRequireDefault(require("mdi-react/EmoticonHappyOutlineIcon"));
16
+
17
+ var _FingerprintIcon = _interopRequireDefault(require("mdi-react/FingerprintIcon"));
18
+
19
+ var _ScaleBalanceIcon = _interopRequireDefault(require("mdi-react/ScaleBalanceIcon"));
20
+
21
+ var _VerifiedIcon = _interopRequireDefault(require("mdi-react/VerifiedIcon"));
22
+
23
+ var _NavBar = _interopRequireDefault(require("./NavBar"));
24
+
25
+ var _testAxe = _interopRequireDefault(require("../../utils/testUtils/testAxe"));
26
+
27
+ var _testWrapper = require("../../utils/testUtils/testWrapper");
28
+
29
+ var _index = require("../../index");
30
+
31
+ var _react2 = require("@emotion/react");
32
+
33
+ var data = [{
34
+ icon: _GlobeIcon["default"],
35
+ key: 'Overview',
36
+ heading: 'Overview',
37
+ children: ['Users', 'Group', 'Populations', 'Attributes', 'A roles title that is really really really really long']
38
+ }, {
39
+ icon: _ViewDashboardIcon["default"],
40
+ key: 'Dashboard',
41
+ heading: 'Dashboard',
42
+ children: ['Users', 'Group', 'Populations', 'Attributes', 'Roles']
43
+ }, {
44
+ icon: _AccountMultipleIcon["default"],
45
+ key: 'Identities',
46
+ heading: 'Identities',
47
+ children: ['Users', 'Group', 'Populations', 'Attributes', 'Roles']
48
+ }, {
49
+ icon: _TransitConnectionVariantIcon["default"],
50
+ key: 'Connections',
51
+ heading: 'Connections',
52
+ children: ['Users', 'Group', 'Populations', 'Attributes', 'Roles']
53
+ }, {
54
+ icon: _EmoticonHappyOutlineIcon["default"],
55
+ key: 'Experiences',
56
+ heading: 'Experiences',
57
+ children: ['Users', 'Group', 'Populations', 'Attributes', 'Roles']
58
+ }];
59
+ var secondData = [{
60
+ icon: _FingerprintIcon["default"],
61
+ key: 'MFA',
62
+ heading: 'MFA',
63
+ children: ['Users', {
64
+ subTitle: 'PingOne Services'
65
+ }, 'Group', 'Populations', 'Attributes', 'Roles']
66
+ }, {
67
+ icon: _ScaleBalanceIcon["default"],
68
+ key: 'Risk',
69
+ heading: 'Risk',
70
+ children: ['Users', 'Group', 'Populations', 'Attributes', 'Roles']
71
+ }, {
72
+ icon: _VerifiedIcon["default"],
73
+ key: 'Verify',
74
+ heading: 'Verify',
75
+ children: ['Users', 'Group', 'Populations', 'Attributes', 'Roles']
76
+ }];
77
+
78
+ var getComponent = function getComponent() {
79
+ var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
80
+ return (0, _testWrapper.render)((0, _react2.jsx)(_NavBar["default"], props, (0, _react2.jsx)(_index.Box, {
81
+ sx: {
82
+ height: '100%',
83
+ maxHeight: '100%',
84
+ overflowY: 'overlay !important'
85
+ }
86
+ }, (0, _react2.jsx)(_index.NavBarSection, {
87
+ items: data,
88
+ hasSeparator: true
89
+ }), (0, _react2.jsx)(_index.NavBarSection, {
90
+ items: secondData,
91
+ title: "test_title"
92
+ }))));
93
+ };
94
+
95
+ (0, _testAxe["default"])(getComponent);
96
+ test('should render basic nav with children', function () {
97
+ getComponent();
98
+
99
+ var nav = _testWrapper.screen.queryByRole('navigation');
100
+
101
+ expect(nav).toBeInTheDocument();
102
+ });
103
+ test('should render title for sections that have titles', function () {
104
+ getComponent();
105
+
106
+ var title = _testWrapper.screen.getByText('test_title');
107
+
108
+ expect(title).toBeInTheDocument();
109
+ });
110
+ test('should render title for itemBodies that have subTitles', function () {
111
+ getComponent();
112
+
113
+ var subTitle = _testWrapper.screen.getByText('PingOne Services');
114
+
115
+ expect(subTitle).toBeInTheDocument();
116
+ });
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
+
5
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
6
+
7
+ _Object$defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+
11
+ _Object$defineProperty(exports, "default", {
12
+ enumerable: true,
13
+ get: function get() {
14
+ return _NavBar["default"];
15
+ }
16
+ });
17
+
18
+ var _NavBar = _interopRequireDefault(require("./NavBar"));
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard");
4
+
5
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
6
+
7
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
8
+
9
+ _Object$defineProperty(exports, "__esModule", {
10
+ value: true
11
+ });
12
+
13
+ exports["default"] = void 0;
14
+
15
+ var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
16
+
17
+ var _react = _interopRequireWildcard(require("react"));
18
+
19
+ var _propTypes = _interopRequireDefault(require("prop-types"));
20
+
21
+ var _index = require("../../index");
22
+
23
+ var _react2 = require("@emotion/react");
24
+
25
+ var NavBarItemBody = function NavBarItemBody(props) {
26
+ var _context;
27
+
28
+ return (0, _react2.jsx)(_index.Box, {
29
+ sx: {
30
+ alignItems: 'flex-start',
31
+ mb: '15px'
32
+ }
33
+ }, (0, _map["default"])(_context = props.item.children).call(_context, function (child) {
34
+ return child.subTitle ? (0, _react2.jsx)(_react.Fragment, {
35
+ key: "fragment".concat(child.subTitle)
36
+ }, (0, _react2.jsx)(_index.Separator, {
37
+ variant: "separator.navBarSubtitleSeparator",
38
+ key: "separator".concat(child.subTitle)
39
+ }), (0, _react2.jsx)(_index.Text, {
40
+ key: "text".concat(child.subTitle),
41
+ variant: "text.navBarSubtitle",
42
+ sx: {
43
+ mb: '10px',
44
+ ml: '45px'
45
+ }
46
+ }, child.subTitle)) : child;
47
+ }));
48
+ };
49
+
50
+ NavBarItemBody.propTypes = {
51
+ item: _propTypes["default"].shape({
52
+ children: _propTypes["default"].arrayOf(_propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].object]))
53
+ })
54
+ };
55
+ var _default = NavBarItemBody;
56
+ exports["default"] = _default;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
+
5
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
6
+
7
+ _Object$defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+
11
+ exports["default"] = void 0;
12
+
13
+ var _react = _interopRequireDefault(require("react"));
14
+
15
+ var _propTypes = _interopRequireDefault(require("prop-types"));
16
+
17
+ var _index = require("../../index");
18
+
19
+ var _react2 = require("@emotion/react");
20
+
21
+ var NavBarItemHeader = function NavBarItemHeader(props) {
22
+ var item = props.item;
23
+ var icon = item.icon;
24
+ return (0, _react2.jsx)(_index.Box, {
25
+ variant: "boxes.navBarItemHeaderContainer",
26
+ isRow: true
27
+ }, icon && (0, _react2.jsx)(_index.Icon, {
28
+ icon: icon,
29
+ size: 20,
30
+ sx: {
31
+ mr: '10px',
32
+ color: 'white',
33
+ fill: 'white'
34
+ }
35
+ }), (0, _react2.jsx)(_index.Text, {
36
+ variant: "navBarHeaderText"
37
+ }, props.item.heading));
38
+ };
39
+
40
+ NavBarItemHeader.propTypes = {
41
+ item: _propTypes["default"].shape({
42
+ heading: _propTypes["default"].string,
43
+ icon: _propTypes["default"].elementType
44
+ })
45
+ };
46
+ var _default = NavBarItemHeader;
47
+ exports["default"] = _default;
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
+
5
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
6
+
7
+ _Object$defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+
11
+ exports["default"] = void 0;
12
+
13
+ var _react = _interopRequireDefault(require("react"));
14
+
15
+ var _propTypes = _interopRequireDefault(require("prop-types"));
16
+
17
+ var _index = require("../../index");
18
+
19
+ var _NavBarItemBody = _interopRequireDefault(require("./NavBarItemBody"));
20
+
21
+ var _NavBarItemHeader = _interopRequireDefault(require("./NavBarItemHeader"));
22
+
23
+ var _react2 = require("@emotion/react");
24
+
25
+ /**
26
+ * Composed component that creates an AccordionGrid group
27
+ * with title, and separator options.
28
+ *
29
+ */
30
+ var NavBarSection = function NavBarSection(props) {
31
+ var hasSeparator = props.hasSeparator,
32
+ title = props.title,
33
+ items = props.items;
34
+ return (0, _react2.jsx)(_react["default"].Fragment, null, title && (0, _react2.jsx)(_index.Text, {
35
+ variant: "text.navBarSubtitle",
36
+ sx: {
37
+ mt: '25px',
38
+ mb: '15px',
39
+ ml: '15px'
40
+ }
41
+ }, title), (0, _react2.jsx)(_index.AccordionGridGroup, {
42
+ items: items
43
+ }, function (item) {
44
+ return (0, _react2.jsx)(_index.Item, {
45
+ headerProps: {
46
+ variant: 'accordion.accordionGridHeaderNav'
47
+ },
48
+ textValue: item
49
+ }, (0, _react2.jsx)(_NavBarItemHeader["default"], {
50
+ item: item
51
+ }), (0, _react2.jsx)(_NavBarItemBody["default"], {
52
+ item: item
53
+ }));
54
+ }), hasSeparator && (0, _react2.jsx)(_index.Box, {
55
+ sx: {
56
+ pl: '15px',
57
+ pr: '15px',
58
+ mt: '25px'
59
+ }
60
+ }, (0, _react2.jsx)(_index.Separator, {
61
+ variant: "separator.navBarSeparator"
62
+ })));
63
+ };
64
+
65
+ NavBarSection.defaultProps = {
66
+ hasSeparator: false
67
+ };
68
+ NavBarSection.propTypes = {
69
+ /** If true, a separator will render at the end of the section */
70
+ hasSeparator: _propTypes["default"].bool,
71
+
72
+ /** If present, this string will render at the top of the section */
73
+ title: _propTypes["default"].string,
74
+
75
+ /**
76
+ * *For performance reasons, use this prop instead of Array.map when iteratively rendering Items*.
77
+ * For use with [dynamic collections](https://react-spectrum.adobe.com/react-stately/collections.html#dynamic-collections).
78
+ */
79
+ items: _propTypes["default"].arrayOf(_propTypes["default"].shape({}))
80
+ };
81
+ var _default = NavBarSection;
82
+ exports["default"] = _default;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
+
5
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
6
+
7
+ _Object$defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+
11
+ _Object$defineProperty(exports, "default", {
12
+ enumerable: true,
13
+ get: function get() {
14
+ return _NavBarSection["default"];
15
+ }
16
+ });
17
+
18
+ var _NavBarSection = _interopRequireDefault(require("./NavBarSection"));
@@ -51,7 +51,7 @@ var Separator = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
51
51
  return (0, _react2.jsx)(_Box["default"], (0, _extends2["default"])({
52
52
  ref: ref,
53
53
  className: classNames,
54
- variant: "separator"
54
+ variant: "separator.base"
55
55
  }, others, separatorProps));
56
56
  });
57
57
  Separator.propTypes = {
@@ -59,7 +59,8 @@ var TooltipTrigger = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
59
59
  className = props.className,
60
60
  isNotFlippable = props.isNotFlippable,
61
61
  isDarkMode = props.isDarkMode,
62
- hasNoArrow = props.hasNoArrow;
62
+ hasNoArrow = props.hasNoArrow,
63
+ targetRef = props.targetRef;
63
64
 
64
65
  var _React$Children$toArr = _react["default"].Children.toArray(children),
65
66
  _React$Children$toArr2 = (0, _slicedToArray2["default"])(_React$Children$toArr, 2),
@@ -69,23 +70,24 @@ var TooltipTrigger = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
69
70
  var state = (0, _tooltip2.useTooltipTriggerState)(props);
70
71
  var tooltipTriggerRef = (0, _react.useRef)();
71
72
  var overlayRef = (0, _react.useRef)();
73
+ var tooltipRef = targetRef || tooltipTriggerRef;
72
74
  (0, _hooks.usePropWarning)(props, 'disabled', 'isDisabled');
73
75
  /* istanbul ignore next */
74
76
 
75
77
  (0, _react.useImperativeHandle)(ref, function () {
76
- return tooltipTriggerRef.current;
78
+ return tooltipRef.current;
77
79
  });
78
80
 
79
81
  var _useTooltipTrigger = (0, _tooltip.useTooltipTrigger)({
80
82
  isDisabled: isDisabled,
81
83
  trigger: triggerAction
82
- }, state, tooltipTriggerRef),
84
+ }, state, tooltipRef),
83
85
  triggerProps = _useTooltipTrigger.triggerProps,
84
86
  tooltipProps = _useTooltipTrigger.tooltipProps;
85
87
 
86
88
  var _useOverlayPosition = (0, _overlays.useOverlayPosition)({
87
89
  placement: (0, _concat["default"])(_context = "".concat(direction, " ")).call(_context, align),
88
- targetRef: tooltipTriggerRef,
90
+ targetRef: tooltipRef,
89
91
  overlayRef: overlayRef,
90
92
  offset: offset,
91
93
  // Our API preference is for default false so we invert this since it should be default true
@@ -160,7 +162,10 @@ TooltipTrigger.propTypes = {
160
162
  placement: _propTypes["default"].string,
161
163
 
162
164
  /** By default, opens for both focus and hover. Can be made to open only for focus. */
163
- trigger: _propTypes["default"].string
165
+ trigger: _propTypes["default"].string,
166
+
167
+ /* The ref for the element which the overlay positions itself with respect to. */
168
+ targetRef: _propTypes["default"].shape({})
164
169
  };
165
170
  TooltipTrigger.defaultProps = {
166
171
  align: 'middle',