@dhis2-ui/file-input 9.11.0 → 9.11.1-beta.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/build/cjs/file-input/__tests__/file-input.test.js +1 -9
- package/build/cjs/file-input/features/accepts_multiple_files/index.js +1 -2
- package/build/cjs/file-input/features/can_be_blurred/index.js +1 -2
- package/build/cjs/file-input/features/can_be_changed/index.js +1 -2
- package/build/cjs/file-input/features/can_be_focused/index.js +1 -2
- package/build/cjs/file-input/features/common/index.js +0 -1
- package/build/cjs/file-input/file-input.e2e.stories.js +49 -0
- package/build/cjs/file-input/file-input.js +13 -44
- package/build/cjs/file-input/{file-input.stories.js → file-input.prod.stories.js} +29 -36
- package/build/cjs/file-input/index.js +0 -1
- package/build/cjs/file-input-field/__tests__/file-input-field.test.js +1 -9
- package/build/cjs/file-input-field/features/can_be_required/index.js +0 -1
- package/build/cjs/file-input-field/features/has_default_button_label/index.js +0 -1
- package/build/cjs/file-input-field/features/has_default_placeholder/index.js +0 -1
- package/build/cjs/file-input-field/file-input-field.e2e.stories.js +24 -0
- package/build/cjs/file-input-field/file-input-field.js +8 -36
- package/build/cjs/file-input-field/{file-input-field.stories.js → file-input-field.prod.stories.js} +33 -51
- package/build/cjs/file-input-field/index.js +0 -1
- package/build/cjs/file-input-field-with-list/__tests__/file-input-field-with-list.test.js +1 -9
- package/build/cjs/file-input-field-with-list/features/common/index.js +0 -1
- package/build/cjs/file-input-field-with-list/features/deduplicates_the_file_list/index.js +0 -1
- package/build/cjs/file-input-field-with-list/features/disables_button_when_full/index.js +0 -1
- package/build/cjs/file-input-field-with-list/features/displays_files_in_a_list/index.js +0 -1
- package/build/cjs/file-input-field-with-list/features/files_can_be_removed/index.js +0 -1
- package/build/cjs/file-input-field-with-list/features/has_default_button_label/index.js +0 -1
- package/build/cjs/file-input-field-with-list/features/has_default_placeholder/index.js +0 -1
- package/build/cjs/file-input-field-with-list/features/has_default_remove_text/index.js +0 -1
- package/build/cjs/file-input-field-with-list/file-input-field-with-list.e2e.stories.js +63 -0
- package/build/cjs/file-input-field-with-list/file-input-field-with-list.js +9 -47
- package/build/cjs/file-input-field-with-list/{file-input-field-with-list.stories.js → file-input-field-with-list.prod.stories.js} +24 -27
- package/build/cjs/file-input-field-with-list/file-list-item-with-remove.js +7 -17
- package/build/cjs/file-input-field-with-list/index.js +0 -1
- package/build/cjs/file-list/features/accepts_cancel_text/index.js +1 -2
- package/build/cjs/file-list/features/accepts_label/index.js +0 -1
- package/build/cjs/file-list/features/accepts_remove_text/index.js +1 -2
- package/build/cjs/file-list/features/can_be_removed/index.js +1 -2
- package/build/cjs/file-list/features/file-list-item-accepts_children/index.js +0 -1
- package/build/cjs/file-list/features/file-list-placeholder-accepts_children/index.js +0 -1
- package/build/cjs/file-list/features/loading_can_be_cancelled/index.js +1 -2
- package/build/cjs/file-list/file-list-item.e2e.stories.js +49 -0
- package/build/cjs/file-list/file-list-item.js +5 -18
- package/build/cjs/file-list/file-list-placeholder.e2e.stories.js +14 -0
- package/build/cjs/file-list/file-list-placeholder.js +2 -9
- package/build/cjs/file-list/file-list.e2e.stories.js +14 -0
- package/build/cjs/file-list/file-list.js +1 -7
- package/build/cjs/file-list/index.js +0 -3
- package/build/cjs/index.js +0 -4
- package/build/cjs/locales/index.js +3 -73
- package/build/es/file-input/features/accepts_multiple_files/index.js +1 -1
- package/build/es/file-input/features/can_be_blurred/index.js +1 -1
- package/build/es/file-input/features/can_be_changed/index.js +1 -1
- package/build/es/file-input/features/can_be_focused/index.js +1 -1
- package/build/es/file-input/{file-input.stories.e2e.js → file-input.e2e.stories.js} +14 -9
- package/build/es/file-input/file-input.js +10 -31
- package/build/es/file-input/{file-input.stories.js → file-input.prod.stories.js} +23 -15
- package/build/es/file-input-field/file-input-field.e2e.stories.js +15 -0
- package/build/es/file-input-field/file-input-field.js +5 -23
- package/build/es/file-input-field/{file-input-field.stories.js → file-input-field.prod.stories.js} +21 -15
- package/build/es/file-input-field-with-list/{file-input-field-with-list.stories.e2e.js → file-input-field-with-list.e2e.stories.js} +15 -10
- package/build/es/file-input-field-with-list/file-input-field-with-list.js +8 -35
- package/build/es/file-input-field-with-list/{file-input-field-with-list.stories.js → file-input-field-with-list.prod.stories.js} +19 -11
- package/build/es/file-input-field-with-list/file-list-item-with-remove.js +4 -8
- package/build/es/file-list/features/accepts_cancel_text/index.js +1 -1
- package/build/es/file-list/features/accepts_remove_text/index.js +1 -1
- package/build/es/file-list/features/can_be_removed/index.js +1 -1
- package/build/es/file-list/features/loading_can_be_cancelled/index.js +1 -1
- package/build/es/file-list/{file-list-item.stories.e2e.js → file-list-item.e2e.stories.js} +13 -7
- package/build/es/file-list/file-list-item.js +4 -9
- package/build/es/file-list/file-list-placeholder.e2e.stories.js +6 -0
- package/build/es/file-list/file-list-placeholder.js +1 -3
- package/build/es/file-list/file-list.e2e.stories.js +6 -0
- package/build/es/file-list/file-list.js +0 -2
- package/package.json +11 -11
- package/build/cjs/file-input/file-input.stories.e2e.js +0 -40
- package/build/cjs/file-input-field/file-input-field.stories.e2e.js +0 -19
- package/build/cjs/file-input-field-with-list/file-input-field-with-list.stories.e2e.js +0 -53
- package/build/cjs/file-list/file-list-item.stories.e2e.js +0 -38
- package/build/cjs/file-list/file-list-placeholder.stories.e2e.js +0 -11
- package/build/cjs/file-list/file-list.stories.e2e.js +0 -11
- package/build/es/file-input-field/file-input-field.stories.e2e.js +0 -12
- package/build/es/file-list/file-list-placeholder.stories.e2e.js +0 -4
- package/build/es/file-list/file-list.stories.e2e.js +0 -4
|
@@ -4,25 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.FileListItemWithRemove = void 0;
|
|
7
|
-
|
|
8
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
|
-
|
|
9
|
+
var _index = require("../file-list/index.js");
|
|
10
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
14
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
15
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
22
16
|
class FileListItemWithRemove extends _react.Component {
|
|
23
17
|
constructor() {
|
|
24
18
|
super(...arguments);
|
|
25
|
-
|
|
26
19
|
_defineProperty(this, "handleRemove", event => {
|
|
27
20
|
const {
|
|
28
21
|
onRemove,
|
|
@@ -33,7 +26,6 @@ class FileListItemWithRemove extends _react.Component {
|
|
|
33
26
|
}, event);
|
|
34
27
|
});
|
|
35
28
|
}
|
|
36
|
-
|
|
37
29
|
render() {
|
|
38
30
|
const {
|
|
39
31
|
label,
|
|
@@ -47,9 +39,7 @@ class FileListItemWithRemove extends _react.Component {
|
|
|
47
39
|
className: className
|
|
48
40
|
});
|
|
49
41
|
}
|
|
50
|
-
|
|
51
42
|
}
|
|
52
|
-
|
|
53
43
|
exports.FileListItemWithRemove = FileListItemWithRemove;
|
|
54
44
|
FileListItemWithRemove.propTypes = {
|
|
55
45
|
label: _propTypes.default.string.isRequired,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
|
4
|
-
|
|
5
4
|
(0, _cypressCucumberPreprocessor.Given)('a loading FileListItem with onCancel handler and cancelText is rendered', () => {
|
|
6
|
-
cy.visitStory('FileListItem', 'Loading with
|
|
5
|
+
cy.visitStory('FileListItem', 'Loading with on cancel and cancel text');
|
|
7
6
|
});
|
|
8
7
|
(0, _cypressCucumberPreprocessor.Then)('the cancelText will be visible', () => {
|
|
9
8
|
cy.get('[data-test="dhis2-uicore-filelistitem-cancel"]').contains('Cancel').should('be.visible');
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
|
4
|
-
|
|
5
4
|
(0, _cypressCucumberPreprocessor.Given)('a FileListItem with removeText is rendered', () => {
|
|
6
|
-
cy.visitStory('FileListItem', 'With
|
|
5
|
+
cy.visitStory('FileListItem', 'With remove text');
|
|
7
6
|
});
|
|
8
7
|
(0, _cypressCucumberPreprocessor.Then)('the removeText will be visible', () => {
|
|
9
8
|
cy.get('[data-test="dhis2-uicore-filelistitem-remove"]').contains('Remove').should('be.visible');
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
|
4
|
-
|
|
5
4
|
(0, _cypressCucumberPreprocessor.Given)('a FileListItem with Onremove handler is rendered', () => {
|
|
6
|
-
cy.visitStory('FileListItem', 'With
|
|
5
|
+
cy.visitStory('FileListItem', 'With on remove');
|
|
7
6
|
});
|
|
8
7
|
(0, _cypressCucumberPreprocessor.When)('the user clicks on the remove text', () => {
|
|
9
8
|
cy.get('[data-test="dhis2-uicore-filelistitem-remove"]').click();
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
|
4
|
-
|
|
5
4
|
(0, _cypressCucumberPreprocessor.Given)('a FileList with children is rendered', () => {
|
|
6
5
|
cy.visitStory('FileList', 'With children');
|
|
7
6
|
cy.get('[data-test="dhis2-uicore-filelist"]').should('be.visible');
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
|
4
|
-
|
|
5
4
|
(0, _cypressCucumberPreprocessor.Given)('a FileListPlaceholder with children is rendered', () => {
|
|
6
5
|
cy.visitStory('FileListPlaceholder', 'With children');
|
|
7
6
|
cy.get('[data-test="dhis2-uicore-filelistplaceholder"]').should('be.visible');
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _cypressCucumberPreprocessor = require("@badeball/cypress-cucumber-preprocessor");
|
|
4
|
-
|
|
5
4
|
(0, _cypressCucumberPreprocessor.Given)('a loading FileListItem with onCancel handler is rendered', () => {
|
|
6
|
-
cy.visitStory('FileListItem', 'Loading with
|
|
5
|
+
cy.visitStory('FileListItem', 'Loading with on cancel');
|
|
7
6
|
});
|
|
8
7
|
(0, _cypressCucumberPreprocessor.When)('the user clicks on the cancel text', () => {
|
|
9
8
|
cy.get('[data-test="dhis2-uicore-filelistitem-cancel"]').click();
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.WithRemoveText = exports.WithOnRemove = exports.WithLabel = exports.LoadingWithOnCancelAndCancelText = exports.LoadingWithOnCancel = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _fileListItem = require("./file-list-item.js");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
window.onRemove = window.Cypress && window.Cypress.cy.stub();
|
|
11
|
+
window.onCancel = window.Cypress && window.Cypress.cy.stub();
|
|
12
|
+
var _default = exports.default = {
|
|
13
|
+
title: 'FileListItem'
|
|
14
|
+
};
|
|
15
|
+
const WithOnRemove = () => /*#__PURE__*/_react.default.createElement(_fileListItem.FileListItem, {
|
|
16
|
+
label: "File list item",
|
|
17
|
+
onRemove: window.onRemove,
|
|
18
|
+
removeText: "Remove"
|
|
19
|
+
});
|
|
20
|
+
exports.WithOnRemove = WithOnRemove;
|
|
21
|
+
const LoadingWithOnCancel = () => /*#__PURE__*/_react.default.createElement(_fileListItem.FileListItem, {
|
|
22
|
+
loading: true,
|
|
23
|
+
label: "File list item",
|
|
24
|
+
removeText: "Remove",
|
|
25
|
+
onCancel: window.onCancel,
|
|
26
|
+
cancelText: "Cancel"
|
|
27
|
+
});
|
|
28
|
+
exports.LoadingWithOnCancel = LoadingWithOnCancel;
|
|
29
|
+
const LoadingWithOnCancelAndCancelText = () => /*#__PURE__*/_react.default.createElement(_fileListItem.FileListItem, {
|
|
30
|
+
loading: true,
|
|
31
|
+
label: "File list item",
|
|
32
|
+
removeText: "Remove",
|
|
33
|
+
onCancel: () => {},
|
|
34
|
+
onRemove: () => {},
|
|
35
|
+
cancelText: "Cancel"
|
|
36
|
+
});
|
|
37
|
+
exports.LoadingWithOnCancelAndCancelText = LoadingWithOnCancelAndCancelText;
|
|
38
|
+
const WithLabel = () => /*#__PURE__*/_react.default.createElement(_fileListItem.FileListItem, {
|
|
39
|
+
label: "Label",
|
|
40
|
+
removeText: "Remove",
|
|
41
|
+
onRemove: () => {}
|
|
42
|
+
});
|
|
43
|
+
exports.WithLabel = WithLabel;
|
|
44
|
+
const WithRemoveText = () => /*#__PURE__*/_react.default.createElement(_fileListItem.FileListItem, {
|
|
45
|
+
label: "Label",
|
|
46
|
+
removeText: "Remove",
|
|
47
|
+
onRemove: () => {}
|
|
48
|
+
});
|
|
49
|
+
exports.WithRemoveText = WithRemoveText;
|
|
@@ -4,23 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.FileListItem = void 0;
|
|
7
|
-
|
|
8
7
|
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
9
|
-
|
|
10
|
-
var _loader = require("@dhis2-ui/loader");
|
|
11
|
-
|
|
12
8
|
var _uiConstants = require("@dhis2/ui-constants");
|
|
13
|
-
|
|
14
9
|
var _uiIcons = require("@dhis2/ui-icons");
|
|
15
|
-
|
|
10
|
+
var _loader = require("@dhis2-ui/loader");
|
|
16
11
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
|
-
|
|
18
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
19
|
-
|
|
20
13
|
var _react = _interopRequireDefault(require("react"));
|
|
21
|
-
|
|
22
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
15
|
const FileListItem = _ref => {
|
|
25
16
|
let {
|
|
26
17
|
className,
|
|
@@ -32,17 +23,14 @@ const FileListItem = _ref => {
|
|
|
32
23
|
cancelText,
|
|
33
24
|
dataTest
|
|
34
25
|
} = _ref;
|
|
35
|
-
|
|
36
26
|
const handleKeyDown = event => {
|
|
37
27
|
if (!onRemove) {
|
|
38
28
|
return;
|
|
39
29
|
}
|
|
40
|
-
|
|
41
30
|
if (event.key === 'Enter' || event.key === 'Backspace' || event.key === 'Delete') {
|
|
42
31
|
onRemove({}, event);
|
|
43
32
|
}
|
|
44
33
|
};
|
|
45
|
-
|
|
46
34
|
return /*#__PURE__*/_react.default.createElement("p", {
|
|
47
35
|
"data-test": dataTest,
|
|
48
36
|
className: _style.default.dynamic([["513536609", [_uiConstants.spacers.dp4, _uiConstants.colors.grey900, _uiConstants.colors.grey700, _uiConstants.colors.red700, _uiConstants.colors.red800, _uiConstants.theme.focus]]]) + " " + ((0, _classnames.default)('selected-file', className) || "")
|
|
@@ -58,20 +46,19 @@ const FileListItem = _ref => {
|
|
|
58
46
|
className: _style.default.dynamic([["513536609", [_uiConstants.spacers.dp4, _uiConstants.colors.grey900, _uiConstants.colors.grey700, _uiConstants.colors.red700, _uiConstants.colors.red800, _uiConstants.theme.focus]]]) + " " + "label"
|
|
59
47
|
}, label), loading && onCancel && cancelText && /*#__PURE__*/_react.default.createElement("span", {
|
|
60
48
|
onClick: event => onCancel({}, event),
|
|
61
|
-
"data-test":
|
|
49
|
+
"data-test": `${dataTest}-cancel`,
|
|
62
50
|
className: _style.default.dynamic([["513536609", [_uiConstants.spacers.dp4, _uiConstants.colors.grey900, _uiConstants.colors.grey700, _uiConstants.colors.red700, _uiConstants.colors.red800, _uiConstants.theme.focus]]]) + " " + "action"
|
|
63
51
|
}, cancelText), !loading && /*#__PURE__*/_react.default.createElement("span", {
|
|
64
52
|
onClick: event => onRemove({}, event),
|
|
65
|
-
"data-test":
|
|
53
|
+
"data-test": `${dataTest}-remove`,
|
|
66
54
|
tabIndex: 0,
|
|
67
55
|
onKeyDown: handleKeyDown,
|
|
68
56
|
className: _style.default.dynamic([["513536609", [_uiConstants.spacers.dp4, _uiConstants.colors.grey900, _uiConstants.colors.grey700, _uiConstants.colors.red700, _uiConstants.colors.red800, _uiConstants.theme.focus]]]) + " " + "action"
|
|
69
57
|
}, removeText)), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
70
58
|
id: "513536609",
|
|
71
59
|
dynamic: [_uiConstants.spacers.dp4, _uiConstants.colors.grey900, _uiConstants.colors.grey700, _uiConstants.colors.red700, _uiConstants.colors.red800, _uiConstants.theme.focus]
|
|
72
|
-
}, [
|
|
60
|
+
}, [`p.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;margin:0;padding-top:${_uiConstants.spacers.dp4};}`, "span.__jsx-style-dynamic-selector{display:inline-block;}", ".icon.__jsx-style-dynamic-selector{margin-inline-end:4px;-webkit-box-flex:0;-webkit-flex-grow:0;-ms-flex-positive:0;flex-grow:0;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;padding-top:1px;}", ".text.__jsx-style-dynamic-selector{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;-webkit-flex-shrink:1;-ms-flex-negative:1;flex-shrink:1;}", `.label.__jsx-style-dynamic-selector{font-size:14px;color:${_uiConstants.colors.grey900};word-break:break-all;}`, ".label.__jsx-style-dynamic-selector::after{content:' ';display:inline-block;width:12px;}", `.action.__jsx-style-dynamic-selector{font-size:12px;line-height:12px;margin-top:0;-webkit-text-decoration:underline;text-decoration:underline;cursor:pointer;color:${_uiConstants.colors.grey700};}`, `.action.__jsx-style-dynamic-selector:hover{color:${_uiConstants.colors.red700};}`, `.action.__jsx-style-dynamic-selector:active{color:${_uiConstants.colors.red800};}`, `.action.__jsx-style-dynamic-selector:focus{outline:3px solid ${_uiConstants.theme.focus};outline-offset:2px;}`]));
|
|
73
61
|
};
|
|
74
|
-
|
|
75
62
|
exports.FileListItem = FileListItem;
|
|
76
63
|
FileListItem.defaultProps = {
|
|
77
64
|
dataTest: 'dhis2-uicore-filelistitem'
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.WithChildren = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _fileListPlaceholder = require("./file-list-placeholder.js");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
var _default = exports.default = {
|
|
11
|
+
title: 'FileListPlaceholder'
|
|
12
|
+
};
|
|
13
|
+
const WithChildren = () => /*#__PURE__*/_react.default.createElement(_fileListPlaceholder.FileListPlaceholder, null, "I am a child");
|
|
14
|
+
exports.WithChildren = WithChildren;
|
|
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.FileListPlaceholder = void 0;
|
|
7
|
-
|
|
8
7
|
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
9
|
-
|
|
10
8
|
var _uiConstants = require("@dhis2/ui-constants");
|
|
11
|
-
|
|
12
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
10
|
var _react = _interopRequireDefault(require("react"));
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
12
|
const FileListPlaceholder = _ref => {
|
|
19
13
|
let {
|
|
20
14
|
children,
|
|
@@ -26,9 +20,8 @@ const FileListPlaceholder = _ref => {
|
|
|
26
20
|
}, children, /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
27
21
|
id: "1287857385",
|
|
28
22
|
dynamic: [_uiConstants.spacers.dp4, _uiConstants.colors.grey700]
|
|
29
|
-
}, [
|
|
23
|
+
}, [`p.__jsx-style-dynamic-selector{margin:0;padding-top:${_uiConstants.spacers.dp4};font-size:14px;color:${_uiConstants.colors.grey700};}`]));
|
|
30
24
|
};
|
|
31
|
-
|
|
32
25
|
exports.FileListPlaceholder = FileListPlaceholder;
|
|
33
26
|
FileListPlaceholder.defaultProps = {
|
|
34
27
|
dataTest: 'dhis2-uicore-filelistplaceholder'
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.WithChildren = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _fileList = require("./file-list.js");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
var _default = exports.default = {
|
|
11
|
+
title: 'FileList'
|
|
12
|
+
};
|
|
13
|
+
const WithChildren = () => /*#__PURE__*/_react.default.createElement(_fileList.FileList, null, "I am a child");
|
|
14
|
+
exports.WithChildren = WithChildren;
|
|
@@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.FileList = void 0;
|
|
7
|
-
|
|
8
7
|
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
var _react = _interopRequireDefault(require("react"));
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
11
|
const FileList = _ref => {
|
|
17
12
|
let {
|
|
18
13
|
children,
|
|
@@ -26,7 +21,6 @@ const FileList = _ref => {
|
|
|
26
21
|
id: "2770071620"
|
|
27
22
|
}, ["div.jsx-2770071620{padding-top:4px;}", ".file-input+div.jsx-2770071620{padding-top:0;}"]));
|
|
28
23
|
};
|
|
29
|
-
|
|
30
24
|
exports.FileList = FileList;
|
|
31
25
|
FileList.defaultProps = {
|
|
32
26
|
dataTest: 'dhis2-uicore-filelist'
|
|
@@ -21,9 +21,6 @@ Object.defineProperty(exports, "FileListPlaceholder", {
|
|
|
21
21
|
return _fileListPlaceholder.FileListPlaceholder;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
|
|
25
24
|
var _fileList = require("./file-list.js");
|
|
26
|
-
|
|
27
25
|
var _fileListItem = require("./file-list-item.js");
|
|
28
|
-
|
|
29
26
|
var _fileListPlaceholder = require("./file-list-placeholder.js");
|
package/build/cjs/index.js
CHANGED
|
@@ -39,11 +39,7 @@ Object.defineProperty(exports, "FileListPlaceholder", {
|
|
|
39
39
|
return _index2.FileListPlaceholder;
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
|
-
|
|
43
42
|
var _index = require("./file-input/index.js");
|
|
44
|
-
|
|
45
43
|
var _index2 = require("./file-list/index.js");
|
|
46
|
-
|
|
47
44
|
var _index3 = require("./file-input-field/index.js");
|
|
48
|
-
|
|
49
45
|
var _index4 = require("./file-input-field-with-list/index.js");
|
|
@@ -4,77 +4,41 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
|
|
9
|
-
|
|
10
8
|
var _translations = _interopRequireDefault(require("./ar/translations.json"));
|
|
11
|
-
|
|
12
9
|
var _translations2 = _interopRequireDefault(require("./ar_IQ/translations.json"));
|
|
13
|
-
|
|
14
10
|
var _translations3 = _interopRequireDefault(require("./ckb/translations.json"));
|
|
15
|
-
|
|
16
11
|
var _translations4 = _interopRequireDefault(require("./cs/translations.json"));
|
|
17
|
-
|
|
18
12
|
var _translations5 = _interopRequireDefault(require("./da/translations.json"));
|
|
19
|
-
|
|
20
13
|
var _translations6 = _interopRequireDefault(require("./en/translations.json"));
|
|
21
|
-
|
|
22
14
|
var _translations7 = _interopRequireDefault(require("./es/translations.json"));
|
|
23
|
-
|
|
24
15
|
var _translations8 = _interopRequireDefault(require("./es_419/translations.json"));
|
|
25
|
-
|
|
26
16
|
var _translations9 = _interopRequireDefault(require("./fr/translations.json"));
|
|
27
|
-
|
|
28
17
|
var _translations10 = _interopRequireDefault(require("./id/translations.json"));
|
|
29
|
-
|
|
30
18
|
var _translations11 = _interopRequireDefault(require("./km/translations.json"));
|
|
31
|
-
|
|
32
19
|
var _translations12 = _interopRequireDefault(require("./ko_KR/translations.json"));
|
|
33
|
-
|
|
34
20
|
var _translations13 = _interopRequireDefault(require("./lo/translations.json"));
|
|
35
|
-
|
|
36
21
|
var _translations14 = _interopRequireDefault(require("./my/translations.json"));
|
|
37
|
-
|
|
38
22
|
var _translations15 = _interopRequireDefault(require("./nb/translations.json"));
|
|
39
|
-
|
|
40
23
|
var _translations16 = _interopRequireDefault(require("./nl/translations.json"));
|
|
41
|
-
|
|
42
24
|
var _translations17 = _interopRequireDefault(require("./prs/translations.json"));
|
|
43
|
-
|
|
44
25
|
var _translations18 = _interopRequireDefault(require("./ps/translations.json"));
|
|
45
|
-
|
|
46
26
|
var _translations19 = _interopRequireDefault(require("./pt/translations.json"));
|
|
47
|
-
|
|
48
27
|
var _translations20 = _interopRequireDefault(require("./pt_BR/translations.json"));
|
|
49
|
-
|
|
50
28
|
var _translations21 = _interopRequireDefault(require("./ru/translations.json"));
|
|
51
|
-
|
|
52
29
|
var _translations22 = _interopRequireDefault(require("./si/translations.json"));
|
|
53
|
-
|
|
54
30
|
var _translations23 = _interopRequireDefault(require("./sv/translations.json"));
|
|
55
|
-
|
|
56
31
|
var _translations24 = _interopRequireDefault(require("./tet/translations.json"));
|
|
57
|
-
|
|
58
32
|
var _translations25 = _interopRequireDefault(require("./tg/translations.json"));
|
|
59
|
-
|
|
60
33
|
var _translations26 = _interopRequireDefault(require("./uk/translations.json"));
|
|
61
|
-
|
|
62
34
|
var _translations27 = _interopRequireDefault(require("./ur/translations.json"));
|
|
63
|
-
|
|
64
35
|
var _translations28 = _interopRequireDefault(require("./uz_Latn/translations.json"));
|
|
65
|
-
|
|
66
36
|
var _translations29 = _interopRequireDefault(require("./uz_UZ_Cyrl/translations.json"));
|
|
67
|
-
|
|
68
37
|
var _translations30 = _interopRequireDefault(require("./uz_UZ_Latn/translations.json"));
|
|
69
|
-
|
|
70
38
|
var _translations31 = _interopRequireDefault(require("./vi/translations.json"));
|
|
71
|
-
|
|
72
39
|
var _translations32 = _interopRequireDefault(require("./zh/translations.json"));
|
|
73
|
-
|
|
74
40
|
var _translations33 = _interopRequireDefault(require("./zh_CN/translations.json"));
|
|
75
|
-
|
|
76
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
77
|
-
|
|
41
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
78
42
|
//------------------------------------------------------------------------------
|
|
79
43
|
// <auto-generated>
|
|
80
44
|
// This code was generated by d2-i18n-generate.
|
|
@@ -83,73 +47,39 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
83
47
|
// the code is regenerated.
|
|
84
48
|
// </auto-generated>
|
|
85
49
|
//------------------------------------------------------------------------------
|
|
86
|
-
const namespace = 'default';
|
|
87
50
|
|
|
51
|
+
const namespace = 'default';
|
|
88
52
|
_d2I18n.default.addResources('ar', namespace, _translations.default);
|
|
89
|
-
|
|
90
53
|
_d2I18n.default.addResources('ar_IQ', namespace, _translations2.default);
|
|
91
|
-
|
|
92
54
|
_d2I18n.default.addResources('ckb', namespace, _translations3.default);
|
|
93
|
-
|
|
94
55
|
_d2I18n.default.addResources('cs', namespace, _translations4.default);
|
|
95
|
-
|
|
96
56
|
_d2I18n.default.addResources('da', namespace, _translations5.default);
|
|
97
|
-
|
|
98
57
|
_d2I18n.default.addResources('en', namespace, _translations6.default);
|
|
99
|
-
|
|
100
58
|
_d2I18n.default.addResources('es', namespace, _translations7.default);
|
|
101
|
-
|
|
102
59
|
_d2I18n.default.addResources('es_419', namespace, _translations8.default);
|
|
103
|
-
|
|
104
60
|
_d2I18n.default.addResources('fr', namespace, _translations9.default);
|
|
105
|
-
|
|
106
61
|
_d2I18n.default.addResources('id', namespace, _translations10.default);
|
|
107
|
-
|
|
108
62
|
_d2I18n.default.addResources('km', namespace, _translations11.default);
|
|
109
|
-
|
|
110
63
|
_d2I18n.default.addResources('ko_KR', namespace, _translations12.default);
|
|
111
|
-
|
|
112
64
|
_d2I18n.default.addResources('lo', namespace, _translations13.default);
|
|
113
|
-
|
|
114
65
|
_d2I18n.default.addResources('my', namespace, _translations14.default);
|
|
115
|
-
|
|
116
66
|
_d2I18n.default.addResources('nb', namespace, _translations15.default);
|
|
117
|
-
|
|
118
67
|
_d2I18n.default.addResources('nl', namespace, _translations16.default);
|
|
119
|
-
|
|
120
68
|
_d2I18n.default.addResources('prs', namespace, _translations17.default);
|
|
121
|
-
|
|
122
69
|
_d2I18n.default.addResources('ps', namespace, _translations18.default);
|
|
123
|
-
|
|
124
70
|
_d2I18n.default.addResources('pt', namespace, _translations19.default);
|
|
125
|
-
|
|
126
71
|
_d2I18n.default.addResources('pt_BR', namespace, _translations20.default);
|
|
127
|
-
|
|
128
72
|
_d2I18n.default.addResources('ru', namespace, _translations21.default);
|
|
129
|
-
|
|
130
73
|
_d2I18n.default.addResources('si', namespace, _translations22.default);
|
|
131
|
-
|
|
132
74
|
_d2I18n.default.addResources('sv', namespace, _translations23.default);
|
|
133
|
-
|
|
134
75
|
_d2I18n.default.addResources('tet', namespace, _translations24.default);
|
|
135
|
-
|
|
136
76
|
_d2I18n.default.addResources('tg', namespace, _translations25.default);
|
|
137
|
-
|
|
138
77
|
_d2I18n.default.addResources('uk', namespace, _translations26.default);
|
|
139
|
-
|
|
140
78
|
_d2I18n.default.addResources('ur', namespace, _translations27.default);
|
|
141
|
-
|
|
142
79
|
_d2I18n.default.addResources('uz_Latn', namespace, _translations28.default);
|
|
143
|
-
|
|
144
80
|
_d2I18n.default.addResources('uz_UZ_Cyrl', namespace, _translations29.default);
|
|
145
|
-
|
|
146
81
|
_d2I18n.default.addResources('uz_UZ_Latn', namespace, _translations30.default);
|
|
147
|
-
|
|
148
82
|
_d2I18n.default.addResources('vi', namespace, _translations31.default);
|
|
149
|
-
|
|
150
83
|
_d2I18n.default.addResources('zh', namespace, _translations32.default);
|
|
151
|
-
|
|
152
84
|
_d2I18n.default.addResources('zh_CN', namespace, _translations33.default);
|
|
153
|
-
|
|
154
|
-
var _default = _d2I18n.default;
|
|
155
|
-
exports.default = _default;
|
|
85
|
+
var _default = exports.default = _d2I18n.default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor';
|
|
2
2
|
Given('a FileInput with multiple and onChange handler is rendered', () => {
|
|
3
|
-
cy.visitStory('FileInput', 'With
|
|
3
|
+
cy.visitStory('FileInput', 'With on change and multiple');
|
|
4
4
|
});
|
|
5
5
|
When('the user selected multiple files', () => {
|
|
6
6
|
cy.get('[data-test="dhis2-uicore-fileinput"] input').uploadMultipleFiles([{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor';
|
|
2
2
|
Given('an FileInput with initialFocus and onBlur handler is rendered', () => {
|
|
3
|
-
cy.visitStory('FileInput', 'With
|
|
3
|
+
cy.visitStory('FileInput', 'With initial focus and on blur');
|
|
4
4
|
});
|
|
5
5
|
When('the FileInput is blurred', () => {
|
|
6
6
|
cy.focused();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor';
|
|
2
2
|
Given('a FileInput with onChange handler is rendered', () => {
|
|
3
|
-
cy.visitStory('FileInput', 'With
|
|
3
|
+
cy.visitStory('FileInput', 'With on change');
|
|
4
4
|
});
|
|
5
5
|
When('a file is selected', () => {
|
|
6
6
|
cy.get('[data-test="dhis2-uicore-fileinput"] input').uploadSingleFile('.md', 'FileInput/file.md');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor';
|
|
2
2
|
Given('a FileInput with onFocus handler is rendered', () => {
|
|
3
|
-
cy.visitStory('FileInput', 'With
|
|
3
|
+
cy.visitStory('FileInput', 'With on focus');
|
|
4
4
|
});
|
|
5
5
|
When('the FileInput is focused', () => {
|
|
6
6
|
cy.get('[data-test="dhis2-uicore-fileinput"] button').focus();
|
|
@@ -1,33 +1,38 @@
|
|
|
1
|
-
import { storiesOf } from '@storybook/react';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { FileInput } from './index.js';
|
|
4
3
|
window.onBlur = window.Cypress && window.Cypress.cy.stub();
|
|
5
4
|
window.onFocus = window.Cypress && window.Cypress.cy.stub();
|
|
6
|
-
|
|
5
|
+
window.onChange = window.Cypress && window.Cypress.cy.stub();
|
|
7
6
|
const onChange = (payload, event) => {
|
|
8
7
|
// NOTE: if files is not transformed into an array,
|
|
9
8
|
// cypress will get an empty file list!
|
|
10
|
-
window.onChange({
|
|
9
|
+
window.onChange({
|
|
10
|
+
...payload,
|
|
11
11
|
files: [...payload.files]
|
|
12
12
|
}, event);
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
export default {
|
|
15
|
+
title: 'FileInput'
|
|
16
|
+
};
|
|
17
|
+
export const WithOnChange = () => /*#__PURE__*/React.createElement(FileInput, {
|
|
16
18
|
onChange: onChange,
|
|
17
19
|
buttonLabel: "Upload file",
|
|
18
20
|
name: "upload"
|
|
19
|
-
})
|
|
21
|
+
});
|
|
22
|
+
export const WithOnChangeAndMultiple = () => /*#__PURE__*/React.createElement(FileInput, {
|
|
20
23
|
name: "upload",
|
|
21
24
|
onChange: onChange,
|
|
22
25
|
buttonLabel: "Upload files",
|
|
23
26
|
multiple: true
|
|
24
|
-
})
|
|
27
|
+
});
|
|
28
|
+
export const WithInitialFocusAndOnBlur = () => /*#__PURE__*/React.createElement(FileInput, {
|
|
25
29
|
buttonLabel: "Upload file",
|
|
26
30
|
name: "upload",
|
|
27
31
|
initialFocus: true,
|
|
28
32
|
onBlur: window.onBlur
|
|
29
|
-
})
|
|
33
|
+
});
|
|
34
|
+
export const WithOnFocus = () => /*#__PURE__*/React.createElement(FileInput, {
|
|
30
35
|
buttonLabel: "Upload file",
|
|
31
36
|
name: "upload",
|
|
32
37
|
onFocus: window.onFocus
|
|
33
|
-
})
|
|
38
|
+
});
|