@procaaso/alphinity-ui-components 1.5.0 → 1.8.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/dist/index.d.cts CHANGED
@@ -374,6 +374,30 @@ interface NodeControlsPanelProps extends react__default.HTMLAttributes<HTMLDivEl
374
374
  */
375
375
  declare const NodeControlsPanel: react__default.FC<NodeControlsPanelProps>;
376
376
 
377
+ /**
378
+ * A custom action button rendered in the device control panel (e.g. Tare, Zero).
379
+ */
380
+ interface CustomAction {
381
+ /** Stable action id passed to onCustomAction when clicked. */
382
+ id: string;
383
+ /** Button label. */
384
+ label: string;
385
+ /** Optional leading icon / emoji. */
386
+ icon?: string;
387
+ /** Visual variant (reserved for future styling). */
388
+ variant?: 'primary' | 'secondary' | 'alarm' | 'warning';
389
+ /**
390
+ * When true, the button renders disabled and does NOT fire onCustomAction.
391
+ * Use for actions that are only conditionally available (e.g. a Tare that is
392
+ * not ready).
393
+ */
394
+ disabled?: boolean;
395
+ /**
396
+ * Tooltip shown on hover explaining why the action is unavailable. Only
397
+ * meaningful when `disabled` is true.
398
+ */
399
+ disabledReason?: string;
400
+ }
377
401
  /**
378
402
  * Device control capabilities and commands
379
403
  */
@@ -387,12 +411,7 @@ interface ControlCapabilities {
387
411
  /** Can the device be reset? */
388
412
  canReset?: boolean;
389
413
  /** Custom actions available */
390
- customActions?: Array<{
391
- id: string;
392
- label: string;
393
- icon?: string;
394
- variant?: 'primary' | 'secondary' | 'alarm' | 'warning';
395
- }>;
414
+ customActions?: CustomAction[];
396
415
  }
397
416
  /**
398
417
  * Device control mode option
@@ -576,10 +595,7 @@ declare function createControlBinding(nodeId: string, deviceConfig: {
576
595
  capabilities?: {
577
596
  canStart?: boolean;
578
597
  canStop?: boolean;
579
- customActions?: Array<{
580
- id: string;
581
- label: string;
582
- }>;
598
+ customActions?: CustomAction[];
583
599
  };
584
600
  status?: string;
585
601
  isRunning?: boolean;
@@ -1980,4 +1996,4 @@ interface SimulationOptions {
1980
1996
  */
1981
1997
  declare function useSimulation(telemetry: TelemetryMap, updateTelemetryBatch: (updates: Array<any>) => void, options?: SimulationOptions): void;
1982
1998
 
