@digigov/react-core 0.16.1 → 0.16.2

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
@@ -1,6 +1,14 @@
1
1
  # Change Log - @digigov/react-core
2
2
 
3
- This log was last generated on Tue, 06 Sep 2022 08:27:15 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 13 Sep 2022 13:10:16 GMT and should not be manually modified.
4
+
5
+ ## 0.16.2
6
+ Tue, 13 Sep 2022 13:10:16 GMT
7
+
8
+ ### Patches
9
+
10
+ - Update registry file
11
+ - Update FileUpload component
4
12
 
5
13
  ## 0.16.1
6
14
  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-upload"
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-upload"
25
+ className="govgr-file-input"
26
26
  type="file"
27
27
  />
28
28
  </div>
@@ -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;
@@ -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("div", (0, _extends2["default"])({
32
- className: (0, _clsx["default"])(className, true && 'upload-file')
33
- }, props), children, /*#__PURE__*/_react["default"].createElement(_Base["default"], (0, _extends2["default"])({
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
- className: (0, _clsx["default"])(true && 'govgr-file-upload')
39
- }, props)));
44
+ disabled: disabled,
45
+ className: (0, _clsx["default"])(true && 'govgr-file-input')
46
+ }, props)), children);
40
47
  });
41
48
 
42
49
  exports.FileUpload = FileUpload;
@@ -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-upload"
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-upload"
25
+ className="govgr-file-input"
26
26
  type="file"
27
27
  />
28
28
  </div>
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["name", "className", "children"];
3
+ var _excluded = ["name", "className", "children", "disabled", "hasFiles"];
4
4
  import React from 'react';
5
5
  import Base from '@digigov/react-core/Base';
6
6
  import clsx from 'clsx';
@@ -13,16 +13,23 @@ export var FileUpload = /*#__PURE__*/React.forwardRef(function FileUpload(_ref,
13
13
  var name = _ref.name,
14
14
  className = _ref.className,
15
15
  children = _ref.children,
16
+ disabled = _ref.disabled,
17
+ _ref$hasFiles = _ref.hasFiles,
18
+ hasFiles = _ref$hasFiles === void 0 ? false : _ref$hasFiles,
16
19
  props = _objectWithoutProperties(_ref, _excluded);
17
20
 
18
- return /*#__PURE__*/React.createElement("div", _extends({
19
- className: clsx(className, true && 'upload-file')
20
- }, props), children, /*#__PURE__*/React.createElement(Base, _extends({
21
+ return /*#__PURE__*/React.createElement(Base, {
22
+ as: "label",
23
+ tabIndex: 0,
24
+ role: "button",
25
+ className: clsx(className, !hasFiles && ['govgr-btn', 'govgr-btn-secondary'], hasFiles && 'govgr-link', true && 'govgr-label-file')
26
+ }, /*#__PURE__*/React.createElement(Base, _extends({
21
27
  as: "input",
22
28
  ref: ref,
23
29
  type: "file",
24
30
  name: name,
25
- className: clsx(true && 'govgr-file-upload')
26
- }, props)));
31
+ disabled: disabled,
32
+ className: clsx(true && 'govgr-file-input')
33
+ }, props)), children);
27
34
  });
28
35
  export default FileUpload;
@@ -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-upload"
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-upload"
25
+ className="govgr-file-input"
26
26
  type="file"
27
27
  />
28
28
  </div>
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["name", "className", "children"];
3
+ var _excluded = ["name", "className", "children", "disabled", "hasFiles"];
4
4
  import React from 'react';
5
5
  import Base from '@digigov/react-core/Base';
6
6
  import clsx from 'clsx';
@@ -13,16 +13,23 @@ export var FileUpload = /*#__PURE__*/React.forwardRef(function FileUpload(_ref,
13
13
  var name = _ref.name,
14
14
  className = _ref.className,
15
15
  children = _ref.children,
16
+ disabled = _ref.disabled,
17
+ _ref$hasFiles = _ref.hasFiles,
18
+ hasFiles = _ref$hasFiles === void 0 ? false : _ref$hasFiles,
16
19
  props = _objectWithoutProperties(_ref, _excluded);
17
20
 
18
- return /*#__PURE__*/React.createElement("div", _extends({
19
- className: clsx(className, true && 'upload-file')
20
- }, props), children, /*#__PURE__*/React.createElement(Base, _extends({
21
+ return /*#__PURE__*/React.createElement(Base, {
22
+ as: "label",
23
+ tabIndex: 0,
24
+ role: "button",
25
+ className: clsx(className, !hasFiles && ['govgr-btn', 'govgr-btn-secondary'], hasFiles && 'govgr-link', true && 'govgr-label-file')
26
+ }, /*#__PURE__*/React.createElement(Base, _extends({
21
27
  as: "input",
22
28
  ref: ref,
23
29
  type: "file",
24
30
  name: name,
25
- className: clsx(true && 'govgr-file-upload')
26
- }, props)));
31
+ disabled: disabled,
32
+ className: clsx(true && 'govgr-file-input')
33
+ }, props)), children);
27
34
  });
28
35
  export default FileUpload;
package/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Digigov v0.16.1
1
+ /** @license Digigov v0.16.2
2
2
  *
3
3
  * This source code is licensed under the BSD-2-Clause license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digigov/react-core",
3
- "version": "0.16.1",
3
+ "version": "0.16.2",
4
4
  "description": "@digigov react core components",
5
5
  "author": "GRNET Developers <devs@lists.grnet.gr>",
6
6
  "license": "BSD-2-Clause",
@@ -11,7 +11,7 @@
11
11
  "directory": "dist"
12
12
  },
13
13
  "peerDependencies": {
14
- "@digigov/css": "0.29.4",
14
+ "@digigov/css": "0.29.5",
15
15
  "clsx": "1.1.1",
16
16
  "react": "16.14.0",
17
17
  "react-dom": "16.14.0"