@pingux/astro 1.2.0-alpha.1 → 1.2.0-alpha.10
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/Button/Button.js +5 -2
- package/lib/cjs/components/Button/Button.stories.js +71 -17
- package/lib/cjs/components/Button/Button.test.js +26 -0
- package/lib/cjs/components/CopyText/CopyButton.js +9 -2
- package/lib/cjs/components/HelpHint/HelpHint.js +24 -6
- package/lib/cjs/components/HelpHint/HelpHint.stories.js +57 -0
- package/lib/cjs/components/HelpHint/HelpHint.test.js +80 -0
- package/lib/cjs/components/Messages/Messages.reducer.js +2 -1
- package/lib/cjs/components/Messages/Messages.stories.js +10 -10
- package/lib/cjs/components/Messages/Messages.test.js +15 -1
- package/lib/cjs/components/Messages/index.js +21 -2
- package/lib/cjs/components/MultivaluesField/MultivaluesField.js +3 -1
- package/lib/cjs/components/NumberField/NumberField.js +3 -1
- package/lib/cjs/components/NumberField/NumberField.test.js +7 -0
- package/lib/cjs/components/OverlayPanel/OverlayPanel.js +2 -16
- package/lib/cjs/components/OverlayPanel/OverlayPanel.test.js +44 -0
- package/lib/cjs/components/TextField/TextField.stories.js +79 -2
- package/lib/cjs/hooks/useAriaLabelWarning/useAriaLabelWarning.js +2 -1
- package/lib/cjs/styles/variants/buttons.js +78 -2
- package/lib/cjs/styles/variants/text.js +14 -0
- package/lib/components/Button/Button.js +6 -3
- package/lib/components/Button/Button.stories.js +53 -5
- package/lib/components/Button/Button.test.js +20 -0
- package/lib/components/CopyText/CopyButton.js +7 -2
- package/lib/components/HelpHint/HelpHint.js +25 -5
- package/lib/components/HelpHint/HelpHint.stories.js +34 -0
- package/lib/components/HelpHint/HelpHint.test.js +58 -0
- package/lib/components/Messages/Messages.reducer.js +1 -1
- package/lib/components/Messages/Messages.stories.js +1 -1
- package/lib/components/Messages/Messages.test.js +11 -1
- package/lib/components/Messages/index.js +2 -1
- package/lib/components/MultivaluesField/MultivaluesField.js +3 -1
- package/lib/components/NumberField/NumberField.js +2 -1
- package/lib/components/NumberField/NumberField.test.js +7 -0
- package/lib/components/OverlayPanel/OverlayPanel.js +3 -16
- package/lib/components/OverlayPanel/OverlayPanel.test.js +38 -0
- package/lib/components/TextField/TextField.stories.js +72 -0
- package/lib/hooks/useAriaLabelWarning/useAriaLabelWarning.js +2 -1
- package/lib/styles/variants/buttons.js +78 -2
- package/lib/styles/variants/text.js +14 -0
- package/package.json +2 -2
@@ -9,7 +9,7 @@ import { Item } from '@react-stately/collections';
|
|
9
9
|
import userEvent from '@testing-library/user-event';
|
10
10
|
import axeTest from '../../utils/testUtils/testAxe';
|
11
11
|
import { render, screen } from '../../utils/testUtils/testWrapper';
|
12
|
-
import Messages from '.';
|
12
|
+
import Messages, { messagesReducerStory, multiMessagesReducerStory } from '.';
|
13
13
|
import Button from '../Button';
|
14
14
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
15
15
|
jest.mock('@react-aria/live-announcer');
|
@@ -173,4 +173,14 @@ describe('announcements', function () {
|
|
173
173
|
expect(messages.childElementCount).toBe(1);
|
174
174
|
expect(announce).toHaveBeenCalledWith('New message 1', 'polite');
|
175
175
|
});
|
176
|
+
});
|
177
|
+
test('should render messages with messagesReducerStory', function () {
|
178
|
+
getComponent();
|
179
|
+
messagesReducerStory.actions.showSuccessMessage();
|
180
|
+
expect(screen.getByTestId(testId)).toBeInTheDocument();
|
181
|
+
});
|
182
|
+
test('should render messages with multiMessagesReducerStory', function () {
|
183
|
+
getComponent();
|
184
|
+
multiMessagesReducerStory.actions.showSuccessMessage();
|
185
|
+
expect(screen.getByTestId(testId)).toBeInTheDocument();
|
176
186
|
});
|
@@ -22,6 +22,7 @@ import { useNumberField } from '@react-aria/numberfield';
|
|
22
22
|
import { useNumberFieldState } from '@react-stately/numberfield';
|
23
23
|
import { useLocale } from '@react-aria/i18n';
|
24
24
|
import { mergeProps } from '@react-aria/utils';
|
25
|
+
import omit from 'lodash/omit';
|
25
26
|
import statuses from '../../utils/devUtils/constants/statuses';
|
26
27
|
import { Box, FieldHelperText, Icon, IconButton, Input, Label } from '../../index';
|
27
28
|
import { useField, usePropWarning } from '../../hooks';
|
@@ -94,7 +95,7 @@ var NumberField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
94
95
|
ref: inputRef // we don't want to merge this props, we want to
|
95
96
|
// overwrite them like defaultValue, value, ect.
|
96
97
|
|
97
|
-
}, fieldControlProps, inputProps)), ControlArrows), helperText && ___EmotionJSX(FieldHelperText, {
|
98
|
+
}, fieldControlProps, omit(inputProps, 'name'))), ControlArrows), helperText && ___EmotionJSX(FieldHelperText, {
|
98
99
|
status: status
|
99
100
|
}, helperText)));
|
100
101
|
});
|
@@ -128,4 +128,11 @@ test('increment and decrement buttons shouldn\'t be able to be focused via keybo
|
|
128
128
|
expect(screen.getByLabelText('arrow-up')).not.toHaveFocus();
|
129
129
|
userEvent.tab();
|
130
130
|
expect(screen.getByLabelText('arrow-down')).not.toHaveFocus();
|
131
|
+
});
|
132
|
+
test('number field input receiving name attribute', function () {
|
133
|
+
var testName = 'testName';
|
134
|
+
getComponent({
|
135
|
+
name: testName
|
136
|
+
});
|
137
|
+
expect(screen.getByLabelText(testLabel)).toHaveAttribute('name', testName);
|
131
138
|
});
|
@@ -1,9 +1,8 @@
|
|
1
1
|
import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
|
2
2
|
import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
3
3
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
4
|
-
import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
5
4
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";
|
6
|
-
import React, { forwardRef, useRef, useImperativeHandle
|
5
|
+
import React, { forwardRef, useRef, useImperativeHandle } from 'react';
|
7
6
|
import PropTypes from 'prop-types';
|
8
7
|
import { FocusScope } from '@react-aria/focus';
|
9
8
|
import Box from '../Box';
|
@@ -26,14 +25,8 @@ var OverlayPanel = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
26
25
|
onClose = _useOverlayPanelState.onClose;
|
27
26
|
|
28
27
|
var overlayPanelRef = useRef();
|
29
|
-
|
30
|
-
var _useState = useState(true),
|
31
|
-
_useState2 = _slicedToArray(_useState, 2),
|
32
|
-
contain = _useState2[0],
|
33
|
-
setIsContained = _useState2[1];
|
34
28
|
/* istanbul ignore next */
|
35
29
|
|
36
|
-
|
37
30
|
useImperativeHandle(ref, function () {
|
38
31
|
return overlayPanelRef.current;
|
39
32
|
});
|
@@ -47,18 +40,12 @@ var OverlayPanel = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
47
40
|
e.stopPropagation();
|
48
41
|
|
49
42
|
if (e.key === 'Escape') {
|
50
|
-
|
43
|
+
onClose(state, triggerRef, onCloseProp);
|
51
44
|
}
|
52
45
|
};
|
53
46
|
|
54
|
-
useEffect(function () {
|
55
|
-
if (!contain && onClose) {
|
56
|
-
onClose(state, triggerRef, onCloseProp);
|
57
|
-
}
|
58
|
-
}, [contain]);
|
59
47
|
return ___EmotionJSX(FocusScope, {
|
60
|
-
autoFocus: true
|
61
|
-
contain: contain
|
48
|
+
autoFocus: true
|
62
49
|
}, ___EmotionJSX(Box, _extends({
|
63
50
|
variant: "overlayPanel.overlayPanel",
|
64
51
|
ref: overlayPanelRef
|
@@ -60,6 +60,13 @@ test('onClose callback fires when provided', function () {
|
|
60
60
|
});
|
61
61
|
expect(onClose).toHaveBeenCalled();
|
62
62
|
});
|
63
|
+
test('custom classname can be passed', function () {
|
64
|
+
getComponent({
|
65
|
+
className: 'testing-class'
|
66
|
+
});
|
67
|
+
var overlayPanel = screen.getByTestId(testId);
|
68
|
+
expect(overlayPanel).toHaveClass('testing-class');
|
69
|
+
});
|
63
70
|
test('neither callback fires when not provided', function () {
|
64
71
|
var onClose = jest.fn();
|
65
72
|
getComponent({
|
@@ -110,4 +117,35 @@ test('triggerRef.current.focus() fires when provided', function () {
|
|
110
117
|
charCode: 27
|
111
118
|
});
|
112
119
|
expect(focusFunction).toHaveBeenCalled();
|
120
|
+
});
|
121
|
+
test('triggerRef.current.focus() does not fire when key other than esc is pressed', function () {
|
122
|
+
var onClose = jest.fn();
|
123
|
+
var focusFunction = jest.fn();
|
124
|
+
var state = {
|
125
|
+
close: onClose
|
126
|
+
};
|
127
|
+
var triggerRef = {
|
128
|
+
current: {
|
129
|
+
focus: focusFunction
|
130
|
+
}
|
131
|
+
};
|
132
|
+
getComponent({
|
133
|
+
state: state,
|
134
|
+
children: ___EmotionJSX("div", null, "Test"),
|
135
|
+
triggerRef: triggerRef
|
136
|
+
});
|
137
|
+
var overlayPanel = screen.getByTestId(testId);
|
138
|
+
fireEvent.keyDown(overlayPanel, {
|
139
|
+
key: 'KeyA',
|
140
|
+
code: 'KeyA',
|
141
|
+
keyCode: 65,
|
142
|
+
charCode: 65
|
143
|
+
});
|
144
|
+
fireEvent.keyUp(overlayPanel, {
|
145
|
+
key: 'KeyA',
|
146
|
+
code: 'KeyA',
|
147
|
+
keyCode: 65,
|
148
|
+
charCode: 65
|
149
|
+
});
|
150
|
+
expect(focusFunction).not.toHaveBeenCalled();
|
113
151
|
});
|
@@ -8,6 +8,8 @@ import TextField from '.';
|
|
8
8
|
import { modes as labelModes } from '../Label/constants';
|
9
9
|
import statuses from '../../utils/devUtils/constants/statuses.js';
|
10
10
|
import Box from '../Box';
|
11
|
+
import useCopyToClipboard from '../../hooks/useCopyToClipboard';
|
12
|
+
import CopyButton from '../CopyText/CopyButton';
|
11
13
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
12
14
|
export default {
|
13
15
|
title: 'Form/TextField',
|
@@ -186,4 +188,74 @@ export var MaxLength = function MaxLength() {
|
|
186
188
|
label: "Example label",
|
187
189
|
maxLength: 9
|
188
190
|
});
|
191
|
+
};
|
192
|
+
export var WithSlots = function WithSlots() {
|
193
|
+
var _useState5 = useState("[{ 'type': 'work', 'streetAddress': 'San Antonio MI 47096' },{ 'type': 'home', 'streetAddress': 'Santa Rosa MN 98804' }]"),
|
194
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
195
|
+
addressesValue = _useState6[0],
|
196
|
+
setAddressesValue = _useState6[1];
|
197
|
+
|
198
|
+
var _useState7 = useState("[{ 'status': 'inactive', 'subject': 'example@pingidentity.com' },{ 'status': 'active', 'subject': 'john@pingidentity.com' }]"),
|
199
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
200
|
+
jsonValue = _useState8[0],
|
201
|
+
setJsonValue = _useState8[1];
|
202
|
+
|
203
|
+
var copyAddressesToClipboard = useCopyToClipboard(addressesValue);
|
204
|
+
var copyJsonToClipboard = useCopyToClipboard(jsonValue);
|
205
|
+
var buttonSx = {
|
206
|
+
position: 'absolute',
|
207
|
+
right: 0,
|
208
|
+
top: '5px'
|
209
|
+
};
|
210
|
+
var containerSx = {
|
211
|
+
sx: {
|
212
|
+
'& input': {
|
213
|
+
paddingRight: '40px'
|
214
|
+
}
|
215
|
+
}
|
216
|
+
};
|
217
|
+
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(TextField, {
|
218
|
+
label: "Multiple Addresses",
|
219
|
+
labelMode: "float",
|
220
|
+
onChange: function onChange(e) {
|
221
|
+
return setAddressesValue(e.target.value);
|
222
|
+
},
|
223
|
+
value: addressesValue,
|
224
|
+
containerProps: containerSx,
|
225
|
+
slots: {
|
226
|
+
inContainer: ___EmotionJSX(CopyButton, {
|
227
|
+
onPress: copyAddressesToClipboard,
|
228
|
+
sx: buttonSx,
|
229
|
+
iconProps: {
|
230
|
+
sx: {
|
231
|
+
path: {
|
232
|
+
fill: 'active'
|
233
|
+
}
|
234
|
+
}
|
235
|
+
}
|
236
|
+
})
|
237
|
+
},
|
238
|
+
mb: 30
|
239
|
+
}), ___EmotionJSX(TextField, {
|
240
|
+
label: "Example JSON",
|
241
|
+
labelMode: "float",
|
242
|
+
onChange: function onChange(e) {
|
243
|
+
return setJsonValue(e.target.value);
|
244
|
+
},
|
245
|
+
value: jsonValue,
|
246
|
+
containerProps: containerSx,
|
247
|
+
slots: {
|
248
|
+
inContainer: ___EmotionJSX(CopyButton, {
|
249
|
+
onPress: copyJsonToClipboard,
|
250
|
+
sx: buttonSx,
|
251
|
+
iconProps: {
|
252
|
+
sx: {
|
253
|
+
path: {
|
254
|
+
fill: 'active'
|
255
|
+
}
|
256
|
+
}
|
257
|
+
}
|
258
|
+
})
|
259
|
+
}
|
260
|
+
}));
|
189
261
|
};
|
@@ -7,8 +7,9 @@ import { useEffect } from 'react';
|
|
7
7
|
*/
|
8
8
|
|
9
9
|
var useAriaLabelWarning = function useAriaLabelWarning(component, ariaLabel) {
|
10
|
+
var condition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
10
11
|
useEffect(function () {
|
11
|
-
if (process.env.NODE_ENV === 'development' && !ariaLabel) {
|
12
|
+
if (process.env.NODE_ENV === 'development' && condition && !ariaLabel) {
|
12
13
|
// eslint-disable-next-line no-console
|
13
14
|
console.warn("".concat(component, " requires an aria-label"), '\n', '\n', 'NOTE: This is a development-only warning and will not display in production.');
|
14
15
|
}
|
@@ -295,6 +295,11 @@ var helpHint = _objectSpread(_objectSpread({}, iconButton), {}, {
|
|
295
295
|
ml: '5px',
|
296
296
|
maxWidth: '13px',
|
297
297
|
maxHeight: '14px',
|
298
|
+
borderRadius: '5.5px',
|
299
|
+
'svg': {
|
300
|
+
'height': '100%',
|
301
|
+
mb: 0.75
|
302
|
+
},
|
298
303
|
'path': {
|
299
304
|
fill: 'neutral.20'
|
300
305
|
},
|
@@ -354,7 +359,7 @@ var chipDeleteButton = {
|
|
354
359
|
borderRadius: '50%',
|
355
360
|
cursor: 'pointer',
|
356
361
|
height: 14,
|
357
|
-
|
362
|
+
mx: '3px !important',
|
358
363
|
p: 0,
|
359
364
|
width: 14,
|
360
365
|
'&.is-focused, &.is-hovered': {
|
@@ -534,6 +539,75 @@ var tooltipInline = _objectSpread(_objectSpread({}, text), {}, {
|
|
534
539
|
}
|
535
540
|
});
|
536
541
|
|
542
|
+
var defaultVariant = _objectSpread(_objectSpread({}, base), {}, {
|
543
|
+
bg: 'white',
|
544
|
+
border: '1px solid',
|
545
|
+
borderColor: 'active',
|
546
|
+
'&.is-hovered': _objectSpread({}, defaultHover),
|
547
|
+
'&.is-pressed': _objectSpread({}, defaultActive),
|
548
|
+
'&.is-focused': _objectSpread({}, defaultFocus)
|
549
|
+
});
|
550
|
+
|
551
|
+
var filter = _objectSpread(_objectSpread({}, defaultVariant), {}, {
|
552
|
+
px: 'sm',
|
553
|
+
borderColor: 'neutral.80',
|
554
|
+
height: 40,
|
555
|
+
color: 'active',
|
556
|
+
display: 'flex'
|
557
|
+
});
|
558
|
+
|
559
|
+
var colorBlock = {
|
560
|
+
bg: 'neutral.95',
|
561
|
+
border: '1px solid',
|
562
|
+
borderColor: 'neutral.90',
|
563
|
+
borderRadius: 10,
|
564
|
+
outline: 'none',
|
565
|
+
cursor: 'pointer',
|
566
|
+
width: 150,
|
567
|
+
minHeight: 40,
|
568
|
+
p: '5px 15px',
|
569
|
+
display: 'flex',
|
570
|
+
justifyContent: 'space-between',
|
571
|
+
alignItems: 'center',
|
572
|
+
'&.is-hovered': {
|
573
|
+
bg: 'neutral.80'
|
574
|
+
},
|
575
|
+
'&.is-focused': _objectSpread({}, defaultFocus),
|
576
|
+
'&.is-pressed': {
|
577
|
+
bg: 'neutral.60',
|
578
|
+
borderColor: 'neutral.60'
|
579
|
+
},
|
580
|
+
'& span': {
|
581
|
+
color: 'text.primary',
|
582
|
+
textAlign: 'left'
|
583
|
+
},
|
584
|
+
'&>div': {
|
585
|
+
alignItems: 'baseline'
|
586
|
+
},
|
587
|
+
'&>svg': {
|
588
|
+
color: 'text.secondary',
|
589
|
+
fill: 'text.secondary'
|
590
|
+
},
|
591
|
+
'&.is-configured': {
|
592
|
+
bg: 'active',
|
593
|
+
borderColor: 'active',
|
594
|
+
'& span': {
|
595
|
+
color: 'white'
|
596
|
+
},
|
597
|
+
'&>svg': {
|
598
|
+
color: 'white',
|
599
|
+
fill: 'white'
|
600
|
+
}
|
601
|
+
},
|
602
|
+
'&.is-configured.is-hovered': {
|
603
|
+
bg: 'accent.40',
|
604
|
+
borderColor: 'accent.40'
|
605
|
+
},
|
606
|
+
'&.is-configured.is-pressed': {
|
607
|
+
bg: 'accent.20',
|
608
|
+
borderColor: 'accent.20'
|
609
|
+
}
|
610
|
+
};
|
537
611
|
export default {
|
538
612
|
accordionHeader: accordionHeader,
|
539
613
|
chipDeleteButton: chipDeleteButton,
|
@@ -554,6 +628,7 @@ export default {
|
|
554
628
|
environmentBreadcrumb: environmentBreadcrumb,
|
555
629
|
expandableRow: expandableRow,
|
556
630
|
fileInputField: fileInputField,
|
631
|
+
filter: filter,
|
557
632
|
iconButton: iconButton,
|
558
633
|
imageUpload: imageUpload,
|
559
634
|
inline: inline,
|
@@ -573,5 +648,6 @@ export default {
|
|
573
648
|
invertedSquare: invertedSquare,
|
574
649
|
tooltipChip: tooltipChip,
|
575
650
|
tooltipIconButton: tooltipIconButton,
|
576
|
-
tooltipInline: tooltipInline
|
651
|
+
tooltipInline: tooltipInline,
|
652
|
+
colorBlock: colorBlock
|
577
653
|
};
|
@@ -158,6 +158,20 @@ export var text = {
|
|
158
158
|
color: 'accent.30',
|
159
159
|
fontFamily: 'standard'
|
160
160
|
}),
|
161
|
+
buttonTitle: _objectSpread(_objectSpread({}, wordWrap), {}, {
|
162
|
+
fontSize: 'xs',
|
163
|
+
fontWeight: 0,
|
164
|
+
color: 'text.primary',
|
165
|
+
fontFamily: 'standard',
|
166
|
+
lineHeight: '13px'
|
167
|
+
}),
|
168
|
+
buttonSubtitle: _objectSpread(_objectSpread({}, wordWrap), {}, {
|
169
|
+
fontSize: 'sm',
|
170
|
+
fontWeight: 3,
|
171
|
+
color: 'text.primary',
|
172
|
+
fontFamily: 'standard',
|
173
|
+
lineHeight: '16px'
|
174
|
+
}),
|
161
175
|
capsLabel: _objectSpread(_objectSpread({}, wordWrap), {}, {
|
162
176
|
color: 'text.secondary',
|
163
177
|
textTransform: 'uppercase',
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pingux/astro",
|
3
|
-
"version": "1.2.0-alpha.
|
3
|
+
"version": "1.2.0-alpha.10",
|
4
4
|
"description": "PingUX themeable React component library",
|
5
5
|
"author": "uxdev@pingidentity.com",
|
6
6
|
"license": "Apache-2.0",
|
@@ -132,7 +132,7 @@
|
|
132
132
|
"lodash": "^4.17.21",
|
133
133
|
"mdi-react": "^7.4.0",
|
134
134
|
"moment": "^2.29.1",
|
135
|
-
"prism-react-renderer": "
|
135
|
+
"prism-react-renderer": "1.2.1",
|
136
136
|
"prop-types": "^15.7.2",
|
137
137
|
"react-calendar": "^3.4.0",
|
138
138
|
"react-color": "^2.19.3",
|