1983
- export { type AnchorType, Button, type ButtonProps, CardHeader, CardUnit, CardValue, CircularGauge, type CircularGaugeProps, type CommandKind, type ConfigActions, type ConfigDisplay, type ConfigParameter, type ConfigSection, type ConfigState, type ConfigTheme, type ControlCapabilities, type ControlMode, ControlPanel, type ControlPanelProps, type ControlParameter, type ControlState, DEFAULT_STATUS_COLORS, DEFAULT_THRESHOLDS, DashboardCard, type DataBinding, type DeviceConfigBinding, type DeviceConfigMap, DeviceConfigPanel, type DeviceConfigPanelProps, type DeviceControlBinding, type DeviceControlMap, DeviceControlPanel, type DeviceControlPanelProps, type DeviceStatus, type Diagram, type DiagramMetadata, type DisplayMode, DisplayModeToggle, type DragPoint, type DragState, EquipmentIndicator, type EquipmentIndicatorProps, EquipmentIndicatorWithSparkline, type EquipmentIndicatorWithSparklineProps, FixedSVGContainer, FooterPanel, FullscreenContainer, FullscreenWorkspace, type FullscreenWorkspaceProps, type FullscreenWorkspaceTab, type KeyboardShortcutsOptions, LeftPanel, LeftToggleButton, LegacyValueEntry, type LegacyValueEntryProps, type ModeConfig, NodeConfigPanel, type NodeConfigPanelProps, type NodeControlConfig, NodeControlsPanel, type NodeControlsPanelProps, type NodeInstance, NumpadDialog, type NumpadDialogProps, type Overlay, type OverlayContent, type OverlayTheme, type OverlayType, PIDCanvas, type PIDCanvasControls, type PIDCanvasFeatures, type PIDCanvasProps, PanelContent, PanelTabs, type PipeEdge, type PipeStyle, type Point, type PortDefinition, type PortInstance, type PortType, RightPanel, RightToggleButton, SVGArea, SVGLockedOverlay, type SVGLockedOverlayProps, type ScalingMetadata, ScrollableSVGWrapper, type SelectionState, Selector, type SelectorOption, type SelectorProps, type SimulationOptions, Sparkline, type SparklineProps, type StatusColorEntry, type StatusColorMap, StatusIndicator, type StatusIndicatorProps, type SymbolCategory, type SymbolDefinition, SymbolLibrary, type SymbolLibraryProps, type SymbolMetadata, type TelemetryBinding, type TelemetryMap, type TelemetryStatus$1 as TelemetryStatus, type TelemetryValue, ThemeProvider, ThemeToggle, type ThemeToggleProps, type Thresholds, type Transform, TrendLine, type TrendLineProps, type UseDeviceControlsOptions, type UseDragOptions, type UseDragResult, type UseSelectionOptions, type UseSelectionResult, type UseTelemetryOptions, type UseTelemetryResult, type UseTelemetryStatusOptions, type UseViewBoxOptions, type UseViewBoxResult, ValueEntry, type ValueEntryProps, type ViewBox, ZoomButton, ZoomControls, calculateThresholdStatus, createConfigBinding, createControlBinding, exampleDiagram, exportDiagram, generateRoutePoints, getAvailableSymbols, getPortWorldPosition, getSymbolDefinition, importDiagram, mockSymbolLibrary, nodeHasPort, overlayStyles, registerSymbol, registerSymbols, resolveStatusColor, useDeviceConfigs, useDeviceControls, useDrag, useKeyboardShortcuts, useSelection, useSimulation, useTelemetry, useTelemetryStatus, useTheme, useViewBox, validateDiagram };
1999
+ export { type AnchorType, Button, type ButtonProps, CardHeader, CardUnit, CardValue, CircularGauge, type CircularGaugeProps, type CommandKind, type ConfigActions, type ConfigDisplay, type ConfigParameter, type ConfigSection, type ConfigState, type ConfigTheme, type ControlCapabilities, type ControlMode, ControlPanel, type ControlPanelProps, type ControlParameter, type ControlState, type CustomAction, DEFAULT_STATUS_COLORS, DEFAULT_THRESHOLDS, DashboardCard, type DataBinding, type DeviceConfigBinding, type DeviceConfigMap, DeviceConfigPanel, type DeviceConfigPanelProps, type DeviceControlBinding, type DeviceControlMap, DeviceControlPanel, type DeviceControlPanelProps, type DeviceStatus, type Diagram, type DiagramMetadata, type DisplayMode, DisplayModeToggle, type DragPoint, type DragState, EquipmentIndicator, type EquipmentIndicatorProps, EquipmentIndicatorWithSparkline, type EquipmentIndicatorWithSparklineProps, FixedSVGContainer, FooterPanel, FullscreenContainer, FullscreenWorkspace, type FullscreenWorkspaceProps, type FullscreenWorkspaceTab, type KeyboardShortcutsOptions, LeftPanel, LeftToggleButton, LegacyValueEntry, type LegacyValueEntryProps, type ModeConfig, NodeConfigPanel, type NodeConfigPanelProps, type NodeControlConfig, NodeControlsPanel, type NodeControlsPanelProps, type NodeInstance, NumpadDialog, type NumpadDialogProps, type Overlay, type OverlayContent, type OverlayTheme, type OverlayType, PIDCanvas, type PIDCanvasControls, type PIDCanvasFeatures, type PIDCanvasProps, PanelContent, PanelTabs, type PipeEdge, type PipeStyle, type Point, type PortDefinition, type PortInstance, type PortType, RightPanel, RightToggleButton, SVGArea, SVGLockedOverlay, type SVGLockedOverlayProps, type ScalingMetadata, ScrollableSVGWrapper, type SelectionState, Selector, type SelectorOption, type SelectorProps, type SimulationOptions, Sparkline, type SparklineProps, type StatusColorEntry, type StatusColorMap, StatusIndicator, type StatusIndicatorProps, type SymbolCategory, type SymbolDefinition, SymbolLibrary, type SymbolLibraryProps, type SymbolMetadata, type TelemetryBinding, type TelemetryMap, type TelemetryStatus$1 as TelemetryStatus, type TelemetryValue, ThemeProvider, ThemeToggle, type ThemeToggleProps, type Thresholds, type Transform, TrendLine, type TrendLineProps, type UseDeviceControlsOptions, type UseDragOptions, type UseDragResult, type UseSelectionOptions, type UseSelectionResult, type UseTelemetryOptions, type UseTelemetryResult, type UseTelemetryStatusOptions, type UseViewBoxOptions, type UseViewBoxResult, ValueEntry, type ValueEntryProps, type ViewBox, ZoomButton, ZoomControls, calculateThresholdStatus, createConfigBinding, createControlBinding, exampleDiagram, exportDiagram, generateRoutePoints, getAvailableSymbols, getPortWorldPosition, getSymbolDefinition, importDiagram, mockSymbolLibrary, nodeHasPort, overlayStyles, registerSymbol, registerSymbols, resolveStatusColor, useDeviceConfigs, useDeviceControls, useDrag, useKeyboardShortcuts, useSelection, useSimulation, useTelemetry, useTelemetryStatus, useTheme, useViewBox, validateDiagram };
package/dist/index.d.ts CHANGED
@@ -374,6 +374,30 @@ interface NodeControlsPanelProps extends react__default.HTMLAttributes<HTMLDivEl
374
374
  */
