@wayke-se/components-react 3.0.0-beta.3 → 3.0.0-beta.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.js +639 -972
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +547 -880
- package/dist/index.mjs.map +4 -4
- package/esbuild/common.js +4 -0
- package/esbuild/lib.js +1 -0
- package/package.json +3 -4
- package/src/components/Gallery/index.tsx +24 -31
- package/src/components/Lightbox/index.tsx +11 -11
- package/src/components/ProductCard/index.tsx +22 -19
package/esbuild/common.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const { sassPlugin } = require('esbuild-sass-plugin');
|
|
2
|
+
|
|
1
3
|
module.exports = {
|
|
2
4
|
entryPoints: ['src/index.ts', 'src/style.js'],
|
|
3
5
|
bundle: true,
|
|
@@ -12,4 +14,6 @@ module.exports = {
|
|
|
12
14
|
'.svg': 'dataurl',
|
|
13
15
|
'.png': 'dataurl',
|
|
14
16
|
},
|
|
17
|
+
|
|
18
|
+
plugins: [sassPlugin()],
|
|
15
19
|
};
|
package/esbuild/lib.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wayke-se/components-react",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.5",
|
|
4
4
|
"description": "Wayke Components React",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"react": "^18.2.0",
|
|
54
54
|
"react-dom": "^18.2.0",
|
|
55
55
|
"rimraf": "^3.0.2",
|
|
56
|
-
"styled-components": "^5.3.
|
|
56
|
+
"styled-components": "^5.3.5",
|
|
57
57
|
"typescript": "^4.4.4"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
@@ -64,9 +64,8 @@
|
|
|
64
64
|
"graphql": "^16.0.1",
|
|
65
65
|
"libphonenumber-js": "^1.9.42",
|
|
66
66
|
"marked": "^4.0.3",
|
|
67
|
-
"pannellum-react": "^1.2.4",
|
|
68
67
|
"react-compound-slider": "^3.3.1",
|
|
69
|
-
"react-
|
|
68
|
+
"react-lazy-load": "^4.0.1",
|
|
70
69
|
"react-slick": "^0.29.0",
|
|
71
70
|
"scroll-into-view-if-needed": "^2.2.28"
|
|
72
71
|
}
|
|
@@ -22,7 +22,6 @@ import { ButtonSecondary, ButtonContent } from '../Button/index';
|
|
|
22
22
|
import Lightbox from '../Lightbox/index';
|
|
23
23
|
import EmbededVideo from '../Video/EmbededVideo';
|
|
24
24
|
import QuickNavEmbeded from '../Video/QuickNavEmbeded';
|
|
25
|
-
import Sphere from '../Sphere/Sphere';
|
|
26
25
|
import { notEmpty } from '../../utils/formats';
|
|
27
26
|
import ThreeSixty from '../ThreeSixty/ThreeSixty';
|
|
28
27
|
import { Media } from '../../@types/codegen';
|
|
@@ -132,36 +131,30 @@ const Gallery = ({ media, placeholderImage }: GalleryProps) => {
|
|
|
132
131
|
beforeChange={beforeChange}
|
|
133
132
|
>
|
|
134
133
|
{!!media?.length ? (
|
|
135
|
-
media
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
onDisableNavigation={onDisableNavigation}
|
|
160
|
-
navigationDisabled={navigationDisabled}
|
|
161
|
-
/>
|
|
162
|
-
)}
|
|
163
|
-
</Item>
|
|
164
|
-
))
|
|
134
|
+
media
|
|
135
|
+
.filter((x) => x.type !== 'sphere')
|
|
136
|
+
.map((m, i) => (
|
|
137
|
+
<Item key={m.files[0].url || i}>
|
|
138
|
+
{m.type === 'image' && (
|
|
139
|
+
<Image
|
|
140
|
+
src={
|
|
141
|
+
m.files[0].formats.filter(notEmpty).find((x) => x.format === '1170x')
|
|
142
|
+
?.url
|
|
143
|
+
}
|
|
144
|
+
alt={`Bild ${i + 1}`}
|
|
145
|
+
/>
|
|
146
|
+
)}
|
|
147
|
+
{m.type === 'threesixty' && (
|
|
148
|
+
<ThreeSixty
|
|
149
|
+
urls={m.files.map((x) => x.url)}
|
|
150
|
+
visible={i === index}
|
|
151
|
+
onDisableNavigation={onDisableNavigation}
|
|
152
|
+
navigationDisabled={navigationDisabled}
|
|
153
|
+
/>
|
|
154
|
+
)}
|
|
155
|
+
{m.type === 'embedded' && <EmbededVideo src={m.files[0].url} index={i + 1} />}
|
|
156
|
+
</Item>
|
|
157
|
+
))
|
|
165
158
|
) : (
|
|
166
159
|
<Item key={placeholder}>
|
|
167
160
|
<Image src={placeholder} alt={`Bild 1`} />
|
|
@@ -3,7 +3,6 @@ import React from 'react';
|
|
|
3
3
|
import { Wrapper, UiBlock, Item, Img, CloseBtn } from './wrapper';
|
|
4
4
|
import { IconCancel } from '../Icon/index';
|
|
5
5
|
import EmbeddedVideoLightbox from '../Video/EmbeddedVideoLightbox';
|
|
6
|
-
import SphereLightbox from '../Sphere/SphereLightbox';
|
|
7
6
|
import ThreeSixtyLightbox from '../ThreeSixty/ThreeSixtLightbox';
|
|
8
7
|
import { Media } from '../../@types/codegen';
|
|
9
8
|
|
|
@@ -31,16 +30,17 @@ const Lightbox = ({ index, media, onClose }: LightboxProps) => {
|
|
|
31
30
|
return (
|
|
32
31
|
<Wrapper ref={(ref) => ref?.focus()} onKeyDown={onKeyDown} tabIndex={0}>
|
|
33
32
|
<UiBlock onClick={onClose} aria-hidden />
|
|
34
|
-
{media
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
{media
|
|
34
|
+
.filter((x) => x.type !== 'sphere')
|
|
35
|
+
.map((m, i) => (
|
|
36
|
+
<Item key={i} ref={index === i ? onRef : undefined}>
|
|
37
|
+
{m.type === 'image' && (
|
|
38
|
+
<Img id={`lightbox-image-${i}`} src={m.files[0].url} alt={`Bild ${i + 1}`} />
|
|
39
|
+
)}
|
|
40
|
+
{m.type === 'threesixty' && <ThreeSixtyLightbox urls={m.files.map((x) => x.url)} />}
|
|
41
|
+
{m.type === 'embedded' && <EmbeddedVideoLightbox url={m.files[0].url} />}
|
|
42
|
+
</Item>
|
|
43
|
+
))}
|
|
44
44
|
<CloseBtn onClick={onClose} title="Stäng">
|
|
45
45
|
<IconCancel block />
|
|
46
46
|
</CloseBtn>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useCallback, useMemo } from 'react';
|
|
2
|
+
import LazyLoad from 'react-lazy-load';
|
|
2
3
|
|
|
3
4
|
import {
|
|
4
5
|
Wrapper,
|
|
@@ -68,27 +69,29 @@ const ProductCard = ({
|
|
|
68
69
|
return (
|
|
69
70
|
<Wrapper onClick={_onClick}>
|
|
70
71
|
<Image>
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
<LazyLoad>
|
|
73
|
+
{image ? (
|
|
74
|
+
<>
|
|
75
|
+
<Picture>
|
|
76
|
+
<Source
|
|
77
|
+
type="image/webp"
|
|
78
|
+
srcSet={`${image}?spec=822x548&format=webp 822w, ${image}?spec=750x500&format=webp 750w, ${image}?spec=411x274&format=webp 411w`}
|
|
79
|
+
sizes="(min-width: 600px) calc(((100vw - 48px) / 2) - 8px), (min-width: 900px) calc(((100vw - 48px) / 3) - 10.666px), (min-width: 1312px) 410px, calc(100vw - 32px)"
|
|
80
|
+
/>
|
|
81
|
+
<Img
|
|
82
|
+
srcSet={`${image}?spec=822x548 822w, ${image}?spec=750x500 750w, ${image}?spec=411x274 411w`}
|
|
83
|
+
sizes="(min-width: 600px) calc(((100vw - 48px) / 2) - 8px), (min-width: 900px) calc(((100vw - 48px) / 3) - 10.666px), (min-width: 1312px) 410px, calc(100vw - 32px)"
|
|
84
|
+
src={`${image}?spec=411x274`}
|
|
85
|
+
alt={title}
|
|
86
|
+
/>
|
|
87
|
+
</Picture>
|
|
88
|
+
</>
|
|
89
|
+
) : (
|
|
73
90
|
<Picture>
|
|
74
|
-
<
|
|
75
|
-
type="image/webp"
|
|
76
|
-
srcSet={`${image}?spec=822x548&format=webp 822w, ${image}?spec=750x500&format=webp 750w, ${image}?spec=411x274&format=webp 411w`}
|
|
77
|
-
sizes="(min-width: 600px) calc(((100vw - 48px) / 2) - 8px), (min-width: 900px) calc(((100vw - 48px) / 3) - 10.666px), (min-width: 1312px) 410px, calc(100vw - 32px)"
|
|
78
|
-
/>
|
|
79
|
-
<Img
|
|
80
|
-
srcSet={`${image}?spec=822x548 822w, ${image}?spec=750x500 750w, ${image}?spec=411x274 411w`}
|
|
81
|
-
sizes="(min-width: 600px) calc(((100vw - 48px) / 2) - 8px), (min-width: 900px) calc(((100vw - 48px) / 3) - 10.666px), (min-width: 1312px) 410px, calc(100vw - 32px)"
|
|
82
|
-
src={`${image}?spec=411x274`}
|
|
83
|
-
alt={title}
|
|
84
|
-
/>
|
|
91
|
+
<Img src={placeholderImage || DEFAULT_PLACEHOLDER_IMAGE} />
|
|
85
92
|
</Picture>
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
<Picture>
|
|
89
|
-
<Img src={placeholderImage || DEFAULT_PLACEHOLDER_IMAGE} />
|
|
90
|
-
</Picture>
|
|
91
|
-
)}
|
|
93
|
+
)}
|
|
94
|
+
</LazyLoad>
|
|
92
95
|
</Image>
|
|
93
96
|
<Content>
|
|
94
97
|
<ContentBody>
|