react-bing-map 1.0.0
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/README.md +24 -0
- package/lib/cjs/components/MapView/MapView.d.ts +2 -0
- package/lib/cjs/components/index.d.ts +1 -0
- package/lib/cjs/hooks/useBingMaps.d.ts +17 -0
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +60 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/stories/Button.d.ts +29 -0
- package/lib/cjs/stories/Button.stories.d.ts +8 -0
- package/lib/cjs/stories/Header.stories.d.ts +6 -0
- package/lib/cjs/stories/MapView.stories.d.ts +8 -0
- package/lib/esm/components/MapView/MapView.d.ts +2 -0
- package/lib/esm/components/index.d.ts +1 -0
- package/lib/esm/hooks/useBingMaps.d.ts +17 -0
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +58 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/stories/Button.d.ts +29 -0
- package/lib/esm/stories/Button.stories.d.ts +8 -0
- package/lib/esm/stories/Header.stories.d.ts +6 -0
- package/lib/esm/stories/MapView.stories.d.ts +8 -0
- package/package.json +57 -0
package/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
## React Rollup Boiler Plate
|
|
2
|
+
|
|
3
|
+
#### Install the dependencies
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
npm install --save-dev @rollup/plugin-commonjs @rollup/plugin-node-resolve @rollup/plugin-typescript @types/react @types/react-dom react react-dom rollup rollup-plugin-peer-deps-external typescript node-sass sass postcss rollup-plugin-postcss
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
#### Run Build
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
npm run build
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
#### Run Story Book
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
npm run storybook
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
#### Output:
|
|
23
|
+
|
|
24
|
+

