@almadar/ui 3.3.1 → 3.5.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.
Files changed (61) hide show
  1. package/dist/avl/index.cjs +67 -30
  2. package/dist/avl/index.js +67 -30
  3. package/dist/components/atoms/Avatar.d.ts +3 -2
  4. package/dist/components/atoms/Box.d.ts +4 -3
  5. package/dist/components/atoms/Button.d.ts +3 -2
  6. package/dist/components/atoms/InfiniteScrollSentinel.d.ts +3 -2
  7. package/dist/components/atoms/Input.d.ts +3 -2
  8. package/dist/components/atoms/Overlay.d.ts +2 -1
  9. package/dist/components/atoms/Radio.d.ts +2 -1
  10. package/dist/components/atoms/RangeSlider.d.ts +3 -2
  11. package/dist/components/atoms/Select.d.ts +2 -1
  12. package/dist/components/atoms/Stack.d.ts +3 -2
  13. package/dist/components/atoms/TextHighlight.d.ts +3 -2
  14. package/dist/components/atoms/Textarea.d.ts +2 -1
  15. package/dist/components/atoms/game/ControlButton.d.ts +3 -2
  16. package/dist/components/atoms/game/Sprite.d.ts +2 -1
  17. package/dist/components/index.cjs +67 -27
  18. package/dist/components/index.js +67 -27
  19. package/dist/components/molecules/Alert.d.ts +2 -1
  20. package/dist/components/molecules/CalendarGrid.d.ts +2 -1
  21. package/dist/components/molecules/Card.d.ts +3 -2
  22. package/dist/components/molecules/DataGrid.d.ts +4 -3
  23. package/dist/components/molecules/DataList.d.ts +7 -6
  24. package/dist/components/molecules/Drawer.d.ts +2 -1
  25. package/dist/components/molecules/NumberStepper.d.ts +3 -2
  26. package/dist/components/molecules/PullToRefresh.d.ts +3 -2
  27. package/dist/components/molecules/SortableList.d.ts +5 -4
  28. package/dist/components/molecules/StarRating.d.ts +3 -2
  29. package/dist/components/molecules/SwipeableRow.d.ts +4 -3
  30. package/dist/components/molecules/UploadDropZone.d.ts +3 -2
  31. package/dist/components/molecules/game/DialogueBox.d.ts +3 -2
  32. package/dist/components/molecules/game/GameMenu.d.ts +4 -3
  33. package/dist/components/molecules/game/GameOverScreen.d.ts +3 -2
  34. package/dist/components/molecules/game/InventoryPanel.d.ts +3 -2
  35. package/dist/components/organisms/CardGrid.d.ts +3 -2
  36. package/dist/components/organisms/CustomPattern.d.ts +5 -4
  37. package/dist/components/organisms/DataTable.d.ts +2 -1
  38. package/dist/components/organisms/Form.d.ts +3 -2
  39. package/dist/components/organisms/GraphCanvas.d.ts +3 -2
  40. package/dist/components/organisms/List.d.ts +4 -2
  41. package/dist/components/organisms/Timeline.d.ts +2 -1
  42. package/dist/components/organisms/game/three/index.cjs +0 -3
  43. package/dist/components/organisms/game/three/index.js +0 -3
  44. package/dist/docs/index.cjs +0 -3
  45. package/dist/docs/index.d.cts +10 -9
  46. package/dist/docs/index.js +0 -3
  47. package/dist/hooks/event-bus-types.d.ts +10 -10
  48. package/dist/hooks/index.cjs +0 -3
  49. package/dist/hooks/index.js +0 -3
  50. package/dist/hooks/useDraggable.d.ts +2 -1
  51. package/dist/hooks/useEventBus.d.ts +2 -1
  52. package/dist/lib/verificationRegistry.d.ts +2 -2
  53. package/dist/marketing/index.cjs +0 -3
  54. package/dist/marketing/index.d.cts +8 -7
  55. package/dist/marketing/index.js +0 -3
  56. package/dist/providers/index.cjs +67 -30
  57. package/dist/providers/index.js +67 -30
  58. package/dist/runtime/createClientEffectHandlers.d.ts +2 -1
  59. package/dist/runtime/index.cjs +67 -27
  60. package/dist/runtime/index.js +67 -27
  61. package/package.json +3 -3
