@pingux/astro 1.2.1 → 1.3.2-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.
Files changed (118) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/lib/cjs/components/AccordionGridGroup/AccordionGridGroup.js +8 -2
  3. package/lib/cjs/components/AccordionGridItem/AccordionGridItemBody.js +5 -2
  4. package/lib/cjs/components/AccordionGridItem/AccordionGridItemHeader.js +8 -3
  5. package/lib/cjs/components/ArrayField/ArrayField.js +213 -0
  6. package/lib/cjs/components/ArrayField/ArrayField.stories.js +223 -0
  7. package/lib/cjs/components/ArrayField/ArrayField.test.js +208 -0
  8. package/lib/cjs/components/ArrayField/ArrayFieldDeleteButton.js +61 -0
  9. package/lib/cjs/components/ArrayField/index.js +27 -0
  10. package/lib/cjs/components/CheckboxField/CheckboxField.js +4 -1
  11. package/lib/cjs/components/CodeView/CodeView.js +3 -3
  12. package/lib/cjs/components/Input/Input.js +3 -11
  13. package/lib/cjs/components/Input/Input.test.js +14 -2
  14. package/lib/cjs/components/ListView/ListView.stories.js +3 -0
  15. package/lib/cjs/components/Loader/Loader.stories.js +3 -3
  16. package/lib/cjs/components/Modal/Modal.js +3 -0
  17. package/lib/cjs/components/Modal/Modal.stories.js +11 -66
  18. package/lib/cjs/components/MultivaluesField/MultivaluesField.js +20 -10
  19. package/lib/cjs/components/MultivaluesField/MultivaluesField.test.js +74 -0
  20. package/lib/cjs/components/NavBar/NavBar.js +30 -4
  21. package/lib/cjs/components/NavBar/NavBar.stories.js +70 -463
  22. package/lib/cjs/components/NavBar/NavBar.test.js +51 -1
  23. package/lib/cjs/components/NavBarSection/NavBarItem.js +137 -0
  24. package/lib/cjs/components/NavBarSection/NavBarItemButton.js +96 -0
  25. package/lib/cjs/components/NavBarSection/NavBarItemHeader.js +1 -1
  26. package/lib/cjs/components/NavBarSection/NavBarItemLink.js +98 -0
  27. package/lib/cjs/components/NavBarSection/NavBarSection.js +10 -8
  28. package/lib/cjs/components/NavBarSection/index.js +28 -1
  29. package/lib/cjs/components/NumberField/NumberField.js +30 -10
  30. package/lib/cjs/components/NumberField/NumberField.test.js +7 -0
  31. package/lib/cjs/components/PageHeader/PageHeader.js +3 -0
  32. package/lib/cjs/components/PageHeader/PageHeader.stories.js +6 -1
  33. package/lib/cjs/components/RadioGroupField/RadioGroupField.js +9 -5
  34. package/lib/cjs/components/SelectField/SelectField.stories.js +3 -55
  35. package/lib/cjs/components/SelectFieldBase/SelectFieldBase.js +8 -1
  36. package/lib/cjs/components/Tabs/Tabs.stories.js +1 -15
  37. package/lib/cjs/context/NavBarContext/index.js +20 -0
  38. package/lib/cjs/hooks/index.js +9 -0
  39. package/lib/cjs/hooks/useField/useField.js +2 -2
  40. package/lib/cjs/hooks/useNavBarPress/index.js +18 -0
  41. package/lib/cjs/hooks/useNavBarPress/useNavBarPress.js +38 -0
  42. package/lib/cjs/hooks/useNavBarPress/useNavBarPress.test.js +42 -0
  43. package/lib/cjs/index.js +80 -58
  44. package/lib/cjs/styles/forms/checkbox.js +0 -1
  45. package/lib/cjs/styles/forms/input.js +1 -1
  46. package/lib/cjs/styles/forms/label.js +3 -0
  47. package/lib/cjs/styles/forms/radio.js +1 -1
  48. package/lib/cjs/styles/forms/switch.js +3 -1
  49. package/lib/cjs/styles/variants/accordion.js +39 -7
  50. package/lib/cjs/styles/variants/boxes.js +5 -25
  51. package/lib/cjs/styles/variants/buttons.js +7 -1
  52. package/lib/cjs/styles/variants/codeView.js +91 -0
  53. package/lib/cjs/styles/variants/navBar.js +68 -0
  54. package/lib/cjs/styles/variants/separator.js +2 -1
  55. package/lib/cjs/styles/variants/text.js +3 -1
  56. package/lib/cjs/styles/variants/variants.js +3 -0
  57. package/lib/components/AccordionGridGroup/AccordionGridGroup.js +7 -2
  58. package/lib/components/AccordionGridItem/AccordionGridItemBody.js +4 -2
  59. package/lib/components/AccordionGridItem/AccordionGridItemHeader.js +9 -4
  60. package/lib/components/ArrayField/ArrayField.js +179 -0
  61. package/lib/components/ArrayField/ArrayField.stories.js +196 -0
  62. package/lib/components/ArrayField/ArrayField.test.js +185 -0
  63. package/lib/components/ArrayField/ArrayFieldDeleteButton.js +43 -0
  64. package/lib/components/ArrayField/index.js +2 -0
  65. package/lib/components/CheckboxField/CheckboxField.js +4 -1
  66. package/lib/components/CodeView/CodeView.js +2 -2
  67. package/lib/components/Input/Input.js +2 -10
  68. package/lib/components/Input/Input.test.js +11 -2
  69. package/lib/components/ListView/ListView.stories.js +3 -0
  70. package/lib/components/Loader/Loader.stories.js +1 -1
  71. package/lib/components/Modal/Modal.js +4 -1
  72. package/lib/components/Modal/Modal.stories.js +10 -59
  73. package/lib/components/MultivaluesField/MultivaluesField.js +19 -9
  74. package/lib/components/MultivaluesField/MultivaluesField.test.js +52 -0
  75. package/lib/components/NavBar/NavBar.js +25 -4
  76. package/lib/components/NavBar/NavBar.stories.js +71 -462
  77. package/lib/components/NavBar/NavBar.test.js +39 -2
  78. package/lib/components/NavBarSection/NavBarItem.js +111 -0
  79. package/lib/components/NavBarSection/NavBarItemButton.js +69 -0
  80. package/lib/components/NavBarSection/NavBarItemHeader.js +1 -1
  81. package/lib/components/NavBarSection/NavBarItemLink.js +71 -0
  82. package/lib/components/NavBarSection/NavBarSection.js +9 -8
  83. package/lib/components/NavBarSection/index.js +4 -1
  84. package/lib/components/NumberField/NumberField.js +32 -12
  85. package/lib/components/NumberField/NumberField.test.js +5 -0
  86. package/lib/components/PageHeader/PageHeader.js +2 -0
  87. package/lib/components/PageHeader/PageHeader.stories.js +5 -1
  88. package/lib/components/RadioGroupField/RadioGroupField.js +9 -5
  89. package/lib/components/SelectField/SelectField.stories.js +2 -50
  90. package/lib/components/SelectFieldBase/SelectFieldBase.js +8 -1
  91. package/lib/components/Tabs/Tabs.stories.js +0 -11
  92. package/lib/context/NavBarContext/index.js +5 -0
  93. package/lib/hooks/index.js +1 -0
  94. package/lib/hooks/useField/useField.js +2 -2
  95. package/lib/hooks/useNavBarPress/index.js +1 -0
  96. package/lib/hooks/useNavBarPress/useNavBarPress.js +27 -0
  97. package/lib/hooks/useNavBarPress/useNavBarPress.test.js +36 -0
  98. package/lib/index.js +2 -0
  99. package/lib/styles/forms/checkbox.js +0 -1
  100. package/lib/styles/forms/input.js +1 -1
  101. package/lib/styles/forms/label.js +3 -0
  102. package/lib/styles/forms/radio.js +1 -1
  103. package/lib/styles/forms/switch.js +3 -1
  104. package/lib/styles/variants/accordion.js +26 -5
  105. package/lib/styles/variants/boxes.js +5 -25
  106. package/lib/styles/variants/buttons.js +7 -1
  107. package/lib/styles/variants/codeView.js +91 -0
  108. package/lib/styles/variants/navBar.js +46 -0
  109. package/lib/styles/variants/separator.js +2 -1
  110. package/lib/styles/variants/text.js +3 -1
  111. package/lib/styles/variants/variants.js +2 -0
  112. package/package.json +3 -1
  113. package/lib/cjs/layouts/ListLayout.stories.js +0 -895
  114. package/lib/cjs/layouts/SchemaFormLayout.stories.js +0 -139
  115. package/lib/cjs/recipes/ArrayField.stories.js +0 -169
  116. package/lib/layouts/ListLayout.stories.js +0 -866
  117. package/lib/layouts/SchemaFormLayout.stories.js +0 -107
  118. 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: ['Users', 'Group', 'Populations', 'Attributes', 'A roles title that is really really really really long']
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: "boxes.navBarItemHeaderContainer",
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
- mt: '25px'
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';
@@ -14,10 +14,10 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
14
14
 
