@pingux/astro 1.23.0-alpha.0 → 1.23.0-alpha.3

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.
@@ -172,7 +172,7 @@ var ArrayField = function ArrayField(props) {
172
172
  }
173
173
  }, [isControlled]);
174
174
  var onFieldAdd = (0, _react.useCallback)(function () {
175
- if (onAddRef.current) {
175
+ if (isControlled) {
176
176
  return onAddRef.current();
177
177
  }
178
178
 
@@ -181,7 +181,7 @@ var ArrayField = function ArrayField(props) {
181
181
 
182
182
  return (0, _concat["default"])(_context = []).call(_context, oldValues, [createEmptyField()]);
183
183
  });
184
- }, [createEmptyField]);
184
+ }, [createEmptyField, isControlled]);
185
185
 
186
186
  var _useLabel = (0, _label.useLabel)(_objectSpread({}, props)),
187
187
  raLabelProps = _useLabel.labelProps;
@@ -79,7 +79,11 @@ test('adds one text field and new empty field is added', function () {
79
79
  });
80
80
  test('onAdd callback is fired when adding field', function () {
81
81
  var onAdd = jest.fn();
82
+ var value = defaultData;
83
+ var defaultValue = null;
82
84
  getComponent({
85
+ value: value,
86
+ defaultValue: defaultValue,
83
87
  onAdd: onAdd,
84
88
  renderField: renderField
85
89
  });
@@ -54,7 +54,8 @@ var CollapsiblePanelItem = /*#__PURE__*/(0, _react.forwardRef)(function (props,
54
54
  fill: 'inherit'
55
55
  }
56
56
  },
57
- onPress: onPress
57
+ onPress: onPress,
58
+ "aria-label": "icon"
58
59
  }, iconElement)));
59
60
  });
60
61
  CollapsiblePanelItem.propTypes = {
@@ -48,8 +48,9 @@ var _Box = _interopRequireDefault(require("../Box"));
48
48
 
49
49
  var _react2 = require("@emotion/react");
50
50
 
51
- var _excluded = ["children", "placement", "arrowProps", "onClose", "isNotClosedOnBlur", "hasNoArrow", "isKeyboardDismissDisabled", "isNonModal", "isDismissable"],
52
- _excluded2 = ["children", "className", "placement", "arrowProps", "isOpen", "hasNoArrow", "isNotClosedOnBlur", "isKeyboardDismissDisabled", "isNonModal", "isDismissable"];
51
+ var _excluded = ["children", "placement", "arrowProps", "arrowCrossOffset", "onClose", "isNotClosedOnBlur", "hasNoArrow", "isKeyboardDismissDisabled", "isNonModal", "isDismissable", "width", "direction"],
52
+ _excluded2 = ["children", "className", "placement", "arrowProps", "arrowCrossOffset", "isOpen", "hasNoArrow", "isNotClosedOnBlur", "isKeyboardDismissDisabled", "isNonModal", "isDismissable", "width", "direction", "sx"],
53
+ _excluded3 = ["arrowCrossOffset", "sx", "direction"];
53
54
 
54
55
  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); }
55
56
 
@@ -66,12 +67,15 @@ var PopoverContainer = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
66
67
  var children = props.children,
67
68
  placement = props.placement,
68
69
  arrowProps = props.arrowProps,
70
+ arrowCrossOffset = props.arrowCrossOffset,
69
71
  onClose = props.onClose,
70
72
  isNotClosedOnBlur = props.isNotClosedOnBlur,
71
73
  hasNoArrow = props.hasNoArrow,
72
74
  isKeyboardDismissDisabled = props.isKeyboardDismissDisabled,
73
75
  isNonModal = props.isNonModal,
74
76
  isDismissable = props.isDismissable,
77
+ width = props.width,
78
+ direction = props.direction,
75
79
  others = (0, _objectWithoutProperties2["default"])(props, _excluded);
