@wayke-se/components-react 3.0.0 → 3.1.0-beta.2

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.
@@ -99,6 +99,76 @@ export const SliderWrapper = styled.div `
99
99
  bottom: 0;
100
100
  left: 0;
101
101
  right: 0;
102
+ user-select: none;
103
+ touch-action: pan-y;
104
+ -webkit-tap-highlight-color: transparent;
105
+
106
+ .slick-list,
107
+ .slick-track {
108
+ transform: translate3d(0, 0, 0);
109
+ }
110
+ }
111
+
112
+ .slick-list {
113
+ position: relative;
114
+ display: block;
115
+ margin: 0;
116
+ padding: 0;
117
+ overflow: hidden;
118
+
119
+ &:focus {
120
+ outline: none;
121
+ }
122
+
123
+ &.dragging {
124
+ cursor: pointer;
125
+ cursor: hand;
126
+ }
127
+ }
128
+
129
+ .slick-track {
130
+ position: relative;
131
+ top: 0;
132
+ left: 0;
133
+ display: block;
134
+ margin-left: auto;
135
+ margin-right: auto;
136
+
137
+ &::before,
138
+ &::after {
139
+ content: '';
140
+ display: table;
141
+ }
142
+
143
+ &::after {
144
+ clear: both;
145
+ }
146
+ }
147
+
148
+ .slick-slide {
149
+ display: none;
150
+ float: left;
151
+ min-height: 1px;
152
+ }
153
+
154
+ .slick-loading {
155
+ .slick-track {
156
+ visibility: hidden;
157
+ }
158
+
159
+ img {
160
+ display: none;
161
+ }
162
+ }
163
+
164
+ .slick-initialized {
165
+ .slick-slide {
166
+ display: block;
167
+ }
168
+ }
169
+
170
+ .slick-slide.dragging img {
171
+ pointer-events: none;
102
172
  }
103
173
 
104
174
  ${(props) => props.theme.breakpoint.LtMd} {
@@ -111,7 +181,6 @@ export const SliderWrapper = styled.div `
111
181
 
112
182
  .slick-slide {
113
183
  border-right: ${size(1)} solid ${(props) => props.theme.color.bg};
114
- //transform: scale(0.95);
115
184
  transform-origin: 0 50%;
116
185
  transition: transform 150ms ease;
117
186
  }
@@ -15,13 +15,28 @@ const Grid = ({ documents, placeholderImage, hashRoute, pathRoute, onClickItem }
15
15
  }
