@instructure/ui-file-drop 8.56.0 → 8.56.2-pr-snapshot-1721749364069
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 +16 -0
- package/lib/FileDrop/FileDropLocator.js +3 -3
- package/lib/FileDrop/index.js +13 -16
- package/lib/FileDrop/props.js +2 -2
- package/package.json +15 -15
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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
|
+
## [8.56.2-pr-snapshot-1721749364069](https://github.com/instructure/instructure-ui/compare/v8.56.1...v8.56.2-pr-snapshot-1721749364069) (2024-07-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-file-drop
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [8.56.1](https://github.com/instructure/instructure-ui/compare/v8.56.0...v8.56.1) (2024-06-13)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @instructure/ui-file-drop
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
# [8.56.0](https://github.com/instructure/instructure-ui/compare/v8.55.1...v8.56.0) (2024-05-06)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @instructure/ui-file-drop
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.FileDropLocator = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _uiTestLocator = require("@instructure/ui-test-locator");
|
|
8
8
|
var _index = require("./index");
|
|
9
9
|
/*
|
|
10
10
|
* The MIT License (MIT)
|
|
@@ -30,8 +30,8 @@ var _index = require("./index");
|
|
|
30
30
|
* SOFTWARE.
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
|
-
const fileInputLocator = (0,
|
|
34
|
-
const FileDropLocator = exports.FileDropLocator = (0,
|
|
33
|
+
const fileInputLocator = (0, _uiTestLocator.locator)('input[type="file"]');
|
|
34
|
+
const FileDropLocator = exports.FileDropLocator = (0, _uiTestLocator.locator)(_index.FileDrop.selector, {
|
|
35
35
|
// the file input isn't visible in this component,
|
|
36
36
|
// so we need special locator methods to interact w/ it
|
|
37
37
|
click: async (element, init, options) => {
|
package/lib/FileDrop/index.js
CHANGED
|
@@ -10,13 +10,10 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _keycode = _interopRequireDefault(require("keycode"));
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
18
|
-
var _getInteraction = require("@instructure/ui-react-utils/lib/getInteraction.js");
|
|
19
|
-
var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
|
|
13
|
+
var _uiFormField = require("@instructure/ui-form-field");
|
|
14
|
+
var _uiView = require("@instructure/ui-view");
|
|
15
|
+
var _uiTestable = require("@instructure/ui-testable");
|
|
16
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
20
17
|
var _accepts = require("./utils/accepts");
|
|
21
18
|
var _getEventFiles = require("./utils/getEventFiles");
|
|
22
19
|
var _emotion = require("@instructure/emotion");
|
|
@@ -58,7 +55,7 @@ function keyEventIsClickButton(e) {
|
|
|
58
55
|
category: components
|
|
59
56
|
---
|
|
60
57
|
**/
|
|
61
|
-
let FileDrop = exports.FileDrop = (_dec = (0,
|
|
58
|
+
let FileDrop = exports.FileDrop = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec3 = (0, _uiTestable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class FileDrop extends _react.Component {
|
|
62
59
|
constructor(props) {
|
|
63
60
|
super(props);
|
|
64
61
|
this.makeStyleProps = () => {
|
|
@@ -221,7 +218,7 @@ let FileDrop = exports.FileDrop = (_dec = (0, _withDeterministicId.withDetermini
|
|
|
221
218
|
return this.props.messages && this.props.messages.length > 0;
|
|
222
219
|
}
|
|
223
220
|
get interaction() {
|
|
224
|
-
return (0,
|
|
221
|
+
return (0, _uiReactUtils.getInteraction)({
|
|
225
222
|
props: this.props
|
|
226
223
|
});
|
|
227
224
|
}
|
|
@@ -271,7 +268,7 @@ let FileDrop = exports.FileDrop = (_dec = (0, _withDeterministicId.withDetermini
|
|
|
271
268
|
}
|
|
272
269
|
renderLabel() {
|
|
273
270
|
const renderLabel = this.props.renderLabel;
|
|
274
|
-
return (0,
|
|
271
|
+
return (0, _uiReactUtils.callRenderProp)(renderLabel, {
|
|
275
272
|
isDragAccepted: this.state.isDragAccepted,
|
|
276
273
|
isDragRejected: this.state.isDragRejected,
|
|
277
274
|
interaction: this.interaction
|
|
@@ -291,7 +288,7 @@ let FileDrop = exports.FileDrop = (_dec = (0, _withDeterministicId.withDetermini
|
|
|
291
288
|
props = (0, _objectWithoutProperties2.default)(_this$props7, _excluded);
|
|
292
289
|
const id = this.props.id || this.defaultId;
|
|
293
290
|
const focusColor = this.state.isDragRejected || this.invalid ? 'danger' : void 0;
|
|
294
|
-
return (0, _emotion.jsx)(
|
|
291
|
+
return (0, _emotion.jsx)(_uiView.View, {
|
|
295
292
|
display: display,
|
|
296
293
|
position: "relative" // contain visually hidden file input element
|
|
297
294
|
,
|
|
@@ -308,7 +305,7 @@ let FileDrop = exports.FileDrop = (_dec = (0, _withDeterministicId.withDetermini
|
|
|
308
305
|
onDragOver: this.handleDragOver,
|
|
309
306
|
onDragLeave: this.handleDragLeave,
|
|
310
307
|
onDrop: this.handleChange
|
|
311
|
-
}, (0, _emotion.jsx)(
|
|
308
|
+
}, (0, _emotion.jsx)(_uiView.View, {
|
|
312
309
|
display: "block",
|
|
313
310
|
position: "relative",
|
|
314
311
|
withFocusOutline: this.state.isFocused,
|
|
@@ -319,9 +316,9 @@ let FileDrop = exports.FileDrop = (_dec = (0, _withDeterministicId.withDetermini
|
|
|
319
316
|
css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.fileDropLabelContent
|
|
320
317
|
}, (0, _emotion.jsx)("span", {
|
|
321
318
|
css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.fileDropLayout
|
|
322
|
-
}, (0, _emotion.jsx)(
|
|
319
|
+
}, (0, _emotion.jsx)(_uiView.View, {
|
|
323
320
|
height: height
|
|
324
|
-
}, this.renderLabel()))))), (0, _emotion.jsx)("input", Object.assign({}, (0,
|
|
321
|
+
}, this.renderLabel()))))), (0, _emotion.jsx)("input", Object.assign({}, (0, _uiReactUtils.passthroughProps)(props), {
|
|
325
322
|
onClick: this.handleClick,
|
|
326
323
|
type: "file",
|
|
327
324
|
css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.fileDropInput,
|
|
@@ -336,10 +333,10 @@ let FileDrop = exports.FileDrop = (_dec = (0, _withDeterministicId.withDetermini
|
|
|
336
333
|
onChange: this.handleChange,
|
|
337
334
|
"aria-describedby": this.hasMessages ? this.messagesId : void 0,
|
|
338
335
|
disabled: this.functionallyDisabled
|
|
339
|
-
})), this.hasMessages ? (0, _emotion.jsx)(
|
|
336
|
+
})), this.hasMessages ? (0, _emotion.jsx)(_uiView.View, {
|
|
340
337
|
display: "block",
|
|
341
338
|
margin: "small 0 0"
|
|
342
|
-
}, (0, _emotion.jsx)(
|
|
339
|
+
}, (0, _emotion.jsx)(_uiFormField.FormFieldMessages, {
|
|
343
340
|
id: this.messagesId,
|
|
344
341
|
messages: this.props.messages
|
|
345
342
|
})) : null);
|
package/lib/FileDrop/props.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.propTypes = exports.allowedProps = void 0;
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var
|
|
9
|
+
var _uiFormField = require("@instructure/ui-form-field");
|
|
10
10
|
var _emotion = require("@instructure/emotion");
|
|
11
11
|
/*
|
|
12
12
|
* The MIT License (MIT)
|
|
@@ -36,7 +36,7 @@ const propTypes = exports.propTypes = {
|
|
|
36
36
|
id: _propTypes.default.string,
|
|
37
37
|
renderLabel: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.node]).isRequired,
|
|
38
38
|
accept: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.string)]),
|
|
39
|
-
messages: _propTypes.default.arrayOf(
|
|
39
|
+
messages: _propTypes.default.arrayOf(_uiFormField.FormPropTypes.message),
|
|
40
40
|
onClick: _propTypes.default.func,
|
|
41
41
|
onDrop: _propTypes.default.func,
|
|
42
42
|
onDropAccepted: _propTypes.default.func,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-file-drop",
|
|
3
|
-
"version": "8.56.
|
|
3
|
+
"version": "8.56.2-pr-snapshot-1721749364069",
|
|
4
4
|
"description": "A flexible facade for an HTML file input",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -24,24 +24,24 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.23.2",
|
|
27
|
-
"@instructure/console": "8.56.
|
|
28
|
-
"@instructure/emotion": "8.56.
|
|
29
|
-
"@instructure/shared-types": "8.56.
|
|
30
|
-
"@instructure/ui-color-utils": "8.56.
|
|
31
|
-
"@instructure/ui-form-field": "8.56.
|
|
32
|
-
"@instructure/ui-react-utils": "8.56.
|
|
33
|
-
"@instructure/ui-testable": "8.56.
|
|
34
|
-
"@instructure/ui-utils": "8.56.
|
|
35
|
-
"@instructure/ui-view": "8.56.
|
|
36
|
-
"@instructure/uid": "8.56.
|
|
27
|
+
"@instructure/console": "8.56.2-pr-snapshot-1721749364069",
|
|
28
|
+
"@instructure/emotion": "8.56.2-pr-snapshot-1721749364069",
|
|
29
|
+
"@instructure/shared-types": "8.56.2-pr-snapshot-1721749364069",
|
|
30
|
+
"@instructure/ui-color-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
31
|
+
"@instructure/ui-form-field": "8.56.2-pr-snapshot-1721749364069",
|
|
32
|
+
"@instructure/ui-react-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
33
|
+
"@instructure/ui-testable": "8.56.2-pr-snapshot-1721749364069",
|
|
34
|
+
"@instructure/ui-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
35
|
+
"@instructure/ui-view": "8.56.2-pr-snapshot-1721749364069",
|
|
36
|
+
"@instructure/uid": "8.56.2-pr-snapshot-1721749364069",
|
|
37
37
|
"keycode": "^2.2.1",
|
|
38
38
|
"prop-types": "^15.8.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@instructure/ui-babel-preset": "8.56.
|
|
42
|
-
"@instructure/ui-test-locator": "8.56.
|
|
43
|
-
"@instructure/ui-test-utils": "8.56.
|
|
44
|
-
"@instructure/ui-themes": "8.56.
|
|
41
|
+
"@instructure/ui-babel-preset": "8.56.2-pr-snapshot-1721749364069",
|
|
42
|
+
"@instructure/ui-test-locator": "8.56.2-pr-snapshot-1721749364069",
|
|
43
|
+
"@instructure/ui-test-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
44
|
+
"@instructure/ui-themes": "8.56.2-pr-snapshot-1721749364069"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"react": ">=16.8 <=18"
|