76
80
  return (0, _react2.jsx)(_overlays.OverlayContainer, null, (0, _react2.jsx)(PopoverWrapper, (0, _extends2["default"])({
77
81
  ref: ref,
@@ -82,7 +86,10 @@ var PopoverContainer = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
82
86
  isKeyboardDismissDisabled: isKeyboardDismissDisabled,
83
87
  hasNoArrow: hasNoArrow,
84
88
  isNonModal: isNonModal,
85
- isDismissable: isDismissable
89
+ isDismissable: isDismissable,
90
+ arrowCrossOffset: arrowCrossOffset,
91
+ width: width,
92
+ direction: direction
86
93
  }, others), children));
87
94
  });
88
95
  PopoverContainer.propTypes = {
@@ -93,19 +100,26 @@ PopoverContainer.propTypes = {
93
100
  hasNoArrow: _propTypes["default"].bool,
94
101
  isKeyboardDismissDisabled: _propTypes["default"].bool,
95
102
  isNonModal: _propTypes["default"].bool,
96
- isDismissable: _propTypes["default"].bool
103
+ isDismissable: _propTypes["default"].bool,
104
+ width: _propTypes["default"].string,
105
+ arrowCrossOffset: _propTypes["default"].string,
106
+ direction: _propTypes["default"].oneOf(['top', 'right', 'bottom', 'left'])
97
107
  };
98
108
  var PopoverWrapper = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
99
109
  var children = props.children,
100
110
  className = props.className,
101
111
  placement = props.placement,
102
112
  arrowProps = props.arrowProps,
113
+ arrowCrossOffset = props.arrowCrossOffset,
103
114
  isOpen = props.isOpen,
104
115
  hasNoArrow = props.hasNoArrow,
105
116
  isNotClosedOnBlur = props.isNotClosedOnBlur,
106
117
  isKeyboardDismissDisabled = props.isKeyboardDismissDisabled,
107
118
  isNonModal = props.isNonModal,
108
119
  isDismissable = props.isDismissable,
120
+ width = props.width,
121
+ direction = props.direction,
122
+ sx = props.sx,
109
123
  others = (0, _objectWithoutProperties2["default"])(props, _excluded2);
110
124
  var popoverRef = (0, _react.useRef)();
111
125
  /* istanbul ignore next */
@@ -135,8 +149,14 @@ var PopoverWrapper = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
135
149
  className: classNames,
136
150
  role: "presentation",
137
151
  "data-popover-placement": placement,
138
- "data-testid": "popover-container"
139
- }), children, hasNoArrow ? null : (0, _react2.jsx)(PopoverArrow, arrowProps)));
152
+ "data-testid": "popover-container",
153
+ sx: _objectSpread(_objectSpread({}, sx), {}, {
154
+ width: width
155
+ })
156
+ }), children, hasNoArrow ? null : (0, _react2.jsx)(PopoverArrow, (0, _extends2["default"])({}, arrowProps, {
157
+ arrowCrossOffset: arrowCrossOffset,
158
+ direction: direction
159
+ }))));
140
160
  });
141
161
  exports.PopoverWrapper = PopoverWrapper;
