@digigov/react-core 0.16.1 → 0.16.3
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 -1
- package/FileUpload/__snapshots__/index.test.tsx.snap +2 -2
- package/FileUpload/index.d.ts +9 -1
- package/FileUpload/index.js +13 -6
- package/FileUploadContainer/__snapshots__/index.test.tsx.snap +29 -0
- package/FileUploadContainer/index.d.ts +14 -0
- package/FileUploadContainer/index.js +41 -0
- package/FileUploadContainer/index.test.d.ts +1 -0
- package/FileUploadContainer/index.test.js +23 -0
- package/HellenicRepublicLogo/logo-el.d.ts +1 -1
- package/HellenicRepublicLogo/logo-el.js +1 -1
- package/es/FileUpload/__snapshots__/index.test.tsx.snap +2 -2
- package/es/FileUpload/index.js +13 -6
- package/es/FileUploadContainer/__snapshots__/index.test.tsx.snap +29 -0
- package/es/FileUploadContainer/index.js +25 -0
- package/es/FileUploadContainer/index.test.js +17 -0
- package/es/HellenicRepublicLogo/logo-el.js +1 -1
- package/es/registry.js +2 -0
- package/esm/FileUpload/__snapshots__/index.test.tsx.snap +2 -2
- package/esm/FileUpload/index.js +13 -6
- package/esm/FileUploadContainer/__snapshots__/index.test.tsx.snap +29 -0
- package/esm/FileUploadContainer/index.js +25 -0
- package/esm/FileUploadContainer/index.test.js +17 -0
- package/esm/HellenicRepublicLogo/logo-el.js +1 -1
- package/esm/index.js +1 -1
- package/esm/registry.js +2 -0
- package/package.json +2 -2
- package/registry.d.ts +1 -0
- package/registry.js +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
# Change Log - @digigov/react-core
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 14 Sep 2022 12:03:44 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 0.16.3
|
|
6
|
+
Wed, 14 Sep 2022 12:03:44 GMT
|
|
7
|
+
|
|
8
|
+
### Patches
|
|
9
|
+
|
|
10
|
+
- Make HellenicRepublicLogo's logo valid base64
|
|
11
|
+
- add new fileconteiner component
|
|
12
|
+
|
|
13
|
+
## 0.16.2
|
|
14
|
+
Tue, 13 Sep 2022 13:10:16 GMT
|
|
15
|
+
|
|
16
|
+
### Patches
|
|
17
|
+
|
|
18
|
+
- Update registry file
|
|
19
|
+
- Update FileUpload component
|
|
4
20
|
|
|
5
21
|
## 0.16.1
|
|
6
22
|
Tue, 06 Sep 2022 08:27:15 GMT
|
|
@@ -8,7 +8,7 @@ exports[`renders the FileUpload with name prop 1`] = `
|
|
|
8
8
|
className="upload-file"
|
|
9
9
|
>
|
|
10
10
|
<input
|
|
11
|
-
className="govgr-file-
|
|
11
|
+
className="govgr-file-input"
|
|
12
12
|
name="some-name"
|
|
13
13
|
type="file"
|
|
14
14
|
/>
|
|
@@ -22,7 +22,7 @@ exports[`renders the FileUpload with no props 1`] = `
|
|
|
22
22
|
className="upload-file"
|
|
23
23
|
>
|
|
24
24
|
<input
|
|
25
|
-
className="govgr-file-
|
|
25
|
+
className="govgr-file-input"
|
|
26
26
|
type="file"
|
|
27
27
|
/>
|
|
28
28
|
</div>
|
package/FileUpload/index.d.ts
CHANGED
|
@@ -5,10 +5,18 @@ export interface FileUploadProps extends BaseProps<'input'> {
|
|
|
5
5
|
* name is optional.
|
|
6
6
|
*/
|
|
7
7
|
name?: string;
|
|
8
|
+
/**
|
|
9
|
+
* disabled is optional.
|
|
10
|
+
*/
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* hasFiles is optional.
|
|
14
|
+
*/
|
|
15
|
+
hasFiles?: boolean;
|
|
8
16
|
}
|
|
9
17
|
/**
|
|
10
18
|
* Details for the FileUpload.
|
|
11
19
|
* FileUpload component is used for uploading files
|
|
12
20
|
*/
|
|
13
|
-
export declare const FileUpload: React.ForwardRefExoticComponent<Pick<FileUploadProps, "form" | "slot" | "style" | "title" | "pattern" | "as" | "className" | "color" | "height" | "id" | "lang" | "max" | "min" | "name" | "type" | "width" | "role" | "tabIndex" | "crossOrigin" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "alt" | "src" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value" | "autoComplete" | "accept" | "capture" | "checked" | "list" | "maxLength" | "minLength" | "multiple" | "readOnly" | "required" | "size" | "step" | "margin" | "marginTop" | "marginBottom" | "marginLeft" | "marginRight" | "padding" | "paddingTop" | "paddingBottom" | "paddingLeft" | "paddingRight" | "printHidden"> & React.RefAttributes<HTMLInputElement>>;
|
|
21
|
+
export declare const FileUpload: React.ForwardRefExoticComponent<Pick<FileUploadProps, "form" | "slot" | "style" | "title" | "pattern" | "as" | "className" | "color" | "height" | "id" | "lang" | "max" | "min" | "name" | "type" | "width" | "role" | "tabIndex" | "crossOrigin" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "alt" | "src" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value" | "autoComplete" | "accept" | "capture" | "checked" | "list" | "maxLength" | "minLength" | "multiple" | "readOnly" | "required" | "size" | "step" | "margin" | "marginTop" | "marginBottom" | "marginLeft" | "marginRight" | "padding" | "paddingTop" | "paddingBottom" | "paddingLeft" | "paddingRight" | "printHidden" | "hasFiles"> & React.RefAttributes<HTMLInputElement>>;
|
|
14
22
|
export default FileUpload;
|
package/FileUpload/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var _Base = _interopRequireDefault(require("@digigov/react-core/Base"));
|
|
|
17
17
|
|
|
18
18
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
19
19
|
|
|
20
|
-
var _excluded = ["name", "className", "children"];
|
|
20
|
+
var _excluded = ["name", "className", "children", "disabled", "hasFiles"];
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Details for the FileUpload.
|
|
@@ -27,16 +27,23 @@ var FileUpload = /*#__PURE__*/_react["default"].forwardRef(function FileUpload(_
|
|
|
27
27
|
var name = _ref.name,
|
|
28
28
|
className = _ref.className,
|
|
29
29
|
children = _ref.children,
|
|
30
|
+
disabled = _ref.disabled,
|
|
31
|
+
_ref$hasFiles = _ref.hasFiles,
|
|
32
|
+
hasFiles = _ref$hasFiles === void 0 ? false : _ref$hasFiles,
|
|
30
33
|
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
31
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
return /*#__PURE__*/_react["default"].createElement(_Base["default"], {
|
|
35
|
+
as: "label",
|
|
36
|
+
tabIndex: 0,
|
|
37
|
+
role: "button",
|
|
38
|
+
className: (0, _clsx["default"])(className, !hasFiles && ['govgr-btn', 'govgr-btn-secondary'], hasFiles && 'govgr-link', true && 'govgr-label-file')
|
|
39
|
+
}, /*#__PURE__*/_react["default"].createElement(_Base["default"], (0, _extends2["default"])({
|
|
34
40
|
as: "input",
|
|
35
41
|
ref: ref,
|
|
36
42
|
type: "file",
|
|
37
43
|
name: name,
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
disabled: disabled,
|
|
45
|
+
className: (0, _clsx["default"])(true && 'govgr-file-input')
|
|
46
|
+
}, props)), children);
|
|
40
47
|
});
|
|
41
48
|
|
|
42
49
|
exports.FileUpload = FileUpload;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`renders the FileUpload with hasUploadedFile prop 1`] = `
|
|
4
|
+
<ForwardRef(FileUploadContainer)
|
|
5
|
+
hasUploadedFile={true}
|
|
6
|
+
>
|
|
7
|
+
<ForwardRef(Base)
|
|
8
|
+
as="div"
|
|
9
|
+
className="govgr-uploaded-file"
|
|
10
|
+
>
|
|
11
|
+
<div
|
|
12
|
+
className="govgr-uploaded-file"
|
|
13
|
+
/>
|
|
14
|
+
</ForwardRef(Base)>
|
|
15
|
+
</ForwardRef(FileUploadContainer)>
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
exports[`renders the FileUpload with no props 1`] = `
|
|
19
|
+
<ForwardRef(FileUploadContainer)>
|
|
20
|
+
<ForwardRef(Base)
|
|
21
|
+
as="div"
|
|
22
|
+
className=""
|
|
23
|
+
>
|
|
24
|
+
<div
|
|
25
|
+
className=""
|
|
26
|
+
/>
|
|
27
|
+
</ForwardRef(Base)>
|
|
28
|
+
</ForwardRef(FileUploadContainer)>
|
|
29
|
+
`;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BaseProps } from '@digigov/react-core/Base';
|
|
3
|
+
export interface FileUploadContainerProps extends BaseProps<'div'> {
|
|
4
|
+
/**
|
|
5
|
+
* hasFiles is optional.
|
|
6
|
+
*/
|
|
7
|
+
hasUploadedFile?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Details for the FileUploadContainer.
|
|
11
|
+
* FileUploadContainer component is used for wrapping the FileUpload component
|
|
12
|
+
*/
|
|
13
|
+
export declare const FileUploadContainer: React.ForwardRefExoticComponent<Pick<FileUploadContainerProps, "slot" | "style" | "title" | "as" | "className" | "color" | "id" | "lang" | "role" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "margin" | "marginTop" | "marginBottom" | "marginLeft" | "marginRight" | "padding" | "paddingTop" | "paddingBottom" | "paddingLeft" | "paddingRight" | "printHidden" | "hasUploadedFile"> & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
export default FileUploadContainer;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = exports.FileUploadContainer = void 0;
|
|
9
|
+
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
12
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
|
|
16
|
+
var _Base = _interopRequireDefault(require("@digigov/react-core/Base"));
|
|
17
|
+
|
|
18
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
19
|
+
|
|
20
|
+
var _excluded = ["className", "children", "hasUploadedFile"];
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Details for the FileUploadContainer.
|
|
24
|
+
* FileUploadContainer component is used for wrapping the FileUpload component
|
|
25
|
+
*/
|
|
26
|
+
var FileUploadContainer = /*#__PURE__*/_react["default"].forwardRef(function FileUploadContainer(_ref, ref) {
|
|
27
|
+
var className = _ref.className,
|
|
28
|
+
children = _ref.children,
|
|
29
|
+
_ref$hasUploadedFile = _ref.hasUploadedFile,
|
|
30
|
+
hasUploadedFile = _ref$hasUploadedFile === void 0 ? false : _ref$hasUploadedFile,
|
|
31
|
+
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
32
|
+
return /*#__PURE__*/_react["default"].createElement(_Base["default"], (0, _extends2["default"])({
|
|
33
|
+
ref: ref,
|
|
34
|
+
as: "div",
|
|
35
|
+
className: (0, _clsx["default"])(className, hasUploadedFile && 'govgr-uploaded-file')
|
|
36
|
+
}, props), children);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
exports.FileUploadContainer = FileUploadContainer;
|
|
40
|
+
var _default = FileUploadContainer;
|
|
41
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
|
|
7
|
+
var _enzyme = require("enzyme");
|
|
8
|
+
|
|
9
|
+
var _FileUploadContainer = _interopRequireDefault(require("@digigov/react-core/FileUploadContainer"));
|
|
10
|
+
|
|
11
|
+
var _ref = /*#__PURE__*/_react["default"].createElement(_FileUploadContainer["default"], null);
|
|
12
|
+
|
|
13
|
+
it('renders the FileUpload with no props', function () {
|
|
14
|
+
expect((0, _enzyme.mount)(_ref)).toMatchSnapshot();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
var _ref2 = /*#__PURE__*/_react["default"].createElement(_FileUploadContainer["default"], {
|
|
18
|
+
hasUploadedFile: true
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('renders the FileUpload with hasUploadedFile prop', function () {
|
|
22
|
+
expect((0, _enzyme.mount)(_ref2)).toMatchSnapshot();
|
|
23
|
+
});
|