@pingux/astro 1.0.0-alpha.2 → 1.0.0-alpha.6

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 CHANGED
@@ -3,6 +3,44 @@
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.0.0-alpha.6](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.0.0-alpha.5...@pingux/astro@1.0.0-alpha.6) (2021-12-30)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * [UIP-4928] password field-hide default safari-edge-ie icon ([1c46ce6](https://gitlab.corp.pingidentity.com/ux/pingux/commit/1c46ce6fa4cdd7fe846f3434de3e36c65df61244))
12
+
13
+
14
+
15
+
16
+
17
+ # [1.0.0-alpha.5](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.0.0-alpha.4...@pingux/astro@1.0.0-alpha.5) (2021-12-29)
18
+
19
+
20
+ ### Features
21
+
22
+ * [UIP-4918] Add File Input ([5987d40](https://gitlab.corp.pingidentity.com/ux/pingux/commit/5987d4064f8a2a54d3e81037acba17c299bea2b0))
23
+
24
+
25
+
26
+
27
+
28
+ # [1.0.0-alpha.4](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.0.0-alpha.3...@pingux/astro@1.0.0-alpha.4) (2021-12-20)
29
+
30
+ **Note:** Version bump only for package @pingux/astro
31
+
32
+
33
+
34
+
35
+
36
+ # [1.0.0-alpha.3](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.0.0-alpha.2...@pingux/astro@1.0.0-alpha.3) (2021-12-17)
37
+
38
+ **Note:** Version bump only for package @pingux/astro
39
+
40
+
41
+
42
+
43
+
6
44
  # [1.0.0-alpha.2](https://gitlab.corp.pingidentity.com/ux/pingux/compare/@pingux/astro@1.0.0-alpha.1...@pingux/astro@1.0.0-alpha.2) (2021-12-17)
7
45
 
8
46
 
@@ -0,0 +1,324 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard");
4
+
5
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
6
+
7
+ var _Object$defineProperty2 = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
8
+
9
+ _Object$defineProperty2(exports, "__esModule", {
10
+ value: true
11
+ });
12
+
13
+ exports["default"] = void 0;
14
+
15
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/define-property"));
16
+
17
+ var _defineProperties = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/define-properties"));
18
+
19
+ var _getOwnPropertyDescriptors = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors"));
20
+
21
+ var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
22
+
23
+ var _getOwnPropertyDescriptor = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor"));
24
+
25
+ var _getOwnPropertySymbols = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols"));
26
+
27
+ var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
28
+
29
+ var _values = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/values"));
30
+
31
+ var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
32
+
33
+ var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
34
+
35
+ var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
36
+
37
+ var _url = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/url"));
38
+
39
+ var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
40
+
41
+ var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
42
+
43
+ var _from = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/from"));
44
+
45
+ var _defineProperty3 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
46
+
47
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
48
+
49
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
50
+
51
+ var _react = _interopRequireWildcard(require("react"));
52
+
53
+ var _visuallyHidden = require("@react-aria/visually-hidden");
54
+
55
+ var _reactDropzone = require("react-dropzone");
56
+
57
+ var _propTypes = _interopRequireDefault(require("prop-types"));
58
+
59
+ var _utils = require("@react-aria/utils");
60
+
61
+ var _uuid = require("uuid");
62
+
63
+ var _index = require("../../index");
64
+
65
+ var _FileItem = _interopRequireDefault(require("./FileItem"));
66
+
67
+ var _FileSelect = _interopRequireDefault(require("./FileSelect"));
68
+
69
+ var _useStatusClasses3 = _interopRequireDefault(require("../../hooks/useStatusClasses"));
70
+
71
+ var _useField2 = _interopRequireDefault(require("../../hooks/useField"));
72
+
73
+ var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
74
+
75
+ var _react2 = require("@emotion/react");
76
+
77
+ function ownKeys(object, enumerableOnly) { var keys = (0, _keys["default"])(object); if (_getOwnPropertySymbols["default"]) { var symbols = (0, _getOwnPropertySymbols["default"])(object); if (enumerableOnly) symbols = (0, _filter["default"])(symbols).call(symbols, function (sym) { return (0, _getOwnPropertyDescriptor["default"])(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
78
+
79
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context2; (0, _forEach["default"])(_context2 = ownKeys(Object(source), true)).call(_context2, function (key) { (0, _defineProperty3["default"])(target, key, source[key]); }); } else if (_getOwnPropertyDescriptors["default"]) { (0, _defineProperties["default"])(target, (0, _getOwnPropertyDescriptors["default"])(source)); } else { var _context3; (0, _forEach["default"])(_context3 = ownKeys(Object(source))).call(_context3, function (key) { (0, _defineProperty2["default"])(target, key, (0, _getOwnPropertyDescriptor["default"])(source, key)); }); } } return target; }
80
+
81
+ /**
82
+ * The FileInputField component allows users to upload one or more files by
83
+ * clicking the button or via drag and drop.
84
+ *
85
+ * We utilize [react-dropzone](https://react-dropzone.js.org/) for the drag and drop functionality.
86
+ * */
87
+ var FileInputField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
88
+ var defaultButtonText = props.defaultButtonText,
89
+ defaultFileList = props.defaultFileList,
90
+ uploadedFilesImperative = props.fileList,
91
+ helperText = props.helperText,
92
+ isDisabled = props.isDisabled,
93
+ isLoading = props.isLoading,
94
+ isMultiple = props.isMultiple,
95
+ onFileSelect = props.onFileSelect,
96
+ onRemove = props.onRemove,
97
+ status = props.status,
98
+ textProps = props.textProps,
99
+ others = (0, _objectWithoutProperties2["default"])(props, ["defaultButtonText", "defaultFileList", "fileList", "helperText", "isDisabled", "isLoading", "isMultiple", "onFileSelect", "onRemove", "status", "textProps"]);
100
+
101
+ var _useState = (0, _react.useState)(defaultFileList || []),
102
+ _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
103
+ uploadedFiles = _useState2[0],
104
+ setUploadedFiles = _useState2[1];
105
+
106
+ var inputRef = (0, _react.useRef)();
107
+ /* istanbul ignore next */
108
+
109
+ (0, _react.useImperativeHandle)(ref, function () {
110
+ return inputRef.current;
111
+ });
112
+
113
+ var _useField = (0, _useField2["default"])(_objectSpread({
114
+ status: status,
115
+ isDisabled: isDisabled
116
+ }, others)),
117
+ fieldContainerProps = _useField.fieldContainerProps,
118
+ fieldControlProps = _useField.fieldControlProps,
119
+ fieldLabelProps = _useField.fieldLabelProps;
120
+
121
+ var _useVisuallyHidden = (0, _visuallyHidden.useVisuallyHidden)(),
122
+ visuallyHiddenProps = _useVisuallyHidden.visuallyHiddenProps;
123
+
124
+ var handleFileSelect = (0, _react.useCallback)(function () {
125
+ inputRef.current.value = null;
126
+ inputRef.current.click();
127
+ }, [inputRef]);
128
+ var handleFileUpload = (0, _react.useCallback)(function (event, newFiles) {
129
+ if (onFileSelect) {
130
+ onFileSelect(event, newFiles);
131
+ }
132
+
133
+ var arrayWithNewFiles = (0, _from["default"])(newFiles);
134
+
135
+ if (!isMultiple) {
136
+ arrayWithNewFiles = (0, _slice["default"])(arrayWithNewFiles).call(arrayWithNewFiles, 0, 1);
137
+ }
138
+
139
+ var newFilesWithIdAndLink = (0, _map["default"])(arrayWithNewFiles).call(arrayWithNewFiles, function (newFile) {
140
+ return {
141
+ fileObj: newFile,
142
+ name: newFile.name,
143
+ id: (0, _uuid.v4)(),
144
+ downloadLink: _url["default"].createObjectURL(newFile),
145
+ status: _statuses["default"].DEFAULT
146
+ };
147
+ });
148
+
149
+ if (isMultiple) {
150
+ setUploadedFiles(function (prevFiles) {
151
+ var _context;
152
+
153
+ return (0, _concat["default"])(_context = []).call(_context, prevFiles, newFilesWithIdAndLink);
154
+ });
155
+ } else {
156
+ setUploadedFiles(newFilesWithIdAndLink);
157
+ }
158
+ }, [isMultiple, onFileSelect]);
159
+ var onDrop = (0, _react.useCallback)(function (acceptedFiles, fileRejections, event) {
160
+ handleFileUpload(event, acceptedFiles);
161
+ }, [handleFileUpload]);
162
+
163
+ var _useDropzone = (0, _reactDropzone.useDropzone)({
164
+ onDrop: onDrop,
165
+ noKeyboard: true,
166
+ disabled: isDisabled || isLoading
167
+ }),
168
+ getRootProps = _useDropzone.getRootProps,
169
+ getInputProps = _useDropzone.getInputProps,
170
+ isDragActive = _useDropzone.isDragActive;
171
+
172
+ var handleOnChange = (0, _react.useCallback)(function (event) {
173
+ handleFileUpload(event, event.target.files);
174
+ }, [handleFileUpload]);
175
+ var handleFileDelete = (0, _react.useCallback)(function (e, fileId) {
176
+ if (onRemove) {
177
+ onRemove(e, fileId);
178
+ }
179
+
180
+ setUploadedFiles(function (prevFiles) {
181
+ return (0, _filter["default"])(prevFiles).call(prevFiles, function (_ref) {
182
+ var id = _ref.id;
183
+ return id !== fileId;
184
+ });
185
+ });
186
+ }, [onRemove]);
187
+ var filesListNode = (0, _react.useMemo)(function () {
188
+ var filesToRender = uploadedFilesImperative || uploadedFiles;
189
+
190
+ if (!(filesToRender === null || filesToRender === void 0 ? void 0 : filesToRender.length)) {
191
+ return null;
192
+ }
193
+
194
+ return (0, _map["default"])(filesToRender).call(filesToRender, function (fileProps) {
195
+ return (0, _react2.jsx)(_FileItem["default"], (0, _extends2["default"])({
196
+ handleFileDelete: handleFileDelete,
197
+ isDisabled: isDisabled || isLoading,
198
+ key: fileProps.id,
199
+ textProps: textProps
200
+ }, fileProps));
201
+ });
202
+ }, [uploadedFilesImperative, uploadedFiles, handleFileDelete, isDisabled, isLoading, textProps]);
203
+
204
+ var _useStatusClasses = (0, _useStatusClasses3["default"])('fileInputFieldWrapper', (0, _defineProperty3["default"])({
205
+ isDragActive: isDragActive,
206
+ isLoading: isLoading
207
+ }, "is-".concat(status), true)),
208
+ classNames = _useStatusClasses.classNames;
209
+
210
+ var shouldFileSelectRender = (0, _react.useCallback)(function () {
211
+ var isFileUploaded;
212
+
213
+ if (uploadedFilesImperative) {
214
+ isFileUploaded = Boolean(uploadedFilesImperative === null || uploadedFilesImperative === void 0 ? void 0 : uploadedFilesImperative.length);
215
+ } else {
216
+ isFileUploaded = Boolean(uploadedFiles === null || uploadedFiles === void 0 ? void 0 : uploadedFiles.length);
217
+ }
218
+
219
+ return isMultiple || !isFileUploaded;
220
+ }, [uploadedFiles, uploadedFilesImperative, isMultiple]);
221
+ return (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_index.Label, fieldLabelProps), (0, _react2.jsx)(_index.Box, (0, _extends2["default"])({
222
+ variant: "boxes.fileInputFieldWrapper"
223
+ }, (0, _utils.mergeProps)(fieldContainerProps, others), {
224
+ className: classNames
225
+ }, getRootProps()), (0, _react2.jsx)(_index.Input, (0, _extends2["default"])({}, (0, _utils.mergeProps)(visuallyHiddenProps, fieldControlProps, getInputProps()), {
226
+ "aria-label": "File Input",
227
+ multiple: isMultiple,
228
+ onChange: handleOnChange,
229
+ ref: inputRef,
230
+ type: "file"
231
+ })), filesListNode, shouldFileSelectRender() && (0, _react2.jsx)(_FileSelect["default"], {
232
+ buttonText: defaultButtonText,
233
+ handleFileSelect: handleFileSelect,
234
+ isDisabled: isDisabled || isLoading,
235
+ textProps: textProps
236
+ }), isLoading && (0, _react2.jsx)(_index.Loader, {
237
+ color: "active",
238
+ sx: {
239
+ position: 'absolute'
240
+ },
241
+ "data-testid": "file-input-field__loader"
242
+ })), helperText && (0, _react2.jsx)(_index.FieldHelperText, {
243
+ status: status
244
+ }, helperText));
245
+ });
246
+ FileInputField.displayName = 'FileInputField';
247
+ FileInputField.propTypes = {
248
+ /** The rendered label for the field. */
249
+ label: _propTypes["default"].node,
250
+
251
+ /** Text rendered below the input. */
252
+ helperText: _propTypes["default"].node,
253
+
254
+ /** Determines the component border status color indicator and helper text styling. */
255
+ status: _propTypes["default"].oneOf((0, _values["default"])(_statuses["default"])),
256
+
257
+ /** Default button text that will be changed on the file name once file is uploaded */
258
+ defaultButtonText: _propTypes["default"].string,
259
+
260
+ /** Defines whether input can accept multiple files or not */
261
+ isMultiple: _propTypes["default"].bool,
262
+
263
+ /** Determines whether the loading indicator is shown. */
264
+ isLoading: _propTypes["default"].bool,
265
+
266
+ /** Whether the field is disabled. */
267
+ isDisabled: _propTypes["default"].bool,
268
+
269
+ /** Array of objects for uploaded files.
270
+ * Objects should have the following structure:
271
+ *
272
+ * {
273
+ *
274
+ * fileObj: File object (optional),
275
+ *
276
+ * id: file id (required - will be returned on delete),
277
+ *
278
+ * name: file name that will be displayed (required - will be displayed),
279
+ *
280
+ * downloadLink: link for the file download (optional),
281
+ *
282
+ * status: file status (if error - icon of the
283
+ * component will be red icon and warning sign)(optional),
284
+ *
285
+ * }
286
+ * */
287
+ fileList: _propTypes["default"].arrayOf(_propTypes["default"].shape({
288
+ fileObj: _propTypes["default"].shape({}),
289
+ id: _propTypes["default"].string.required,
290
+ name: _propTypes["default"].string.required,
291
+ downloadLink: _propTypes["default"].string,
292
+ status: _propTypes["default"].oneOf((0, _values["default"])(_statuses["default"]))
293
+ })),
294
+
295
+ /** Default array of objects for uploaded files. */
296
+ defaultFileList: _propTypes["default"].arrayOf(_propTypes["default"].shape({
297
+ fileObj: _propTypes["default"].shape({}),
298
+ id: _propTypes["default"].string.required,
299
+ name: _propTypes["default"].string.required,
300
+ downloadLink: _propTypes["default"].string,
301
+ status: _propTypes["default"].oneOf((0, _values["default"])(_statuses["default"]))
302
+ })),
303
+
304
+ /** The handler that is called when the input files is uploaded.
305
+ *
306
+ * `(event, files) => void`
307
+ * */
308
+ onFileSelect: _propTypes["default"].func,
309
+
310
+ /** The handler that is called when an uploaded file got removed.
311
+ *
312
+ * `(fileId) => void`
313
+ * */
314
+ onRemove: _propTypes["default"].func,
315
+
316
+ /** These props will be spread to the field text component. */
317
+ textProps: _propTypes["default"].shape({})
318
+ };
319
+ FileInputField.defaultProps = {
320
+ defaultButtonText: 'Select a file',
321
+ status: _statuses["default"].DEFAULT
322
+ };
323
+ var _default = FileInputField;
324
+ exports["default"] = _default;
@@ -0,0 +1,250 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard");
4
+
5
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
6
+
7
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
8
+
9
+ _Object$defineProperty(exports, "__esModule", {
10
+ value: true
11
+ });
12
+
13
+ exports.WithCustomWidth = exports.ErrorWithMultipleFiles = exports.ErrorStatusSingleFile = exports.DefaultFileListUncontrolled = exports.ControlledState = exports.CustomButtonText = exports.Default = exports["default"] = void 0;
14
+
15
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
16
+
17
+ var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
18
+
19
+ var _react = _interopRequireWildcard(require("react"));
20
+
21
+ var _uuid = require("uuid");
22
+
23
+ var _ = _interopRequireDefault(require("./"));
24
+
25
+ var _index = require("../../index");
26
+
27
+ var _statuses = _interopRequireDefault(require("../../utils/devUtils/constants/statuses"));
28
+
29
+ var _react2 = require("@emotion/react");
30
+
31
+ var _default = {
32
+ title: 'Form/FileInputField',
33
+ component: _["default"],
34
+ parameters: {
35
+ docs: {
36
+ source: {
37
+ type: 'code'
38
+ }
39
+ }
40
+ },
41
+ argTypes: {
42
+ label: {
43
+ control: {
44
+ type: 'text'
45
+ },
46
+ defaultValue: 'Field Label'
47
+ },
48
+ helperText: {
49
+ control: {
50
+ type: 'text'
51
+ }
52
+ },
53
+ status: {
54
+ control: {
55
+ type: 'select',
56
+ options: _statuses["default"]
57
+ },
58
+ defaultValue: _statuses["default"].DEFAULT
59
+ },
60
+ defaultButtonText: {
61
+ control: {
62
+ type: 'text'
63
+ }
64
+ },
65
+ isMultiple: {
66
+ control: {
67
+ type: 'boolean'
68
+ }
69
+ },
70
+ isLoading: {
71
+ control: {
72
+ type: 'boolean'
73
+ }
74
+ },
75
+ isDisabled: {
76
+ control: {
77
+ type: 'boolean'
78
+ }
79
+ },
80
+ fileList: {
81
+ control: {
82
+ type: 'none'
83
+ }
84
+ },
85
+ defaultFileList: {
86
+ control: {
87
+ type: 'none'
88
+ }
89
+ },
90
+ textProps: {
91
+ control: {
92
+ type: 'none'
93
+ }
94
+ }
95
+ }
96
+ };
97
+ exports["default"] = _default;
98
+ var fitContentWidthSx = {
99
+ width: 'fit-content'
100
+ };
101
+
102
+ var Default = function Default(args) {
103
+ return (0, _react2.jsx)(_["default"], (0, _extends2["default"])({
104
+ sx: fitContentWidthSx
105
+ }, args));
106
+ };
107
+
108
+ exports.Default = Default;
109
+
110
+ var CustomButtonText = function CustomButtonText() {
111
+ return (0, _react2.jsx)(_["default"], {
112
+ defaultButtonText: "Original Button Name",
113
+ label: "Custom Button Text",
114
+ sx: fitContentWidthSx
115
+ });
116
+ };
117
+
118
+ exports.CustomButtonText = CustomButtonText;
119
+
120
+ var ControlledState = function ControlledState() {
121
+ var _useState = (0, _react.useState)([]),
122
+ _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
123
+ userFiles = _useState2[0],
124
+ setUserFiles = _useState2[1];
125
+
126
+ var _useState3 = (0, _react.useState)(),
127
+ _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
128
+ error = _useState4[0],
129
+ setError = _useState4[1];
130
+
131
+ var handleFileSelect = function handleFileSelect(event, files) {
132
+ // this is approximate conversion just for an example
133
+ var uploadedFileSizeMb = files[0].size / 1e6;
134
+
135
+ if (uploadedFileSizeMb > 2) {
136
+ setError('Only files under 2 MB can be uploaded.');
137
+ } else {
138
+ setUserFiles([{
139
+ id: (0, _uuid.v4)(),
140
+ name: files[0].name,
141
+ downloadLink: 'link for testing purposes'
142
+ }]);
143
+ setError(null);
144
+ }
145
+ }; // you would want to handle this differently in case you have multiple files
146
+
147
+
148
+ var handleFileRemove = function handleFileRemove() {
149
+ setUserFiles([]);
150
+ setError(null);
151
+ };
152
+
153
+ return (0, _react2.jsx)(_["default"], {
154
+ label: "Controlled State With limit on file size upload below 2 mb",
155
+ onFileSelect: handleFileSelect,
156
+ onRemove: handleFileRemove,
157
+ fileList: userFiles,
158
+ sx: fitContentWidthSx,
159
+ status: error && _statuses["default"].ERROR,
160
+ helperText: error
161
+ });
162
+ };
163
+
164
+ exports.ControlledState = ControlledState;
165
+
166
+ var DefaultFileListUncontrolled = function DefaultFileListUncontrolled() {
167
+ return (0, _react2.jsx)(_["default"], {
168
+ defaultFileList: [{
169
+ id: 'test-id1',
170
+ name: 'PingId Mobile (Android)',
171
+ downloadLink: 'https://download.pingidentity.com/public/PingID/android/PingID.apk'
172
+ }, {
173
+ id: 'test-id2',
174
+ name: 'PingId Desktop (macOS)',
175
+ downloadLink: 'https://downloads.pingidentity.com/pingid/mac-client/PingID.pkg'
176
+ }, {
177
+ id: 'test-id3',
178
+ name: 'PingId Desktop (Windows)',
179
+ downloadLink: 'https://download.pingidentity.com/public/PingID/PingID_1.7.2.zip'
180
+ }],
181
+ isMultiple: true,
182
+ label: "Uncontrolled File List with default files",
183
+ sx: fitContentWidthSx
184
+ });
185
+ };
186
+
187
+ exports.DefaultFileListUncontrolled = DefaultFileListUncontrolled;
188
+
189
+ var ErrorStatusSingleFile = function ErrorStatusSingleFile() {
190
+ return (0, _react2.jsx)(_["default"], {
191
+ defaultFileList: [{
192
+ id: 'test-id3',
193
+ name: 'PingId Desktop (Windows)',
194
+ downloadLink: 'https://download.pingidentity.com/public/PingID/PingID_1.7.2.zip',
195
+ status: _statuses["default"].ERROR
196
+ }],
197
+ label: "Error Status Single File",
198
+ sx: fitContentWidthSx,
199
+ helperText: "There is an error",
200
+ status: _statuses["default"].ERROR
201
+ });
202
+ };
203
+
204
+ exports.ErrorStatusSingleFile = ErrorStatusSingleFile;
205
+
206
+ var ErrorWithMultipleFiles = function ErrorWithMultipleFiles() {
207
+ return (0, _react2.jsx)(_["default"], {
208
+ defaultFileList: [{
209
+ id: 'test-id3',
210
+ name: 'PingId Desktop (Windows)',
211
+ downloadLink: 'https://download.pingidentity.com/public/PingID/PingID_1.7.2.zip',
212
+ status: _statuses["default"].ERROR
213
+ }, {
214
+ id: 'test-id2',
215
+ name: 'PingId Desktop (macOS)',
216
+ downloadLink: 'https://downloads.pingidentity.com/pingid/mac-client/PingID.pkg'
217
+ }],
218
+ label: "Error Status With Multiple Files but without a red border",
219
+ sx: fitContentWidthSx,
220
+ helperText: "There is an error but helperText text will be default since no status passed",
221
+ isMultiple: true
222
+ });
223
+ };
224
+
225
+ exports.ErrorWithMultipleFiles = ErrorWithMultipleFiles;
226
+
227
+ var WithCustomWidth = function WithCustomWidth() {
228
+ var textSx = {
229
+ textOverflow: 'ellipsis',
230
+ overflow: 'hidden',
231
+ whiteSpace: 'nowrap'
232
+ };
233
+ return (0, _react2.jsx)(_index.Box, {
234
+ width: 200
235
+ }, (0, _react2.jsx)(_["default"], {
236
+ defaultButtonText: "Long Long Button Text With A Lot of Words In It",
237
+ defaultFileList: [{
238
+ id: 'test-id1',
239
+ name: 'Really Long File Name That Cant Fit',
240
+ downloadLink: 'https://download.pingidentity.com/public/PingID/android/PingID.apk'
241
+ }],
242
+ label: "Custom Width",
243
+ textProps: {
244
+ sx: textSx
245
+ },
246
+ isMultiple: true
247
+ }));
248
+ };
249
+
250
+ exports.WithCustomWidth = WithCustomWidth;