|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MapView } from './MapView/MapView';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type TMapView = {
|
|
2
|
+
mapType?: string;
|
|
3
|
+
bingKey: string;
|
|
4
|
+
centerLocation?: [number, number];
|
|
5
|
+
initZoom?: number;
|
|
6
|
+
pushPins?: [];
|
|
7
|
+
pushPinIcon?: any;
|
|
8
|
+
};
|
|
9
|
+
declare const useBingMaps: ({ mapType, bingKey, centerLocation, initZoom, pushPins, pushPinIcon }: {
|
|
10
|
+
mapType?: string | undefined;
|
|
11
|
+
bingKey?: string | undefined;
|
|
12
|
+
centerLocation?: number[] | undefined;
|
|
13
|
+
initZoom?: number | undefined;
|
|
14
|
+
pushPins?: never[] | undefined;
|
|
15
|
+
pushPinIcon?: string | undefined;
|
|
16
|
+
}) => [any, any];
|
|
17
|
+
export default useBingMaps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
package/lib/cjs/index.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
|
|
5
|
+
var useBingMaps = function (_a) {
|
|
6
|
+
var _b = _a.mapType, mapType = _b === void 0 ? '' : _b, _c = _a.bingKey, bingKey = _c === void 0 ? '' : _c, _d = _a.centerLocation, centerLocation = _d === void 0 ? [0, 0] : _d, _e = _a.initZoom, initZoom = _e === void 0 ? 0 : _e, _f = _a.pushPins, pushPins = _f === void 0 ? [] : _f, _g = _a.pushPinIcon, pushPinIcon = _g === void 0 ? '' : _g;
|
|
7
|
+
var myWindow = window;
|
|
8
|
+
var initMap = React.useCallback(function () {
|
|
9
|
+
var Maps = myWindow.Microsoft.Maps;
|
|
10
|
+
var map = new Maps.Map('#bing-map', {
|
|
11
|
+
credentials: bingKey,
|
|
12
|
+
center: new Maps.Location(centerLocation[0], centerLocation[1]),
|
|
13
|
+
mapTypeId: Maps.MapTypeId[mapType],
|
|
14
|
+
showLogo: false,
|
|
15
|
+
zoom: initZoom
|
|
16
|
+
});
|
|
17
|
+
var infobox = new Maps.Infobox(map.getCenter(), {
|
|
18
|
+
visible: false
|
|
19
|
+
});
|
|
20
|
+
infobox.setMap(map);
|
|
21
|
+
addPushPins(map, infobox, Maps);
|
|
22
|
+
}, []);
|
|
23
|
+
var addPushPins = function (map, infobox, Maps) {
|
|
24
|
+
for (var ele in pushPins) {
|
|
25
|
+
new Maps.Pushpin(centerLocation, pushPinIcon);
|
|
26
|
+
// const data: ContentType = pushPins[ele]?.content
|
|
27
|
+
// handleOnInfobox(pin, infobox, data, Maps)
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
// myWindow.initMap = initMap;
|
|
31
|
+
return [myWindow, initMap];
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
var MapView = function () {
|
|
35
|
+
var mapView = {
|
|
36
|
+
mapType: '',
|
|
37
|
+
bingKey: '',
|
|
38
|
+
centerLocation: [0, 0],
|
|
39
|
+
initZoom: 0,
|
|
40
|
+
pushPins: [],
|
|
41
|
+
pushPinIcon: ''
|
|
42
|
+
};
|
|
43
|
+
var _a = useBingMaps(mapView), myWindow = _a[0], initMap = _a[1];
|
|
44
|
+
myWindow.initMap = initMap;
|
|
45
|
+
React.useEffect(function () {
|
|
46
|
+
if (!document.querySelector('[data-bing="true"]')) {
|
|
47
|
+
var scriptTag = document.createElement('script');
|
|
48
|
+
scriptTag.src =
|
|
49
|
+
'https://www.bing.com/api/maps/mapcontrol' + '?callback=initMap';
|
|
50
|
+
scriptTag.async = true;
|
|
51
|
+
scriptTag.dataset.bing = 'true';
|
|
52
|
+
document.body.appendChild(scriptTag);
|
|
53
|
+
}
|
|
54
|
+
}, []);
|
|
55
|
+
return (React.createElement("div", { className: 'map-view' },
|
|
56
|
+
React.createElement("div", { id: 'bing-map' })));
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
exports.MapView = MapView;
|
|
60
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/hooks/useBingMaps.ts","../../src/components/MapView/MapView.tsx"],"sourcesContent":[null,null],"names":["useCallback","useEffect"],"mappings":";;;;AAoBA,IAAM,WAAW,GAAG,UAAC,EAOpB,EAAA;AANC,IAAA,IAAA,EAAA,GAAA,EAAA,CAAA,OAAY,EAAZ,OAAO,GAAA,EAAA,KAAA,KAAA,CAAA,GAAG,EAAE,GAAA,EAAA,EACZ,eAAY,EAAZ,OAAO,mBAAG,EAAE,GAAA,EAAA,EACZ,EAAuB,GAAA,EAAA,CAAA,cAAA,EAAvB,cAAc,GAAG,EAAA,KAAA,KAAA,CAAA,GAAA,CAAC,CAAC,EAAE,CAAC,CAAC,GAAA,EAAA,EACvB,gBAAY,EAAZ,QAAQ,mBAAG,CAAC,GAAA,EAAA,EACZ,EAAa,GAAA,EAAA,CAAA,QAAA,EAAb,QAAQ,GAAG,EAAA,KAAA,KAAA,CAAA,GAAA,EAAE,KAAA,EACb,EAAA,GAAA,EAAA,CAAA,WAAgB,EAAhB,WAAW,GAAA,EAAA,KAAA,KAAA,CAAA,GAAG,EAAE,GAAA,EAAA,CAAA;IAEhB,IAAI,QAAQ,GAAG,MAAa,CAAC;IAC7B,IAAM,OAAO,GAAGA,iBAAW,CAAC,YAAA;AAC1B,QAAA,IAAI,IAAI,GAAG,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC;QACnC,IAAI,GAAG,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE;AAClC,YAAA,WAAW,EAAE,OAAO;AACpB,YAAA,MAAM,EAAE,IAAI,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;AAC/D,YAAA,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;AAClC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,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;AACnD,YAAA,SAAS,CAAC,GAAG;gBACX,0CAA0C,GAAG,mBAAmB,CAAC;AACnE,YAAA,SAAS,CAAC,KAAK,GAAG,IAAI,CAAC;AACvB,YAAA,SAAS,CAAC,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC;AAChC,YAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;AACtC,SAAA;KACF,EAAE,EAAE,CAAC,CAAC;AACP,IAAA,QACE,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,UAAU,EAAA;AACvB,QAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,EAAE,EAAC,UAAU,EAAO,CAAA,CACrB,EACN;AACJ;;;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './button.css';
|
|
3
|
+
interface ButtonProps {
|
|
4
|
+
/**
|
|
5
|
+
* Is this the principal call to action on the page?
|
|
6
|
+
*/
|
|
7
|
+
primary?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* What background color to use
|
|
10
|
+
*/
|
|
11
|
+
backgroundColor?: string;
|
|
12
|
+
/**
|
|
13
|
+
* How large should the button be?
|
|
14
|
+
*/
|
|
15
|
+
size?: 'small' | 'medium' | 'large';
|
|
16
|
+
/**
|
|
17
|
+
* Button contents
|
|
18
|
+
*/
|
|
19
|
+
label: string;
|
|
20
|
+
/**
|
|
21
|
+
* Optional click handler
|
|
22
|
+
*/
|
|
23
|
+
onClick?: () => void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Primary UI component for user interaction
|
|
27
|
+
*/
|
|
28
|
+
export declare const Button: ({ primary, size, backgroundColor, label, ...props }: ButtonProps) => React.JSX.Element;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
declare const meta: any;
|
|
3
|
+
export default meta;
|
|
4
|
+
type Story = StoryObj<typeof meta>;
|
|
5
|
+
export declare const Primary: Story;
|
|
6
|
+
export declare const Secondary: Story;
|
|
7
|
+
export declare const Large: Story;
|
|
8
|
+
export declare const Small: Story;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
declare const meta: any;
|
|
3
|
+
export default meta;
|
|
4
|
+
type Story = StoryObj<typeof meta>;
|
|
5
|
+
export declare const Primary: Story;
|
|
6
|
+
export declare const Secondary: Story;
|
|
7
|
+
export declare const Large: Story;
|
|
8
|
+
export declare const Small: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MapView } from './MapView/MapView';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type TMapView = {
|
|
2
|
+
mapType?: string;
|
|
3
|
+
bingKey: string;
|
|
4
|
+
centerLocation?: [number, number];
|
|
5
|
+
initZoom?: number;
|
|
6
|
+
pushPins?: [];
|
|
7
|
+
pushPinIcon?: any;
|
|
8
|
+
};
|
|
9
|
+
declare const useBingMaps: ({ mapType, bingKey, centerLocation, initZoom, pushPins, pushPinIcon }: {
|
|
10
|
+
mapType?: string | undefined;
|
|
11
|
+
bingKey?: string | undefined;
|
|
12
|
+
centerLocation?: number[] | undefined;
|
|
13
|
+
initZoom?: number | undefined;
|
|
14
|
+
pushPins?: never[] | undefined;
|
|
15
|
+
pushPinIcon?: string | undefined;
|
|
16
|
+
}) => [any, any];
|
|
17
|
+
export default useBingMaps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
package/lib/esm/index.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React, { useCallback, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
var useBingMaps = function (_a) {
|
|
4
|
+
var _b = _a.mapType, mapType = _b === void 0 ? '' : _b, _c = _a.bingKey, bingKey = _c === void 0 ? '' : _c, _d = _a.centerLocation, centerLocation = _d === void 0 ? [0, 0] : _d, _e = _a.initZoom, initZoom = _e === void 0 ? 0 : _e, _f = _a.pushPins, pushPins = _f === void 0 ? [] : _f, _g = _a.pushPinIcon, pushPinIcon = _g === void 0 ? '' : _g;
|
|
5
|
+
var myWindow = window;
|
|
6
|
+
var initMap = useCallback(function () {
|
|
7
|
+
var Maps = myWindow.Microsoft.Maps;
|
|
8
|
+
var map = new Maps.Map('#bing-map', {
|
|
9
|
+
credentials: bingKey,
|
|
10
|
+
center: new Maps.Location(centerLocation[0], centerLocation[1]),
|
|
11
|
+
mapTypeId: Maps.MapTypeId[mapType],
|
|
12
|
+
showLogo: false,
|
|
13
|
+
zoom: initZoom
|
|
14
|
+
});
|
|
15
|
+
var infobox = new Maps.Infobox(map.getCenter(), {
|
|
16
|
+
visible: false
|
|
17
|
+
});
|
|
18
|
+
infobox.setMap(map);
|
|
19
|
+
addPushPins(map, infobox, Maps);
|
|
20
|
+
}, []);
|
|
21
|
+
var addPushPins = function (map, infobox, Maps) {
|
|
22
|
+
for (var ele in pushPins) {
|
|
23
|
+
new Maps.Pushpin(centerLocation, pushPinIcon);
|
|
24
|
+
// const data: ContentType = pushPins[ele]?.content
|
|
25
|
+
// handleOnInfobox(pin, infobox, data, Maps)
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
// myWindow.initMap = initMap;
|
|
29
|
+
return [myWindow, initMap];
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
var MapView = function () {
|
|
33
|
+
var mapView = {
|
|
34
|
+
mapType: '',
|
|
35
|
+
bingKey: '',
|
|
36
|
+
centerLocation: [0, 0],
|
|
37
|
+
initZoom: 0,
|
|
38
|
+
pushPins: [],
|
|
39
|
+
pushPinIcon: ''
|
|
40
|
+
};
|
|
41
|
+
var _a = useBingMaps(mapView), myWindow = _a[0], initMap = _a[1];
|
|
42
|
+
myWindow.initMap = initMap;
|
|
43
|
+
useEffect(function () {
|
|
44
|
+
if (!document.querySelector('[data-bing="true"]')) {
|
|
45
|
+
var scriptTag = document.createElement('script');
|
|
46
|
+
scriptTag.src =
|
|
47
|
+
'https://www.bing.com/api/maps/mapcontrol' + '?callback=initMap';
|
|
48
|
+
scriptTag.async = true;
|
|
49
|
+
scriptTag.dataset.bing = 'true';
|
|
50
|
+
document.body.appendChild(scriptTag);
|
|
51
|
+
}
|
|
52
|
+
}, []);
|
|
53
|
+
return (React.createElement("div", { className: 'map-view' },
|
|
54
|
+
React.createElement("div", { id: 'bing-map' })));
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export { MapView };
|
|
58
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/hooks/useBingMaps.ts","../../src/components/MapView/MapView.tsx"],"sourcesContent":[null,null],"names":[],"mappings":";;AAoBA,IAAM,WAAW,GAAG,UAAC,EAOpB,EAAA;AANC,IAAA,IAAA,EAAA,GAAA,EAAA,CAAA,OAAY,EAAZ,OAAO,GAAA,EAAA,KAAA,KAAA,CAAA,GAAG,EAAE,GAAA,EAAA,EACZ,eAAY,EAAZ,OAAO,mBAAG,EAAE,GAAA,EAAA,EACZ,EAAuB,GAAA,EAAA,CAAA,cAAA,EAAvB,cAAc,GAAG,EAAA,KAAA,KAAA,CAAA,GAAA,CAAC,CAAC,EAAE,CAAC,CAAC,GAAA,EAAA,EACvB,gBAAY,EAAZ,QAAQ,mBAAG,CAAC,GAAA,EAAA,EACZ,EAAa,GAAA,EAAA,CAAA,QAAA,EAAb,QAAQ,GAAG,EAAA,KAAA,KAAA,CAAA,GAAA,EAAE,KAAA,EACb,EAAA,GAAA,EAAA,CAAA,WAAgB,EAAhB,WAAW,GAAA,EAAA,KAAA,KAAA,CAAA,GAAG,EAAE,GAAA,EAAA,CAAA;IAEhB,IAAI,QAAQ,GAAG,MAAa,CAAC;IAC7B,IAAM,OAAO,GAAG,WAAW,CAAC,YAAA;AAC1B,QAAA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WAAW,EAAE,EAAE;KAChB,CAAC;IACI,IAAA,EAAA,GAAsB,WAAW,CAAC,OAAO,CAAC,EAAzC,QAAQ,GAAA,EAAA,CAAA,CAAA,CAAA,EAAE,OAAO,GAAA,EAAA,CAAA,CAAA,CAAwB,CAAC;AAEjD,IAAA,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC;AAE3B,IAAA,SAAS,CAAC,YAAA;AACR,QAAA,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,oBAAoB,CAAC,EAAE;YACjD,IAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;AACnD,YAAA,SAAS,CAAC,GAAG;gBACX,0CAA0C,GAAG,mBAAmB,CAAC;AACnE,YAAA,SAAS,CAAC,KAAK,GAAG,IAAI,CAAC;AACvB,YAAA,SAAS,CAAC,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC;AAChC,YAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;AACtC,SAAA;KACF,EAAE,EAAE,CAAC,CAAC;AACP,IAAA,QACE,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,UAAU,EAAA;AACvB,QAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,EAAE,EAAC,UAAU,EAAO,CAAA,CACrB,EACN;AACJ;;;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './button.css';
|
|
3
|
+
interface ButtonProps {
|
|
4
|
+
/**
|
|
5
|
+
* Is this the principal call to action on the page?
|
|
6
|
+
*/
|
|
7
|
+
primary?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* What background color to use
|
|
10
|
+
*/
|
|
11
|
+
backgroundColor?: string;
|
|
12
|
+
/**
|
|
13
|
+
* How large should the button be?
|
|
14
|
+
*/
|
|
15
|
+
size?: 'small' | 'medium' | 'large';
|
|
16
|
+
/**
|
|
17
|
+
* Button contents
|
|
18
|
+
*/
|
|
19
|
+
label: string;
|
|
20
|
+
/**
|
|
21
|
+
* Optional click handler
|
|
22
|
+
*/
|
|
23
|
+
onClick?: () => void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Primary UI component for user interaction
|
|
27
|
+
*/
|
|
28
|
+
export declare const Button: ({ primary, size, backgroundColor, label, ...props }: ButtonProps) => React.JSX.Element;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
declare const meta: any;
|
|
3
|
+
export default meta;
|
|
4
|
+
type Story = StoryObj<typeof meta>;
|
|
5
|
+
export declare const Primary: Story;
|
|
6
|
+
export declare const Secondary: Story;
|
|
7
|
+
export declare const Large: Story;
|
|
8
|
+
export declare const Small: Story;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
declare const meta: any;
|
|
3
|
+
export default meta;
|
|
4
|
+
type Story = StoryObj<typeof meta>;
|
|
5
|
+
export declare const Primary: Story;
|
|
6
|
+
export declare const Secondary: Story;
|
|
7
|
+
export declare const Large: Story;
|
|
8
|
+
export declare const Small: Story;
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-bing-map",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"author": "Mohanraj Kandasamy",
|
|
5
|
+
"license": "ISC",
|
|
6
|
+
"description": "",
|
|
7
|
+
"main": "./lib/cjs/index.js",
|
|
8
|
+
"module": "./lib/esm/index.js",
|
|
9
|
+
"types": "./lib/esm/index.d.ts",
|
|
10
|
+
"type": "module",
|
|
11
|
+
"files": [
|
|
12
|
+
"/lib"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "rollup -c",
|
|
16
|
+
"build:watch": "rollup -c --watch",
|
|
17
|
+
"storybook": "storybook dev -p 6006",
|
|
18
|
+
"build-storybook": "storybook build"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@rollup/plugin-commonjs": "^25.0.2",
|
|
22
|
+
"@rollup/plugin-node-resolve": "^15.1.0",
|
|
23
|
+
"@rollup/plugin-typescript": "^11.1.2",
|
|
24
|
+
"@storybook/addon-essentials": "^7.2.0",
|
|
25
|
+
"@storybook/addon-interactions": "^7.2.0",
|
|
26
|
+
"@storybook/addon-links": "^7.2.0",
|
|
27
|
+
"@storybook/addon-onboarding": "^1.0.8",
|
|
28
|
+
"@storybook/blocks": "^7.2.0",
|
|
29
|
+
"@storybook/react": "^7.2.0",
|
|
30
|
+
"@storybook/react-vite": "^7.2.0",
|
|
31
|
+
"@storybook/testing-library": "^0.2.0",
|
|
32
|
+
"@types/react": "^18.2.15",
|
|
33
|
+
"@types/react-dom": "^18.2.7",
|
|
34
|
+
"node-sass": "^9.0.0",
|
|
35
|
+
"postcss": "^8.4.26",
|
|
36
|
+
"react": "^18.2.0",
|
|
37
|
+
"react-dom": "^18.2.0",
|
|
38
|
+
"rollup": "^3.26.2",
|
|
39
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
40
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
41
|
+
"sass": "^1.63.6",
|
|
42
|
+
"storybook": "^7.2.0",
|
|
43
|
+
"tslib": "^2.6.0",
|
|
44
|
+
"typescript": "^5.1.6"
|
|
45
|
+
},
|
|
46
|
+
"keywords": [
|
|
47
|
+
"react-template",
|
|
48
|
+
"react-library",
|
|
49
|
+
"typescript",
|
|
50
|
+
"react",
|
|
51
|
+
"template"
|
|
52
|
+
],
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"react": "^16 || ^17 || ^18",
|
|
55
|
+
"react-dom": "^16 || ^17 || ^18"
|
|
56
|
+
}
|
|
57
|
+
}
|