@redneckz/wildless-cms-uni-blocks 0.14.514 → 0.14.516

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.
Files changed (43) hide show
  1. package/bundle/bundle.umd.js +14 -10
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/data/StickyMobileData.d.ts +2 -2
  4. package/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +2 -1
  5. package/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  6. package/dist/components/StickyBottomMenu/useBottomMenuItemDialog.js +1 -1
  7. package/dist/components/StickyBottomMenu/useBottomMenuItemDialog.js.map +1 -1
  8. package/dist/data/StickyMobileData.d.ts +2 -2
  9. package/dist/ui-kit/YandexMap/YandexMap.js +12 -8
  10. package/dist/ui-kit/YandexMap/YandexMap.js.map +1 -1
  11. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +2 -1
  12. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  13. package/lib/components/StickyBottomMenu/useBottomMenuItemDialog.js +1 -1
  14. package/lib/components/StickyBottomMenu/useBottomMenuItemDialog.js.map +1 -1
  15. package/lib/data/StickyMobileData.d.ts +2 -2
  16. package/lib/ui-kit/YandexMap/YandexMap.js +12 -8
  17. package/lib/ui-kit/YandexMap/YandexMap.js.map +1 -1
  18. package/mobile/bundle/bundle.umd.js +15 -11
  19. package/mobile/bundle/bundle.umd.min.js +1 -1
  20. package/mobile/bundle/data/StickyMobileData.d.ts +2 -2
  21. package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +2 -1
  22. package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  23. package/mobile/dist/components/StickyBottomMenu/useBottomMenuItemDialog.js +1 -1
  24. package/mobile/dist/components/StickyBottomMenu/useBottomMenuItemDialog.js.map +1 -1
  25. package/mobile/dist/data/StickyMobileData.d.ts +2 -2
  26. package/mobile/dist/ui-kit/YandexMap/YandexMap.js +12 -8
  27. package/mobile/dist/ui-kit/YandexMap/YandexMap.js.map +1 -1
  28. package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +2 -1
  29. package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  30. package/mobile/lib/components/StickyBottomMenu/useBottomMenuItemDialog.js +1 -1
  31. package/mobile/lib/components/StickyBottomMenu/useBottomMenuItemDialog.js.map +1 -1
  32. package/mobile/lib/data/StickyMobileData.d.ts +2 -2
  33. package/mobile/lib/ui-kit/YandexMap/YandexMap.js +12 -8
  34. package/mobile/lib/ui-kit/YandexMap/YandexMap.js.map +1 -1
  35. package/mobile/src/components/OfficesAtmsMap/OfficesAtmsMapLayout.tsx +2 -1
  36. package/mobile/src/components/StickyBottomMenu/useBottomMenuItemDialog.tsx +5 -2
  37. package/mobile/src/data/StickyMobileData.ts +8 -7
  38. package/mobile/src/ui-kit/YandexMap/YandexMap.tsx +14 -8
  39. package/package.json +1 -1
  40. package/src/components/OfficesAtmsMap/OfficesAtmsMapLayout.tsx +2 -1
  41. package/src/components/StickyBottomMenu/useBottomMenuItemDialog.tsx +5 -2
  42. package/src/data/StickyMobileData.ts +8 -7
  43. package/src/ui-kit/YandexMap/YandexMap.tsx +14 -8
@@ -5186,6 +5186,9 @@
5186
5186
  const map = useRef(null);
5187
5187
  const yandexMaps = useYandexMaps();