375
375
  declare const NodeControlsPanel: react__default.FC<NodeControlsPanelProps>;
376
376
 
377
+ /**
378
+ * A custom action button rendered in the device control panel (e.g. Tare, Zero).
379
+ */
380
+ interface CustomAction {
381
+ /** Stable action id passed to onCustomAction when clicked. */
382
+ id: string;
383
+ /** Button label. */
384
+ label: string;
385
+ /** Optional leading icon / emoji. */
386
+ icon?: string;
387
+ /** Visual variant (reserved for future styling). */
388
+ variant?: 'primary' | 'secondary' | 'alarm' | 'warning';
389
+ /**
390
+ * When true, the button renders disabled and does NOT fire onCustomAction.
391
+ * Use for actions that are only conditionally available (e.g. a Tare that is
392
+ * not ready).
393
+ */
394
+ disabled?: boolean;
395
+ /**
396
+ * Tooltip shown on hover explaining why the action is unavailable. Only
397
+ * meaningful when `disabled` is true.
398
+ */
399
+ disabledReason?: string;
400
+ }
377
401
  /**
378
402
  * Device control capabilities and commands
379
403
  */
@@ -387,12 +411,7 @@ interface ControlCapabilities {
387
411
  /** Can the device be reset? */
388
412
  canReset?: boolean;
389
413
  /** Custom actions available */
390
- customActions?: Array<{
391
- id: string;
392
- label: string;
393
- icon?: string;
394
- variant?: 'primary' | 'secondary' | 'alarm' | 'warning';
395
- }>;
414
+ customActions?: CustomAction[];
396
415
  }
397
416
  /**
398
417
  * Device control mode option
@@ -576,10 +595,7 @@ declare function createControlBinding(nodeId: string, deviceConfig: {
576
595
  capabilities?: {
577
596
  canStart?: boolean;
578
597
  canStop?: boolean;
579
- customActions?: Array<{
580
- id: string;
581
- label: string;
582
- }>;
598
+ customActions?: CustomAction[];
583
599
  };
584
600
  status?: string;
585
601
  isRunning?: boolean;
@@ -1980,4 +1996,4 @@ interface SimulationOptions {
1980
1996
  */
1981
1997
  declare function useSimulation(telemetry: TelemetryMap, updateTelemetryBatch: (updates: Array<any>) => void, options?: SimulationOptions): void;
1982
1998
 
