diff --git a/package.json b/package.json index b56a1a1..2a5bdfb 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,16 @@ { "name": "@sofarocean/mapbox-context", - "version": "2.1.0", + "version": "2.2.0", "description": "A React wrapper for Mapbox GL JS built for the era of React Context and Hooks", "main": "dist/index.js", "types": "dist/index.d.ts", "author": "Wayfinder Engineering ", "license": "MIT", "private": false, - "repository": "https://github.com/wavespotter/mapbox-context", + "repository": { + "type": "git", + "url": "git+https://github.com/wavespotter/mapbox-context.git" + }, "homepage": "https://github.com/wavespotter/mapbox-context", "files": [ "package.json", @@ -44,6 +47,7 @@ "typescript": "^5.9.2", "typescript-eslint": "^8.41.0", "vite": "^7.1.2", + "vite-plugin-css-injected-by-js": "^4.0.1", "vite-plugin-dts": "^4.5.4", "vitest": "^3.2.4" }, diff --git a/src/components/MapboxMap/index.tsx b/src/components/MapboxMap/index.tsx index bb6e857..761bb28 100644 --- a/src/components/MapboxMap/index.tsx +++ b/src/components/MapboxMap/index.tsx @@ -1,3 +1,4 @@ +import "./map.css"; import mapboxgl, { LngLatBoundsLike, LngLatLike, @@ -101,6 +102,7 @@ const MapboxMap = ({ transformRequest, accessToken: token, }); + newMap.addControl(new mapboxgl.AttributionControl(), "bottom-left"); newMap.on("load", () => { setMap(newMap); }); diff --git a/src/components/MapboxMap/map.css b/src/components/MapboxMap/map.css new file mode 100644 index 0000000..bf789d0 --- /dev/null +++ b/src/components/MapboxMap/map.css @@ -0,0 +1,4 @@ +.mapboxgl-ctrl-bottom-left { + display: flex; + flex-direction: column-reverse; +} \ No newline at end of file diff --git a/vite.config.js b/vite.config.js index 2689e98..f2f484b 100644 --- a/vite.config.js +++ b/vite.config.js @@ -3,10 +3,12 @@ import { dirname } from "node:path"; import { fileURLToPath, URL } from "node:url"; import { extname, relative, resolve } from "path"; import { defineConfig } from "vite"; +import cssInjectedByJs from "vite-plugin-css-injected-by-js"; import dts from "vite-plugin-dts"; export default defineConfig({ plugins: [ + cssInjectedByJs(), dts({ exclude: ["**/*.stories.tsx", "**/storybook-helpers/*"], }), diff --git a/yarn.lock b/yarn.lock index 7b5b3d6..c02951a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4010,11 +4010,6 @@ node-releases@^2.0.19: resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.19.tgz#9e445a52950951ec4d177d843af370b411caf314" integrity sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw== -object-assign@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== - open@^8.0.4: version "8.4.2" resolved "https://registry.yarnpkg.com/open/-/open-8.4.2.tgz#5b5ffe2a8f793dcd2aad73e550cb87b59cb084f9" @@ -4871,6 +4866,11 @@ vite-node@3.2.4: pathe "^2.0.3" vite "^5.0.0 || ^6.0.0 || ^7.0.0-0" +vite-plugin-css-injected-by-js@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/vite-plugin-css-injected-by-js/-/vite-plugin-css-injected-by-js-4.0.1.tgz#ed69dd8f04800f9e3c7a17c3a2e3819eede6092e" + integrity sha512-WfyRojojQyAO/KzWf+efcXpTPv6zJPXaRmr9EYq5a4v5I3PWCR7kR01hiri2lW6+rHm3a57kpwsf+iahIJi1Qw== + vite-plugin-dts@^4.5.4: version "4.5.4" resolved "https://registry.yarnpkg.com/vite-plugin-dts/-/vite-plugin-dts-4.5.4.tgz#51b60aaaa760d9cf5c2bb3676c69d81910d6b08c"