5188
5188
  useEffect(() => {
5189
+ if (!points?.length) {
5190
+ return;
5191
+ }
5189
5192
  if (!map?.current) {
5190
5193
  yandexMaps?.ready(() => {
5191
5194
  // Ready function may be called few times, but must be called once
@@ -5193,7 +5196,7 @@
5193
5196
  return;
5194
5197
  }
5195
5198
  map.current = new yandexMaps.Map('map', {
5196
- center: points ? getCenterPoint(points) : DEFAULT_CENTER_COORDS,
5199
+ center: getCenterPoint(points),
5197
5200
  zoom,
5198
5201
  controls: [],
5199
5202
  suppressMapOpenBlock: true,
@@ -5203,9 +5206,7 @@
5203
5206
  }
5204
5207
  else if (yandexMaps) {
5205
5208
  renderClusterer({ yandexMaps, map: map.current, points });
5206
- if (!points?.length) {
5207
- map.current.setCenter(DEFAULT_CENTER_COORDS);
5208
- }
5209
+ map.current.setCenter(getCenterPoint(points));
5209
5210
  }
5210
5211
  }, [yandexMaps, points, zoom]);
5211
5212
  if (!yandexMaps) {
@@ -5214,10 +5215,13 @@
5214
5215
  const zIndex = 'z-10';
5215
5216
  return (jsxs("div", { id: "map", className: style('relative', 'w-full', className), children: [jsxs("div", { className: style('absolute right-2 top-52 z-10 w-12 overflow-hidden border border-transparent rounded-md', zIndex), children: [jsx(ZoomButton, { yandexMaps: map }), jsx(ZoomButton, { yandexMaps: map, direction: "out" })] }), renderUserGeolocation(map, yandexMaps, style('right-2 top-80', zIndex))] }));
5216
5217
  });
5217
- const getCenterPoint = (points) => [
5218
- getArraySumAndAverage(mapByIndex(points, 0)),
5219
- getArraySumAndAverage(mapByIndex(points, 1)),
5220
- ];
5218
+ const getCenterPoint = (points) => {
5219
+ const centerCoords = [
5220
+ getArraySumAndAverage(mapByIndex(points, 0)),
5221
+ getArraySumAndAverage(mapByIndex(points, 1)),
5222
+ ];
5223
+ return centerCoords.every((_) => _) ? centerCoords : DEFAULT_CENTER_COORDS;
5224
+ };
5221
5225
  const mapByIndex = (points, index) => points.map((_) => _.coords[index]);
5222
5226
  const getArraySumAndAverage = (arr) => arr.length && arr.reduce((a, b) => a + b) / arr.length;
5223
5227
 
@@ -5288,7 +5292,7 @@
5288
5292
  return [_filteredItems, _points, _filteredRemoteWorkplaces, itemsLength];
5289
5293
  }, [data, remoteWorkplaces, filtrationState]);
5290
5294
  const [activeButton, setActiveButton] = useState('all');
5291
- return (jsxs("div", { className: style('space-y-1', className), children: [jsxs("div", { className: "bg-white", children: [jsxs("div", { className: "p-3xl pb-0", children: [jsx("div", { className: "flex flex-col sm:flex-row gap-xs mb-2xl", children: jsxs(Heading, { headingType: "h3", children: [jsx("span", { suppressHydrationWarning: true, children: title }), lengthItems ? (jsx(Text, { size: "text-h2", color: "text-secondary-text", children: jsx("span", { suppressHydrationWarning: true, children: ` (${lengthItems})` }) })) : null] }) }), descriptionData ? renderDescriptionBlock$1(descriptionData) : null, onlyOffice && renderButtonsGroup(data, activeButton, setActiveButton), jsx("div", { className: style('pb-3xl', filtersVisibleStyles(activeButton)), children: renderFiltrationForm(Object.keys(initFilterState), { field, reset }, onlyOffice) })] }), jsx("div", { className: "h-[600px]", children: jsx(ClientOnly, { children: jsx(YandexMap, { points: points, className: "h-full" }) }) })] }), jsxs(ClientOnly, { children: [filteredItems.map(renderCard), filteredRemoteWorkplaces.map(renderRemoteWorkplaceCard)] })] }));
5295
+ return (jsxs("div", { className: style('space-y-1', className), children: [jsxs("div", { className: "bg-white", children: [jsxs("div", { className: "p-3xl pb-0", children: [jsx("div", { className: "flex flex-col sm:flex-row gap-xs mb-2xl", children: jsxs(Heading, { headingType: "h3", children: [jsx("span", { suppressHydrationWarning: true, children: title }), lengthItems ? (jsx(Text, { size: "text-h2", color: "text-secondary-text", children: jsx("span", { suppressHydrationWarning: true, children: ` (${lengthItems})` }) })) : null] }) }), descriptionData ? renderDescriptionBlock$1(descriptionData) : null, onlyOffice && renderButtonsGroup(data, activeButton, setActiveButton), jsx("div", { className: style('pb-3xl', filtersVisibleStyles(activeButton)), children: renderFiltrationForm(Object.keys(initFilterState), { field, reset }, onlyOffice) })] }), jsx("div", { className: "h-[600px]", children: jsx(ClientOnly, { children: points?.length ? jsx(YandexMap, { points: points, className: "h-full" }) : jsx(Shimmer, {}) }) })] }), jsxs(ClientOnly, { children: [filteredItems.map(renderCard), filteredRemoteWorkplaces.map(renderRemoteWorkplaceCard)] })] }));
5292
5296
  });
5293
5297
  const renderButtonsGroup = (data, activeButton, onButtonClick) => {
5294
5298
  const allButtonVersion = getVersion(activeButton === 'all');
@@ -6452,7 +6456,7 @@
6452
6456
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
6453
6457
  });
6454
6458
 
6455
- const packageVersion = "0.14.513";
6459
+ const packageVersion = "0.14.515";
6456
6460
 
6457
6461
  exports.Blocks = Blocks;
6458
6462
  exports.ContentPage = ContentPage;