@pingux/astro 1.43.0 → 1.44.0-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.
@@ -121,14 +121,14 @@ var NumberField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
121
121
  variant: "numberField.arrows"
122
122
  }, (0, _react2.jsx)(_.IconButton, (0, _extends2["default"])({}, incrementButtonProps, {
123
123
  ref: decRef,
124
- tabIndex: "-1",
124
+ tabIndex: "0",
125
125
  p: 0
126
126
  }), (0, _react2.jsx)(_.Icon, {
127
127
  icon: _MenuUpIcon["default"],
128
128
  size: 18
129
129
  })), (0, _react2.jsx)(_.IconButton, (0, _extends2["default"])({}, decrementButtonProps, {
130
130
  ref: incrRef,
131
- tabIndex: "-1",
131
+ tabIndex: "0",
132
132
  p: 0
133
133
  }), (0, _react2.jsx)(_.Icon, {
134
134
  icon: _MenuDownIcon["default"],
@@ -155,7 +155,7 @@ test('should show hintText text if prop is passed', function () {
155
155
 
156
156
  expect(_testWrapper.screen.getByText(hintText)).toBeInTheDocument();
157
157
  });
158
- test('increment and decrement buttons shouldn\'t be able to be focused via keyboard', function () {
158
+ test('increment and decrement buttons should be able to be focused via keyboard', function () {
159
159
  getComponent();
160
160
 
161
161
  _userEvent["default"].tab();
@@ -164,11 +164,11 @@ test('increment and decrement buttons shouldn\'t be able to be focused via keybo
164
164
 
165
165
  _userEvent["default"].tab();
166
166
 
167
- expect(_testWrapper.screen.getByLabelText('arrow-up')).not.toHaveFocus();
167
+ expect(_testWrapper.screen.getByLabelText('arrow-up')).toHaveFocus();
168
168
 
169
169
  _userEvent["default"].tab();
170
170
 
171
- expect(_testWrapper.screen.getByLabelText('arrow-down')).not.toHaveFocus();
171
+ expect(_testWrapper.screen.getByLabelText('arrow-down')).toHaveFocus();
172
172
  });
173
173
  test('number field input receiving name attribute', function () {
174
174
  var testName = 'testName';
@@ -16,6 +16,8 @@ _Object$defineProperty(exports, "__esModule", {
16
16
 
17
17
  exports["default"] = exports.InnerPanel = exports.Expandable = exports.Default = exports.CustomWidth = void 0;
18
18
 
19
+ var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
20
+
19
21
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
20
22
 
21
23
  var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
@@ -339,6 +341,21 @@ var Expandable = function Expandable() {
339
341
  return onClose(state, triggerRef);
340
342
  };
341
343
 
344
+ var _useState5 = (0, _react.useState)('#EACE91'),
345
+ _useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
346
+ color = _useState6[0],
347
+ setColor = _useState6[1];
348
+
349
+ var handleColorChange = (0, _react.useCallback)(function (_ref3) {
350
+ var _context, _context2, _context3;
351
+
352
+ var rgb = _ref3.rgb;
353
+ var r = rgb.r,
354
+ b = rgb.b,
355
+ g = rgb.g,
356
+ a = rgb.a;
357
+ setColor((0, _concat["default"])(_context = (0, _concat["default"])(_context2 = (0, _concat["default"])(_context3 = "rgba(".concat(r, ", ")).call(_context3, g, ", ")).call(_context2, b, ", ")).call(_context, a, ")"));
358
+ }, []);
342
359
  var header = (0, _react2.jsx)(_index.Box, {
343
360
  sx: sx.header
344
361
  }, (0, _react2.jsx)(_index.Box, {
@@ -398,11 +415,12 @@ var Expandable = function Expandable() {
398
415
  label: "Node Description",
399
416
  defaultValue: "The Value of the Text Input"
400
417
  }), (0, _react2.jsx)(_index.ColorField, {
401
- value: "#EACE91",
418
+ value: color,
402
419
  label: "Node Background Color",
403
420
  buttonProps: {
404
421
  sx: sx.colorField
405
- }
422
+ },
423
+ onChange: handleColorChange
406
424
  }), (0, _react2.jsx)(_index.SwitchField, {
407
425
  hintText: "Example Hint",
408
426
  labelProps: {
@@ -66,7 +66,7 @@ var hooks = _interopRequireWildcard(require("../../hooks"));
66
66
 
67
67
  var _react2 = require("@emotion/react");
68
68
 
69
- var _excluded = ["helperText", "isVisible", "onVisibleChange", "requirements", "slots", "status", "viewHiddenIconTestId", "viewIconTestId"];
69
+ var _excluded = ["helperText", "isVisible", "onVisibleChange", "requirements", "requirementsListProps", "slots", "status", "viewHiddenIconTestId", "viewIconTestId"];
70
70
 
71
71
  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); }
72
72
 
@@ -89,6 +89,7 @@ var PasswordField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
89
89
  isVisibleProp = props.isVisible,
90
90
  onVisibleChangeProp = props.onVisibleChange,
91
91
  requirements = props.requirements,
92
+ requirementsListProps = props.requirementsListProps,
92
93
  slots = props.slots,
93
94
  status = props.status,
94
95
  viewHiddenIconTestId = props.viewHiddenIconTestId,
@@ -219,9 +220,9 @@ var PasswordField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
219
220
  placement: placement,
220
221
  ref: popoverRef,
221
222
  style: style
222
- }, (0, _react2.jsx)(_.RequirementsList, {
223
+ }, (0, _react2.jsx)(_.RequirementsList, (0, _extends2["default"])({
223
224
  requirements: requirements
224
- })));
225
+ }, requirementsListProps))));
225
226
  });
226
227
  PasswordField.propTypes = _objectSpread({
227
228
  /** The rendered label for the field. */
@@ -324,7 +325,10 @@ PasswordField.propTypes = _objectSpread({
324
325
  requirements: _propTypes["default"].arrayOf(_propTypes["default"].shape({
325
326
  name: _propTypes["default"].string.isRequired,
326
327
  status: _propTypes["default"].oneOf(['default', 'success', 'warning', 'error'])
327
- }))
328
+ })),
329
+
330
+ /** Props object that is spread to the requirements list. */
331
+ requirementsListProps: _propTypes["default"].shape({})
328
332
  }, _ariaAttributes.ariaAttributesBasePropTypes);
329
333
  PasswordField.defaultProps = {
330
334
  hasAutoFocus: false,
@@ -224,6 +224,20 @@ test('if all requirements are successful, do not render popover', function () {
224
224
 
225
225
  expect(_react2.screen.queryByRole('presentation')).not.toBeInTheDocument();
226
226
  });
227
+ test('passing in props to the requirements list works', function () {
228
+ var requirementsListProps = {
229
+ 'data-testid': 'my-custom-id'
230
+ };
231
+ getComponent({
232
+ requirements: defaultRequirements,
233
+ requirementsListProps: requirementsListProps
234
+ });
235
+ expect(_react2.screen.queryByTestId(requirementsListProps['data-testid'])).not.toBeInTheDocument();
236
+
237
+ _userEvent["default"].click(_react2.screen.getByRole('textbox'));
238
+
239
+ expect(_react2.screen.queryByTestId(requirementsListProps['data-testid'])).toBeInTheDocument();
240
+ });
227
241
  test('password field with helper text', function () {
228
242
  var helperText = 'helper text';
229
243
  getComponent({
@@ -76,14 +76,14 @@ var NumberField = /*#__PURE__*/forwardRef(function (props, ref) {
76
76
  variant: "numberField.arrows"
77
77
  }, ___EmotionJSX(IconButton, _extends({}, incrementButtonProps, {
78
78
  ref: decRef,
79
- tabIndex: "-1",
79
+ tabIndex: "0",
80
80
  p: 0
81
81
  }), ___EmotionJSX(Icon, {
82
82
  icon: MenuUp,
83
83
  size: 18
84
84
  })), ___EmotionJSX(IconButton, _extends({}, decrementButtonProps, {
85
85
  ref: incrRef,
86
- tabIndex: "-1",
86
+ tabIndex: "0",
87
87
  p: 0
88
88
  }), ___EmotionJSX(Icon, {
89
89
  icon: MenuDown,
@@ -120,14 +120,14 @@ test('should show hintText text if prop is passed', function () {
120
120
  fireEvent.mouseEnter(helpHintButton);
121
121
  expect(screen.getByText(hintText)).toBeInTheDocument();
122
122
  });
123
- test('increment and decrement buttons shouldn\'t be able to be focused via keyboard', function () {
123
+ test('increment and decrement buttons should be able to be focused via keyboard', function () {
124
124
  getComponent();
125
125
  userEvent.tab();
126
126
  expect(screen.getByLabelText(testLabel)).toHaveFocus();
127
127
  userEvent.tab();
128
- expect(screen.getByLabelText('arrow-up')).not.toHaveFocus();
128
+ expect(screen.getByLabelText('arrow-up')).toHaveFocus();
129
129
  userEvent.tab();
130
- expect(screen.getByLabelText('arrow-down')).not.toHaveFocus();
130
+ expect(screen.getByLabelText('arrow-down')).toHaveFocus();
131
131
  });
132
132
  test('number field input receiving name attribute', function () {
133
133
  var testName = 'testName';
@@ -1,6 +1,7 @@
1
1
  import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
2
2
  import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
3
- import React, { useState, useRef } from 'react';
3
+ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
4
+ import React, { useCallback, useState, useRef } from 'react';
4
5
  import { Item } from '@react-stately/collections';
5
6
  import ArrowTopRightBottomLeft from 'mdi-react/ArrowTopRightBottomLeftIcon';
6
7
  import ArrowCollapse from 'mdi-react/ArrowCollapseIcon';
@@ -293,6 +294,22 @@ export var Expandable = function Expandable() {
293
294
  return onClose(state, triggerRef);
294
295
  };
295
296
 
297
+ var _useState5 = useState('#EACE91'),
298
+ _useState6 = _slicedToArray(_useState5, 2),
299
+ color = _useState6[0],
300
+ setColor = _useState6[1];
301
+
302
+ var handleColorChange = useCallback(function (_ref3) {
303
+ var _context, _context2, _context3;
304
+
305
+ var rgb = _ref3.rgb;
306
+ var r = rgb.r,
307
+ b = rgb.b,
308
+ g = rgb.g,
309
+ a = rgb.a;
310
+ setColor(_concatInstanceProperty(_context = _concatInstanceProperty(_context2 = _concatInstanceProperty(_context3 = "rgba(".concat(r, ", ")).call(_context3, g, ", ")).call(_context2, b, ", ")).call(_context, a, ")"));
311
+ }, []);
312
+
296
313
  var header = ___EmotionJSX(Box, {
297
314
  sx: sx.header
298
315
  }, ___EmotionJSX(Box, {
@@ -353,11 +370,12 @@ export var Expandable = function Expandable() {
353
370
  label: "Node Description",
354
371
  defaultValue: "The Value of the Text Input"
355
372
  }), ___EmotionJSX(ColorField, {
356
- value: "#EACE91",
373
+ value: color,
357
374
  label: "Node Background Color",
358
375
  buttonProps: {
359
376
  sx: sx.colorField
360
- }
377
+ },
378
+ onChange: handleColorChange
361
379
  }), ___EmotionJSX(SwitchField, {
362
380
  hintText: "Example Hint",
363
381
  labelProps: {
@@ -9,7 +9,7 @@ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
9
9
  import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
10
10
  import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
11
11
  import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
12
- var _excluded = ["helperText", "isVisible", "onVisibleChange", "requirements", "slots", "status", "viewHiddenIconTestId", "viewIconTestId"];
12
+ var _excluded = ["helperText", "isVisible", "onVisibleChange", "requirements", "requirementsListProps", "slots", "status", "viewHiddenIconTestId", "viewIconTestId"];
13
13
 
14
14
  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; }
15
15
 
@@ -43,6 +43,7 @@ var PasswordField = /*#__PURE__*/forwardRef(function (props, ref) {
43
43
  isVisibleProp = props.isVisible,
44
44
  onVisibleChangeProp = props.onVisibleChange,
45
45
  requirements = props.requirements,
46
+ requirementsListProps = props.requirementsListProps,
46
47
  slots = props.slots,
47
48
  status = props.status,
48
49
  viewHiddenIconTestId = props.viewHiddenIconTestId,
@@ -173,9 +174,9 @@ var PasswordField = /*#__PURE__*/forwardRef(function (props, ref) {
173
174
  placement: placement,
174
175
  ref: popoverRef,
175
176
  style: style
176
- }, ___EmotionJSX(RequirementsList, {
177
+ }, ___EmotionJSX(RequirementsList, _extends({
177
178
  requirements: requirements
178
- })));
179
+ }, requirementsListProps))));
179
180
  });
180
181
  PasswordField.propTypes = _objectSpread({
181
182
  /** The rendered label for the field. */
@@ -278,7 +279,10 @@ PasswordField.propTypes = _objectSpread({
278
279
  requirements: PropTypes.arrayOf(PropTypes.shape({
279
280
  name: PropTypes.string.isRequired,
280
281
  status: PropTypes.oneOf(['default', 'success', 'warning', 'error'])
281
- }))
282
+ })),
283
+
284
+ /** Props object that is spread to the requirements list. */
285
+ requirementsListProps: PropTypes.shape({})
282
286
  }, ariaAttributesBasePropTypes);
283
287
  PasswordField.defaultProps = {
284
288
  hasAutoFocus: false,
@@ -188,6 +188,18 @@ test('if all requirements are successful, do not render popover', function () {
188
188
  userEvent.click(input);
189
189
  expect(screen.queryByRole('presentation')).not.toBeInTheDocument();
190
190
  });
191
+ test('passing in props to the requirements list works', function () {
192
+ var requirementsListProps = {
193
+ 'data-testid': 'my-custom-id'
194
+ };
195
+ getComponent({
196
+ requirements: defaultRequirements,
197
+ requirementsListProps: requirementsListProps
198
+ });
199
+ expect(screen.queryByTestId(requirementsListProps['data-testid'])).not.toBeInTheDocument();
200
+ userEvent.click(screen.getByRole('textbox'));
201
+ expect(screen.queryByTestId(requirementsListProps['data-testid'])).toBeInTheDocument();
202
+ });
191
203
  test('password field with helper text', function () {
192
204
  var helperText = 'helper text';
193
205
  getComponent({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pingux/astro",
3
- "version": "1.43.0",
3
+ "version": "1.44.0-alpha.0",
4
4
  "description": "PingUX themeable React component library",
5
5
  "repository": {
6
6
  "type": "git",