@trackunit/react-map 0.0.4-alpha-9d327375fc1.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 +296 -0
- package/index.cjs.js +9851 -0
- package/index.d.ts +1 -0
- package/index.esm.js +9752 -0
- package/package.json +34 -0
- package/src/annotations/getDescriptorContentKey.d.ts +14 -0
- package/src/annotations/mapAnnotations.d.ts +76 -0
- package/src/annotations/useMapAnnotation.d.ts +16 -0
- package/src/annotations/useMapAnnotations.d.ts +17 -0
- package/src/appearance/AppearancePreview.d.ts +27 -0
- package/src/appearance/AppearancePreviewGrid.d.ts +29 -0
- package/src/appearance/appearanceTypes.d.ts +84 -0
- package/src/appearance/useMapAppearanceControls.d.ts +29 -0
- package/src/clusters/ClusterMarker.d.ts +41 -0
- package/src/clusters/ClusterStick.d.ts +97 -0
- package/src/clusters/formatClusterCount.d.ts +11 -0
- package/src/clusters/stories/ClusterMarkerCompactFormatsDemo.d.ts +7 -0
- package/src/clusters/stories/ClusterMarkerCountOnlyDemo.d.ts +7 -0
- package/src/clusters/stories/ClusterMarkerDefaultDemo.d.ts +12 -0
- package/src/clusters/stories/ClusterMarkerPlaygroundDemo.d.ts +10 -0
- package/src/clusters/stories/ClusterMarkerStateDemo.d.ts +9 -0
- package/src/clusters/stories/ClusterMarkerWithSegmentsDemo.d.ts +7 -0
- package/src/clusters/stories/ClusterMarkerWithSticksDemo.d.ts +10 -0
- package/src/clusters/useClusterCountFormat.d.ts +19 -0
- package/src/controls/AnnotationRenderer.d.ts +17 -0
- package/src/controls/AnnotationStack.d.ts +21 -0
- package/src/controls/ControlRenderer.d.ts +20 -0
- package/src/controls/Controls.d.ts +15 -0
- package/src/controls/annotationButtonClasses.d.ts +13 -0
- package/src/controls/collapseControls.d.ts +37 -0
- package/src/controls/defineControlStack.d.ts +10 -0
- package/src/controls/deriveResponsiveMode.d.ts +19 -0
- package/src/controls/longitudeToGlobeIcon.d.ts +3 -0
- package/src/controls/renderers/boolean/BooleanButton.d.ts +16 -0
- package/src/controls/renderers/boolean/MenuBooleanItem.d.ts +20 -0
- package/src/controls/renderers/boolean/MenuCheckbox.d.ts +14 -0
- package/src/controls/renderers/boolean/MenuToggle.d.ts +14 -0
- package/src/controls/renderers/button/Button.d.ts +14 -0
- package/src/controls/renderers/button/MenuButton.d.ts +16 -0
- package/src/controls/renderers/custom/Custom.d.ts +22 -0
- package/src/controls/renderers/menu/Menu.d.ts +23 -0
- package/src/controls/renderers/menu/Modal.d.ts +21 -0
- package/src/controls/renderers/menu/SectionHeader.d.ts +14 -0
- package/src/controls/renderers/menu/Separator.d.ts +11 -0
- package/src/controls/renderers/radio-group/MenuRadioGroup.d.ts +15 -0
- package/src/controls/renderers/radio-group/RadioGroup.d.ts +19 -0
- package/src/controls/renderers/radio-group/RadioGroupField.d.ts +17 -0
- package/src/controls/renderers/search/MenuSearch.d.ts +15 -0
- package/src/controls/renderers/search/Search.d.ts +14 -0
- package/src/controls/renderers/select/MenuSelect.d.ts +15 -0
- package/src/controls/renderers/select/Select.d.ts +14 -0
- package/src/controls/renderers/stepper/MenuStepper.d.ts +17 -0
- package/src/controls/renderers/stepper/Stepper.d.ts +18 -0
- package/src/controls/renderers/toggle-group/MenuToggleGroup.d.ts +17 -0
- package/src/controls/renderers/toggle-group/ToggleGroup.d.ts +15 -0
- package/src/controls/renderers/toggle-group/ToggleGroupField.d.ts +19 -0
- package/src/controls/renderingRules.d.ts +26 -0
- package/src/controls/types.d.ts +395 -0
- package/src/controls/useAnimatedPresence.d.ts +15 -0
- package/src/controls/useAnnotationPresence.d.ts +16 -0
- package/src/controls/useControlStack.d.ts +21 -0
- package/src/controls/useControlsConfig.d.ts +27 -0
- package/src/controls/usePopoverPlacement.d.ts +33 -0
- package/src/core/LoadingIndicatorPill.d.ts +9 -0
- package/src/core/MapLoadingState.d.ts +17 -0
- package/src/core/SafeAreaLayoutContext.d.ts +5 -0
- package/src/core/__testHelpers.d.ts +23 -0
- package/src/core/createMapComponent.d.ts +32 -0
- package/src/core/loadingIndicator.d.ts +21 -0
- package/src/core/padWithInsets.d.ts +5 -0
- package/src/core/types.d.ts +208 -0
- package/src/core/useCameraIdle.d.ts +2 -0
- package/src/core/useCameraState.d.ts +3 -0
- package/src/core/useMap.d.ts +57 -0
- package/src/core/useMapAdapterState.d.ts +14 -0
- package/src/core/useMapKeyboardNavigation.d.ts +38 -0
- package/src/core/usePreviewMap.d.ts +43 -0
- package/src/index.d.ts +69 -0
- package/src/interactions/interactionReducer.d.ts +31 -0
- package/src/layers/Layers.d.ts +32 -0
- package/src/layers/__testHelpers.d.ts +24 -0
- package/src/layers/buildExpandedIds.d.ts +17 -0
- package/src/layers/image-overlay/useImageOverlay.d.ts +39 -0
- package/src/layers/internal/MapLayerContext.d.ts +24 -0
- package/src/layers/internal/adaptiveMarkerResolution.d.ts +33 -0
- package/src/layers/internal/computeBounds.d.ts +34 -0
- package/src/layers/internal/countFeaturesInViewport.d.ts +14 -0
- package/src/layers/internal/createLazyGetter.d.ts +16 -0
- package/src/layers/internal/layerHelpers.d.ts +18 -0
- package/src/layers/internal/markerPortalZIndex.d.ts +17 -0
- package/src/layers/internal/useDblClickFit.d.ts +13 -0
- package/src/layers/internal/useEntityInteraction.d.ts +21 -0
- package/src/layers/internal/useFitFeatureBounds.d.ts +19 -0
- package/src/layers/internal/useLayerHandleSync.d.ts +18 -0
- package/src/layers/internal/useLayerReady.d.ts +25 -0
- package/src/layers/internal/useMarkerMountBridge.d.ts +41 -0
- package/src/layers/internal/useViewportContext.d.ts +34 -0
- package/src/layers/mapFocus.d.ts +29 -0
- package/src/layers/routes/useRoute.d.ts +39 -0
- package/src/layers/shared/measureLabelWidth.d.ts +11 -0
- package/src/layers/types.d.ts +131 -0
- package/src/layers/useExpandedIds.d.ts +20 -0
- package/src/layers/useFitToContent.d.ts +57 -0
- package/src/layers/useLayers.d.ts +58 -0
- package/src/layers/useMarkers/adaptiveHelpers.d.ts +156 -0
- package/src/layers/useMarkers/resolveServerClusters.d.ts +26 -0
- package/src/layers/useMarkers/useAdaptiveMarkerHelpers.d.ts +38 -0
- package/src/layers/useMarkers/useMarkers.d.ts +127 -0
- package/src/layers/useShapes/InteractiveDecoration.d.ts +23 -0
- package/src/layers/useShapes/MultiGeometryPlusBadge.d.ts +17 -0
- package/src/layers/useShapes/MultiPartBadge.d.ts +11 -0
- package/src/layers/useShapes/ShapeAnnotationLabel.d.ts +30 -0
- package/src/layers/useShapes/ShapeIcon.d.ts +21 -0
- package/src/layers/useShapes/ShapeLabelPill.d.ts +25 -0
- package/src/layers/useShapes/buildShapeLabelResolutionContext.d.ts +23 -0
- package/src/layers/useShapes/decorationFactories.d.ts +47 -0
- package/src/layers/useShapes/edge/ShapeEdgeLabel.d.ts +13 -0
- package/src/layers/useShapes/edge/computeEdgeAutoPlacement.d.ts +69 -0
- package/src/layers/useShapes/edge/computeEdgeProperties.d.ts +21 -0
- package/src/layers/useShapes/edge/edgeInsetsForFeature.d.ts +27 -0
- package/src/layers/useShapes/edge/edgeReservations.d.ts +36 -0
- package/src/layers/useShapes/edge/findBestEdgePosition.d.ts +247 -0
- package/src/layers/useShapes/extractMultiParts.d.ts +25 -0
- package/src/layers/useShapes/findBestVisibleVertex.d.ts +18 -0
- package/src/layers/useShapes/multiPartDecorations.d.ts +19 -0
- package/src/layers/useShapes/shapeDecorations.d.ts +154 -0
- package/src/layers/useShapes/shapeFeatureBuilders.d.ts +25 -0
- package/src/layers/useShapes/shapeLabelPolicy.d.ts +42 -0
- package/src/layers/useShapes/shapeLabelResolution.d.ts +45 -0
- package/src/layers/useShapes/shapeSyntheticMarkerRender.d.ts +16 -0
- package/src/layers/useShapes/useShapeDecorations.d.ts +56 -0
- package/src/layers/useShapes/useShapeLabelHelpers.d.ts +29 -0
- package/src/layers/useShapes/useShapes.d.ts +50 -0
- package/src/markers/MapMarker.d.ts +115 -0
- package/src/markers/MapMarkerIcon.d.ts +21 -0
- package/src/markers/animation/applyStickFrame.d.ts +15 -0
- package/src/markers/animation/spring.d.ts +45 -0
- package/src/markers/animation/stickFrame.d.ts +82 -0
- package/src/markers/animation/usePillBackgroundPaint.d.ts +15 -0
- package/src/markers/animation/useStickAnimation.d.ts +21 -0
- package/src/markers/animation/useStickTween.d.ts +28 -0
- package/src/markers/geometry/stickPositioning.d.ts +69 -0
- package/src/markers/geometry/useDirectionIndicator.d.ts +8 -0
- package/src/markers/internal/MapMarkerStickSurface.d.ts +47 -0
- package/src/markers/model/mapMarkerDomPortalStacking.d.ts +22 -0
- package/src/markers/model/markerDomTypes.d.ts +68 -0
- package/src/markers/model/markerResolvers.d.ts +34 -0
- package/src/markers/model/markerSizeMap.d.ts +82 -0
- package/src/markers/model/markerTuningParams.d.ts +60 -0
- package/src/markers/model/useMarkerStateResolvers.d.ts +25 -0
- package/src/markers/shared/MarkerAnimatedSurface.d.ts +20 -0
- package/src/markers/shared/MarkerDiscContent.d.ts +11 -0
- package/src/markers/shared/mapMarkerVariants.d.ts +35 -0
- package/src/markers/shared/markerColors.d.ts +55 -0
- package/src/markers/shared/useMarkerColors.d.ts +23 -0
- package/src/markers/stories/demoes/AnimationCircleVsPillDemo.d.ts +7 -0
- package/src/markers/stories/demoes/CircleIconGuidanceDemo.d.ts +2 -0
- package/src/markers/stories/demoes/DefaultDemo.d.ts +14 -0
- package/src/markers/stories/demoes/DirectionBehaviorDemo.d.ts +2 -0
- package/src/markers/stories/demoes/PillLabelLengthsDemo.d.ts +2 -0
- package/src/markers/stories/demoes/StatesDemo.d.ts +7 -0
- package/src/markers/stories/demoes/StickModeDemo.d.ts +2 -0
- package/src/markers/stories/demoes/StickModePlaygroundDemo.d.ts +10 -0
- package/src/markers/stories/helpers/AbsoluteGridPicker.d.ts +17 -0
- package/src/markers/stories/helpers/InlineLabel.d.ts +4 -0
- package/src/markers/stories/helpers/InlineSlider.d.ts +11 -0
- package/src/markers/stories/helpers/LabeledMarker.d.ts +7 -0
- package/src/markers/stories/helpers/MarkerRow.d.ts +4 -0
- package/src/markers/stories/helpers/SectionHeader.d.ts +4 -0
- package/src/markers/stories/helpers/StatesMarkerCell.d.ts +15 -0
- package/src/markers/stories/helpers/ThemedPreview.d.ts +10 -0
- package/src/markers/stories/helpers/mapMarkerStoryConstants.d.ts +4 -0
- package/src/panel/Panel.d.ts +60 -0
- package/src/panel/PanelOrchestrator.d.ts +24 -0
- package/src/panel/preload/preloadInitiators.d.ts +44 -0
- package/src/panel/preload/useHoverPreloadInitiator.d.ts +8 -0
- package/src/panel/preload/usePanelPreload.d.ts +46 -0
- package/src/panel/preload/useProximityPreloadInitiator.d.ts +13 -0
- package/src/panel/store/panels.d.ts +76 -0
- package/src/panel/storyHelpers.d.ts +9 -0
- package/src/panel/usePanel.d.ts +81 -0
- package/src/panel/utils/autoPan.d.ts +78 -0
- package/src/panel/utils/panelShellConstants.d.ts +8 -0
- package/src/panel/utils/useAutoPanResolver.d.ts +23 -0
- package/src/panel/utils/useWheelForwarding.d.ts +18 -0
- package/src/stories/InteractionDisplay.d.ts +9 -0
- package/src/stories/PositionDisplay.d.ts +9 -0
- package/src/stories/_storyCoordUtils.d.ts +8 -0
- package/src/testing/mockMapApi.d.ts +29 -0
- package/src/translation.d.ts +30 -0
- package/translation.cjs.js +30 -0
- package/translation.cjs10.js +30 -0
- package/translation.cjs11.js +30 -0
- package/translation.cjs12.js +30 -0
- package/translation.cjs13.js +30 -0
- package/translation.cjs14.js +30 -0
- package/translation.cjs15.js +30 -0
- package/translation.cjs16.js +30 -0
- package/translation.cjs17.js +30 -0
- package/translation.cjs2.js +30 -0
- package/translation.cjs3.js +30 -0
- package/translation.cjs4.js +30 -0
- package/translation.cjs5.js +30 -0
- package/translation.cjs6.js +30 -0
- package/translation.cjs7.js +30 -0
- package/translation.cjs8.js +30 -0
- package/translation.cjs9.js +30 -0
- package/translation.esm.js +28 -0
- package/translation.esm10.js +28 -0
- package/translation.esm11.js +28 -0
- package/translation.esm12.js +28 -0
- package/translation.esm13.js +28 -0
- package/translation.esm14.js +28 -0
- package/translation.esm15.js +28 -0
- package/translation.esm16.js +28 -0
- package/translation.esm17.js +28 -0
- package/translation.esm2.js +28 -0
- package/translation.esm3.js +28 -0
- package/translation.esm4.js +28 -0
- package/translation.esm5.js +28 -0
- package/translation.esm6.js +28 -0
- package/translation.esm7.js +28 -0
- package/translation.esm8.js +28 -0
- package/translation.esm9.js +28 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { MapApi } from "../core/types";
|
|
2
|
+
import type { ControlsConfig } from "./types";
|
|
3
|
+
type ControlsProps = Readonly<{
|
|
4
|
+
/** The map API object from useMap */
|
|
5
|
+
api: MapApi;
|
|
6
|
+
/** Additional CSS classes for the controls container */
|
|
7
|
+
className?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Custom controls configuration to override the default.
|
|
10
|
+
* If provided, this will be used instead of building from api.options.
|
|
11
|
+
*/
|
|
12
|
+
controlsConfig?: ControlsConfig;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const Controls: import("react").MemoExoticComponent<({ api, className, controlsConfig: controlsConfigProp }: ControlsProps) => import("react/jsx-runtime").JSX.Element>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base CSS classes for button elements used in map annotation overlays —
|
|
3
|
+
* `AnnotationRenderer` (simple-pill button) and `ShapeAnnotationLabel` (custom pill button).
|
|
4
|
+
*
|
|
5
|
+
* Resets native button appearance while preserving font inheritance and keyboard
|
|
6
|
+
* focus accessibility. Matches the focus ring pattern in InteractiveDecoration.tsx
|
|
7
|
+
* so all interactive map overlay buttons behave consistently for keyboard users.
|
|
8
|
+
*
|
|
9
|
+
* Compose additional appearance classes on top via `twMerge`.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare const ANNOTATION_BUTTON_RESET_CLASSES = "appearance-none m-0 cursor-pointer border-0 font-inherit focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { CategoryKey, ControlConfig, ControlsConfig, IconName, MenuItemConfig, ResponsiveMode } from "./types";
|
|
2
|
+
/** Icon + label for a single category (or the "all controls" fallback) */
|
|
3
|
+
type CategoryMeta = Readonly<{
|
|
4
|
+
icon: IconName;
|
|
5
|
+
label: string;
|
|
6
|
+
}>;
|
|
7
|
+
/** Metadata for every category, plus the "all controls" collapsed-mode entry */
|
|
8
|
+
export type CategoryMetadata = Readonly<Record<CategoryKey, CategoryMeta> & {
|
|
9
|
+
/** Metadata for the single collapsed-mode menu button */
|
|
10
|
+
allControls: CategoryMeta;
|
|
11
|
+
}>;
|
|
12
|
+
/**
|
|
13
|
+
* Converts a top-level `ControlConfig` into one or more `MenuItemConfig` items.
|
|
14
|
+
*
|
|
15
|
+
* Most control types pass through unchanged (they're already valid menu items).
|
|
16
|
+
* One special case:
|
|
17
|
+
* - **Menu** → flattens its items into the parent (menus cannot nest)
|
|
18
|
+
*
|
|
19
|
+
* When `section` is provided, it is set on each output item (except separators
|
|
20
|
+
* which don't support sections).
|
|
21
|
+
*/
|
|
22
|
+
export declare const controlToMenuItems: (control: ControlConfig, section?: string) => ReadonlyArray<MenuItemConfig>;
|
|
23
|
+
/**
|
|
24
|
+
* Pure config transform that restructures `ControlsConfig` based on how much
|
|
25
|
+
* space is available.
|
|
26
|
+
*
|
|
27
|
+
* - `"full"` -- pass through unchanged
|
|
28
|
+
* - `"categorized"` -- group controls within each category into a per-category
|
|
29
|
+
* menu (only when >1 control in that category)
|
|
30
|
+
* - `"collapsed"` -- merge all controls into a single menu with named sections
|
|
31
|
+
*
|
|
32
|
+
* This operates at the config level, before controls enter the middleware
|
|
33
|
+
* rendering pipeline. Existing renderers handle the resulting menus with no
|
|
34
|
+
* changes needed.
|
|
35
|
+
*/
|
|
36
|
+
export declare const collapseControls: (config: ControlsConfig, mode: ResponsiveMode, metadata: CategoryMetadata) => ControlsConfig;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ControlConfig } from "./types";
|
|
2
|
+
export type ControlStackItem = ControlConfig | undefined;
|
|
3
|
+
/**
|
|
4
|
+
* Builds an ordered control stack from explicit control handles.
|
|
5
|
+
*
|
|
6
|
+
* The array order is the rendered order. Optional controls can be passed as
|
|
7
|
+
* `undefined`; duplicate ids are rejected because they would produce unstable
|
|
8
|
+
* React keys and ambiguous control identity.
|
|
9
|
+
*/
|
|
10
|
+
export declare const defineControlStack: (controls: ReadonlyArray<ControlStackItem>) => ReadonlyArray<ControlConfig>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ResponsiveMode } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Height thresholds for bumping the responsive mode toward more collapsed.
|
|
4
|
+
* Compared against the container's **border-box** height so the measurement
|
|
5
|
+
* is independent of padding changes (which depend on availableSpace).
|
|
6
|
+
*/
|
|
7
|
+
export declare const HEIGHT_COLLAPSED_THRESHOLD = 230;
|
|
8
|
+
export declare const HEIGHT_CATEGORIZED_THRESHOLD = 380;
|
|
9
|
+
/**
|
|
10
|
+
* Height threshold for switching from "comfortable" to "constrained" available space.
|
|
11
|
+
* Compared against the container's **border-box** height.
|
|
12
|
+
*/
|
|
13
|
+
export declare const HEIGHT_COMFORTABLE_THRESHOLD = 380;
|
|
14
|
+
/**
|
|
15
|
+
* Derive responsive mode from container breakpoints and height.
|
|
16
|
+
* Width breakpoints set the base mode; low height bumps it toward more collapsed.
|
|
17
|
+
* Narrowest first: collapsed -> categorized -> full.
|
|
18
|
+
*/
|
|
19
|
+
export declare const deriveResponsiveMode: (isSm: boolean, isMd: boolean, containerHeight: number) => ResponsiveMode;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ResolvedControlProps } from "../../renderingRules";
|
|
2
|
+
import type { BooleanControlConfig } from "../../types";
|
|
3
|
+
type BooleanButtonProps = Readonly<{
|
|
4
|
+
config: BooleanControlConfig;
|
|
5
|
+
resolved: ResolvedControlProps;
|
|
6
|
+
}>;
|
|
7
|
+
/**
|
|
8
|
+
* Shared standalone renderer for boolean controls (toggle and checkbox).
|
|
9
|
+
* Both render identically as an IconButton with tooltip in standalone mode.
|
|
10
|
+
* Tooltip shows "Toggle: [label]".
|
|
11
|
+
* Purely presentational -- all rendering decisions come from resolved props.
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare const BooleanButton: ({ config, resolved }: BooleanButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { IconName } from "../../types";
|
|
3
|
+
type MenuBooleanItemProps = Readonly<{
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
"data-testid"?: string;
|
|
7
|
+
icon?: IconName;
|
|
8
|
+
label: string;
|
|
9
|
+
}>;
|
|
10
|
+
/**
|
|
11
|
+
* Shared menu layout for boolean controls (toggle and checkbox).
|
|
12
|
+
* Renders: [label] [icon] ...space... [children]
|
|
13
|
+
*
|
|
14
|
+
* The caller provides the specific input control (ToggleSwitch or Checkbox)
|
|
15
|
+
* as children.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export declare const MenuBooleanItem: ({ children, className, "data-testid": dataTestId, icon, label, }: MenuBooleanItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ResolvedControlProps } from "../../renderingRules";
|
|
2
|
+
import type { CheckboxControlConfig } from "../../types";
|
|
3
|
+
type MenuCheckboxProps = Readonly<{
|
|
4
|
+
config: CheckboxControlConfig;
|
|
5
|
+
resolved: ResolvedControlProps;
|
|
6
|
+
}>;
|
|
7
|
+
/**
|
|
8
|
+
* Renders a checkbox control within a menu context.
|
|
9
|
+
* Purely presentational -- all rendering decisions come from resolved props.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare const MenuCheckbox: ({ config, resolved }: MenuCheckboxProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ResolvedControlProps } from "../../renderingRules";
|
|
2
|
+
import type { ToggleControlConfig } from "../../types";
|
|
3
|
+
type MenuToggleProps = Readonly<{
|
|
4
|
+
config: ToggleControlConfig;
|
|
5
|
+
resolved: ResolvedControlProps;
|
|
6
|
+
}>;
|
|
7
|
+
/**
|
|
8
|
+
* Renders a toggle control within a menu context.
|
|
9
|
+
* Purely presentational -- all rendering decisions come from resolved props.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare const MenuToggle: ({ config, resolved }: MenuToggleProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ResolvedControlProps } from "../../renderingRules";
|
|
2
|
+
import type { ButtonControlConfig } from "../../types";
|
|
3
|
+
type ButtonProps = Readonly<{
|
|
4
|
+
config: ButtonControlConfig;
|
|
5
|
+
resolved: ResolvedControlProps;
|
|
6
|
+
}>;
|
|
7
|
+
/**
|
|
8
|
+
* Renders a simple icon button control (standalone mode).
|
|
9
|
+
* Purely presentational -- all rendering decisions come from resolved props.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare const Button: ({ config, resolved }: ButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ResolvedControlProps } from "../../renderingRules";
|
|
2
|
+
import type { ButtonControlConfig } from "../../types";
|
|
3
|
+
type MenuButtonProps = Readonly<{
|
|
4
|
+
config: ButtonControlConfig;
|
|
5
|
+
resolved: ResolvedControlProps;
|
|
6
|
+
}>;
|
|
7
|
+
/**
|
|
8
|
+
* Renders a button control within a menu context.
|
|
9
|
+
* Layout: label on the left, icon on the right (consistent with other menu items).
|
|
10
|
+
* The entire row is clickable.
|
|
11
|
+
* Purely presentational -- all rendering decisions come from resolved props.
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare const MenuButton: ({ config, resolved }: MenuButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ResolvedControlProps } from "../../renderingRules";
|
|
2
|
+
import type { CustomControlConfig, Placement } from "../../types";
|
|
3
|
+
type CustomProps = Readonly<{
|
|
4
|
+
config: CustomControlConfig;
|
|
5
|
+
resolved: ResolvedControlProps;
|
|
6
|
+
placement: Placement;
|
|
7
|
+
}>;
|
|
8
|
+
/**
|
|
9
|
+
* Renders a custom control by delegating to the user-provided `render` function.
|
|
10
|
+
*
|
|
11
|
+
* This is an **escape hatch** -- prefer built-in control types (button, toggle,
|
|
12
|
+
* stepper, select, menu) which handle compactness, placement, tooltips, and
|
|
13
|
+
* accessibility automatically.
|
|
14
|
+
*
|
|
15
|
+
* The custom render function receives the full environment context so it can
|
|
16
|
+
* adapt to compactness and placement. Unless `autoTooltip` is `"none"`,
|
|
17
|
+
* standalone placement wraps the output in `Tooltip` using `label`.
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare const Custom: ({ config, resolved, placement }: CustomProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ComponentRef, type RefObject } from "react";
|
|
2
|
+
import { type AvailableSpace, type ResolvedControlProps } from "../../renderingRules";
|
|
3
|
+
import type { MenuControlConfig, MenuPresentation } from "../../types";
|
|
4
|
+
type MenuProps = Readonly<{
|
|
5
|
+
availableSpace: AvailableSpace;
|
|
6
|
+
config: MenuControlConfig;
|
|
7
|
+
/** Ref to the controls overlay container, used to compute popover placement */
|
|
8
|
+
containerRef: RefObject<ComponentRef<"div"> | null>;
|
|
9
|
+
customPortalId?: string;
|
|
10
|
+
menuPresentation: MenuPresentation;
|
|
11
|
+
resolved: ResolvedControlProps;
|
|
12
|
+
}>;
|
|
13
|
+
/**
|
|
14
|
+
* Renders a menu control as either a popover or a modal,
|
|
15
|
+
* depending on the `menuPresentation` prop derived from container size.
|
|
16
|
+
*
|
|
17
|
+
* Delegates to `MenuPopover` or `MenuModal` so each path
|
|
18
|
+
* only runs the hooks it needs.
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export declare const Menu: ({ availableSpace, config, containerRef, customPortalId, menuPresentation, resolved, }: MenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { ResolvedControlProps } from "../../renderingRules";
|
|
3
|
+
import type { MenuControlConfig } from "../../types";
|
|
4
|
+
type ModalProps = Readonly<{
|
|
5
|
+
config: MenuControlConfig;
|
|
6
|
+
resolved: ResolvedControlProps;
|
|
7
|
+
/** The menu content (grouped sections and items) to render inside the modal body */
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}>;
|
|
10
|
+
/**
|
|
11
|
+
* Renders a menu control as a modal instead of a popover.
|
|
12
|
+
* Used on narrow containers where popovers would be clipped or awkward.
|
|
13
|
+
*
|
|
14
|
+
* The trigger is the same IconButton used by the popover path.
|
|
15
|
+
* The content is rendered inside a Modal with ModalHeader (label + close)
|
|
16
|
+
* and ModalBody (scrollable menu items).
|
|
17
|
+
*
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export declare const Modal: ({ config, resolved, children }: ModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type SectionHeaderProps = Readonly<{
|
|
2
|
+
/** Section title to display */
|
|
3
|
+
title: string;
|
|
4
|
+
/** Additional CSS classes */
|
|
5
|
+
className?: string;
|
|
6
|
+
}>;
|
|
7
|
+
/**
|
|
8
|
+
* Renders a section header within a menu.
|
|
9
|
+
* Non-interactive, purely visual grouping element.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare const SectionHeader: ({ title, className }: SectionHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type SeparatorProps = Readonly<{
|
|
2
|
+
/** Additional CSS classes */
|
|
3
|
+
className?: string;
|
|
4
|
+
}>;
|
|
5
|
+
/**
|
|
6
|
+
* Renders a horizontal separator line within a menu.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare const Separator: ({ className }: SeparatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ResolvedControlProps } from "../../renderingRules";
|
|
2
|
+
import type { RadioGroupControlConfig } from "../../types";
|
|
3
|
+
type MenuRadioGroupProps = Readonly<{
|
|
4
|
+
config: RadioGroupControlConfig;
|
|
5
|
+
/** Carried for the same signature as other menu renderers; the menu radio has no use for resolved (no icon on the field). */
|
|
6
|
+
resolved: ResolvedControlProps;
|
|
7
|
+
}>;
|
|
8
|
+
/**
|
|
9
|
+
* Renders a radio group within a menu context.
|
|
10
|
+
* `data-testid` (when set) is on the menu-item wrapper only — not duplicated on the inner `RadioGroupField`.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare const MenuRadioGroup: ({ config, resolved: _resolved }: MenuRadioGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ComponentRef, type RefObject } from "react";
|
|
2
|
+
import type { ResolvedControlProps } from "../../renderingRules";
|
|
3
|
+
import type { RadioGroupControlConfig } from "../../types";
|
|
4
|
+
type RadioGroupProps = Readonly<{
|
|
5
|
+
config: RadioGroupControlConfig;
|
|
6
|
+
containerRef: RefObject<ComponentRef<"div"> | null>;
|
|
7
|
+
customPortalId?: string;
|
|
8
|
+
resolved: ResolvedControlProps;
|
|
9
|
+
}>;
|
|
10
|
+
/**
|
|
11
|
+
* Standalone radio group: icon button opens a popover (`MoreMenu`).
|
|
12
|
+
* Panel styling matches the menu popover card look: bordered white surface with
|
|
13
|
+
* `rounded-lg border border-neutral-300 bg-white px-3 py-2 shadow` (aligned with menu content styling).
|
|
14
|
+
* The same `RadioGroupField` tree is used as {@link MenuRadioGroup} in a menu list.
|
|
15
|
+
*
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export declare const RadioGroup: ({ config, containerRef, customPortalId, resolved }: RadioGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import type { RadioGroupControlConfig } from "../../types";
|
|
3
|
+
type RadioGroupFieldProps = Readonly<{
|
|
4
|
+
config: Pick<RadioGroupControlConfig, "className" | "id" | "onChange" | "options" | "value"> & {
|
|
5
|
+
/** Omitted in menu context so the menu-item wrapper keeps a single `data-testid`. */
|
|
6
|
+
"data-testid"?: string;
|
|
7
|
+
/** Passed through to the design-system `RadioGroup` field label (optional at the field layer). */
|
|
8
|
+
label?: string;
|
|
9
|
+
};
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* Shared RadioGroup + RadioItem tree for menu and standalone placements.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare const RadioGroupField: ({ config }: RadioGroupFieldProps) => ReactElement;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ResolvedControlProps } from "../../renderingRules";
|
|
2
|
+
import type { SearchControlConfig } from "../../types";
|
|
3
|
+
type MenuSearchProps = Readonly<{
|
|
4
|
+
config: SearchControlConfig;
|
|
5
|
+
resolved: ResolvedControlProps;
|
|
6
|
+
}>;
|
|
7
|
+
/**
|
|
8
|
+
* Renders a search control within a menu context.
|
|
9
|
+
* Uses FormGroup to match label styling with SelectField and other form components.
|
|
10
|
+
* Purely presentational -- all rendering decisions come from resolved props.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare const MenuSearch: ({ config, resolved: _resolved }: MenuSearchProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ResolvedControlProps } from "../../renderingRules";
|
|
2
|
+
import type { SearchControlConfig } from "../../types";
|
|
3
|
+
type SearchProps = Readonly<{
|
|
4
|
+
config: SearchControlConfig;
|
|
5
|
+
resolved: ResolvedControlProps;
|
|
6
|
+
}>;
|
|
7
|
+
/**
|
|
8
|
+
* Renders a search control for search/filter.
|
|
9
|
+
* Purely presentational -- all rendering decisions come from resolved props.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare const Search: ({ config, resolved }: SearchProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ResolvedControlProps } from "../../renderingRules";
|
|
2
|
+
import type { SelectControlConfig } from "../../types";
|
|
3
|
+
type MenuSelectProps = Readonly<{
|
|
4
|
+
config: SelectControlConfig;
|
|
5
|
+
resolved: ResolvedControlProps;
|
|
6
|
+
}>;
|
|
7
|
+
/**
|
|
8
|
+
* Renders a select control within a menu context.
|
|
9
|
+
* Purely presentational -- all rendering decisions come from resolved props.
|
|
10
|
+
* `data-testid` (when set) is on the menu-item wrapper only — not duplicated on the inner `SelectField`.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare const MenuSelect: ({ config, resolved: _resolved }: MenuSelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ResolvedControlProps } from "../../renderingRules";
|
|
2
|
+
import type { SelectControlConfig } from "../../types";
|
|
3
|
+
type SelectProps = Readonly<{
|
|
4
|
+
config: SelectControlConfig;
|
|
5
|
+
resolved: ResolvedControlProps;
|
|
6
|
+
}>;
|
|
7
|
+
/**
|
|
8
|
+
* Renders a select dropdown control.
|
|
9
|
+
* Purely presentational -- all rendering decisions come from resolved props.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare const Select: ({ config, resolved }: SelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ResolvedControlProps } from "../../renderingRules";
|
|
2
|
+
import type { StepperControlConfig } from "../../types";
|
|
3
|
+
type MenuStepperProps = Readonly<{
|
|
4
|
+
config: StepperControlConfig;
|
|
5
|
+
resolved: ResolvedControlProps;
|
|
6
|
+
}>;
|
|
7
|
+
/**
|
|
8
|
+
* Renders a stepper control within a menu context.
|
|
9
|
+
* Shows label on the left and horizontal decrement/increment buttons on the right.
|
|
10
|
+
* Always uses Minus/Plus icons with translated "Decrease"/"Increase" labels.
|
|
11
|
+
*
|
|
12
|
+
* Layout: [Label] ...space... [-] [+]
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare const MenuStepper: ({ config, resolved }: MenuStepperProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ResolvedControlProps } from "../../renderingRules";
|
|
2
|
+
import type { StepperControlConfig } from "../../types";
|
|
3
|
+
type StepperProps = Readonly<{
|
|
4
|
+
config: StepperControlConfig;
|
|
5
|
+
resolved: ResolvedControlProps;
|
|
6
|
+
}>;
|
|
7
|
+
/**
|
|
8
|
+
* Renders two connected buttons for increment/decrement actions.
|
|
9
|
+
* Always uses Plus/Minus icons with translated "Increase"/"Decrease" labels.
|
|
10
|
+
* Tooltip shows "label, Increase" or "label, Decrease" depending on which
|
|
11
|
+
* button is hovered, falling back to just "label".
|
|
12
|
+
*
|
|
13
|
+
* Purely presentational -- all rendering decisions come from resolved props.
|
|
14
|
+
*
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare const Stepper: ({ config, resolved }: StepperProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ResolvedControlProps } from "../../renderingRules";
|
|
2
|
+
import type { ToggleGroupControlConfig } from "../../types";
|
|
3
|
+
type MenuToggleGroupProps = Readonly<{
|
|
4
|
+
config: ToggleGroupControlConfig;
|
|
5
|
+
resolved: ResolvedControlProps;
|
|
6
|
+
}>;
|
|
7
|
+
/**
|
|
8
|
+
* Toggle group within a menu — text and icons (not icon-only). Segment `size` comes from resolved props
|
|
9
|
+
* (same sizing rules as other menu controls via {@link resolveControl}).
|
|
10
|
+
* The wrapper exposes `role="group"` and `aria-label={config.label}` so the segment row has an accessible name
|
|
11
|
+
* (there is no separate visible field label like {@link MenuRadioGroup}).
|
|
12
|
+
* `data-testid` (when set) is on the menu-item wrapper only — not duplicated on the inner `ToggleGroup`.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare const MenuToggleGroup: ({ config, resolved }: MenuToggleGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ResolvedControlProps } from "../../renderingRules";
|
|
2
|
+
import type { ToggleGroupControlConfig } from "../../types";
|
|
3
|
+
type ToggleGroupProps = Readonly<{
|
|
4
|
+
config: ToggleGroupControlConfig;
|
|
5
|
+
resolved: ResolvedControlProps;
|
|
6
|
+
}>;
|
|
7
|
+
/**
|
|
8
|
+
* Standalone segmented toggle group (design-system `ToggleGroup`).
|
|
9
|
+
* Uses icon-only segments with tooltips; the group is named via `config.label` on the wrapper (`aria-label`).
|
|
10
|
+
* Border contrast uses a wrapper `::after` (inset ring above the DS fill — same idea as a trailing overlay, without an extra DOM node).
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export declare const ToggleGroup: ({ config, resolved }: ToggleGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ToggleGroup as ToggleGroupPrimitive } from "@trackunit/react-components";
|
|
2
|
+
import type { ComponentProps, ReactElement } from "react";
|
|
3
|
+
import type { ToggleGroupControlConfig } from "../../types";
|
|
4
|
+
type ToggleGroupFieldProps = Readonly<{
|
|
5
|
+
config: Pick<ToggleGroupControlConfig, "disabled" | "onChange" | "options" | "value"> & {
|
|
6
|
+
className?: string;
|
|
7
|
+
/** Omitted when the outer wrapper owns `data-testid` (e.g. menu row). */
|
|
8
|
+
"data-testid"?: string;
|
|
9
|
+
};
|
|
10
|
+
isIconOnly: boolean;
|
|
11
|
+
size: ComponentProps<typeof ToggleGroupPrimitive>["size"];
|
|
12
|
+
}>;
|
|
13
|
+
/**
|
|
14
|
+
* Shared design-system `ToggleGroup` wiring for standalone and menu placements.
|
|
15
|
+
*
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export declare const ToggleGroupField: ({ config, isIconOnly, size }: ToggleGroupFieldProps) => ReactElement;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AvailableSpace, Compactness, ControlConfig, MenuItemConfig, Placement, RenderContext, ResolvedControlProps, ResolvedControlPropsBase } from "./types";
|
|
2
|
+
export type { AvailableSpace, Compactness, Placement, RenderContext, ResolvedControlProps, ResolvedControlPropsBase };
|
|
3
|
+
/** Shared padding for interactive menu items (button, toggle, stepper, select, radioGroup). */
|
|
4
|
+
export declare const cvaControlMenuItemBase: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
5
|
+
/** Context available to all middleware and resolvers */
|
|
6
|
+
export type MiddlewareContext = Readonly<{
|
|
7
|
+
renderContext: RenderContext;
|
|
8
|
+
config: ControlConfig | MenuItemConfig;
|
|
9
|
+
}>;
|
|
10
|
+
/**
|
|
11
|
+
* A middleware function: receives current state, returns modified state.
|
|
12
|
+
*
|
|
13
|
+
* Exported for advanced use cases such as providing a custom middleware
|
|
14
|
+
* stack to `resolveControl`. Most consumers should not need this.
|
|
15
|
+
*/
|
|
16
|
+
export type ControlMiddleware = (state: ResolvedControlPropsBase, ctx: MiddlewareContext) => ResolvedControlPropsBase;
|
|
17
|
+
/**
|
|
18
|
+
* Runs the full pipeline: initial state -> middleware -> type resolver.
|
|
19
|
+
* Pure function, no side effects, easily testable.
|
|
20
|
+
*
|
|
21
|
+
* Inspired by Floating UI's middleware pattern:
|
|
22
|
+
* - Cross-cutting middleware (sizing) handles concerns for all control types
|
|
23
|
+
* - Type-specific resolvers handle logic unique to each control type
|
|
24
|
+
* - Type resolvers run after middleware and can override any field
|
|
25
|
+
*/
|
|
26
|
+
export declare const resolveControl: (config: ControlConfig | MenuItemConfig, renderContext: RenderContext, middleware?: ReadonlyArray<ControlMiddleware>) => ResolvedControlProps;
|