@swisper.ai/web-map 0.0.2 → 0.0.4
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.css +1 -1
- package/dist/index.es.js +76 -76
- package/dist/index.es.js.map +1 -1
- package/dist/map-pin.d.ts.map +1 -1
- package/dist/user-location-pin.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/__tests__/map-user-location.spec.tsx +2 -6
- package/src/base-map.json +1 -0
- package/src/map-marker.json +1 -0
- package/src/map-marker.stories.tsx +6 -6
- package/src/map-marker.tsx +1 -1
- package/src/map-pin.json +1 -0
- package/src/map-pin.tsx +2 -1
- package/src/map-user-location.json +1 -0
- package/src/map-user-location.stories.tsx +11 -12
- package/src/map-view.json +1 -0
- package/src/map-view.stories.tsx +5 -6
- package/src/user-location-pin.json +1 -0
- package/src/user-location-pin.tsx +2 -1
- /package/src/__tests__/{load-map-lib.spec.ts → load-map-lib.test.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { withTooltip } from '@swisper.ai/ui';
|
|
4
4
|
|
|
5
5
|
import { USER_LOCATION } from './__storybook__/fixtures';
|
|
6
6
|
import { MapUserLocation } from './map-user-location';
|
|
@@ -12,18 +12,17 @@ const meta: Meta<typeof MapUserLocation> = {
|
|
|
12
12
|
tags: ['autodocs'],
|
|
13
13
|
decorators: [
|
|
14
14
|
(Story) => (
|
|
15
|
-
<
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
</div>
|
|
25
|
-
</TooltipProvider>
|
|
15
|
+
<div className="h-[500px] w-[700px]">
|
|
16
|
+
<MapView
|
|
17
|
+
testId="map-user-location-story"
|
|
18
|
+
ariaLabel="Your location"
|
|
19
|
+
fitPoints={[[USER_LOCATION.longitude, USER_LOCATION.latitude]]}
|
|
20
|
+
>
|
|
21
|
+
<Story />
|
|
22
|
+
</MapView>
|
|
23
|
+
</div>
|
|
26
24
|
),
|
|
25
|
+
withTooltip,
|
|
27
26
|
],
|
|
28
27
|
args: {
|
|
29
28
|
coordinates: USER_LOCATION,
|
package/src/map-view.json
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"$schema": "../../int-eslint-config/schemas/component.schema.json",
|
|
3
3
|
"component": "map-view",
|
|
4
4
|
"purpose": "Interactive map root that frames a set of points and shares controlled selection and hover state with the MapMarkers drawn inside it.",
|
|
5
|
+
"anatomy": ["import { MapView } from '@swisper.ai/web-map';", "", "<MapView />"],
|
|
5
6
|
"useWhen": [
|
|
6
7
|
"Showing a set of places (search results, venues, offices) as selectable pins on a map",
|
|
7
8
|
"A map is paired with a list or cards and selecting in one must highlight the other",
|
package/src/map-view.stories.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { withTooltip } from '@swisper.ai/ui';
|
|
5
5
|
|
|
6
6
|
import { PLACE_POINTS, PLACES, USER_LOCATION } from './__storybook__/fixtures';
|
|
7
7
|
import { DEFAULT_FIT_BOUNDS_PADDING, DEFAULT_MAP_STYLE_URL } from './constants';
|
|
@@ -47,12 +47,11 @@ const meta: Meta<typeof MapViewDemo> = {
|
|
|
47
47
|
tags: ['autodocs'],
|
|
48
48
|
decorators: [
|
|
49
49
|
(Story) => (
|
|
50
|
-
<
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
</div>
|
|
54
|
-
</TooltipProvider>
|
|
50
|
+
<div className="h-[600px] w-[800px]">
|
|
51
|
+
<Story />
|
|
52
|
+
</div>
|
|
55
53
|
),
|
|
54
|
+
withTooltip,
|
|
56
55
|
],
|
|
57
56
|
// `selectedId`, `hoveredId`, `onSelect` and `onHover` stay out of meta args: the demo owns them
|
|
58
57
|
// in state, and an arg would override it and break selecting a pin. Callbacks are logged through
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"$schema": "../../int-eslint-config/schemas/component.schema.json",
|
|
3
3
|
"component": "user-location-pin",
|
|
4
4
|
"purpose": "The marker for the user's own position: a blue dot with a white ring, with a tooltip and accessible name.",
|
|
5
|
+
"anatomy": ["import { UserLocationPin } from '@swisper.ai/web-map';", "", "<UserLocationPin />"],
|
|
5
6
|
"useWhen": [
|
|
6
7
|
"Rendering the default user-position marker, which web-map/map-user-location does for you",
|
|
7
8
|
"Showing the user-position dot outside a map, such as in a map legend"
|
|
File without changes
|