1983
- export { type AnchorType, Button, type ButtonProps, CardHeader, CardUnit, CardValue, CircularGauge, type CircularGaugeProps, type CommandKind, type ConfigActions, type ConfigDisplay, type ConfigParameter, type ConfigSection, type ConfigState, type ConfigTheme, type ControlCapabilities, type ControlMode, ControlPanel, type ControlPanelProps, type ControlParameter, type ControlState, DEFAULT_STATUS_COLORS, DEFAULT_THRESHOLDS, DashboardCard, type DataBinding, type DeviceConfigBinding, type DeviceConfigMap, DeviceConfigPanel, type DeviceConfigPanelProps, type DeviceControlBinding, type DeviceControlMap, DeviceControlPanel, type DeviceControlPanelProps, type DeviceStatus, type Diagram, type DiagramMetadata, type DisplayMode, DisplayModeToggle, type DragPoint, type DragState, EquipmentIndicator, type EquipmentIndicatorProps, EquipmentIndicatorWithSparkline, type EquipmentIndicatorWithSparklineProps, FixedSVGContainer, FooterPanel, FullscreenContainer, FullscreenWorkspace, type FullscreenWorkspaceProps, type FullscreenWorkspaceTab, type KeyboardShortcutsOptions, LeftPanel, LeftToggleButton, LegacyValueEntry, type LegacyValueEntryProps, type ModeConfig, NodeConfigPanel, type NodeConfigPanelProps, type NodeControlConfig, NodeControlsPanel, type NodeControlsPanelProps, type NodeInstance, NumpadDialog, type NumpadDialogProps, type Overlay, type OverlayContent, type OverlayTheme, type OverlayType, PIDCanvas, type PIDCanvasControls, type PIDCanvasFeatures, type PIDCanvasProps, PanelContent, PanelTabs, type PipeEdge, type PipeStyle, type Point, type PortDefinition, type PortInstance, type PortType, RightPanel, RightToggleButton, SVGArea, SVGLockedOverlay, type SVGLockedOverlayProps, type ScalingMetadata, ScrollableSVGWrapper, type SelectionState, Selector, type SelectorOption, type SelectorProps, type SimulationOptions, Sparkline, type SparklineProps, type StatusColorEntry, type StatusColorMap, StatusIndicator, type StatusIndicatorProps, type SymbolCategory, type SymbolDefinition, SymbolLibrary, type SymbolLibraryProps, type SymbolMetadata, type TelemetryBinding, type TelemetryMap, type TelemetryStatus$1 as TelemetryStatus, type TelemetryValue, ThemeProvider, ThemeToggle, type ThemeToggleProps, type Thresholds, type Transform, TrendLine, type TrendLineProps, type UseDeviceControlsOptions, type UseDragOptions, type UseDragResult, type UseSelectionOptions, type UseSelectionResult, type UseTelemetryOptions, type UseTelemetryResult, type UseTelemetryStatusOptions, type UseViewBoxOptions, type UseViewBoxResult, ValueEntry, type ValueEntryProps, type ViewBox, ZoomButton, ZoomControls, calculateThresholdStatus, createConfigBinding, createControlBinding, exampleDiagram, exportDiagram, generateRoutePoints, getAvailableSymbols, getPortWorldPosition, getSymbolDefinition, importDiagram, mockSymbolLibrary, nodeHasPort, overlayStyles, registerSymbol, registerSymbols, resolveStatusColor, useDeviceConfigs, useDeviceControls, useDrag, useKeyboardShortcuts, useSelection, useSimulation, useTelemetry, useTelemetryStatus, useTheme, useViewBox, validateDiagram };
1999
+ export { type AnchorType, Button, type ButtonProps, CardHeader, CardUnit, CardValue, CircularGauge, type CircularGaugeProps, type CommandKind, type ConfigActions, type ConfigDisplay, type ConfigParameter, type ConfigSection, type ConfigState, type ConfigTheme, type ControlCapabilities, type ControlMode, ControlPanel, type ControlPanelProps, type ControlParameter, type ControlState, type CustomAction, DEFAULT_STATUS_COLORS, DEFAULT_THRESHOLDS, DashboardCard, type DataBinding, type DeviceConfigBinding, type DeviceConfigMap, DeviceConfigPanel, type DeviceConfigPanelProps, type DeviceControlBinding, type DeviceControlMap, DeviceControlPanel, type DeviceControlPanelProps, type DeviceStatus, type Diagram, type DiagramMetadata, type DisplayMode, DisplayModeToggle, type DragPoint, type DragState, EquipmentIndicator, type EquipmentIndicatorProps, EquipmentIndicatorWithSparkline, type EquipmentIndicatorWithSparklineProps, FixedSVGContainer, FooterPanel, FullscreenContainer, FullscreenWorkspace, type FullscreenWorkspaceProps, type FullscreenWorkspaceTab, type KeyboardShortcutsOptions, LeftPanel, LeftToggleButton, LegacyValueEntry, type LegacyValueEntryProps, type ModeConfig, NodeConfigPanel, type NodeConfigPanelProps, type NodeControlConfig, NodeControlsPanel, type NodeControlsPanelProps, type NodeInstance, NumpadDialog, type NumpadDialogProps, type Overlay, type OverlayContent, type OverlayTheme, type OverlayType, PIDCanvas, type PIDCanvasControls, type PIDCanvasFeatures, type PIDCanvasProps, PanelContent, PanelTabs, type PipeEdge, type PipeStyle, type Point, type PortDefinition, type PortInstance, type PortType, RightPanel, RightToggleButton, SVGArea, SVGLockedOverlay, type SVGLockedOverlayProps, type ScalingMetadata, ScrollableSVGWrapper, type SelectionState, Selector, type SelectorOption, type SelectorProps, type SimulationOptions, Sparkline, type SparklineProps, type StatusColorEntry, type StatusColorMap, StatusIndicator, type StatusIndicatorProps, type SymbolCategory, type SymbolDefinition, SymbolLibrary, type SymbolLibraryProps, type SymbolMetadata, type TelemetryBinding, type TelemetryMap, type TelemetryStatus$1 as TelemetryStatus, type TelemetryValue, ThemeProvider, ThemeToggle, type ThemeToggleProps, type Thresholds, type Transform, TrendLine, type TrendLineProps, type UseDeviceControlsOptions, type UseDragOptions, type UseDragResult, type UseSelectionOptions, type UseSelectionResult, type UseTelemetryOptions, type UseTelemetryResult, type UseTelemetryStatusOptions, type UseViewBoxOptions, type UseViewBoxResult, ValueEntry, type ValueEntryProps, type ViewBox, ZoomButton, ZoomControls, calculateThresholdStatus, createConfigBinding, createControlBinding, exampleDiagram, exportDiagram, generateRoutePoints, getAvailableSymbols, getPortWorldPosition, getSymbolDefinition, importDiagram, mockSymbolLibrary, nodeHasPort, overlayStyles, registerSymbol, registerSymbols, resolveStatusColor, useDeviceConfigs, useDeviceControls, useDrag, useKeyboardShortcuts, useSelection, useSimulation, useTelemetry, useTelemetryStatus, useTheme, useViewBox, validateDiagram };
package/dist/index.js CHANGED
@@ -1755,33 +1755,41 @@ function DeviceControlPanel({
1755
1755
  }
1756
1756
  )
