@deck.gl/widgets 9.2.11 → 9.3.0-alpha.2
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/compass-widget.js +5 -5
- package/dist/compass-widget.js.map +1 -1
- package/dist/context-menu-widget.d.ts +27 -20
- package/dist/context-menu-widget.d.ts.map +1 -1
- package/dist/context-menu-widget.js +45 -48
- package/dist/context-menu-widget.js.map +1 -1
- package/dist/dist.dev.js +3114 -869
- package/dist/fullscreen-widget.js +1 -1
- package/dist/fullscreen-widget.js.map +1 -1
- package/dist/geocoder-widget.d.ts +2 -4
- package/dist/geocoder-widget.d.ts.map +1 -1
- package/dist/geocoder-widget.js +16 -20
- package/dist/geocoder-widget.js.map +1 -1
- package/dist/gimbal-widget.d.ts +0 -3
- package/dist/gimbal-widget.d.ts.map +1 -1
- package/dist/gimbal-widget.js +4 -22
- package/dist/gimbal-widget.js.map +1 -1
- package/dist/icon-widget.d.ts +28 -0
- package/dist/icon-widget.d.ts.map +1 -0
- package/dist/icon-widget.js +35 -0
- package/dist/icon-widget.js.map +1 -0
- package/dist/index.cjs +1271 -561
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +16 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -10
- package/dist/index.js.map +1 -1
- package/dist/info-widget.d.ts +39 -17
- package/dist/info-widget.d.ts.map +1 -1
- package/dist/info-widget.js +46 -130
- package/dist/info-widget.js.map +1 -1
- package/dist/lib/components/dropdown-menu.d.ts +12 -5
- package/dist/lib/components/dropdown-menu.d.ts.map +1 -1
- package/dist/lib/components/dropdown-menu.js +20 -11
- package/dist/lib/components/dropdown-menu.js.map +1 -1
- package/dist/lib/components/icon-button.d.ts +3 -0
- package/dist/lib/components/icon-button.d.ts.map +1 -1
- package/dist/lib/components/icon-button.js +10 -2
- package/dist/lib/components/icon-button.js.map +1 -1
- package/dist/lib/components/popover.d.ts +30 -0
- package/dist/lib/components/popover.d.ts.map +1 -0
- package/dist/lib/components/popover.js +93 -0
- package/dist/lib/components/popover.js.map +1 -0
- package/dist/lib/components/range-input.d.ts +26 -0
- package/dist/lib/components/range-input.d.ts.map +1 -0
- package/dist/lib/components/range-input.js +261 -0
- package/dist/lib/components/range-input.js.map +1 -0
- package/dist/lib/components/user-content.d.ts +8 -0
- package/dist/lib/components/user-content.d.ts.map +1 -0
- package/dist/lib/components/user-content.js +15 -0
- package/dist/lib/components/user-content.js.map +1 -0
- package/dist/lib/data-url.d.ts +5 -0
- package/dist/lib/data-url.d.ts.map +1 -0
- package/dist/lib/data-url.js +7 -0
- package/dist/lib/data-url.js.map +1 -0
- package/dist/popup-widget.d.ts +64 -0
- package/dist/popup-widget.d.ts.map +1 -0
- package/dist/popup-widget.js +76 -0
- package/dist/popup-widget.js.map +1 -0
- package/dist/reset-view-widget.d.ts +1 -1
- package/dist/reset-view-widget.d.ts.map +1 -1
- package/dist/reset-view-widget.js +12 -11
- package/dist/reset-view-widget.js.map +1 -1
- package/dist/scrollbar-widget.d.ts +68 -0
- package/dist/scrollbar-widget.d.ts.map +1 -0
- package/dist/scrollbar-widget.js +181 -0
- package/dist/scrollbar-widget.js.map +1 -0
- package/dist/selector-widget.d.ts +44 -0
- package/dist/selector-widget.d.ts.map +1 -0
- package/dist/selector-widget.js +64 -0
- package/dist/selector-widget.js.map +1 -0
- package/dist/splitter-widget.d.ts +52 -11
- package/dist/splitter-widget.d.ts.map +1 -1
- package/dist/splitter-widget.js +177 -76
- package/dist/splitter-widget.js.map +1 -1
- package/dist/stats-widget.d.ts +6 -1
- package/dist/stats-widget.d.ts.map +1 -1
- package/dist/stats-widget.js +39 -10
- package/dist/stats-widget.js.map +1 -1
- package/dist/stylesheet.css +291 -39
- package/dist/theme-widget.d.ts.map +1 -1
- package/dist/theme-widget.js +7 -5
- package/dist/theme-widget.js.map +1 -1
- package/dist/themes.d.ts +30 -0
- package/dist/themes.d.ts.map +1 -1
- package/dist/themes.js +28 -4
- package/dist/themes.js.map +1 -1
- package/dist/timeline-widget.d.ts +25 -6
- package/dist/timeline-widget.d.ts.map +1 -1
- package/dist/timeline-widget.js +51 -18
- package/dist/timeline-widget.js.map +1 -1
- package/dist/toggle-widget.d.ts +38 -0
- package/dist/toggle-widget.d.ts.map +1 -0
- package/dist/toggle-widget.js +47 -0
- package/dist/toggle-widget.js.map +1 -0
- package/dist/zoom-widget.d.ts +2 -8
- package/dist/zoom-widget.d.ts.map +1 -1
- package/dist/zoom-widget.js +23 -18
- package/dist/zoom-widget.js.map +1 -1
- package/dist.min.js +2 -2
- package/package.json +4 -3
- package/src/compass-widget.tsx +5 -5
- package/src/context-menu-widget.tsx +88 -78
- package/src/fullscreen-widget.tsx +1 -1
- package/src/geocoder-widget.tsx +17 -24
- package/src/gimbal-widget.tsx +4 -26
- package/src/icon-widget.tsx +69 -0
- package/src/index.ts +22 -15
- package/src/info-widget.tsx +100 -157
- package/src/lib/components/dropdown-menu.tsx +58 -29
- package/src/lib/components/icon-button.tsx +15 -3
- package/src/lib/components/popover.tsx +167 -0
- package/src/lib/components/range-input.tsx +432 -0
- package/src/lib/components/user-content.tsx +30 -0
- package/src/lib/data-url.ts +5 -0
- package/src/popup-widget.tsx +170 -0
- package/src/reset-view-widget.tsx +12 -11
- package/src/scrollbar-widget.tsx +288 -0
- package/src/selector-widget.tsx +111 -0
- package/src/splitter-widget.tsx +281 -96
- package/src/stats-widget.tsx +59 -12
- package/src/stylesheet.css +291 -39
- package/src/theme-widget.tsx +7 -5
- package/src/themes.ts +35 -4
- package/src/timeline-widget.tsx +103 -33
- package/src/toggle-widget.tsx +101 -0
- package/src/zoom-widget.tsx +25 -21
- package/dist/fps-widget.d.ts +0 -28
- package/dist/fps-widget.d.ts.map +0 -1
- package/dist/fps-widget.js +0 -51
- package/dist/fps-widget.js.map +0 -1
- package/dist/lib/components/grouped-icon-button.d.ts +0 -10
- package/dist/lib/components/grouped-icon-button.d.ts.map +0 -1
- package/dist/lib/components/grouped-icon-button.js +0 -7
- package/dist/lib/components/grouped-icon-button.js.map +0 -1
- package/dist/lib/components/icon-menu.d.ts +0 -16
- package/dist/lib/components/icon-menu.d.ts.map +0 -1
- package/dist/lib/components/icon-menu.js +0 -34
- package/dist/lib/components/icon-menu.js.map +0 -1
- package/dist/lib/components/simple-menu.d.ts +0 -16
- package/dist/lib/components/simple-menu.d.ts.map +0 -1
- package/dist/lib/components/simple-menu.js +0 -30
- package/dist/lib/components/simple-menu.js.map +0 -1
- package/dist/view-selector-widget.d.ts +0 -35
- package/dist/view-selector-widget.d.ts.map +0 -1
- package/dist/view-selector-widget.js +0 -63
- package/dist/view-selector-widget.js.map +0 -1
- package/src/fps-widget.tsx +0 -77
- package/src/lib/components/grouped-icon-button.tsx +0 -27
- package/src/lib/components/icon-menu.tsx +0 -71
- package/src/lib/components/simple-menu.tsx +0 -52
- package/src/view-selector-widget.tsx +0 -151
package/dist/index.d.ts
CHANGED
|
@@ -6,14 +6,17 @@ export { ScaleWidget as _ScaleWidget } from "./scale-widget.js";
|
|
|
6
6
|
export { GeocoderWidget as _GeocoderWidget } from "./geocoder-widget.js";
|
|
7
7
|
export { FullscreenWidget } from "./fullscreen-widget.js";
|
|
8
8
|
export { SplitterWidget as _SplitterWidget } from "./splitter-widget.js";
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export { ContextMenuWidget
|
|
9
|
+
export { InfoWidget } from "./info-widget.js";
|
|
10
|
+
export { PopupWidget } from "./popup-widget.js";
|
|
11
|
+
export { ContextMenuWidget } from "./context-menu-widget.js";
|
|
12
|
+
export { ScrollbarWidget } from "./scrollbar-widget.js";
|
|
13
|
+
export { IconWidget } from "./icon-widget.js";
|
|
14
|
+
export { ToggleWidget } from "./toggle-widget.js";
|
|
15
|
+
export { SelectorWidget } from "./selector-widget.js";
|
|
12
16
|
export { TimelineWidget as _TimelineWidget } from "./timeline-widget.js";
|
|
13
17
|
export { ScreenshotWidget } from "./screenshot-widget.js";
|
|
14
|
-
export { ThemeWidget
|
|
15
|
-
export { LoadingWidget
|
|
16
|
-
export { FpsWidget as _FpsWidget } from "./fps-widget.js";
|
|
18
|
+
export { ThemeWidget } from "./theme-widget.js";
|
|
19
|
+
export { LoadingWidget } from "./loading-widget.js";
|
|
17
20
|
export { StatsWidget as _StatsWidget } from "./stats-widget.js";
|
|
18
21
|
export type { FullscreenWidgetProps } from "./fullscreen-widget.js";
|
|
19
22
|
export type { CompassWidgetProps } from "./compass-widget.js";
|
|
@@ -22,24 +25,25 @@ export type { ScreenshotWidgetProps } from "./screenshot-widget.js";
|
|
|
22
25
|
export type { ResetViewWidgetProps } from "./reset-view-widget.js";
|
|
23
26
|
export type { GeocoderWidgetProps } from "./geocoder-widget.js";
|
|
24
27
|
export type { LoadingWidgetProps } from "./loading-widget.js";
|
|
25
|
-
export type {
|
|
28
|
+
export type { IconWidgetProps } from "./icon-widget.js";
|
|
29
|
+
export type { ToggleWidgetProps } from "./toggle-widget.js";
|
|
26
30
|
export type { ScaleWidgetProps } from "./scale-widget.js";
|
|
27
31
|
export type { ThemeWidgetProps } from "./theme-widget.js";
|
|
28
32
|
export type { InfoWidgetProps } from "./info-widget.js";
|
|
33
|
+
export type { PopupWidgetProps } from "./popup-widget.js";
|
|
29
34
|
export type { StatsWidgetProps } from "./stats-widget.js";
|
|
30
35
|
export type { ContextMenuWidgetProps } from "./context-menu-widget.js";
|
|
31
36
|
export type { SplitterWidgetProps } from "./splitter-widget.js";
|
|
32
37
|
export type { TimelineWidgetProps } from "./timeline-widget.js";
|
|
33
|
-
export type {
|
|
38
|
+
export type { SelectorWidgetProps } from "./selector-widget.js";
|
|
34
39
|
export type { GimbalWidgetProps } from "./gimbal-widget.js";
|
|
40
|
+
export type { ContentBounds, ScrollbarWidgetProps, ScrollbarDecoration } from "./scrollbar-widget.js";
|
|
35
41
|
export { LightTheme, DarkTheme, LightGlassTheme, DarkGlassTheme } from "./themes.js";
|
|
36
42
|
export type { DeckWidgetTheme } from "./themes.js";
|
|
37
43
|
export { ButtonGroup as _ButtonGroup, type ButtonGroupProps } from "./lib/components/button-group.js";
|
|
38
44
|
export { IconButton as _IconButton, type IconButtonProps } from "./lib/components/icon-button.js";
|
|
39
|
-
export {
|
|
40
|
-
export {
|
|
41
|
-
export { SimpleMenu as _SimpleMenu, type SimpleMenuProps } from "./lib/components/simple-menu.js";
|
|
42
|
-
export { IconMenu as _IconMenu, type IconMenuProps } from "./lib/components/icon-menu.js";
|
|
45
|
+
export { DropdownMenu as _DropdownMenu, type DropdownMenuProps, SimpleMenu as _SimpleMenu, type SimpleMenuProps } from "./lib/components/dropdown-menu.js";
|
|
46
|
+
export { RangeInput as _RangeInput, type RangeInputProps, type RangeInputDecoration } from "./lib/components/range-input.js";
|
|
43
47
|
export { type Geocoder } from "./lib/geocode/geocoder.js";
|
|
44
48
|
export { GoogleGeocoder as _GoogleGeocoder, MapboxGeocoder as _MapboxGeocoder, OpenCageGeocoder as _OpenCageGeocoder, CoordinatesGeocoder as _CoordinatesGeocoder, CurrentLocationGeocoder as _CurrentLocationGeocoder } from "./lib/geocode/geocoders.js";
|
|
45
49
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,UAAU,EAAC,yBAAsB;AACzC,OAAO,EAAC,eAAe,EAAC,+BAA4B;AACpD,OAAO,EAAC,YAAY,EAAC,2BAAwB;AAG7C,OAAO,EAAC,aAAa,EAAC,4BAAyB;AAC/C,OAAO,EAAC,WAAW,IAAI,YAAY,EAAC,0BAAuB;AAC3D,OAAO,EAAC,cAAc,IAAI,eAAe,EAAC,6BAA0B;AAGpE,OAAO,EAAC,gBAAgB,EAAC,+BAA4B;AACrD,OAAO,EAAC,cAAc,IAAI,eAAe,EAAC,6BAA0B;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],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|
|
|
12
12
|
// View widgets
|
|
13
13
|
export { FullscreenWidget } from "./fullscreen-widget.js";
|
|
14
14
|
export { SplitterWidget as _SplitterWidget } from "./splitter-widget.js";
|
|
15
|
-
export { ViewSelectorWidget as _ViewSelectorWidget } from "./view-selector-widget.js";
|
|
16
15
|
// Information widgets
|
|
17
|
-
export { InfoWidget
|
|
18
|
-
export {
|
|
16
|
+
export { InfoWidget } from "./info-widget.js";
|
|
17
|
+
export { PopupWidget } from "./popup-widget.js";
|
|
18
|
+
export { ContextMenuWidget } from "./context-menu-widget.js";
|
|
19
|
+
export { ScrollbarWidget } from "./scrollbar-widget.js";
|
|
19
20
|
// Control widgets
|
|
21
|
+
export { IconWidget } from "./icon-widget.js";
|
|
22
|
+
export { ToggleWidget } from "./toggle-widget.js";
|
|
23
|
+
export { SelectorWidget } from "./selector-widget.js";
|
|
20
24
|
export { TimelineWidget as _TimelineWidget } from "./timeline-widget.js";
|
|
21
25
|
// Utility widgets
|
|
22
26
|
export { ScreenshotWidget } from "./screenshot-widget.js";
|
|
23
|
-
export { ThemeWidget
|
|
24
|
-
export { LoadingWidget
|
|
25
|
-
export { FpsWidget as _FpsWidget } from "./fps-widget.js";
|
|
27
|
+
export { ThemeWidget } from "./theme-widget.js";
|
|
28
|
+
export { LoadingWidget } from "./loading-widget.js";
|
|
26
29
|
export { StatsWidget as _StatsWidget } from "./stats-widget.js";
|
|
27
30
|
export { LightTheme, DarkTheme, LightGlassTheme, DarkGlassTheme } from "./themes.js";
|
|
28
31
|
// Experimental preact components
|
|
29
32
|
export { ButtonGroup as _ButtonGroup } from "./lib/components/button-group.js";
|
|
30
33
|
export { IconButton as _IconButton } from "./lib/components/icon-button.js";
|
|
31
|
-
export {
|
|
32
|
-
export {
|
|
33
|
-
export { SimpleMenu as _SimpleMenu } from "./lib/components/simple-menu.js";
|
|
34
|
-
export { IconMenu as _IconMenu } from "./lib/components/icon-menu.js";
|
|
34
|
+
export { DropdownMenu as _DropdownMenu, SimpleMenu as _SimpleMenu } from "./lib/components/dropdown-menu.js";
|
|
35
|
+
export { RangeInput as _RangeInput } from "./lib/components/range-input.js";
|
|
35
36
|
export { GoogleGeocoder as _GoogleGeocoder, MapboxGeocoder as _MapboxGeocoder, OpenCageGeocoder as _OpenCageGeocoder, CoordinatesGeocoder as _CoordinatesGeocoder, CurrentLocationGeocoder as _CurrentLocationGeocoder } from "./lib/geocode/geocoders.js";
|
|
36
37
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,qBAAqB;AACrB,OAAO,EAAC,UAAU,EAAC,yBAAsB;AACzC,OAAO,EAAC,eAAe,EAAC,+BAA4B;AACpD,OAAO,EAAC,YAAY,EAAC,2BAAwB;AAE7C,qBAAqB;AACrB,OAAO,EAAC,aAAa,EAAC,4BAAyB;AAC/C,OAAO,EAAC,WAAW,IAAI,YAAY,EAAC,0BAAuB;AAC3D,OAAO,EAAC,cAAc,IAAI,eAAe,EAAC,6BAA0B;AAEpE,eAAe;AACf,OAAO,EAAC,gBAAgB,EAAC,+BAA4B;AACrD,OAAO,EAAC,cAAc,IAAI,eAAe,EAAC,6BAA0B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,qBAAqB;AACrB,OAAO,EAAC,UAAU,EAAC,yBAAsB;AACzC,OAAO,EAAC,eAAe,EAAC,+BAA4B;AACpD,OAAO,EAAC,YAAY,EAAC,2BAAwB;AAE7C,qBAAqB;AACrB,OAAO,EAAC,aAAa,EAAC,4BAAyB;AAC/C,OAAO,EAAC,WAAW,IAAI,YAAY,EAAC,0BAAuB;AAC3D,OAAO,EAAC,cAAc,IAAI,eAAe,EAAC,6BAA0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
import type { Deck, PickingInfo, Viewport, WidgetProps } from '@deck.gl/core';
|
|
3
|
+
import { type PopoverProps } from "./lib/components/popover.js";
|
|
4
|
+
export type TooltipContent = {
|
|
5
|
+
/** Anchor of the popup in world coordinates, e.g. [longitude, latitude].
|
|
6
|
+
* If not supplied, default to the mouse position where the popup was triggered.
|
|
7
|
+
*/
|
|
8
|
+
position?: number[];
|
|
9
|
+
/** Text content to display in the popup */
|
|
10
|
+
text?: string;
|
|
11
|
+
/** HTML content to display in the popup. If supplied, `text` is ignored. */
|
|
12
|
+
html?: string;
|
|
13
|
+
/** HTML element to attach inside the popup. */
|
|
14
|
+
element?: HTMLElement | null;
|
|
15
|
+
/** Custom class name to add to the popup */
|
|
16
|
+
className?: string;
|
|
17
|
+
/** CSS style overrides of the popup */
|
|
18
|
+
style?: Partial<CSSStyleDeclaration>;
|
|
19
|
+
};
|
|
3
20
|
export type InfoWidgetProps = WidgetProps & {
|
|
4
21
|
/** View to attach to and interact with. Required when using multiple views */
|
|
5
22
|
viewId?: string | null;
|
|
6
23
|
/** Determines the interaction mode of the widget */
|
|
7
|
-
mode: 'click' | 'hover'
|
|
24
|
+
mode: 'click' | 'hover';
|
|
8
25
|
/** Function to generate the popup contents from the selected element */
|
|
9
|
-
getTooltip?: (info: PickingInfo, widget: InfoWidget) =>
|
|
10
|
-
/** Position
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
|
|
26
|
+
getTooltip?: (info: PickingInfo, widget: InfoWidget) => TooltipContent | string | null | undefined;
|
|
27
|
+
/** Position popup relative to the anchor.
|
|
28
|
+
* @default 'right'
|
|
29
|
+
*/
|
|
30
|
+
placement?: PopoverProps['placement'];
|
|
31
|
+
/** Pixel offset
|
|
32
|
+
* @default 10
|
|
33
|
+
*/
|
|
34
|
+
offset?: PopoverProps['offset'];
|
|
35
|
+
/**
|
|
36
|
+
* Show an arrow pointing at the anchor. Optionally accepts a pixel size.
|
|
37
|
+
* @default 10
|
|
38
|
+
*/
|
|
39
|
+
arrow?: PopoverProps['arrow'];
|
|
20
40
|
};
|
|
21
41
|
export declare class InfoWidget extends Widget<InfoWidgetProps> {
|
|
22
42
|
static defaultProps: Required<InfoWidgetProps>;
|
|
23
43
|
className: string;
|
|
24
44
|
placement: "fill";
|
|
25
45
|
viewport?: Viewport;
|
|
46
|
+
tooltip: Required<TooltipContent> | null;
|
|
26
47
|
constructor(props: InfoWidgetProps);
|
|
27
48
|
setProps(props: Partial<InfoWidgetProps>): void;
|
|
28
|
-
|
|
29
|
-
onViewportChange(viewport: any): void;
|
|
30
|
-
onHover(info: PickingInfo): void;
|
|
31
|
-
onClick(info: PickingInfo): boolean;
|
|
32
|
-
onAdd({ deck, viewId }: {
|
|
49
|
+
onAdd({ deck }: {
|
|
33
50
|
deck: Deck<any>;
|
|
34
51
|
viewId: string | null;
|
|
35
52
|
}): void;
|
|
53
|
+
onRemove(): void;
|
|
54
|
+
onViewportChange(viewport: any): void;
|
|
55
|
+
onHover(info: PickingInfo): void;
|
|
56
|
+
onClick(info: PickingInfo): void;
|
|
57
|
+
protected _getTooltip(info: PickingInfo): Required<TooltipContent> | null;
|
|
36
58
|
onRenderHTML(rootElement: HTMLElement): void;
|
|
37
59
|
}
|
|
38
60
|
//# sourceMappingURL=info-widget.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"info-widget.d.ts","sourceRoot":"","sources":["../src/info-widget.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AACrC,OAAO,KAAK,EAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"info-widget.d.ts","sourceRoot":"","sources":["../src/info-widget.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAC,MAAM,EAAC,MAAM,eAAe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Q,CAAC;IACpB,OAAO,EAAE,QAAQ,CAAC,cAAc,CAAC,GAAG,IAAI,CAAQ;gBAEpC,KAAK,EAAE,eAAe;IAKlC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,eAAe,CAAC;IAKxC,KAAK,CAAC,EAAC,IAAI,EAAC,EAAE;QAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;KAAC;IAItD,QAAQ;IAOR,gBAAgB,CAAC,QAAQ,KAAA;IAKzB,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IAMhC,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IAMhC,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,QAAQ,CAAC,cAAc,CAAC,GAAG,IAAI;IAsBzE,YAAY,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;CAkC7C"}
|
package/dist/info-widget.js
CHANGED
|
@@ -1,175 +1,91 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "preact/jsx-runtime";
|
|
2
2
|
// deck.gl
|
|
3
3
|
// SPDX-License-Identifier: MIT
|
|
4
4
|
// Copyright (c) vis.gl contributors
|
|
5
5
|
import { Widget } from '@deck.gl/core';
|
|
6
6
|
import { render } from 'preact';
|
|
7
|
+
import { Popover } from "./lib/components/popover.js";
|
|
8
|
+
import { UserContent } from "./lib/components/user-content.js";
|
|
7
9
|
export class InfoWidget extends Widget {
|
|
8
10
|
constructor(props) {
|
|
9
11
|
super(props);
|
|
10
12
|
this.className = 'deck-widget-info';
|
|
11
13
|
this.placement = 'fill';
|
|
14
|
+
this.tooltip = null;
|
|
12
15
|
this.setProps(this.props);
|
|
13
16
|
}
|
|
14
17
|
setProps(props) {
|
|
15
18
|
this.viewId = props.viewId ?? this.viewId;
|
|
16
19
|
super.setProps(props);
|
|
17
20
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
onAdd({ deck }) {
|
|
22
|
+
this.deck = deck;
|
|
23
|
+
}
|
|
24
|
+
onRemove() {
|
|
25
|
+
// Invoke clean up of preact hooks
|
|
26
|
+
if (this.rootElement) {
|
|
27
|
+
render(null, this.rootElement);
|
|
28
|
+
}
|
|
23
29
|
}
|
|
24
30
|
onViewportChange(viewport) {
|
|
25
31
|
this.viewport = viewport;
|
|
26
32
|
this.updateHTML();
|
|
27
33
|
}
|
|
28
34
|
onHover(info) {
|
|
29
|
-
if (this.props.mode === 'hover'
|
|
30
|
-
|
|
31
|
-
// hover tooltips should show over static and click infos
|
|
32
|
-
this.setProps({
|
|
33
|
-
visible: tooltip !== null,
|
|
34
|
-
...tooltip,
|
|
35
|
-
style: { zIndex: '1', ...tooltip?.style }
|
|
36
|
-
});
|
|
35
|
+
if (this.props.mode === 'hover') {
|
|
36
|
+
this.tooltip = this._getTooltip(info);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
onClick(info) {
|
|
40
|
-
if (this.props.mode === 'click'
|
|
41
|
-
|
|
42
|
-
this.setProps({
|
|
43
|
-
visible: tooltip !== null,
|
|
44
|
-
...tooltip
|
|
45
|
-
});
|
|
46
|
-
return tooltip !== null;
|
|
40
|
+
if (this.props.mode === 'click') {
|
|
41
|
+
this.tooltip = this._getTooltip(info);
|
|
47
42
|
}
|
|
48
|
-
// Original behavior
|
|
49
|
-
return this.props.onClick?.(this, info) || false;
|
|
50
43
|
}
|
|
51
|
-
|
|
52
|
-
this.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
44
|
+
_getTooltip(info) {
|
|
45
|
+
if (!this.props.getTooltip)
|
|
46
|
+
return null;
|
|
47
|
+
const content = this.props.getTooltip(info, this) ?? null;
|
|
48
|
+
if (content === null)
|
|
49
|
+
return null;
|
|
50
|
+
const normalizedTooltip = typeof content === 'string' ? { text: content } : content;
|
|
51
|
+
const position = normalizedTooltip.position || info.coordinate;
|
|
52
|
+
if (!position)
|
|
53
|
+
return null;
|
|
54
|
+
return {
|
|
55
|
+
position,
|
|
56
|
+
text: '',
|
|
57
|
+
html: '',
|
|
58
|
+
element: null,
|
|
59
|
+
className: '',
|
|
60
|
+
style: {},
|
|
61
|
+
...normalizedTooltip
|
|
62
|
+
};
|
|
59
63
|
}
|
|
60
64
|
onRenderHTML(rootElement) {
|
|
61
|
-
if (!this.viewport) {
|
|
65
|
+
if (!this.viewport || this.tooltip === null) {
|
|
66
|
+
render(null, rootElement);
|
|
62
67
|
return;
|
|
63
68
|
}
|
|
64
|
-
const
|
|
69
|
+
const style = {
|
|
70
|
+
...this.props.style,
|
|
71
|
+
...this.tooltip.style
|
|
72
|
+
};
|
|
65
73
|
// Project the clicked geographic coordinate to canvas (x, y)
|
|
66
|
-
const [x, y] = this.viewport.project(
|
|
67
|
-
const minOffset = this.props.minOffset || 0;
|
|
68
|
-
const gap = 10; // gap between clicked point and popup box
|
|
69
|
-
const arrowHeight = 8; // height of the triangle arrow
|
|
70
|
-
const arrowWidth = 16; // full width of the arrow
|
|
71
|
-
// Decide vertical orientation.
|
|
72
|
-
// If the clicked point is in the bottom half, place the popup above the point.
|
|
73
|
-
const isAbove = y > this.viewport.height / 2;
|
|
74
|
-
const background = (this.props.style && this.props.style.background) || 'rgba(255,255,255,0.9)';
|
|
74
|
+
const [x, y] = this.viewport.project(this.tooltip.position);
|
|
75
75
|
// Render the popup container with a content box and a placeholder for the arrow.
|
|
76
76
|
// The container is positioned absolutely (initially at 0,0) and will be repositioned after measuring.
|
|
77
|
-
const ui =
|
|
78
|
-
background,
|
|
79
|
-
padding: '10px',
|
|
80
|
-
position: 'relative',
|
|
81
|
-
// Include any additional styles
|
|
82
|
-
...this.props.style
|
|
83
|
-
}, children: this.props.text }), _jsx("div", { className: "popup-arrow", style: { position: 'absolute', width: '0px', height: '0px' } })] })) : null;
|
|
77
|
+
const ui = (_jsx(Popover, { x: x, y: y, placement: this.props.placement, arrow: this.props.arrow, arrowColor: "var(--menu-background, #fff)", offset: this.props.offset, children: _jsx(UserContent, { className: `deck-widget-popup-content ${this.tooltip.className} ${this.props.className}`, style: style, html: this.tooltip.html, text: this.tooltip.text, element: this.tooltip.element }) }));
|
|
84
78
|
render(ui, rootElement);
|
|
85
|
-
// After rendering, measure the content and adjust positioning so that:
|
|
86
|
-
// - The popup (with its arrow) does not cover the clicked point.
|
|
87
|
-
// - The arrow's tip points to the clicked point.
|
|
88
|
-
// - The popup remains within the canvas bounds, with minOffset.
|
|
89
|
-
// eslint-disable-next-line max-statements, complexity
|
|
90
|
-
requestAnimationFrame(() => {
|
|
91
|
-
if (!this.props.visible || !rootElement.firstChild || !this.viewport)
|
|
92
|
-
return;
|
|
93
|
-
const container = rootElement.firstChild;
|
|
94
|
-
const contentEl = container.querySelector('.popup-content');
|
|
95
|
-
const arrowEl = container.querySelector('.popup-arrow');
|
|
96
|
-
if (!contentEl || !arrowEl)
|
|
97
|
-
return;
|
|
98
|
-
const contentRect = contentEl.getBoundingClientRect();
|
|
99
|
-
const popupWidth = contentRect.width;
|
|
100
|
-
const popupHeight = contentRect.height;
|
|
101
|
-
// Compute ideal horizontal position: center the popup on the clicked x
|
|
102
|
-
let computedLeft = x - popupWidth / 2;
|
|
103
|
-
// Compute vertical position based on orientation:
|
|
104
|
-
// If the popup is above, position its bottom edge (minus arrow & gap) at the clicked y.
|
|
105
|
-
// Otherwise, position its top edge (plus arrow & gap) at the clicked y.
|
|
106
|
-
let computedTop;
|
|
107
|
-
if (isAbove) {
|
|
108
|
-
computedTop = y - gap - arrowHeight - popupHeight;
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
computedTop = y + gap + arrowHeight;
|
|
112
|
-
}
|
|
113
|
-
// Ensure the popup (content) stays within horizontal bounds of the canvas
|
|
114
|
-
if (computedLeft < minOffset) {
|
|
115
|
-
computedLeft = minOffset;
|
|
116
|
-
}
|
|
117
|
-
if (computedLeft + popupWidth > this.viewport.width - minOffset) {
|
|
118
|
-
computedLeft = this.viewport.width - minOffset - popupWidth;
|
|
119
|
-
}
|
|
120
|
-
// Ensure the vertical position (including the arrow) stays within canvas bounds.
|
|
121
|
-
if (isAbove) {
|
|
122
|
-
if (computedTop < minOffset) {
|
|
123
|
-
computedTop = minOffset;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
else if (computedTop + popupHeight + arrowHeight > this.viewport.height - minOffset) {
|
|
127
|
-
computedTop = this.viewport.height - minOffset - popupHeight - arrowHeight;
|
|
128
|
-
}
|
|
129
|
-
// Update container position (remove any transform and set left/top explicitly)
|
|
130
|
-
container.style.left = `${computedLeft}px`;
|
|
131
|
-
container.style.top = `${computedTop}px`;
|
|
132
|
-
container.style.transform = '';
|
|
133
|
-
// Compute arrow's horizontal offset relative to the container.
|
|
134
|
-
// We want the arrow's tip to align with the clicked point.
|
|
135
|
-
let arrowLeft = x - computedLeft - arrowWidth / 2;
|
|
136
|
-
// Optionally constrain arrowLeft so it stays within the popup's width.
|
|
137
|
-
arrowLeft = Math.max(arrowLeft, 0);
|
|
138
|
-
arrowLeft = Math.min(arrowLeft, popupWidth - arrowWidth);
|
|
139
|
-
// Update arrow element's style based on orientation.
|
|
140
|
-
if (isAbove) {
|
|
141
|
-
// Popup is above the clicked point so arrow appears at the bottom of the popup.
|
|
142
|
-
arrowEl.style.left = `${arrowLeft}px`;
|
|
143
|
-
arrowEl.style.bottom = `-${arrowHeight}px`;
|
|
144
|
-
arrowEl.style.top = '';
|
|
145
|
-
arrowEl.style.borderLeft = `${arrowWidth / 2}px solid transparent`;
|
|
146
|
-
arrowEl.style.borderRight = `${arrowWidth / 2}px solid transparent`;
|
|
147
|
-
arrowEl.style.borderTop = `${arrowHeight}px solid ${background}`;
|
|
148
|
-
arrowEl.style.borderBottom = '';
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
// Popup is below the clicked point so arrow appears at the top.
|
|
152
|
-
arrowEl.style.left = `${arrowLeft}px`;
|
|
153
|
-
arrowEl.style.top = `-${arrowHeight}px`;
|
|
154
|
-
arrowEl.style.bottom = '';
|
|
155
|
-
arrowEl.style.borderLeft = `${arrowWidth / 2}px solid transparent`;
|
|
156
|
-
arrowEl.style.borderRight = `${arrowWidth / 2}px solid transparent`;
|
|
157
|
-
arrowEl.style.borderBottom = `${arrowHeight}px solid ${background}`;
|
|
158
|
-
arrowEl.style.borderTop = '';
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
79
|
}
|
|
162
80
|
}
|
|
163
81
|
InfoWidget.defaultProps = {
|
|
164
82
|
...Widget.defaultProps,
|
|
165
83
|
id: 'info',
|
|
166
|
-
position: [0, 0],
|
|
167
|
-
text: '',
|
|
168
|
-
visible: false,
|
|
169
|
-
minOffset: 0,
|
|
170
84
|
viewId: null,
|
|
171
85
|
mode: 'hover',
|
|
172
86
|
getTooltip: undefined,
|
|
173
|
-
|
|
87
|
+
placement: 'right',
|
|
88
|
+
offset: 10,
|
|
89
|
+
arrow: 10
|
|
174
90
|
};
|
|
175
91
|
//# sourceMappingURL=info-widget.js.map
|
package/dist/info-widget.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"info-widget.js","sourceRoot":"","sources":["../src/info-widget.tsx"],"names":[],"mappings":";AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAErC,OAAO,EAAC,MAAM,EAAM,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"info-widget.js","sourceRoot":"","sources":["../src/info-widget.tsx"],"names":[],"mappings":";AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAErC,OAAO,EAAC,MAAM,EAAM,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAC,OAAO,EAAoB,oCAAiC;AAC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ACJ,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAC/B,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,UAAU,EAAC,8BAA8B,EACzC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,YAEzB,KAAC,WAAW,IACV,SAAS,EAAE,6BAA6B,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,EACxF,KAAK,EAAE,KAA0B,EACjC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,EACvB,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,EACvB,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,GAC7B,GACM,CACX,CAAC;QACF,MAAM,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;IAC1B,CAAC;;AA7GM,uBAAY,GAA8B;IAC/C,GAAG,MAAM,CAAC,YAAY;IACtB,EAAE,EAAE,MAAM;IACV,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,SAAU;IACtB,SAAS,EAAE,OAAO;IAClB,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,EAAE;CACV,AATkB,CASjB"}
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
import { type JSX } from 'preact';
|
|
1
|
+
import { type JSX, type ComponentChild } from 'preact';
|
|
2
2
|
export type MenuItem = string | {
|
|
3
|
+
value?: string;
|
|
3
4
|
label: string;
|
|
4
|
-
value: string;
|
|
5
5
|
icon?: string;
|
|
6
|
+
onSelect?: () => void;
|
|
6
7
|
};
|
|
7
8
|
export type DropdownMenuProps = {
|
|
8
9
|
menuItems: MenuItem[];
|
|
9
|
-
onSelect
|
|
10
|
-
style?:
|
|
10
|
+
onSelect?: (value: string) => void;
|
|
11
|
+
style?: Partial<CSSStyleDeclaration>;
|
|
11
12
|
};
|
|
12
|
-
export declare const DropdownMenu: (props: DropdownMenuProps) => JSX.Element
|
|
13
|
+
export declare const DropdownMenu: (props: DropdownMenuProps) => JSX.Element;
|
|
14
|
+
export type SimpleMenuProps = DropdownMenuProps & {
|
|
15
|
+
trigger?: ComponentChild;
|
|
16
|
+
isOpen: boolean;
|
|
17
|
+
onClose: () => void;
|
|
18
|
+
};
|
|
19
|
+
export declare const SimpleMenu: (props: SimpleMenuProps) => JSX.Element | null;
|
|
13
20
|
//# sourceMappingURL=dropdown-menu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu.d.ts","sourceRoot":"","sources":["../../../src/lib/components/dropdown-menu.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAC,KAAK,GAAG,EAAC,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"dropdown-menu.d.ts","sourceRoot":"","sources":["../../../src/lib/components/dropdown-menu.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAC,KAAK,GAAG,EAAE,KAAK,cAAc,EAAC,MAAM,QAAQ,CAAC;AAIrD,MAAM,MAAM,QAAQ,GAChB,MAAM,GACN;IACE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,CAAC;AAEN,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,KAAK,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACtC,CAAC;AAcF,eAAO,MAAM,YAAY,UAAW,iBAAiB,gBAgBpD,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,iBAAiB,GAAG;IAChD,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,UAAU,UAAW,eAAe,uBAuDhD,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
2
|
import { useState, useRef, useEffect } from 'preact/hooks';
|
|
3
|
+
import { getCSSMask } from "../data-url.js";
|
|
3
4
|
function getMenuItemValue(item) {
|
|
4
5
|
return typeof item === 'string' ? item : item.value;
|
|
5
6
|
}
|
|
@@ -11,30 +12,38 @@ function getMenuItemIcon(item) {
|
|
|
11
12
|
}
|
|
12
13
|
export const DropdownMenu = (props) => {
|
|
13
14
|
const [isOpen, setIsOpen] = useState(false);
|
|
15
|
+
return (_jsx(SimpleMenu, { ...props, style: { ...props.style, position: 'absolute' }, isOpen: isOpen, onClose: () => setIsOpen(false), trigger: _jsx("button", { className: "deck-widget-dropdown-button", onClick: () => setIsOpen(!isOpen), children: _jsx("span", { className: `deck-widget-dropdown-icon ${isOpen ? 'open' : ''}` }) }) }));
|
|
16
|
+
};
|
|
17
|
+
export const SimpleMenu = (props) => {
|
|
14
18
|
const dropdownRef = useRef(null);
|
|
15
|
-
const toggleDropdown = () => setIsOpen(!isOpen);
|
|
16
|
-
const handleClickOutside = (event) => {
|
|
17
|
-
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
18
|
-
setIsOpen(false);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
19
|
useEffect(() => {
|
|
20
|
+
const handleClickOutside = (event) => {
|
|
21
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
22
|
+
props.onClose();
|
|
23
|
+
}
|
|
24
|
+
};
|
|
22
25
|
document.addEventListener('mousedown', handleClickOutside);
|
|
23
26
|
return () => {
|
|
24
27
|
document.removeEventListener('mousedown', handleClickOutside);
|
|
25
28
|
};
|
|
26
29
|
}, []);
|
|
27
|
-
const handleSelect = (item) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
const handleSelect = (value, item) => {
|
|
31
|
+
if (value) {
|
|
32
|
+
if (typeof item === 'object') {
|
|
33
|
+
item.onSelect?.();
|
|
34
|
+
}
|
|
35
|
+
props.onSelect?.(value);
|
|
36
|
+
props.onClose();
|
|
37
|
+
}
|
|
30
38
|
};
|
|
31
39
|
// Don't render anything if there are no menu items
|
|
32
40
|
if (props.menuItems.length === 0) {
|
|
33
41
|
return null;
|
|
34
42
|
}
|
|
35
|
-
return (_jsxs("div", { className: "deck-widget-dropdown-container", ref: dropdownRef,
|
|
43
|
+
return (_jsxs("div", { className: "deck-widget-dropdown-container", ref: dropdownRef, children: [props.trigger, props.isOpen && (_jsx("ul", { className: "deck-widget-dropdown-menu", style: props.style, children: props.menuItems.map((item, i) => {
|
|
44
|
+
const value = getMenuItemValue(item);
|
|
36
45
|
const icon = getMenuItemIcon(item);
|
|
37
|
-
return (_jsxs("li", { className:
|
|
46
|
+
return (_jsxs("li", { className: `deck-widget-dropdown-item ${value ? '' : 'disabled'}`, onClick: () => handleSelect(value, item), children: [icon && (_jsx("span", { className: "deck-widget-dropdown-item-icon", style: getCSSMask(icon) })), getMenuItemLabel(item)] }, i));
|
|
38
47
|
}) }))] }));
|
|
39
48
|
};
|
|
40
49
|
//# sourceMappingURL=dropdown-menu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu.js","sourceRoot":"","sources":["../../../src/lib/components/dropdown-menu.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"dropdown-menu.js","sourceRoot":"","sources":["../../../src/lib/components/dropdown-menu.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AACzD,OAAO,EAAC,UAAU,EAAC,uBAAoB;AAiBvC,SAAS,gBAAgB,CAAC,IAAc;IACt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AAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,EAAE,EAEjE,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,aAEvC,IAAI,IAAI,CACP,eAAM,SAAS,EAAC,gCAAgC,EAAC,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,GAAI,CAC7E,EACA,gBAAgB,CAAC,IAAI,CAAC,KANlB,CAAC,CAOH,CACN,CAAC;gBACJ,CAAC,CAAC,GACC,CACN,IACG,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { ComponentChildren, JSX } from 'preact';
|
|
2
2
|
export type IconButtonProps = {
|
|
3
3
|
className?: string;
|
|
4
|
+
icon?: string;
|
|
4
5
|
label?: string;
|
|
6
|
+
color?: string;
|
|
7
|
+
style?: JSX.CSSProperties;
|
|
5
8
|
onClick?: JSX.MouseEventHandler<HTMLButtonElement>;
|
|
6
9
|
children?: ComponentChildren;
|
|
7
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon-button.d.ts","sourceRoot":"","sources":["../../../src/lib/components/icon-button.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,iBAAiB,EAAE,GAAG,EAAC,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"icon-button.d.ts","sourceRoot":"","sources":["../../../src/lib/components/icon-button.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,iBAAiB,EAAE,GAAG,EAAC,MAAM,QAAQ,CAAC;AAInD,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,GAAG,CAAC,aAAa,CAAC;IAC1B,OAAO,CAAC,EAAE,GAAG,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACnD,QAAQ,CAAC,EAAE,iBAAiB,CAAC;CAC9B,CAAC;AAEF,iDAAiD;AACjD,eAAO,MAAM,UAAU,UAAW,eAAe,gBAqBhD,CAAC"}
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx } from "preact/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'preact/hooks';
|
|
3
|
+
import { getCSSMask } from "../data-url.js";
|
|
2
4
|
/** Renders a button component with widget CSS */
|
|
3
5
|
export const IconButton = (props) => {
|
|
4
|
-
const { className = '', label, onClick, children } = props;
|
|
5
|
-
|
|
6
|
+
const { className = '', style, color, icon, label, onClick, children } = props;
|
|
7
|
+
const iconStyle = useMemo(() => {
|
|
8
|
+
const css = getCSSMask(icon);
|
|
9
|
+
if (!color)
|
|
10
|
+
return css;
|
|
11
|
+
return { ...css, backgroundColor: color };
|
|
12
|
+
}, [color, icon]);
|
|
13
|
+
return (_jsx("div", { className: "deck-widget-button", style: style, children: _jsx("button", { className: `deck-widget-icon-button ${className}`, type: "button", onClick: onClick, title: label, children: children ? children : _jsx("div", { className: "deck-widget-icon", style: iconStyle }) }) }));
|
|
6
14
|
};
|
|
7
15
|
//# sourceMappingURL=icon-button.js.map
|