@pingux/astro 2.17.0-alpha.4 → 2.17.0-alpha.5

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.
@@ -94,9 +94,7 @@ var Uncontrolled = function Uncontrolled(_ref) {
94
94
  hintText: 'Example Hint',
95
95
  isRequired: true,
96
96
  helpHintProps: {
97
- tooltipProps: {
98
- direction: 'top'
99
- }
97
+ direction: 'top'
100
98
  }
101
99
  },
102
100
  renderField: function renderField(id, fieldValue, onFieldValueChange, onFieldDelete, isDisabled, otherFieldProps) {
@@ -24,7 +24,7 @@ var _ = require("../..");
24
24
  var _hooks = require("../../hooks");
25
25
  var _safariAgent = require("../../styles/safariAgent");
26
26
  var _react2 = require("@emotion/react");
27
- var _excluded = ["align", "arrowCrossOffset", "children", "className", "closeDelay", "direction", "hasNoArrow", "iconButtonProps", "isDarkMode", "isNotFlippable", "offset", "popoverProps"];
27
+ var _excluded = ["align", "arrowCrossOffset", "children", "className", "closeDelay", "direction", "hasNoArrow", "iconButtonProps", "isDarkMode", "isNotFlippable", "offset", "popoverProps", "tooltipProps"];
28
28
  function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
29
29
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
30
30
  var HelpIcon = function HelpIcon() {
@@ -56,6 +56,7 @@ var HelpHint = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
56
56
  isNotFlippable = props.isNotFlippable,
57
57
  offset = props.offset,
58
58
  popoverProps = props.popoverProps,
59
+ tooltipProps = props.tooltipProps,
59
60
  others = (0, _objectWithoutProperties2["default"])(props, _excluded);
60
61
  var _useState = (0, _react.useState)(false),
61
62
  _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
@@ -165,7 +166,7 @@ var HelpHint = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
165
166
  onClose: close,
166
167
  placement: placement,
167
168
  ref: overlayRef
168
- }, (0, _reactAria.mergeProps)(overlayProps, positionProps, popoverProps, overlayHoverProps, focusWithinProps)), (0, _react2.jsx)(_reactAria.FocusScope, {
169
+ }, (0, _reactAria.mergeProps)(overlayProps, positionProps, popoverProps || tooltipProps, overlayHoverProps, focusWithinProps)), (0, _react2.jsx)(_reactAria.FocusScope, {
169
170
  restoreFocus: true,
170
171
  autoFocus: isFocusVisible
171
172
  }, (0, _react2.jsx)(_.Box, {
@@ -175,6 +176,8 @@ var HelpHint = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
175
176
  HelpHint.propTypes = {
176
177
  /** Props object that is spread directly into the popover element. */
177
178
  popoverProps: _propTypes["default"].shape({}),
179
+ /** @ignore Alias for `popoverProps` prop. Exists for backwards-compatibility. */
180
+ tooltipProps: _propTypes["default"].shape({}),
178
181
  /** Props object that is spread directly into the IconButton element. */
179
182
  iconButtonProps: _propTypes["default"].shape({}),
180
183
  /** Defaults to true, displays dark popover with white text */
@@ -55,11 +55,12 @@ var WithPopoverAndIconButtonProps = function WithPopoverAndIconButtonProps() {
55
55
  p: 50
56
56
  }, (0, _react2.jsx)(_index.HelpHint, {
57
57
  popoverProps: {
58
- direction: 'bottom'
58
+ 'data-id': 'popover-container'
59
59
  },
60
60
  iconButtonProps: {
61
61
  'aria-label': 'Help hint'
62
- }
62
+ },
63
+ direction: "bottom"
63
64
  }, "Text of the popover right here..."));
64
65
  };
65
66
  exports.WithPopoverAndIconButtonProps = WithPopoverAndIconButtonProps;
@@ -58,7 +58,11 @@ var popoverContainer = _objectSpread(_objectSpread({}, _TooltipStyles.container)
58
58
  p: '10px',
59
59
  fontSize: 'sm',
60
60
  fontWeight: 1,
61
- width: '117px'
61
+ maxWidth: '300px',
62
+ overflow: 'visible',
63
+ textOverflow: '',
64
+ maxHeight: 'unset',
65
+ display: 'flex'
62
66
  });
63
67
  var _default = {
64
68
  hintButton: hintButton,
@@ -154,6 +154,19 @@ test('applies popoverProps', function () {
154
154
  });
155
155
  expect(_testWrapper.screen.getByText(popoverValue)).toBeInTheDocument();
156
156
  });
