@pingux/astro 2.95.0 → 2.96.0-alpha.1
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/lib/cjs/components/EditButton/EditButton.stories.js +7 -0
- package/lib/cjs/components/IconButton/IconButton.stories.d.ts +37 -4
- package/lib/cjs/components/IconButton/IconButton.stories.js +45 -2
- package/lib/cjs/components/IconButton/IconButton.styles.d.ts +14 -0
- package/lib/cjs/components/IconButton/IconButton.styles.js +6 -3
- package/lib/cjs/components/PasswordField/PasswordField.d.ts +4 -0
- package/lib/cjs/components/PasswordField/PasswordField.js +17 -97
- package/lib/cjs/components/PasswordField/PasswordField.stories.d.ts +17 -0
- package/lib/cjs/components/PasswordField/PasswordField.stories.js +12 -0
- package/lib/cjs/components/PasswordField/PasswordField.test.d.ts +1 -0
- package/lib/cjs/components/PasswordField/PasswordField.test.js +88 -43
- package/lib/cjs/components/PasswordField/index.d.ts +1 -0
- package/lib/cjs/types/index.d.ts +1 -0
- package/lib/cjs/types/index.js +29 -18
- package/lib/cjs/types/passwordField.d.ts +69 -0
- package/lib/cjs/types/passwordField.js +6 -0
- package/lib/cjs/types/requirementsList.d.ts +2 -1
- package/lib/cjs/utils/designUtils/figmaLinks.d.ts +8 -0
- package/lib/cjs/utils/designUtils/figmaLinks.js +9 -1
- package/lib/components/EditButton/EditButton.stories.js +7 -0
- package/lib/components/IconButton/IconButton.stories.js +42 -0
- package/lib/components/IconButton/IconButton.styles.js +6 -3
- package/lib/components/PasswordField/PasswordField.js +20 -100
- package/lib/components/PasswordField/PasswordField.stories.js +12 -0
- package/lib/components/PasswordField/PasswordField.test.js +66 -21
- package/lib/types/index.js +1 -0
- package/lib/types/passwordField.js +1 -0
- package/lib/utils/designUtils/figmaLinks.js +9 -1
- package/package.json +1 -1
@@ -16,6 +16,7 @@ import React, { useState } from 'react';
|
|
16
16
|
import { withDesign } from 'storybook-addon-designs';
|
17
17
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
18
18
|
import { Box, EditButton, Text } from '../../index';
|
19
|
+
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks';
|
19
20
|
import { iconButtonArgTypes } from '../IconButton/iconButtonAttributes';
|
20
21
|
import { IconSize } from './EditButton';
|
21
22
|
import EditButtonReadme from './EditButton.mdx';
|
@@ -51,6 +52,12 @@ export var Default = function Default(args) {
|
|
51
52
|
"aria-label": "edit"
|
52
53
|
}));
|
53
54
|
};
|
55
|
+
Default.parameters = {
|
56
|
+
design: {
|
57
|
+
type: 'figma',
|
58
|
+
url: FIGMA_LINKS.editButton["default"]
|
59
|
+
}
|
60
|
+
};
|
54
61
|
export var WithSizeProp = function WithSizeProp(args) {
|
55
62
|
return ___EmotionJSX(EditButton, _extends({}, args, {
|
56
63
|
size: "lg",
|
@@ -45,6 +45,24 @@ Default.parameters = {
|
|
45
45
|
url: FIGMA_LINKS.iconButton["default"]
|
46
46
|
}
|
47
47
|
};
|
48
|
+
export var Inverted = function Inverted(args) {
|
49
|
+
return ___EmotionJSX(IconButton, _extends({
|
50
|
+
"aria-label": "Plus icon button"
|
51
|
+
}, args, {
|
52
|
+
variant: "inverted"
|
53
|
+
}), ___EmotionJSX(Icon, {
|
54
|
+
icon: PlusIcon,
|
55
|
+
title: {
|
56
|
+
name: 'Plus Icon'
|
57
|
+
}
|
58
|
+
}));
|
59
|
+
};
|
60
|
+
Inverted.parameters = {
|
61
|
+
design: {
|
62
|
+
type: 'figma',
|
63
|
+
url: FIGMA_LINKS.iconButton.inverted
|
64
|
+
}
|
65
|
+
};
|
48
66
|
export var WithTooltip = function WithTooltip() {
|
49
67
|
return ___EmotionJSX(IconButton, {
|
50
68
|
"aria-label": "icon button with tooltip",
|
@@ -57,6 +75,12 @@ export var WithTooltip = function WithTooltip() {
|
|
57
75
|
}
|
58
76
|
}));
|
59
77
|
};
|
78
|
+
WithTooltip.parameters = {
|
79
|
+
design: {
|
80
|
+
type: 'figma',
|
81
|
+
url: FIGMA_LINKS.iconButton.withTooltip
|
82
|
+
}
|
83
|
+
};
|
60
84
|
export var Disabled = function Disabled() {
|
61
85
|
return ___EmotionJSX(IconButton, {
|
62
86
|
"aria-label": "disabled icon button",
|
@@ -68,6 +92,12 @@ export var Disabled = function Disabled() {
|
|
68
92
|
}
|
69
93
|
}));
|
70
94
|
};
|
95
|
+
Disabled.parameters = {
|
96
|
+
design: {
|
97
|
+
type: 'figma',
|
98
|
+
url: FIGMA_LINKS.iconButton.disabled
|
99
|
+
}
|
100
|
+
};
|
71
101
|
export var Sizes = function Sizes() {
|
72
102
|
return ___EmotionJSX(Table, null, ___EmotionJSX(TableHead, null, ___EmotionJSX(TableRow, {
|
73
103
|
key: "head"
|
@@ -172,6 +202,12 @@ export var Sizes = function Sizes() {
|
|
172
202
|
}
|
173
203
|
}))))));
|
174
204
|
};
|
205
|
+
Sizes.parameters = {
|
206
|
+
design: {
|
207
|
+
type: 'figma',
|
208
|
+
url: FIGMA_LINKS.iconButton.sizes
|
209
|
+
}
|
210
|
+
};
|
175
211
|
export var CommonlyUsed = function CommonlyUsed() {
|
176
212
|
return (
|
177
213
|
// please note these are intentionally not mapped for story transparency
|
@@ -493,4 +529,10 @@ export var CommonlyUsed = function CommonlyUsed() {
|
|
493
529
|
}
|
494
530
|
}))))
|
495
531
|
);
|
532
|
+
};
|
533
|
+
CommonlyUsed.parameters = {
|
534
|
+
design: {
|
535
|
+
type: 'figma',
|
536
|
+
url: FIGMA_LINKS.iconButton.commonlyUsed
|
537
|
+
}
|
496
538
|
};
|
@@ -38,13 +38,15 @@ export var base = {
|
|
38
38
|
outline: 'none',
|
39
39
|
'&.is-focused': _objectSpread({}, defaultFocus),
|
40
40
|
'&.is-hovered': {
|
41
|
-
bg: 'accent.95'
|
41
|
+
bg: 'accent.95',
|
42
|
+
boxShadow: 'standard'
|
42
43
|
},
|
43
44
|
'&.is-pressed': {
|
44
45
|
'path': {
|
45
46
|
fill: 'white'
|
46
47
|
},
|
47
|
-
bg: 'active'
|
48
|
+
bg: 'active',
|
49
|
+
boxShadow: 'none'
|
48
50
|
}
|
49
51
|
};
|
50
52
|
var bidirectional = {
|
@@ -81,7 +83,8 @@ var inverted = _objectSpread(_objectSpread({}, base), {}, {
|
|
81
83
|
'&.is-pressed': {
|
82
84
|
bg: 'accent.20',
|
83
85
|
borderColor: 'accent.20',
|
84
|
-
color: 'white'
|
86
|
+
color: 'white',
|
87
|
+
boxShadow: 'none'
|
85
88
|
}
|
86
89
|
});
|
87
90
|
var invertedSquare = _objectSpread(_objectSpread({}, inverted), {}, {
|
@@ -4,7 +4,7 @@ import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
5
5
|
var _excluded = ["helperText", "isVisible", "onVisibleChange", "requirements", "requirementsListProps", "slots", "status", "viewHiddenIconTestId", "viewIconTestId"];
|
6
6
|
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; }
|
7
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
7
|
+
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; }
|
8
8
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
9
9
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
10
10
|
import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
|
@@ -17,45 +17,37 @@ import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/inst
|
|
17
17
|
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
18
18
|
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
19
19
|
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
20
|
-
import React, { forwardRef, useCallback,
|
20
|
+
import React, { forwardRef, useCallback, useRef, useState } from 'react';
|
21
21
|
import { useOverlayPosition } from 'react-aria';
|
22
22
|
import EyeOffIcon from '@pingux/mdi-react/EyeOffOutlineIcon';
|
23
23
|
import EyeIcon from '@pingux/mdi-react/EyeOutlineIcon';
|
24
24
|
import { useLayoutEffect, useResizeObserver } from '@react-aria/utils';
|
25
25
|
import { VisuallyHidden } from '@react-aria/visually-hidden';
|
26
|
-
import PropTypes from 'prop-types';
|
27
26
|
import { Box, FieldHelperText, Icon, IconButton, Input, Label, PopoverContainer, RequirementsList } from '../..';
|
28
|
-
import { useDebounce, useField, useProgressiveState, usePropWarning, useStatusClasses } from '../../hooks';
|
27
|
+
import { useDebounce, useField, useLocalOrForwardRef, useProgressiveState, usePropWarning, useStatusClasses } from '../../hooks';
|
29
28
|
import { getPendoID } from '../../utils/devUtils/constants/pendoID';
|
30
29
|
import statuses from '../../utils/devUtils/constants/statuses';
|
31
|
-
import {
|
32
|
-
import { inputFieldAttributesBasePropTypes } from '../../utils/docUtils/fieldAttributes';
|
33
|
-
import { statusDefaultProp, statusPropTypes } from '../../utils/docUtils/statusProp';
|
30
|
+
import { statusDefaultProp } from '../../utils/docUtils/statusProp';
|
34
31
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
35
32
|
var displayName = 'PasswordField';
|
36
33
|
var ARIA_LABELS_FOR_SHOW_PASSWORD_TOGGLE = {
|
37
34
|
HIDE: 'hide password',
|
38
35
|
SHOW: 'show password'
|
39
36
|
};
|
40
|
-
var RequirementMessage = function RequirementMessage(
|
37
|
+
var RequirementMessage = function RequirementMessage(props) {
|
41
38
|
var _context;
|
42
|
-
var requirement =
|
39
|
+
var requirement = props.requirement;
|
43
40
|
return ___EmotionJSX(React.Fragment, null, useDebounce({
|
44
|
-
value: _concatInstanceProperty(_context = "".concat(requirement.name, " ")).call(_context, requirement.status === statuses.SUCCESS ?
|
41
|
+
value: _concatInstanceProperty(_context = "".concat(requirement.name, " ")).call(_context, requirement.status === statuses.SUCCESS ? statuses.SUCCESS : 'not met'),
|
45
42
|
delay: 100
|
46
43
|
}));
|
47
44
|
};
|
48
|
-
RequirementMessage.propTypes = {
|
49
|
-
requirement: PropTypes.shape({
|
50
|
-
name: PropTypes.string,
|
51
|
-
status: PropTypes.string
|
52
|
-
})
|
53
|
-
};
|
54
45
|
var PasswordField = /*#__PURE__*/forwardRef(function (props, ref) {
|
55
46
|
var helperText = props.helperText,
|
56
47
|
isVisibleProp = props.isVisible,
|
57
48
|
onVisibleChangeProp = props.onVisibleChange,
|
58
|
-
requirements = props.requirements,
|
49
|
+
_props$requirements = props.requirements,
|
50
|
+
requirements = _props$requirements === void 0 ? [] : _props$requirements,
|
59
51
|
requirementsListProps = props.requirementsListProps,
|
60
52
|
slots = props.slots,
|
61
53
|
status = props.status,
|
@@ -67,9 +59,9 @@ var PasswordField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
67
59
|
isTyping = _useState2[0],
|
68
60
|
setIsTyping = _useState2[1];
|
69
61
|
var checkRequirements = function checkRequirements() {
|
70
|
-
return
|
62
|
+
return _filterInstanceProperty(requirements).call(requirements, function (req) {
|
71
63
|
return req.status === 'default';
|
72
|
-
}).length
|
64
|
+
}).length === 0;
|
73
65
|
};
|
74
66
|
var _useField = useField(_objectSpread({
|
75
67
|
status: status
|
@@ -80,20 +72,16 @@ var PasswordField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
80
72
|
fieldLabelProps = _useField.fieldLabelProps;
|
81
73
|
var isFocused = fieldControlInputProps.isFocused,
|
82
74
|
onChange = fieldControlInputProps.onChange;
|
83
|
-
var inputRef =
|
84
|
-
var popoverRef = useRef();
|
75
|
+
var inputRef = useLocalOrForwardRef(ref);
|
76
|
+
var popoverRef = useRef(null);
|
85
77
|
usePropWarning(props, 'disabled', 'isDisabled');
|
86
|
-
/* istanbul ignore next */
|
87
|
-
useImperativeHandle(ref, function () {
|
88
|
-
return inputRef.current;
|
89
|
-
});
|
90
78
|
var _useProgressiveState = useProgressiveState(isVisibleProp, isVisibleProp),
|
91
79
|
_useProgressiveState2 = _slicedToArray(_useProgressiveState, 2),
|
92
80
|
isVisible = _useProgressiveState2[0],
|
93
81
|
setIsShown = _useProgressiveState2[1];
|
94
82
|
|
95
83
|
// Measure the width of the input to inform the width of the menu (below).
|
96
|
-
var _useState3 = useState(
|
84
|
+
var _useState3 = useState(0),
|
97
85
|
_useState4 = _slicedToArray(_useState3, 2),
|
98
86
|
menuWidth = _useState4[0],
|
99
87
|
setMenuWidth = _useState4[1];
|
@@ -138,12 +126,12 @@ var PasswordField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
138
126
|
var toggleShowPasswordAriaLabel = isVisible ? ARIA_LABELS_FOR_SHOW_PASSWORD_TOGGLE.HIDE : ARIA_LABELS_FOR_SHOW_PASSWORD_TOGGLE.SHOW;
|
139
127
|
var handleToggleShowPassword = function handleToggleShowPassword() {
|
140
128
|
setIsShown(!isVisible);
|
129
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
130
|
+
args[_key] = arguments[_key];
|
131
|
+
}
|
132
|
+
var params = _objectSpread({}, args);
|
141
133
|
if (onVisibleChangeProp) {
|
142
|
-
|
143
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
144
|
-
args[_key] = arguments[_key];
|
145
|
-
}
|
146
|
-
onVisibleChangeProp.apply(void 0, _concatInstanceProperty(_context2 = [!isVisible]).call(_context2, args));
|
134
|
+
onVisibleChangeProp(!isVisible, params);
|
147
135
|
}
|
148
136
|
};
|
149
137
|
var handleInputChange = function handleInputChange(e) {
|
@@ -153,7 +141,7 @@ var PasswordField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
153
141
|
setIsTyping(true);
|
154
142
|
_setTimeout(function () {
|
155
143
|
setIsTyping(false);
|
156
|
-
},
|
144
|
+
}, 300);
|
157
145
|
};
|
158
146
|
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(Box, _extends({
|
159
147
|
variant: "forms.input.fieldContainer"
|
@@ -210,74 +198,6 @@ var PasswordField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
210
198
|
}));
|
211
199
|
}))));
|
212
200
|
});
|
213
|
-
PasswordField.propTypes = _objectSpread(_objectSpread(_objectSpread({
|
214
|
-
/** The rendered label for the field. */
|
215
|
-
label: PropTypes.node,
|
216
|
-
/** Whether or not the password is visible. */
|
217
|
-
isVisible: PropTypes.bool,
|
218
|
-
/** Function that is passed into the IconButton within this component. */
|
219
|
-
onVisibleChange: PropTypes.func,
|
220
|
-
/** Text rendered below the input. */
|
221
|
-
helperText: PropTypes.node,
|
222
|
-
/** The unique identifier for the input element. */
|
223
|
-
id: PropTypes.string,
|
224
|
-
/** The name for the input element. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname). */
|
225
|
-
name: PropTypes.string,
|
226
|
-
/**
|
227
|
-
* Callback fired when the value is changed on the input element.
|
228
|
-
*
|
229
|
-
* @param {object} event The event source of the callback.
|
230
|
-
* You can pull out the new value by accessing `event.target.value` (string).
|
231
|
-
*/
|
232
|
-
onChange: PropTypes.func,
|
233
|
-
/** The value for the input element (controlled). */
|
234
|
-
value: PropTypes.string,
|
235
|
-
/** How the input should handle autocompletion according to the browser. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefautocomplete). The `autocomplete` prop is an alias for this. */
|
236
|
-
autoComplete: PropTypes.string,
|
237
|
-
/** @ignore Alias for `autoComplete` prop. Exists for backwards-compatibility. */
|
238
|
-
autocomplete: PropTypes.string,
|
239
|
-
/** A list of class names to apply to the input element. */
|
240
|
-
className: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
241
|
-
/** The default value for the input element. */
|
242
|
-
defaultValue: PropTypes.string,
|
243
|
-
/** Whether the input element is automatically focused when loaded onto the page. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefautofocus). */
|
244
|
-
hasAutoFocus: PropTypes.bool,
|
245
|
-
/** Whether the field is disabled. */
|
246
|
-
isDisabled: PropTypes.bool,
|
247
|
-
/** Whether the input can be selected, but not changed by the user. */
|
248
|
-
isReadOnly: PropTypes.bool,
|
249
|
-
/** Whether the field is required. */
|
250
|
-
isRequired: PropTypes.bool,
|
251
|
-
/** Add max Length to input value */
|
252
|
-
maxLength: PropTypes.number,
|
253
|
-
/**
|
254
|
-
* Callback fired when focus is lost on the input element.
|
255
|
-
*/
|
256
|
-
onBlur: PropTypes.func,
|
257
|
-
/**
|
258
|
-
* Callback fired when focus is lost on the input element.
|
259
|
-
*/
|
260
|
-
onFocus: PropTypes.func,
|
261
|
-
/** The placeholder text to display in the input element. */
|
262
|
-
placeholder: PropTypes.string,
|
263
|
-
/** Provides a way to insert markup in specified places. */
|
264
|
-
slots: PropTypes.shape({
|
265
|
-
/** The given node will be inserted into the field container. */
|
266
|
-
inContainer: PropTypes.node
|
267
|
-
}),
|
268
|
-
/** Determines the type of input to use. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdeftype). */
|
269
|
-
type: PropTypes.string,
|
270
|
-
/** @ignore Prop that allows testing of the icon button. */
|
271
|
-
viewHiddenIconTestId: PropTypes.string,
|
272
|
-
/** @ignore Prop that allows testing of the icon button. */
|
273
|
-
viewIconTestId: PropTypes.string,
|
274
|
-
/** Array of Requirements and their status. */
|
275
|
-
requirements: PropTypes.arrayOf(PropTypes.shape(_objectSpread({
|
276
|
-
name: PropTypes.string.isRequired
|
277
|
-
}, statusPropTypes))),
|
278
|
-
/** Props object that is spread to the requirements list. */
|
279
|
-
requirementsListProps: PropTypes.shape({})
|
280
|
-
}, statusPropTypes), ariaAttributesBasePropTypes), inputFieldAttributesBasePropTypes);
|
281
201
|
PasswordField.defaultProps = _objectSpread({
|
282
202
|
hasAutoFocus: false,
|
283
203
|
isDisabled: false,
|
@@ -189,6 +189,18 @@ export var FloatLabel = function FloatLabel() {
|
|
189
189
|
labelMode: "float"
|
190
190
|
});
|
191
191
|
};
|
192
|
+
|
193
|
+
// Added to bypass color contrast issue
|
194
|
+
FloatLabel.parameters = {
|
195
|
+
a11y: {
|
196
|
+
config: {
|
197
|
+
rules: [{
|
198
|
+
id: 'color-contrast',
|
199
|
+
enabled: false
|
200
|
+
}]
|
201
|
+
}
|
202
|
+
}
|
203
|
+
};
|
192
204
|
export var LeftLabel = function LeftLabel() {
|
193
205
|
var _useState15 = useState(false),
|
194
206
|
_useState16 = _slicedToArray(_useState15, 2),
|
@@ -10,13 +10,13 @@ import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instan
|
|
10
10
|
import _typeof from "@babel/runtime-corejs3/helpers/esm/typeof";
|
11
11
|
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
|
12
12
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
13
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = _Object$defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof _Symbol ? _Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return _Object$defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = _Object$create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = _Object$getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(IteratorPrototype); function defineIteratorMethods(prototype) { var _context5; _forEachInstanceProperty(_context5 = ["next", "throw", "return"]).call(_context5, function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = _Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return _reverseInstanceProperty(keys).call(keys), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { var _context6; if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context6 = this.tryEntries).call(_context6, resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
13
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = _Object$defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof _Symbol ? _Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return _Object$defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = _Object$create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = _Object$getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = _Object$create(IteratorPrototype); function defineIteratorMethods(prototype) { var _context6; _forEachInstanceProperty(_context6 = ["next", "throw", "return"]).call(_context6, function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], _forEachInstanceProperty(tryLocsList).call(tryLocsList, pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return _Object$setPrototypeOf ? _Object$setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = _Object$create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = _Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return _reverseInstanceProperty(keys).call(keys), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { var _context7; if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, _forEachInstanceProperty(_context7 = this.tryEntries).call(_context7, resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+_sliceInstanceProperty(name).call(name, 1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
14
14
|
import React from 'react';
|
15
15
|
import createCache from '@emotion/cache';
|
16
16
|
import { CacheProvider } from '@emotion/react';
|
17
|
-
import { render, screen } from '@testing-library/react';
|
18
17
|
import userEvent from '@testing-library/user-event';
|
19
|
-
import
|
18
|
+
import statuses from '../../utils/devUtils/constants/statuses';
|
19
|
+
import { act, render, screen } from '../../utils/testUtils/testWrapper';
|
20
20
|
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
21
21
|
import PasswordField from '.';
|
22
22
|
|
@@ -34,41 +34,41 @@ var helperProp = 'helperText';
|
|
34
34
|
var defaultProps = {
|
35
35
|
'data-testid': testId,
|
36
36
|
label: testLabel,
|
37
|
-
|
37
|
+
helperText: helperProp,
|
38
38
|
viewHiddenIconTestId: 'view-hidden-test-id',
|
39
39
|
viewIconTestId: 'view-icon-test-id'
|
40
40
|
};
|
41
41
|
var defaultRequirements = [{
|
42
42
|
name: '6 characters',
|
43
|
-
status:
|
43
|
+
status: statuses.DEFAULT
|
44
44
|
}, {
|
45
45
|
name: '1 UPPERCASE letter',
|
46
|
-
status:
|
46
|
+
status: statuses.DEFAULT
|
47
47
|
}, {
|
48
48
|
name: '1 lowercase letter',
|
49
|
-
status:
|
49
|
+
status: statuses.DEFAULT
|
50
50
|
}, {
|
51
51
|
name: '1 number',
|
52
|
-
status:
|
52
|
+
status: statuses.DEFAULT
|
53
53
|
}, {
|
54
54
|
name: '1 special character',
|
55
|
-
status:
|
55
|
+
status: statuses.DEFAULT
|
56
56
|
}];
|
57
|
-
var
|
57
|
+
var successfulRequirements = [{
|
58
58
|
name: '6 characters',
|
59
|
-
status:
|
59
|
+
status: statuses.SUCCESS
|
60
60
|
}, {
|
61
61
|
name: '1 UPPERCASE letter',
|
62
|
-
status:
|
62
|
+
status: statuses.SUCCESS
|
63
63
|
}, {
|
64
64
|
name: '1 lowercase letter',
|
65
|
-
status:
|
65
|
+
status: statuses.SUCCESS
|
66
66
|
}, {
|
67
67
|
name: '1 number',
|
68
|
-
status:
|
68
|
+
status: statuses.SUCCESS
|
69
69
|
}, {
|
70
70
|
name: '1 special character',
|
71
|
-
status:
|
71
|
+
status: statuses.SUCCESS
|
72
72
|
}];
|
73
73
|
var getComponent = function getComponent() {
|
74
74
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
@@ -193,7 +193,7 @@ test('passing in requirements and focusing renders the requirements popover', fu
|
|
193
193
|
});
|
194
194
|
test('if all requirements are successful, do not render popover', function () {
|
195
195
|
getComponent({
|
196
|
-
requirements:
|
196
|
+
requirements: successfulRequirements
|
197
197
|
});
|
198
198
|
var input = screen.getByRole('textbox');
|
199
199
|
userEvent.click(input);
|
@@ -221,11 +221,6 @@ test('password field with helper text', function () {
|
|
221
221
|
});
|
222
222
|
test('onChange function receives right text', function () {
|
223
223
|
var inputText = '';
|
224
|
-
act(function () {
|
225
|
-
global.setTimeout = jest.fn(function (cb) {
|
226
|
-
return cb();
|
227
|
-
});
|
228
|
-
});
|
229
224
|
var testOnChange = function testOnChange(e) {
|
230
225
|
inputText = e.target.value;
|
231
226
|
};
|
@@ -234,5 +229,55 @@ test('onChange function receives right text', function () {
|
|
234
229
|
});
|
235
230
|
var input = screen.getByRole('textbox');
|
236
231
|
userEvent.type(input, '12345678');
|
232
|
+
jest.useFakeTimers();
|
237
233
|
expect(inputText).toBe('12345678');
|
234
|
+
});
|
235
|
+
test('renders left slot content', function () {
|
236
|
+
var leftSlotContent = ___EmotionJSX("div", {
|
237
|
+
"data-testid": "in-container-slot"
|
238
|
+
}, "Slot Content");
|
239
|
+
getComponent({
|
240
|
+
slots: {
|
241
|
+
inContainer: leftSlotContent
|
242
|
+
}
|
243
|
+
});
|
244
|
+
var leftSlot = screen.getByTestId('in-container-slot');
|
245
|
+
expect(leftSlot).toBeInTheDocument();
|
246
|
+
expect(leftSlot).toHaveTextContent('Slot Content');
|
247
|
+
});
|
248
|
+
test('handleInputChange sets isTyping to true and then false after 300ms', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
249
|
+
var delay, input;
|
250
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
251
|
+
while (1) switch (_context5.prev = _context5.next) {
|
252
|
+
case 0:
|
253
|
+
delay = 300;
|
254
|
+
jest.useFakeTimers();
|
255
|
+
getComponent();
|
256
|
+
input = screen.getByRole('textbox');
|
257
|
+
userEvent.type(input, 'test');
|
258
|
+
expect(input).toHaveValue('test');
|
259
|
+
expect(input.type).toBe('password');
|
260
|
+
act(function () {
|
261
|
+
jest.advanceTimersByTime(delay);
|
262
|
+
});
|
263
|
+
_context5.next = 10;
|
264
|
+
return act(function () {
|
265
|
+
expect(input).toHaveValue('test');
|
266
|
+
}, {
|
267
|
+
timeout: delay + 1
|
268
|
+
});
|
269
|
+
case 10:
|
270
|
+
case "end":
|
271
|
+
return _context5.stop();
|
272
|
+
}
|
273
|
+
}, _callee5);
|
274
|
+
})));
|
275
|
+
test('handleInputChange calls onChange prop', function () {
|
276
|
+
var onChange = jest.fn();
|
277
|
+
getComponent({
|
278
|
+
onChange: onChange
|
279
|
+
});
|
280
|
+
var input = screen.getByRole('textbox');
|
281
|
+
userEvent.type(input, 'test');
|
282
|
+
expect(onChange).toHaveBeenCalled();
|
238
283
|
});
|
package/lib/types/index.js
CHANGED
@@ -36,6 +36,7 @@ export * from './Modal';
|
|
36
36
|
export * from './navBar';
|
37
37
|
export * from './navSideBar';
|
38
38
|
export * from './overlayPanel';
|
39
|
+
export * from './passwordField';
|
39
40
|
export * from './popoverContainer';
|
40
41
|
export * from './popoverMenu';
|
41
42
|
export * from './progressBar';
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -93,7 +93,12 @@ export var FIGMA_LINKS = {
|
|
93
93
|
"default": 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?type=design&node-id=17916-38366&t=rLZVlRDdR1JhehkH-0'
|
94
94
|
},
|
95
95
|
iconButton: {
|
96
|
-
"default": 'https://www.figma.com/file/
|
96
|
+
"default": 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=45365-7042&t=pXTSE3YlGbL0X49N-4',
|
97
|
+
inverted: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=58623-6228&t=pXTSE3YlGbL0X49N-4',
|
98
|
+
withTooltip: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=58623-6053&t=pXTSE3YlGbL0X49N-4',
|
99
|
+
disabled: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=58748-5372&t=pXTSE3YlGbL0X49N-4',
|
100
|
+
sizes: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=58748-5412&t=pXTSE3YlGbL0X49N-4',
|
101
|
+
commonlyUsed: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=58748-6048&t=pXTSE3YlGbL0X49N-4'
|
97
102
|
},
|
98
103
|
inlineEditing: {
|
99
104
|
"default": 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?type=design&node-id=5244-14864&mode=design&t=1pPbrQvGkdMYBNqk-0'
|
@@ -175,5 +180,8 @@ export var FIGMA_LINKS = {
|
|
175
180
|
"default": 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=52102-11051&t=OK8Fy4P3se6BKy0F-4',
|
176
181
|
withoutButton: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=52102-16196&t=OK8Fy4P3se6BKy0F-4',
|
177
182
|
withoutLink: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=52102-16201&t=OK8Fy4P3se6BKy0F-4'
|
183
|
+
},
|
184
|
+
editButton: {
|
185
|
+
"default": 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=58623-6267&t=pXTSE3YlGbL0X49N-4'
|
178
186
|
}
|
179
187
|
};
|