react-ui-basics 0.0.213 → 0.0.214

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-ui-basics",
3
- "version": "0.0.213",
3
+ "version": "0.0.214",
4
4
  "description": "",
5
5
  "module": "index.js",
6
6
  "_main": "index.cjs.js",
package/src/Checkbox.tsx CHANGED
@@ -6,8 +6,8 @@ import {PureComponent, render, propsGetter} from "./ReactConstants";
6
6
 
7
7
  export interface CheckboxProps {
8
8
  value: boolean,
9
- onChange: ChangeEventHandler,
10
- label: string | ReactElement,
9
+ onChange: ChangeEventHandler<HTMLInputElement>,
10
+ label?: string | ReactElement,
11
11
  name?: string,
12
12
  id?: string | number,
13
13
  disabled?: boolean,
@@ -9,7 +9,7 @@ export interface DropFileInputProps {
9
9
  icon?: MaterialIconType,
10
10
  label?: string | ReactElement,
11
11
  droppable?: boolean,
12
- onDrop?: DragEventHandler,
12
+ onDrop?: (files: File[]) => void,
13
13
  multiple?: boolean,
14
14
  accept?: string,
15
15
  }
@@ -1,4 +1,4 @@
1
- import ReactConstants from "./../ReactConstants"; import {clientHeight as __clientHeight, clientWidth as __clientWidth, createAccessor as __createAccessor, data as __data, height as __height, left as __left, length as __length, pageX as __pageX, pageY as __pageY, props as __props, scrollLeft as __scrollLeft, scrollTop as __scrollTop, state as __state, style as __style, target as __target, top as __top, value as __value, width as __width} from "./../CommonFields"; import {toConsumableArray as __toConsumableArray} from "./../_virtual/_rollupPluginBabelHelpers"; import {extends as __extends} from "./../_virtual/_rollupPluginBabelHelpers"; import {inherits as __inherits} from "./../_virtual/_rollupPluginBabelHelpers"; import './Dropzone.css'; import React from 'react';
1
+ import React, {ReactElement, ReactNode} from 'react';
2
2
  import PropTypes from "prop-types";
3
3
  import ReactCreateElement from './ReactCreateElement';
4
4
  import './Dropzone.css'
@@ -10,7 +10,7 @@ const toArray = (o) => {
10
10
  return o;
11
11
 
12
12
  const l = [];
13
- for (let i = 0; i < __length(o); i++) {
13
+ for (let i = 0; i < o.length; i++) {
14
14
  l.push(o[i])
15
15
  }
16
16
  return l;
@@ -30,7 +30,19 @@ const ignoredTypes = setOf([
30
30
 
31
31
  const ignore = dt => dt && (!dt.types[0] || ignoredTypes[dt.types[0]]);
32
32
 
33
- class Dropzone extends PureComponent {
33
+ export interface DropzoneProps {
34
+ onDrop: (files: File[]) => void,
35
+ className?: string,
36
+ overlayLabel?: string | ReactElement,
37
+ clickable?: boolean,
38
+ droppable?: boolean,
39
+ multiple?: boolean,
40
+ disabled?: boolean,
41
+ accept?: string,
42
+ children?: ReactNode
43
+ }
44
+
45
+ class Dropzone extends PureComponent<DropzoneProps> {
34
46
 
35
47
  constructor(properties) {
36
48
  super(properties);
@@ -40,11 +52,11 @@ class Dropzone extends PureComponent {
40
52
  let entries = [];
41
53
 
42
54
  const props = propsGetter(that);
43
- const isDragging = stateGS(that);
55
+ const isDragging = stateGS<boolean>(that);
44
56
 
45
57
  const onDrop = (e) => {
46
58
  const dt = e.dataTransfer;
47
- const files = toArray(dt && dt.files || __target(e).files);
59
+ const files = toArray(dt && dt.files || e.target.files);
48
60
  props().onDrop(files);
49
61
  isDragging(false);
50
62
  entries = [];
@@ -61,8 +73,9 @@ class Dropzone extends PureComponent {
61
73
  const onDragEnter = (e) => {
62
74
  const dt = e.dataTransfer;
63
75
  if (ignore(dt)) return;
64
- if (entries.indexOf(__target(e)) === -1) {
65
- entries.push(__target(e))
76
+
77
+ if (entries.indexOf(e.target) === -1) {
78
+ entries.push(e.target)
66
79
  }
67
80
 
68
81
  dt && (dt.dropEffect = 'copy');
@@ -70,9 +83,9 @@ class Dropzone extends PureComponent {
70
83
  prevent(e);
71
84
  };
72
85
  const onDragLeave = (e) => {
73
- entries = entries.filter(el => el !== __target(e));
86
+ entries = entries.filter(el => el !== e.target);
74
87
 
75
- if (__length(entries) === 0)
88
+ if (entries.length === 0)
76
89
  isDragging(false);
77
90
 
78
91
  prevent(e)
@@ -80,8 +93,17 @@ class Dropzone extends PureComponent {
80
93
 
81
94
  const inputRef = createRef()
82
95
 
83
- that[ReactConstants[3]] = () => {
84
- const {children, className, disabled, clickable, multiple, droppable, overlayLabel, accept} = props();
96
+ that[render] = () => {
97
+ const {
98
+ children,
99
+ className,
100
+ disabled,
101
+ clickable = true,
102
+ multiple = true,
103
+ droppable = true,
104
+ overlayLabel,
105
+ accept
106
+ } = props();
85
107
 
86
108
  return <div className={classNames('Dropzone', className, isDragging() && 'dragging')}
87
109
  onDragLeave={!disabled && droppable && onDragLeave || UNDEFINED}
@@ -109,26 +131,4 @@ class Dropzone extends PureComponent {
109
131
  }
110
132
  }
111
133
 
112
- Dropzone.defaultProps = {
113
- clickable: true,
114
- multiple: true,
115
- droppable: true,
116
- };
117
-
118
- if (process.env.NODE_ENV !== 'production') {
119
- Dropzone.propTypes = {
120
- [ReactConstants[5]]: PropTypes.string,
121
- overlayLabel: PropTypes.oneOfType([
122
- PropTypes.string,
123
- PropTypes.element
124
- ]),
125
- clickable: PropTypes.bool,
126
- droppable: PropTypes.bool,
127
- multiple: PropTypes.bool,
128
- disabled: PropTypes.bool,
129
- onDrop: PropTypes.func.isRequired,
130
- accept: PropTypes.string,
131
- };
132
- }
133
-
134
134
  export default Dropzone;