157
+ test('applies tooltipProps', function () {
158
+ getComponent({
159
+ tooltipProps: {
160
+ isOpen: true,
161
+ maxWidth: 'unset',
162
+ width: '1000px'
163
+ }
164
+ });
165
+ var popover = _testWrapper.screen.queryByRole('presentation');
166
+ expect(popover).toBeInTheDocument();
167
+ expect(popover).toHaveStyle('width: 1000px');
168
+ expect(popover).toHaveStyle('maxWidth: unset');
169
+ });
157
170
  test('applies iconButtonProps', function () {
158
171
  var newLabel = 'New label';
159
172
  getComponent({
@@ -85,9 +85,7 @@ export var Uncontrolled = function Uncontrolled(_ref) {
85
85
  hintText: 'Example Hint',
86
86
  isRequired: true,
87
87
  helpHintProps: {
88
- tooltipProps: {
89
- direction: 'top'
90
- }
88
+ direction: 'top'
91
89
  }
92
90
  },
93
91
  renderField: function renderField(id, fieldValue, onFieldValueChange, onFieldDelete, isDisabled, otherFieldProps) {
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
2
  import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
3
3
  import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
4
- var _excluded = ["align", "arrowCrossOffset", "children", "className", "closeDelay", "direction", "hasNoArrow", "iconButtonProps", "isDarkMode", "isNotFlippable", "offset", "popoverProps"];
4
+ var _excluded = ["align", "arrowCrossOffset", "children", "className", "closeDelay", "direction", "hasNoArrow", "iconButtonProps", "isDarkMode", "isNotFlippable", "offset", "popoverProps", "tooltipProps"];
5
5
  import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
6
6
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
7
7
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
@@ -43,6 +43,7 @@ var HelpHint = /*#__PURE__*/forwardRef(function (props, ref) {
43
43
  isNotFlippable = props.isNotFlippable,
44
44
  offset = props.offset,
45
45
  popoverProps = props.popoverProps,
46
+ tooltipProps = props.tooltipProps,
46
47
  others = _objectWithoutProperties(props, _excluded);
47
48
  var _useState = useState(false),
48
49
  _useState2 = _slicedToArray(_useState, 2),
@@ -152,7 +153,7 @@ var HelpHint = /*#__PURE__*/forwardRef(function (props, ref) {
152
153
  onClose: close,
153
154
  placement: placement,
154
155
  ref: overlayRef
155
- }, mergeProps(overlayProps, positionProps, popoverProps, overlayHoverProps, focusWithinProps)), ___EmotionJSX(FocusScope, {
156
+ }, mergeProps(overlayProps, positionProps, popoverProps || tooltipProps, overlayHoverProps, focusWithinProps)), ___EmotionJSX(FocusScope, {
156
157
  restoreFocus: true,
157
158
  autoFocus: isFocusVisible
158
159
  }, ___EmotionJSX(Box, {
@@ -162,6 +163,8 @@ var HelpHint = /*#__PURE__*/forwardRef(function (props, ref) {
162
163
  HelpHint.propTypes = {
163
164
  /** Props object that is spread directly into the popover element. */
164
165
  popoverProps: PropTypes.shape({}),
166
+ /** @ignore Alias for `popoverProps` prop. Exists for backwards-compatibility. */
167
+ tooltipProps: PropTypes.shape({}),
165
168
  /** Props object that is spread directly into the IconButton element. */
166
169
  iconButtonProps: PropTypes.shape({}),
167
170
  /** Defaults to true, displays dark popover with white text */
@@ -45,11 +45,12 @@ export var WithPopoverAndIconButtonProps = function WithPopoverAndIconButtonProp
45
45
  p: 50
46
46
  }, ___EmotionJSX(HelpHint, {
47
47
  popoverProps: {
48
- direction: 'bottom'
48
+ 'data-id': 'popover-container'
49
49
  },
50
50
  iconButtonProps: {
51
51
  'aria-label': 'Help hint'
52
- }
52
+ },
53
+ direction: "bottom"
53
54
  }, "Text of the popover right here..."));
54
55
  };
55
56
  export var ContentWithLink = function ContentWithLink() {
@@ -50,7 +50,11 @@ var popoverContainer = _objectSpread(_objectSpread({}, container), {}, {
50
50
  p: '10px',
51
51
  fontSize: 'sm',
52
52
  fontWeight: 1,
53
- width: '117px'
53
+ maxWidth: '300px',
54
+ overflow: 'visible',
55
+ textOverflow: '',
56
+ maxHeight: 'unset',
57
+ display: 'flex'
54
58
  });
55
59
  export default {
56
60
  hintButton: hintButton,
@@ -151,6 +151,19 @@ test('applies popoverProps', function () {
151
151
  });
152
152
  expect(screen.getByText(popoverValue)).toBeInTheDocument();
153
153
  });
154
+ test('applies tooltipProps', function () {
155
+ getComponent({
156
+ tooltipProps: {
157
+ isOpen: true,
158
+ maxWidth: 'unset',
159
+ width: '1000px'
160
+ }
161
+ });
162
+ var popover = screen.queryByRole('presentation');
163
+ expect(popover).toBeInTheDocument();
164
+ expect(popover).toHaveStyle('width: 1000px');
165
+ expect(popover).toHaveStyle('maxWidth: unset');
166
+ });
154
167
  test('applies iconButtonProps', function () {
155
168
  var newLabel = 'New label';
156
169
  getComponent({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "2.17.0-alpha.4",
3
+ "version": "2.17.0-alpha.5",
4
4
  "description": "React component library for Ping Identity's design system",
5
5
  "repository": {
6
6
  "type": "git",