142
162
  PopoverWrapper.propTypes = {
@@ -147,21 +167,61 @@ PopoverWrapper.propTypes = {
147
167
  isNotClosedOnBlur: _propTypes["default"].bool,
148
168
  isKeyboardDismissDisabled: _propTypes["default"].bool,
149
169
  isNonModal: _propTypes["default"].bool,
150
- isDismissable: _propTypes["default"].bool
170
+ isDismissable: _propTypes["default"].bool,
171
+ width: _propTypes["default"].string,
172
+ arrowCrossOffset: _propTypes["default"].string,
173
+ sx: _propTypes["default"].shape({}),
174
+ direction: _propTypes["default"].oneOf(['top', 'right', 'bottom', 'left'])
151
175
  };
152
176
  PopoverWrapper.defaultProps = {
153
177
  placement: 'bottom'
154
178
  };
155
179
 
156
180
  var PopoverArrow = function PopoverArrow(props) {
157
- var others = (0, _extends2["default"])({}, props);
181
+ var arrowCrossOffset = props.arrowCrossOffset,
182
+ sx = props.sx,
183
+ direction = props.direction,
184
+ others = (0, _objectWithoutProperties2["default"])(props, _excluded3);
185
+ /* istanbul ignore next */
186
+
187
+ var calculateOffset = function calculateOffset() {
188
+ switch (true) {
189
+ case direction === 'top':
190
+ case direction === 'bottom':
191
+ return {
192
+ '&:before': {
193
+ left: "calc(50% - ".concat(arrowCrossOffset, ") !important")
194
+ }
195
+ };
196
+
197
+ case direction === 'left':
198
+ case direction === 'right':
199
+ return {
200
+ '&:before': {
201
+ top: "calc(50% - ".concat(arrowCrossOffset, ") !important")
202
+ }
203
+ };
204
+
205
+ default:
206
+ return {};
207
+ }
208
+ };
209
+
158
210
  return (0, _react2.jsx)(_Box["default"], (0, _extends2["default"])({
159
211
  variant: "popoverMenu.arrow",
160
212
  "data-popover-arrow": "arrow",
161
213
  "data-testid": "popover-arrow"
162
- }, others));
214
+ }, others, {
215
+ sx: _objectSpread(_objectSpread({}, arrowCrossOffset && calculateOffset()), sx)
216
+ }));
163
217
  };
164
218
 
165
219
  exports.PopoverArrow = PopoverArrow;
220
+ PopoverArrow.propTypes = {
221
+ width: _propTypes["default"].string,
222
+ arrowCrossOffset: _propTypes["default"].string,
223
+ sx: _propTypes["default"].shape({}),
224
+ direction: _propTypes["default"].oneOf(['top', 'right', 'bottom', 'left'])
225
+ };
166
226
  var _default = PopoverContainer;
167
227
  exports["default"] = _default;
@@ -104,7 +104,8 @@ var RockerButtonGroup = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref
104
104
  variant: "rockerbutton.rockerContainerInner",
105
105
  isRow: true
