diff --git a/apps/react-storybook/stories/map/OSMMap.stories.tsx b/apps/react-storybook/stories/map/OSMMap.stories.tsx
index e96a51a62e69..865b6130cd0e 100644
--- a/apps/react-storybook/stories/map/OSMMap.stories.tsx
+++ b/apps/react-storybook/stories/map/OSMMap.stories.tsx
@@ -1,4 +1,5 @@
import type { Meta, StoryObj } from '@storybook/react-webpack5';
+import { useArgs } from 'storybook/preview-api';
import Attribution from 'ol/control/Attribution.js';
import type OpenLayersMap from 'ol/Map.js';
@@ -6,25 +7,41 @@ import 'ol/ol.css';
import { fromLonLat, transformExtent } from 'ol/proj.js';
import View from 'ol/View.js';
import React from 'react';
-import Map from 'devextreme-react/map';
-import type { ReadyEvent } from 'devextreme/ui/map';
+import Map, { type MapRef } from 'devextreme-react/map';
+import type {
+ MapLocation,
+ MapType,
+ ReadyEvent,
+} from 'devextreme/ui/map';
import 'devextreme/ui/map/openlayers';
const CENTER = { lat: 40.7484, lng: -73.9857 };
+const CENTRAL_PARK_CENTER = { lat: 40.7829, lng: -73.9654 };
const EXTENT: [number, number, number, number] = [-74.08, 40.67, -73.85, 40.88];
const TILE_SERVER = {
url: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
attribution: '© OpenStreetMap contributors',
maxZoom: 19,
};
-const PROVIDER_CONFIG = { tileServer: TILE_SERVER };
+const PROVIDER_CONFIG = { tileServer: () => TILE_SERVER };
interface OsmStoryArgs {
+ centerOnCentralPark: boolean;
+ controls: boolean;
+ disabled: boolean;
+ focusStateEnabled: boolean;
+ rtlEnabled: boolean;
+ type: MapType;
zoom: number;
}
-const configureMap = (
+interface OsmMapStoryProps extends OsmStoryArgs {
+ updateArgs: (args: Partial) => void;
+}
+
+const configureOpenLayersMap = (
{ originalMap }: ReadyEvent,
+ center: MapLocation,
zoom: number,
): void => {
const map = originalMap as OpenLayersMap;
@@ -34,36 +51,86 @@ const configureMap = (
attribution?.setCollapsed(false);
attribution?.setCollapsible(false);
map.setView(new View({
- center: fromLonLat([CENTER.lng, CENTER.lat]),
+ center: fromLonLat([center.lng, center.lat]),
extent: transformExtent(EXTENT, 'EPSG:4326', 'EPSG:3857'),
maxZoom: 16,
minZoom: 14,
- showFullExtent: false,
smoothExtentConstraint: false,
zoom,
}));
};
-const OsmMapStory = ({ zoom }: OsmStoryArgs): React.ReactElement => (
-