@pingux/astro 1.5.0-alpha.1 → 1.5.1-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 +17 -0
- package/lib/cjs/components/CodeView/CodeView.js +1 -1
- package/lib/cjs/components/CodeView/CodeView.test.js +22 -27
- package/lib/cjs/components/CopyText/CopyText.js +1 -1
- package/lib/cjs/components/TextAreaField/TextAreaField.js +14 -7
- package/lib/cjs/styles/variants/boxes.js +10 -1
- package/lib/cjs/styles/variants/codeView.js +2 -1
- package/lib/components/CodeView/CodeView.js +1 -1
- package/lib/components/CodeView/CodeView.test.js +22 -23
- package/lib/components/CopyText/CopyText.js +1 -1
- package/lib/components/TextAreaField/TextAreaField.js +17 -7
- package/lib/styles/variants/boxes.js +10 -1
- package/lib/styles/variants/codeView.js +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,23 @@
|
|
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.5.0](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.4.1...@pingux/astro@1.5.0) (2022-03-22)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* [UIP-5282] Code View discrepancies ([9e483b1](https://gitlab.corp.pingidentity.com/ux/pingux/commit/9e483b1078cc47a21c40fce1d256230dc6d57d65))
|
12
|
+
|
13
|
+
|
14
|
+
### Features
|
15
|
+
|
16
|
+
* [UIP-5162] Add MultiselectFilter component ([b624104](https://gitlab.corp.pingidentity.com/ux/pingux/commit/b624104fe17352d7975498378bc605562698916a))
|
17
|
+
* [UIP-5163] Tab with Popover menu ([2334558](https://gitlab.corp.pingidentity.com/ux/pingux/commit/23345584dfd0bcc40700cb9925fa908002388de2))
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
|
6
23
|
## [1.4.1](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.4.0...@pingux/astro@1.4.1) (2022-03-18)
|
7
24
|
|
8
25
|
**Note:** Version bump only for package @pingux/astro
|
@@ -57,8 +57,21 @@ var textValue = "\nexport const Default = args => (\n <>\n <Text sx={{ fontW
|
|
57
57
|
var getComponent = function getComponent() {
|
58
58
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
59
59
|
return (0, _testWrapper.render)((0, _react2.jsx)(_.CodeView, (0, _extends2["default"])({}, defaultProps, props), textValue));
|
60
|
-
};
|
60
|
+
};
|
61
61
|
|
62
|
+
beforeEach(function () {
|
63
|
+
var mockClipboard = {
|
64
|
+
writeText: jest.fn()
|
65
|
+
};
|
66
|
+
global.navigator.clipboard = mockClipboard;
|
67
|
+
global.document.execCommand = jest.fn();
|
68
|
+
global.document.execCommand.mockReturnValue(true);
|
69
|
+
});
|
70
|
+
afterEach(function () {
|
71
|
+
jest.resetAllMocks();
|
72
|
+
global.navigator.clipboard = originalClipboard;
|
73
|
+
global.document.execCommand = originalExecCommand;
|
74
|
+
}); // Need to be added to each test file to test accessibility using axe.
|
62
75
|
|
63
76
|
(0, _testAxe["default"])(getComponent);
|
64
77
|
test('renders component in the default state', function () {
|
@@ -69,29 +82,22 @@ test('renders component in the default state', function () {
|
|
69
82
|
expect(container).toBeInstanceOf(HTMLDivElement);
|
70
83
|
expect(container).toBeInTheDocument();
|
71
84
|
});
|
72
|
-
test('
|
85
|
+
test('copy button is hovered and renders tooltip via mouse', function () {
|
73
86
|
getComponent();
|
74
87
|
|
75
|
-
var
|
88
|
+
var copyBtn = _testWrapper.screen.getByLabelText('copy');
|
76
89
|
|
77
|
-
|
90
|
+
expect(copyBtn).not.toHaveFocus();
|
78
91
|
|
79
|
-
|
92
|
+
_userEvent["default"].hover(copyBtn);
|
80
93
|
|
94
|
+
expect(copyBtn).toHaveClass('is-hovered');
|
81
95
|
expect(_testWrapper.screen.queryByRole('tooltip')).toBeInTheDocument();
|
82
96
|
expect(_testWrapper.screen.queryByRole('tooltip')).toHaveTextContent('Copy to clipboard');
|
83
97
|
});
|
84
|
-
test('
|
98
|
+
test('copy button is focused and renders tooltip via keyboard', function () {
|
85
99
|
getComponent();
|
86
100
|
|
87
|
-
var container = _testWrapper.screen.getByTestId(testId);
|
88
|
-
|
89
|
-
expect(container).not.toHaveFocus();
|
90
|
-
|
91
|
-
_userEvent["default"].tab();
|
92
|
-
|
93
|
-
expect(container).toHaveFocus();
|
94
|
-
|
95
101
|
var copyBtn = _testWrapper.screen.getByLabelText('copy');
|
96
102
|
|
97
103
|
expect(copyBtn).not.toHaveFocus();
|
@@ -100,6 +106,8 @@ test('content and copy button are focused via keyboard', function () {
|
|
100
106
|
|
101
107
|
expect(copyBtn).toHaveFocus();
|
102
108
|
expect(copyBtn).toHaveClass('is-focused');
|
109
|
+
expect(_testWrapper.screen.queryByRole('tooltip')).toBeInTheDocument();
|
110
|
+
expect(_testWrapper.screen.queryByRole('tooltip')).toHaveTextContent('Copy to clipboard');
|
103
111
|
});
|
104
112
|
test('doesn\'t render copy button and tooltip with prop hasNoCopyButton', function () {
|
105
113
|
getComponent({
|
@@ -126,19 +134,6 @@ test('renders line numbers with prop hasLineNumbers', function () {
|
|
126
134
|
expect(_testWrapper.screen.queryByText('1')).toBeInTheDocument();
|
127
135
|
expect(_testWrapper.screen.queryByText(linesLength)).toBeInTheDocument();
|
128
136
|
});
|
129
|
-
beforeEach(function () {
|
130
|
-
var mockClipboard = {
|
131
|
-
writeText: jest.fn()
|
132
|
-
};
|
133
|
-
global.navigator.clipboard = mockClipboard;
|
134
|
-
global.document.execCommand = jest.fn();
|
135
|
-
global.document.execCommand.mockReturnValue(true);
|
136
|
-
});
|
137
|
-
afterEach(function () {
|
138
|
-
jest.resetAllMocks();
|
139
|
-
global.navigator.clipboard = originalClipboard;
|
140
|
-
global.document.execCommand = originalExecCommand;
|
141
|
-
});
|
142
137
|
test('click on copy button copies data to the clipboard', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
143
138
|
var button;
|
144
139
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
@@ -129,7 +129,7 @@ var CopyText = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
129
129
|
ref: ref,
|
130
130
|
isRow: true,
|
131
131
|
variant: "boxes.copy"
|
132
|
-
}, others), content, (0, _react2.jsx)(TooltipWrapper, {
|
132
|
+
}, wrapperProps, others), content, (0, _react2.jsx)(TooltipWrapper, {
|
133
133
|
isOpen: isTooltipOpen,
|
134
134
|
tooltip: tooltip
|
135
135
|
}, (0, _react2.jsx)(_CopyButton["default"], (0, _extends2["default"])({
|
@@ -80,6 +80,7 @@ var TextAreaField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
80
80
|
|
81
81
|
var textAreaRef = (0, _react.useRef)();
|
82
82
|
var labelRef = (0, _react.useRef)();
|
83
|
+
var labelWrapperRef = (0, _react.useRef)();
|
83
84
|
var containerRef = (0, _react.useRef)();
|
84
85
|
var inputContainerRef = (0, _react.useRef)();
|
85
86
|
var slotContainer = (0, _react.useRef)();
|
@@ -94,6 +95,7 @@ var TextAreaField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
94
95
|
var resizeFloatLabel = function resizeFloatLabel() {
|
95
96
|
/* istanbul ignore next */
|
96
97
|
labelRef.current.style.width = textAreaRef.current.style.width;
|
98
|
+
labelWrapperRef.current.style.width = "".concat(textAreaRef.current.clientWidth - 2, "px");
|
97
99
|
};
|
98
100
|
/* istanbul ignore next */
|
99
101
|
|
@@ -134,19 +136,24 @@ var TextAreaField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
134
136
|
thisRef.removeEventListener('mousemove', props.resizeCallback ? props.resizeCallback : resizeFloatLabel);
|
135
137
|
};
|
136
138
|
}, [props.isUnresizable, props.labelMode, props.resizeCallback]);
|
139
|
+
var labelNode = (0, _react2.jsx)(_Label["default"], (0, _extends2["default"])({
|
140
|
+
ref: labelRef
|
141
|
+
}, fieldLabelProps, {
|
142
|
+
sx: isLabelHigher && {
|
143
|
+
gridRow: '1/5'
|
144
|
+
}
|
145
|
+
}));
|
146
|
+
var wrappedLabel = (0, _react2.jsx)(_Box["default"], {
|
147
|
+
variant: "boxes.floatLabelWrapper",
|
148
|
+
ref: labelWrapperRef
|
149
|
+
}, labelNode);
|
137
150
|
return (0, _react2.jsx)(_Box["default"], (0, _extends2["default"])({
|
138
151
|
variant: "forms.input.wrapper"
|
139
152
|
}, fieldContainerProps, {
|
140
153
|
sx: _objectSpread(_objectSpread({}, columnStyleProps === null || columnStyleProps === void 0 ? void 0 : columnStyleProps.sx), fieldContainerProps === null || fieldContainerProps === void 0 ? void 0 : fieldContainerProps.sx),
|
141
154
|
ref: containerRef,
|
142
155
|
maxWidth: "100%"
|
143
|
-
}), (0, _react2.jsx)(
|
144
|
-
ref: labelRef
|
145
|
-
}, fieldLabelProps, {
|
146
|
-
sx: isLabelHigher && {
|
147
|
-
gridRow: '1/5'
|
148
|
-
}
|
149
|
-
})), (0, _react2.jsx)(_Box["default"], {
|
156
|
+
}), props.labelMode === 'float' ? wrappedLabel : labelNode, (0, _react2.jsx)(_Box["default"], {
|
150
157
|
isRow: true,
|
151
158
|
variant: "forms.input.container",
|
152
159
|
className: fieldControlProps.className,
|
@@ -299,6 +299,14 @@ var fileInputFieldWrapper = {
|
|
299
299
|
alignItems: 'center'
|
300
300
|
}
|
301
301
|
};
|
302
|
+
var floatLabelWrapper = {
|
303
|
+
backgroundColor: 'white',
|
304
|
+
position: 'relative',
|
305
|
+
height: '17px',
|
306
|
+
bottom: '-18px',
|
307
|
+
left: '3px',
|
308
|
+
zIndex: 2
|
309
|
+
};
|
302
310
|
var _default = {
|
303
311
|
base: base,
|
304
312
|
card: card,
|
@@ -317,6 +325,7 @@ var _default = {
|
|
317
325
|
radioContainer: radioContainer,
|
318
326
|
scrollbox: scrollbox,
|
319
327
|
topShadowScrollbox: topShadowScrollbox,
|
320
|
-
bottomShadowScrollbox: bottomShadowScrollbox
|
328
|
+
bottomShadowScrollbox: bottomShadowScrollbox,
|
329
|
+
floatLabelWrapper: floatLabelWrapper
|
321
330
|
};
|
322
331
|
exports["default"] = _default;
|
@@ -35,8 +35,21 @@ var textValue = "\nexport const Default = args => (\n <>\n <Text sx={{ fontW
|
|
35
35
|
var getComponent = function getComponent() {
|
36
36
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
37
37
|
return render(___EmotionJSX(CodeView, _extends({}, defaultProps, props), textValue));
|
38
|
-
};
|
38
|
+
};
|
39
39
|
|
40
|
+
beforeEach(function () {
|
41
|
+
var mockClipboard = {
|
42
|
+
writeText: jest.fn()
|
43
|
+
};
|
44
|
+
global.navigator.clipboard = mockClipboard;
|
45
|
+
global.document.execCommand = jest.fn();
|
46
|
+
global.document.execCommand.mockReturnValue(true);
|
47
|
+
});
|
48
|
+
afterEach(function () {
|
49
|
+
jest.resetAllMocks();
|
50
|
+
global.navigator.clipboard = originalClipboard;
|
51
|
+
global.document.execCommand = originalExecCommand;
|
52
|
+
}); // Need to be added to each test file to test accessibility using axe.
|
40
53
|
|
41
54
|
axeTest(getComponent);
|
42
55
|
test('renders component in the default state', function () {
|
@@ -45,25 +58,24 @@ test('renders component in the default state', function () {
|
|
45
58
|
expect(container).toBeInstanceOf(HTMLDivElement);
|
46
59
|
expect(container).toBeInTheDocument();
|
47
60
|
});
|
48
|
-
test('
|
61
|
+
test('copy button is hovered and renders tooltip via mouse', function () {
|
49
62
|
getComponent();
|
50
|
-
var
|
51
|
-
|
52
|
-
|
63
|
+
var copyBtn = screen.getByLabelText('copy');
|
64
|
+
expect(copyBtn).not.toHaveFocus();
|
65
|
+
userEvent.hover(copyBtn);
|
66
|
+
expect(copyBtn).toHaveClass('is-hovered');
|
53
67
|
expect(screen.queryByRole('tooltip')).toBeInTheDocument();
|
54
68
|
expect(screen.queryByRole('tooltip')).toHaveTextContent('Copy to clipboard');
|
55
69
|
});
|
56
|
-
test('
|
70
|
+
test('copy button is focused and renders tooltip via keyboard', function () {
|
57
71
|
getComponent();
|
58
|
-
var container = screen.getByTestId(testId);
|
59
|
-
expect(container).not.toHaveFocus();
|
60
|
-
userEvent.tab();
|
61
|
-
expect(container).toHaveFocus();
|
62
72
|
var copyBtn = screen.getByLabelText('copy');
|
63
73
|
expect(copyBtn).not.toHaveFocus();
|
64
74
|
userEvent.tab();
|
65
75
|
expect(copyBtn).toHaveFocus();
|
66
76
|
expect(copyBtn).toHaveClass('is-focused');
|
77
|
+
expect(screen.queryByRole('tooltip')).toBeInTheDocument();
|
78
|
+
expect(screen.queryByRole('tooltip')).toHaveTextContent('Copy to clipboard');
|
67
79
|
});
|
68
80
|
test('doesn\'t render copy button and tooltip with prop hasNoCopyButton', function () {
|
69
81
|
getComponent({
|
@@ -86,19 +98,6 @@ test('renders line numbers with prop hasLineNumbers', function () {
|
|
86
98
|
expect(screen.queryByText('1')).toBeInTheDocument();
|
87
99
|
expect(screen.queryByText(linesLength)).toBeInTheDocument();
|
88
100
|
});
|
89
|
-
beforeEach(function () {
|
90
|
-
var mockClipboard = {
|
91
|
-
writeText: jest.fn()
|
92
|
-
};
|
93
|
-
global.navigator.clipboard = mockClipboard;
|
94
|
-
global.document.execCommand = jest.fn();
|
95
|
-
global.document.execCommand.mockReturnValue(true);
|
96
|
-
});
|
97
|
-
afterEach(function () {
|
98
|
-
jest.resetAllMocks();
|
99
|
-
global.navigator.clipboard = originalClipboard;
|
100
|
-
global.document.execCommand = originalExecCommand;
|
101
|
-
});
|
102
101
|
test('click on copy button copies data to the clipboard', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
103
102
|
var button;
|
104
103
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
@@ -106,7 +106,7 @@ var CopyText = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
106
106
|
ref: ref,
|
107
107
|
isRow: true,
|
108
108
|
variant: "boxes.copy"
|
109
|
-
}, others), content, ___EmotionJSX(TooltipWrapper, {
|
109
|
+
}, wrapperProps, others), content, ___EmotionJSX(TooltipWrapper, {
|
110
110
|
isOpen: isTooltipOpen,
|
111
111
|
tooltip: tooltip
|
112
112
|
}, ___EmotionJSX(CopyButton, _extends({
|
@@ -47,6 +47,7 @@ var TextAreaField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
47
47
|
|
48
48
|
var textAreaRef = useRef();
|
49
49
|
var labelRef = useRef();
|
50
|
+
var labelWrapperRef = useRef();
|
50
51
|
var containerRef = useRef();
|
51
52
|
var inputContainerRef = useRef();
|
52
53
|
var slotContainer = useRef();
|
@@ -61,6 +62,7 @@ var TextAreaField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
61
62
|
var resizeFloatLabel = function resizeFloatLabel() {
|
62
63
|
/* istanbul ignore next */
|
63
64
|
labelRef.current.style.width = textAreaRef.current.style.width;
|
65
|
+
labelWrapperRef.current.style.width = "".concat(textAreaRef.current.clientWidth - 2, "px");
|
64
66
|
};
|
65
67
|
/* istanbul ignore next */
|
66
68
|
|
@@ -101,19 +103,27 @@ var TextAreaField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
101
103
|
thisRef.removeEventListener('mousemove', props.resizeCallback ? props.resizeCallback : resizeFloatLabel);
|
102
104
|
};
|
103
105
|
}, [props.isUnresizable, props.labelMode, props.resizeCallback]);
|
106
|
+
|
107
|
+
var labelNode = ___EmotionJSX(Label, _extends({
|
108
|
+
ref: labelRef
|
109
|
+
}, fieldLabelProps, {
|
110
|
+
sx: isLabelHigher && {
|
111
|
+
gridRow: '1/5'
|
112
|
+
}
|
113
|
+
}));
|
114
|
+
|
115
|
+
var wrappedLabel = ___EmotionJSX(Box, {
|
116
|
+
variant: "boxes.floatLabelWrapper",
|
117
|
+
ref: labelWrapperRef
|
118
|
+
}, labelNode);
|
119
|
+
|
104
120
|
return ___EmotionJSX(Box, _extends({
|
105
121
|
variant: "forms.input.wrapper"
|
106
122
|
}, fieldContainerProps, {
|
107
123
|
sx: _objectSpread(_objectSpread({}, columnStyleProps === null || columnStyleProps === void 0 ? void 0 : columnStyleProps.sx), fieldContainerProps === null || fieldContainerProps === void 0 ? void 0 : fieldContainerProps.sx),
|
108
124
|
ref: containerRef,
|
109
125
|
maxWidth: "100%"
|
110
|
-
}), ___EmotionJSX(
|
111
|
-
ref: labelRef
|
112
|
-
}, fieldLabelProps, {
|
113
|
-
sx: isLabelHigher && {
|
114
|
-
gridRow: '1/5'
|
115
|
-
}
|
116
|
-
})), ___EmotionJSX(Box, {
|
126
|
+
}), props.labelMode === 'float' ? wrappedLabel : labelNode, ___EmotionJSX(Box, {
|
117
127
|
isRow: true,
|
118
128
|
variant: "forms.input.container",
|
119
129
|
className: fieldControlProps.className,
|
@@ -277,6 +277,14 @@ var fileInputFieldWrapper = {
|
|
277
277
|
alignItems: 'center'
|
278
278
|
}
|
279
279
|
};
|
280
|
+
var floatLabelWrapper = {
|
281
|
+
backgroundColor: 'white',
|
282
|
+
position: 'relative',
|
283
|
+
height: '17px',
|
284
|
+
bottom: '-18px',
|
285
|
+
left: '3px',
|
286
|
+
zIndex: 2
|
287
|
+
};
|
280
288
|
export default {
|
281
289
|
base: base,
|
282
290
|
card: card,
|
@@ -295,5 +303,6 @@ export default {
|
|
295
303
|
radioContainer: radioContainer,
|
296
304
|
scrollbox: scrollbox,
|
297
305
|
topShadowScrollbox: topShadowScrollbox,
|
298
|
-
bottomShadowScrollbox: bottomShadowScrollbox
|
306
|
+
bottomShadowScrollbox: bottomShadowScrollbox,
|
307
|
+
floatLabelWrapper: floatLabelWrapper
|
299
308
|
};
|