@trackunit/react-map 0.1.55 → 0.1.56
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/index.cjs.js +12 -1
- package/index.esm.js +13 -3
- package/package.json +1 -1
- package/src/index.d.ts +1 -0
- package/src/panel/PanelIconButton.d.ts +16 -0
package/index.cjs.js
CHANGED
|
@@ -697,6 +697,16 @@ const SHAPE_STYLE_DEFAULTS = {
|
|
|
697
697
|
},
|
|
698
698
|
};
|
|
699
699
|
|
|
700
|
+
const PANEL_ICON_BUTTON_CLASS_NAME = tailwindMerge.twMerge("inline-flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-md border-0 bg-transparent p-1.5 text-neutral-600", "hover:bg-black/5 hover:text-neutral-700", "active:bg-black/10 active:text-neutral-800", "focus-visible:bg-black/10 focus-visible:text-neutral-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1", "disabled:cursor-not-allowed disabled:bg-transparent disabled:text-neutral-400");
|
|
701
|
+
/**
|
|
702
|
+
* Lightweight ghost icon button for map panel chrome. Skips `IconButton`'s
|
|
703
|
+
* Tooltip/Button stack so icon glyphs paint on the same frame as panel content.
|
|
704
|
+
*
|
|
705
|
+
* Consumers should pass decorative icons with `ariaHidden` and rely on
|
|
706
|
+
* `aria-label` (and the native `title` tooltip) for accessible naming.
|
|
707
|
+
*/
|
|
708
|
+
const PanelIconButton = ({ "aria-label": ariaLabel, children, disabled = false, onClick, "data-testid": dataTestId, }) => (jsxRuntime.jsx("button", { "aria-label": ariaLabel, className: PANEL_ICON_BUTTON_CLASS_NAME, "data-testid": dataTestId, disabled: disabled, onClick: onClick, title: ariaLabel, type: "button", children: children }));
|
|
709
|
+
|
|
700
710
|
/**
|
|
701
711
|
* CSS `max-height` of the Panel shell — `min(320px, 40vh)`.
|
|
702
712
|
*
|
|
@@ -967,7 +977,7 @@ const Panel = ({ anchor, placement = DEFAULT_PLACEMENT$1, onDismiss, closeLabel
|
|
|
967
977
|
// "open" — fade in via opacity transition
|
|
968
978
|
// "closing" — fade out before unmount
|
|
969
979
|
const panelState = isClosing ? "closing" : isCommitted ? "open" : "";
|
|
970
|
-
return (jsxRuntime.jsxs("div", { className: PANEL_SHELL_CLASS_NAME, "data-panel": panelState, ref: mergedShellRef, style: floatingStyles, ...getFloatingProps(), "aria-label": ariaLabel, children: [jsxRuntime.jsx("div", { className: PANEL_CHROME_CLASS_NAME, style: { maxHeight: `min(${PANEL_MAX_HEIGHT_PX}px, ${PANEL_MAX_HEIGHT_VH}vh)` }, children: jsxRuntime.jsx("div", { className: scrollSlotClassName, "data-testid": "panel-scroll-slot", ref: scrollRef, children: children }) }), onClickDismiss !== undefined ? (jsxRuntime.jsx("div", { className: "absolute right-0 top-0 z-10 -translate-y-1/2 translate-x-1/2 rounded-2xl border border-neutral-300 bg-white shadow-sm", children: jsxRuntime.jsx(
|
|
980
|
+
return (jsxRuntime.jsxs("div", { className: PANEL_SHELL_CLASS_NAME, "data-panel": panelState, ref: mergedShellRef, style: floatingStyles, ...getFloatingProps(), "aria-label": ariaLabel, children: [jsxRuntime.jsx("div", { className: PANEL_CHROME_CLASS_NAME, style: { maxHeight: `min(${PANEL_MAX_HEIGHT_PX}px, ${PANEL_MAX_HEIGHT_VH}vh)` }, children: jsxRuntime.jsx("div", { className: scrollSlotClassName, "data-testid": "panel-scroll-slot", ref: scrollRef, children: children }) }), onClickDismiss !== undefined ? (jsxRuntime.jsx("div", { className: "absolute right-0 top-0 z-10 -translate-y-1/2 translate-x-1/2 rounded-2xl border border-neutral-300 bg-white shadow-sm", children: jsxRuntime.jsx(PanelIconButton, { "aria-label": closeLabel, "data-testid": "panel-close-button", onClick: onClickDismiss, children: jsxRuntime.jsx(reactComponents.Icon, { ariaHidden: true, className: "text-neutral-700", name: "XMark", size: "small" }) }) })) : null] }));
|
|
971
981
|
};
|
|
972
982
|
Panel.displayName = "Panel";
|
|
973
983
|
|
|
@@ -11897,6 +11907,7 @@ exports.MARKER_TUNING = MARKER_TUNING;
|
|
|
11897
11907
|
exports.MapLoadingState = MapLoadingState;
|
|
11898
11908
|
exports.MapMarker = MapMarker;
|
|
11899
11909
|
exports.MapMarkerIcon = MapMarkerIcon;
|
|
11910
|
+
exports.PanelIconButton = PanelIconButton;
|
|
11900
11911
|
exports.ShapeAnnotationLabel = ShapeAnnotationLabel;
|
|
11901
11912
|
exports.buildExpandedIds = buildExpandedIds;
|
|
11902
11913
|
exports.cvaMapMarker = cvaMapMarker;
|
package/index.esm.js
CHANGED
|
@@ -4,7 +4,7 @@ import { INITIAL_CAMERA_STATE, INITIAL_MAP_STATUS, KEYBOARD_PAN_AMOUNT, KEYBOARD
|
|
|
4
4
|
export { ANCHOR_SELECTOR, DEFAULT_MAP_APPEARANCE, HIT_SURFACE_SELECTOR, INITIAL_CAMERA_STATE, INITIAL_INTERACTION_STATE, INITIAL_MAP_STATE, INITIAL_MAP_STATUS, computeMarkerDomPortalZIndex, defineAdapter, geometryTypeToShapeType, mapAppearanceSchema, mapThemeSchema, mapTypeSchema } from '@trackunit/react-map-adapter-shared';
|
|
5
5
|
import { useSyncExternalStore, useMemo, useState, useRef, useCallback, useLayoutEffect, useEffect, useReducer, createContext, useContext, memo, Suspense, useId, Fragment as Fragment$1, forwardRef } from 'react';
|
|
6
6
|
import { cvaMerge } from '@trackunit/css-class-variance-utilities';
|
|
7
|
-
import { useMergeRefs,
|
|
7
|
+
import { useMergeRefs, Icon, Spinner, Text, useMeasure, useContainerBreakpoints, useDebounce, useWatch, useKeyboardShortcut, Tooltip, IconButton, ToggleGroup as ToggleGroup$1, useIsFullscreen, Popover, PopoverTrigger, PopoverContent, MoreMenu, useHover as useHover$1, cvaInteractableItem, useLocalStorageReducer } from '@trackunit/react-components';
|
|
8
8
|
import { twMerge } from 'tailwind-merge';
|
|
9
9
|
import { useFloating, autoUpdate, offset, flip, useHover, safePolygon, useInteractions, shift, hide, useDismiss, useRole } from '@floating-ui/react';
|
|
10
10
|
import { createPortal } from 'react-dom';
|
|
@@ -696,6 +696,16 @@ const SHAPE_STYLE_DEFAULTS = {
|
|
|
696
696
|
},
|
|
697
697
|
};
|
|
698
698
|
|
|
699
|
+
const PANEL_ICON_BUTTON_CLASS_NAME = twMerge("inline-flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-md border-0 bg-transparent p-1.5 text-neutral-600", "hover:bg-black/5 hover:text-neutral-700", "active:bg-black/10 active:text-neutral-800", "focus-visible:bg-black/10 focus-visible:text-neutral-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1", "disabled:cursor-not-allowed disabled:bg-transparent disabled:text-neutral-400");
|
|
700
|
+
/**
|
|
701
|
+
* Lightweight ghost icon button for map panel chrome. Skips `IconButton`'s
|
|
702
|
+
* Tooltip/Button stack so icon glyphs paint on the same frame as panel content.
|
|
703
|
+
*
|
|
704
|
+
* Consumers should pass decorative icons with `ariaHidden` and rely on
|
|
705
|
+
* `aria-label` (and the native `title` tooltip) for accessible naming.
|
|
706
|
+
*/
|
|
707
|
+
const PanelIconButton = ({ "aria-label": ariaLabel, children, disabled = false, onClick, "data-testid": dataTestId, }) => (jsx("button", { "aria-label": ariaLabel, className: PANEL_ICON_BUTTON_CLASS_NAME, "data-testid": dataTestId, disabled: disabled, onClick: onClick, title: ariaLabel, type: "button", children: children }));
|
|
708
|
+
|
|
699
709
|
/**
|
|
700
710
|
* CSS `max-height` of the Panel shell — `min(320px, 40vh)`.
|
|
701
711
|
*
|
|
@@ -966,7 +976,7 @@ const Panel = ({ anchor, placement = DEFAULT_PLACEMENT$1, onDismiss, closeLabel
|
|
|
966
976
|
// "open" — fade in via opacity transition
|
|
967
977
|
// "closing" — fade out before unmount
|
|
968
978
|
const panelState = isClosing ? "closing" : isCommitted ? "open" : "";
|
|
969
|
-
return (jsxs("div", { className: PANEL_SHELL_CLASS_NAME, "data-panel": panelState, ref: mergedShellRef, style: floatingStyles, ...getFloatingProps(), "aria-label": ariaLabel, children: [jsx("div", { className: PANEL_CHROME_CLASS_NAME, style: { maxHeight: `min(${PANEL_MAX_HEIGHT_PX}px, ${PANEL_MAX_HEIGHT_VH}vh)` }, children: jsx("div", { className: scrollSlotClassName, "data-testid": "panel-scroll-slot", ref: scrollRef, children: children }) }), onClickDismiss !== undefined ? (jsx("div", { className: "absolute right-0 top-0 z-10 -translate-y-1/2 translate-x-1/2 rounded-2xl border border-neutral-300 bg-white shadow-sm", children: jsx(
|
|
979
|
+
return (jsxs("div", { className: PANEL_SHELL_CLASS_NAME, "data-panel": panelState, ref: mergedShellRef, style: floatingStyles, ...getFloatingProps(), "aria-label": ariaLabel, children: [jsx("div", { className: PANEL_CHROME_CLASS_NAME, style: { maxHeight: `min(${PANEL_MAX_HEIGHT_PX}px, ${PANEL_MAX_HEIGHT_VH}vh)` }, children: jsx("div", { className: scrollSlotClassName, "data-testid": "panel-scroll-slot", ref: scrollRef, children: children }) }), onClickDismiss !== undefined ? (jsx("div", { className: "absolute right-0 top-0 z-10 -translate-y-1/2 translate-x-1/2 rounded-2xl border border-neutral-300 bg-white shadow-sm", children: jsx(PanelIconButton, { "aria-label": closeLabel, "data-testid": "panel-close-button", onClick: onClickDismiss, children: jsx(Icon, { ariaHidden: true, className: "text-neutral-700", name: "XMark", size: "small" }) }) })) : null] }));
|
|
970
980
|
};
|
|
971
981
|
Panel.displayName = "Panel";
|
|
972
982
|
|
|
@@ -11829,4 +11839,4 @@ const mockMapApi = (overrides) => {
|
|
|
11829
11839
|
*/
|
|
11830
11840
|
setupLibraryTranslations();
|
|
11831
11841
|
|
|
11832
|
-
export { ClusterMarker, ClusterStick, Controls, DEFAULT_MARKER_SIZE_BREAKPOINTS, DefaultControls, Layers, MARKER_DARK_PILL, MARKER_DISC_BORDER_WIDTH_PX, MARKER_LIGHT_PILL, MARKER_PILL_CONTENT_LAYOUT_SIZE, MARKER_SIZE_MAP, MARKER_TUNING, MapLoadingState, MapMarker, MapMarkerIcon, ShapeAnnotationLabel, buildExpandedIds, cvaMapMarker, cvaMarkerIndicator, mockMapApi, useAdaptiveMarkerHelpers, useAutoPanResolver, useCameraIdle, useCameraState, useClusterCountFormat, useControlStack, useControls, useDefaultControls, useDirectionIndicator, useEntitiesNearCursor, useExpandedIds, useFitFeatureBounds, useFitToContent, useImageOverlay, useLayers, useMap, useMapAnnotation, useMapAnnotations, useMapAppearanceControls, useMapKeyboardNavigation, useMarkerColors, useMarkerStateResolvers, useMarkers, usePanel, usePanelPreload, usePreviewMap, useRoute, useShapeLabelHelpers, useShapes, useViewportContext };
|
|
11842
|
+
export { ClusterMarker, ClusterStick, Controls, DEFAULT_MARKER_SIZE_BREAKPOINTS, DefaultControls, Layers, MARKER_DARK_PILL, MARKER_DISC_BORDER_WIDTH_PX, MARKER_LIGHT_PILL, MARKER_PILL_CONTENT_LAYOUT_SIZE, MARKER_SIZE_MAP, MARKER_TUNING, MapLoadingState, MapMarker, MapMarkerIcon, PanelIconButton, ShapeAnnotationLabel, buildExpandedIds, cvaMapMarker, cvaMarkerIndicator, mockMapApi, useAdaptiveMarkerHelpers, useAutoPanResolver, useCameraIdle, useCameraState, useClusterCountFormat, useControlStack, useControls, useDefaultControls, useDirectionIndicator, useEntitiesNearCursor, useExpandedIds, useFitFeatureBounds, useFitToContent, useImageOverlay, useLayers, useMap, useMapAnnotation, useMapAnnotations, useMapAppearanceControls, useMapKeyboardNavigation, useMarkerColors, useMarkerStateResolvers, useMarkers, usePanel, usePanelPreload, usePreviewMap, useRoute, useShapeLabelHelpers, useShapes, useViewportContext };
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export { cvaMapMarker, cvaMarkerIndicator } from "./markers/shared/mapMarkerVari
|
|
|
39
39
|
export { MARKER_DARK_PILL, MARKER_LIGHT_PILL } from "./markers/shared/markerColors";
|
|
40
40
|
export type { MarkerColorConfig, MarkerColorCssVars, ResolvedMarkerColors } from "./markers/shared/markerColors";
|
|
41
41
|
export { useEntitiesNearCursor, type EntityNearCursor, type UseEntitiesNearCursorOptions, } from "./cursor/useEntitiesNearCursor";
|
|
42
|
+
export { PanelIconButton, type PanelIconButtonProps } from "./panel/PanelIconButton";
|
|
42
43
|
export { type HoverPanelPreloadInitiator, type PanelPreloadInitiator, type PanelPreloadInitiatorType, type ProximityPanelPreloadInitiator, } from "./panel/preload/preloadInitiators";
|
|
43
44
|
export { usePanelPreload, type UsePanelPreloadOptions } from "./panel/preload/usePanelPreload";
|
|
44
45
|
export { type PanelStore } from "./panel/store/panels";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type MouseEventHandler, type ReactElement, type ReactNode } from "react";
|
|
2
|
+
export type PanelIconButtonProps = Readonly<{
|
|
3
|
+
"aria-label": string;
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
onClick: MouseEventHandler<HTMLButtonElement>;
|
|
7
|
+
"data-testid"?: string;
|
|
8
|
+
}>;
|
|
9
|
+
/**
|
|
10
|
+
* Lightweight ghost icon button for map panel chrome. Skips `IconButton`'s
|
|
11
|
+
* Tooltip/Button stack so icon glyphs paint on the same frame as panel content.
|
|
12
|
+
*
|
|
13
|
+
* Consumers should pass decorative icons with `ariaHidden` and rely on
|
|
14
|
+
* `aria-label` (and the native `title` tooltip) for accessible naming.
|
|
15
|
+
*/
|
|
16
|
+
export declare const PanelIconButton: ({ "aria-label": ariaLabel, children, disabled, onClick, "data-testid": dataTestId, }: PanelIconButtonProps) => ReactElement;
|