1757
1757
  ] }),
1758
- activeCapabilities?.customActions && activeCapabilities.customActions.length > 0 && /* @__PURE__ */ jsx8("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: activeCapabilities.customActions.map((action) => /* @__PURE__ */ jsxs7(
1759
- "button",
1760
- {
1761
- onClick: () => onCustomAction?.(action.id),
1762
- style: {
1763
- flex: 1,
1764
- minWidth: "120px",
1765
- height: touchSize,
1766
- backgroundColor: surfaceColor,
1767
- color: textColor,
1768
- border: `1px solid ${borderColor}`,
1769
- borderRadius: "6px",
1770
- fontSize: "11px",
1771
- fontWeight: 600,
1772
- fontFamily: "monospace",
1773
- letterSpacing: "0.5px",
1774
- textTransform: "uppercase",
1775
- cursor: "pointer",
1776
- transition: "all 0.15s"
1758
+ activeCapabilities?.customActions && activeCapabilities.customActions.length > 0 && /* @__PURE__ */ jsx8("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: activeCapabilities.customActions.map((action) => {
1759
+ const actionDisabled = action.disabled === true;
1760
+ return /* @__PURE__ */ jsxs7(
1761
+ "button",
1762
+ {
1763
+ onClick: () => {
1764
+ if (!actionDisabled) onCustomAction?.(action.id);
1765
+ },
1766
+ disabled: actionDisabled,
1767
+ title: actionDisabled ? action.disabledReason : void 0,
1768
+ style: {
1769
+ flex: 1,
1770
+ minWidth: "120px",
1771
+ height: touchSize,
1772
+ backgroundColor: surfaceColor,
1773
+ color: textColor,
1774
+ border: `1px solid ${borderColor}`,
1775
+ borderRadius: "6px",
1776
+ fontSize: "11px",
1777
+ fontWeight: 600,
1778
+ fontFamily: "monospace",
1779
+ letterSpacing: "0.5px",
1780
+ textTransform: "uppercase",
1781
+ cursor: actionDisabled ? "not-allowed" : "pointer",
1782
+ opacity: actionDisabled ? 0.4 : 1,
1783
+ transition: "all 0.15s"
1784
+ },
1785
+ children: [
1786
+ action.icon && /* @__PURE__ */ jsx8("span", { style: { marginRight: "6px" }, children: action.icon }),
1787
+ action.label
1788
+ ]
1777
1789
  },
1778
- children: [
1779
- action.icon && /* @__PURE__ */ jsx8("span", { style: { marginRight: "6px" }, children: action.icon }),
1780
- action.label
1781
- ]
1782
- },
1783
- action.id
1784
- )) })
1790
+ action.id
1791
+ );
1792
+ }) })
1785
1793
  ] }),
1786
1794
  binding.state.lastCommandResult && showToast && /* @__PURE__ */ jsx8(
1787
1795
  "div",