@pingux/astro 0.42.0 → 1.0.0-alpha.11

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.
Files changed (60) hide show
  1. package/CHANGELOG.md +132 -0
  2. package/lib/cjs/components/AccordionGridGroup/AccordionGridGroup.js +1 -1
  3. package/lib/cjs/components/AccordionItem/AccordionItem.js +3 -1
  4. package/lib/cjs/components/CopyText/CopyText.js +3 -73
  5. package/lib/cjs/components/FileInputField/FileInputField.js +324 -0
  6. package/lib/cjs/components/FileInputField/FileInputField.stories.js +250 -0
  7. package/lib/cjs/components/FileInputField/FileInputField.test.js +227 -0
  8. package/lib/cjs/components/FileInputField/FileItem.js +125 -0
  9. package/lib/cjs/components/FileInputField/FileSelect.js +48 -0
  10. package/lib/cjs/components/FileInputField/index.js +18 -0
  11. package/lib/cjs/components/ListView/ListView.js +4 -3
  12. package/lib/cjs/components/ListViewItem/ListViewItem.js +3 -6
  13. package/lib/cjs/components/NumberField/NumberField.js +4 -2
  14. package/lib/cjs/components/NumberField/NumberField.test.js +15 -0
  15. package/lib/cjs/components/Tab/Tab.js +11 -4
  16. package/lib/cjs/components/Tabs/Tabs.js +7 -1
  17. package/lib/cjs/components/Tabs/Tabs.stories.js +60 -6
  18. package/lib/cjs/components/Tabs/Tabs.test.js +78 -15
  19. package/lib/cjs/hooks/useCopyToClipboard/index.js +18 -0
  20. package/lib/cjs/hooks/useCopyToClipboard/useCopyToClipboard.js +83 -0
  21. package/lib/cjs/hooks/useCopyToClipboard/useCopyToClipboard.test.js +79 -0
  22. package/lib/cjs/index.js +10 -0
  23. package/lib/cjs/recipes/CopyToClipboard.stories.js +45 -0
  24. package/lib/cjs/recipes/RadioButtonsWithLinks.stories.js +146 -0
  25. package/lib/cjs/recipes/RowLineChart.stories.js +6 -1
  26. package/lib/cjs/styles/forms/input.js +11 -0
  27. package/lib/cjs/styles/variants/accordion.js +2 -2
  28. package/lib/cjs/styles/variants/boxes.js +27 -0
  29. package/lib/cjs/styles/variants/buttons.js +20 -0
  30. package/lib/cjs/styles/variants/tabs.js +1 -0
  31. package/lib/components/AccordionGridGroup/AccordionGridGroup.js +1 -1
  32. package/lib/components/AccordionItem/AccordionItem.js +3 -1
  33. package/lib/components/CopyText/CopyText.js +2 -71
  34. package/lib/components/FileInputField/FileInputField.js +280 -0
  35. package/lib/components/FileInputField/FileInputField.stories.js +206 -0
  36. package/lib/components/FileInputField/FileInputField.test.js +187 -0
  37. package/lib/components/FileInputField/FileItem.js +100 -0
  38. package/lib/components/FileInputField/FileSelect.js +31 -0
  39. package/lib/components/FileInputField/index.js +1 -0
  40. package/lib/components/ListView/ListView.js +4 -3
  41. package/lib/components/ListViewItem/ListViewItem.js +3 -5
  42. package/lib/components/NumberField/NumberField.js +4 -2
  43. package/lib/components/NumberField/NumberField.test.js +9 -0
  44. package/lib/components/Tab/Tab.js +11 -4
  45. package/lib/components/Tabs/Tabs.js +7 -1
  46. package/lib/components/Tabs/Tabs.stories.js +56 -4
  47. package/lib/components/Tabs/Tabs.test.js +78 -15
  48. package/lib/hooks/useCopyToClipboard/index.js +1 -0
  49. package/lib/hooks/useCopyToClipboard/useCopyToClipboard.js +69 -0
  50. package/lib/hooks/useCopyToClipboard/useCopyToClipboard.test.js +64 -0
  51. package/lib/index.js +1 -0
  52. package/lib/recipes/CopyToClipboard.stories.js +25 -0
  53. package/lib/recipes/RadioButtonsWithLinks.stories.js +120 -0
  54. package/lib/recipes/RowLineChart.stories.js +6 -1
  55. package/lib/styles/forms/input.js +11 -0
  56. package/lib/styles/variants/accordion.js +2 -2
  57. package/lib/styles/variants/boxes.js +27 -0
  58. package/lib/styles/variants/buttons.js +20 -0
  59. package/lib/styles/variants/tabs.js +1 -0
  60. package/package.json +3 -2