15
15
  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; }
16
16
 
17
- import React, { forwardRef, useImperativeHandle } from 'react';
17
+ import React, { forwardRef, useCallback, useImperativeHandle, useMemo } from 'react';
18
18
  import PropTypes from 'prop-types';
19
- import ArrowDropUpIcon from 'mdi-react/ArrowDropUpIcon';
20
- import ArrowDropDownIcon from 'mdi-react/ArrowDropDownIcon';
19
+ import MenuUp from 'mdi-react/MenuUpIcon';
20
+ import MenuDown from 'mdi-react/MenuDownIcon';
21
21
  import { useNumberField } from '@react-aria/numberfield';
22
22
  import { useNumberFieldState } from '@react-stately/numberfield';
23
23
  import { useLocale } from '@react-aria/i18n';
@@ -73,18 +73,38 @@ var NumberField = /*#__PURE__*/forwardRef(function (props, ref) {
73
73
  variant: "numberField.arrows"
74
74
  }, ___EmotionJSX(IconButton, _extends({}, incrementButtonProps, {
75
75
  ref: decRef,
76
- tabIndex: "-1"
76
+ tabIndex: "-1",
77
+ p: 0
77
78
  }), ___EmotionJSX(Icon, {
78
- icon: ArrowDropUpIcon,
79
- size: 12
79
+ icon: MenuUp,
80
+ size: 18
80
81
  })), ___EmotionJSX(IconButton, _extends({}, decrementButtonProps, {
81
82
  ref: incrRef,
82
- tabIndex: "-1"
83
+ tabIndex: "-1",
84
+ p: 0
83
85
  }), ___EmotionJSX(Icon, {
84
- icon: ArrowDropDownIcon,
85
- size: 12
86
- })));
87
-
86
+ icon: MenuDown,
87
+ size: 18
88
+ }))); // this needed to remove console warning in React 16
89
+ // I believe once we update to 17 - we can remove this
90
+
91
+
92
+ var onInputFocus = useCallback(function (e) {
93
+ e.persist();
94
+ fieldControlProps.onFocus(e);
95
+ inputProps.onFocus(e);
96
+ }, [fieldControlProps, inputProps]);
97
+ var onInputBlur = useCallback(function (e) {
98
+ e.persist();
99
+ fieldControlProps.onBlur(e);
100
+ inputProps.onBlur(e);
101
+ }, [fieldControlProps, inputProps]);
102
+ var updatedFieldControlProps = useMemo(function () {
103
+ return _objectSpread(_objectSpread({}, fieldControlProps), {}, {
104
+ onFocus: onInputFocus,
105
+ onBlur: onInputBlur
106
+ });
107
+ }, [fieldControlProps, onInputBlur, onInputFocus]);
88
108
  return ___EmotionJSX(Box, fieldContainerProps, ___EmotionJSX(Label, mergeProps(fieldLabelProps, labelProps)), ___EmotionJSX(Box, _extends({
89
109
  variant: "numberField.noDefaultArrows"
90
110
  }, groupProps), ___EmotionJSX(Box, {
@@ -95,7 +115,7 @@ var NumberField = /*#__PURE__*/forwardRef(function (props, ref) {
95
115
  ref: inputRef // we don't want to merge this props, we want to
96
116
  // overwrite them like defaultValue, value, ect.
97
117
 
98
- }, fieldControlProps, omit(inputProps, 'name'))), ControlArrows), helperText && ___EmotionJSX(FieldHelperText, {
118
+ }, updatedFieldControlProps, omit(inputProps, ['name', 'onFocus', 'onBlur']))), ControlArrows), helperText && ___EmotionJSX(FieldHelperText, {
99
119
  status: status
100
120
  }, helperText)));
