@axinom/mosaic-ui 0.33.0-rc.3 → 0.33.0-rc.5
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/dist/index.es.js +3 -3
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/Loaders/ImageLoader/ImageLoader.scss +27 -21
- package/src/components/Loaders/ImageLoader/ImageLoader.spec.tsx +8 -12
- package/src/components/Loaders/ImageLoader/ImageLoader.tsx +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axinom/mosaic-ui",
|
|
3
|
-
"version": "0.33.0-rc.
|
|
3
|
+
"version": "0.33.0-rc.5",
|
|
4
4
|
"description": "UI components for building Axinom Mosaic applications",
|
|
5
5
|
"author": "Axinom",
|
|
6
6
|
"license": "PROPRIETARY",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"build-storybook": "storybook build"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@axinom/mosaic-core": "^0.4.6-rc.
|
|
35
|
+
"@axinom/mosaic-core": "^0.4.6-rc.5",
|
|
36
36
|
"@faker-js/faker": "^7.4.0",
|
|
37
37
|
"@popperjs/core": "^2.9.2",
|
|
38
38
|
"clsx": "^1.1.0",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"publishConfig": {
|
|
103
103
|
"access": "public"
|
|
104
104
|
},
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "4bcb9bfa2545d336f1bb0a98ea881b966456d4f0"
|
|
106
106
|
}
|
|
@@ -1,29 +1,35 @@
|
|
|
1
1
|
@import '../../../styles/common.scss';
|
|
2
2
|
|
|
3
3
|
.container {
|
|
4
|
-
@include boxSizing;
|
|
5
|
-
|
|
6
|
-
width: 50px;
|
|
7
|
-
height: 50px;
|
|
8
4
|
display: grid;
|
|
9
|
-
grid
|
|
10
|
-
grid-template-rows: 1fr;
|
|
11
|
-
place-items: center;
|
|
12
|
-
}
|
|
5
|
+
grid: 1fr / 1fr;
|
|
13
6
|
|
|
14
|
-
.
|
|
15
|
-
|
|
16
|
-
}
|
|
7
|
+
.loader {
|
|
8
|
+
@include boxSizing;
|
|
17
9
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
10
|
+
width: 50px;
|
|
11
|
+
height: 50px;
|
|
12
|
+
display: grid;
|
|
13
|
+
grid: 1fr / 1fr;
|
|
14
|
+
place-items: center;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.imageContainer {
|
|
18
|
+
display: grid;
|
|
19
|
+
grid: 1fr / 1fr;
|
|
20
|
+
place-items: center;
|
|
21
|
+
|
|
22
|
+
.fallback {
|
|
23
|
+
background-color: var(
|
|
24
|
+
--fallback-image-bg-color,
|
|
25
|
+
$fallback-image-bg-color
|
|
26
|
+
);
|
|
27
|
+
}
|
|
23
28
|
|
|
24
|
-
.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
.fallBackImage {
|
|
30
|
+
height: 50px;
|
|
31
|
+
width: 50px;
|
|
32
|
+
align-self: center;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
29
35
|
}
|
|
@@ -99,7 +99,7 @@ describe('ImageLoader', () => {
|
|
|
99
99
|
|
|
100
100
|
const loader = wrapper.find(ContentLoader);
|
|
101
101
|
const imgDisplay = wrapper.find('img').prop('style')?.display;
|
|
102
|
-
const fallbackContainer = wrapper.find('.container');
|
|
102
|
+
const fallbackContainer = wrapper.find('.container').at(1);
|
|
103
103
|
|
|
104
104
|
expect(loader.exists()).toBe(false);
|
|
105
105
|
expect(imgDisplay).toBe('none');
|
|
@@ -116,7 +116,7 @@ describe('ImageLoader', () => {
|
|
|
116
116
|
|
|
117
117
|
const loader = wrapper.find(ContentLoader);
|
|
118
118
|
const images = wrapper.find('img');
|
|
119
|
-
const fallbackContainer = wrapper.find('.container');
|
|
119
|
+
const fallbackContainer = wrapper.find('.container').at(1);
|
|
120
120
|
|
|
121
121
|
expect(loader.exists()).toBe(false);
|
|
122
122
|
expect(images.at(0).prop('style')?.display).toBe('none'); // hidden failed image
|
|
@@ -198,12 +198,10 @@ describe('ImageLoader', () => {
|
|
|
198
198
|
it(`loader dimensions defaults to '50px' by '50px'`, () => {
|
|
199
199
|
const wrapper = shallow(<ImageLoader imgSrc="" />);
|
|
200
200
|
|
|
201
|
-
const
|
|
202
|
-
.find('.container')
|
|
203
|
-
.prop('style') as React.CSSProperties;
|
|
201
|
+
const loader = wrapper.find('.loader').prop('style') as React.CSSProperties;
|
|
204
202
|
|
|
205
|
-
expect(
|
|
206
|
-
expect(
|
|
203
|
+
expect(loader.height).toBe('50px');
|
|
204
|
+
expect(loader.width).toBe('50px');
|
|
207
205
|
});
|
|
208
206
|
|
|
209
207
|
it('sets the height and width of the loader', () => {
|
|
@@ -213,11 +211,9 @@ describe('ImageLoader', () => {
|
|
|
213
211
|
<ImageLoader imgSrc="" height={mockHeight} width={mockWidth} />,
|
|
214
212
|
);
|
|
215
213
|
|
|
216
|
-
const
|
|
217
|
-
.find('.container')
|
|
218
|
-
.prop('style') as React.CSSProperties;
|
|
214
|
+
const loader = wrapper.find('.loader').prop('style') as React.CSSProperties;
|
|
219
215
|
|
|
220
|
-
expect(
|
|
221
|
-
expect(
|
|
216
|
+
expect(loader.height).toBe(`${mockHeight}px`);
|
|
217
|
+
expect(loader.width).toBe(`${mockWidth}px`);
|
|
222
218
|
});
|
|
223
219
|
});
|
|
@@ -106,9 +106,9 @@ export const ImageLoader: React.FC<ImageLoaderProps> = ({
|
|
|
106
106
|
}, [imgSrc, onError]);
|
|
107
107
|
|
|
108
108
|
return (
|
|
109
|
-
|
|
109
|
+
<div className={classes.container}>
|
|
110
110
|
{isLoading && (
|
|
111
|
-
<div className={classes.
|
|
111
|
+
<div className={classes.loader} style={customStyles}>
|
|
112
112
|
<ContentLoader
|
|
113
113
|
speed={speed}
|
|
114
114
|
backgroundColor={backgroundColor}
|
|
@@ -153,6 +153,6 @@ export const ImageLoader: React.FC<ImageLoaderProps> = ({
|
|
|
153
153
|
{!isLoading && !fallBack && children}
|
|
154
154
|
</div>
|
|
155
155
|
)}
|
|
156
|
-
|
|
156
|
+
</div>
|
|
157
157
|
);
|
|
158
158
|
};
|