106
106
  }, tabListProps, raTabListProps, {
107
- ref: buttonGroupRef
107
+ ref: buttonGroupRef,
108
+ role: "toolbar"
108
109
  }), (0, _map["default"])(_context = (0, _from["default"])(state.collection)).call(_context, function (item) {
109
110
  return (0, _react2.jsx)(_RockerButton.CollectionRockerButton, {
110
111
  key: item.key,
@@ -57,7 +57,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
57
57
  var TooltipTrigger = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
58
58
  var _context, _useStatusClasses2;
59
59
 
60
- var children = props.children,
60
+ var arrowCrossOffset = props.arrowCrossOffset,
61
+ children = props.children,
61
62
  crossOffset = props.crossOffset,
62
63
  isDisabled = props.isDisabled,
63
64
  align = props.align,
@@ -68,7 +69,8 @@ var TooltipTrigger = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
68
69
  isNotFlippable = props.isNotFlippable,
69
70
  isDarkMode = props.isDarkMode,
70
71
  hasNoArrow = props.hasNoArrow,
71
- targetRef = props.targetRef;
72
+ targetRef = props.targetRef,
73
+ width = props.width;
72
74
 
73
75
  var _React$Children$toArr = _react["default"].Children.toArray(children),
74
76
  _React$Children$toArr2 = (0, _slicedToArray2["default"])(_React$Children$toArr, 2),
@@ -116,7 +118,10 @@ var TooltipTrigger = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
116
118
  placement: placement,
117
119
  arrowProps: arrowProps,
118
120
  className: classNames,
119
- hasNoArrow: hasNoArrow
121
+ hasNoArrow: hasNoArrow,
122
+ arrowCrossOffset: arrowCrossOffset,
123
+ width: width,
124
+ direction: direction
120
125
  }, positionProps, tooltipProps), tooltip);
121
126
  return (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_interactions.PressResponder, (0, _extends2["default"])({}, triggerProps, {
122
127
  ref: tooltipTriggerRef
@@ -166,12 +171,19 @@ TooltipTrigger.propTypes = {
166
171
  /** Tooltip offset relative to its trigger. */
167
172
  offset: _propTypes["default"].number,
168
173
 
174
+ /** Arrow offset relative to the left of the tooltip.
175
+ * Must be passed as a px or percentage. */
176
+ arrowCrossOffset: _propTypes["default"].string,
177
+
169
178
  /** The placement of the element with respect to its anchor element. */
170
179
  placement: _propTypes["default"].string,
171
180
 
172
181
  /** By default, opens for both focus and hover. Can be made to open only for focus. */
173
182
  trigger: _propTypes["default"].string,
174
183
 
184
+ /** Width applied to the wrapper of the tooltip component. */
185
+ width: _propTypes["default"].string,
186
+
175
187
  /* The ref for the element which the overlay positions itself with respect to. */
176
188
  targetRef: _propTypes["default"].shape({})
177
189
  };
@@ -8,7 +8,7 @@ _Object$defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
10
 
11
- exports.withDirectionProp = exports.withDelayProp = exports.withAlignProp = exports.isOpen = exports["default"] = exports.TextWithTooltip = exports.IconWithTooltip = exports.Disabled = exports.Default = exports.ChipWithTooltip = void 0;
11
+ exports.withWidthProp = exports.withDirectionProp = exports.withDelayProp = exports.withArrowCrossOffsetProp = exports.withAlignProp = exports.isOpen = exports["default"] = exports.TextWithTooltip = exports.IconWithTooltip = exports.Disabled = exports.Default = exports.ChipWithTooltip = void 0;
12
12
 
13
13
  var _react = _interopRequireDefault(require("react"));
14
14
 
@@ -60,6 +60,23 @@ var withDelayProp = function withDelayProp() {
60
60
 
61
61
  exports.withDelayProp = withDelayProp;
62
62
 
63
+ var withWidthProp = function withWidthProp() {
64
+ return (0, _react2.jsx)(_index.TooltipTrigger, {
65
+ width: "200px"
66
+ }, (0, _react2.jsx)(_index.Button, null, "Hover Over Me!"), (0, _react2.jsx)(_index.Tooltip, null, "Custom width display"));
67
+ };
68
+
69
+ exports.withWidthProp = withWidthProp;
70
+
71
+ var withArrowCrossOffsetProp = function withArrowCrossOffsetProp() {
72
+ return (0, _react2.jsx)(_index.TooltipTrigger, {
73
+ arrowCrossOffset: "30px",
74
+ isOpen: true
75
+ }, (0, _react2.jsx)(_index.Button, null, "Hover Over Me!"), (0, _react2.jsx)(_index.Tooltip, null, "Display with a delay"));
76
+ };
77
+
78
+ exports.withArrowCrossOffsetProp = withArrowCrossOffsetProp;
79
+
63
80
  var isOpen = function isOpen() {
64
81
  return (0, _react2.jsx)(_index.TooltipTrigger, {
65
82
  isOpen: true
@@ -106,4 +106,14 @@ test('trigger press events work when a tooltip is disabled', function () {
106
106
  _userEvent["default"].click(button);
107
107
 
108
108
  expect(onPress).toHaveBeenCalledTimes(1);
109
+ });
110
+ test('passing in width applies the correct width to the container', function () {
111
+ getComponent({
112
+ isOpen: true,
113
+ width: '100px'
114
+ });
115
+
116
+ var arrow = _testWrapper.screen.getByTestId('popover-container');
117
+
118
+ expect(arrow).toHaveStyle('width: 100px');
109
119
  });
@@ -150,6 +150,8 @@ var Default = function Default() {
150
150
  searchValue = _useState4[0],
151
151
  setSearchValue = _useState4[1];
152
152
 
153
+ var checkBoxRef = (0, _react.useRef)(null);
154
+
153
155
  var _useFilter = (0, _i18n.useFilter)({
154
156
  sensitivity: 'base'
155
157
  }),
@@ -325,7 +327,11 @@ var Default = function Default() {
325
327
  },
326
328
  isSelected: (0, _some["default"])(selectedItems).call(selectedItems, function (el) {
327
329
  return el.key === item.key;
328
- })
330
+ }),
331
+ ref: checkBoxRef,
332
+ onClick: function onClick() {
333
+ return checkBoxRef.current.focus();
334
+ }
329
335
  }));
330
336
  })), (0, _react2.jsx)(_.CollapsiblePanel, {
331
337
  items: selectedItems,
@@ -118,7 +118,7 @@ var ArrayField = function ArrayField(props) {
118
118
  }
119
119
  }, [isControlled]);
120
120
  var onFieldAdd = useCallback(function () {
121
- if (onAddRef.current) {
121
+ if (isControlled) {
122
122
  return onAddRef.current();
123
123
  }
124
124
 
@@ -127,7 +127,7 @@ var ArrayField = function ArrayField(props) {
127
127
 
128
128
  return _concatInstanceProperty(_context = []).call(_context, oldValues, [createEmptyField()]);
129
129
  });
130
- }, [createEmptyField]);
130
+ }, [createEmptyField, isControlled]);
131
131
 