@@ -1,5 +1,6 @@
1
+ import type { EventKey, EventPayload } from "@almadar/core";
1
2
  import { type EventBusContextType } from "../../../hooks/useEventBus";
2
- export interface MenuOption {
3
+ export type MenuOption = EventPayload & {
3
4
  /** Optional ID (generated from index if not provided) */
4
5
  id?: string;
5
6
  /** Display label */
@@ -15,8 +16,8 @@ export interface MenuOption {
15
16
  /** Sub-label or description */
16
17
  subLabel?: string;
17
18
  /** Action identifier (alternative to event) */
18
- action?: string;
19
- }
19
+ action?: EventKey;
20
+ };
20
21
  export interface GameMenuProps {
21
22
  /** Menu title */
22
23
  title: string;
@@ -1,4 +1,5 @@
1
1
  import * as React from "react";
2
+ import type { EventPayload } from "@almadar/core";
2
3
  import { type EventBusContextType } from "../../../hooks/useEventBus";
3
4
  export interface GameOverStat {
4
5
  /** Stat label */
@@ -16,7 +17,7 @@ export interface GameOverStat {
16
17
  /** Icon */
17
18
  icon?: React.ReactNode;
18
19
  }
19
- export interface GameOverAction {
20
+ export type GameOverAction = EventPayload & {
20
21
  /** Display label */
21
22
  label: string;
22
23
  /** Event to emit on click */
@@ -25,7 +26,7 @@ export interface GameOverAction {
25
26
  navigatesTo?: string;
26
27
  /** Button variant */
27
28
  variant?: "primary" | "secondary" | "ghost";
28
- }
29
+ };
29
30
  export interface GameOverScreenProps {
30
31
  /** Screen title (e.g., "Game Over", "Victory!") */
31
32
  title: string;
@@ -11,14 +11,15 @@
11
11
  * Local state is hover/tooltip only — rendering-only concerns.
12
12
  */
13
13
  import React from 'react';
14
- export interface InventoryItem {
14
+ import type { EventPayload } from "@almadar/core";
15
+ export type InventoryItem = EventPayload & {
15
16
  id: string;
16
17
  type: string;
17
18
  quantity: number;
18
19
  sprite?: string;
19
20
  name?: string;
20
21
  description?: string;
21
- }
22
+ };
22
23
  export interface InventoryPanelProps {
23
24
  /** Array of items in inventory */
24
25
  items: InventoryItem[];
@@ -9,6 +9,7 @@
9
9
  * for pagination, filtering, or search. All state is owned by the trait state machine.
10
10
  */
11
11
  import React from 'react';
12
+ import type { EventKey } from "@almadar/core";
12
13
  import type { EntityDisplayProps } from './types';
13
14
  export type CardGridGap = 'none' | 'sm' | 'md' | 'lg' | 'xl';
14
15
  /**
@@ -18,13 +19,13 @@ export interface CardItemAction {
18
19
  /** Action button label */
19
20
  label: string;
20
21
  /** Event to dispatch on click (schema metadata) */
21
- event?: string;
22
+ event?: EventKey;
22
23
  /** Navigation URL - supports template interpolation like "/products/{{row.id}}" */
23
24
  navigatesTo?: string;
24
25
  /** Callback on click */
25
26
  onClick?: (item: unknown) => void;
26
27
  /** Action used by generated code - alternative to event */
27
- action?: string;
28
+ action?: EventKey;
28
29
  /** Action placement - accepts string for compatibility with generated code */
29
30
  placement?: 'card' | 'footer' | 'row' | string;
30
31
  /** Button variant - accepts string for compatibility with generated code */
@@ -8,6 +8,7 @@
8
8
  * @packageDocumentation
9
9
  */
10
10
  import React from "react";
11
+ import type { EventKey, EventPayload } from "@almadar/core";
11
12
  /**
12
13
  * Allowed element types for custom patterns.
13
14
  */
@@ -31,9 +32,9 @@ export interface CustomPatternProps {
31
32
  /** Text content (for leaf elements) */
32
33
  content?: string;
33
34
  /** Event to emit on click (REQUIRED for interactive elements) */
34
- action?: string;
35
+ action?: EventKey;
35
36
  /** Event payload */
36
- payload?: Record<string, unknown>;
37
+ payload?: EventPayload;
37
38
  /** Nested children patterns */
38
39
  children?: React.ReactNode;
39
40
  /** Image source (for img elements) */
@@ -81,8 +82,8 @@ export interface CustomPatternConfig {
81
82
  className?: string;
82
83
  token?: string | string[];
83
84
  content?: string;
84
- action?: string;
85
- payload?: Record<string, unknown>;
85
+ action?: EventKey;
86
+ payload?: EventPayload;
86
87
  children?: CustomPatternConfig[];
87
88
  src?: string;
88
89
  alt?: string;
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import type { EventKey } from "@almadar/core";
2
3
  import { LucideIcon } from "lucide-react";
3
4
  import { EntityDisplayProps } from "./types";
4
5
  import type { EntityRow } from "@almadar/core";
@@ -33,7 +34,7 @@ export interface DataTableProps<T extends EntityRow & {
33
34
  label: string;
34
35
  event?: string;
35
36
  navigatesTo?: string;
36
- action?: string;
37
+ action?: EventKey;
37
38
  placement?: "row" | "bulk" | string;
38
39
  icon?: LucideIcon;
39
40
  variant?: "default" | "primary" | "secondary" | "ghost" | "danger" | string;
@@ -12,6 +12,7 @@
12
12
  * - Nested sections with collapsible support
13
13
  */
14
14
  import React from "react";
15
+ import type { EventKey } from "@almadar/core";
15
16
  import { type SelectOption } from "../atoms/Select";
16
17
  import { type RelationOption } from "../molecules/RelationSelect";
17
18
  import type { OrbitalEntity } from "@almadar/core";
@@ -173,9 +174,9 @@ export interface FormProps extends Omit<React.FormHTMLAttributes<HTMLFormElement
173
174
  /** Form title (used by ModalSlot to extract title) */
174
175
  title?: string;
175
176
  /** Event to dispatch on successful submit (defaults to 'SAVE') */
176
- submitEvent?: string;
177
+ submitEvent?: EventKey;
177
178
  /** Event to dispatch on cancel (defaults to 'CANCEL') */
178
- cancelEvent?: string;
179
+ cancelEvent?: EventKey;
179
180
  /** Entity ID binding for edit mode (triggers initialData from selectedEntity in compiled code) */
180
181
  entityId?: string;
181
182
  /** Data for relation fields: { fieldName: RelationOption[] } */
@@ -11,7 +11,8 @@
11
11
  * - className for external styling
12
12
  */
13
13
  import React from "react";
14
- export interface GraphNode {
14
+ import type { EventPayload } from "@almadar/core";
15
+ export type GraphNode = EventPayload & {
15
16
  id: string;
16
17
  label?: string;
17
18
  group?: string;
@@ -20,7 +21,7 @@ export interface GraphNode {
20
21
  /** Position (optional, computed if missing) */
21
22
  x?: number;
22
23
  y?: number;
23
- }
24
+ };
24
25
  export interface GraphEdge {
25
26
  source: string;
26
27
  target: string;
@@ -17,6 +17,7 @@
17
17
  * - No internal search/filter state — trait provides filtered data
18
18
  */
19
19
  import React from "react";
20
+ import type { EventKey } from "@almadar/core";
20
21
  import type { LucideIcon } from "lucide-react";
21
22
  import { type MenuItem } from "../molecules/Menu";
22
23
  import type { EntityDisplayProps } from "./types";
@@ -41,11 +42,12 @@ export interface ListItem {
41
42
  export interface SchemaItemAction {
42
43
  label: string;
43
44
  /** Event to dispatch on click */
44
- event?: string;
45
+ event?: EventKey;
45
46
  navigatesTo?: string;
46
47
  /** Action placement - accepts all common placement values */
47
48
  placement?: "row" | "bulk" | "card" | "footer" | string;
48
- action?: string;
49
+ /** Alternate event-dispatch field (same semantics as `event`) — generated code emits `UI:{action}` on click */
50
+ action?: EventKey;
49
51
  variant?: "primary" | "secondary" | "ghost" | "danger" | "default";
50
52
  /** Click handler from generated code */
51
53
  onClick?: (row: unknown) => void;
@@ -11,6 +11,7 @@
11
11
  * - className for external styling
12
12
  */
13
13
  import React from "react";
14
+ import type { EventKey } from "@almadar/core";
14
15
  import type { EntityRow } from "@almadar/core";
15
16
  import type { LucideIcon } from "lucide-react";
16
17
  export type TimelineItemStatus = "complete" | "active" | "pending" | "error";
@@ -32,7 +33,7 @@ export interface TimelineItem {
32
33
  }
33
34
  export interface TimelineAction {
34
35
  label: string;
35
- event?: string;
36
+ event?: EventKey;
36
37
  navigatesTo?: string;
37
38
  variant?: "primary" | "secondary" | "ghost";
38
39
  }
@@ -1439,9 +1439,6 @@ var fallbackEventBus = {
1439
1439
  emit: (type, payload, source) => {
1440
1440
  const event = {
1441
1441
  type,
1442
- // Narrow at the bus boundary: public emit accepts an opaque object so
1443
- // generic UI emit sites don't require casts; the envelope stores the
1444
- // payload as EventPayload which listeners consume directly.
1445
1442
  payload,
1446
1443
  timestamp: Date.now(),
1447
1444
  source
@@ -1415,9 +1415,6 @@ var fallbackEventBus = {
1415
1415
  emit: (type, payload, source) => {
1416
1416
  const event = {
1417
1417
  type,
1418
- // Narrow at the bus boundary: public emit accepts an opaque object so
1419
- // generic UI emit sites don't require casts; the envelope stores the
1420
- // payload as EventPayload which listeners consume directly.
1421
1418
  payload,
1422
1419
  timestamp: Date.now(),
1423
1420
  source
@@ -2573,9 +2573,6 @@ var fallbackEventBus = {
2573
2573
  emit: (type, payload, source) => {
2574
2574
  const event = {
2575
2575
  type,
2576
- // Narrow at the bus boundary: public emit accepts an opaque object so
2577
- // generic UI emit sites don't require casts; the envelope stores the
2578
- // payload as EventPayload which listeners consume directly.
2579
2576
  payload,
2580
2577
  timestamp: Date.now(),
2581
2578
  source
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { EventKey, EventPayload } from '@almadar/core';
2
3
  import { LucideIcon } from 'lucide-react';
3
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
5
 
@@ -48,11 +49,11 @@ interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {
48
49
  /** HTML element to render as */
49
50
  as?: React.ElementType;
50
51
  /** Declarative event name — emits UI:{action} via eventBus on click */
51
- action?: string;
52
+ action?: EventKey;
52
53
  /** Payload to include with the action event */
53
- actionPayload?: Record<string, unknown>;
54
+ actionPayload?: EventPayload;
54
55
  /** Declarative hover event — emits UI:{hoverEvent} with { hovered: true/false } on mouseEnter/mouseLeave */
55
- hoverEvent?: string;
56
+ hoverEvent?: EventKey;
56
57
  /** Maximum width (CSS value, e.g., "550px", "80rem") */
57
58
  maxWidth?: string;
58
59
  /** Children elements */
@@ -106,9 +107,9 @@ interface StackProps {
106
107
  /** Tab index for focus management */
107
108
  tabIndex?: number;
108
109
  /** Declarative event name — emits UI:{action} via eventBus on click */
109
- action?: string;
110
+ action?: EventKey;
110
111
  /** Payload to include with the action event */
111
- actionPayload?: Record<string, unknown>;
112
+ actionPayload?: EventPayload;
112
113
  /** When true, horizontal stacks flip to vertical below the md breakpoint (768px) */
113
114
  responsive?: boolean;
114
115
  }
@@ -180,9 +181,9 @@ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
180
181
  /** Alias for rightIcon */
181
182
  iconRight?: React.ReactNode | LucideIcon | string;
182
183
  /** Declarative event name — emits UI:{action} via eventBus on click */
183
- action?: string;
184
+ action?: EventKey;
184
185
  /** Payload to include with the action event */
185
- actionPayload?: Record<string, unknown>;
186
+ actionPayload?: EventPayload;
186
187
  /** Button label text (alternative to children for schema-driven rendering) */
187
188
  label?: string;
188
189
  }
@@ -276,7 +277,7 @@ interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "
276
277
  /** Whether input is disabled */
277
278
  disabled?: boolean;
278
279
  /** Declarative event name for trait dispatch */
279
- action?: string;
280
+ action?: EventKey;
280
281
  /** Input type - supports 'select' and 'textarea' in addition to standard types */
281
282
  inputType?: "text" | "email" | "password" | "number" | "tel" | "url" | "search" | "date" | "datetime-local" | "time" | "checkbox" | "select" | "textarea";
282
283
  error?: string;
@@ -295,7 +296,7 @@ interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "
295
296
  /** onChange handler - accepts events from input, select, or textarea */
296
297
  onChange?: React.ChangeEventHandler<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>;
297
298
  }
298
- declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>>;
299
+ declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>>;
299
300
 
300
301
  /**
301
302
  * DocSidebar Molecule Component
@@ -2549,9 +2549,6 @@ var fallbackEventBus = {
2549
2549
  emit: (type, payload, source) => {
2550
2550
  const event = {
2551
2551
  type,
2552
- // Narrow at the bus boundary: public emit accepts an opaque object so
2553
- // generic UI emit sites don't require casts; the envelope stores the
2554
- // payload as EventPayload which listeners consume directly.
2555
2552
  payload,
2556
2553
  timestamp: Date.now(),
2557
2554
  source
@@ -7,28 +7,28 @@
7
7
  *
8
8
  * @packageDocumentation
9
9
  */
10
- import type { BusEvent, BusEventSource, BusEventListener, Unsubscribe } from "@almadar/core";
11
- export type { BusEvent, BusEventSource, Unsubscribe };
10
+ import type { BusEvent, BusEventSource, BusEventListener, EventPayload, Unsubscribe } from "@almadar/core";
11
+ export type { BusEvent, BusEventSource, EventPayload, Unsubscribe };
12
12
  export type EventListener = BusEventListener;
13
13
  /**
14
14
  * Event bus context type.
15
15
  *
16
- * `emit` accepts `Record<string, unknown>` on its public surface so
17
- * generic UI components (DataGrid, SortableList, ...) can pass
18
- * consumer-defined row data without a cast at every emit site. The
19
- * envelope stored in `BusEvent.payload` is narrowed to `EventPayload`
20
- * inside the bus implementation listeners always receive the typed
21
- * shape.
16
+ * `emit` accepts `EventPayload` from `@almadar/core` the canonical
17
+ * object shape (index signature over `EventPayloadValue`) that the bus
18
+ * envelope stores and listeners consume. Pattern-specific payload types
19
+ * from `@almadar/patterns` (`ItemActionPayload`, `SelectionChangePayload`,
20
+ * `FormSubmitPayload`, ...) are structural subtypes of `EventPayload`,
21
+ * so components can pass them in without casts.
22
22
  */
23
23
  export interface EventBusContextType {
24
24
  /**
25
25
  * Emit an event to all listeners.
26
26
  *
27
27
  * @param type - Event type identifier
28
- * @param payload - Optional payload data (object-shaped)
28
+ * @param payload - Optional payload data (shape matches {@link EventPayload})
29
29
  * @param source - Optional origin info (orbital/trait/...)
30
30
  */
31
- emit: (type: string, payload?: Record<string, unknown>, source?: BusEventSource) => void;
31
+ emit: (type: string, payload?: EventPayload, source?: BusEventSource) => void;
32
32
  /**
33
33
  * Subscribe to an event type.
34
34
  *
@@ -938,9 +938,6 @@ var fallbackEventBus = {
938
938
  emit: (type, payload, source) => {
939
939
  const event = {
940
940
  type,
941
- // Narrow at the bus boundary: public emit accepts an opaque object so
942
- // generic UI emit sites don't require casts; the envelope stores the
943
- // payload as EventPayload which listeners consume directly.
944
941
  payload,
945
942
  timestamp: Date.now(),
946
943
  source
@@ -932,9 +932,6 @@ var fallbackEventBus = {
932
932
  emit: (type, payload, source) => {
933
933
  const event = {
934
934
  type,
935
- // Narrow at the bus boundary: public emit accepts an opaque object so
936
- // generic UI emit sites don't require casts; the envelope stores the
937
- // payload as EventPayload which listeners consume directly.
938
935
  payload,
939
936
  timestamp: Date.now(),
940
937
  source
@@ -1,7 +1,8 @@
1
+ import type { EventPayload } from '@almadar/core';
1
2
  /** Discriminated payload carried by every drag operation. */
2
3
  export interface DraggablePayload {
3
4
  kind: 'pattern' | 'behavior' | 'tree-node' | 'event-wire';
4
- data: Record<string, unknown>;
5
+ data: EventPayload;
5
6
  }
6
7
  export interface UseDraggableOptions {
7
8
  /** The payload that will be serialised into dataTransfer. */
@@ -1,4 +1,5 @@
1
1
  import type { BusEvent, BusEventSource, EventListener, Unsubscribe, EventBusContextType } from './event-bus-types';
2
+ import type { EventPayload } from '@almadar/core';
2
3
  export type { BusEvent, BusEventSource, EventListener, Unsubscribe, EventBusContextType };
3
4
  declare global {
4
5
  interface Window {
@@ -92,5 +93,5 @@ export declare const useEventSubscription: typeof useEventListener;
92
93
  * };
93
94
  * ```
94
95
  */
95
- export declare function useEmitEvent(): (type: string, payload?: Record<string, unknown>, source?: BusEventSource) => void;
96
+ export declare function useEmitEvent(): (type: string, payload?: EventPayload, source?: BusEventSource) => void;
96
97
  export default useEventBus;
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * @packageDocumentation
11
11
  */
12
- import type { AssetLoadStatus, BridgeHealth, BusEvent, CheckStatus, EffectTrace, EventLogEntry, OrbitalVerificationAPI, ServerResponseTrace, TraitStateSnapshot, TransitionTrace, VerificationCheck, VerificationSnapshot, VerificationSummary } from '@almadar/core';
12
+ import type { AssetLoadStatus, BridgeHealth, BusEvent, CheckStatus, EffectTrace, EventLogEntry, EventPayload, OrbitalVerificationAPI, ServerResponseTrace, TraitStateSnapshot, TransitionTrace, VerificationCheck, VerificationSnapshot, VerificationSummary } from '@almadar/core';
13
13
  export type { AssetLoadStatus, BridgeHealth, CheckStatus, EffectTrace, EventLogEntry, OrbitalVerificationAPI, ServerResponseTrace, TraitStateSnapshot, TransitionTrace, VerificationCheck, VerificationSnapshot, VerificationSummary, };
14
14
  type ChangeListener = () => void;
15
15
  /**
@@ -59,7 +59,7 @@ export declare function waitForTransition(event: string, timeoutMs?: number): Pr
59
59
  * Call this during app initialization.
60
60
  */
61
61
  export declare function bindEventBus(eventBus: {
62
- emit: (type: string, payload?: Record<string, unknown>) => void;
62
+ emit: (type: string, payload?: EventPayload) => void;
63
63
  onAny?: (listener: (event: BusEvent) => void) => () => void;
64
64
  }): void;
65
65
  /**
@@ -2573,9 +2573,6 @@ var fallbackEventBus = {
2573
2573
  emit: (type, payload, source) => {
2574
2574
  const event = {
2575
2575
  type,
2576
- // Narrow at the bus boundary: public emit accepts an opaque object so
2577
- // generic UI emit sites don't require casts; the envelope stores the
2578
- // payload as EventPayload which listeners consume directly.
2579
2576
  payload,
2580
2577
  timestamp: Date.now(),
2581
2578
  source
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { EventKey, EventPayload } from '@almadar/core';
2
3
  import { LucideIcon } from 'lucide-react';
3
4
 
4
5
  /**
@@ -47,11 +48,11 @@ interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {
47
48
  /** HTML element to render as */
48
49
  as?: React.ElementType;
49
50
  /** Declarative event name — emits UI:{action} via eventBus on click */
50
- action?: string;
51
+ action?: EventKey;
51
52
  /** Payload to include with the action event */
52
- actionPayload?: Record<string, unknown>;
53
+ actionPayload?: EventPayload;
53
54
  /** Declarative hover event — emits UI:{hoverEvent} with { hovered: true/false } on mouseEnter/mouseLeave */
54
- hoverEvent?: string;
55
+ hoverEvent?: EventKey;
55
56
  /** Maximum width (CSS value, e.g., "550px", "80rem") */
56
57
  maxWidth?: string;
57
58
  /** Children elements */
@@ -105,9 +106,9 @@ interface StackProps {
105
106
  /** Tab index for focus management */
106
107
  tabIndex?: number;
107
108
  /** Declarative event name — emits UI:{action} via eventBus on click */
108
- action?: string;
109
+ action?: EventKey;
109
110
  /** Payload to include with the action event */
110
- actionPayload?: Record<string, unknown>;
111
+ actionPayload?: EventPayload;
111
112
  /** When true, horizontal stacks flip to vertical below the md breakpoint (768px) */
112
113
  responsive?: boolean;
113
114
  }
@@ -179,9 +180,9 @@ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
179
180
  /** Alias for rightIcon */
180
181
  iconRight?: React.ReactNode | LucideIcon | string;
181
182
  /** Declarative event name — emits UI:{action} via eventBus on click */
182
- action?: string;
183
+ action?: EventKey;
183
184
  /** Payload to include with the action event */
184
- actionPayload?: Record<string, unknown>;
185
+ actionPayload?: EventPayload;
185
186
  /** Button label text (alternative to children for schema-driven rendering) */
186
187
  label?: string;
187
188
  }
@@ -2549,9 +2549,6 @@ var fallbackEventBus = {
2549
2549
  emit: (type, payload, source) => {
2550
2550
  const event = {
2551
2551
  type,
2552
- // Narrow at the bus boundary: public emit accepts an opaque object so
2553
- // generic UI emit sites don't require casts; the envelope stores the
2554
- // payload as EventPayload which listeners consume directly.
2555
2552
  payload,
2556
2553
  timestamp: Date.now(),
2557
2554
  source