@micromag/core 0.3.19 → 0.3.24
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/es/components.js +23 -10
- package/es/contexts.js +9 -4
- package/es/index.js +1 -1
- package/lib/components.js +23 -10
- package/lib/contexts.js +9 -4
- package/lib/index.js +1 -1
- package/package.json +2 -2
package/es/components.js
CHANGED
|
@@ -798,7 +798,7 @@ var Card = function Card(_ref) {
|
|
|
798
798
|
src: image,
|
|
799
799
|
alt: imageAlt,
|
|
800
800
|
className: classNames(['card-img-top', _defineProperty({}, imageClassName, imageClassName !== null)])
|
|
801
|
-
}) : image, beforeBody, bodyInner !== null ?
|
|
801
|
+
}) : image, beforeBody, bodyInner !== null ? onClickBody !== null ? /*#__PURE__*/React.createElement("button", {
|
|
802
802
|
type: "button",
|
|
803
803
|
className: classNames(_defineProperty({
|
|
804
804
|
'card-body': !imageOverlay,
|
|
@@ -810,15 +810,15 @@ var Card = function Card(_ref) {
|
|
|
810
810
|
'card-body': !imageOverlay,
|
|
811
811
|
'card-img-overlay': imageOverlay
|
|
812
812
|
}, bodyClassName, bodyClassName !== null))
|
|
813
|
-
}, bodyInner)
|
|
813
|
+
}, bodyInner) : null, afterBody, links !== null && linksElements !== null && !linksInSameBody ? /*#__PURE__*/React.createElement("div", {
|
|
814
814
|
className: "card-body"
|
|
815
|
-
}, linksElements) : null, footer !== null ?
|
|
815
|
+
}, linksElements) : null, footer !== null ? onClickFooter !== null ? /*#__PURE__*/React.createElement("button", {
|
|
816
816
|
type: "button",
|
|
817
817
|
className: classNames(['card-footer', _defineProperty({}, footerClassName, footerClassName !== null)]),
|
|
818
818
|
onClick: onClickFooter
|
|
819
819
|
}, /*#__PURE__*/React.createElement(Label, null, footer)) : /*#__PURE__*/React.createElement("div", {
|
|
820
820
|
className: classNames(['card-footer', _defineProperty({}, footerClassName, footerClassName !== null)])
|
|
821
|
-
}, /*#__PURE__*/React.createElement(Label, null, footer))
|
|
821
|
+
}, /*#__PURE__*/React.createElement(Label, null, footer)) : null);
|
|
822
822
|
var cardClassName = classNames(['card', (_ref10 = {}, _defineProperty(_ref10, "bg-".concat(theme), !imageOverlay && theme !== 'dark'), _defineProperty(_ref10, 'bg-dark', imageOverlay || theme === 'dark'), _defineProperty(_ref10, 'text-dark', theme === 'light'), _defineProperty(_ref10, 'text-light', imageOverlay || theme === 'dark' || theme === 'primary'), _defineProperty(_ref10, className, className !== null), _ref10)]);
|
|
823
823
|
|
|
824
824
|
if (href !== null) {
|
|
@@ -1045,14 +1045,27 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
1045
1045
|
onClickItem = _ref.onClickItem,
|
|
1046
1046
|
onClickOutside = _ref.onClickOutside;
|
|
1047
1047
|
var refContainer = useRef(null);
|
|
1048
|
+
|
|
1049
|
+
var _useState = useState(visible),
|
|
1050
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1051
|
+
enabled = _useState2[0],
|
|
1052
|
+
setEnabled = _useState2[1];
|
|
1053
|
+
|
|
1048
1054
|
var onDocumentClick = useCallback(function (e) {
|
|
1049
1055
|
if (refContainer.current && !refContainer.current.contains(e.currentTarget) && onClickOutside !== null) {
|
|
1050
1056
|
onClickOutside(e);
|
|
1051
1057
|
}
|
|
1052
1058
|
}, [refContainer.current, onClickOutside]);
|
|
1053
|
-
useDocumentEvent('click', onDocumentClick,
|
|
1054
|
-
console.log('visible', visible); // eslint-disable-line
|
|
1059
|
+
useDocumentEvent('click', onDocumentClick, enabled); // Delay the outside click detection
|
|
1055
1060
|
|
|
1061
|
+
useEffect(function () {
|
|
1062
|
+
var id = setTimeout(function () {
|
|
1063
|
+
setEnabled(visible);
|
|
1064
|
+
}, 100);
|
|
1065
|
+
return function () {
|
|
1066
|
+
clearTimeout(id);
|
|
1067
|
+
};
|
|
1068
|
+
}, [visible, setEnabled]);
|
|
1056
1069
|
return /*#__PURE__*/React.createElement("div", {
|
|
1057
1070
|
className: classNames(['dropdown-menu', (_ref2 = {}, _defineProperty(_ref2, "dropdown-menu-".concat(align), align !== null), _defineProperty(_ref2, "show", visible), _defineProperty(_ref2, className, className !== null), _ref2)]),
|
|
1058
1071
|
ref: refContainer
|
|
@@ -1095,7 +1108,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
1095
1108
|
}
|
|
1096
1109
|
} : null;
|
|
1097
1110
|
return ItemComponent !== null ? /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement(ItemComponent, Object.assign({
|
|
1098
|
-
key: "item-".concat(index),
|
|
1111
|
+
key: "item-".concat(index, "-").concat(label),
|
|
1099
1112
|
className: classNames([(_ref3 = {
|
|
1100
1113
|
'dropdown-item': type === 'link' || type === 'button',
|
|
1101
1114
|
'dropdown-divider': type === 'divider',
|
|
@@ -2291,11 +2304,11 @@ var Media = function Media(_ref) {
|
|
|
2291
2304
|
'align-self-center': thumbnailAlign === 'center',
|
|
2292
2305
|
'align-self-end': thumbnailAlign === 'bottom'
|
|
2293
2306
|
}, thumbnailClassName, thumbnailClassName !== null)])
|
|
2294
|
-
}) : thumbnail, /*#__PURE__*/React.createElement("div", {
|
|
2307
|
+
}) : thumbnail, title !== null || children !== null ? /*#__PURE__*/React.createElement("div", {
|
|
2295
2308
|
className: classNames(['card-body', styles$e.body, _defineProperty({}, bodyClassName, bodyClassName !== null)])
|
|
2296
2309
|
}, title !== null ? /*#__PURE__*/React.createElement("h5", {
|
|
2297
2310
|
className: classNames(['mt-0', styles$e.title, _defineProperty({}, titleClassName, titleClassName !== null)])
|
|
2298
|
-
}, /*#__PURE__*/React.createElement(Label, null, title)) : null, children));
|
|
2311
|
+
}, /*#__PURE__*/React.createElement(Label, null, title)) : null, children) : null);
|
|
2299
2312
|
};
|
|
2300
2313
|
|
|
2301
2314
|
Media.propTypes = propTypes$e;
|
|
@@ -2741,7 +2754,7 @@ PropTypes$1.shape({
|
|
|
2741
2754
|
screens: PropTypes$1.arrayOf(PropTypes$1.string),
|
|
2742
2755
|
width: PropTypes$1.number,
|
|
2743
2756
|
height: PropTypes$1.number,
|
|
2744
|
-
landscape: PropTypes$1.
|
|
2757
|
+
landscape: PropTypes$1.bool
|
|
2745
2758
|
});
|
|
2746
2759
|
PropTypes$1.oneOf(['view', 'placeholder', 'edit', 'preview', 'static', 'capture']);
|
|
2747
2760
|
/**
|
package/es/contexts.js
CHANGED
|
@@ -1095,7 +1095,8 @@ var useUppyCore = function useUppyCore() {
|
|
|
1095
1095
|
"package": packageCache
|
|
1096
1096
|
}),
|
|
1097
1097
|
_useState2 = _slicedToArray(_useState, 2),
|
|
1098
|
-
|
|
1098
|
+
_useState2$0$package = _useState2[0]["package"],
|
|
1099
|
+
loadedPackage = _useState2$0$package === void 0 ? null : _useState2$0$package,
|
|
1099
1100
|
setLoadedPackage = _useState2[1];
|
|
1100
1101
|
|
|
1101
1102
|
useEffect(function () {
|
|
@@ -1147,7 +1148,8 @@ var useUppyLocale = function useUppyLocale(locale) {
|
|
|
1147
1148
|
"package": packagesCache$2[locale] || null
|
|
1148
1149
|
}),
|
|
1149
1150
|
_useState2 = _slicedToArray(_useState, 2),
|
|
1150
|
-
|
|
1151
|
+
_useState2$0$package = _useState2[0]["package"],
|
|
1152
|
+
loadedPackage = _useState2$0$package === void 0 ? null : _useState2$0$package,
|
|
1151
1153
|
setLoadedPackage = _useState2[1];
|
|
1152
1154
|
|
|
1153
1155
|
var packageLoader = packagesMap[locale] || null;
|
|
@@ -1219,7 +1221,8 @@ var useUppySources = function useUppySources(sources) {
|
|
|
1219
1221
|
}, null)
|
|
1220
1222
|
}),
|
|
1221
1223
|
_useState2 = _slicedToArray(_useState, 2),
|
|
1222
|
-
|
|
1224
|
+
_useState2$0$packages = _useState2[0].packages,
|
|
1225
|
+
loadedPackages = _useState2$0$packages === void 0 ? [] : _useState2$0$packages,
|
|
1223
1226
|
setLoadedPackages = _useState2[1];
|
|
1224
1227
|
|
|
1225
1228
|
var sourcesToLoad = useMemo(function () {
|
|
@@ -1301,7 +1304,8 @@ var useUppyTransport = function useUppyTransport(transport) {
|
|
|
1301
1304
|
"package": packagesCache[transport] || null
|
|
1302
1305
|
}),
|
|
1303
1306
|
_useState2 = _slicedToArray(_useState, 2),
|
|
1304
|
-
|
|
1307
|
+
_useState2$0$package = _useState2[0]["package"],
|
|
1308
|
+
loadedPackage = _useState2$0$package === void 0 ? null : _useState2$0$package,
|
|
1305
1309
|
setLoadedPackage = _useState2[1];
|
|
1306
1310
|
|
|
1307
1311
|
var packageLoader = packagesMap[transport] || null;
|
|
@@ -1554,6 +1558,7 @@ var UppyProvider = function UppyProvider(_ref5) {
|
|
|
1554
1558
|
return null;
|
|
1555
1559
|
}
|
|
1556
1560
|
|
|
1561
|
+
console.log('up', Uppy);
|
|
1557
1562
|
return function () {
|
|
1558
1563
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1559
1564
|
|
package/es/index.js
CHANGED
|
@@ -472,7 +472,7 @@ var screenSize = PropTypes$1.shape({
|
|
|
472
472
|
screens: PropTypes$1.arrayOf(PropTypes$1.string),
|
|
473
473
|
width: PropTypes$1.number,
|
|
474
474
|
height: PropTypes$1.number,
|
|
475
|
-
landscape: PropTypes$1.
|
|
475
|
+
landscape: PropTypes$1.bool
|
|
476
476
|
});
|
|
477
477
|
var renderContext = PropTypes$1.oneOf(['view', 'placeholder', 'edit', 'preview', 'static', 'capture']);
|
|
478
478
|
/**
|
package/lib/components.js
CHANGED
|
@@ -821,7 +821,7 @@ var Card = function Card(_ref) {
|
|
|
821
821
|
src: image,
|
|
822
822
|
alt: imageAlt,
|
|
823
823
|
className: classNames__default["default"](['card-img-top', _defineProperty__default["default"]({}, imageClassName, imageClassName !== null)])
|
|
824
|
-
}) : image, beforeBody, bodyInner !== null ?
|
|
824
|
+
}) : image, beforeBody, bodyInner !== null ? onClickBody !== null ? /*#__PURE__*/React__default["default"].createElement("button", {
|
|
825
825
|
type: "button",
|
|
826
826
|
className: classNames__default["default"](_defineProperty__default["default"]({
|
|
827
827
|
'card-body': !imageOverlay,
|
|
@@ -833,15 +833,15 @@ var Card = function Card(_ref) {
|
|
|
833
833
|
'card-body': !imageOverlay,
|
|
834
834
|
'card-img-overlay': imageOverlay
|
|
835
835
|
}, bodyClassName, bodyClassName !== null))
|
|
836
|
-
}, bodyInner)
|
|
836
|
+
}, bodyInner) : null, afterBody, links !== null && linksElements !== null && !linksInSameBody ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
837
837
|
className: "card-body"
|
|
838
|
-
}, linksElements) : null, footer !== null ?
|
|
838
|
+
}, linksElements) : null, footer !== null ? onClickFooter !== null ? /*#__PURE__*/React__default["default"].createElement("button", {
|
|
839
839
|
type: "button",
|
|
840
840
|
className: classNames__default["default"](['card-footer', _defineProperty__default["default"]({}, footerClassName, footerClassName !== null)]),
|
|
841
841
|
onClick: onClickFooter
|
|
842
842
|
}, /*#__PURE__*/React__default["default"].createElement(Label, null, footer)) : /*#__PURE__*/React__default["default"].createElement("div", {
|
|
843
843
|
className: classNames__default["default"](['card-footer', _defineProperty__default["default"]({}, footerClassName, footerClassName !== null)])
|
|
844
|
-
}, /*#__PURE__*/React__default["default"].createElement(Label, null, footer))
|
|
844
|
+
}, /*#__PURE__*/React__default["default"].createElement(Label, null, footer)) : null);
|
|
845
845
|
var cardClassName = classNames__default["default"](['card', (_ref10 = {}, _defineProperty__default["default"](_ref10, "bg-".concat(theme), !imageOverlay && theme !== 'dark'), _defineProperty__default["default"](_ref10, 'bg-dark', imageOverlay || theme === 'dark'), _defineProperty__default["default"](_ref10, 'text-dark', theme === 'light'), _defineProperty__default["default"](_ref10, 'text-light', imageOverlay || theme === 'dark' || theme === 'primary'), _defineProperty__default["default"](_ref10, className, className !== null), _ref10)]);
|
|
846
846
|
|
|
847
847
|
if (href !== null) {
|
|
@@ -1068,14 +1068,27 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
1068
1068
|
onClickItem = _ref.onClickItem,
|
|
1069
1069
|
onClickOutside = _ref.onClickOutside;
|
|
1070
1070
|
var refContainer = React.useRef(null);
|
|
1071
|
+
|
|
1072
|
+
var _useState = React.useState(visible),
|
|
1073
|
+
_useState2 = _slicedToArray__default["default"](_useState, 2),
|
|
1074
|
+
enabled = _useState2[0],
|
|
1075
|
+
setEnabled = _useState2[1];
|
|
1076
|
+
|
|
1071
1077
|
var onDocumentClick = React.useCallback(function (e) {
|
|
1072
1078
|
if (refContainer.current && !refContainer.current.contains(e.currentTarget) && onClickOutside !== null) {
|
|
1073
1079
|
onClickOutside(e);
|
|
1074
1080
|
}
|
|
1075
1081
|
}, [refContainer.current, onClickOutside]);
|
|
1076
|
-
hooks.useDocumentEvent('click', onDocumentClick,
|
|
1077
|
-
console.log('visible', visible); // eslint-disable-line
|
|
1082
|
+
hooks.useDocumentEvent('click', onDocumentClick, enabled); // Delay the outside click detection
|
|
1078
1083
|
|
|
1084
|
+
React.useEffect(function () {
|
|
1085
|
+
var id = setTimeout(function () {
|
|
1086
|
+
setEnabled(visible);
|
|
1087
|
+
}, 100);
|
|
1088
|
+
return function () {
|
|
1089
|
+
clearTimeout(id);
|
|
1090
|
+
};
|
|
1091
|
+
}, [visible, setEnabled]);
|
|
1079
1092
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1080
1093
|
className: classNames__default["default"](['dropdown-menu', (_ref2 = {}, _defineProperty__default["default"](_ref2, "dropdown-menu-".concat(align), align !== null), _defineProperty__default["default"](_ref2, "show", visible), _defineProperty__default["default"](_ref2, className, className !== null), _ref2)]),
|
|
1081
1094
|
ref: refContainer
|
|
@@ -1118,7 +1131,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
1118
1131
|
}
|
|
1119
1132
|
} : null;
|
|
1120
1133
|
return ItemComponent !== null ? /*#__PURE__*/React__default["default"].createElement("li", null, /*#__PURE__*/React__default["default"].createElement(ItemComponent, Object.assign({
|
|
1121
|
-
key: "item-".concat(index),
|
|
1134
|
+
key: "item-".concat(index, "-").concat(label),
|
|
1122
1135
|
className: classNames__default["default"]([(_ref3 = {
|
|
1123
1136
|
'dropdown-item': type === 'link' || type === 'button',
|
|
1124
1137
|
'dropdown-divider': type === 'divider',
|
|
@@ -2314,11 +2327,11 @@ var Media = function Media(_ref) {
|
|
|
2314
2327
|
'align-self-center': thumbnailAlign === 'center',
|
|
2315
2328
|
'align-self-end': thumbnailAlign === 'bottom'
|
|
2316
2329
|
}, thumbnailClassName, thumbnailClassName !== null)])
|
|
2317
|
-
}) : thumbnail, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
2330
|
+
}) : thumbnail, title !== null || children !== null ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
2318
2331
|
className: classNames__default["default"](['card-body', styles$e.body, _defineProperty__default["default"]({}, bodyClassName, bodyClassName !== null)])
|
|
2319
2332
|
}, title !== null ? /*#__PURE__*/React__default["default"].createElement("h5", {
|
|
2320
2333
|
className: classNames__default["default"](['mt-0', styles$e.title, _defineProperty__default["default"]({}, titleClassName, titleClassName !== null)])
|
|
2321
|
-
}, /*#__PURE__*/React__default["default"].createElement(Label, null, title)) : null, children));
|
|
2334
|
+
}, /*#__PURE__*/React__default["default"].createElement(Label, null, title)) : null, children) : null);
|
|
2322
2335
|
};
|
|
2323
2336
|
|
|
2324
2337
|
Media.propTypes = propTypes$e;
|
|
@@ -2764,7 +2777,7 @@ PropTypes__default["default"].shape({
|
|
|
2764
2777
|
screens: PropTypes__default["default"].arrayOf(PropTypes__default["default"].string),
|
|
2765
2778
|
width: PropTypes__default["default"].number,
|
|
2766
2779
|
height: PropTypes__default["default"].number,
|
|
2767
|
-
landscape: PropTypes__default["default"].
|
|
2780
|
+
landscape: PropTypes__default["default"].bool
|
|
2768
2781
|
});
|
|
2769
2782
|
PropTypes__default["default"].oneOf(['view', 'placeholder', 'edit', 'preview', 'static', 'capture']);
|
|
2770
2783
|
/**
|
package/lib/contexts.js
CHANGED
|
@@ -1130,7 +1130,8 @@ var useUppyCore = function useUppyCore() {
|
|
|
1130
1130
|
"package": packageCache
|
|
1131
1131
|
}),
|
|
1132
1132
|
_useState2 = _slicedToArray__default["default"](_useState, 2),
|
|
1133
|
-
|
|
1133
|
+
_useState2$0$package = _useState2[0]["package"],
|
|
1134
|
+
loadedPackage = _useState2$0$package === void 0 ? null : _useState2$0$package,
|
|
1134
1135
|
setLoadedPackage = _useState2[1];
|
|
1135
1136
|
|
|
1136
1137
|
React.useEffect(function () {
|
|
@@ -1182,7 +1183,8 @@ var useUppyLocale = function useUppyLocale(locale) {
|
|
|
1182
1183
|
"package": packagesCache$2[locale] || null
|
|
1183
1184
|
}),
|
|
1184
1185
|
_useState2 = _slicedToArray__default["default"](_useState, 2),
|
|
1185
|
-
|
|
1186
|
+
_useState2$0$package = _useState2[0]["package"],
|
|
1187
|
+
loadedPackage = _useState2$0$package === void 0 ? null : _useState2$0$package,
|
|
1186
1188
|
setLoadedPackage = _useState2[1];
|
|
1187
1189
|
|
|
1188
1190
|
var packageLoader = packagesMap[locale] || null;
|
|
@@ -1254,7 +1256,8 @@ var useUppySources = function useUppySources(sources) {
|
|
|
1254
1256
|
}, null)
|
|
1255
1257
|
}),
|
|
1256
1258
|
_useState2 = _slicedToArray__default["default"](_useState, 2),
|
|
1257
|
-
|
|
1259
|
+
_useState2$0$packages = _useState2[0].packages,
|
|
1260
|
+
loadedPackages = _useState2$0$packages === void 0 ? [] : _useState2$0$packages,
|
|
1258
1261
|
setLoadedPackages = _useState2[1];
|
|
1259
1262
|
|
|
1260
1263
|
var sourcesToLoad = React.useMemo(function () {
|
|
@@ -1336,7 +1339,8 @@ var useUppyTransport = function useUppyTransport(transport) {
|
|
|
1336
1339
|
"package": packagesCache[transport] || null
|
|
1337
1340
|
}),
|
|
1338
1341
|
_useState2 = _slicedToArray__default["default"](_useState, 2),
|
|
1339
|
-
|
|
1342
|
+
_useState2$0$package = _useState2[0]["package"],
|
|
1343
|
+
loadedPackage = _useState2$0$package === void 0 ? null : _useState2$0$package,
|
|
1340
1344
|
setLoadedPackage = _useState2[1];
|
|
1341
1345
|
|
|
1342
1346
|
var packageLoader = packagesMap[transport] || null;
|
|
@@ -1589,6 +1593,7 @@ var UppyProvider = function UppyProvider(_ref5) {
|
|
|
1589
1593
|
return null;
|
|
1590
1594
|
}
|
|
1591
1595
|
|
|
1596
|
+
console.log('up', Uppy);
|
|
1592
1597
|
return function () {
|
|
1593
1598
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1594
1599
|
|
package/lib/index.js
CHANGED
|
@@ -498,7 +498,7 @@ var screenSize = PropTypes__default["default"].shape({
|
|
|
498
498
|
screens: PropTypes__default["default"].arrayOf(PropTypes__default["default"].string),
|
|
499
499
|
width: PropTypes__default["default"].number,
|
|
500
500
|
height: PropTypes__default["default"].number,
|
|
501
|
-
landscape: PropTypes__default["default"].
|
|
501
|
+
landscape: PropTypes__default["default"].bool
|
|
502
502
|
});
|
|
503
503
|
var renderContext = PropTypes__default["default"].oneOf(['view', 'placeholder', 'edit', 'preview', 'static', 'capture']);
|
|
504
504
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.24",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -132,5 +132,5 @@
|
|
|
132
132
|
"publishConfig": {
|
|
133
133
|
"access": "public"
|
|
134
134
|
},
|
|
135
|
-
"gitHead": "
|
|
135
|
+
"gitHead": "f2d5d71a3e5c5e6d6e9d8af3bdd8a71bf38fbbb7"
|
|
136
136
|
}
|