@@ -0,0 +1,206 @@
1
+ import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
2
+ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
3
+ import React, { useState } from 'react';
4
+ import { v4 as uuidv4 } from 'uuid';
5
+ import FileInputField from './';
6
+ import { Box } from '../../index';
7
+ import statuses from '../../utils/devUtils/constants/statuses';
8
+ import { jsx as ___EmotionJSX } from "@emotion/react";
9
+ export default {
10
+ title: 'Form/FileInputField',
11
+ component: FileInputField,
12
+ parameters: {
13
+ docs: {
14
+ source: {
15
+ type: 'code'
16
+ }
17
+ }
18
+ },
19
+ argTypes: {
20
+ label: {
21
+ control: {
22
+ type: 'text'
23
+ },
24
+ defaultValue: 'Field Label'
25
+ },
26
+ helperText: {
27
+ control: {
28
+ type: 'text'
29
+ }
30
+ },
31
+ status: {
32
+ control: {
33
+ type: 'select',
34
+ options: statuses
35
+ },
36
+ defaultValue: statuses.DEFAULT
37
+ },
38
+ defaultButtonText: {
39
+ control: {
40
+ type: 'text'
41
+ }
42
+ },
43
+ isMultiple: {
44
+ control: {
45
+ type: 'boolean'
46
+ }
47
+ },
48
+ isLoading: {
49
+ control: {
50
+ type: 'boolean'
51
+ }
52
+ },
53
+ isDisabled: {
54
+ control: {
55
+ type: 'boolean'
56
+ }
57
+ },
58
+ fileList: {
59
+ control: {
60
+ type: 'none'
61
+ }
62
+ },
63
+ defaultFileList: {
64
+ control: {
65
+ type: 'none'
66
+ }
67
+ },
68
+ textProps: {
69
+ control: {
70
+ type: 'none'
71
+ }
72
+ }
73
+ }
74
+ };
75
+ var fitContentWidthSx = {
76
+ width: 'fit-content'
77
+ };
78
+ export var Default = function Default(args) {
79
+ return ___EmotionJSX(FileInputField, _extends({
80
+ sx: fitContentWidthSx
81
+ }, args));
82
+ };
83
+ export var CustomButtonText = function CustomButtonText() {
84
+ return ___EmotionJSX(FileInputField, {
85
+ defaultButtonText: "Original Button Name",
86
+ label: "Custom Button Text",
87
+ sx: fitContentWidthSx
88
+ });
89
+ };
90
+ export var ControlledState = function ControlledState() {
91
+ var _useState = useState([]),
92
+ _useState2 = _slicedToArray(_useState, 2),
93
+ userFiles = _useState2[0],
94
+ setUserFiles = _useState2[1];
95
+
96
+ var _useState3 = useState(),
97
+ _useState4 = _slicedToArray(_useState3, 2),
98
+ error = _useState4[0],
99
+ setError = _useState4[1];
100
+
101
+ var handleFileSelect = function handleFileSelect(event, files) {
102
+ // this is approximate conversion just for an example
103
+ var uploadedFileSizeMb = files[0].size / 1e6;
104
+
105
+ if (uploadedFileSizeMb > 2) {
106
+ setError('Only files under 2 MB can be uploaded.');
107
+ } else {
108
+ setUserFiles([{
109
+ id: uuidv4(),
110
+ name: files[0].name,
111
+ downloadLink: 'link for testing purposes'
112
+ }]);
113
+ setError(null);
114
+ }
115
+ }; // you would want to handle this differently in case you have multiple files
116
+
117
+
118
+ var handleFileRemove = function handleFileRemove() {
119
+ setUserFiles([]);
120
+ setError(null);
121
+ };
122
+
123
+ return ___EmotionJSX(FileInputField, {
124
+ label: "Controlled State With limit on file size upload below 2 mb",
125
+ onFileSelect: handleFileSelect,
126
+ onRemove: handleFileRemove,
127
+ fileList: userFiles,
128
+ sx: fitContentWidthSx,
129
+ status: error && statuses.ERROR,
130
+ helperText: error
131
+ });
132
+ };
133
+ export var DefaultFileListUncontrolled = function DefaultFileListUncontrolled() {
134
+ return ___EmotionJSX(FileInputField, {
135
+ defaultFileList: [{
136
+ id: 'test-id1',
137
+ name: 'PingId Mobile (Android)',
138
+ downloadLink: 'https://download.pingidentity.com/public/PingID/android/PingID.apk'
139
+ }, {
140
+ id: 'test-id2',
141
+ name: 'PingId Desktop (macOS)',
142
+ downloadLink: 'https://downloads.pingidentity.com/pingid/mac-client/PingID.pkg'
143
+ }, {
144
+ id: 'test-id3',
145
+ name: 'PingId Desktop (Windows)',
146
+ downloadLink: 'https://download.pingidentity.com/public/PingID/PingID_1.7.2.zip'
147
+ }],
148
+ isMultiple: true,
149
+ label: "Uncontrolled File List with default files",
150
+ sx: fitContentWidthSx
151
+ });
152
+ };
153
+ export var ErrorStatusSingleFile = function ErrorStatusSingleFile() {
154
+ return ___EmotionJSX(FileInputField, {
155
+ defaultFileList: [{
156
+ id: 'test-id3',
157
+ name: 'PingId Desktop (Windows)',
158
+ downloadLink: 'https://download.pingidentity.com/public/PingID/PingID_1.7.2.zip',
159
+ status: statuses.ERROR
160
+ }],
161
+ label: "Error Status Single File",
162
+ sx: fitContentWidthSx,
163
+ helperText: "There is an error",
164
+ status: statuses.ERROR
165
+ });
166
+ };
167
+ export var ErrorWithMultipleFiles = function ErrorWithMultipleFiles() {
168
+ return ___EmotionJSX(FileInputField, {
169
+ defaultFileList: [{
170
+ id: 'test-id3',
171
+ name: 'PingId Desktop (Windows)',
172
+ downloadLink: 'https://download.pingidentity.com/public/PingID/PingID_1.7.2.zip',
173
+ status: statuses.ERROR
174
+ }, {
175
+ id: 'test-id2',
176
+ name: 'PingId Desktop (macOS)',
177
+ downloadLink: 'https://downloads.pingidentity.com/pingid/mac-client/PingID.pkg'
178
+ }],
179
+ label: "Error Status With Multiple Files but without a red border",
180
+ sx: fitContentWidthSx,
181
+ helperText: "There is an error but helperText text will be default since no status passed",
182
+ isMultiple: true
183
+ });
184
+ };
185
+ export var WithCustomWidth = function WithCustomWidth() {
186
+ var textSx = {
187
+ textOverflow: 'ellipsis',
188
+ overflow: 'hidden',
189
+ whiteSpace: 'nowrap'
190
+ };
191
+ return ___EmotionJSX(Box, {
192
+ width: 200
193
+ }, ___EmotionJSX(FileInputField, {
194
+ defaultButtonText: "Long Long Button Text With A Lot of Words In It",
195
+ defaultFileList: [{
196
+ id: 'test-id1',
197
+ name: 'Really Long File Name That Cant Fit',
198
+ downloadLink: 'https://download.pingidentity.com/public/PingID/android/PingID.apk'
199
+ }],
200
+ label: "Custom Width",
201
+ textProps: {
202
+ sx: textSx
203
+ },
204
+ isMultiple: true
205
+ }));
206
+ };
@@ -0,0 +1,187 @@
1
+ import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
2
+ import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
3
+ import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
4
+ import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
5
+ import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
6
+ import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
7
+ import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
8
+ import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
9
+ import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
10
+ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
11
+
12
+ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (enumerableOnly) symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
13
+
14
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty(_context = ownKeys(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context2; _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
15
+
16
+ import React from 'react';
17
+ import userEvent from '@testing-library/user-event';
18
+ import { fireEvent, render, screen } from '@testing-library/react';
19
+ import axeTest from '../../utils/testUtils/testAxe';
20
+ import FileInputField from './FileInputField';
21
+ import statuses from '../../utils/devUtils/constants/statuses';
22
+ import { jsx as ___EmotionJSX } from "@emotion/react";
23
+ var fileInputFieldTestId = 'file-input-test-id';
24
+ var testLabel = 'file-input-test-label';
25
+ var fileSelectTestIdButton = 'file-input-field__file-select';
26
+ var fileUploadedDeleteIconTestId = 'file-uploaded__delete-file-button';
27
+ var fileUploadedFileIconErrorTestId = 'file-uploaded__file-icon--is-error';
28
+ var fileUploadedDownloadTestId = 'file-uploaded__download-file-button';
29
+ var fileUploadedDownloadLinkTestId = 'file-uploaded__download-link';
30
+ var loaderTestId = 'file-input-field__loader';
31
+ var testFileURL = 'test-file-url';
32
+ var testFileId = 'test-file-id-1';
33
+ var testFileName = 'chucknorris.png';
34
+ var testFileName2 = 'chucknorris222.png';
35
+ var testFile = new File(['(⌐□_□)'], testFileName, {
36
+ type: 'image/png'
37
+ });
38
+ var testFile2 = new File(['(⌐□_□)'], testFileName2, {
39
+ type: 'image/png'
40
+ });
41
+ var testFileObject = {
42
+ id: testFileId,
43
+ name: testFileName,
44
+ downloadLink: testFileURL
45
+ };
46
+ var originalValue = global.URL.createObjectURL;
47
+ var defaultProps = {
48
+ 'data-testid': fileInputFieldTestId,
49
+ label: testLabel
50
+ };
51
+ beforeAll(function () {
52
+ global.URL.createObjectURL = jest.fn(function () {
53
+ return testFileURL;
54
+ });
55
+ });
56
+ afterAll(function () {
57
+ global.URL.createObjectURL = originalValue;
58
+ });
59
+
60
+ var getComponent = function getComponent(props) {
61
+ return render(___EmotionJSX(FileInputField, _extends({}, defaultProps, props)));
62
+ };
63
+
64
+ axeTest(getComponent);
65
+ test('should render file input field component by default', function () {
66
+ getComponent();
67
+ var fileUploadField = screen.getByTestId(fileInputFieldTestId);
68
+ expect(fileUploadField).toBeInstanceOf(HTMLDivElement);
69
+ expect(fileUploadField).toBeInTheDocument();
70
+ });
71
+ test('should render files if they are passed as default', function () {
72
+ getComponent({
73
+ defaultFileList: [testFileObject]
74
+ });
75
+ expect(screen.getByText(testFileName)).toBeInTheDocument();
76
+ });
77
+ test('should render files if they are passed as controlled prop', function () {
78
+ getComponent({
79
+ fileList: [testFileObject]
80
+ });
81
+ expect(screen.getByText(testFileName)).toBeInTheDocument();
82
+ });
83
+ test('should be able to display uploaded file', function () {
84
+ getComponent();
85
+ var fileUploadFieldInput = screen.getByLabelText(testLabel);
86
+ userEvent.click(screen.getByTestId(fileSelectTestIdButton));
87
+ fireEvent.change(fileUploadFieldInput, {
88
+ target: {
89
+ files: [testFile]
90
+ }
91
+ });
92
+ expect(screen.getByText(testFileName)).toBeInTheDocument();
93
+ });
94
+ test('should be able to add uploaded file if isMultiple true and file select always present', function () {
95
+ var testCustomButtonName = 'test Custom Button Name';
96
+ getComponent({
97
+ defaultFileList: [testFileObject],
98
+ defaultButtonText: testCustomButtonName,
99
+ isMultiple: true
100
+ });
101
+ var fileUploadFieldInput = screen.getByLabelText(testLabel);
102
+ userEvent.click(screen.getByTestId(fileSelectTestIdButton));
103
+ fireEvent.change(fileUploadFieldInput, {
104
+ target: {
105
+ files: [testFile2]
106
+ }
107
+ });
108
+ expect(screen.getByText(testFileName)).toBeInTheDocument();
109
+ expect(screen.getByText(testFileName2)).toBeInTheDocument();
110
+ expect(screen.getByText(testCustomButtonName)).toBeInTheDocument();
111
+ });
112
+ test('should call onFileSelect if file uploaded', function () {
113
+ var mockOnFileSelect = jest.fn();
114
+ getComponent({
115
+ onFileSelect: mockOnFileSelect
116
+ });
117
+ var fileUploadFieldInput = screen.getByLabelText(testLabel);
118
+ userEvent.click(screen.getByTestId(fileSelectTestIdButton));
119
+ fireEvent.change(fileUploadFieldInput, {
120
+ target: {
121
+ files: [testFile]
122
+ }
123
+ });
124
+ expect(mockOnFileSelect).toHaveBeenCalledTimes(1);
125
+ });
126
+ test('file should have download link as attribute', function () {
127
+ getComponent({
128
+ defaultFileList: [testFileObject]
129
+ });
130
+ userEvent.click(screen.getByTestId(fileUploadedDownloadTestId));
131
+ expect(screen.getByTestId(fileUploadedDownloadLinkTestId)).toHaveAttribute('href', testFileURL);
132
+ });
133
+ test('should remove file if trash icon clicked', function () {
134
+ getComponent({
135
+ defaultFileList: [testFileObject]
136
+ });
137
+ expect(screen.getByText(testFileName)).toBeInTheDocument();
138
+ userEvent.click(screen.getByTestId(fileUploadedDeleteIconTestId));
139
+ expect(screen.queryByText(testFileName)).not.toBeInTheDocument();
140
+ });
141
+ test('should call onRemove if trash icon clicked', function () {
142
+ var mockOnRemove = jest.fn();
143
+ getComponent({
144
+ defaultFileList: [{
145
+ id: testFileId,
146
+ name: 'test'
147
+ }],
148
+ onRemove: mockOnRemove
149
+ });
150
+ userEvent.click(screen.getByTestId(fileUploadedDeleteIconTestId));
151
+ expect(mockOnRemove).toHaveBeenCalledTimes(1);
152
+ expect(mockOnRemove).toHaveBeenCalledWith(expect.anything(), testFileId);
153
+ });
154
+ test('file select will have custom text if from props if provided', function () {
155
+ var mockTitle = 'test-title';
156
+ getComponent({
157
+ defaultButtonText: mockTitle
158
+ });
159
+ expect(screen.getByText(mockTitle)).toBeInTheDocument();
160
+ });
161
+ test('should render error border if appropriate state passed', function () {
162
+ getComponent({
163
+ status: statuses.ERROR
164
+ });
165
+ expect(screen.getByTestId(fileInputFieldTestId)).toHaveClass('is-error');
166
+ });
167
+ test('file uploaded should render red error icon', function () {
168
+ getComponent({
169
+ defaultFileList: [_objectSpread(_objectSpread({}, testFileObject), {}, {
170
+ status: statuses.ERROR
171
+ })]
172
+ });
173
+ expect(screen.getByTestId(fileUploadedFileIconErrorTestId)).toBeInTheDocument();
174
+ });
175
+ test('should display loader if appropriate prop is passed', function () {
176
+ getComponent({
177
+ isLoading: true
178
+ });
179
+ expect(screen.getByTestId(loaderTestId)).toBeInTheDocument();
180
+ });
181
+ test('should display helper text if passed', function () {
182
+ var testHelperText = 'testHelperText';
183
+ getComponent({
184
+ helperText: testHelperText
185
+ });
186
+ expect(screen.getByText(testHelperText)).toBeInTheDocument();
187
+ });
@@ -0,0 +1,100 @@
1
+ import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
2
+ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
3
+ import React, { useCallback, useRef } from 'react';
4
+ import InsertDriveFileIcon from 'mdi-react/InsertDriveFileIcon';
5
+ import ErrorIcon from 'mdi-react/ErrorIcon';
6
+ import DeleteIcon from 'mdi-react/DeleteIcon';
7
+ import PropTypes from 'prop-types';
8
+ import { useVisuallyHidden } from '@react-aria/visually-hidden';
9
+ import { Box, Button, IconButton, Icon, Text } from '../../index';
10
+ import statuses from '../../utils/devUtils/constants/statuses';
11
+ import { jsx as ___EmotionJSX } from "@emotion/react";
12
+
13
+ var FileItem = function FileItem(props) {
14
+ var downloadLink = props.downloadLink,
15
+ handleFileDelete = props.handleFileDelete,
16
+ id = props.id,
17
+ isDisabled = props.isDisabled,
18
+ name = props.name,
19
+ status = props.status,
20
+ textProps = props.textProps;
21
+ var handleDeleteButtonPress = useCallback(function (e) {
22
+ return handleFileDelete(e, id);
23
+ }, [id, handleFileDelete]);
24
+
25
+ var _useVisuallyHidden = useVisuallyHidden(),
26
+ visuallyHiddenProps = _useVisuallyHidden.visuallyHiddenProps;
27
+
28
+ var downloadRef = useRef();
29
+ var getFileIconProps = useCallback(function () {
30
+ switch (status) {
31
+ case statuses.ERROR:
32
+ return {
33
+ icon: ErrorIcon,
34
+ color: 'critical.dark',
35
+ 'data-testid': 'file-uploaded__file-icon--is-error'
36
+ };
37
+
38
+ default:
39
+ return {
40
+ icon: InsertDriveFileIcon
41
+ };
42
+ }
43
+ }, [status]);
44
+
45
+ var handleDownloadPress = function handleDownloadPress() {
46
+ downloadRef.current.click();
47
+ };
48
+
49
+ return ___EmotionJSX(Box, {
50
+ isRow: true,
51
+ alignItems: "center",
52
+ mx: 15,
53
+ my: 5
54
+ }, ___EmotionJSX(Icon, _extends({
55
+ size: 15,
56
+ "data-testid": "file-uploaded__file-icon"
57
+ }, getFileIconProps(), {
58
+ isDisabled: isDisabled
59
+ })), ___EmotionJSX(Button, {
60
+ variant: "fileInputField",
61
+ mx: 5,
62
+ isDisabled: isDisabled,
63
+ "aria-label": name,
64
+ "data-testid": "file-uploaded__download-file-button",
65
+ onPress: handleDownloadPress
66
+ }, ___EmotionJSX(Text, _extends({
67
+ color: "active"
68
+ }, textProps), name)), ___EmotionJSX(IconButton, {
69
+ "aria-label": "Delete ".concat(name, " file icon"),
70
+ "data-testid": "file-uploaded__delete-file-button",
71
+ isDisabled: isDisabled,
72
+ onPress: handleDeleteButtonPress,
73
+ sx: {
74
+ alignSelf: 'auto'
75
+ }
76
+ }, ___EmotionJSX(Icon, {
77
+ icon: DeleteIcon,
78
+ size: 15,
79
+ isDisabled: isDisabled
80
+ })), ___EmotionJSX("a", _extends({
81
+ href: downloadLink
82
+ }, visuallyHiddenProps, {
83
+ download: true,
84
+ ref: downloadRef,
85
+ "aria-label": "download",
86
+ "data-testid": "file-uploaded__download-link",
87
+ tabIndex: -1
88
+ })));
89
+ };
90
+
91
+ export default FileItem;
92
+ FileItem.propTypes = {
93
+ downloadLink: PropTypes.string,
94
+ handleFileDelete: PropTypes.func,
95
+ id: PropTypes.string,
96
+ isDisabled: PropTypes.bool,
97
+ name: PropTypes.string,
98
+ status: PropTypes.oneOf(_Object$values(statuses)),
99
+ textProps: PropTypes.shape({})
100
+ };
@@ -0,0 +1,31 @@
1
+ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
+ import React from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import { Button, Text } from '../../index';
5
+ import { jsx as ___EmotionJSX } from "@emotion/react";
6
+
7
+ var FileSelect = function FileSelect(props) {
8
+ var buttonText = props.buttonText,
9
+ handleFileSelect = props.handleFileSelect,
10
+ isDisabled = props.isDisabled,
11
+ textProps = props.textProps;
12
+ return ___EmotionJSX(Button, {
13
+ "aria-label": buttonText,
14
+ "data-testid": "file-input-field__file-select",
15
+ isDisabled: isDisabled,
16
+ mx: 15,
17
+ my: 5,
18
+ onPress: handleFileSelect,
19
+ variant: "fileInputField"
20
+ }, ___EmotionJSX(Text, _extends({
21
+ color: "active"
22
+ }, textProps), buttonText));
23
+ };
24
+
25
+ export default FileSelect;
26
+ FileSelect.propTypes = {
27
+ buttonText: PropTypes.string,
28
+ handleFileSelect: PropTypes.func,
29
+ isDisabled: PropTypes.bool,
30
+ textProps: PropTypes.shape({})
31
+ };
@@ -0,0 +1 @@
1
+ export { default } from './FileInputField';
@@ -37,18 +37,19 @@ export var collectionTypes = {
37
37
  PLACEHOLDER: 'placeholder'
38
38
  };
39
39
  export function useListLayout(state) {
40
+ var ROW_HEIGHT = 81;
40
41
  var collator = useCollator({
41
42
  usage: 'search',
42
43
  sensitivity: 'base'
43
44
  });
44
45
  var layout = useMemo(function () {
45
46
  return new ListLayout({
46
- estimatedRowHeight: 81,
47
+ estimatedRowHeight: ROW_HEIGHT,
47
48
  estimatedHeadingHeight: 26,
48
49
  paddingRight: 4,
49
50
  paddingLeft: 4,
50
- loaderHeight: 81,
51
- placeholderHeight: 81,
51
+ loaderHeight: ROW_HEIGHT,
52
+ placeholderHeight: ROW_HEIGHT,
52
53
  collator: collator
53
54
  });
54
55
  }, [collator]);
@@ -8,7 +8,6 @@ import { useGridCell, useGridRow } from '@react-aria/grid';
8
8
  import { useHover } from '@react-aria/interactions';
9
9
  import { ListViewContext } from '../ListView/ListViewContext';
10
10
  import Box from '../Box';
11
- import Separator from '../Separator';
12
11
  import { useStatusClasses } from '../../hooks';
13
12
  import { jsx as ___EmotionJSX } from "@emotion/react";
14
13
 
@@ -65,7 +64,8 @@ var ListViewItem = function ListViewItem(props) {
65
64
  var _useStatusClasses = useStatusClasses(className, {
66
65
  isHovered: isHovered,
67
66
  isSelected: isSelected,
68
- isFocused: isDisabled ? false : isFocusVisible
67
+ isFocused: isDisabled ? false : isFocusVisible,
68
+ hasSeparator: hasSeparator
69
69
  }),
70
70
  classNames = _useStatusClasses.classNames;
71
71
 
@@ -86,9 +86,7 @@ var ListViewItem = function ListViewItem(props) {
86
86
  isSelected: isSelected,
87
87
  className: classNames,
88
88
  "data-id": dataId
89
- }, listItemProps), item.rendered)), hasSeparator && ___EmotionJSX(Separator, {
90
- m: "0px"
91
- }));
89
+ }, listItemProps), item.rendered)));
92
90
  };
