@bfrs/agentic-components 0.1.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/BFRS_AGENTIC_COMPONENTS.md +1236 -0
- package/README.md +132 -0
- package/dist/components/data-display/DataTable/DataTable.d.ts +2 -0
- package/dist/components/data-display/DataTable/DataTable.types.d.ts +153 -0
- package/dist/components/data-display/DataTable/TableBulkActions.d.ts +2 -0
- package/dist/components/data-display/DataTable/TableColumnVisibility.d.ts +2 -0
- package/dist/components/data-display/DataTable/TableEmptyState.d.ts +2 -0
- package/dist/components/data-display/DataTable/TableErrorState.d.ts +2 -0
- package/dist/components/data-display/DataTable/TablePagination.d.ts +2 -0
- package/dist/components/data-display/DataTable/TableRowActions.d.ts +2 -0
- package/dist/components/data-display/DataTable/TableSkeleton.d.ts +2 -0
- package/dist/components/data-display/DataTable/TableToolbar.d.ts +2 -0
- package/dist/components/data-display/DataTable/index.d.ts +10 -0
- package/dist/components/data-display/MetricCard/MetricCard.d.ts +14 -0
- package/dist/components/data-display/MetricCard/MetricCard.types.d.ts +15 -0
- package/dist/components/data-display/MetricCard/index.d.ts +2 -0
- package/dist/components/feedback/EmptyState/EmptyState.d.ts +10 -0
- package/dist/components/feedback/EmptyState/EmptyState.types.d.ts +12 -0
- package/dist/components/feedback/EmptyState/index.d.ts +2 -0
- package/dist/components/feedback/ErrorState/ErrorState.d.ts +8 -0
- package/dist/components/feedback/ErrorState/ErrorState.types.d.ts +10 -0
- package/dist/components/feedback/ErrorState/index.d.ts +2 -0
- package/dist/components/feedback/LoadingState/LoadingState.d.ts +6 -0
- package/dist/components/feedback/LoadingState/LoadingState.types.d.ts +8 -0
- package/dist/components/feedback/LoadingState/index.d.ts +2 -0
- package/dist/components/feedback/Toast/Toast.context.d.ts +3 -0
- package/dist/components/feedback/Toast/Toast.d.ts +3 -0
- package/dist/components/feedback/Toast/Toast.types.d.ts +48 -0
- package/dist/components/feedback/Toast/index.d.ts +3 -0
- package/dist/components/filters/DateRangePicker/DateRangePicker.d.ts +5 -0
- package/dist/components/filters/DateRangePicker/DateRangePicker.types.d.ts +48 -0
- package/dist/components/filters/DateRangePicker/DateRangePicker.utils.d.ts +35 -0
- package/dist/components/filters/DateRangePicker/index.d.ts +3 -0
- package/dist/components/filters/FilterBar/FilterBar.d.ts +15 -0
- package/dist/components/filters/FilterBar/FilterBar.types.d.ts +21 -0
- package/dist/components/filters/FilterBar/index.d.ts +2 -0
- package/dist/components/filters/FilterDrawer/FilterDrawer.d.ts +2 -0
- package/dist/components/filters/FilterDrawer/FilterDrawer.types.d.ts +17 -0
- package/dist/components/filters/FilterDrawer/index.d.ts +2 -0
- package/dist/components/layout/FormSection/FormSection.d.ts +14 -0
- package/dist/components/layout/FormSection/FormSection.types.d.ts +14 -0
- package/dist/components/layout/FormSection/index.d.ts +2 -0
- package/dist/components/layout/PageHeader/PageHeader.d.ts +13 -0
- package/dist/components/layout/PageHeader/PageHeader.types.d.ts +14 -0
- package/dist/components/layout/PageHeader/index.d.ts +2 -0
- package/dist/components/layout/SectionHeader/SectionHeader.d.ts +9 -0
- package/dist/components/layout/SectionHeader/SectionHeader.types.d.ts +10 -0
- package/dist/components/layout/SectionHeader/index.d.ts +2 -0
- package/dist/components/navigation/ActionMenu/ActionMenu.d.ts +2 -0
- package/dist/components/navigation/ActionMenu/ActionMenu.types.d.ts +22 -0
- package/dist/components/navigation/ActionMenu/index.d.ts +2 -0
- package/dist/components/navigation/Tabs/Tabs.d.ts +2 -0
- package/dist/components/navigation/Tabs/Tabs.types.d.ts +17 -0
- package/dist/components/navigation/Tabs/index.d.ts +2 -0
- package/dist/components/overlays/ConfirmDialog/ConfirmDialog.d.ts +2 -0
- package/dist/components/overlays/ConfirmDialog/ConfirmDialog.types.d.ts +19 -0
- package/dist/components/overlays/ConfirmDialog/index.d.ts +2 -0
- package/dist/components/overlays/Drawer/Drawer.d.ts +2 -0
- package/dist/components/overlays/Drawer/Drawer.types.d.ts +24 -0
- package/dist/components/overlays/Drawer/index.d.ts +2 -0
- package/dist/components/overlays/Modal/Modal.d.ts +2 -0
- package/dist/components/overlays/Modal/Modal.types.d.ts +22 -0
- package/dist/components/overlays/Modal/index.d.ts +2 -0
- package/dist/components/primitives/Badge/Badge.d.ts +9 -0
- package/dist/components/primitives/Badge/Badge.types.d.ts +13 -0
- package/dist/components/primitives/Badge/index.d.ts +2 -0
- package/dist/components/primitives/Button/Button.d.ts +15 -0
- package/dist/components/primitives/Button/Button.types.d.ts +17 -0
- package/dist/components/primitives/Button/index.d.ts +2 -0
- package/dist/components/primitives/Card/Card.d.ts +9 -0
- package/dist/components/primitives/Card/Card.types.d.ts +8 -0
- package/dist/components/primitives/Card/index.d.ts +2 -0
- package/dist/components/primitives/Chip/Chip.d.ts +10 -0
- package/dist/components/primitives/Chip/Chip.types.d.ts +14 -0
- package/dist/components/primitives/Chip/index.d.ts +2 -0
- package/dist/components/primitives/Input/Input.d.ts +16 -0
- package/dist/components/primitives/Input/Input.types.d.ts +18 -0
- package/dist/components/primitives/Input/index.d.ts +2 -0
- package/dist/components/ui/actions/Button/Button.d.ts +2 -0
- package/dist/components/ui/actions/Button/index.d.ts +1 -0
- package/dist/components/ui/actions/IconButton/IconButton.d.ts +2 -0
- package/dist/components/ui/actions/IconButton/index.d.ts +1 -0
- package/dist/components/ui/data-display/Avatar/Avatar.d.ts +15 -0
- package/dist/components/ui/data-display/Avatar/index.d.ts +1 -0
- package/dist/components/ui/data-display/Pagination/Pagination.d.ts +7 -0
- package/dist/components/ui/data-display/Pagination/index.d.ts +1 -0
- package/dist/components/ui/data-display/Table/Table.d.ts +28 -0
- package/dist/components/ui/data-display/Table/TableEmptyState.d.ts +2 -0
- package/dist/components/ui/data-display/Table/TableSkeleton.d.ts +5 -0
- package/dist/components/ui/data-display/Table/index.d.ts +3 -0
- package/dist/components/ui/feedback/Alert/Alert.d.ts +18 -0
- package/dist/components/ui/feedback/Alert/index.d.ts +1 -0
- package/dist/components/ui/feedback/Badge/Badge.d.ts +2 -0
- package/dist/components/ui/feedback/Badge/index.d.ts +1 -0
- package/dist/components/ui/feedback/Chip/Chip.d.ts +2 -0
- package/dist/components/ui/feedback/Chip/index.d.ts +1 -0
- package/dist/components/ui/feedback/EmptyState/EmptyState.d.ts +2 -0
- package/dist/components/ui/feedback/EmptyState/index.d.ts +1 -0
- package/dist/components/ui/feedback/Skeleton/Skeleton.d.ts +10 -0
- package/dist/components/ui/feedback/Skeleton/index.d.ts +1 -0
- package/dist/components/ui/feedback/Spinner/Spinner.d.ts +6 -0
- package/dist/components/ui/feedback/Spinner/index.d.ts +1 -0
- package/dist/components/ui/forms/Checkbox/Checkbox.d.ts +14 -0
- package/dist/components/ui/forms/Checkbox/index.d.ts +1 -0
- package/dist/components/ui/forms/FormField/FormField.d.ts +17 -0
- package/dist/components/ui/forms/FormField/index.d.ts +1 -0
- package/dist/components/ui/forms/Input/Input.d.ts +2 -0
- package/dist/components/ui/forms/Input/index.d.ts +1 -0
- package/dist/components/ui/forms/Label/Label.d.ts +9 -0
- package/dist/components/ui/forms/Label/index.d.ts +1 -0
- package/dist/components/ui/forms/Radio/Radio.d.ts +14 -0
- package/dist/components/ui/forms/Radio/index.d.ts +1 -0
- package/dist/components/ui/forms/SearchableSelect/SearchableSelect.d.ts +18 -0
- package/dist/components/ui/forms/SearchableSelect/index.d.ts +1 -0
- package/dist/components/ui/forms/Select/Select.d.ts +20 -0
- package/dist/components/ui/forms/Select/index.d.ts +1 -0
- package/dist/components/ui/forms/Switch/Switch.d.ts +7 -0
- package/dist/components/ui/forms/Switch/index.d.ts +1 -0
- package/dist/components/ui/forms/Textarea/Textarea.d.ts +9 -0
- package/dist/components/ui/forms/Textarea/index.d.ts +1 -0
- package/dist/components/ui/index.d.ts +53 -0
- package/dist/components/ui/navigation/Breadcrumbs/Breadcrumbs.d.ts +11 -0
- package/dist/components/ui/navigation/Breadcrumbs/index.d.ts +1 -0
- package/dist/components/ui/navigation/Tabs/Tabs.d.ts +2 -0
- package/dist/components/ui/navigation/Tabs/index.d.ts +1 -0
- package/dist/components/ui/overlays/Dialog/Dialog.d.ts +2 -0
- package/dist/components/ui/overlays/Dialog/index.d.ts +1 -0
- package/dist/components/ui/overlays/Drawer/Drawer.d.ts +2 -0
- package/dist/components/ui/overlays/Drawer/index.d.ts +1 -0
- package/dist/components/ui/overlays/Dropdown/Dropdown.d.ts +16 -0
- package/dist/components/ui/overlays/Dropdown/index.d.ts +1 -0
- package/dist/components/ui/overlays/Popover/Popover.d.ts +8 -0
- package/dist/components/ui/overlays/Popover/index.d.ts +1 -0
- package/dist/components/ui/overlays/Tooltip/Tooltip.d.ts +8 -0
- package/dist/components/ui/overlays/Tooltip/index.d.ts +1 -0
- package/dist/components/ui/patterns/BusinessInfoDisplayCard/BusinessInfoDisplayCard.d.ts +37 -0
- package/dist/components/ui/patterns/BusinessInfoDisplayCard/BusinessInfoDisplayCardSkeleton.d.ts +7 -0
- package/dist/components/ui/patterns/BusinessInfoDisplayCard/index.d.ts +2 -0
- package/dist/components/ui/patterns/ChatBubble/ChatBubble.d.ts +11 -0
- package/dist/components/ui/patterns/ChatBubble/index.d.ts +1 -0
- package/dist/components/ui/patterns/ChatComposer/ChatComposer.d.ts +19 -0
- package/dist/components/ui/patterns/ChatComposer/index.d.ts +1 -0
- package/dist/components/ui/patterns/FullPageLoader/FullPageLoader.d.ts +17 -0
- package/dist/components/ui/patterns/FullPageLoader/FullPageLoaderSpinner.d.ts +4 -0
- package/dist/components/ui/patterns/FullPageLoader/index.d.ts +1 -0
- package/dist/components/ui/patterns/LayoutShell/LayoutShell.d.ts +8 -0
- package/dist/components/ui/patterns/LayoutShell/index.d.ts +1 -0
- package/dist/components/ui/patterns/PageHeader/PageHeader.d.ts +2 -0
- package/dist/components/ui/patterns/PageHeader/index.d.ts +1 -0
- package/dist/components/ui/patterns/StepProgressCard/StepProgressCard.d.ts +24 -0
- package/dist/components/ui/patterns/StepProgressCard/StepProgressCardSkeleton.d.ts +7 -0
- package/dist/components/ui/patterns/StepProgressCard/index.d.ts +2 -0
- package/dist/components/ui/primitives/Box/Box.d.ts +7 -0
- package/dist/components/ui/primitives/Box/index.d.ts +1 -0
- package/dist/components/ui/primitives/Container/Container.d.ts +10 -0
- package/dist/components/ui/primitives/Container/index.d.ts +1 -0
- package/dist/components/ui/primitives/Grid/Grid.d.ts +9 -0
- package/dist/components/ui/primitives/Grid/index.d.ts +1 -0
- package/dist/components/ui/primitives/Icon/Icon.d.ts +15 -0
- package/dist/components/ui/primitives/Icon/index.d.ts +1 -0
- package/dist/components/ui/primitives/Paper/Paper.d.ts +12 -0
- package/dist/components/ui/primitives/Paper/index.d.ts +1 -0
- package/dist/components/ui/primitives/Stack/Stack.d.ts +17 -0
- package/dist/components/ui/primitives/Stack/index.d.ts +1 -0
- package/dist/components/ui/primitives/Text/Text.d.ts +16 -0
- package/dist/components/ui/primitives/Text/index.d.ts +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +12652 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/cn.d.ts +2 -0
- package/dist/lib/utils.d.ts +1 -0
- package/dist/style.css +1 -0
- package/dist/theme/index.d.ts +2 -0
- package/dist/theme/theme.types.d.ts +1 -0
- package/dist/theme/tokens.d.ts +11 -0
- package/dist/tokens/colors.d.ts +35 -0
- package/dist/tokens/index.d.ts +8 -0
- package/dist/tokens/motion.d.ts +7 -0
- package/dist/tokens/radius.d.ts +8 -0
- package/dist/tokens/shadows.d.ts +6 -0
- package/dist/tokens/sizes.d.ts +75 -0
- package/dist/tokens/spacing.d.ts +12 -0
- package/dist/tokens/typography.d.ts +12 -0
- package/dist/tokens/zIndex.d.ts +9 -0
- package/package.json +94 -0
- package/scripts/postinstall.cjs +76 -0
package/README.md
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Agentic Components
|
|
2
|
+
|
|
3
|
+
Production-grade React component library for Shiprocket agentic interfaces.
|
|
4
|
+
|
|
5
|
+
- Repository: https://github.com/bfrs/agentic-components
|
|
6
|
+
- Showcase: https://bfrs.github.io/agentic-components/
|
|
7
|
+
- Package: `@bfrs/agentic-components`
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
Configure npm auth in the consuming app:
|
|
12
|
+
|
|
13
|
+
```ini
|
|
14
|
+
registry=https://registry.npmjs.org/
|
|
15
|
+
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Then install:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install @bfrs/agentic-components
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
During install, the package writes `BFRS_AGENTIC_COMPONENTS.md` into the consuming project. It also ensures `AGENTS.md` and `CLAUDE.md` reference that file, creating either file when missing. Existing agent files are preserved and only receive the reference line:
|
|
25
|
+
|
|
26
|
+
```md
|
|
27
|
+
Use BFRS_AGENTIC_COMPONENTS.md for knowledge regarding the component library.
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import "@bfrs/agentic-components/styles";
|
|
34
|
+
import { Button, Card, Checkbox, Input, Text } from "@bfrs/agentic-components";
|
|
35
|
+
|
|
36
|
+
export function Example() {
|
|
37
|
+
return (
|
|
38
|
+
<Card>
|
|
39
|
+
<Text variant="title">Create shipment</Text>
|
|
40
|
+
<Input placeholder="Pickup pincode" />
|
|
41
|
+
<Checkbox label="Save this pickup address" defaultChecked />
|
|
42
|
+
<Button onClick={() => undefined}>Continue</Button>
|
|
43
|
+
</Card>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Most DOM-backed components forward compatible React props such as `onClick`, `onKeyDown`, `aria-*`, `data-*`, `className`, `style`, and refs. Controlled components expose explicit callbacks such as `onValueChange`, `onOpenChange`, `onSort`, `onRowClick`, and `onPageChange`.
|
|
49
|
+
|
|
50
|
+
Size-aware controls support `sm`, `md`, and `lg`. `sm` is the compact dashboard size for dense controls and filters.
|
|
51
|
+
|
|
52
|
+
### DateRangePicker
|
|
53
|
+
|
|
54
|
+
Use `DateRangePicker` for preset and custom date-range filters. Keep API date formatting in the consuming app.
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
import { DateRangePicker, presetToRange, type DateRangeValue } from "@bfrs/agentic-components";
|
|
58
|
+
|
|
59
|
+
const [range, setRange] = useState<DateRangeValue>({
|
|
60
|
+
preset: "Last 30 days",
|
|
61
|
+
...presetToRange("Last 30 days")
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
<DateRangePicker value={range} onChange={setRange} maxRangeDays={365} />;
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### ToastProvider
|
|
68
|
+
|
|
69
|
+
Wrap the app once and call toast helpers from app event handlers.
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
import { Button, ToastProvider, useToast } from "@bfrs/agentic-components";
|
|
73
|
+
|
|
74
|
+
function SaveButton() {
|
|
75
|
+
const { success, danger } = useToast();
|
|
76
|
+
|
|
77
|
+
return <Button onClick={() => success("Changes saved")}>Save</Button>;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
<ToastProvider>
|
|
81
|
+
<SaveButton />
|
|
82
|
+
</ToastProvider>;
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Checkbox
|
|
86
|
+
|
|
87
|
+
Use `Checkbox` for independent true/false decisions or multi-select choices. It renders as a square checklist control, while `Radio` renders circular options for single-choice groups.
|
|
88
|
+
|
|
89
|
+
```tsx
|
|
90
|
+
import { Checkbox } from "@bfrs/agentic-components";
|
|
91
|
+
|
|
92
|
+
<Checkbox
|
|
93
|
+
label="Accept terms"
|
|
94
|
+
description="Use checkboxes when each option can be selected independently."
|
|
95
|
+
checked={accepted}
|
|
96
|
+
onCheckedChange={setAccepted}
|
|
97
|
+
/>
|
|
98
|
+
|
|
99
|
+
<Checkbox label="Partially selected" checked="indeterminate" />
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Development
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
npm run typecheck
|
|
106
|
+
npm run lint
|
|
107
|
+
npm run build:lib
|
|
108
|
+
npm run build:demo
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
`npm run build:lib` outputs the package to `dist`.
|
|
112
|
+
|
|
113
|
+
`npm run build:demo` outputs the showcase app to `dist-demo`.
|
|
114
|
+
|
|
115
|
+
## Publishing
|
|
116
|
+
|
|
117
|
+
Package publishing is configured for npmjs private packages. Publish only through the controlled release flow:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
npm run changeset
|
|
121
|
+
npm run version-packages
|
|
122
|
+
git tag v0.1.0
|
|
123
|
+
git push origin main --tags
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
The `Publish Package` GitHub Action publishes to npmjs on version tags, published GitHub releases, or manual workflow dispatch. Configure the repository secret `NPM_TOKEN` with publish access.
|
|
127
|
+
|
|
128
|
+
## Showcase Deployment
|
|
129
|
+
|
|
130
|
+
The `Deploy Showcase` GitHub Action builds `dist-demo` and deploys it to GitHub Pages on pushes to `main`.
|
|
131
|
+
|
|
132
|
+
In the GitHub repository settings, set Pages source to **GitHub Actions**.
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { DataTableProps } from './DataTable.types';
|
|
2
|
+
export declare function DataTable<Row>({ data, columns, getRowId, loading, error, emptyState, emptyTitle, emptyDescription, pagination, enableSorting, sorting, defaultSorting, onSortingChange, visibleColumnIds, columnOrder, defaultColumnOrder, onColumnOrderChange, enableColumnPinning, pinnedColumnCount, defaultPinnedColumnCount, onPinnedColumnCountChange, pinLeadingColumn, defaultPinLeadingColumn, onPinLeadingColumnChange, enableColumnReordering, resetKey, showSortIcon, leadingColumn, rowActions, rowActionsHeader, rowActionsWidth, stickyRowActions, selection, selectedRowIds, onSelectedRowIdsChange, stickyHeader, minWidth, density, className, tableClassName, headerClassName, rowClassName, cellClassName, onRowClick, "aria-label": ariaLabel }: DataTableProps<Row>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { ActionMenuItem } from '../../navigation/ActionMenu';
|
|
3
|
+
export type SortDirection = "asc" | "desc";
|
|
4
|
+
export type TableDensity = "compact" | "default" | "comfortable";
|
|
5
|
+
export type TableAlign = "left" | "center" | "right";
|
|
6
|
+
export type DataTableSorting = {
|
|
7
|
+
columnId: string;
|
|
8
|
+
direction: SortDirection;
|
|
9
|
+
};
|
|
10
|
+
export type DataTableColumn<Row> = {
|
|
11
|
+
id: string;
|
|
12
|
+
header: ReactNode;
|
|
13
|
+
accessorKey?: keyof Row;
|
|
14
|
+
accessorFn?: (row: Row) => unknown;
|
|
15
|
+
sortValue?: (row: Row) => unknown;
|
|
16
|
+
cell?: (row: Row, context: {
|
|
17
|
+
value: unknown;
|
|
18
|
+
rowIndex: number;
|
|
19
|
+
selected: boolean;
|
|
20
|
+
hovered: boolean;
|
|
21
|
+
}) => ReactNode;
|
|
22
|
+
sortable?: boolean;
|
|
23
|
+
width?: number | string;
|
|
24
|
+
minWidth?: number | string;
|
|
25
|
+
align?: TableAlign;
|
|
26
|
+
className?: string;
|
|
27
|
+
headerClassName?: string;
|
|
28
|
+
style?: CSSProperties;
|
|
29
|
+
headerStyle?: CSSProperties;
|
|
30
|
+
};
|
|
31
|
+
export type DataTableLeadingColumn<Row> = {
|
|
32
|
+
header: ReactNode;
|
|
33
|
+
cell: (row: Row, context: {
|
|
34
|
+
rowIndex: number;
|
|
35
|
+
selected: boolean;
|
|
36
|
+
hovered: boolean;
|
|
37
|
+
}) => ReactNode;
|
|
38
|
+
width?: number | string;
|
|
39
|
+
minWidth?: number | string;
|
|
40
|
+
className?: string;
|
|
41
|
+
headerClassName?: string;
|
|
42
|
+
style?: CSSProperties;
|
|
43
|
+
headerStyle?: CSSProperties;
|
|
44
|
+
};
|
|
45
|
+
export type DataTablePagination = {
|
|
46
|
+
page: number;
|
|
47
|
+
totalPages: number;
|
|
48
|
+
pageSize?: number;
|
|
49
|
+
totalItems?: number;
|
|
50
|
+
pageSizeOptions?: number[];
|
|
51
|
+
onPageChange: (page: number) => void;
|
|
52
|
+
onPageSizeChange?: (pageSize: number) => void;
|
|
53
|
+
};
|
|
54
|
+
export type DataTableProps<Row> = {
|
|
55
|
+
data: Row[];
|
|
56
|
+
columns: DataTableColumn<Row>[];
|
|
57
|
+
getRowId?: (row: Row, index: number) => string;
|
|
58
|
+
loading?: boolean;
|
|
59
|
+
error?: ReactNode;
|
|
60
|
+
emptyState?: ReactNode;
|
|
61
|
+
emptyTitle?: ReactNode;
|
|
62
|
+
emptyDescription?: ReactNode;
|
|
63
|
+
pagination?: DataTablePagination;
|
|
64
|
+
enableSorting?: boolean;
|
|
65
|
+
sorting?: DataTableSorting | null;
|
|
66
|
+
defaultSorting?: DataTableSorting | null;
|
|
67
|
+
onSortingChange?: (sorting: DataTableSorting | null) => void;
|
|
68
|
+
visibleColumnIds?: string[];
|
|
69
|
+
columnOrder?: string[];
|
|
70
|
+
defaultColumnOrder?: string[];
|
|
71
|
+
onColumnOrderChange?: (columnOrder: string[]) => void;
|
|
72
|
+
enableColumnPinning?: boolean;
|
|
73
|
+
pinnedColumnCount?: number;
|
|
74
|
+
defaultPinnedColumnCount?: number;
|
|
75
|
+
onPinnedColumnCountChange?: (count: number) => void;
|
|
76
|
+
pinLeadingColumn?: boolean;
|
|
77
|
+
defaultPinLeadingColumn?: boolean;
|
|
78
|
+
onPinLeadingColumnChange?: (pinned: boolean) => void;
|
|
79
|
+
enableColumnReordering?: boolean;
|
|
80
|
+
resetKey?: string | number;
|
|
81
|
+
showSortIcon?: "always" | "active" | "never";
|
|
82
|
+
leadingColumn?: DataTableLeadingColumn<Row>;
|
|
83
|
+
rowActions?: (row: Row) => ReactNode;
|
|
84
|
+
rowActionsHeader?: ReactNode;
|
|
85
|
+
rowActionsWidth?: number | string;
|
|
86
|
+
stickyRowActions?: boolean;
|
|
87
|
+
selection?: boolean;
|
|
88
|
+
selectedRowIds?: string[];
|
|
89
|
+
onSelectedRowIdsChange?: (ids: string[]) => void;
|
|
90
|
+
stickyHeader?: boolean;
|
|
91
|
+
minWidth?: number | string;
|
|
92
|
+
density?: TableDensity;
|
|
93
|
+
className?: string;
|
|
94
|
+
tableClassName?: string;
|
|
95
|
+
headerClassName?: string;
|
|
96
|
+
rowClassName?: string | ((row: Row, index: number) => string | undefined);
|
|
97
|
+
cellClassName?: string;
|
|
98
|
+
onRowClick?: (row: Row) => void;
|
|
99
|
+
"aria-label"?: string;
|
|
100
|
+
};
|
|
101
|
+
export type TableToolbarProps = {
|
|
102
|
+
title?: ReactNode;
|
|
103
|
+
description?: ReactNode;
|
|
104
|
+
totalLabel?: ReactNode;
|
|
105
|
+
loadingLabel?: ReactNode;
|
|
106
|
+
search?: ReactNode;
|
|
107
|
+
actions?: ReactNode;
|
|
108
|
+
columnVisibility?: ReactNode;
|
|
109
|
+
className?: string;
|
|
110
|
+
};
|
|
111
|
+
export type TablePaginationProps = DataTablePagination & {
|
|
112
|
+
itemLabel?: string;
|
|
113
|
+
className?: string;
|
|
114
|
+
};
|
|
115
|
+
export type TableStateProps = {
|
|
116
|
+
title?: ReactNode;
|
|
117
|
+
description?: ReactNode;
|
|
118
|
+
action?: ReactNode;
|
|
119
|
+
colSpan?: number;
|
|
120
|
+
className?: string;
|
|
121
|
+
};
|
|
122
|
+
export type TableSkeletonProps = {
|
|
123
|
+
rows?: number;
|
|
124
|
+
columns?: number;
|
|
125
|
+
density?: TableDensity;
|
|
126
|
+
colSpan?: number;
|
|
127
|
+
};
|
|
128
|
+
export type TableRowActionsProps<Row> = {
|
|
129
|
+
row: Row;
|
|
130
|
+
getItems: (row: Row) => ActionMenuItem[];
|
|
131
|
+
label?: string;
|
|
132
|
+
};
|
|
133
|
+
export type TableBulkActionsProps = {
|
|
134
|
+
selectedCount: number;
|
|
135
|
+
actions?: ReactNode;
|
|
136
|
+
onClearSelection?: () => void;
|
|
137
|
+
label?: ReactNode;
|
|
138
|
+
className?: string;
|
|
139
|
+
};
|
|
140
|
+
export type TableColumnVisibilityColumn = {
|
|
141
|
+
id: string;
|
|
142
|
+
label: ReactNode;
|
|
143
|
+
disabled?: boolean;
|
|
144
|
+
};
|
|
145
|
+
export type TableColumnVisibilityProps = {
|
|
146
|
+
columns: TableColumnVisibilityColumn[];
|
|
147
|
+
visibleColumnIds: string[];
|
|
148
|
+
onVisibleColumnIdsChange: (ids: string[]) => void;
|
|
149
|
+
label?: ReactNode;
|
|
150
|
+
resetLabel?: ReactNode;
|
|
151
|
+
onReset?: () => void;
|
|
152
|
+
className?: string;
|
|
153
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { TablePaginationProps } from './DataTable.types';
|
|
2
|
+
export declare function TablePagination({ page, totalPages, pageSize, totalItems, pageSizeOptions, onPageChange, onPageSizeChange, itemLabel, className }: TablePaginationProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './DataTable';
|
|
2
|
+
export * from './DataTable.types';
|
|
3
|
+
export * from './TableToolbar';
|
|
4
|
+
export * from './TablePagination';
|
|
5
|
+
export * from './TableEmptyState';
|
|
6
|
+
export * from './TableSkeleton';
|
|
7
|
+
export * from './TableErrorState';
|
|
8
|
+
export * from './TableRowActions';
|
|
9
|
+
export * from './TableBulkActions';
|
|
10
|
+
export * from './TableColumnVisibility';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TrendDirection } from './MetricCard.types';
|
|
2
|
+
export declare const MetricCard: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLDivElement> & {
|
|
3
|
+
title: import('react').ReactNode;
|
|
4
|
+
value: import('react').ReactNode;
|
|
5
|
+
subtitle?: import('react').ReactNode;
|
|
6
|
+
description?: import('react').ReactNode;
|
|
7
|
+
trendValue?: import('react').ReactNode;
|
|
8
|
+
trendDirection?: TrendDirection;
|
|
9
|
+
icon?: import('react').ReactNode;
|
|
10
|
+
action?: import('react').ReactNode;
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
error?: import('react').ReactNode;
|
|
13
|
+
compact?: boolean;
|
|
14
|
+
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type TrendDirection = "up" | "down" | "neutral";
|
|
3
|
+
export type MetricCardProps = HTMLAttributes<HTMLDivElement> & {
|
|
4
|
+
title: ReactNode;
|
|
5
|
+
value: ReactNode;
|
|
6
|
+
subtitle?: ReactNode;
|
|
7
|
+
description?: ReactNode;
|
|
8
|
+
trendValue?: ReactNode;
|
|
9
|
+
trendDirection?: TrendDirection;
|
|
10
|
+
icon?: ReactNode;
|
|
11
|
+
action?: ReactNode;
|
|
12
|
+
loading?: boolean;
|
|
13
|
+
error?: ReactNode;
|
|
14
|
+
compact?: boolean;
|
|
15
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const EmptyState: import('react').ForwardRefExoticComponent<Omit<import('react').HTMLAttributes<HTMLDivElement>, "title"> & {
|
|
2
|
+
icon?: import('react').ReactNode;
|
|
3
|
+
illustration?: import('react').ReactNode;
|
|
4
|
+
title: import('react').ReactNode;
|
|
5
|
+
description?: import('react').ReactNode;
|
|
6
|
+
primaryAction?: import('react').ReactNode;
|
|
7
|
+
secondaryAction?: import('react').ReactNode;
|
|
8
|
+
action?: import('react').ReactNode;
|
|
9
|
+
variant?: import('./EmptyState.types').EmptyStateVariant;
|
|
10
|
+
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type EmptyStateVariant = "default" | "compact" | "full-page" | "table";
|
|
3
|
+
export type EmptyStateProps = Omit<HTMLAttributes<HTMLDivElement>, "title"> & {
|
|
4
|
+
icon?: ReactNode;
|
|
5
|
+
illustration?: ReactNode;
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
description?: ReactNode;
|
|
8
|
+
primaryAction?: ReactNode;
|
|
9
|
+
secondaryAction?: ReactNode;
|
|
10
|
+
action?: ReactNode;
|
|
11
|
+
variant?: EmptyStateVariant;
|
|
12
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const ErrorState: import('react').ForwardRefExoticComponent<Omit<import('react').HTMLAttributes<HTMLDivElement>, "title"> & {
|
|
2
|
+
icon?: import('react').ReactNode;
|
|
3
|
+
title?: import('react').ReactNode;
|
|
4
|
+
description?: import('react').ReactNode;
|
|
5
|
+
retryAction?: import('react').ReactNode;
|
|
6
|
+
secondaryAction?: import('react').ReactNode;
|
|
7
|
+
variant?: import('./ErrorState.types').ErrorStateVariant;
|
|
8
|
+
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type ErrorStateVariant = "default" | "compact" | "full-page" | "table";
|
|
3
|
+
export type ErrorStateProps = Omit<HTMLAttributes<HTMLDivElement>, "title"> & {
|
|
4
|
+
icon?: ReactNode;
|
|
5
|
+
title?: ReactNode;
|
|
6
|
+
description?: ReactNode;
|
|
7
|
+
retryAction?: ReactNode;
|
|
8
|
+
secondaryAction?: ReactNode;
|
|
9
|
+
variant?: ErrorStateVariant;
|
|
10
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const LoadingState: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLDivElement> & {
|
|
2
|
+
label?: import('react').ReactNode;
|
|
3
|
+
description?: import('react').ReactNode;
|
|
4
|
+
variant?: import('./LoadingState.types').LoadingStateVariant;
|
|
5
|
+
rows?: number;
|
|
6
|
+
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type LoadingStateVariant = "spinner" | "skeleton";
|
|
3
|
+
export type LoadingStateProps = HTMLAttributes<HTMLDivElement> & {
|
|
4
|
+
label?: ReactNode;
|
|
5
|
+
description?: ReactNode;
|
|
6
|
+
variant?: LoadingStateVariant;
|
|
7
|
+
rows?: number;
|
|
8
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ToastManagerProps, ToastProviderProps } from './Toast.types';
|
|
2
|
+
export declare function ToastManager({ toasts, onDismiss, placement, className }: ToastManagerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
3
|
+
export declare function ToastProvider({ children, placement, maxToasts, defaultDuration, className }: ToastProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type ToastTone = "neutral" | "success" | "warning" | "danger" | "info";
|
|
3
|
+
export type ToastPlacement = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
|
|
4
|
+
export type ToastInput = string | {
|
|
5
|
+
id?: string;
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
description?: ReactNode;
|
|
8
|
+
tone?: ToastTone;
|
|
9
|
+
duration?: number;
|
|
10
|
+
icon?: ReactNode;
|
|
11
|
+
action?: ReactNode;
|
|
12
|
+
dismissible?: boolean;
|
|
13
|
+
className?: string;
|
|
14
|
+
};
|
|
15
|
+
export type ToastRecord = {
|
|
16
|
+
id: string;
|
|
17
|
+
title: ReactNode;
|
|
18
|
+
description?: ReactNode;
|
|
19
|
+
tone: ToastTone;
|
|
20
|
+
duration: number;
|
|
21
|
+
icon?: ReactNode;
|
|
22
|
+
action?: ReactNode;
|
|
23
|
+
dismissible: boolean;
|
|
24
|
+
className?: string;
|
|
25
|
+
};
|
|
26
|
+
export type ToastManagerProps = {
|
|
27
|
+
toasts: ToastRecord[];
|
|
28
|
+
onDismiss: (id: string) => void;
|
|
29
|
+
placement?: ToastPlacement;
|
|
30
|
+
className?: string;
|
|
31
|
+
};
|
|
32
|
+
export type ToastProviderProps = {
|
|
33
|
+
children: ReactNode;
|
|
34
|
+
placement?: ToastPlacement;
|
|
35
|
+
maxToasts?: number;
|
|
36
|
+
defaultDuration?: number;
|
|
37
|
+
className?: string;
|
|
38
|
+
};
|
|
39
|
+
export type ToastContextValue = {
|
|
40
|
+
toasts: ToastRecord[];
|
|
41
|
+
toast: (input: ToastInput) => string;
|
|
42
|
+
success: (input: string | Omit<Extract<ToastInput, object>, "tone">) => string;
|
|
43
|
+
warning: (input: string | Omit<Extract<ToastInput, object>, "tone">) => string;
|
|
44
|
+
danger: (input: string | Omit<Extract<ToastInput, object>, "tone">) => string;
|
|
45
|
+
info: (input: string | Omit<Extract<ToastInput, object>, "tone">) => string;
|
|
46
|
+
dismiss: (id: string) => void;
|
|
47
|
+
clear: () => void;
|
|
48
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DateRangePickerProps } from './DateRangePicker.types';
|
|
2
|
+
export declare function DateRangePicker({ className, value, defaultValue, onChange, presets, placeholder, label, helperText, size, disabled, clearable, minDate, maxDate, maxRangeDays, months, align, side, open: controlledOpen, defaultOpen, onOpenChange, infoText, customPresetLabel, applyLabel, cancelLabel, clearLabel, formatDate, formatRange, triggerClassName, contentClassName, calendarClassName, ...props }: DateRangePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare namespace DateRangePicker {
|
|
4
|
+
var displayName: string;
|
|
5
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
+
import { ComponentSize } from '../../../tokens';
|
|
3
|
+
export type DateRangePresetId = string;
|
|
4
|
+
export type DateRangeValue = {
|
|
5
|
+
preset?: DateRangePresetId;
|
|
6
|
+
from?: Date;
|
|
7
|
+
to?: Date;
|
|
8
|
+
};
|
|
9
|
+
export type DateRangePreset = {
|
|
10
|
+
id: DateRangePresetId;
|
|
11
|
+
label: ReactNode;
|
|
12
|
+
getRange: () => {
|
|
13
|
+
from: Date;
|
|
14
|
+
to: Date;
|
|
15
|
+
};
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type DateRangePickerProps = Omit<ComponentPropsWithoutRef<"div">, "defaultValue" | "onChange"> & {
|
|
19
|
+
value?: DateRangeValue;
|
|
20
|
+
defaultValue?: DateRangeValue;
|
|
21
|
+
onChange?: (value: DateRangeValue) => void;
|
|
22
|
+
presets?: DateRangePreset[];
|
|
23
|
+
placeholder?: ReactNode;
|
|
24
|
+
label?: ReactNode;
|
|
25
|
+
helperText?: ReactNode;
|
|
26
|
+
size?: ComponentSize;
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
clearable?: boolean;
|
|
29
|
+
minDate?: Date;
|
|
30
|
+
maxDate?: Date;
|
|
31
|
+
maxRangeDays?: number;
|
|
32
|
+
months?: 1 | 2;
|
|
33
|
+
align?: "start" | "center" | "end";
|
|
34
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
35
|
+
open?: boolean;
|
|
36
|
+
defaultOpen?: boolean;
|
|
37
|
+
onOpenChange?: (open: boolean) => void;
|
|
38
|
+
infoText?: ReactNode;
|
|
39
|
+
customPresetLabel?: ReactNode;
|
|
40
|
+
applyLabel?: ReactNode;
|
|
41
|
+
cancelLabel?: ReactNode;
|
|
42
|
+
clearLabel?: ReactNode;
|
|
43
|
+
formatDate?: (date: Date) => string;
|
|
44
|
+
formatRange?: (value: DateRangeValue) => ReactNode;
|
|
45
|
+
triggerClassName?: string;
|
|
46
|
+
contentClassName?: string;
|
|
47
|
+
calendarClassName?: string;
|
|
48
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { DateRangePreset, DateRangePresetId, DateRangeValue } from './DateRangePicker.types';
|
|
2
|
+
export declare const CUSTOM_PRESET_ID = "Custom";
|
|
3
|
+
export declare const DAY_MS: number;
|
|
4
|
+
export declare const MONTH_NAMES: string[];
|
|
5
|
+
export declare const SHORT_MONTH_NAMES: string[];
|
|
6
|
+
export declare const DAY_HEADS: string[];
|
|
7
|
+
export declare function startOfDay(date: Date): Date;
|
|
8
|
+
export declare function addDays(date: Date, days: number): Date;
|
|
9
|
+
export declare function compareDay(a: Date, b: Date): number;
|
|
10
|
+
export declare function differenceInCalendarDays(a: Date, b: Date): number;
|
|
11
|
+
export declare function sameDay(a: Date, b?: Date): boolean;
|
|
12
|
+
export declare function daysInMonth(year: number, month: number): number;
|
|
13
|
+
export declare function shiftMonth(year: number, month: number, delta: number): {
|
|
14
|
+
year: number;
|
|
15
|
+
month: number;
|
|
16
|
+
};
|
|
17
|
+
export declare function normalizeRange(from: Date, to: Date): {
|
|
18
|
+
from: Date;
|
|
19
|
+
to: Date;
|
|
20
|
+
};
|
|
21
|
+
export declare function defaultFormatDate(date: Date): string;
|
|
22
|
+
export declare function presetToRange(preset: DateRangePresetId): {
|
|
23
|
+
from: Date;
|
|
24
|
+
to: Date;
|
|
25
|
+
};
|
|
26
|
+
export declare const defaultDateRangePresets: DateRangePreset[];
|
|
27
|
+
export declare function hasCompleteRange(value: DateRangeValue): value is DateRangeValue & {
|
|
28
|
+
from: Date;
|
|
29
|
+
to: Date;
|
|
30
|
+
};
|
|
31
|
+
export declare function getInitialCalendar(value: DateRangeValue, months: 1 | 2): {
|
|
32
|
+
year: number;
|
|
33
|
+
month: number;
|
|
34
|
+
};
|
|
35
|
+
export declare function getPresetLabel(presets: DateRangePreset[], presetId?: string): import('react').ReactNode;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const FilterBar: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLDivElement> & {
|
|
2
|
+
searchValue?: string;
|
|
3
|
+
onSearchChange?: (value: string) => void;
|
|
4
|
+
onClearSearch?: () => void;
|
|
5
|
+
searchPlaceholder?: string;
|
|
6
|
+
searchInput?: import('react').ReactNode;
|
|
7
|
+
filterTrigger?: import('react').ReactNode;
|
|
8
|
+
onOpenFilters?: () => void;
|
|
9
|
+
activeFiltersCount?: number;
|
|
10
|
+
filterChips?: import('./FilterBar.types').FilterChipItem[];
|
|
11
|
+
onClearAllFilters?: () => void;
|
|
12
|
+
primaryAction?: import('react').ReactNode;
|
|
13
|
+
secondaryActions?: import('react').ReactNode;
|
|
14
|
+
sticky?: boolean;
|
|
15
|
+
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type FilterChipItem = {
|
|
3
|
+
id: string;
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
onRemove?: () => void;
|
|
6
|
+
};
|
|
7
|
+
export type FilterBarProps = HTMLAttributes<HTMLDivElement> & {
|
|
8
|
+
searchValue?: string;
|
|
9
|
+
onSearchChange?: (value: string) => void;
|
|
10
|
+
onClearSearch?: () => void;
|
|
11
|
+
searchPlaceholder?: string;
|
|
12
|
+
searchInput?: ReactNode;
|
|
13
|
+
filterTrigger?: ReactNode;
|
|
14
|
+
onOpenFilters?: () => void;
|
|
15
|
+
activeFiltersCount?: number;
|
|
16
|
+
filterChips?: FilterChipItem[];
|
|
17
|
+
onClearAllFilters?: () => void;
|
|
18
|
+
primaryAction?: ReactNode;
|
|
19
|
+
secondaryActions?: ReactNode;
|
|
20
|
+
sticky?: boolean;
|
|
21
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { FilterDrawerProps } from './FilterDrawer.types';
|
|
2
|
+
export declare function FilterDrawer({ open, onOpenChange, onClose, title, description, children, activeFiltersCount, applyLabel, resetLabel, onApply, onReset, applying, footerActions, className }: FilterDrawerProps): import("react/jsx-runtime").JSX.Element;
|