@pingux/astro 1.25.1-alpha.8 → 1.25.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.
- package/CHANGELOG.md +16 -0
- package/lib/cjs/components/AccordionGridGroup/AccordionGridGroup.test.js +19 -0
- package/lib/cjs/components/AccordionGridItem/AccordionGridItemBody.js +0 -1
- package/lib/cjs/components/PasswordField/PasswordField.js +55 -52
- package/lib/cjs/styles/variants/accordion.js +2 -1
- package/lib/components/AccordionGridGroup/AccordionGridGroup.test.js +11 -0
- package/lib/components/AccordionGridItem/AccordionGridItemBody.js +0 -1
- package/lib/components/PasswordField/PasswordField.js +53 -49
- package/lib/styles/variants/accordion.js +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,22 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [1.25.1](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.25.0...@pingux/astro@1.25.1) (2022-08-30)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* [UIP-5310] Accordion with input focus issue ([c998b3e](https://gitlab.corp.pingidentity.com/ux/pingux/commit/c998b3e3d16638be92f70aee979b5350c3997fa8))
|
12
|
+
* [UIP-5497] Multivalues field status ([03d5b11](https://gitlab.corp.pingidentity.com/ux/pingux/commit/03d5b11e84639e911d9200aa1e7ff48f024943c8))
|
13
|
+
* [UIP-5557] Updates to bidirectional arrow recipe ([e2b3ffe](https://gitlab.corp.pingidentity.com/ux/pingux/commit/e2b3ffee81925855102a90b2aa76662d07f0d4f8))
|
14
|
+
* [UIP-5589] correct links in customizing style ([39d7f30](https://gitlab.corp.pingidentity.com/ux/pingux/commit/39d7f301e7403a54f210ef9964d12c6993c44513))
|
15
|
+
* [UIP-5593] Update password toggle aria-label ([d74813d](https://gitlab.corp.pingidentity.com/ux/pingux/commit/d74813dcb1f1a9045d68a8f948ea2dcdfe58b476))
|
16
|
+
* [UIP-5612] List+Panel Recipe Design Improvements ([64b9546](https://gitlab.corp.pingidentity.com/ux/pingux/commit/64b9546231124a725218ef5985a5315be828d68e))
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
6
22
|
# [1.25.0](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.24.0...@pingux/astro@1.25.0) (2022-08-11)
|
7
23
|
|
8
24
|
|
@@ -280,5 +280,24 @@ test('adds focus to inputs', function () {
|
|
280
280
|
_userEvent["default"].click(secondInput);
|
281
281
|
|
282
282
|
expect(firstInput).not.toHaveFocus();
|
283
|
+
expect(secondInput).toHaveFocus();
|
284
|
+
});
|
285
|
+
test('adds focus to input on a single click after onBlur', function () {
|
286
|
+
getComponentWithTextFields();
|
287
|
+
|
288
|
+
var firstInput = _testWrapper.screen.getAllByRole('gridcell')[0];
|
289
|
+
|
290
|
+
var secondInput = _testWrapper.screen.getAllByRole('gridcell')[1];
|
291
|
+
|
292
|
+
expect(secondInput).not.toHaveFocus();
|
293
|
+
|
294
|
+
_userEvent["default"].click(firstInput);
|
295
|
+
|
296
|
+
_userEvent["default"].click(secondInput);
|
297
|
+
|
298
|
+
secondInput.blur();
|
299
|
+
|
300
|
+
_userEvent["default"].click(secondInput);
|
301
|
+
|
283
302
|
expect(secondInput).toHaveFocus();
|
284
303
|
});
|
@@ -90,7 +90,6 @@ var AccordionGridItemBody = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
90
90
|
var ariaLabel = props['aria-label'];
|
91
91
|
delete mergedProps.onMouseDown;
|
92
92
|
delete mergedProps.onPointerDown;
|
93
|
-
delete mergedProps.onClick;
|
94
93
|
return (0, _react2.jsx)(_Box["default"], (0, _extends2["default"])({
|
95
94
|
as: "div",
|
96
95
|
variant: "accordion.accordionGridBody",
|
@@ -56,33 +56,29 @@ var _overlays = require("@react-aria/overlays");
|
|
56
56
|
|
57
57
|
var _utils = require("@react-aria/utils");
|
58
58
|
|
59
|
-
var
|
60
|
-
|
61
|
-
var _useProgressiveState3 = _interopRequireDefault(require("../../hooks/useProgressiveState"));
|
59
|
+
var hooks = _interopRequireWildcard(require("../../hooks"));
|
62
60
|
|
63
61
|
var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
|
64
62
|
|
65
|
-
var _hooks = require("../../hooks");
|
66
|
-
|
67
63
|
var _Box = _interopRequireDefault(require("../Box"));
|
68
64
|
|
69
65
|
var _FieldHelperText = _interopRequireDefault(require("../FieldHelperText"));
|
70
66
|
|
71
|
-
var _Input = _interopRequireDefault(require("../Input"));
|
72
|
-
|
73
|
-
var _Label = _interopRequireDefault(require("../Label"));
|
74
|
-
|
75
67
|
var _Icon = _interopRequireDefault(require("../Icon"));
|
76
68
|
|
77
69
|
var _IconButton = _interopRequireDefault(require("../IconButton"));
|
78
70
|
|
71
|
+
var _Input = _interopRequireDefault(require("../Input"));
|
72
|
+
|
73
|
+
var _Label = _interopRequireDefault(require("../Label"));
|
74
|
+
|
79
75
|
var _PopoverContainer = _interopRequireDefault(require("../PopoverContainer"));
|
80
76
|
|
81
77
|
var _RequirementsList = _interopRequireDefault(require("../RequirementsList"));
|
82
78
|
|
83
79
|
var _react2 = require("@emotion/react");
|
84
80
|
|
85
|
-
var _excluded = ["helperText", "isVisible", "onVisibleChange", "slots", "status", "viewHiddenIconTestId", "viewIconTestId"
|
81
|
+
var _excluded = ["helperText", "isVisible", "onVisibleChange", "requirements", "slots", "status", "viewHiddenIconTestId", "viewIconTestId"];
|
86
82
|
|
87
83
|
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); }
|
88
84
|
|
@@ -92,18 +88,23 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
|
|
92
88
|
|
93
89
|
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) { (0, _defineProperty2["default"])(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; }
|
94
90
|
|
91
|
+
var ARIA_LABELS_FOR_SHOW_PASSWORD_TOGGLE = {
|
92
|
+
HIDE: 'hide password',
|
93
|
+
SHOW: 'show password'
|
94
|
+
};
|
95
95
|
/**
|
96
96
|
* Combines a text input, label, IconButton and helper text for a complete, form-ready solution.
|
97
97
|
*/
|
98
|
+
|
98
99
|
var PasswordField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
99
100
|
var helperText = props.helperText,
|
100
101
|
isVisibleProp = props.isVisible,
|
101
102
|
onVisibleChangeProp = props.onVisibleChange,
|
103
|
+
requirements = props.requirements,
|
102
104
|
slots = props.slots,
|
103
105
|
status = props.status,
|
104
106
|
viewHiddenIconTestId = props.viewHiddenIconTestId,
|
105
107
|
viewIconTestId = props.viewIconTestId,
|
106
|
-
requirements = props.requirements,
|
107
108
|
others = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
108
109
|
|
109
110
|
var checkRequirements = function checkRequirements() {
|
@@ -112,41 +113,27 @@ var PasswordField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
112
113
|
}).length > 0;
|
113
114
|
};
|
114
115
|
|
115
|
-
var
|
116
|
+
var _hooks$useField = hooks.useField(_objectSpread({
|
116
117
|
status: status
|
117
118
|
}, others)),
|
118
|
-
fieldContainerProps =
|
119
|
-
fieldControlProps =
|
120
|
-
fieldLabelProps =
|
119
|
+
fieldContainerProps = _hooks$useField.fieldContainerProps,
|
120
|
+
fieldControlProps = _hooks$useField.fieldControlProps,
|
121
|
+
fieldLabelProps = _hooks$useField.fieldLabelProps;
|
121
122
|
|
122
123
|
var isFocused = fieldControlProps.isFocused;
|
123
124
|
var inputRef = (0, _react.useRef)();
|
124
125
|
var popoverRef = (0, _react.useRef)();
|
125
|
-
|
126
|
+
hooks.usePropWarning(props, 'disabled', 'isDisabled');
|
126
127
|
/* istanbul ignore next */
|
127
128
|
|
128
129
|
(0, _react.useImperativeHandle)(ref, function () {
|
129
130
|
return inputRef.current;
|
130
131
|
});
|
131
132
|
|
132
|
-
var
|
133
|
-
|
134
|
-
isVisible =
|
135
|
-
setIsShown =
|
136
|
-
|
137
|
-
var onVisibleChange = function onVisibleChange() {
|
138
|
-
setIsShown(!isVisible);
|
139
|
-
|
140
|
-
if (onVisibleChangeProp) {
|
141
|
-
var _context;
|
142
|
-
|
143
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
144
|
-
args[_key] = arguments[_key];
|
145
|
-
}
|
146
|
-
|
147
|
-
onVisibleChangeProp.apply(void 0, (0, _concat["default"])(_context = [!isVisible]).call(_context, args));
|
148
|
-
}
|
149
|
-
}; // Measure the width of the input to inform the width of the menu (below).
|
133
|
+
var _hooks$useProgressive = hooks.useProgressiveState(isVisibleProp, onVisibleChangeProp),
|
134
|
+
_hooks$useProgressive2 = (0, _slicedToArray2["default"])(_hooks$useProgressive, 2),
|
135
|
+
isVisible = _hooks$useProgressive2[0],
|
136
|
+
setIsShown = _hooks$useProgressive2[1]; // Measure the width of the input to inform the width of the menu (below).
|
150
137
|
|
151
138
|
|
152
139
|
var _useState = (0, _react.useState)(null),
|
@@ -167,10 +154,10 @@ var PasswordField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
167
154
|
(0, _utils.useLayoutEffect)(onResize, [onResize]);
|
168
155
|
|
169
156
|
var _useOverlayPosition = (0, _overlays.useOverlayPosition)({
|
170
|
-
|
157
|
+
isOpen: true,
|
171
158
|
overlayRef: popoverRef,
|
172
159
|
placement: 'bottom end',
|
173
|
-
|
160
|
+
targetRef: inputRef
|
174
161
|
}),
|
175
162
|
overlayProps = _useOverlayPosition.overlayProps,
|
176
163
|
placement = _useOverlayPosition.placement,
|
@@ -184,15 +171,31 @@ var PasswordField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
184
171
|
}
|
185
172
|
}, [isFocused, updatePosition]);
|
186
173
|
|
187
|
-
var style = _objectSpread(
|
188
|
-
|
189
|
-
|
190
|
-
});
|
174
|
+
var style = _objectSpread({
|
175
|
+
minWidth: menuWidth,
|
176
|
+
width: menuWidth
|
177
|
+
}, overlayProps.style);
|
191
178
|
|
192
|
-
var
|
179
|
+
var _hooks$useStatusClass = hooks.useStatusClasses(fieldControlProps.className, {
|
193
180
|
'is-success': status === _statuses["default"].SUCCESS || checkRequirements() && requirements.length > 0
|
194
181
|
}),
|
195
|
-
classNames =
|
182
|
+
classNames = _hooks$useStatusClass.classNames;
|
183
|
+
|
184
|
+
var toggleShowPasswordAriaLabel = isVisible ? ARIA_LABELS_FOR_SHOW_PASSWORD_TOGGLE.HIDE : ARIA_LABELS_FOR_SHOW_PASSWORD_TOGGLE.SHOW;
|
185
|
+
|
186
|
+
var handleToggleShowPassword = function handleToggleShowPassword() {
|
187
|
+
setIsShown(!isVisible);
|
188
|
+
|
189
|
+
if (onVisibleChangeProp) {
|
190
|
+
var _context;
|
191
|
+
|
192
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
193
|
+
args[_key] = arguments[_key];
|
194
|
+
}
|
195
|
+
|
196
|
+
onVisibleChangeProp.apply(void 0, (0, _concat["default"])(_context = [!isVisible]).call(_context, args));
|
197
|
+
}
|
198
|
+
};
|
196
199
|
|
197
200
|
return (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_Box["default"], (0, _extends2["default"])({
|
198
201
|
variant: "forms.input.wrapper"
|
@@ -211,23 +214,23 @@ var PasswordField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
211
214
|
})), (0, _react2.jsx)(_Box["default"], {
|
212
215
|
variant: "forms.input.containedIcon"
|
213
216
|
}, (0, _react2.jsx)(_IconButton["default"], {
|
214
|
-
"aria-label":
|
217
|
+
"aria-label": toggleShowPasswordAriaLabel,
|
215
218
|
isDisabled: fieldControlProps.disabled,
|
216
|
-
|
217
|
-
|
219
|
+
onPress: handleToggleShowPassword,
|
220
|
+
size: 28
|
218
221
|
}, (0, _react2.jsx)(_Icon["default"], {
|
219
222
|
"data-testid": isVisible ? viewIconTestId : viewHiddenIconTestId,
|
220
223
|
icon: isVisible ? _EyeOutlineIcon["default"] : _EyeOffOutlineIcon["default"]
|
221
224
|
}))), slots === null || slots === void 0 ? void 0 : slots.inContainer), helperText && (0, _react2.jsx)(_FieldHelperText["default"], {
|
222
225
|
status: status
|
223
226
|
}, helperText)), (0, _react2.jsx)(_PopoverContainer["default"], {
|
224
|
-
isOpen: isFocused && requirements && (0, _isArray["default"])(requirements) && !checkRequirements(),
|
225
|
-
ref: popoverRef,
|
226
|
-
placement: placement,
|
227
|
-
style: style,
|
228
227
|
hasNoArrow: true,
|
228
|
+
isDismissable: false,
|
229
229
|
isNonModal: true,
|
230
|
-
|
230
|
+
isOpen: isFocused && requirements && (0, _isArray["default"])(requirements) && !checkRequirements(),
|
231
|
+
placement: placement,
|
232
|
+
ref: popoverRef,
|
233
|
+
style: style
|
231
234
|
}, (0, _react2.jsx)(_RequirementsList["default"], {
|
232
235
|
requirements: requirements
|
233
236
|
})));
|
@@ -340,9 +343,9 @@ PasswordField.defaultProps = {
|
|
340
343
|
isDisabled: false,
|
341
344
|
isReadOnly: false,
|
342
345
|
isRequired: false,
|
343
|
-
|
346
|
+
requirements: [],
|
344
347
|
status: _statuses["default"].DEFAULT,
|
345
|
-
|
348
|
+
type: 'password'
|
346
349
|
};
|
347
350
|
PasswordField.displayName = 'PasswordField';
|
348
351
|
var _default = PasswordField;
|
@@ -212,4 +212,15 @@ test('adds focus to inputs', function () {
|
|
212
212
|
userEvent.click(secondInput);
|
213
213
|
expect(firstInput).not.toHaveFocus();
|
214
214
|
expect(secondInput).toHaveFocus();
|
215
|
+
});
|
216
|
+
test('adds focus to input on a single click after onBlur', function () {
|
217
|
+
getComponentWithTextFields();
|
218
|
+
var firstInput = screen.getAllByRole('gridcell')[0];
|
219
|
+
var secondInput = screen.getAllByRole('gridcell')[1];
|
220
|
+
expect(secondInput).not.toHaveFocus();
|
221
|
+
userEvent.click(firstInput);
|
222
|
+
userEvent.click(secondInput);
|
223
|
+
secondInput.blur();
|
224
|
+
userEvent.click(secondInput);
|
225
|
+
expect(secondInput).toHaveFocus();
|
215
226
|
});
|
@@ -55,7 +55,6 @@ var AccordionGridItemBody = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
55
55
|
var ariaLabel = props['aria-label'];
|
56
56
|
delete mergedProps.onMouseDown;
|
57
57
|
delete mergedProps.onPointerDown;
|
58
|
-
delete mergedProps.onClick;
|
59
58
|
return ___EmotionJSX(Box, _extends({
|
60
59
|
as: "div",
|
61
60
|
variant: "accordion.accordionGridBody",
|
@@ -13,7 +13,7 @@ import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
|
13
13
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
14
14
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
15
15
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
16
|
-
var _excluded = ["helperText", "isVisible", "onVisibleChange", "slots", "status", "viewHiddenIconTestId", "viewIconTestId"
|
16
|
+
var _excluded = ["helperText", "isVisible", "onVisibleChange", "requirements", "slots", "status", "viewHiddenIconTestId", "viewIconTestId"];
|
17
17
|
|
18
18
|
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; }
|
19
19
|
|
@@ -25,32 +25,34 @@ import EyeIcon from 'mdi-react/EyeOutlineIcon';
|
|
25
25
|
import EyeOffIcon from 'mdi-react/EyeOffOutlineIcon';
|
26
26
|
import { useOverlayPosition } from '@react-aria/overlays';
|
27
27
|
import { useLayoutEffect, useResizeObserver } from '@react-aria/utils';
|
28
|
-
import
|
29
|
-
import useProgressiveState from '../../hooks/useProgressiveState';
|
28
|
+
import * as hooks from '../../hooks';
|
30
29
|
import statuses from '../../utils/devUtils/constants/statuses';
|
31
|
-
import { usePropWarning, useStatusClasses } from '../../hooks';
|
32
30
|
import Box from '../Box';
|
33
31
|
import FieldHelperText from '../FieldHelperText';
|
34
|
-
import Input from '../Input';
|
35
|
-
import Label from '../Label';
|
36
32
|
import Icon from '../Icon';
|
37
33
|
import IconButton from '../IconButton';
|
34
|
+
import Input from '../Input';
|
35
|
+
import Label from '../Label';
|
38
36
|
import PopoverContainer from '../PopoverContainer';
|
39
37
|
import RequirementsList from '../RequirementsList';
|
38
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
39
|
+
var ARIA_LABELS_FOR_SHOW_PASSWORD_TOGGLE = {
|
40
|
+
HIDE: 'hide password',
|
41
|
+
SHOW: 'show password'
|
42
|
+
};
|
40
43
|
/**
|
41
44
|
* Combines a text input, label, IconButton and helper text for a complete, form-ready solution.
|
42
45
|
*/
|
43
46
|
|
44
|
-
import { jsx as ___EmotionJSX } from "@emotion/react";
|
45
47
|
var PasswordField = /*#__PURE__*/forwardRef(function (props, ref) {
|
46
48
|
var helperText = props.helperText,
|
47
49
|
isVisibleProp = props.isVisible,
|
48
50
|
onVisibleChangeProp = props.onVisibleChange,
|
51
|
+
requirements = props.requirements,
|
49
52
|
slots = props.slots,
|
50
53
|
status = props.status,
|
51
54
|
viewHiddenIconTestId = props.viewHiddenIconTestId,
|
52
55
|
viewIconTestId = props.viewIconTestId,
|
53
|
-
requirements = props.requirements,
|
54
56
|
others = _objectWithoutProperties(props, _excluded);
|
55
57
|
|
56
58
|
var checkRequirements = function checkRequirements() {
|
@@ -59,41 +61,27 @@ var PasswordField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
59
61
|
}).length > 0;
|
60
62
|
};
|
61
63
|
|
62
|
-
var
|
64
|
+
var _hooks$useField = hooks.useField(_objectSpread({
|
63
65
|
status: status
|
64
66
|
}, others)),
|
65
|
-
fieldContainerProps =
|
66
|
-
fieldControlProps =
|
67
|
-
fieldLabelProps =
|
67
|
+
fieldContainerProps = _hooks$useField.fieldContainerProps,
|
68
|
+
fieldControlProps = _hooks$useField.fieldControlProps,
|
69
|
+
fieldLabelProps = _hooks$useField.fieldLabelProps;
|
68
70
|
|
69
71
|
var isFocused = fieldControlProps.isFocused;
|
70
72
|
var inputRef = useRef();
|
71
73
|
var popoverRef = useRef();
|
72
|
-
usePropWarning(props, 'disabled', 'isDisabled');
|
74
|
+
hooks.usePropWarning(props, 'disabled', 'isDisabled');
|
73
75
|
/* istanbul ignore next */
|
74
76
|
|
75
77
|
useImperativeHandle(ref, function () {
|
76
78
|
return inputRef.current;
|
77
79
|
});
|
78
80
|
|
79
|
-
var
|
80
|
-
|
81
|
-
isVisible =
|
82
|
-
setIsShown =
|
83
|
-
|
84
|
-
var onVisibleChange = function onVisibleChange() {
|
85
|
-
setIsShown(!isVisible);
|
86
|
-
|
87
|
-
if (onVisibleChangeProp) {
|
88
|
-
var _context;
|
89
|
-
|
90
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
91
|
-
args[_key] = arguments[_key];
|
92
|
-
}
|
93
|
-
|
94
|
-
onVisibleChangeProp.apply(void 0, _concatInstanceProperty(_context = [!isVisible]).call(_context, args));
|
95
|
-
}
|
96
|
-
}; // Measure the width of the input to inform the width of the menu (below).
|
81
|
+
var _hooks$useProgressive = hooks.useProgressiveState(isVisibleProp, onVisibleChangeProp),
|
82
|
+
_hooks$useProgressive2 = _slicedToArray(_hooks$useProgressive, 2),
|
83
|
+
isVisible = _hooks$useProgressive2[0],
|
84
|
+
setIsShown = _hooks$useProgressive2[1]; // Measure the width of the input to inform the width of the menu (below).
|
97
85
|
|
98
86
|
|
99
87
|
var _useState = useState(null),
|
@@ -114,10 +102,10 @@ var PasswordField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
114
102
|
useLayoutEffect(onResize, [onResize]);
|
115
103
|
|
116
104
|
var _useOverlayPosition = useOverlayPosition({
|
117
|
-
|
105
|
+
isOpen: true,
|
118
106
|
overlayRef: popoverRef,
|
119
107
|
placement: 'bottom end',
|
120
|
-
|
108
|
+
targetRef: inputRef
|
121
109
|
}),
|
122
110
|
overlayProps = _useOverlayPosition.overlayProps,
|
123
111
|
placement = _useOverlayPosition.placement,
|
@@ -131,15 +119,31 @@ var PasswordField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
131
119
|
}
|
132
120
|
}, [isFocused, updatePosition]);
|
133
121
|
|
134
|
-
var style = _objectSpread(
|
135
|
-
|
136
|
-
|
137
|
-
});
|
122
|
+
var style = _objectSpread({
|
123
|
+
minWidth: menuWidth,
|
124
|
+
width: menuWidth
|
125
|
+
}, overlayProps.style);
|
138
126
|
|
139
|
-
var
|
127
|
+
var _hooks$useStatusClass = hooks.useStatusClasses(fieldControlProps.className, {
|
140
128
|
'is-success': status === statuses.SUCCESS || checkRequirements() && requirements.length > 0
|
141
129
|
}),
|
142
|
-
classNames =
|
130
|
+
classNames = _hooks$useStatusClass.classNames;
|
131
|
+
|
132
|
+
var toggleShowPasswordAriaLabel = isVisible ? ARIA_LABELS_FOR_SHOW_PASSWORD_TOGGLE.HIDE : ARIA_LABELS_FOR_SHOW_PASSWORD_TOGGLE.SHOW;
|
133
|
+
|
134
|
+
var handleToggleShowPassword = function handleToggleShowPassword() {
|
135
|
+
setIsShown(!isVisible);
|
136
|
+
|
137
|
+
if (onVisibleChangeProp) {
|
138
|
+
var _context;
|
139
|
+
|
140
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
141
|
+
args[_key] = arguments[_key];
|
142
|
+
}
|
143
|
+
|
144
|
+
onVisibleChangeProp.apply(void 0, _concatInstanceProperty(_context = [!isVisible]).call(_context, args));
|
145
|
+
}
|
146
|
+
};
|
143
147
|
|
144
148
|
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Box, _extends({
|
145
149
|
variant: "forms.input.wrapper"
|
@@ -158,23 +162,23 @@ var PasswordField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
158
162
|
})), ___EmotionJSX(Box, {
|
159
163
|
variant: "forms.input.containedIcon"
|
160
164
|
}, ___EmotionJSX(IconButton, {
|
161
|
-
"aria-label":
|
165
|
+
"aria-label": toggleShowPasswordAriaLabel,
|
162
166
|
isDisabled: fieldControlProps.disabled,
|
163
|
-
|
164
|
-
|
167
|
+
onPress: handleToggleShowPassword,
|
168
|
+
size: 28
|
165
169
|
}, ___EmotionJSX(Icon, {
|
166
170
|
"data-testid": isVisible ? viewIconTestId : viewHiddenIconTestId,
|
167
171
|
icon: isVisible ? EyeIcon : EyeOffIcon
|
168
172
|
}))), slots === null || slots === void 0 ? void 0 : slots.inContainer), helperText && ___EmotionJSX(FieldHelperText, {
|
169
173
|
status: status
|
170
174
|
}, helperText)), ___EmotionJSX(PopoverContainer, {
|
171
|
-
isOpen: isFocused && requirements && _Array$isArray(requirements) && !checkRequirements(),
|
172
|
-
ref: popoverRef,
|
173
|
-
placement: placement,
|
174
|
-
style: style,
|
175
175
|
hasNoArrow: true,
|
176
|
+
isDismissable: false,
|
176
177
|
isNonModal: true,
|
177
|
-
|
178
|
+
isOpen: isFocused && requirements && _Array$isArray(requirements) && !checkRequirements(),
|
179
|
+
placement: placement,
|
180
|
+
ref: popoverRef,
|
181
|
+
style: style
|
178
182
|
}, ___EmotionJSX(RequirementsList, {
|
179
183
|
requirements: requirements
|
180
184
|
})));
|
@@ -287,9 +291,9 @@ PasswordField.defaultProps = {
|
|
287
291
|
isDisabled: false,
|
288
292
|
isReadOnly: false,
|
289
293
|
isRequired: false,
|
290
|
-
|
294
|
+
requirements: [],
|
291
295
|
status: statuses.DEFAULT,
|
292
|
-
|
296
|
+
type: 'password'
|
293
297
|
};
|
294
298
|
PasswordField.displayName = 'PasswordField';
|
295
299
|
export default PasswordField;
|