@bfrs/agentic-components 0.2.0 → 0.2.2

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.
@@ -88,6 +88,8 @@ Use attributes for simple props: `variant`, `size`, `tone`, `label`, `loading`,
88
88
 
89
89
  Common component events: `(value-change)`, `(checked-change)`, `(open-change)`, `(close)`, `(confirm)`, `(cancel)`, `(row-click)`, `(sort-change)`, `(page-change)`, `(page-size-change)`, `(action-select)`, `(dropdown-select)`, `(date-range-change)`, `(search-change)`, `(open-filters)`, `(apply)`, `(reset)`, and `(submit)`. Payloads are available on `$event.detail`.
90
90
 
91
+ For validated forms, keep client validation, API validation, and submit side effects in the consuming app. In React, pass field errors through `FormField errorText` and set `Input error`. In Angular, use `bfrs-input` with `[attr.error]` and `[attr.error-message]`, listen to `(value-change)`, and manage success/failure notifications with `bfrs-toast-manager`.
92
+
91
93
  ```html
92
94
  <bfrs-select
93
95
  placeholder="Channel"
package/README.md CHANGED
@@ -114,6 +114,28 @@ Use simple attributes for primitive values and `[props]` for structured values o
114
114
 
115
115
  Registered tags include `bfrs-box`, `bfrs-container`, `bfrs-paper`, `bfrs-stack`, `bfrs-grid`, `bfrs-text`, `bfrs-icon`, `bfrs-button`, `bfrs-icon-button`, `bfrs-form-field`, `bfrs-label`, `bfrs-input`, `bfrs-textarea`, `bfrs-select`, `bfrs-date-range-picker`, `bfrs-searchable-select`, `bfrs-checkbox`, `bfrs-radio`, `bfrs-switch`, `bfrs-badge`, `bfrs-chip`, `bfrs-alert`, `bfrs-toast-manager`, `bfrs-spinner`, `bfrs-skeleton`, `bfrs-empty-state`, `bfrs-error-state`, `bfrs-loading-state`, `bfrs-modal`, `bfrs-drawer`, `bfrs-confirm-dialog`, `bfrs-dropdown`, `bfrs-tooltip`, `bfrs-popover`, `bfrs-avatar`, `bfrs-metric-card`, `bfrs-table-pagination`, `bfrs-data-table`, `bfrs-tabs`, `bfrs-breadcrumbs`, `bfrs-action-menu`, `bfrs-page-header`, `bfrs-section-header`, `bfrs-layout-shell`, `bfrs-form-section`, `bfrs-filter-bar`, `bfrs-filter-drawer`, `bfrs-chat-bubble`, `bfrs-chat-composer`, `bfrs-full-page-loader`, `bfrs-business-info-display-card`, and `bfrs-step-progress-card`.
116
116
 
117
+ ### Validated Forms
118
+
119
+ Keep form validation and API checks in the app. Render field errors below inputs, then show success or failure through the toast API.
120
+
121
+ ```tsx
122
+ <FormField label="Pickup pincode" errorText={errors.pickupPincode}>
123
+ <Input error={Boolean(errors.pickupPincode)} value={pickupPincode} onChange={updatePickupPincode} />
124
+ </FormField>
125
+ ```
126
+
127
+ ```html
128
+ <bfrs-input
129
+ label="Pickup pincode"
130
+ [value]="pickupPincode"
131
+ [attr.error]="errors.pickupPincode ? true : null"
132
+ [attr.error-message]="errors.pickupPincode || null"
133
+ (value-change)="pickupPincode = $event.detail.value">
134
+ </bfrs-input>
135
+
136
+ <bfrs-toast-manager [props]="{ toasts: toasts }" (dismiss)="dismissToast($event.detail.id)"></bfrs-toast-manager>
137
+ ```
138
+
117
139
  ### DateRangePicker
118
140
 
119
141
  Use `DateRangePicker` for preset and custom date-range filters. Keep API date formatting in the consuming app.
@@ -51,3 +51,6 @@ export * from './patterns/ChatComposer';
51
51
  export * from './patterns/FullPageLoader';
52
52
  export * from './patterns/BusinessInfoDisplayCard';
53
53
  export * from './patterns/StepProgressCard';
54
+ export * from './patterns/CommandMenu';
55
+ export * from './patterns/WorkspaceHeader';
56
+ export * from './patterns/SideNav';
@@ -0,0 +1,47 @@
1
+ import { ReactNode } from 'react';
2
+ export type CommandMenuTone = "neutral" | "primary" | "success" | "warning" | "danger" | "info";
3
+ export type CommandMenuItem = {
4
+ /** Stable id for the item. */
5
+ id: string;
6
+ /** Primary label, e.g. a command name. */
7
+ label: ReactNode;
8
+ /** Secondary description line. */
9
+ description?: ReactNode;
10
+ /** Leading icon node, rendered inside a tinted square. */
11
+ icon?: ReactNode;
12
+ /** Extra text used for filtering (in addition to a string `label`). */
13
+ keywords?: string;
14
+ /** Optional trailing status badge. */
15
+ status?: {
16
+ label: ReactNode;
17
+ tone?: CommandMenuTone;
18
+ };
19
+ disabled?: boolean;
20
+ };
21
+ export type CommandMenuProps = {
22
+ /** Items to render. */
23
+ items: CommandMenuItem[];
24
+ /** Current filter query. When set and `filter` is not false, items are filtered. */
25
+ query?: string;
26
+ /** Optional uppercase title shown above the list. */
27
+ title?: ReactNode;
28
+ /** Text shown when no items match. */
29
+ emptyText?: ReactNode;
30
+ /** Whether to internally filter `items` by `query`. Defaults to true. */
31
+ filter?: boolean;
32
+ /** Called when an item is selected. */
33
+ onSelect?: (item: CommandMenuItem) => void;
34
+ className?: string;
35
+ };
36
+ /**
37
+ * Searchable command / option palette. Renders a floating-style surface with a
38
+ * list of icon + label + description rows and optional status badges. Filtering
39
+ * is internal by default; pass `filter={false}` to control the list yourself.
40
+ *
41
+ * The component is position-agnostic — wrap it (or pass `className`) to place it
42
+ * as a popover above an input, in a dropdown, etc.
43
+ */
44
+ export declare function CommandMenu({ items, query, title, emptyText, filter, onSelect, className }: CommandMenuProps): import("react/jsx-runtime").JSX.Element;
45
+ export declare namespace CommandMenu {
46
+ var displayName: string;
47
+ }
@@ -0,0 +1 @@
1
+ export * from './CommandMenu';
@@ -0,0 +1,52 @@
1
+ import { CSSProperties, ReactNode } from 'react';
2
+ export type SideNavSubItem = {
3
+ id: string;
4
+ label: ReactNode;
5
+ onSelect?: () => void;
6
+ };
7
+ export type SideNavItem = {
8
+ id: string;
9
+ label: ReactNode;
10
+ /** Leading icon node. */
11
+ icon?: ReactNode;
12
+ active?: boolean;
13
+ /** Trailing badge/slot (hidden when collapsed). */
14
+ badge?: ReactNode;
15
+ /** Hover flyout entries. When present, clicking the row does not call `onSelect`. */
16
+ nested?: SideNavSubItem[];
17
+ onSelect?: () => void;
18
+ };
19
+ export type SideNavSection = {
20
+ id?: string;
21
+ /** Uppercase section title (hidden when collapsed). */
22
+ title?: ReactNode;
23
+ items: SideNavItem[];
24
+ /** Optional action row shown under the items (e.g. "Create new"). Hidden when collapsed. */
25
+ action?: ReactNode;
26
+ };
27
+ export type SideNavProps = {
28
+ sections: SideNavSection[];
29
+ collapsed?: boolean;
30
+ /** Expanded width in px. Defaults to 240. */
31
+ width?: number;
32
+ /** Collapsed width in px. Defaults to 56. */
33
+ collapsedWidth?: number;
34
+ /** Top slot, above the scrollable nav (e.g. a primary CTA). */
35
+ header?: ReactNode;
36
+ /** Extra content rendered inside the scroll area after the sections (e.g. a recents list). */
37
+ children?: ReactNode;
38
+ /** Bottom slot (e.g. user + settings). */
39
+ footer?: ReactNode;
40
+ className?: string;
41
+ style?: CSSProperties;
42
+ };
43
+ /**
44
+ * Collapsible application sidebar navigation. Renders grouped sections of items
45
+ * with active state, optional badges, and hover flyouts for nested items, plus
46
+ * dedicated `header` and `footer` slots. All data (labels, icons, handlers) is
47
+ * passed in — the component owns layout, collapse behavior, and chrome only.
48
+ */
49
+ export declare function SideNav({ sections, collapsed, width, collapsedWidth, header, children, footer, className, style }: SideNavProps): import("react/jsx-runtime").JSX.Element;
50
+ export declare namespace SideNav {
51
+ var displayName: string;
52
+ }
@@ -0,0 +1 @@
1
+ export * from './SideNav';
@@ -0,0 +1,35 @@
1
+ import { CSSProperties, ReactNode } from 'react';
2
+ export type WorkspaceHeaderProps = {
3
+ /** Brand block (logo + product name) rendered at the far left. */
4
+ brand?: ReactNode;
5
+ /** Fixed width (px) for the brand rail, e.g. to align with a sidebar. Auto when omitted. */
6
+ brandWidth?: number;
7
+ /** When provided, renders a sidebar-toggle button next to the brand. */
8
+ onToggleSidebar?: () => void;
9
+ /** Accessible label for the sidebar-toggle button. */
10
+ toggleLabel?: string;
11
+ /** Optional tab strip, rendered as its own bordered column after the brand. */
12
+ tabs?: ReactNode;
13
+ /** Fixed width (px) for the tabs column, e.g. to align with a secondary pane. Auto when omitted. */
14
+ tabsWidth?: number;
15
+ /** Search control, placed at the start of the trailing actions area. */
16
+ search?: ReactNode;
17
+ /** Trailing action controls (wallet, apps, avatar, …). */
18
+ actions?: ReactNode;
19
+ /** Free-form content placed in the main (flex) region before the spacer. */
20
+ children?: ReactNode;
21
+ /** Header height in px. Defaults to 52. */
22
+ height?: number;
23
+ className?: string;
24
+ style?: CSSProperties;
25
+ };
26
+ /**
27
+ * Application top bar for workspace-style layouts. Slot-based: drop in a brand
28
+ * block, an optional sidebar toggle, a tab strip, a search control, and trailing
29
+ * actions. All product-specific logic (which tabs exist, wallet balance, etc.)
30
+ * stays in the consuming app — this component only owns layout and chrome.
31
+ */
32
+ export declare function WorkspaceHeader({ brand, brandWidth, onToggleSidebar, toggleLabel, tabs, tabsWidth, search, actions, children, height, className, style }: WorkspaceHeaderProps): import("react/jsx-runtime").JSX.Element;
33
+ export declare namespace WorkspaceHeader {
34
+ var displayName: string;
35
+ }
@@ -0,0 +1 @@
1
+ export * from './WorkspaceHeader';
@@ -422,6 +422,24 @@ export declare class BfrsStepProgressCardSkeletonElement extends ReactCustomElem
422
422
  static get observedAttributes(): string[];
423
423
  protected renderElement(): unknown;
424
424
  }
425
+ export declare class BfrsCommandMenuElement extends ReactCustomElement {
426
+ static readonly tagName = "command-menu";
427
+ static get observedAttributes(): string[];
428
+ protected defaultDisplay(): string;
429
+ protected renderElement(): unknown;
430
+ }
431
+ export declare class BfrsWorkspaceHeaderElement extends ReactCustomElement {
432
+ static readonly tagName = "workspace-header";
433
+ static get observedAttributes(): string[];
434
+ protected defaultDisplay(): string;
435
+ protected renderElement(): unknown;
436
+ }
437
+ export declare class BfrsSideNavElement extends ReactCustomElement {
438
+ static readonly tagName = "side-nav";
439
+ static get observedAttributes(): string[];
440
+ protected defaultDisplay(): string;
441
+ protected renderElement(): unknown;
442
+ }
425
443
  export declare function defineBfrsAgenticElements(options?: BfrsCustomElementRegistryOptions): void;
426
444
  declare global {
427
445
  interface HTMLElementTagNameMap {
@@ -442,6 +460,7 @@ declare global {
442
460
  "bfrs-chat-composer": BfrsChatComposerElement;
443
461
  "bfrs-checkbox": BfrsCheckboxElement;
444
462
  "bfrs-chip": BfrsChipElement;
463
+ "bfrs-command-menu": BfrsCommandMenuElement;
445
464
  "bfrs-confirm-dialog": BfrsConfirmDialogElement;
446
465
  "bfrs-container": BfrsContainerElement;
447
466
  "bfrs-data-table": BfrsDataTableElement;
@@ -474,6 +493,7 @@ declare global {
474
493
  "bfrs-searchable-select": BfrsSearchableSelectElement;
475
494
  "bfrs-section-header": BfrsSectionHeaderElement;
476
495
  "bfrs-select": BfrsSelectElement;
496
+ "bfrs-side-nav": BfrsSideNavElement;
477
497
  "bfrs-skeleton": BfrsSkeletonElement;
478
498
  "bfrs-spinner": BfrsSpinnerElement;
479
499
  "bfrs-stack": BfrsStackElement;
@@ -486,6 +506,7 @@ declare global {
486
506
  "bfrs-textarea": BfrsTextareaElement;
487
507
  "bfrs-toast-manager": BfrsToastManagerElement;
488
508
  "bfrs-tooltip": BfrsTooltipElement;
509
+ "bfrs-workspace-header": BfrsWorkspaceHeaderElement;
489
510
  }
490
511
  }
491
512
  export {};