@bfrs/agentic-components 0.4.5 → 0.4.7

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.
@@ -558,6 +558,7 @@ Single-value dropdown. Options are `{ value: string; label: string }`.
558
558
 
559
559
  The Figma trigger style is the only select size: 28px high with 12.5px text, 7px radius, and a 10px chevron.
560
560
  The trigger chevron rotates 180deg while open. This open/close motion and focused/open border treatment is shared by `Select`, `SearchableSelect`, and `MultiSelect`.
561
+ Selected option rows render with bold text across select-style listboxes: `Select`, `SearchableSelect`, `MultiSelect`, and `SuggestInput`.
561
562
 
562
563
  ```tsx
563
564
  <Select
@@ -158,6 +158,38 @@ export type TableBulkActionsProps = {
158
158
  label?: ReactNode;
159
159
  className?: string;
160
160
  };
161
+ export type ViewType = "orders" | "shipments" | "products";
162
+ export type ViewColumn = {
163
+ key: string;
164
+ order: number;
165
+ visible: boolean;
166
+ };
167
+ export type ViewFilter = {
168
+ field: string;
169
+ op: string;
170
+ value: unknown;
171
+ };
172
+ export type SavedView = {
173
+ view_id: string;
174
+ name: string;
175
+ view_type: ViewType;
176
+ columns: ViewColumn[];
177
+ filters: ViewFilter[];
178
+ priority: number;
179
+ is_default: boolean;
180
+ is_system_defined: boolean;
181
+ };
182
+ export type SaveViewPayload = {
183
+ view_type: ViewType;
184
+ name: string;
185
+ columns: ViewColumn[];
186
+ filters?: ViewFilter[];
187
+ priority?: number;
188
+ };
189
+ export type SaveViewResult = {
190
+ view: SavedView;
191
+ alreadyExists: boolean;
192
+ };
161
193
  export type TableColumnVisibilityColumn = {
162
194
  id: string;
163
195
  label: ReactNode;
@@ -1,12 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { TableColumnVisibilityColumn } from './DataTable.types';
3
- export type TableSaveViewPayload = {
4
- name: string;
5
- visibleColumnIds: string[];
6
- hiddenColumnCount: number;
7
- filtersCount: number;
8
- appliedSettingLabels: string[];
9
- };
2
+ import { TableColumnVisibilityColumn, ViewFilter, ViewType, SaveViewPayload, SaveViewResult } from './DataTable.types';
10
3
  export type TableSaveViewProps = {
11
4
  open?: boolean;
12
5
  defaultOpen?: boolean;
@@ -28,10 +21,23 @@ export type TableSaveViewProps = {
28
21
  visibleColumnIds?: string[];
29
22
  hiddenColumnCount?: number;
30
23
  filtersCount?: number;
24
+ /** The listing type — required to build the API payload. */
25
+ viewType?: ViewType;
26
+ /** Active filters to persist with the view, in API format. */
27
+ filters?: ViewFilter[];
28
+ /** View priority. Higher wins on resolution. Defaults to 0. */
29
+ priority?: number;
31
30
  cancelLabel?: ReactNode;
32
31
  saveLabel?: ReactNode;
33
32
  onCancel?: () => void;
34
- onSave?: (payload: TableSaveViewPayload) => void | Promise<void>;
33
+ /**
34
+ * Called on submit with the API-formatted payload.
35
+ * Return a `SaveViewResult` (e.g. from `saveView()`) to trigger `onSaved`
36
+ * and allow the component to detect duplicates.
37
+ */
38
+ onSave?: (payload: SaveViewPayload) => void | Promise<SaveViewResult | void>;
39
+ /** Fires after a successful save with the resolved view and duplicate flag. */
40
+ onSaved?: (result: SaveViewResult) => void;
35
41
  loading?: boolean;
36
42
  disabled?: boolean;
37
43
  closeOnSave?: boolean;
@@ -41,4 +47,4 @@ export type TableSaveViewProps = {
41
47
  className?: string;
42
48
  triggerClassName?: string;
43
49
  };
44
- export declare function TableSaveView({ open, defaultOpen, onOpenChange, onClose, trigger, triggerLabel, title, description, viewName, defaultViewName, onViewNameChange, viewNameLabel, viewNamePlaceholder, appliedLabel, appliedSettings, appliedSettingLabels, columns, visibleColumnIds, hiddenColumnCount, filtersCount, cancelLabel, saveLabel, onCancel, onSave, loading, disabled, closeOnSave, closeOnOverlayClick, closeOnEscape, preventClose, className, triggerClassName }: TableSaveViewProps): import("react/jsx-runtime").JSX.Element;
50
+ export declare function TableSaveView({ open, defaultOpen, onOpenChange, onClose, trigger, triggerLabel, title, description, viewName, defaultViewName, onViewNameChange, viewNameLabel, viewNamePlaceholder, appliedLabel, appliedSettings, appliedSettingLabels, columns, visibleColumnIds, hiddenColumnCount, filtersCount, viewType, filters, priority, cancelLabel, saveLabel, onCancel, onSave, onSaved, loading, disabled, closeOnSave, closeOnOverlayClick, closeOnEscape, preventClose, className, triggerClassName }: TableSaveViewProps): import("react/jsx-runtime").JSX.Element;
@@ -9,3 +9,4 @@ export * from './TableRowActions';
9
9
  export * from './TableBulkActions';
10
10
  export * from './TableColumnVisibility';
11
11
  export * from './TableSaveView';
12
+ export * from './saveViewApi';
@@ -0,0 +1,26 @@
1
+ import { SaveViewPayload, SaveViewResult } from './DataTable.types';
2
+ export type SaveViewOptions = {
3
+ /** Base URL of the API service, e.g. `"http://localhost:8000"` or `import.meta.env.VITE_API_BASE_URL`. Trailing slash is optional. */
4
+ baseUrl: string;
5
+ token: string;
6
+ payload: SaveViewPayload;
7
+ };
8
+ /**
9
+ * POST /api/v1/saveview
10
+ *
11
+ * Saves a user view. Returns the saved view and whether it was a duplicate.
12
+ * Throws on HTTP error (auth, validation, network).
13
+ */
14
+ export declare function saveView({ baseUrl, token, payload }: SaveViewOptions): Promise<SaveViewResult>;
15
+ /**
16
+ * Creates a pre-configured save function bound to a base URL and token.
17
+ * The returned function matches the `TableSaveView.onSave` signature directly.
18
+ *
19
+ * @example
20
+ * const save = createSaveView({ baseUrl: import.meta.env.VITE_API_BASE_URL, token });
21
+ * <TableSaveView onSave={save} onSaved={...} />
22
+ */
23
+ export declare function createSaveView({ baseUrl, token }: {
24
+ baseUrl: string;
25
+ token: string;
26
+ }): (payload: SaveViewPayload) => Promise<SaveViewResult>;