132
132
  var _useLabel = useLabel(_objectSpread({}, props)),
133
133
  raLabelProps = _useLabel.labelProps;
@@ -66,7 +66,11 @@ test('adds one text field and new empty field is added', function () {
66
66
  });
67
67
  test('onAdd callback is fired when adding field', function () {
68
68
  var onAdd = jest.fn();
69
+ var value = defaultData;
70
+ var defaultValue = null;
69
71
  getComponent({
72
+ value: value,
73
+ defaultValue: defaultValue,
70
74
  onAdd: onAdd,
71
75
  renderField: renderField
72
76
  });
@@ -30,7 +30,8 @@ var CollapsiblePanelItem = /*#__PURE__*/forwardRef(function (props, ref) {
30
30
  fill: 'inherit'
31
31
  }
32
32
  },
33
- onPress: onPress
33
+ onPress: onPress,
34
+ "aria-label": "icon"
34
35
  }, iconElement)));
35
36
  });
36
37
  CollapsiblePanelItem.propTypes = {
@@ -9,8 +9,9 @@ import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
9
9
  import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
10
10
  import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
11
11
  import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
12
- var _excluded = ["children", "placement", "arrowProps", "onClose", "isNotClosedOnBlur", "hasNoArrow", "isKeyboardDismissDisabled", "isNonModal", "isDismissable"],
13
- _excluded2 = ["children", "className", "placement", "arrowProps", "isOpen", "hasNoArrow", "isNotClosedOnBlur", "isKeyboardDismissDisabled", "isNonModal", "isDismissable"];
12
+ var _excluded = ["children", "placement", "arrowProps", "arrowCrossOffset", "onClose", "isNotClosedOnBlur", "hasNoArrow", "isKeyboardDismissDisabled", "isNonModal", "isDismissable", "width", "direction"],
13
+ _excluded2 = ["children", "className", "placement", "arrowProps", "arrowCrossOffset", "isOpen", "hasNoArrow", "isNotClosedOnBlur", "isKeyboardDismissDisabled", "isNonModal", "isDismissable", "width", "direction", "sx"],
14
+ _excluded3 = ["arrowCrossOffset", "sx", "direction"];
14
15
 
15
16
  function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
16
17
 
@@ -31,12 +32,15 @@ var PopoverContainer = /*#__PURE__*/forwardRef(function (props, ref) {
31
32
  var children = props.children,
32
33
  placement = props.placement,
33
34
  arrowProps = props.arrowProps,
35
+ arrowCrossOffset = props.arrowCrossOffset,
34
36
  onClose = props.onClose,
35
37
  isNotClosedOnBlur = props.isNotClosedOnBlur,
36
38
  hasNoArrow = props.hasNoArrow,
37
39
  isKeyboardDismissDisabled = props.isKeyboardDismissDisabled,
38
40
  isNonModal = props.isNonModal,
39
41
  isDismissable = props.isDismissable,
42
+ width = props.width,
43
+ direction = props.direction,
40
44
  others = _objectWithoutProperties(props, _excluded);
41
45
 
42
46
  return ___EmotionJSX(OverlayContainer, null, ___EmotionJSX(PopoverWrapper, _extends({
@@ -48,7 +52,10 @@ var PopoverContainer = /*#__PURE__*/forwardRef(function (props, ref) {
48
52
  isKeyboardDismissDisabled: isKeyboardDismissDisabled,
49
53
  hasNoArrow: hasNoArrow,
50
54
  isNonModal: isNonModal,
51
- isDismissable: isDismissable
55
+ isDismissable: isDismissable,
56
+ arrowCrossOffset: arrowCrossOffset,
57
+ width: width,
58
+ direction: direction
52
59
  }, others), children));
53
60
  });
54
61
  PopoverContainer.propTypes = {
@@ -59,19 +66,26 @@ PopoverContainer.propTypes = {
59
66
  hasNoArrow: PropTypes.bool,
60
67
  isKeyboardDismissDisabled: PropTypes.bool,
61
68
  isNonModal: PropTypes.bool,
62
- isDismissable: PropTypes.bool
69
+ isDismissable: PropTypes.bool,
70
+ width: PropTypes.string,
71
+ arrowCrossOffset: PropTypes.string,
72
+ direction: PropTypes.oneOf(['top', 'right', 'bottom', 'left'])
63
73
  };
64
74
  export var PopoverWrapper = /*#__PURE__*/forwardRef(function (props, ref) {
65
75
  var children = props.children,
66
76
  className = props.className,
67
77
  placement = props.placement,
68
78
  arrowProps = props.arrowProps,
79
+ arrowCrossOffset = props.arrowCrossOffset,
69
80
  isOpen = props.isOpen,
70
81
  hasNoArrow = props.hasNoArrow,
71
82
  isNotClosedOnBlur = props.isNotClosedOnBlur,
72
83
  isKeyboardDismissDisabled = props.isKeyboardDismissDisabled,
73
84
  isNonModal = props.isNonModal,
74
85
  isDismissable = props.isDismissable,
86
+ width = props.width,
87
+ direction = props.direction,
88
+ sx = props.sx,
75
89
  others = _objectWithoutProperties(props, _excluded2);
76
90
 
77
91
  var popoverRef = useRef();
@@ -102,8 +116,14 @@ export var PopoverWrapper = /*#__PURE__*/forwardRef(function (props, ref) {
102
116
  className: classNames,
103
117
  role: "presentation",
104
118
  "data-popover-placement": placement,
105
- "data-testid": "popover-container"
106
- }), children, hasNoArrow ? null : ___EmotionJSX(PopoverArrow, arrowProps)));
119
+ "data-testid": "popover-container",
120
+ sx: _objectSpread(_objectSpread({}, sx), {}, {
121
+ width: width
122
+ })
123
+ }), children, hasNoArrow ? null : ___EmotionJSX(PopoverArrow, _extends({}, arrowProps, {
124
+ arrowCrossOffset: arrowCrossOffset,
125
+ direction: direction
126
+ }))));
107
127
  });