93
91
 
94
92
  ListViewItem.propTypes = {
@@ -71,12 +71,14 @@ var NumberField = /*#__PURE__*/forwardRef(function (props, ref) {
71
71
  var ControlArrows = ___EmotionJSX(Box, {
72
72
  variant: "numberField.arrows"
73
73
  }, ___EmotionJSX(IconButton, _extends({}, incrementButtonProps, {
74
- ref: decRef
74
+ ref: decRef,
75
+ tabIndex: "-1"
75
76
  }), ___EmotionJSX(Icon, {
76
77
  icon: ArrowDropUpIcon,
77
78
  size: 12
78
79
  })), ___EmotionJSX(IconButton, _extends({}, decrementButtonProps, {
79
- ref: incrRef
80
+ ref: incrRef,
81
+ tabIndex: "-1"
80
82
  }), ___EmotionJSX(Icon, {
81
83
  icon: ArrowDropDownIcon,
82
84
  size: 12
@@ -119,4 +119,13 @@ test('should show hintText text if prop is passed', function () {
119
119
  fireEvent.mouseMove(helpHintButton);
120
120
  fireEvent.mouseEnter(helpHintButton);
121
121
  expect(screen.getByText(hintText)).toBeInTheDocument();
122
+ });
123
+ test('increment and decrement buttons shouldn\'t be able to be focused via keyboard', function () {
124
+ getComponent();
125
+ userEvent.tab();
126
+ expect(screen.getByLabelText(testLabel)).toHaveFocus();
127
+ userEvent.tab();
128
+ expect(screen.getByLabelText('arrow-up')).not.toHaveFocus();
129
+ userEvent.tab();
130
+ expect(screen.getByLabelText('arrow-down')).not.toHaveFocus();
122
131
  });
@@ -21,6 +21,7 @@ export var CollectionTab = /*#__PURE__*/forwardRef(function (props, ref) {
21
21
  tabsDisabled = props.isDisabled,
22
22
  orientation = props.orientation,
23
23
  mode = props.mode,
24
+ slots = props.slots,
24
25
  tooltipTriggerProps = props.tooltipTriggerProps;
25
26
  var key = item.key,
26
27
  rendered = item.rendered,
@@ -34,8 +35,8 @@ export var CollectionTab = /*#__PURE__*/forwardRef(function (props, ref) {
34
35
  content = itemProps.content,
35
36
  otherItemProps = _objectWithoutProperties(itemProps, ["icon", "isDisabled", "separator", "tabLabelProps", "tabLineProps", "content"]);
36
37
 
37
- var isDisabled = tabsDisabled || tabDisabled;
38
38
  var state = useContext(TabsContext);
39
+ var isDisabled = tabsDisabled || tabDisabled || state.disabledKeys.has(key);
39
40
  var isSelected = state.selectedKey === key;
40
41
 
41
42
  var _useFocusRing = useFocusRing(),
@@ -70,14 +71,16 @@ export var CollectionTab = /*#__PURE__*/forwardRef(function (props, ref) {
70
71
  }, state, tabRef),
71
72
  tabProps = _useTab.tabProps;
72
73
 
73
- var tab = ___EmotionJSX(Box, _extends({
74
+ var tab = ___EmotionJSX(Box, {
75
+ isRow: true
76
+ }, slots === null || slots === void 0 ? void 0 : slots.beforeTab, ___EmotionJSX(Box, _extends({
74
77
  className: classNames,
75
78
  variant: "tab"
76
79
  }, mergeProps(focusProps, hoverProps, tabProps), otherItemProps, {
77
80
  ref: tabRef
78
81
  }), icon, ___EmotionJSX(Text, _extends({
79
82
  variant: "tabLabel"
80
- }, tabLabelProps), rendered), isSelected && !isDisabled && ___EmotionJSX(TabLine, tabLineProps));
83
+ }, tabLabelProps), rendered), isSelected && !isDisabled && ___EmotionJSX(TabLine, tabLineProps)), slots === null || slots === void 0 ? void 0 : slots.afterTab);
81
84
 
82
85
  if (mode === 'tooltip') {
83
86
  return ___EmotionJSX(React.Fragment, null, separator, ___EmotionJSX(TooltipTrigger, _extends({}, tooltipTriggerProps, {
@@ -100,7 +103,11 @@ CollectionTab.propTypes = {
100
103
  }),
101
104
  mode: PropTypes.oneOf(['default', 'tooltip']),
102
105
  orientation: PropTypes.oneOf(['horizontal', 'vertical']),
103
- tooltipTriggerProps: PropTypes.shape({})
106
+ tooltipTriggerProps: PropTypes.shape({}),
107
+ slots: PropTypes.shape({
108
+ beforeTab: PropTypes.node,
109
+ afterTab: PropTypes.node
110
+ })
104
111
  };
105
112
 
106
113
  var TabLine = function TabLine(props) {
@@ -71,12 +71,15 @@ var Tabs = /*#__PURE__*/forwardRef(function (props, ref) {
71
71
  }, tabListProps, raTabListProps, {
72
72
  ref: tabListRef
73
73
  }), _mapInstanceProperty(_context = _Array$from(state.collection)).call(_context, function (item) {
74
+ var _item$props;
75
+
74
76
  return ___EmotionJSX(CollectionTab, {
75
77
  key: item.key,
76
78
  item: item,
77
79
  isDisabled: isDisabled,
78
80
  orientation: orientation,
79
- mode: mode
81
+ mode: mode,
82
+ slots: item === null || item === void 0 ? void 0 : (_item$props = item.props) === null || _item$props === void 0 ? void 0 : _item$props.slots
80
83
  });
81
84
  })), ___EmotionJSX(Box, _extends({
82
85
  variant: "tabPanel",
@@ -87,6 +90,9 @@ Tabs.propTypes = {
87
90
  /** The default tab key to be selected. (uncontrolled) */
88
91
  defaultSelectedKey: PropTypes.string,
89
92
 
93
+ /** Array of keys to disable within the tab list. */
94
+ disabledKeys: PropTypes.arrayOf(PropTypes.string),
95
+
90
96
  /** The tab key that is currently selected. (controlled) */
91
97
  selectedKey: PropTypes.string,
92
98