@laser-ui/components 0.2.2 → 0.3.0
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 +4 -0
- package/dropdown/Dropdown.js +1 -4
- package/image/Image.js +4 -4
- package/image/types.d.ts +1 -2
- package/package.json +4 -4
- package/root/dialog-service.js +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
# [0.3.0](https://github.com/laser-ui/laser-ui/compare/v0.2.2...v0.3.0) (2023-11-03)
|
|
6
|
+
|
|
7
|
+
**Note:** Version bump only for package @laser-ui/components
|
|
8
|
+
|
|
5
9
|
## [0.2.2](https://github.com/laser-ui/laser-ui/compare/v0.2.1...v0.2.2) (2023-10-31)
|
|
6
10
|
|
|
7
11
|
### Bug Fixes
|
package/dropdown/Dropdown.js
CHANGED
|
@@ -267,10 +267,7 @@ function DropdownFC(props, ref) {
|
|
|
267
267
|
triggerRef,
|
|
268
268
|
popupRef,
|
|
269
269
|
containerRefs: [],
|
|
270
|
-
}, onVisibleChange: (
|
|
271
|
-
console.log(visible);
|
|
272
|
-
changeVisible(visible);
|
|
273
|
-
}, children: ({ renderTrigger, renderPopup }) => {
|
|
270
|
+
}, onVisibleChange: changeVisible, children: ({ renderTrigger, renderPopup }) => {
|
|
274
271
|
const render = (el) => {
|
|
275
272
|
var _a, _b;
|
|
276
273
|
triggerId = (_a = el.props.id) !== null && _a !== void 0 ? _a : `${namespace}-dropdown-trigger-${uniqueId}`;
|
package/image/Image.js
CHANGED
|
@@ -9,15 +9,15 @@ import { CLASSES } from './vars';
|
|
|
9
9
|
import { useComponentProps, useStyled } from '../hooks';
|
|
10
10
|
import { mergeCS } from '../utils';
|
|
11
11
|
export const Image = (props) => {
|
|
12
|
-
const _a = useComponentProps('Image', props), { styleOverrides, styleProvider,
|
|
12
|
+
const _a = useComponentProps('Image', props), { styleOverrides, styleProvider, loading, error, actions, imgProps } = _a, restProps = __rest(_a, ["styleOverrides", "styleProvider", "loading", "error", "actions", "imgProps"]);
|
|
13
13
|
const styled = useStyled(CLASSES, { image: styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider.image }, styleOverrides);
|
|
14
14
|
const forceUpdate = useForceUpdate();
|
|
15
15
|
const dataRef = useRef({
|
|
16
16
|
isLoading: true,
|
|
17
17
|
isError: false,
|
|
18
18
|
});
|
|
19
|
-
if (src !== dataRef.current.prevSrc) {
|
|
20
|
-
dataRef.current.prevSrc = src;
|
|
19
|
+
if (imgProps.src !== dataRef.current.prevSrc) {
|
|
20
|
+
dataRef.current.prevSrc = imgProps.src;
|
|
21
21
|
dataRef.current.isLoading = true;
|
|
22
22
|
dataRef.current.isError = false;
|
|
23
23
|
}
|
|
@@ -27,7 +27,7 @@ export const Image = (props) => {
|
|
|
27
27
|
}), { children: [dataRef.current.isLoading && checkNodeExist(loading) && loading, dataRef.current.isError && checkNodeExist(error) && error, actions && _jsx("div", Object.assign({}, styled('image__actions'), { children: Children.map(actions, (action) => action) })), _jsx("img", Object.assign({}, imgProps, mergeCS(styled('image__img'), {
|
|
28
28
|
className: imgProps === null || imgProps === void 0 ? void 0 : imgProps.className,
|
|
29
29
|
style: Object.assign(Object.assign({}, imgProps === null || imgProps === void 0 ? void 0 : imgProps.style), { display: (dataRef.current.isLoading && loading) || (dataRef.current.isError && error) ? 'none' : undefined }),
|
|
30
|
-
}), {
|
|
30
|
+
}), { onLoadStart: (e) => {
|
|
31
31
|
var _a;
|
|
32
32
|
// https://bugs.chromium.org/p/chromium/issues/detail?id=458851
|
|
33
33
|
(_a = imgProps === null || imgProps === void 0 ? void 0 : imgProps.onLoadStart) === null || _a === void 0 ? void 0 : _a.call(imgProps, e);
|
package/image/types.d.ts
CHANGED
|
@@ -3,11 +3,10 @@ import type { CLASSES, PREVIEW_CLASSES } from './vars';
|
|
|
3
3
|
import type { BaseProps } from '../types';
|
|
4
4
|
export {};
|
|
5
5
|
export interface ImageProps extends BaseProps<'image', typeof CLASSES>, Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
6
|
-
|
|
6
|
+
imgProps: React.ImgHTMLAttributes<HTMLImageElement>;
|
|
7
7
|
loading?: React.ReactNode;
|
|
8
8
|
error?: React.ReactNode;
|
|
9
9
|
actions?: React.ReactElement[];
|
|
10
|
-
imgProps?: React.ImgHTMLAttributes<HTMLImageElement>;
|
|
11
10
|
}
|
|
12
11
|
export interface ImageActionProps extends BaseProps<'image', typeof CLASSES>, React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
13
12
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@laser-ui/components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "React components.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"module": "./index.js",
|
|
27
27
|
"types": "./index.d.ts",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@laser-ui/hooks": "0.
|
|
30
|
-
"@laser-ui/utils": "0.
|
|
29
|
+
"@laser-ui/hooks": "0.3.0",
|
|
30
|
+
"@laser-ui/utils": "0.3.0",
|
|
31
31
|
"@material-design-icons/svg": "^0.14.12",
|
|
32
32
|
"jss": "^10.10.0",
|
|
33
33
|
"jss-preset-default": "^10.10.0",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"access": "public",
|
|
46
46
|
"directory": "../../dist/libs/components"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "4fe0b462c868d1b30b645af80d9e9690f3cefb5c"
|
|
49
49
|
}
|
package/root/dialog-service.js
CHANGED
|
@@ -7,7 +7,11 @@ export class DialogService {
|
|
|
7
7
|
draft.push({
|
|
8
8
|
key: dialogKey,
|
|
9
9
|
type,
|
|
10
|
-
props: Object.assign(Object.assign({}, props), { visible: true, skipFirstTransition: false,
|
|
10
|
+
props: Object.assign(Object.assign({}, props), { visible: true, skipFirstTransition: false, onClose: () => {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
(_b = (_a = props).onClose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
13
|
+
DialogService.close(dialogKey);
|
|
14
|
+
}, afterVisibleChange: (visible) => {
|
|
11
15
|
var _a, _b;
|
|
12
16
|
(_b = (_a = props).afterVisibleChange) === null || _b === void 0 ? void 0 : _b.call(_a, visible);
|
|
13
17
|
if (!visible) {
|