108
128
  PopoverWrapper.propTypes = {
109
129
  placement: PropTypes.string,
@@ -113,18 +133,58 @@ PopoverWrapper.propTypes = {
113
133
  isNotClosedOnBlur: PropTypes.bool,
114
134
  isKeyboardDismissDisabled: PropTypes.bool,
115
135
  isNonModal: PropTypes.bool,
116
- isDismissable: PropTypes.bool
136
+ isDismissable: PropTypes.bool,
137
+ width: PropTypes.string,
138
+ arrowCrossOffset: PropTypes.string,
139
+ sx: PropTypes.shape({}),
140
+ direction: PropTypes.oneOf(['top', 'right', 'bottom', 'left'])
117
141
  };
118
142
  PopoverWrapper.defaultProps = {
119
143
  placement: 'bottom'
120
144
  };
121
145
  export var PopoverArrow = function PopoverArrow(props) {
122
- var others = _extends({}, props);
146
+ var arrowCrossOffset = props.arrowCrossOffset,
147
+ sx = props.sx,
148
+ direction = props.direction,
149
+ others = _objectWithoutProperties(props, _excluded3);
150
+ /* istanbul ignore next */
151
+
152
+
153
+ var calculateOffset = function calculateOffset() {
154
+ switch (true) {
155
+ case direction === 'top':
156
+ case direction === 'bottom':
157
+ return {
158
+ '&:before': {
159
+ left: "calc(50% - ".concat(arrowCrossOffset, ") !important")
160
+ }
161
+ };
162
+
163
+ case direction === 'left':
164
+ case direction === 'right':
165
+ return {
166
+ '&:before': {
167
+ top: "calc(50% - ".concat(arrowCrossOffset, ") !important")
168
+ }
169
+ };
170
+
171
+ default:
172
+ return {};
173
+ }
174
+ };
123
175
 
124
176
  return ___EmotionJSX(Box, _extends({
125
177
  variant: "popoverMenu.arrow",
126
178
  "data-popover-arrow": "arrow",
127
179
  "data-testid": "popover-arrow"
128
- }, others));
180
+ }, others, {
181
+ sx: _objectSpread(_objectSpread({}, arrowCrossOffset && calculateOffset()), sx)
182
+ }));
183
+ };
184
+ PopoverArrow.propTypes = {
185
+ width: PropTypes.string,
186
+ arrowCrossOffset: PropTypes.string,
187
+ sx: PropTypes.shape({}),
188
+ direction: PropTypes.oneOf(['top', 'right', 'bottom', 'left'])
129
189
  };