101
121
  });
@@ -135,4 +135,9 @@ test('number field input receiving name attribute', function () {
135
135
  name: testName
136
136
  });
137
137
  expect(screen.getByLabelText(testLabel)).toHaveAttribute('name', testName);
138
+ });
139
+ test('number field can be focused', function () {
140
+ getComponent();
141
+ userEvent.tab();
142
+ expect(screen.getByLabelText(testLabel)).toHaveClass('is-focused');
138
143
  });
@@ -4,12 +4,14 @@ import React, { forwardRef } from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import Text from '../Text/Text';
6
6
  import Box from '../Box/Box';
7
+ import { useDeprecationWarning } from '../../hooks';
7
8
  import { jsx as ___EmotionJSX } from "@emotion/react";
8
9
  var PageHeader = /*#__PURE__*/forwardRef(function (props, ref) {
9
10
  var title = props.title,
10
11
  children = props.children,
11
12
  others = _objectWithoutProperties(props, ["title", "children"]);
12
13
 
14
+ useDeprecationWarning('The Page Header component will be deprecated in Astro-UI 2.0.0.');
13
15
  return ___EmotionJSX(Box, _extends({
14
16
  isRow: true,
15
17
  justifyContent: "space-between",
@@ -2,10 +2,14 @@ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
2
  import React from 'react';
3
3
  import PageHeader from '../PageHeader/PageHeader';
4
4
  import Button from '../Button/Button';
5
+ import withDeprecationWarning from '../../utils/devUtils/decorators/withDeprecationWarning';
5
6
  import { jsx as ___EmotionJSX } from "@emotion/react";
6
7
  export default {
7
- title: 'PageHeader',
8
+ title: 'Deprecated/PageHeader',
8
9
  component: PageHeader,
10
+ decorators: [function (Story, context) {
11
+ return withDeprecationWarning(Story, context, 'The `PageHeader` component will be deprecated in Astro-UI 2.0.0.');
12
+ }],
9
13
  argTypes: {
10
14
  title: {
11
15
  control: {
@@ -63,17 +63,21 @@ var RadioGroupField = /*#__PURE__*/forwardRef(function (props, ref) {
63
63
  }, radioGroupProps), ___EmotionJSX(Label, _extends({
64
64
  isDisabled: isDisabled,
65
65
  hintText: hintText,
66
- isRequired: isRequired
67
- }, labelProps), label), helperText && ___EmotionJSX(FieldHelperText, {
68
- status: status
69
- }, helperText), ___EmotionJSX(Box, {
66
+ isRequired: isRequired,
67
+ variant: "forms.label.radioGroup"
68
+ }, labelProps), label), ___EmotionJSX(Box, {
70
69
  variant: "forms.radioGroupWrapper",
71
70
  isRow: orientation === ORIENTATION.HORIZONTAL
72
71
  }, ___EmotionJSX(RadioContext.Provider, {
73
72
  value: _objectSpread({
74
73
  isDisabled: isDisabled
75
74
  }, state)
76
- }, children)));
75
+ }, children)), helperText && ___EmotionJSX(FieldHelperText, {
76
+ status: status,
77
+ sx: {
78
+ pt: 'xs'
79
+ }
80
+ }, helperText));
77
81
  });
78
82
  RadioGroupField.propTypes = {
79
83
  /** The name of the RadioGroupField, used when submitting an HTML form. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name_and_radio_buttons). */
@@ -16,7 +16,6 @@ import { useAsyncList } from '@react-stately/data';
16
16
  import { SelectField, Item, Separator, Section } from '../../index';
17
17
  import statuses from '../../utils/devUtils/constants/statuses';
18
18
  import { modes as labelModes } from '../Label/constants';
19
- import Box from '../Box';
20
19
  import { jsx as ___EmotionJSX } from "@emotion/react";
21
20
  var animals = [{
22
21
  name: 'Aardvark',
@@ -195,52 +194,6 @@ export var FloatLabel = function FloatLabel() {
195
194
  key: "yellow"
196
195
  }, "Yellow"));
197
196
  };
198
- export var LeftLabel = function LeftLabel() {
199
- return ___EmotionJSX(Box, {
200
- gap: "xl",
201
- width: "100%"
202
- }, ___EmotionJSX(SelectField, {
203
- helperText: "Here is some helpful text...",
204
- label: "Example Label",
205
- labelMode: "left"
206
- }, ___EmotionJSX(Item, {
207
- key: "red"
208
- }, "Red"), ___EmotionJSX(Item, {
209
- key: "blue"
210
- }, "Blue"), ___EmotionJSX(Item, {
211
- key: "yellow"
212
- }, "Yellow")), ___EmotionJSX(SelectField, {
213
- label: "Example Label that is much longer than the previous one",
214
- labelMode: "left"
215
- }, ___EmotionJSX(Item, {
216
- key: "red"
217
- }, "Red"), ___EmotionJSX(Item, {
218
- key: "blue"
219
- }, "Blue"), ___EmotionJSX(Item, {
220
- key: "yellow"
221
- }, "Yellow")), ___EmotionJSX(SelectField, {
222
- label: "Example label with set width",
223
- labelMode: "left",
224
- containerProps: {
225
- sx: {
226
- gridTemplateColumns: '120px auto'
227
- }
228
- }
229
- }, ___EmotionJSX(Item, {
230
- key: "red"
231
- }, "Red"), ___EmotionJSX(Item, {
232
- key: "blue"
233
- }, "Blue"), ___EmotionJSX(Item, {
234
- key: "yellow"
235
- }, "Yellow")));
236
- };
237
- LeftLabel.parameters = {
238
- docs: {
239
- description: {
240
- story: 'Users are able to override the default 40% column width when using left label by providing a new gridTemplatesColumn value, as shown in the example below.'
241
- }
242
- }
243
- };
244
197
  export var Controlled = function Controlled() {
245
198
  var _useState = useState('yellow'),
246
199
  _useState2 = _slicedToArray(_useState, 2),
@@ -299,15 +252,14 @@ export var DisabledOptions = function DisabledOptions() {
299
252
  key: "red"
300
253
  }, "Red"), ___EmotionJSX(Item, {
301
254
  key: "blue"
302
- }, "Blue (disabled)"), ___EmotionJSX(Item, {
255
+ }, "Blue"), ___EmotionJSX(Item, {
303
256
  key: "yellow"
304
257
  }, "Yellow"));
