@lowentry/mui 1.2.12 → 1.2.13
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/Avatar/index.js +44 -0
- package/Avatar/index.js.map +1 -0
- package/index.js +3 -2
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Avatar.jsx +28 -0
- package/src/index.js +1 -0
package/Avatar/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import _extends from '@babel/runtime/helpers/extends';
|
|
2
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { LeRed } from '@lowentry/react-redux';
|
|
7
|
+
import { Avatar as Avatar$1 } from '@mui/material';
|
|
8
|
+
|
|
9
|
+
var _excluded = ["src", "slotProps", "retryOptions", "children"];
|
|
10
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
|
+
var Avatar = LeRed.memo(function (_ref) {
|
|
13
|
+
var _slotProps$img3, _slotProps$img4;
|
|
14
|
+
var src = _ref.src,
|
|
15
|
+
slotProps = _ref.slotProps,
|
|
16
|
+
retryOptions = _ref.retryOptions,
|
|
17
|
+
children = _ref.children,
|
|
18
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
19
|
+
var _LeRed$useRetryingIma = LeRed.useRetryingImageUrl(src, retryOptions),
|
|
20
|
+
_LeRed$useRetryingIma2 = _slicedToArray(_LeRed$useRetryingIma, 2),
|
|
21
|
+
imgSrc = _LeRed$useRetryingIma2[0],
|
|
22
|
+
onImgError = _LeRed$useRetryingIma2[1];
|
|
23
|
+
var onError = LeRed.useCallback(function () {
|
|
24
|
+
var _slotProps$img;
|
|
25
|
+
onImgError.apply(void 0, arguments);
|
|
26
|
+
if (slotProps !== null && slotProps !== void 0 && (_slotProps$img = slotProps.img) !== null && _slotProps$img !== void 0 && _slotProps$img.onError) {
|
|
27
|
+
var _slotProps$img2;
|
|
28
|
+
(_slotProps$img2 = slotProps.img).onError.apply(_slotProps$img2, arguments);
|
|
29
|
+
}
|
|
30
|
+
}, [onImgError, slotProps === null || slotProps === void 0 || (_slotProps$img3 = slotProps.img) === null || _slotProps$img3 === void 0 ? void 0 : _slotProps$img3.onError]);
|
|
31
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Avatar$1, _extends({
|
|
32
|
+
src: imgSrc,
|
|
33
|
+
slotProps: _objectSpread(_objectSpread({}, slotProps !== null && slotProps !== void 0 ? slotProps : {}), {}, {
|
|
34
|
+
img: _objectSpread(_objectSpread({
|
|
35
|
+
referrerPolicy: 'no-referrer'
|
|
36
|
+
}, (_slotProps$img4 = slotProps === null || slotProps === void 0 ? void 0 : slotProps.img) !== null && _slotProps$img4 !== void 0 ? _slotProps$img4 : {}), {}, {
|
|
37
|
+
onError: onError
|
|
38
|
+
})
|
|
39
|
+
})
|
|
40
|
+
}, props), children));
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export { Avatar as default };
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/components/Avatar.jsx"],"sourcesContent":["import React from 'react';\nimport {LeRed} from '@lowentry/react-redux';\nimport {Avatar as MuiAvatar} from '@mui/material';\n\n\nconst Avatar = LeRed.memo(({src, slotProps, retryOptions, children, ...props}) =>\n{\n\tconst [imgSrc, onImgError] = LeRed.useRetryingImageUrl(src, retryOptions);\n\t\n\t\n\tconst onError = LeRed.useCallback((...args) =>\n\t{\n\t\tonImgError(...args);\n\t\t\n\t\tif(slotProps?.img?.onError)\n\t\t{\n\t\t\tslotProps.img.onError(...args);\n\t\t}\n\t}, [onImgError, slotProps?.img?.onError]);\n\t\n\t\n\treturn (<>\n\t\t<MuiAvatar src={imgSrc} slotProps={{...(slotProps ?? {}), img:{referrerPolicy:'no-referrer', ...(slotProps?.img ?? {}), onError:onError}}} {...props}>\n\t\t\t{children}\n\t\t</MuiAvatar>\n\t</>);\n});\nexport default Avatar;\n"],"names":["Avatar","LeRed","memo","_ref","_slotProps$img3","_slotProps$img4","src","slotProps","retryOptions","children","props","_objectWithoutProperties","_excluded","_LeRed$useRetryingIma","useRetryingImageUrl","_LeRed$useRetryingIma2","_slicedToArray","imgSrc","onImgError","onError","useCallback","_slotProps$img","apply","arguments","img","_slotProps$img2","React","createElement","Fragment","MuiAvatar","_extends","_objectSpread","referrerPolicy"],"mappings":";;;;;;;;;;;AAKMA,IAAAA,MAAM,GAAGC,KAAK,CAACC,IAAI,CAAC,UAAAC,IAAA,EAC1B;EAAA,IAAAC,eAAA,EAAAC,eAAA,CAAA;AAAA,EAAA,IAD4BC,GAAG,GAAAH,IAAA,CAAHG,GAAG;IAAEC,SAAS,GAAAJ,IAAA,CAATI,SAAS;IAAEC,YAAY,GAAAL,IAAA,CAAZK,YAAY;IAAEC,QAAQ,GAAAN,IAAA,CAARM,QAAQ;AAAKC,IAAAA,KAAK,GAAAC,wBAAA,CAAAR,IAAA,EAAAS,SAAA,CAAA,CAAA;EAE3E,IAAAC,qBAAA,GAA6BZ,KAAK,CAACa,mBAAmB,CAACR,GAAG,EAAEE,YAAY,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AAA,EAAA;MAAGiB,GAAG,EAAAO,aAAA,CAAAA,aAAA,CAAA;AAAEC,QAAAA,cAAc,EAAC,aAAA;AAAa,OAAA,EAAA,CAAA3B,eAAA,GAAME,SAAS,KAAA,IAAA,IAATA,SAAS,KAATA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,SAAS,CAAEiB,GAAG,cAAAnB,eAAA,KAAA,KAAA,CAAA,GAAAA,eAAA,GAAI,EAAE,CAAA,EAAA,EAAA,EAAA;AAAGc,QAAAA,OAAO,EAACA,OAAAA;AAAO,OAAA,CAAA;AAAC,KAAA,CAAA;AAAE,GAAA,EAAKT,KAAK,CAAA,EAClJD,QACS,CACV,CAAC,CAAA;AACJ,CAAC;;;;"}
|
package/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { default as Avatar } from './Avatar/index.js';
|
|
1
2
|
export { default as DatePicker } from './DatePicker/index.js';
|
|
2
3
|
export { default as Dialog } from './Dialog/index.js';
|
|
3
4
|
export { default as InitiallyInvisible } from './InitiallyInvisible/index.js';
|
|
@@ -9,15 +10,15 @@ export { default as RemovableNumericTextField } from './RemovableNumericTextFiel
|
|
|
9
10
|
export { default as RemovableTextField } from './RemovableTextField/index.js';
|
|
10
11
|
export { default as Submittable } from './Submittable/index.js';
|
|
11
12
|
export { default as TextField } from './TextField/index.js';
|
|
12
|
-
import '@babel/runtime/helpers/slicedToArray';
|
|
13
13
|
import '@babel/runtime/helpers/extends';
|
|
14
14
|
import '@babel/runtime/helpers/defineProperty';
|
|
15
|
+
import '@babel/runtime/helpers/slicedToArray';
|
|
15
16
|
import '@babel/runtime/helpers/objectWithoutProperties';
|
|
16
17
|
import 'react';
|
|
17
18
|
import '@lowentry/react-redux';
|
|
19
|
+
import '@mui/material';
|
|
18
20
|
import '@lowentry/utils';
|
|
19
21
|
import 'dayjs';
|
|
20
|
-
import '@mui/material';
|
|
21
22
|
import '@mui/x-date-pickers';
|
|
22
23
|
import '@mui/icons-material/ArrowBackIosNew';
|
|
23
24
|
import '@mui/icons-material/ArrowForwardIos';
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {LeRed} from '@lowentry/react-redux';
|
|
3
|
+
import {Avatar as MuiAvatar} from '@mui/material';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const Avatar = LeRed.memo(({src, slotProps, retryOptions, children, ...props}) =>
|
|
7
|
+
{
|
|
8
|
+
const [imgSrc, onImgError] = LeRed.useRetryingImageUrl(src, retryOptions);
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const onError = LeRed.useCallback((...args) =>
|
|
12
|
+
{
|
|
13
|
+
onImgError(...args);
|
|
14
|
+
|
|
15
|
+
if(slotProps?.img?.onError)
|
|
16
|
+
{
|
|
17
|
+
slotProps.img.onError(...args);
|
|
18
|
+
}
|
|
19
|
+
}, [onImgError, slotProps?.img?.onError]);
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
return (<>
|
|
23
|
+
<MuiAvatar src={imgSrc} slotProps={{...(slotProps ?? {}), img:{referrerPolicy:'no-referrer', ...(slotProps?.img ?? {}), onError:onError}}} {...props}>
|
|
24
|
+
{children}
|
|
25
|
+
</MuiAvatar>
|
|
26
|
+
</>);
|
|
27
|
+
});
|
|
28
|
+
export default Avatar;
|
package/src/index.js
CHANGED