@almadar/ui 4.36.0 → 4.38.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.
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import type { EventEmit, EventPayload, EventPayloadValue } from '@almadar/core';
2
3
  export interface BranchingQuestion {
3
4
  id: string;
4
5
  label: string;
@@ -6,7 +7,7 @@ export interface BranchingQuestion {
6
7
  }
7
8
  export type BranchingOperator = 'equals' | 'not-equals' | 'contains' | 'in';
8
9
  export declare const END_OF_SURVEY = "end-of-survey";
9
- export interface BranchingRule {
10
+ export interface BranchingRule extends EventPayload {
10
11
  id: string;
11
12
  sourceQuestionId: string;
12
13
  operator: BranchingOperator;
@@ -14,9 +15,18 @@ export interface BranchingRule {
14
15
  targetQuestionId: string | typeof END_OF_SURVEY;
15
16
  }
16
17
  export interface BranchingLogicBuilderProps {
17
- questions: BranchingQuestion[];
18
- rules: BranchingRule[];
18
+ questions: readonly BranchingQuestion[] | EventPayloadValue;
19
+ /**
20
+ * Rules. Accepts either a typed array (direct consumers) or the runtime
21
+ * payload shape from a render-ui binding (`@payload.data`). Narrowed to
22
+ * `[]` internally when the value isn't an array.
23
+ */
24
+ rules: readonly BranchingRule[] | EventPayloadValue;
19
25
  onRulesChange?: (rules: BranchingRule[]) => void;
26
+ /** Event name dispatched via event bus when rules change. Payload: `{ rules }`. */
27
+ rulesChangeEvent?: EventEmit<{
28
+ rules: BranchingRule[];
29
+ }>;
20
30
  readOnly?: boolean;
21
31
  className?: string;
22
32
  }
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import type { EventEmit } from "@almadar/core";
2
3
  export type LikertScaleSize = "sm" | "md" | "lg";
3
4
  export type LikertScaleVariant = "radios" | "buttons";
4
5
  export interface LikertOption {
@@ -16,6 +17,10 @@ export interface LikertScaleProps {
16
17
  value?: number | string | null;
17
18
  /** Change callback */
18
19
  onChange?: (value: number | string) => void;
20
+ /** Event name dispatched via event bus on change. Payload: { value: number | string } */
21
+ changeEvent?: EventEmit<{
22
+ value: number | string;
23
+ }>;
19
24
  /** Disabled state */
20
25
  disabled?: boolean;
21
26
  /** Size variant */
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import type { EventEmit } from '@almadar/core';
2
3
  export interface MatrixRow {
3
4
  id: string;
4
5
  label: string;
@@ -18,6 +19,11 @@ export interface MatrixQuestionProps {
18
19
  values?: Record<string, number | string>;
19
20
  /** Change handler invoked with rowId and selected column value */
20
21
  onChange?: (rowId: string, value: number | string) => void;
22
+ /** Event name dispatched via event bus when a row's value changes. Payload: { rowId, value } */
23
+ changeEvent?: EventEmit<{
24
+ rowId: string;
25
+ value: number | string;
26
+ }>;
21
27
  /** Disable all inputs */
22
28
  disabled?: boolean;
23
29
  /** Visual size */
@@ -9,6 +9,7 @@
9
9
  * **Atomic Design**: Composed using Typography atom and native form controls.
10
10
  */
11
11
  import React from 'react';
12
+ import type { EventEmit } from '@almadar/core';
12
13
  export interface OptionConstraintOption {
13
14
  id: string;
14
15
  label: string;
@@ -32,6 +33,9 @@ export interface OptionConstraintGroupProps {
32
33
  constraint: OptionConstraint;
33
34
  selected?: string[];
34
35
  onChange?: (selected: string[]) => void;
36
+ changeEvent?: EventEmit<{
37
+ selected: string[];
38
+ }>;
35
39
  size?: 'sm' | 'md';
36
40
  className?: string;
37
41
  }
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import type { EventPayloadValue } from "@almadar/core";
2
+ import type { EventEmit, EventPayloadValue } from "@almadar/core";
3
3
  export type CanvasItemStatus = 'empty' | 'seated' | 'ordered' | 'awaiting-bill' | 'cleaning';
4
4
  export type CanvasItemShape = 'round' | 'rectangle' | 'square';
5
5
  export interface CanvasItem {
@@ -27,6 +27,14 @@ export interface PositionedCanvasProps {
27
27
  editable?: boolean;
28
28
  onSelect?: (id: string | null) => void;
29
29
  onMove?: (id: string, x: number, y: number) => void;
30
+ selectEvent?: EventEmit<{
31
+ id: string | null;
32
+ }>;
33
+ moveEvent?: EventEmit<{
34
+ id: string;
35
+ x: number;
36
+ y: number;
37
+ }>;
30
38
  className?: string;
31
39
  }
32
40
  export declare const PositionedCanvas: React.FC<PositionedCanvasProps>;
@@ -1,11 +1,18 @@
1
1
  import React from "react";
2
- export interface QrScanResult {
2
+ import type { EventEmit, EventPayload } from "@almadar/core";
3
+ /**
4
+ * QR scan callback payload. Extends `EventPayload` (string-indexed
5
+ * `EventPayloadValue` map) so the result is directly assignable to a
6
+ * render-ui dispatched event payload without re-shaping.
7
+ */
8
+ export interface QrScanResult extends EventPayload {
3
9
  text: string;
4
10
  format: string;
5
11
  timestamp: number;
6
12
  }
7
13
  export interface QrScannerProps {
8
14
  onScan?: (result: QrScanResult) => void;
15
+ scanEvent?: EventEmit<QrScanResult>;
9
16
  onError?: (error: Error) => void;
10
17
  facingMode?: 'environment' | 'user';
11
18
  paused?: boolean;
@@ -5,6 +5,8 @@
5
5
  * Composes the VoteStack molecule + Avatar/Typography/Button atoms.
6
6
  */
7
7
  import React from "react";
8
+ import type { EventEmit } from "@almadar/core";
9
+ import { type VoteValue } from "../molecules/VoteStack";
8
10
  export interface ReplyNode {
9
11
  id: string;
10
12
  authorName: string;
@@ -12,17 +14,30 @@ export interface ReplyNode {
12
14
  content: string;
13
15
  postedAt: string;
14
16
  voteCount?: number;
15
- userVote?: 'up' | 'down' | null;
17
+ userVote?: VoteValue;
16
18
  replies?: ReplyNode[];
17
19
  collapsed?: boolean;
18
20
  }
19
21
  export interface ReplyTreeProps {
20
22
  nodes: ReplyNode[];
21
23
  maxDepth?: number;
22
- onVote?: (nodeId: string, vote: 'up' | 'down' | null) => void;
24
+ onVote?: (nodeId: string, vote: VoteValue) => void;
23
25
  onReply?: (parentNodeId: string) => void;
24
26
  onFlag?: (nodeId: string) => void;
25
27
  onContinueThread?: (nodeId: string) => void;
28
+ voteEvent?: EventEmit<{
29
+ nodeId: string;
30
+ vote: VoteValue;
31
+ }>;
32
+ replyEvent?: EventEmit<{
33
+ parentNodeId: string;
34
+ }>;
35
+ flagEvent?: EventEmit<{
36
+ nodeId: string;
37
+ }>;
38
+ continueThreadEvent?: EventEmit<{
39
+ nodeId: string;
40
+ }>;
26
41
  showActions?: boolean;
27
42
  className?: string;
28
43
  }
@@ -8,6 +8,7 @@
8
8
  * scope for the Phase 10 scaffold.
9
9
  */
10
10
  import React from "react";
11
+ import type { EventEmit, EventPayloadValue } from '@almadar/core';
11
12
  export type BlockType = "paragraph" | "heading-1" | "heading-2" | "heading-3" | "bullet-list" | "numbered-list" | "quote" | "code" | "divider" | "image";
12
13
  export interface RichBlock {
13
14
  id: string;
@@ -15,10 +16,14 @@ export interface RichBlock {
15
16
  content?: string;
16
17
  metadata?: Record<string, string | number | boolean>;
17
18
  children?: RichBlock[];
19
+ [key: string]: EventPayloadValue;
18
20
  }
19
21
  export interface RichBlockEditorProps {
20
22
  initialBlocks?: RichBlock[];
21
23
  onChange?: (blocks: RichBlock[]) => void;
24
+ changeEvent?: EventEmit<{
25
+ blocks: RichBlock[];
26
+ }>;
22
27
  readOnly?: boolean;
23
28
  placeholder?: string;
24
29
  showToolbar?: boolean;
@@ -6,6 +6,7 @@
6
6
  * LCS-based line diff inline (no external diff library).
7
7
  */
8
8
  import React from "react";
9
+ import type { EventPayloadValue, EventEmit } from "@almadar/core";
9
10
  export interface DiffRevision {
10
11
  id: string;
11
12
  label: string;
@@ -22,8 +23,13 @@ export interface DiffLine {
22
23
  }
23
24
  export type VersionDiffView = "side-by-side" | "inline";
24
25
  export interface VersionDiffProps {
25
- /** All available revisions (at least 2). */
26
- revisions: DiffRevision[];
26
+ /**
27
+ * All available revisions (at least 2). Accepts either a typed array (direct
28
+ * consumers) or the runtime payload shape from a render-ui binding
29
+ * (`@payload.revisions`). Narrowed to `[]` internally when the value isn't
30
+ * an array.
31
+ */
32
+ revisions: readonly DiffRevision[] | EventPayloadValue;
27
33
  /** Currently selected "before" revision id. */
28
34
  beforeId?: string;
29
35
  /** Currently selected "after" revision id. */
@@ -36,6 +42,18 @@ export interface VersionDiffProps {
36
42
  onSelectAfter?: (id: string) => void;
37
43
  /** Called when the user clicks the revert button (passes the "before" id). */
38
44
  onRevert?: (id: string) => void;
45
+ /** Event name dispatched via event bus when the "before" revision changes. Payload: { id }. */
46
+ selectBeforeEvent?: EventEmit<{
47
+ id: string;
48
+ }>;
49
+ /** Event name dispatched via event bus when the "after" revision changes. Payload: { id }. */
50
+ selectAfterEvent?: EventEmit<{
51
+ id: string;
52
+ }>;
53
+ /** Event name dispatched via event bus when the user clicks revert. Payload: { id }. */
54
+ revertEvent?: EventEmit<{
55
+ id: string;
56
+ }>;
39
57
  /** Language label (informational). */
40
58
  language?: string;
41
59
  /** Additional CSS classes. */
@@ -1,7 +1,15 @@
1
1
  import React from "react";
2
+ import type { EventEmit } from "@almadar/core";
2
3
  export type VoteStackSize = "sm" | "md" | "lg";
3
4
  export type VoteStackVariant = "vertical" | "horizontal";
4
- export type VoteValue = "up" | "down" | null;
5
+ /**
6
+ * Current vote state. Both `null` (typical "cleared" sentinel for direct
7
+ * consumers) and the string `"none"` (the .lolo enum spelling — `direction:
8
+ * "up" | "down" | "none"`) are accepted; the component treats them
9
+ * identically. Keeping both accommodates render-ui bindings without forcing
10
+ * std atoms to drop their string sentinel.
11
+ */
12
+ export type VoteValue = "up" | "down" | "none" | null;
5
13
  export interface VoteStackProps {
6
14
  /** Current tally */
7
15
  count: number;
@@ -9,6 +17,10 @@ export interface VoteStackProps {
9
17
  userVote?: VoteValue;
10
18
  /** Toggle handler. Clicking the same arrow clears (emits null). */
11
19
  onVote?: (next: VoteValue) => void;
20
+ /** Event name dispatched on the bus when a vote is cast. Payload: { next: VoteValue }. */
21
+ voteEvent?: EventEmit<{
22
+ next: VoteValue;
23
+ }>;
12
24
  /** Disabled state */
13
25
  disabled?: boolean;
14
26
  /** Size variant */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "4.36.0",
3
+ "version": "4.38.0",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "sideEffects": [