305
258
  };
306
259
  export var NoOptionsAvailable = function NoOptionsAvailable() {
307
260
  return ___EmotionJSX(SelectField, {
308
261
  label: "Select an option...",
309
- isDisabled: true,
310
- defaultText: "No options available"
262
+ placeholder: "No options available"
311
263
  });
312
264
  };
313
265
  export var HelperText = function HelperText() {
@@ -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
 
@@ -161,17 +161,6 @@ export var CustomTabLine = function CustomTabLine() {
161
161
  }, item.children);
162
162
  });
163
163
  };
164
- export var Orientation = function Orientation() {
165
- return ___EmotionJSX(Tabs, {
166
- orientation: "vertical",
167
- items: tabs
168
- }, function (item) {
169
- return ___EmotionJSX(Tab, {
170
- key: item.name,
171
- title: item.name
172
- }, item.children);
173
- });
174
- };
175
164
  export var TabPanelProps = function TabPanelProps() {
176
165
  return ___EmotionJSX(Tabs, {
177
166
  tabPanelProps: {
@@ -0,0 +1,5 @@
1
+ import { createContext, useContext } from 'react';
2
+ export var NavBarContext = /*#__PURE__*/createContext({});
3
+ export var useNavBarContext = function useNavBarContext() {
4
+ return useContext(NavBarContext);
5
+ };
@@ -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';