130
190
  export default PopoverContainer;
@@ -64,7 +64,8 @@ var RockerButtonGroup = /*#__PURE__*/forwardRef(function (props, ref) {
64
64
  variant: "rockerbutton.rockerContainerInner",
65
65
  isRow: true
66
66
  }, tabListProps, raTabListProps, {
67
- ref: buttonGroupRef
67
+ ref: buttonGroupRef,
68
+ role: "toolbar"
68
69
  }), _mapInstanceProperty(_context = _Array$from(state.collection)).call(_context, function (item) {
69
70
  return ___EmotionJSX(CollectionRockerButton, {
70
71
  key: item.key,
@@ -22,7 +22,8 @@ import { jsx as ___EmotionJSX } from "@emotion/react";
22
22
  var TooltipTrigger = /*#__PURE__*/forwardRef(function (props, ref) {
23
23
  var _context, _useStatusClasses2;
24
24
 
25
- var children = props.children,
25
+ var arrowCrossOffset = props.arrowCrossOffset,
26
+ children = props.children,
26
27
  crossOffset = props.crossOffset,
27
28
  isDisabled = props.isDisabled,
28
29
  align = props.align,
@@ -33,7 +34,8 @@ var TooltipTrigger = /*#__PURE__*/forwardRef(function (props, ref) {
33
34
  isNotFlippable = props.isNotFlippable,
34
35
  isDarkMode = props.isDarkMode,
35
36
  hasNoArrow = props.hasNoArrow,
36
- targetRef = props.targetRef;
37
+ targetRef = props.targetRef,
38
+ width = props.width;
37
39
 
38
40
  var _React$Children$toArr = React.Children.toArray(children),
39
41
  _React$Children$toArr2 = _slicedToArray(_React$Children$toArr, 2),
@@ -81,7 +83,10 @@ var TooltipTrigger = /*#__PURE__*/forwardRef(function (props, ref) {
81
83
  placement: placement,
82
84
  arrowProps: arrowProps,
83
85
  className: classNames,
84
- hasNoArrow: hasNoArrow
86
+ hasNoArrow: hasNoArrow,
87
+ arrowCrossOffset: arrowCrossOffset,
88
+ width: width,
89
+ direction: direction
85
90
  }, positionProps, tooltipProps), tooltip);
86
91
 
87
92
  return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(PressResponder, _extends({}, triggerProps, {
@@ -132,12 +137,19 @@ TooltipTrigger.propTypes = {
132
137
  /** Tooltip offset relative to its trigger. */
133
138
  offset: PropTypes.number,
134
139
 
140
+ /** Arrow offset relative to the left of the tooltip.
141
+ * Must be passed as a px or percentage. */
142
+ arrowCrossOffset: PropTypes.string,
143
+
135
144
  /** The placement of the element with respect to its anchor element. */
136
145
  placement: PropTypes.string,
137
146
 
138
147
  /** By default, opens for both focus and hover. Can be made to open only for focus. */
139
148
  trigger: PropTypes.string,
140
149
 
150
+ /** Width applied to the wrapper of the tooltip component. */
151
+ width: PropTypes.string,
152
+
141
153
  /* The ref for the element which the overlay positions itself with respect to. */
142
154
  targetRef: PropTypes.shape({})
143
155
  };
@@ -27,6 +27,17 @@ export var withDelayProp = function withDelayProp() {
27
27
  delay: 700
28
28
  }, ___EmotionJSX(Button, null, "Hover Over Me!"), ___EmotionJSX(Tooltip, null, "Display with a delay"));
29
29
  };
30
+ export var withWidthProp = function withWidthProp() {
31
+ return ___EmotionJSX(TooltipTrigger, {
32
+ width: "200px"
33
+ }, ___EmotionJSX(Button, null, "Hover Over Me!"), ___EmotionJSX(Tooltip, null, "Custom width display"));
34
+ };
35
+ export var withArrowCrossOffsetProp = function withArrowCrossOffsetProp() {
36
+ return ___EmotionJSX(TooltipTrigger, {
37
+ arrowCrossOffset: "30px",
38
+ isOpen: true
39
+ }, ___EmotionJSX(Button, null, "Hover Over Me!"), ___EmotionJSX(Tooltip, null, "Display with a delay"));
40
+ };
30
41
  export var isOpen = function isOpen() {
31
42
  return ___EmotionJSX(TooltipTrigger, {
32
43
  isOpen: true
@@ -71,4 +71,12 @@ test('trigger press events work when a tooltip is disabled', function () {
71
71
  expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
72
72
  userEvent.click(button);
73
73
  expect(onPress).toHaveBeenCalledTimes(1);
74
+ });
75
+ test('passing in width applies the correct width to the container', function () {
76
+ getComponent({
77
+ isOpen: true,
78
+ width: '100px'
79
+ });
80
+ var arrow = screen.getByTestId('popover-container');
81
+ expect(arrow).toHaveStyle('width: 100px');
74
82
  });
@@ -16,7 +16,7 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
16
16
 
17
17
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context2 = ownKeys(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context3 = ownKeys(Object(source))).call(_context3, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
18
18
 
19
- import React, { useMemo, useState } from 'react';
19
+ import React, { useMemo, useState, useRef } from 'react';
20
20
  import { useFilter } from '@react-aria/i18n';
21
21
  import AccountIcon from 'mdi-react/AccountIcon';
22
22
  import AccountGroupIcon from 'mdi-react/AccountGroupIcon';
@@ -106,6 +106,8 @@ export var Default = function Default() {
106
106
  searchValue = _useState4[0],
107
107
  setSearchValue = _useState4[1];
108
108
 
109
+ var checkBoxRef = useRef(null);
110
+
109
111
  var _useFilter = useFilter({
110
112
  sensitivity: 'base'
111
113
  }),
@@ -281,7 +283,11 @@ export var Default = function Default() {
281
283
  },
282
284
  isSelected: _someInstanceProperty(selectedItems).call(selectedItems, function (el) {
283
285
  return el.key === item.key;
284
- })
286
+ }),
287
+ ref: checkBoxRef,
288
+ onClick: function onClick() {
289
+ return checkBoxRef.current.focus();
290
+ }
285
291
  }));
286
292
  })), ___EmotionJSX(CollapsiblePanel, {
287
293
  items: selectedItems,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "1.23.0-alpha.0",
3
+ "version": "1.23.0-alpha.3",
4
4
  "description": "PingUX themeable React component library",
5
5
  "author": "ux-development@pingidentity.com",
6
6
  "license": "Apache-2.0",