16
16
  return (React.createElement(Wrapper, null,
17
17
  React.createElement(List, null, documents.map((document) => {
18
+ /*
18
19
  const _path = pathRoute?.replace(/^\/|\/$/g, '');
20
+
19
21
  const prefix = _path ? `/${_path}/` : '/';
20
- const pathRouteUrl = window.location.pathname === '/'
22
+
23
+ const pathRouteUrl =
24
+ window.location.pathname === '/'
21
25
  ? `${prefix}${document._id}`
22
26
  : `${window.location.pathname}${prefix}${document._id}`;
27
+ */
28
+ /*
29
+ const _pathRoute = pathRoute
30
+ ? pathRoute.startsWith('/')
31
+ ? `${location.pathname}${pathRoute}/${document._id}`
32
+ : `${pathRoute}/${document._id}`
33
+ : undefined;
34
+
35
+ console.log(_pathRoute);
36
+ */
37
+ const _pathRoute = pathRoute ? `${pathRoute}/${document._id}` : undefined;
23
38
  return (React.createElement(Item, { key: document._id },
24
- React.createElement(ProductCard, { id: document._id, onClick: onClickItem, title: document.title, pathRoute: pathRoute, href: pathRoute ? pathRouteUrl : hashRoute ? `#${document._id}` : undefined, image: resolveImage(document), placeholderImage: placeholderImage, description: document.shortDescription, uspList: [
39
+ React.createElement(ProductCard, { id: document._id, onClick: onClickItem, title: document.title, pathRoute: pathRoute, href: _pathRoute ? _pathRoute : hashRoute ? `#${document._id}` : undefined, image: resolveImage(document), placeholderImage: placeholderImage, description: document.shortDescription, uspList: [
25
40
  {
26
41
  title: document.modelYear,
27
42
  },
@@ -8,9 +8,12 @@ const ProductCard = ({ id, title, href, image, pathRoute, placeholderImage, desc
8
8
  const { pushState } = usePath();
9
9
  const _onClick = useMemo(() => (onClick ? () => onClick(id) : undefined), [id]);
10
10
  const onHrefClick = useCallback((e) => {
11
- if (!!pathRoute && href) {
12
- e.preventDefault();
13
- pushState(href);
11
+ if (pathRoute && href) {
12
+ const reg = new RegExp('^((http|https)://)|//');
13
+ if (!pathRoute.match(reg) && !pathRoute.startsWith(location.origin)) {
14
+ e.preventDefault();
15
+ pushState(href);
16
+ }
14
17
  }
15
18
  }, [id, pathRoute, href]);
16
19
  return (React.createElement(Wrapper, { onClick: _onClick },
@@ -36,11 +36,11 @@ const Related = ({ id, hashRoute, pathRoute, onClickSearchItem }) => {
36
36
  React.createElement(OverflowGrid, null,
37
37
  React.createElement(OverflowGridList, null, response?.documentList.documents.map((document) => {
38
38
  const prefix = pathRoute ? `/${pathRoute}` : '/';
39
- const r = regexPathGuid(pathRoute);
39
+ const r = regexPathGuid();
40
40
  const pathRouteUrl = window.location.pathname === '/'
41
41
  ? `${prefix}${document._id}`
42
42
  : r.test(`${pathRoute}${id}`)
43
- ? window.location.pathname.replace(r, `${pathRoute}${document._id}`)
43
+ ? window.location.pathname.replace(r, document._id)
44
44
  : `${window.location.pathname}${prefix}${document._id}`;
45
45
  return (React.createElement(OverflowGridItem, { key: document._id },
46
46
  React.createElement(ProductCard, { id: document._id, onClick: onItemClicked, title: document.title, href: pathRoute ? pathRouteUrl : hashRoute ? `#${document._id}` : undefined, image: document.featuredImage?.files?.[0]?.url, description: document.shortDescription, uspList: [
@@ -2,7 +2,7 @@ export const regexGuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a
2
2
  const regexEndGuid = /[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/;
3
3
  export const escapeRegExpString = (s) => s.replace(/[-[\]/{}()*+?.\\^$|]/g, '\\$&');
4
4
  export const regexPathGuid = (path) => {
5
- if (!path) {
5
+ if (!path || path) {
6
6
  return regexEndGuid;
7
7
  }
8
8
  const r = new RegExp(`${escapeRegExpString(path)}${regexEndGuid.source}`, 'gi');
package/dist-web/index.js CHANGED
@@ -1956,9 +1956,12 @@ const ProductCard = ({ id, title, href, image, pathRoute, placeholderImage, desc
1956
1956
  const { pushState } = usePath();
1957
1957
  const _onClick = useMemo(() => (onClick ? () => onClick(id) : undefined), [id]);
1958
1958
  const onHrefClick = useCallback((e) => {
1959
- if (!!pathRoute && href) {
1960
- e.preventDefault();
1961
- pushState(href);
1959
+ if (pathRoute && href) {
1960
+ const reg = new RegExp('^((http|https)://)|//');
1961
+ if (!pathRoute.match(reg) && !pathRoute.startsWith(location.origin)) {
1962
+ e.preventDefault();
1963
+ pushState(href);
1964
+ }
1962
1965
  }
1963
1966
  }, [id, pathRoute, href]);
1964
1967
  return (React__default.createElement(Wrapper$8, { onClick: _onClick },
@@ -1997,13 +2000,28 @@ const Grid = ({ documents, placeholderImage, hashRoute, pathRoute, onClickItem }
1997
2000
  }
1998
2001
  return (React__default.createElement(Wrapper$7, null,
1999
2002
  React__default.createElement(List$4, null, documents.map((document) => {
2003
+ /*
2000
2004
  const _path = pathRoute?.replace(/^\/|\/$/g, '');
2005
+
2001
2006
  const prefix = _path ? `/${_path}/` : '/';
2002
- const pathRouteUrl = window.location.pathname === '/'
2007
+
2008
+ const pathRouteUrl =
2009
+ window.location.pathname === '/'
2003
2010
  ? `${prefix}${document._id}`
2004
2011
  : `${window.location.pathname}${prefix}${document._id}`;
2012
+ */
2013
+ /*
2014
+ const _pathRoute = pathRoute
2015
+ ? pathRoute.startsWith('/')
2016
+ ? `${location.pathname}${pathRoute}/${document._id}`
2017
+ : `${pathRoute}/${document._id}`
2018
+ : undefined;
2019
+
2020
+ console.log(_pathRoute);
2021
+ */
2022
+ const _pathRoute = pathRoute ? `${pathRoute}/${document._id}` : undefined;
2005
2023
  return (React__default.createElement(Item$4, { key: document._id },
2006
- React__default.createElement(ProductCard, { id: document._id, onClick: onClickItem, title: document.title, pathRoute: pathRoute, href: pathRoute ? pathRouteUrl : hashRoute ? `#${document._id}` : undefined, image: resolveImage(document), placeholderImage: placeholderImage, description: document.shortDescription, uspList: [
2024
+ React__default.createElement(ProductCard, { id: document._id, onClick: onClickItem, title: document.title, pathRoute: pathRoute, href: _pathRoute ? _pathRoute : hashRoute ? `#${document._id}` : undefined, image: resolveImage(document), placeholderImage: placeholderImage, description: document.shortDescription, uspList: [
2007
2025
  {
2008
2026
  title: document.modelYear,
2009
2027
  },
@@ -2778,6 +2796,76 @@ const SliderWrapper = styled.div `
2778
2796
  bottom: 0;
2779
2797
  left: 0;
2780
2798
  right: 0;
2799
+ user-select: none;
2800
+ touch-action: pan-y;
2801
+ -webkit-tap-highlight-color: transparent;
2802
+
2803
+ .slick-list,
2804
+ .slick-track {
2805
+ transform: translate3d(0, 0, 0);
2806
+ }
2807
+ }
2808
+
2809
+ .slick-list {
2810
+ position: relative;
2811
+ display: block;
2812
+ margin: 0;
2813
+ padding: 0;
2814
+ overflow: hidden;
2815
+
2816
+ &:focus {
2817
+ outline: none;
2818
+ }
2819
+
2820
+ &.dragging {
2821
+ cursor: pointer;
2822
+ cursor: hand;
2823
+ }
2824
+ }
2825
+
2826
+ .slick-track {
2827
+ position: relative;
2828
+ top: 0;
2829
+ left: 0;
2830
+ display: block;
2831
+ margin-left: auto;
2832
+ margin-right: auto;
2833
+
2834
+ &::before,
2835
+ &::after {
2836
+ content: '';
2837
+ display: table;
2838
+ }
2839
+
2840
+ &::after {
2841
+ clear: both;
2842
+ }
2843
+ }
2844
+
2845
+ .slick-slide {
2846
+ display: none;
2847
+ float: left;
2848
+ min-height: 1px;
2849
+ }
2850
+
2851
+ .slick-loading {
2852
+ .slick-track {
2853
+ visibility: hidden;
2854
+ }
2855
+
2856
+ img {
2857
+ display: none;
2858
+ }
2859
+ }
2860
+
2861
+ .slick-initialized {
2862
+ .slick-slide {
2863
+ display: block;
2864
+ }
2865
+ }
2866
+
2867
+ .slick-slide.dragging img {
2868
+ pointer-events: none;
2781
2869
  }
2782
2870
 
2783
2871
  ${(props) => props.theme.breakpoint.LtMd} {
@@ -2790,7 +2878,6 @@ const SliderWrapper = styled.div `
2790
2878
 
2791
2879
  .slick-slide {
2792
2880
  border-right: ${size(1)} solid ${(props) => props.theme.color.bg};
2793
- //transform: scale(0.95);
2794
2881
  transform-origin: 0 50%;
2795
2882
  transition: transform 150ms ease;
2796
2883
  }
@@ -5762,7 +5849,7 @@ const useRelatedSearch = (id) => {
5762
5849
  const regexEndGuid = /[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/;
5763
5850
  const escapeRegExpString = (s) => s.replace(/[-[\]/{}()*+?.\\^$|]/g, '\\$&');
5764
5851
  const regexPathGuid = (path) => {
5765
- if (!path) {
5852
+ if (!path || path) {
5766
5853
  return regexEndGuid;
5767
5854
  }
5768
5855
  const r = new RegExp(`${escapeRegExpString(path)}${regexEndGuid.source}`, 'gi');
@@ -5794,11 +5881,11 @@ const Related = ({ id, hashRoute, pathRoute, onClickSearchItem }) => {
5794
5881
  React__default.createElement(OverflowGrid, null,
5795
5882
  React__default.createElement(OverflowGridList, null, response?.documentList.documents.map((document) => {
5796
5883
  const prefix = pathRoute ? `/${pathRoute}` : '/';
5797
- const r = regexPathGuid(pathRoute);
5884
+ const r = regexPathGuid();
5798
5885
  const pathRouteUrl = window.location.pathname === '/'
5799
5886
  ? `${prefix}${document._id}`
5800
5887
  : r.test(`${pathRoute}${id}`)
5801
- ? window.location.pathname.replace(r, `${pathRoute}${document._id}`)
5888
+ ? window.location.pathname.replace(r, document._id)
5802
5889
  : `${window.location.pathname}${prefix}${document._id}`;
5803
5890
  return (React__default.createElement(OverflowGridItem, { key: document._id },
5804
5891
  React__default.createElement(ProductCard, { id: document._id, onClick: onItemClicked, title: document.title, href: pathRoute ? pathRouteUrl : hashRoute ? `#${document._id}` : undefined, image: document.featuredImage?.files?.[0]?.url, description: document.shortDescription, uspList: [