blixify-ui-web-mcp 0.1.2 → 0.1.18
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/lib/components/action/button/README.md +12 -11
- package/lib/components/action/button/button.stories.tsx +4 -10
- package/lib/components/action/buttonGroup/buttonGroup.stories.tsx +4 -10
- package/lib/components/action/iconButton/iconButton.stories.tsx +4 -10
- package/lib/components/action/radioList/radioList.stories.tsx +4 -10
- package/lib/components/action/slider/slider.stories.tsx +4 -10
- package/lib/components/action/textButton/textButton.stories.tsx +4 -10
- package/lib/components/action/toggle/toggle.stories.tsx +4 -10
- package/lib/components/advanced/collapse/collapse.stories.tsx +4 -10
- package/lib/components/advanced/infoWindow/infoWindow.stories.tsx +4 -10
- package/lib/components/advanced/popUp/README.md +21 -7
- package/lib/components/advanced/popUp/popUp.stories.tsx +4 -10
- package/lib/components/auth/bareSignIn/bareSignIn.stories.tsx +30 -10
- package/lib/components/auth/bareSignUp/bareSignUp.stories.tsx +4 -10
- package/lib/components/auth/signIn/signIn.stories.tsx +4 -10
- package/lib/components/auth/signUp/signUp.stories.tsx +4 -10
- package/lib/components/chart/areaChart/areaChart.stories.tsx +7 -13
- package/lib/components/chart/barChart/barChart.stories.tsx +7 -13
- package/lib/components/chart/boxPlotChart/boxPlotChart.stories.tsx +8 -14
- package/lib/components/chart/bubbleChart/bubbleChart.stories.tsx +8 -14
- package/lib/components/chart/card/card.stories.tsx +4 -10
- package/lib/components/chart/ganttChart/README.md +96 -110
- package/lib/components/chart/ganttChart/ganttChart.stories.tsx +135 -125
- package/lib/components/chart/heatmapChart/README.md +93 -82
- package/lib/components/chart/heatmapChart/heatmapChart.stories.tsx +122 -84
- package/lib/components/chart/lineChart/lineChart.stories.tsx +4 -10
- package/lib/components/chart/pieChart/pieChart.stories.tsx +4 -10
- package/lib/components/chart/polarAreaChart/polarAreaChart.stories.tsx +8 -14
- package/lib/components/chart/radarChart/radarChart.stories.tsx +4 -10
- package/lib/components/chart/radialBar/radialChart.stories.tsx +4 -10
- package/lib/components/chart/rangeBarChart/rangeBarChart.stories.tsx +4 -10
- package/lib/components/chart/statsCard/statsCard.stories.tsx +4 -10
- package/lib/components/chart/treemapChart/treemapChart.stories.tsx +8 -14
- package/lib/components/chat/chatAnchor/README.md +61 -79
- package/lib/components/chat/chatAnchor/chatAnchor.stories.tsx +13 -19
- package/lib/components/chat/chatBase/README.md +244 -196
- package/lib/components/chat/chatBase/chatBase.stories.tsx +828 -250
- package/lib/components/chat/chatDashboard/README.md +89 -129
- package/lib/components/chat/chatDashboard/chatDashboard.stories.tsx +406 -117
- package/lib/components/data/dataGraph/README.md +135 -1
- package/lib/components/data/dataGraph/dataGraph.stories.tsx +90 -77
- package/lib/components/data/dataReference/README.md +141 -43
- package/lib/components/data/dataReference/dataReference.stories.tsx +111 -45
- package/lib/components/data/dataTemplate/README.md +88 -61
- package/lib/components/data/dataTemplate/dataModule.stories.tsx +4 -10
- package/lib/components/data/dataTemplate/dataTemplate.stories.tsx +4 -10
- package/lib/components/data/dataWrapper/README.md +48 -46
- package/lib/components/data/dataWrapper/dataWrapper.stories.tsx +258 -489
- package/lib/components/data/queryForm/queryForm.stories.tsx +4 -10
- package/lib/components/data/readQuery/readQuery.stories.tsx +4 -9
- package/lib/components/data/readQueryHoc/readQueryHoc.stories.tsx +4 -10
- package/lib/components/data/writeQuery/writeQuery.stories.tsx +4 -8
- package/lib/components/design/actionSection/actionSection.stories.tsx +6 -10
- package/lib/components/design/banner/banner.stories.tsx +4 -10
- package/lib/components/design/bannerAction/bannerAction.stories.tsx +4 -10
- package/lib/components/design/blogSection/blogSection.stories.tsx +4 -10
- package/lib/components/design/carouselSection/carouselSection.stories.tsx +4 -10
- package/lib/components/design/designList/designList.stories.tsx +4 -10
- package/lib/components/design/faq/faq.stories.tsx +4 -10
- package/lib/components/design/fileGrid/fileGrid.stories.tsx +4 -10
- package/lib/components/design/fileViewer/fileViewer.stories.tsx +4 -10
- package/lib/components/design/footerSection/footerSection.stories.tsx +4 -10
- package/lib/components/design/googleReview/googleReview.stories.tsx +4 -10
- package/lib/components/design/heroSection/heroSection.stories.tsx +4 -10
- package/lib/components/design/iconList/iconList.stories.tsx +4 -10
- package/lib/components/design/imageGallery/imageGallery.stories.tsx +4 -10
- package/lib/components/design/imageZoom/imageZoom.stories.tsx +4 -10
- package/lib/components/design/leftContent/leftContent.stories.tsx +4 -10
- package/lib/components/design/logoCloud/logoCloud.stories.tsx +4 -10
- package/lib/components/design/onboarding/onboarding.stories.tsx +4 -10
- package/lib/components/design/pricing/pricing.stories.tsx +4 -10
- package/lib/components/design/rightContent/rightContent.stories.tsx +4 -10
- package/lib/components/design/sectionList/sectionList.stories.tsx +4 -10
- package/lib/components/design/teams/teams.stories.tsx +4 -10
- package/lib/components/display/alert/alert.stories.tsx +4 -10
- package/lib/components/display/calendar/README.md +49 -0
- package/lib/components/display/calendar/calendar.stories.tsx +71 -28
- package/lib/components/display/clipboard/clipboard.stories.tsx +4 -10
- package/lib/components/display/detailList/detailList.stories.tsx +5 -10
- package/lib/components/display/drawer/drawer.stories.tsx +5 -10
- package/lib/components/display/emptyState/emptyState.stories.tsx +4 -10
- package/lib/components/display/feeds/feeds.stories.tsx +4 -10
- package/lib/components/display/flexTable/README.md +11 -7
- package/lib/components/display/flexTable/flexTable.stories.tsx +114 -11
- package/lib/components/display/grid/README.md +28 -27
- package/lib/components/display/grid/grid.stories.tsx +4 -10
- package/lib/components/display/kanban/kanban.stories.tsx +14 -20
- package/lib/components/display/list/README.md +30 -29
- package/lib/components/display/list/list.stories.tsx +4 -10
- package/lib/components/display/loading/loading.stories.tsx +5 -10
- package/lib/components/display/mapView/mapView.stories.tsx +4 -10
- package/lib/components/display/modal/modal.stories.tsx +4 -11
- package/lib/components/display/notification/notification.stories.tsx +4 -10
- package/lib/components/display/progress/progress.stories.tsx +5 -10
- package/lib/components/display/stepper/stepper.stories.tsx +5 -10
- package/lib/components/display/table/README.md +38 -37
- package/lib/components/display/table/table.stories.tsx +8 -14
- package/lib/components/display/tag/tag.stories.tsx +4 -10
- package/lib/components/input/address/address.stories.tsx +4 -10
- package/lib/components/input/canvas/canvas.stories.tsx +4 -10
- package/lib/components/input/checkbox/checkbox.stories.tsx +4 -10
- package/lib/components/input/datePicker/datePicker.stories.tsx +4 -10
- package/lib/components/input/form/form.stories.tsx +4 -10
- package/lib/components/input/markdown/markdown.stories.tsx +5 -10
- package/lib/components/input/monthYearPicker/monthYearPicker.stories.tsx +4 -10
- package/lib/components/input/netPromoterScore/netPromoterScore.stories.tsx +4 -10
- package/lib/components/input/rating/rating.stories.tsx +4 -10
- package/lib/components/input/select/README.md +30 -29
- package/lib/components/input/select/select.stories.tsx +4 -10
- package/lib/components/input/signature/signature.stories.tsx +4 -10
- package/lib/components/input/textArea/textArea.stories.tsx +4 -10
- package/lib/components/input/textInput/textinput.stories.tsx +4 -10
- package/lib/components/input/uploadInput/uploadInput.stories.tsx +135 -11
- package/lib/components/navigation/bars/README.md +90 -17
- package/lib/components/navigation/bars/bars.stories.tsx +128 -60
- package/lib/components/navigation/bottomTab/bottomTab.stories.tsx +5 -10
- package/lib/components/navigation/breadcrumb/README.md +40 -20
- package/lib/components/navigation/breadcrumb/breadcrumb.stories.tsx +34 -14
- package/lib/components/navigation/header/README.md +67 -108
- package/lib/components/navigation/header/header.stories.tsx +165 -49
- package/lib/components/navigation/leftNav/README.md +121 -66
- package/lib/components/navigation/leftNav/leftNav.stories.tsx +178 -91
- package/lib/components/navigation/tabs/tabs.stories.tsx +57 -39
- package/lib/components/structure/column/column.stories.tsx +5 -10
- package/lib/components/structure/container/container.stories.tsx +5 -10
- package/lib/components/structure/link/link.stories.tsx +4 -10
- package/lib/components/structure/text/text.stories.tsx +5 -10
- package/lib/components/template/authPage/authPage.stories.tsx +6 -5
- package/lib/components/template/landingPage/landingPage.stories.tsx +8 -6
- package/lib/components/template/productListing/productListing.stories.tsx +7 -13
- package/lib/components/template/productOverview/productOverview.stories.tsx +5 -11
- package/lib/components/template/shoppingCart/shoppingCart.stories.tsx +6 -12
- package/lib/components/template/userHomePage/userHomePage.stories.tsx +7 -6
- package/lib/components/template/userRankingDashboard/userRankingDashboard.stories.tsx +5 -11
- package/package.json +1 -1
|
@@ -4,10 +4,144 @@
|
|
|
4
4
|
|
|
5
5
|
<hr>
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
A dashboard chart grid that fetches and renders analytics data from a remote API. Supports card, bar, line, pie, and radar chart types in a responsive grid layout. Each chart handles its own data fetching, date range filtering, and attribute filtering.
|
|
8
8
|
|
|
9
9
|
##### Import
|
|
10
10
|
|
|
11
11
|
```js
|
|
12
12
|
import { DataGraph } from "blixify-ui-web/components/data/dataGraph";
|
|
13
13
|
```
|
|
14
|
+
|
|
15
|
+
##### Usage
|
|
16
|
+
|
|
17
|
+
Basic dashboard with card and bar charts:
|
|
18
|
+
|
|
19
|
+
```jsx
|
|
20
|
+
<DataGraph
|
|
21
|
+
charts={[
|
|
22
|
+
{
|
|
23
|
+
gridSize: 1,
|
|
24
|
+
type: "card",
|
|
25
|
+
title: "Total Products",
|
|
26
|
+
spaceId: "products",
|
|
27
|
+
query: [],
|
|
28
|
+
queryBaseType: "count",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
gridSize: 1,
|
|
32
|
+
type: "card",
|
|
33
|
+
title: "Total Revenue",
|
|
34
|
+
spaceId: "orders",
|
|
35
|
+
query: [],
|
|
36
|
+
queryBaseType: "sum",
|
|
37
|
+
queryAttributeId: ["price"],
|
|
38
|
+
queryBaseDateId: "createdAt",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
gridSize: 2,
|
|
42
|
+
type: "bar",
|
|
43
|
+
title: "Sales by Product",
|
|
44
|
+
spaceId: "orders",
|
|
45
|
+
query: [
|
|
46
|
+
{ type: "=", queryId: "code", value: "P001" },
|
|
47
|
+
{ type: "=", queryId: "code", value: "P002" },
|
|
48
|
+
],
|
|
49
|
+
queryBaseType: "sum",
|
|
50
|
+
queryAttributeId: ["price"],
|
|
51
|
+
},
|
|
52
|
+
]}
|
|
53
|
+
workspace={{
|
|
54
|
+
apiEndpoint: "http://localhost:3000/api",
|
|
55
|
+
apiEndpointType: "mongoDB",
|
|
56
|
+
}}
|
|
57
|
+
/>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Line chart with date range:
|
|
61
|
+
|
|
62
|
+
```jsx
|
|
63
|
+
{
|
|
64
|
+
gridSize: 2,
|
|
65
|
+
type: "line",
|
|
66
|
+
title: "Orders Over Time",
|
|
67
|
+
spaceId: "orders",
|
|
68
|
+
query: [],
|
|
69
|
+
queryBaseType: "count",
|
|
70
|
+
queryBaseDateId: "createdAt",
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Radar chart comparing multiple attributes across query groups:
|
|
75
|
+
|
|
76
|
+
```jsx
|
|
77
|
+
{
|
|
78
|
+
gridSize: 2,
|
|
79
|
+
type: "radar",
|
|
80
|
+
title: "Performance",
|
|
81
|
+
spaceId: "reports",
|
|
82
|
+
query: [
|
|
83
|
+
{ type: "=", queryId: "status", value: "Completed" },
|
|
84
|
+
{ type: "=", queryId: "status", value: "Pending" },
|
|
85
|
+
],
|
|
86
|
+
queryBaseType: "sum",
|
|
87
|
+
queryAttributeId: ["revenue", "units", "returns"],
|
|
88
|
+
queryBaseDateId: "createdAt",
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Custom layout via renderSettings:
|
|
93
|
+
|
|
94
|
+
```jsx
|
|
95
|
+
<DataGraph
|
|
96
|
+
charts={charts}
|
|
97
|
+
workspace={workspace}
|
|
98
|
+
renderSettings={(chartsElement, data) => (
|
|
99
|
+
<div className="my-custom-wrapper">{chartsElement}</div>
|
|
100
|
+
)}
|
|
101
|
+
/>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
##### Required props
|
|
105
|
+
|
|
106
|
+
| Name | Type | Description |
|
|
107
|
+
| ----------- | ---------------------- | -------------------------------------------------------- |
|
|
108
|
+
| `charts` | `Charts[]` | List of chart definitions — see Charts below |
|
|
109
|
+
| `workspace` | `WorkspaceDevSettings` | API connection settings — see WorkspaceDevSettings below |
|
|
110
|
+
|
|
111
|
+
##### Optional props
|
|
112
|
+
|
|
113
|
+
| Name | Type | Default | Description |
|
|
114
|
+
| ---------------- | ------------------------------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
115
|
+
| `gridSize` | `2 \| 3` | — | Override the grid column layout. Default is a responsive `1 → 2 → 4` column grid. `2` forces 2 cols, `3` forces 3 cols. |
|
|
116
|
+
| `renderSettings` | `(charts: ReactElement, data: any) => any` | — | Custom render function. Receives the rendered charts element and the raw analytics data object. Use to wrap charts in a custom layout. |
|
|
117
|
+
|
|
118
|
+
##### Charts
|
|
119
|
+
|
|
120
|
+
| Name | Type | Description |
|
|
121
|
+
| ------------------ | ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
|
122
|
+
| `type` | `"card" \| "bar" \| "line" \| "pie" \| "radar"` | Chart type to render |
|
|
123
|
+
| `title` | `string` | Chart title — also used as the key for internal state |
|
|
124
|
+
| `spaceId` | `string` | The collection/space ID to query data from |
|
|
125
|
+
| `gridSize` | `number` | Number of grid columns this chart spans |
|
|
126
|
+
| `query` | `Query[]` | Data series definitions. Each query entry produces one data point or series segment. Pass `[]` for a single aggregate. |
|
|
127
|
+
| `queryBaseType` | `"count" \| "sum" \| "avg" \| "value"` | Aggregate function. Defaults to `"count"`. |
|
|
128
|
+
| `queryAttributeId` | `string[]` | Required when `queryBaseType` is `"sum"`, `"avg"`, or `"value"`. The field(s) to aggregate. For `radar`, each entry becomes a radar axis. |
|
|
129
|
+
| `queryBaseDateId` | `string` | Field used for date range filtering. When set, a date range picker is shown on the chart. |
|
|
130
|
+
| `queryReferenceId` | `string` | Field used for reference-based filtering when a reference filter is active. |
|
|
131
|
+
| `baseQuery` | `Query[]` | Static filter queries always applied alongside any dynamic filters. |
|
|
132
|
+
| `description` | `string` | Subtitle shown on `card` type charts |
|
|
133
|
+
| `cardIcon` | `string` | Heroicon name (solid) for the card icon, e.g. `"UserIcon"`. Defaults to `FolderIcon`. |
|
|
134
|
+
| `cardIconBgColor` | `string` | Tailwind bg class for the card icon background |
|
|
135
|
+
| `colors` | `string[]` | Custom color array for chart segments/bars/lines |
|
|
136
|
+
| `orientation` | `"col" \| "row"` | Bar chart orientation. Defaults to `"row"`. |
|
|
137
|
+
| `stackedVertical` | `boolean` | Enables stacked bars on bar charts |
|
|
138
|
+
|
|
139
|
+
##### WorkspaceDevSettings
|
|
140
|
+
|
|
141
|
+
| Name | Type | Description |
|
|
142
|
+
| ------------------ | -------------------------------------------------------------------------- | ------------------------------- |
|
|
143
|
+
| `apiEndpoint` | `string` | Base URL for the data API |
|
|
144
|
+
| `apiEndpointType` | `"mongoDB" \| "firebase" \| "mongoServer" \| "fbServer" \| "mondayServer"` | Server/DB type driving the API |
|
|
145
|
+
| `apiEndpointToken` | `string` | Auth token for the API endpoint |
|
|
146
|
+
| `apiUserToken` | `string` | Per-user auth token |
|
|
147
|
+
| `assetEndpoint` | `string` | Base URL for asset/file storage |
|
|
@@ -1,84 +1,97 @@
|
|
|
1
|
-
import { storiesOf } from "@storybook/react";
|
|
2
1
|
import React from "react";
|
|
3
|
-
import {
|
|
4
|
-
import README from "./README.md";
|
|
2
|
+
import { StorySection } from "../../storyUtils";
|
|
5
3
|
import { DataGraph } from "./index";
|
|
6
4
|
|
|
7
|
-
const
|
|
5
|
+
const meta = { title: "Data/Data Graph" };
|
|
6
|
+
export default meta;
|
|
8
7
|
|
|
9
|
-
stories.addParameters({
|
|
10
|
-
readme: {
|
|
11
|
-
content: README,
|
|
12
|
-
},
|
|
13
|
-
});
|
|
14
8
|
|
|
15
|
-
|
|
9
|
+
const workspace = {
|
|
10
|
+
apiEndpoint: "http://localhost:3000/api",
|
|
11
|
+
apiEndpointType: "mongoDB" as const,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const DataGraphStory = () => {
|
|
16
15
|
return (
|
|
17
|
-
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
16
|
+
<>
|
|
17
|
+
<StorySection
|
|
18
|
+
title="Card Charts"
|
|
19
|
+
description="type='card' renders a stat card. queryBaseType='count' counts records; 'sum' totals a numeric field specified in queryAttributeId. queryBaseDateId enables a date range picker on the card."
|
|
20
|
+
>
|
|
21
|
+
<div className="w-full">
|
|
22
|
+
<DataGraph
|
|
23
|
+
charts={[
|
|
24
|
+
{
|
|
25
|
+
gridSize: 1,
|
|
26
|
+
type: "card",
|
|
27
|
+
title: "Total Products",
|
|
28
|
+
description: "All products in catalogue",
|
|
29
|
+
spaceId: "esh-products",
|
|
30
|
+
query: [],
|
|
31
|
+
queryBaseType: "count",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
gridSize: 1,
|
|
35
|
+
type: "card",
|
|
36
|
+
title: "Total Revenue",
|
|
37
|
+
description: "Sum of all order prices",
|
|
38
|
+
spaceId: "esh-products",
|
|
39
|
+
query: [],
|
|
40
|
+
queryBaseType: "sum",
|
|
41
|
+
queryAttributeId: ["price"],
|
|
42
|
+
queryBaseDateId: "createdAt",
|
|
43
|
+
},
|
|
44
|
+
]}
|
|
45
|
+
workspace={workspace}
|
|
46
|
+
gridSize={2}
|
|
47
|
+
/>
|
|
48
|
+
</div>
|
|
49
|
+
</StorySection>
|
|
50
|
+
|
|
51
|
+
<StorySection
|
|
52
|
+
title="Mixed Dashboard"
|
|
53
|
+
description="Combine multiple chart types in one DataGraph. Each chart's gridSize controls how many columns it spans within the grid."
|
|
54
|
+
>
|
|
55
|
+
<div className="w-full">
|
|
56
|
+
<DataGraph
|
|
57
|
+
charts={[
|
|
58
|
+
{
|
|
59
|
+
gridSize: 1,
|
|
60
|
+
type: "card",
|
|
61
|
+
title: "All Products",
|
|
62
|
+
description: "Total product count",
|
|
63
|
+
spaceId: "esh-products",
|
|
64
|
+
query: [],
|
|
65
|
+
queryBaseType: "count",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
gridSize: 1,
|
|
69
|
+
type: "card",
|
|
70
|
+
title: "Total Price",
|
|
71
|
+
description: "Sum of all prices",
|
|
72
|
+
spaceId: "esh-products",
|
|
73
|
+
query: [],
|
|
74
|
+
queryBaseType: "sum",
|
|
75
|
+
queryAttributeId: ["price"],
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
gridSize: 2,
|
|
79
|
+
type: "bar",
|
|
80
|
+
title: "Price per Code",
|
|
81
|
+
spaceId: "esh-products",
|
|
82
|
+
query: [
|
|
83
|
+
{ type: "=", queryId: "code", value: "P001" },
|
|
84
|
+
{ type: "=", queryId: "code", value: "N001" },
|
|
85
|
+
{ type: "=", queryId: "code", value: "A001" },
|
|
86
|
+
],
|
|
87
|
+
queryBaseType: "sum",
|
|
88
|
+
queryAttributeId: ["price"],
|
|
89
|
+
},
|
|
90
|
+
]}
|
|
91
|
+
workspace={workspace}
|
|
92
|
+
/>
|
|
93
|
+
</div>
|
|
94
|
+
</StorySection>
|
|
95
|
+
</>
|
|
83
96
|
);
|
|
84
|
-
}
|
|
97
|
+
}
|
|
@@ -4,59 +4,157 @@
|
|
|
4
4
|
|
|
5
5
|
<hr>
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
A searchable select input that fetches its options from a remote data source. Supports single (`reference`) and multi-select (`listReference`) modes, live search, query filtering, and sort.
|
|
8
8
|
|
|
9
9
|
##### Import
|
|
10
10
|
|
|
11
11
|
```js
|
|
12
12
|
import { DataReference } from "blixify-ui-web/components/data/dataReference";
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
##### Usage
|
|
16
|
+
|
|
17
|
+
Single reference select:
|
|
18
|
+
|
|
19
|
+
```jsx
|
|
20
|
+
const [value, setValue] = useState("");
|
|
21
|
+
|
|
22
|
+
<DataReference
|
|
23
|
+
value={value}
|
|
24
|
+
schema={{
|
|
25
|
+
id: "salesSelected",
|
|
26
|
+
name: "Sales Person",
|
|
27
|
+
type: "reference",
|
|
28
|
+
referenceSpaceId: "salesNameList",
|
|
29
|
+
referenceLabel: "name",
|
|
30
|
+
}}
|
|
31
|
+
devSettings={{
|
|
32
|
+
apiEndpoint: "http://localhost:3000/api",
|
|
33
|
+
apiEndpointType: "mongoDB",
|
|
34
|
+
}}
|
|
35
|
+
lib={{ axios }}
|
|
36
|
+
onChange={(value) => setValue(value)}
|
|
37
|
+
/>;
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
With query filter and sort:
|
|
13
41
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
```jsx
|
|
43
|
+
<DataReference
|
|
44
|
+
value={value}
|
|
45
|
+
schema={{
|
|
46
|
+
id: "salesSelected",
|
|
47
|
+
name: "Sales Person",
|
|
48
|
+
type: "reference",
|
|
49
|
+
referenceSpaceId: "salesNameList",
|
|
50
|
+
referenceLabel: "name",
|
|
51
|
+
referenceQuery: [{ type: "=", value: "Sales", queryId: "role" }],
|
|
52
|
+
referenceSort: { sortId: "name", type: "asc" },
|
|
53
|
+
}}
|
|
54
|
+
devSettings={{
|
|
55
|
+
apiEndpoint: "http://localhost:3000/api",
|
|
56
|
+
apiEndpointType: "mondayServer",
|
|
57
|
+
}}
|
|
58
|
+
lib={{ axios }}
|
|
59
|
+
onChange={(value) => setValue(value)}
|
|
60
|
+
/>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Multi-select (listReference):
|
|
64
|
+
|
|
65
|
+
```jsx
|
|
66
|
+
const [value, setValue] = useState([]);
|
|
67
|
+
|
|
68
|
+
<DataReference
|
|
69
|
+
value={value}
|
|
70
|
+
schema={{
|
|
71
|
+
id: "assignees",
|
|
72
|
+
name: "Assignees",
|
|
73
|
+
type: "listReference",
|
|
74
|
+
referenceSpaceId: "members",
|
|
75
|
+
referenceLabel: "name",
|
|
76
|
+
}}
|
|
77
|
+
devSettings={{
|
|
78
|
+
apiEndpoint: "http://localhost:3000/api",
|
|
79
|
+
apiEndpointType: "mongoDB",
|
|
80
|
+
}}
|
|
81
|
+
lib={{ axios }}
|
|
82
|
+
onChange={(value) => setValue(value)}
|
|
83
|
+
closeOnClickOutside
|
|
84
|
+
/>;
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Dark mode with static dropdown:
|
|
88
|
+
|
|
89
|
+
```jsx
|
|
90
|
+
<div className="p-4 rounded-md bg-zinc-800">
|
|
91
|
+
<DataReference
|
|
92
|
+
value={value}
|
|
93
|
+
schema={{
|
|
94
|
+
id: "title",
|
|
95
|
+
name: "Reference",
|
|
96
|
+
type: "reference",
|
|
97
|
+
referenceSpaceId: "items",
|
|
98
|
+
referenceLabel: "title",
|
|
99
|
+
}}
|
|
100
|
+
devSettings={{
|
|
101
|
+
apiEndpoint: "http://localhost:3000/api",
|
|
102
|
+
apiEndpointType: "mongoDB",
|
|
103
|
+
}}
|
|
104
|
+
lib={{ axios }}
|
|
105
|
+
onChange={(value) => setValue(value)}
|
|
106
|
+
darkMode
|
|
107
|
+
staticDropdown
|
|
108
|
+
/>
|
|
109
|
+
</div>
|
|
42
110
|
```
|
|
43
111
|
|
|
44
112
|
##### Required props
|
|
45
113
|
|
|
46
|
-
| Name
|
|
47
|
-
|
|
|
48
|
-
| value | `any` |
|
|
49
|
-
| schema | `DataStructure` |
|
|
114
|
+
| Name | Type | Description |
|
|
115
|
+
| -------- | --------------- | --------------------------------------------------------------------------- |
|
|
116
|
+
| `value` | `any` | Current value — a string for `reference`, or `string[]` for `listReference` |
|
|
117
|
+
| `schema` | `DataStructure` | Column definition — see schema fields below |
|
|
50
118
|
|
|
51
119
|
##### Optional props
|
|
52
120
|
|
|
53
|
-
| Name
|
|
54
|
-
|
|
|
55
|
-
| devSettings | `WorkspaceDevSettings` |
|
|
56
|
-
|
|
|
57
|
-
|
|
|
58
|
-
| optional | `boolean` |
|
|
59
|
-
|
|
|
60
|
-
|
|
|
61
|
-
|
|
|
62
|
-
|
|
|
121
|
+
| Name | Type | Description |
|
|
122
|
+
| --------------------- | ---------------------- | -------------------------------------------------------------------------------------------------------------------- |
|
|
123
|
+
| `devSettings` | `WorkspaceDevSettings` | API connection settings — see WorkspaceDevSettings below |
|
|
124
|
+
| `lib` | `{ axios?: any }` | Pass your axios instance for making API requests |
|
|
125
|
+
| `onChange` | `(value: any) => void` | Called with the new value when the selection changes |
|
|
126
|
+
| `optional` | `boolean` | When `true`, skips validation on `handleSubmit` |
|
|
127
|
+
| `subLabel` | `string` | Secondary label rendered below the main label for additional context |
|
|
128
|
+
| `darkMode` | `boolean` | Switches the select to a dark theme |
|
|
129
|
+
| `staticDropdown` | `boolean` | When `true`, the parent container expands to fit the open dropdown instead of the dropdown overlapping content below |
|
|
130
|
+
| `closeOnClickOutside` | `boolean` | When `true`, the dropdown closes when the user clicks outside. Applies to `listReference` (multi-select) mode |
|
|
131
|
+
|
|
132
|
+
##### Schema fields (DataStructure)
|
|
133
|
+
|
|
134
|
+
Only fields relevant to `DataReference` are listed. `type` must be `"reference"` or `"listReference"`.
|
|
135
|
+
|
|
136
|
+
| Name | Type | Description |
|
|
137
|
+
| ------------------------- | -------------------------------- | ----------------------------------------------------------------------------------- |
|
|
138
|
+
| `id` | `string` | Unique field identifier |
|
|
139
|
+
| `name` | `string` | Label displayed above the select |
|
|
140
|
+
| `type` | `"reference" \| "listReference"` | `"reference"` for single select, `"listReference"` for multi-select |
|
|
141
|
+
| `referenceSpaceId` | `string` | The collection/space ID to fetch options from |
|
|
142
|
+
| `referenceLabel` | `string` | The field key in each fetched record to use as the option label |
|
|
143
|
+
| `referenceSecondaryLabel` | `string` | Optional secondary label field shown below the primary label in each option |
|
|
144
|
+
| `referenceQuery` | `Query[]` | Optional filter queries applied when fetching options |
|
|
145
|
+
| `referenceSort` | `Sort` | Optional sort applied when fetching options, e.g. `{ sortId: "name", type: "asc" }` |
|
|
146
|
+
| `placeholder` | `string` | Placeholder text shown when no value is selected |
|
|
147
|
+
| `disabled` | `boolean` | Disables the select input |
|
|
148
|
+
| `optional` | `boolean` | Marks the field as optional in form validation |
|
|
149
|
+
|
|
150
|
+
##### WorkspaceDevSettings
|
|
151
|
+
|
|
152
|
+
| Name | Type | Description |
|
|
153
|
+
| ------------------ | -------------------------------------------------------------------------- | ---------------------------------- |
|
|
154
|
+
| `apiEndpoint` | `string` | Base URL for the data API |
|
|
155
|
+
| `apiEndpointType` | `"mongoDB" \| "firebase" \| "mongoServer" \| "fbServer" \| "mondayServer"` | The server/DB type driving the API |
|
|
156
|
+
| `apiEndpointToken` | `string` | Auth token for the API endpoint |
|
|
157
|
+
| `apiUserToken` | `string` | Per-user auth token |
|
|
158
|
+
| `assetEndpoint` | `string` | Base URL for asset/file storage |
|
|
159
|
+
| `assetType` | `"firebase" \| "aws"` | Storage provider type |
|
|
160
|
+
| `assetBucket` | `string` | Storage bucket name |
|