@alepha/ui 0.33.0 → 0.34.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/dist/admin/analytics/AdvancedSection.d.ts.map +1 -1
- package/dist/admin/analytics/AdvancedSection.js +7 -3
- package/dist/admin/analytics/AdvancedSection.js.map +1 -1
- package/dist/admin/analytics/AnalyticsChart.d.ts +1 -0
- package/dist/admin/analytics/AnalyticsChart.d.ts.map +1 -1
- package/dist/admin/analytics/AnalyticsChart.js +3 -1
- package/dist/admin/analytics/AnalyticsChart.js.map +1 -1
- package/dist/admin/analytics/AnalyticsChartHeader.d.ts +5 -0
- package/dist/admin/analytics/AnalyticsChartHeader.d.ts.map +1 -1
- package/dist/admin/analytics/AnalyticsChartHeader.js +7 -2
- package/dist/admin/analytics/AnalyticsChartHeader.js.map +1 -1
- package/dist/admin/analytics/AnalyticsChartLine.d.ts +5 -0
- package/dist/admin/analytics/AnalyticsChartLine.d.ts.map +1 -1
- package/dist/admin/analytics/AnalyticsChartLine.js +6 -2
- package/dist/admin/analytics/AnalyticsChartLine.js.map +1 -1
- package/dist/admin/analytics/CoarsenedBadge.d.ts +15 -0
- package/dist/admin/analytics/CoarsenedBadge.d.ts.map +1 -0
- package/dist/admin/analytics/CoarsenedBadge.js +30 -0
- package/dist/admin/analytics/CoarsenedBadge.js.map +1 -0
- package/dist/admin/analytics/CompareNote.d.ts +5 -0
- package/dist/admin/analytics/CompareNote.d.ts.map +1 -1
- package/dist/admin/analytics/CompareNote.js +5 -1
- package/dist/admin/analytics/CompareNote.js.map +1 -1
- package/dist/admin/analytics/FilterEditor.d.ts +1 -0
- package/dist/admin/analytics/FilterEditor.d.ts.map +1 -1
- package/dist/admin/analytics/FilterEditor.js +1 -0
- package/dist/admin/analytics/FilterEditor.js.map +1 -1
- package/dist/admin/analytics/GroupByChips.d.ts +17 -11
- package/dist/admin/analytics/GroupByChips.d.ts.map +1 -1
- package/dist/admin/analytics/GroupByChips.js +21 -20
- package/dist/admin/analytics/GroupByChips.js.map +1 -1
- package/dist/admin/analytics/MeasureChips.d.ts +11 -6
- package/dist/admin/analytics/MeasureChips.d.ts.map +1 -1
- package/dist/admin/analytics/MeasureChips.js +13 -16
- package/dist/admin/analytics/MeasureChips.js.map +1 -1
- package/dist/admin/analytics/QueryPanel.d.ts.map +1 -1
- package/dist/admin/analytics/QueryPanel.js +9 -5
- package/dist/admin/analytics/QueryPanel.js.map +1 -1
- package/dist/admin/analytics/RangeControl.d.ts +11 -7
- package/dist/admin/analytics/RangeControl.d.ts.map +1 -1
- package/dist/admin/analytics/RangeControl.js +83 -30
- package/dist/admin/analytics/RangeControl.js.map +1 -1
- package/dist/admin/analytics/ResultsPane.d.ts.map +1 -1
- package/dist/admin/analytics/ResultsPane.js +13 -9
- package/dist/admin/analytics/ResultsPane.js.map +1 -1
- package/dist/admin/analytics/ResultsTable.d.ts.map +1 -1
- package/dist/admin/analytics/ResultsTable.js +3 -3
- package/dist/admin/analytics/ResultsTable.js.map +1 -1
- package/dist/admin/analytics/TotalsCards.d.ts +2 -1
- package/dist/admin/analytics/TotalsCards.d.ts.map +1 -1
- package/dist/admin/analytics/TotalsCards.js +9 -10
- package/dist/admin/analytics/TotalsCards.js.map +1 -1
- package/dist/admin/analytics/analyticsModel.d.ts +126 -17
- package/dist/admin/analytics/analyticsModel.d.ts.map +1 -1
- package/dist/admin/analytics/analyticsModel.js +283 -48
- package/dist/admin/analytics/analyticsModel.js.map +1 -1
- package/dist/admin/analytics/analyticsTypes.d.ts +55 -4
- package/dist/admin/analytics/analyticsTypes.d.ts.map +1 -1
- package/dist/admin/analytics/chartModel.d.ts +38 -3
- package/dist/admin/analytics/chartModel.d.ts.map +1 -1
- package/dist/admin/analytics/chartModel.js +86 -16
- package/dist/admin/analytics/chartModel.js.map +1 -1
- package/dist/admin/analytics/instantRangeSchema.d.ts +8 -0
- package/dist/admin/analytics/instantRangeSchema.d.ts.map +1 -0
- package/dist/admin/analytics/instantRangeSchema.js +13 -0
- package/dist/admin/analytics/instantRangeSchema.js.map +1 -0
- package/dist/admin/analytics/useAnalyticsQuery.d.ts +13 -3
- package/dist/admin/analytics/useAnalyticsQuery.d.ts.map +1 -1
- package/dist/admin/analytics/useAnalyticsQuery.js +60 -21
- package/dist/admin/analytics/useAnalyticsQuery.js.map +1 -1
- package/dist/admin/analytics/useFilterValues.d.ts +4 -0
- package/dist/admin/analytics/useFilterValues.d.ts.map +1 -1
- package/dist/admin/analytics/useFilterValues.js +6 -6
- package/dist/admin/analytics/useFilterValues.js.map +1 -1
- package/dist/ai/AiChat.d.ts +30 -0
- package/dist/ai/AiChat.d.ts.map +1 -0
- package/dist/ai/AiChat.js +116 -0
- package/dist/ai/AiChat.js.map +1 -0
- package/dist/ai/AiChatConfirmCard.d.ts +17 -0
- package/dist/ai/AiChatConfirmCard.d.ts.map +1 -0
- package/dist/ai/AiChatConfirmCard.js +47 -0
- package/dist/ai/AiChatConfirmCard.js.map +1 -0
- package/dist/ai/AiChatHistory.d.ts +14 -0
- package/dist/ai/AiChatHistory.d.ts.map +1 -0
- package/dist/ai/AiChatHistory.js +40 -0
- package/dist/ai/AiChatHistory.js.map +1 -0
- package/dist/ai/AiChatMessage.d.ts +10 -0
- package/dist/ai/AiChatMessage.d.ts.map +1 -0
- package/dist/ai/AiChatMessage.js +38 -0
- package/dist/ai/AiChatMessage.js.map +1 -0
- package/dist/ai/AiFormRegistry.d.ts +37 -0
- package/dist/ai/AiFormRegistry.d.ts.map +1 -0
- package/dist/ai/AiFormRegistry.js +59 -0
- package/dist/ai/AiFormRegistry.js.map +1 -0
- package/dist/ai/aiChatMessageFormSchema.d.ts +7 -0
- package/dist/ai/aiChatMessageFormSchema.d.ts.map +1 -0
- package/dist/ai/aiChatMessageFormSchema.js +13 -0
- package/dist/ai/aiChatMessageFormSchema.js.map +1 -0
- package/dist/ai/aiContextAtom.d.ts +16 -0
- package/dist/ai/aiContextAtom.d.ts.map +1 -0
- package/dist/ai/aiContextAtom.js +25 -0
- package/dist/ai/aiContextAtom.js.map +1 -0
- package/dist/ai/index.d.ts +18 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +10 -0
- package/dist/ai/useAiChat.d.ts +82 -0
- package/dist/ai/useAiChat.d.ts.map +1 -0
- package/dist/ai/useAiChat.js +256 -0
- package/dist/ai/useAiChat.js.map +1 -0
- package/dist/ai/useAiContext.d.ts +33 -0
- package/dist/ai/useAiContext.d.ts.map +1 -0
- package/dist/ai/useAiContext.js +52 -0
- package/dist/ai/useAiContext.js.map +1 -0
- package/dist/core/Breadcrumb.js +1 -1
- package/dist/core/Breadcrumb.js.map +1 -1
- package/dist/core/Sheet.d.ts +6 -1
- package/dist/core/Sheet.d.ts.map +1 -1
- package/dist/core/Sheet.js +2 -2
- package/dist/core/Sheet.js.map +1 -1
- package/dist/core/Sidebar.d.ts +7 -1
- package/dist/core/Sidebar.d.ts.map +1 -1
- package/dist/core/Sidebar.js +22 -17
- package/dist/core/Sidebar.js.map +1 -1
- package/dist/core/index.js +2 -2
- package/dist/form/Control.d.ts +14 -0
- package/dist/form/Control.d.ts.map +1 -1
- package/dist/form/Control.js +9 -3
- package/dist/form/Control.js.map +1 -1
- package/dist/form/ControlDate.d.ts +11 -0
- package/dist/form/ControlDate.d.ts.map +1 -1
- package/dist/form/ControlDate.js +20 -2
- package/dist/form/ControlDate.js.map +1 -1
- package/dist/form/ControlDatePopover.d.ts +3 -0
- package/dist/form/ControlDatePopover.d.ts.map +1 -1
- package/dist/form/ControlDatePopover.js +1 -0
- package/dist/form/ControlDatePopover.js.map +1 -1
- package/dist/form/ControlMonthPopover.d.ts +25 -0
- package/dist/form/ControlMonthPopover.d.ts.map +1 -0
- package/dist/form/ControlMonthPopover.js +112 -0
- package/dist/form/ControlMonthPopover.js.map +1 -0
- package/dist/form/ControlSelect.d.ts +7 -0
- package/dist/form/ControlSelect.d.ts.map +1 -1
- package/dist/form/ControlSelect.js +37 -0
- package/dist/form/ControlSelect.js.map +1 -1
- package/dist/i18n/fr/uiFr.d.ts.map +1 -1
- package/dist/i18n/fr/uiFr.js +31 -1
- package/dist/i18n/fr/uiFr.js.map +1 -1
- package/dist/shell/AppShellNavCollapse.d.ts +4 -0
- package/dist/shell/AppShellNavCollapse.d.ts.map +1 -1
- package/dist/shell/AppShellNavCollapse.js +1 -0
- package/dist/shell/AppShellNavCollapse.js.map +1 -1
- package/dist/shell/AppShellSidebarNavItem.d.ts.map +1 -1
- package/dist/shell/AppShellSidebarNavItem.js +13 -9
- package/dist/shell/AppShellSidebarNavItem.js.map +1 -1
- package/dist/shell/AppShellStatefulSidebarTrigger.d.ts.map +1 -1
- package/dist/shell/AppShellStatefulSidebarTrigger.js +5 -2
- package/dist/shell/AppShellStatefulSidebarTrigger.js.map +1 -1
- package/dist/table/DataTable.d.ts.map +1 -1
- package/dist/table/DataTable.js +2 -1
- package/dist/table/DataTable.js.map +1 -1
- package/dist/table/DataTableToolbar.d.ts +7 -3
- package/dist/table/DataTableToolbar.d.ts.map +1 -1
- package/dist/table/DataTableToolbar.js +7 -3
- package/dist/table/DataTableToolbar.js.map +1 -1
- package/dist/table/dataTableBaseProps.d.ts +17 -0
- package/dist/table/dataTableBaseProps.d.ts.map +1 -1
- package/docs/packages-alepha-ui-account.md +29 -0
- package/docs/packages-alepha-ui-admin.md +35 -0
- package/docs/packages-alepha-ui-ai.md +29 -0
- package/docs/packages-alepha-ui-auth.md +23 -0
- package/docs/packages-alepha-ui-calendar.md +24 -0
- package/docs/packages-alepha-ui-chart.md +23 -0
- package/docs/packages-alepha-ui-command.md +24 -0
- package/docs/packages-alepha-ui-core.md +40 -0
- package/docs/packages-alepha-ui-form.md +29 -0
- package/docs/packages-alepha-ui-i18n-fr.md +31 -0
- package/docs/packages-alepha-ui-markdown.md +27 -0
- package/docs/packages-alepha-ui-organizations.md +20 -0
- package/docs/packages-alepha-ui-otp.md +22 -0
- package/docs/packages-alepha-ui-overview.md +337 -0
- package/docs/packages-alepha-ui-resizable.md +22 -0
- package/docs/packages-alepha-ui-settings.md +23 -0
- package/docs/packages-alepha-ui-shell.md +41 -0
- package/docs/packages-alepha-ui-table.md +37 -0
- package/docs/packages-alepha-ui-tree.md +31 -0
- package/package.json +15 -5
- package/src/admin/analytics/AdvancedSection.tsx +39 -30
- package/src/admin/analytics/AnalyticsChart.tsx +7 -1
- package/src/admin/analytics/AnalyticsChartHeader.tsx +22 -7
- package/src/admin/analytics/AnalyticsChartLine.tsx +15 -2
- package/src/admin/analytics/CoarsenedBadge.tsx +38 -0
- package/src/admin/analytics/CompareNote.tsx +16 -5
- package/src/admin/analytics/FilterEditor.tsx +2 -0
- package/src/admin/analytics/GroupByChips.tsx +40 -27
- package/src/admin/analytics/MeasureChips.tsx +19 -11
- package/src/admin/analytics/QueryPanel.tsx +10 -5
- package/src/admin/analytics/RangeControl.tsx +91 -27
- package/src/admin/analytics/ResultsPane.tsx +20 -6
- package/src/admin/analytics/ResultsTable.tsx +9 -5
- package/src/admin/analytics/TotalsCards.tsx +24 -11
- package/src/admin/analytics/analyticsModel.spec.ts +167 -36
- package/src/admin/analytics/analyticsModel.ts +358 -49
- package/src/admin/analytics/analyticsTypes.ts +56 -4
- package/src/admin/analytics/chartModel.ts +139 -20
- package/src/admin/analytics/instantRangeSchema.ts +9 -0
- package/src/admin/analytics/useAnalyticsQuery.ts +98 -35
- package/src/admin/analytics/useFilterValues.ts +16 -5
- package/src/ai/AiChat.tsx +151 -0
- package/src/ai/AiChatConfirmCard.tsx +64 -0
- package/src/ai/AiChatHistory.tsx +60 -0
- package/src/ai/AiChatMessage.tsx +57 -0
- package/src/ai/AiFormRegistry.ts +78 -0
- package/src/ai/__tests__/AiChat.browser.spec.tsx +391 -0
- package/src/ai/aiChatMessageFormSchema.ts +8 -0
- package/src/ai/aiContextAtom.ts +23 -0
- package/src/ai/index.ts +18 -0
- package/src/ai/useAiChat.ts +343 -0
- package/src/ai/useAiContext.ts +74 -0
- package/src/core/Breadcrumb.tsx +1 -1
- package/src/core/Sheet.tsx +9 -2
- package/src/core/Sidebar.tsx +45 -22
- package/src/form/Control.tsx +26 -1
- package/src/form/ControlDate.tsx +37 -2
- package/src/form/ControlDatePopover.tsx +4 -1
- package/src/form/ControlMonthPopover.tsx +169 -0
- package/src/form/ControlSelect.tsx +62 -0
- package/src/form/__tests__/ControlChoices.browser.spec.tsx +130 -0
- package/src/i18n/fr/uiFr.ts +36 -2
- package/src/shell/AppShellNavCollapse.tsx +5 -0
- package/src/shell/AppShellSidebarNavItem.tsx +23 -10
- package/src/shell/AppShellStatefulSidebarTrigger.tsx +10 -2
- package/src/shell/__tests__/AppShellDirection.browser.spec.tsx +95 -0
- package/src/table/DataTable.tsx +2 -0
- package/src/table/DataTableToolbar.tsx +18 -3
- package/src/table/__tests__/DataTableLeading.browser.spec.tsx +130 -0
- package/src/table/dataTableBaseProps.ts +17 -0
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
---
|
|
2
|
+
slug: "packages-alepha-ui-overview"
|
|
3
|
+
title: "@alepha/ui"
|
|
4
|
+
summary: "Shared Base UI and Tailwind components for Alepha apps."
|
|
5
|
+
package: "@alepha/ui"
|
|
6
|
+
section: "packages"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# @alepha/ui
|
|
10
|
+
|
|
11
|
+
Shared Base UI and Tailwind components for Alepha apps. Edited directly; bugfixes propagate via normal dep updates.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @alepha/ui
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Overview
|
|
20
|
+
|
|
21
|
+
`@alepha/ui` is the shared component library for Alepha applications, built
|
|
22
|
+
on Base UI and Tailwind, with [lucide](https://lucide.dev) icons.
|
|
23
|
+
|
|
24
|
+
Unlike the rest of the framework, these components are **meant to be edited
|
|
25
|
+
directly**: `src/` ships alongside the built `dist/`, so you can copy a
|
|
26
|
+
component into your app and change it, or depend on the package and let
|
|
27
|
+
bugfixes arrive through normal dependency updates.
|
|
28
|
+
|
|
29
|
+
## Import paths
|
|
30
|
+
|
|
31
|
+
The package is sixteen modules, one subpath each. The primitives are the package
|
|
32
|
+
root; everything heavier is a subpath of its own, so an app loads only what it
|
|
33
|
+
renders:
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import { Button, cn, useToast } from "@alepha/ui";
|
|
37
|
+
import { AdminRouter } from "@alepha/ui/admin";
|
|
38
|
+
import { AutoForm } from "@alepha/ui/form";
|
|
39
|
+
import { DataTable } from "@alepha/ui/table";
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Load the stylesheet once, at your app's entry point:
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import "@alepha/ui/styles.css";
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
A module's files are private: import from the subpath, never from a file
|
|
49
|
+
inside it. Inside the package the rule is the opposite - every import is
|
|
50
|
+
relative and names a concrete file - and `check:conventions` enforces both
|
|
51
|
+
the module map and that `@alepha/ui` (the root) imports no other module.
|
|
52
|
+
|
|
53
|
+
## What's inside
|
|
54
|
+
|
|
55
|
+
| Subpath | What it holds |
|
|
56
|
+
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
57
|
+
| `@alepha/ui` | The primitives (`Button`, `Input`, `Card`, `Badge`, `Dialog`, `Sheet`, `Tooltip`, `Sidebar`, and the rest), `cn`, `useToast` + `Toaster`, `useDialog` + `DialogProvider`, `useIsMobile`, `TimeAgo`, `UserAvatar` |
|
|
58
|
+
| `@alepha/ui/form` | `AutoForm`, `Control` and the per-type renderers (`ControlSelect`, `ControlDate`, `ControlUpload`, ...), `FormField`, `resizeImage` |
|
|
59
|
+
| `@alepha/ui/settings` | The settings kit: `SettingsLayout`, `SettingsNav`, `SettingsSection`, `SettingsRow`, `SettingsDangerSection` |
|
|
60
|
+
| `@alepha/ui/table` | `DataTable` and its parts, `paginateLocal`, `useTableSelection`, `PermissionMatrix` |
|
|
61
|
+
| `@alepha/ui/tree` | `TreeView`, `TreeViewResizer`, `useTreeState`, and the tree model (`buildTree`, `flattenTree`, `resolveDrop`, ...) |
|
|
62
|
+
| `@alepha/ui/markdown` | `MarkdownView` and the diagram parsers. See the section below |
|
|
63
|
+
| `@alepha/ui/shell` | `AppShell`, `NavShell` and its `Spotlight`, `PlateLayout`, `DetailLayout`, `AppActions`, the header buttons, `ActionErrorToaster` |
|
|
64
|
+
| `@alepha/ui/auth` | `AuthRouter` and its pages, `TurnstileWidget` |
|
|
65
|
+
| `@alepha/ui/account` | `AccountRouter`, `$pageAccount`, and the account pages |
|
|
66
|
+
| `@alepha/ui/admin` | `AdminRouter`, `$pageAdmin`, the admin pages and `AdminAnalytics` |
|
|
67
|
+
| `@alepha/ui/chart` | The recharts wrapper (`ChartContainer` and its parts). Opt-in |
|
|
68
|
+
| `@alepha/ui/command` | The command palette on Base UI's `Autocomplete` (`Command`, `CommandDialog`), ranked by cmdk's scorer. Opt-in |
|
|
69
|
+
| `@alepha/ui/calendar` | The react-day-picker wrapper (`Calendar`). Opt-in |
|
|
70
|
+
| `@alepha/ui/otp` | The input-otp wrapper (`InputOTP`). Opt-in |
|
|
71
|
+
| `@alepha/ui/resizable` | The react-resizable-panels wrapper. Opt-in |
|
|
72
|
+
| `@alepha/ui/i18n/fr` | `uiFr`, the French catalogue for every key the package asks for |
|
|
73
|
+
|
|
74
|
+
The five opt-in wrappers import only the root, so a heavy dependency (recharts,
|
|
75
|
+
react-day-picker, input-otp, react-resizable-panels) is loaded by the app
|
|
76
|
+
that imports its subpath and by nothing else.
|
|
77
|
+
|
|
78
|
+
> `useDialog()` throws without a `<DialogProvider>` above it, and toasts need a
|
|
79
|
+
> `<Toaster />`. `AppShell` mounts both. The account and admin routers do
|
|
80
|
+
> **not** - a second `<Toaster />` under an app that already has one shows every
|
|
81
|
+
> toast twice - so a standalone mount (or `AppShell` with `embedded`) has to
|
|
82
|
+
> wrap them itself.
|
|
83
|
+
|
|
84
|
+
## Example
|
|
85
|
+
|
|
86
|
+
`AutoForm` pairs with `useForm` from `alepha/react/form`. The schema is the
|
|
87
|
+
single source of truth - field types, validation, and layout hints all come
|
|
88
|
+
from it:
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
import { AutoForm } from "@alepha/ui/form";
|
|
92
|
+
import { z } from "alepha";
|
|
93
|
+
import { useForm } from "alepha/react/form";
|
|
94
|
+
|
|
95
|
+
const profileSchema = z.object({
|
|
96
|
+
username: z
|
|
97
|
+
.string()
|
|
98
|
+
.min(2)
|
|
99
|
+
.max(32)
|
|
100
|
+
.meta({ $control: { icon: "user" } }),
|
|
101
|
+
email: z.string(),
|
|
102
|
+
newsletter: z.boolean(),
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
export const ProfilePage = () => {
|
|
106
|
+
const form = useForm({
|
|
107
|
+
schema: profileSchema,
|
|
108
|
+
initialValues: { username: "", email: "", newsletter: false },
|
|
109
|
+
handler: (values) => save(values),
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<AutoForm
|
|
114
|
+
form={form}
|
|
115
|
+
icon="cog"
|
|
116
|
+
title="Account profile"
|
|
117
|
+
autoGroup
|
|
118
|
+
disabledIfPristine
|
|
119
|
+
/>
|
|
120
|
+
);
|
|
121
|
+
};
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
`autoGroup` derives field groups from the schema shape; pass `groups` instead to
|
|
125
|
+
lay them out yourself.
|
|
126
|
+
|
|
127
|
+
### Settings cards
|
|
128
|
+
|
|
129
|
+
`layout="row"` renders the same shape as the `SettingsSection` / `SettingsRow`
|
|
130
|
+
kit rather than an approximation of it: each group becomes a bordered card of
|
|
131
|
+
divided rows, label and help on the left, control on the right, and the action
|
|
132
|
+
bar is the card's own last row. Each group carries its own `title` and
|
|
133
|
+
`description`, rendered through the same `SettingsHeading` the kit uses.
|
|
134
|
+
|
|
135
|
+
```tsx
|
|
136
|
+
<AutoForm
|
|
137
|
+
form={form}
|
|
138
|
+
layout="row"
|
|
139
|
+
disabledIfPristine
|
|
140
|
+
groups={[
|
|
141
|
+
{
|
|
142
|
+
title: "Name",
|
|
143
|
+
description: "How you are identified to other people.",
|
|
144
|
+
fields: ["username", "firstName", "lastName"],
|
|
145
|
+
},
|
|
146
|
+
]}
|
|
147
|
+
/>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
So a settings card whose rows are all form fields should be an `AutoForm`.
|
|
151
|
+
Reach for `SettingsSection` directly for the rows that are _not_ fields - an
|
|
152
|
+
avatar picker, a read-only value, a lone button.
|
|
153
|
+
|
|
154
|
+
Add `autoSave` to commit on change instead, which hides the action bar. Text
|
|
155
|
+
fields still never commit on keystroke: they commit on Enter, or on the inline
|
|
156
|
+
tick that appears in the input once the field is dirty.
|
|
157
|
+
|
|
158
|
+
## Markdown, and diagrams in it
|
|
159
|
+
|
|
160
|
+
`MarkdownView` renders markdown as formatted prose. Raw HTML is always escaped
|
|
161
|
+
to text, never promoted to markup: it renders content authored by one user to
|
|
162
|
+
another, so a live raw tag would be an injection point on every surface built on
|
|
163
|
+
this package.
|
|
164
|
+
|
|
165
|
+
### Spoilers
|
|
166
|
+
|
|
167
|
+
`||text||` renders as a covered box that reveals on click, on Enter or on
|
|
168
|
+
Space. Discord's syntax, and Discord's behaviour: inline markdown inside it
|
|
169
|
+
survives (`||see [the docs](/d) **now**||` hides a link and a bold word, not
|
|
170
|
+
the text of them), a code span and a fence keep their pipes literally, and an
|
|
171
|
+
unterminated `||` renders as the two characters that were typed rather than
|
|
172
|
+
swallowing the rest of the paragraph. A pair cannot cross a paragraph break.
|
|
173
|
+
|
|
174
|
+
⚠️ **It is not a security feature, and must never be described as one.** The
|
|
175
|
+
covered text is in the DOM from the first paint - the box is a colour, not an
|
|
176
|
+
absence - and it is also in the raw markdown, in an export, in whatever an API
|
|
177
|
+
or an MCP tool serves, and in any search snippet built from the source. It
|
|
178
|
+
hides a plot point from a reader's eye. It does not store a secret, and the
|
|
179
|
+
same words go in any UI that explains it.
|
|
180
|
+
|
|
181
|
+
A revealed spoiler stays revealed: re-hiding on blur would make it unreadable
|
|
182
|
+
with a keyboard, since reading what is around it is exactly what a reader does
|
|
183
|
+
next.
|
|
184
|
+
|
|
185
|
+
### Diagrams
|
|
186
|
+
|
|
187
|
+
A ` ```mermaid ` fence containing a **`flowchart`** or a **`sequenceDiagram`**
|
|
188
|
+
is drawn as an SVG diagram instead of a code block. The renderer is in-house
|
|
189
|
+
rather than mermaid itself: mermaid is roughly 500-900 kB gzip in a browser and
|
|
190
|
+
cannot run without a DOM, because it measures text in a hidden element. Here the
|
|
191
|
+
only imported piece is `graphre` (dagre in TypeScript, ~15.5 kB gzip), and only
|
|
192
|
+
the flowchart uses it; parsing, text measurement and drawing are ours. The whole
|
|
193
|
+
thing is one lazy chunk of about 22 kB gzip, imported only when a document
|
|
194
|
+
actually contains a fence, so a document with no diagram pays nothing.
|
|
195
|
+
|
|
196
|
+
The two are separate pipelines that share only the text metrics and the theming.
|
|
197
|
+
A flowchart has to be ranked, which is what `graphre` does; a sequence diagram
|
|
198
|
+
has both axes decided by the source - participants left to right in declaration
|
|
199
|
+
order, rows top to bottom in statement order - so its layout is arithmetic with
|
|
200
|
+
no library at all.
|
|
201
|
+
|
|
202
|
+
Drawing it ourselves is what makes the diagram look like the app: the SVG uses
|
|
203
|
+
`--card`, `--border`, `--muted-foreground` and `--muted`, so dark mode works
|
|
204
|
+
with no second palette and no theme prop.
|
|
205
|
+
|
|
206
|
+
The syntax is mermaid's so a document stays portable to GitHub, Obsidian and
|
|
207
|
+
anywhere else, but only a subset is drawn.
|
|
208
|
+
|
|
209
|
+
### Flowcharts
|
|
210
|
+
|
|
211
|
+
| | |
|
|
212
|
+
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
213
|
+
| Header | `flowchart` / `graph`, `TD` `TB` `LR` `RL` `BT` |
|
|
214
|
+
| Nodes | `[rect]` `(rounded)` `{diamond}` `((circle))`; `([ ])` `[[ ]]` `[( )]` `{{ }}` `> ]` `[/ /]` `[\ \]` `((( )))` are consumed and mapped onto those four |
|
|
215
|
+
| Edges | `-->` `---` `-.->` `==>` `<-->`; `--o` and `--x` parse, but the emitter has one end marker, so they draw the same arrowhead as `-->` rather than mermaid's circle and cross |
|
|
216
|
+
| Edge labels | both `-->\|text\|` and `-- text -->` |
|
|
217
|
+
| Structure | chains `A --> B --> C`, fans `A & B --> C`, nested `subgraph` |
|
|
218
|
+
| Text | `<br/>` becomes a line break; quoted and backtick-quoted labels |
|
|
219
|
+
|
|
220
|
+
⚠️ **A node label must not contain a link operator.** The statement is scanned
|
|
221
|
+
for links before anything knows where the labels are, so a `--`, `==` or `-.`
|
|
222
|
+
sequence inside `[...]` is read as an edge and the label is cut. `A[--o]` yields
|
|
223
|
+
an empty `A` and a bogus node named `]`; `A[pre--post]` truncates to `pre`.
|
|
224
|
+
Quoting does NOT protect it - `A["-->"]` is damaged identically, because
|
|
225
|
+
`splitOnLinks` runs with no quote awareness. A single hyphen (`A[well-known]`)
|
|
226
|
+
is safe. There is no escape that works today, and the failure is silent: the
|
|
227
|
+
graph still draws, with the wrong text.
|
|
228
|
+
|
|
229
|
+
### Sequence diagrams
|
|
230
|
+
|
|
231
|
+
| | |
|
|
232
|
+
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
233
|
+
| Participants | `participant A`, `participant A as Alice`, `actor U` (an actor draws a stick figure); declared implicitly by first use, in order of appearance |
|
|
234
|
+
| Arrows | `->` `-->` `->>` `-->>` `-x` `--x` `-)` `--)`; the double hyphen dashes the line, and the four heads (none, filled, cross, open) are drawn distinctly |
|
|
235
|
+
| Activation | `->>+` / `-->>-` and `activate` / `deactivate` parse and are DISCARDED - activation bars are not drawn |
|
|
236
|
+
| Notes | `Note left of A:`, `Note right of A:`, `Note over A:`, `Note over A,B:` |
|
|
237
|
+
| Fragments | `alt` / `else` / `opt` / `loop`, nested, each closed by `end` |
|
|
238
|
+
| Other | `autonumber` (including `autonumber 10 10`), self-messages, `<br/>` line breaks |
|
|
239
|
+
|
|
240
|
+
A sequence diagram keeps its natural width in a horizontal scroll frame rather
|
|
241
|
+
than scaling into the prose column. A flowchart is roughly as tall as it is wide
|
|
242
|
+
and shrinks gracefully; a sequence diagram's width comes from its participant
|
|
243
|
+
count with nothing to wrap, so scaling eight lifelines into a phone column puts
|
|
244
|
+
the labels at around 5px with no way for the reader to recover. The frame is
|
|
245
|
+
focusable and carries an accessible name, because a scroll container that cannot
|
|
246
|
+
take focus cannot be scrolled from a keyboard.
|
|
247
|
+
|
|
248
|
+
Two constructs are refused rather than approximated. `par`, `critical`, `break`,
|
|
249
|
+
`create` and `destroy` send the WHOLE diagram back to the code block: drawing
|
|
250
|
+
`par` branches one under the other would assert an ordering that is false, and
|
|
251
|
+
silently wrong output about a protocol is worse than no output. `rect`, `box`,
|
|
252
|
+
`links`, `link`, `menu` and `style` are skipped in silence, being decorative.
|
|
253
|
+
|
|
254
|
+
### Everything else
|
|
255
|
+
|
|
256
|
+
Degrades to the code block it renders as today, silently: `classDiagram`,
|
|
257
|
+
`gantt` and mindmaps are not drawn, `style` and `classDef` are ignored (the
|
|
258
|
+
theme picks the colours), and a malformed diagram, a parse failure, a graph past
|
|
259
|
+
the 200-node / 400-edge cap or a sequence diagram past the 30-participant /
|
|
260
|
+
300-row cap all render the plain fence rather than an error.
|
|
261
|
+
|
|
262
|
+
The font is pinned rather than inherited. Layout needs node sizes before it can
|
|
263
|
+
place anything, and node width comes from a generated per-character width table
|
|
264
|
+
measured against Inter at one size; inheriting the surrounding face would make
|
|
265
|
+
text and box disagree, differently on every surface.
|
|
266
|
+
|
|
267
|
+
## Command palette
|
|
268
|
+
|
|
269
|
+
`@alepha/ui/command` is Base UI's `Autocomplete`, rendered inline: a search
|
|
270
|
+
input over a list that stays on screen. It is **data-driven**. The root takes
|
|
271
|
+
every row as `items` (flat, or in groups shaped `{ items, ...yours }`), ranks
|
|
272
|
+
them against the query, and hands `CommandList` what is left, best first,
|
|
273
|
+
through a function child:
|
|
274
|
+
|
|
275
|
+
```tsx
|
|
276
|
+
import {
|
|
277
|
+
Command,
|
|
278
|
+
CommandDialog,
|
|
279
|
+
CommandEmpty,
|
|
280
|
+
CommandGroup,
|
|
281
|
+
CommandInput,
|
|
282
|
+
CommandItem,
|
|
283
|
+
CommandList,
|
|
284
|
+
} from "@alepha/ui/command";
|
|
285
|
+
|
|
286
|
+
<CommandDialog open={open} onOpenChange={setOpen}>
|
|
287
|
+
<Command<Page>
|
|
288
|
+
items={groups}
|
|
289
|
+
itemToStringValue={(page) => `${page.section} ${page.label}`}
|
|
290
|
+
>
|
|
291
|
+
<CommandInput placeholder="Search…" />
|
|
292
|
+
<CommandEmpty>No results.</CommandEmpty>
|
|
293
|
+
<CommandList>
|
|
294
|
+
{(group: PageGroup) => (
|
|
295
|
+
<CommandGroup key={group.key} items={group.items} heading={group.label}>
|
|
296
|
+
{(page: Page) => (
|
|
297
|
+
<CommandItem key={page.href} value={page} onClick={() => go(page)}>
|
|
298
|
+
{page.label}
|
|
299
|
+
</CommandItem>
|
|
300
|
+
)}
|
|
301
|
+
</CommandGroup>
|
|
302
|
+
)}
|
|
303
|
+
</CommandList>
|
|
304
|
+
</Command>
|
|
305
|
+
</CommandDialog>;
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
The ranking is cmdk's fuzzy subsequence scorer, ported (`commandScore`, also
|
|
309
|
+
exported): a match at the start of a word beats one inside a word, and a short
|
|
310
|
+
string beats a long one with the same match. The first row is always
|
|
311
|
+
highlighted, so Enter runs the best match. Results that arrive already ranked,
|
|
312
|
+
from a server for instance, take `mode="none"`, which shows `items` as given.
|
|
313
|
+
|
|
314
|
+
The palette was on cmdk until 0.30.0, which read each row from its children.
|
|
315
|
+
The part names are the same; what a row carried moved to the root:
|
|
316
|
+
|
|
317
|
+
| cmdk | now |
|
|
318
|
+
| --------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
|
|
319
|
+
| `CommandItem value="…"` | `CommandItem value={item}`, the item from `items`; the text it is found by is the root's `itemToStringValue` |
|
|
320
|
+
| `CommandItem keywords={[…]}` | append them in `itemToStringValue`: the scorer read `value` and `keywords` as one string |
|
|
321
|
+
| `CommandItem onSelect` | `CommandItem onClick`, which also runs on Enter |
|
|
322
|
+
| rows written as children of the list | `items` on `Command`, drawn by a function child of `CommandList` or `CommandGroup` |
|
|
323
|
+
| `Command shouldFilter={false}` | `Command mode="none"` |
|
|
324
|
+
| `Command filter={(value, search) => n}` | `Command filter={(item, query, itemToString) => n}`, a score: 0 hides, higher first |
|
|
325
|
+
| `CommandInput value` / `onValueChange` | `Command value` / `onValueChange` |
|
|
326
|
+
| `CommandEmpty` inside `CommandList` | `CommandEmpty` beside it, before the list |
|
|
327
|
+
| `data-selected` on the keyboard row | `data-highlighted` |
|
|
328
|
+
|
|
329
|
+
## Adding a component
|
|
330
|
+
|
|
331
|
+
The package owns every file in it: there is no registry to pull from and no
|
|
332
|
+
generator to run. A new primitive is written by hand in `src/core/`, one file
|
|
333
|
+
per family, named after it (`DropdownMenu.tsx` holds the menu and all its
|
|
334
|
+
parts), and re-exported from `src/core/index.ts`. An upstream component
|
|
335
|
+
(shadcn's, Base UI's own examples) is a fine starting point, copied in and then
|
|
336
|
+
edited like any other file here: `cn` comes from `./utils.ts`, and a
|
|
337
|
+
`data-slot` attribute on each part keeps it addressable from `styles.css`.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
slug: "packages-alepha-ui-resizable"
|
|
3
|
+
title: "@alepha/ui - Resizable"
|
|
4
|
+
summary: "Resizable panels, on react-resizable-panels."
|
|
5
|
+
package: "@alepha/ui"
|
|
6
|
+
section: "packages"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# @alepha/ui - Resizable
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @alepha/ui
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Overview
|
|
18
|
+
|
|
19
|
+
Resizable panels, on react-resizable-panels.
|
|
20
|
+
|
|
21
|
+
`ResizablePanelGroup`, `ResizablePanel` and `ResizableHandle`. Opt-in:
|
|
22
|
+
nothing else in `@alepha/ui` imports it.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
slug: "packages-alepha-ui-settings"
|
|
3
|
+
title: "@alepha/ui - Settings"
|
|
4
|
+
summary: "The settings kit."
|
|
5
|
+
package: "@alepha/ui"
|
|
6
|
+
section: "packages"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# @alepha/ui - Settings
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @alepha/ui
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Overview
|
|
18
|
+
|
|
19
|
+
The settings kit.
|
|
20
|
+
|
|
21
|
+
`SettingsLayout` and `SettingsNav` frame a settings area; `SettingsSection`,
|
|
22
|
+
`SettingsRow`, `SettingsHeading` and `SettingsDangerSection` build its pages,
|
|
23
|
+
and `settingsCardEdge` is the one card edge they all share.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
slug: "packages-alepha-ui-shell"
|
|
3
|
+
title: "@alepha/ui - Shell"
|
|
4
|
+
summary: "Application shells and their chrome."
|
|
5
|
+
package: "@alepha/ui"
|
|
6
|
+
section: "packages"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# @alepha/ui - Shell
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @alepha/ui
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Overview
|
|
18
|
+
|
|
19
|
+
Application shells and their chrome.
|
|
20
|
+
|
|
21
|
+
`$pageNav` declares a page that appears in a shell's sidebar, for an app
|
|
22
|
+
that hangs its pages off its OWN layout rather than the admin shell's
|
|
23
|
+
(`$pageAdmin` is the same thing already parented to `AdminRouter`).
|
|
24
|
+
|
|
25
|
+
`AppShell` is the sidebar-and-header frame of an application and `NavShell`
|
|
26
|
+
the page-tree variant with its `Spotlight` search. `PlateLayout` and
|
|
27
|
+
`DetailLayout` frame a page, `AppActions` a toolbar. `ButtonDark`,
|
|
28
|
+
`ButtonTheme`, `ButtonLanguage`, `ButtonInbox` and `ButtonUser` are the
|
|
29
|
+
header buttons, and `ButtonSettings` is the account button with language,
|
|
30
|
+
theme and display mode folded into its menu once signed in.
|
|
31
|
+
`ActionErrorToaster` turns a failed action into a toast.
|
|
32
|
+
|
|
33
|
+
## API Reference
|
|
34
|
+
|
|
35
|
+
### Primitives
|
|
36
|
+
|
|
37
|
+
- [`$pageNav`](../../../alepha/docs/reference-primitives-$pagenav.md) - `$page` sugar for shell pages: declares the page's `nav` metadata and its
|
|
38
|
+
|
|
39
|
+
### React Hooks
|
|
40
|
+
|
|
41
|
+
- [`useDetailTab`](../../../alepha/docs/reference-react-hooks-usedetailtab.md) - Binds a detail page's selected tab to `?tab=<key>`.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
slug: "packages-alepha-ui-table"
|
|
3
|
+
title: "@alepha/ui - Table"
|
|
4
|
+
summary: "Data tables."
|
|
5
|
+
package: "@alepha/ui"
|
|
6
|
+
section: "packages"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# @alepha/ui - Table
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @alepha/ui
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Overview
|
|
18
|
+
|
|
19
|
+
Data tables.
|
|
20
|
+
|
|
21
|
+
`DataTable` is a table wired for server-side pagination, sorting and
|
|
22
|
+
filtering, with row and bulk actions, persisted filters and a static mode for
|
|
23
|
+
local data (`paginateLocal`). Its filters are a record of fields
|
|
24
|
+
(`DataTableFilterFields`) that it draws on its own filter bar. Above that
|
|
25
|
+
bar it can hold a collapsible summary (`DataTableSummary`): stat cards
|
|
26
|
+
(`DataTableStatCard`) given or fetched with the table's filters, and any
|
|
27
|
+
node beside them. A `help` node sits behind a `?` at the end of the
|
|
28
|
+
toolbar's icons.
|
|
29
|
+
`DataTableFilterMenu`, `DataTableFilterDialog` and `DataTableBulkMenu`
|
|
30
|
+
are its parts, and `useTableSelection` its selection state. `PermissionMatrix` is the grid of
|
|
31
|
+
roles against permissions the admin and account kits draw.
|
|
32
|
+
|
|
33
|
+
## API Reference
|
|
34
|
+
|
|
35
|
+
### React Hooks
|
|
36
|
+
|
|
37
|
+
- [`useTableSelection`](../../../alepha/docs/reference-react-hooks-usetableselection.md) - Cross-page row selection for DataTable.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
slug: "packages-alepha-ui-tree"
|
|
3
|
+
title: "@alepha/ui - Tree"
|
|
4
|
+
summary: "A controlled tree."
|
|
5
|
+
package: "@alepha/ui"
|
|
6
|
+
section: "packages"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# @alepha/ui - Tree
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @alepha/ui
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Overview
|
|
18
|
+
|
|
19
|
+
A controlled tree.
|
|
20
|
+
|
|
21
|
+
`treeModel`'s functions are the pure half: build, flatten, cycle-safe parents
|
|
22
|
+
and drop resolution. `TreeView` draws the rows with their indent guides and
|
|
23
|
+
ARIA tree roles; drag and drop, inline rename and a context-menu slot are
|
|
24
|
+
opt-ins. `useTreeState` holds the gesture state and `TreeViewResizer` is the
|
|
25
|
+
pane handle.
|
|
26
|
+
|
|
27
|
+
## API Reference
|
|
28
|
+
|
|
29
|
+
### React Hooks
|
|
30
|
+
|
|
31
|
+
- [`useTreeState`](../../../alepha/docs/reference-react-hooks-usetreestate.md) - The state a `TreeView` needs and a consumer would otherwise write again:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alepha/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
4
4
|
"description": "Shared Base UI and Tailwind components for Alepha apps. Edited directly; bugfixes propagate via normal dep updates.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"alepha",
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
},
|
|
20
20
|
"files": [
|
|
21
21
|
"dist",
|
|
22
|
-
"src"
|
|
22
|
+
"src",
|
|
23
|
+
"docs"
|
|
23
24
|
],
|
|
24
25
|
"type": "module",
|
|
25
26
|
"sideEffects": [
|
|
@@ -70,6 +71,10 @@
|
|
|
70
71
|
"types": "./dist/organizations/index.d.ts",
|
|
71
72
|
"default": "./dist/organizations/index.js"
|
|
72
73
|
},
|
|
74
|
+
"./ai": {
|
|
75
|
+
"types": "./dist/ai/index.d.ts",
|
|
76
|
+
"default": "./dist/ai/index.js"
|
|
77
|
+
},
|
|
73
78
|
"./chart": {
|
|
74
79
|
"types": "./dist/chart/index.d.ts",
|
|
75
80
|
"default": "./dist/chart/index.js"
|
|
@@ -143,6 +148,10 @@
|
|
|
143
148
|
"types": "./dist/organizations/index.d.ts",
|
|
144
149
|
"default": "./dist/organizations/index.js"
|
|
145
150
|
},
|
|
151
|
+
"./ai": {
|
|
152
|
+
"types": "./dist/ai/index.d.ts",
|
|
153
|
+
"default": "./dist/ai/index.js"
|
|
154
|
+
},
|
|
146
155
|
"./chart": {
|
|
147
156
|
"types": "./dist/chart/index.d.ts",
|
|
148
157
|
"default": "./dist/chart/index.js"
|
|
@@ -205,7 +214,7 @@
|
|
|
205
214
|
"@types/bun": "^1.4.2",
|
|
206
215
|
"@types/node": "^26.6.4",
|
|
207
216
|
"@types/react": "^19.3.0",
|
|
208
|
-
"alepha": "0.
|
|
217
|
+
"alepha": "0.34.0",
|
|
209
218
|
"react": "^19.3.0",
|
|
210
219
|
"react-dom": "^19.3.0",
|
|
211
220
|
"recharts": "^3.10.1",
|
|
@@ -213,7 +222,7 @@
|
|
|
213
222
|
"typescript": "^7.0.2"
|
|
214
223
|
},
|
|
215
224
|
"peerDependencies": {
|
|
216
|
-
"alepha": "^0.
|
|
225
|
+
"alepha": "^0.34.0",
|
|
217
226
|
"react": "^19.3.0",
|
|
218
227
|
"react-dom": "^19.3.0",
|
|
219
228
|
"recharts": "^3",
|
|
@@ -230,5 +239,6 @@
|
|
|
230
239
|
"engines": {
|
|
231
240
|
"node": ">=24.0.0"
|
|
232
241
|
},
|
|
233
|
-
"llms": "https://alepha.dev/llms.txt"
|
|
242
|
+
"llms": "https://alepha.dev/llms.txt",
|
|
243
|
+
"llmsLocal": "./docs"
|
|
234
244
|
}
|
|
@@ -4,7 +4,7 @@ import { useState } from "react";
|
|
|
4
4
|
|
|
5
5
|
import { Segmented } from "../../core/Segmented.tsx";
|
|
6
6
|
import { cn } from "../../core/utils.ts";
|
|
7
|
-
import { ANALYTICS_LIMITS } from "./analyticsModel.ts";
|
|
7
|
+
import { ANALYTICS_LIMITS, analyticsSpanLabel } from "./analyticsModel.ts";
|
|
8
8
|
import type {
|
|
9
9
|
AnalyticsCompareMode,
|
|
10
10
|
AnalyticsQueryState,
|
|
@@ -63,10 +63,15 @@ export const AdvancedSection = (props: AdvancedSectionProps) => {
|
|
|
63
63
|
]
|
|
64
64
|
.filter(Boolean)
|
|
65
65
|
.join(" · ")
|
|
66
|
-
:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
: props.window.instant
|
|
67
|
+
? tr("admin.analytics.summaryInstant", {
|
|
68
|
+
default: "vs the previous $1 · limit $2",
|
|
69
|
+
args: [analyticsSpanLabel(props.window), String(props.state.limit)],
|
|
70
|
+
})
|
|
71
|
+
: tr("admin.analytics.summaryDefaults", {
|
|
72
|
+
default: "until yesterday · vs previous $1d · limit $2",
|
|
73
|
+
args: [String(props.state.days), String(props.state.limit)],
|
|
74
|
+
});
|
|
70
75
|
|
|
71
76
|
return (
|
|
72
77
|
<div className="flex flex-col gap-[9px]">
|
|
@@ -94,32 +99,35 @@ export const AdvancedSection = (props: AdvancedSectionProps) => {
|
|
|
94
99
|
</button>
|
|
95
100
|
{expanded && (
|
|
96
101
|
<div className="border-border flex flex-col gap-3.5 border-l pl-[11px]">
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
props.
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
{
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
102
|
+
{/* `until` places a day window; an instant window has both ends. */}
|
|
103
|
+
{!props.window.instant && (
|
|
104
|
+
<div className="flex flex-col gap-[7px]">
|
|
105
|
+
<ClauseLabel>until</ClauseLabel>
|
|
106
|
+
<Segmented
|
|
107
|
+
className="self-start"
|
|
108
|
+
size="sm"
|
|
109
|
+
value={props.state.untilMode}
|
|
110
|
+
onChange={(value) =>
|
|
111
|
+
props.onUntilMode(value as AnalyticsUntilMode)
|
|
112
|
+
}
|
|
113
|
+
options={[
|
|
114
|
+
{ value: "yesterday", label: "yesterday" },
|
|
115
|
+
{ value: "today", label: "today" },
|
|
116
|
+
]}
|
|
117
|
+
/>
|
|
118
|
+
<div className="text-muted-foreground text-[10.5px] leading-normal">
|
|
119
|
+
{props.state.untilMode === "yesterday"
|
|
120
|
+
? tr("admin.analytics.untilYesterdayNote", {
|
|
121
|
+
default: "Ends $1, the last complete UTC day.",
|
|
122
|
+
args: [props.window.to],
|
|
123
|
+
})
|
|
124
|
+
: tr("admin.analytics.untilTodayNote", {
|
|
125
|
+
default:
|
|
126
|
+
"Ends today: the newest bucket is partial, and is drawn ghosted.",
|
|
127
|
+
})}
|
|
128
|
+
</div>
|
|
121
129
|
</div>
|
|
122
|
-
|
|
130
|
+
)}
|
|
123
131
|
<div className="flex flex-col gap-[7px]">
|
|
124
132
|
<ClauseLabel>compare to</ClauseLabel>
|
|
125
133
|
<Segmented
|
|
@@ -139,6 +147,7 @@ export const AdvancedSection = (props: AdvancedSectionProps) => {
|
|
|
139
147
|
className="text-[10.5px] leading-normal"
|
|
140
148
|
compare={props.state.compare}
|
|
141
149
|
days={props.state.days}
|
|
150
|
+
window={props.window}
|
|
142
151
|
baselineWindow={props.baselineWindow}
|
|
143
152
|
/>
|
|
144
153
|
</div>
|