northline 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/LICENSE +4 -0
- package/README.md +250 -0
- package/dist/chartSetup.d.ts +3 -0
- package/dist/chartTheme.d.ts +67 -0
- package/dist/components/Accordion.d.ts +17 -0
- package/dist/components/Alert.d.ts +9 -0
- package/dist/components/Avatar.d.ts +10 -0
- package/dist/components/AvatarGroup.d.ts +7 -0
- package/dist/components/Badge.d.ts +8 -0
- package/dist/components/Breadcrumbs.d.ts +8 -0
- package/dist/components/BulletChart.d.ts +10 -0
- package/dist/components/Button.d.ts +6 -0
- package/dist/components/ButtonGroup.d.ts +5 -0
- package/dist/components/Card.d.ts +7 -0
- package/dist/components/Carousel.d.ts +7 -0
- package/dist/components/ChartCard.d.ts +23 -0
- package/dist/components/ChartLegend.d.ts +10 -0
- package/dist/components/Checkbox.d.ts +8 -0
- package/dist/components/CodeBlock.d.ts +6 -0
- package/dist/components/ColorPicker.d.ts +7 -0
- package/dist/components/Combobox.d.ts +13 -0
- package/dist/components/Container.d.ts +7 -0
- package/dist/components/CopyButton.d.ts +5 -0
- package/dist/components/DatePicker.d.ts +9 -0
- package/dist/components/DateRangePicker.d.ts +9 -0
- package/dist/components/DescriptionList.d.ts +10 -0
- package/dist/components/Divider.d.ts +6 -0
- package/dist/components/Drawer.d.ts +11 -0
- package/dist/components/EmptyState.d.ts +8 -0
- package/dist/components/ErrorBoundary.d.ts +18 -0
- package/dist/components/Fieldset.d.ts +9 -0
- package/dist/components/FileUpload.d.ts +10 -0
- package/dist/components/Gauge.d.ts +10 -0
- package/dist/components/Grid.d.ts +8 -0
- package/dist/components/Heading.d.ts +7 -0
- package/dist/components/Icon.d.ts +8 -0
- package/dist/components/IconButton.d.ts +8 -0
- package/dist/components/InfoTooltip.d.ts +4 -0
- package/dist/components/Input.d.ts +10 -0
- package/dist/components/Kbd.d.ts +5 -0
- package/dist/components/Link.d.ts +6 -0
- package/dist/components/List.d.ts +11 -0
- package/dist/components/LoadingOverlay.d.ts +7 -0
- package/dist/components/Menu.d.ts +13 -0
- package/dist/components/MiniBar.d.ts +6 -0
- package/dist/components/Modal.d.ts +10 -0
- package/dist/components/Navbar.d.ts +7 -0
- package/dist/components/NumberStepper.d.ts +10 -0
- package/dist/components/OTPInput.d.ts +8 -0
- package/dist/components/Pagination.d.ts +6 -0
- package/dist/components/PasswordInput.d.ts +13 -0
- package/dist/components/Popover.d.ts +8 -0
- package/dist/components/Portal.d.ts +5 -0
- package/dist/components/ProgressBar.d.ts +9 -0
- package/dist/components/Radio.d.ts +23 -0
- package/dist/components/Rating.d.ts +7 -0
- package/dist/components/ScoreCard.d.ts +10 -0
- package/dist/components/SearchInput.d.ts +7 -0
- package/dist/components/SegmentedControl.d.ts +12 -0
- package/dist/components/Select.d.ts +22 -0
- package/dist/components/Sidebar.d.ts +14 -0
- package/dist/components/Skeleton.d.ts +8 -0
- package/dist/components/Slider.d.ts +13 -0
- package/dist/components/Sparkline.d.ts +6 -0
- package/dist/components/Spinner.d.ts +5 -0
- package/dist/components/Stack.d.ts +13 -0
- package/dist/components/StatusDot.d.ts +8 -0
- package/dist/components/Stepper.d.ts +11 -0
- package/dist/components/Switch.d.ts +8 -0
- package/dist/components/Table.d.ts +15 -0
- package/dist/components/Tabs.d.ts +12 -0
- package/dist/components/TagInput.d.ts +8 -0
- package/dist/components/Text.d.ts +11 -0
- package/dist/components/Textarea.d.ts +10 -0
- package/dist/components/Timeline.d.ts +13 -0
- package/dist/components/Toast.d.ts +14 -0
- package/dist/components/Tooltip.d.ts +7 -0
- package/dist/components/Tree.d.ts +13 -0
- package/dist/hooks/useClickOutside.d.ts +2 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.js +2769 -0
- package/dist/index.js.map +1 -0
- package/dist/theme.css +2 -0
- package/package.json +46 -0
package/LICENSE
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# Northline
|
|
2
|
+
|
|
3
|
+
A flat, mono-labeled dashboard theme: thin-bordered white cards, big
|
|
4
|
+
Space Grotesk numbers, IBM Plex Mono micro-labels, sparklines, and a
|
|
5
|
+
blue/teal/purple/orange Chart.js palette. Extracted from the Audience
|
|
6
|
+
Performance dashboard so it can be reused in other apps.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
Run `npm run build` in this package first (produces `dist/index.js`,
|
|
11
|
+
`dist/theme.css`, and `.d.ts` declarations - see **Building** below), then
|
|
12
|
+
depend on it from another repo as a `file:` dependency:
|
|
13
|
+
|
|
14
|
+
```json
|
|
15
|
+
{ "dependencies": { "northline": "file:../northline/packages/northline" } }
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
or publish it (private npm / GitHub Packages) and install normally.
|
|
19
|
+
|
|
20
|
+
## Building
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm run build # from this package, or `npm run build --workspace=northline` from the repo root
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
This is a Vite library-mode build (`vite.config.ts`): it compiles `src/` to
|
|
27
|
+
a single ES module (`dist/index.js`) with source maps, extracts `theme.css`
|
|
28
|
+
as a separate asset, and generates flat `.d.ts` declarations per component
|
|
29
|
+
via `vite-plugin-dts`. React/react-dom/chart.js/react-chartjs-2/
|
|
30
|
+
chartjs-plugin-datalabels stay external (peer dependencies), not bundled.
|
|
31
|
+
|
|
32
|
+
Re-run this after any source change - a `file:` dependency does not rebuild
|
|
33
|
+
automatically, so a consuming app only sees changes once `dist/` is
|
|
34
|
+
regenerated. The `playground` package is the exception: its Vite config
|
|
35
|
+
aliases `northline`/`northline/theme.css` straight to `src/`, so it keeps
|
|
36
|
+
instant HMR without a build step.
|
|
37
|
+
|
|
38
|
+
**Note on peer deps and duplicate modules:** because `northline` typically
|
|
39
|
+
lives outside the consuming app's own `node_modules` (a sibling repo via
|
|
40
|
+
`file:`), a consumer's bundler can resolve peer dependencies (React,
|
|
41
|
+
Chart.js, ...) against *this* repo's `node_modules` instead of its own,
|
|
42
|
+
creating two separate module instances (e.g. two Chart.js registries -
|
|
43
|
+
`installCharts()` registers scales on one copy while charts render with the
|
|
44
|
+
other, throwing `"category" is not a registered scale"`). If you hit that,
|
|
45
|
+
add a `resolve.dedupe` entry for the affected package(s) in the consumer's
|
|
46
|
+
Vite config.
|
|
47
|
+
|
|
48
|
+
## Storybook
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm run storybook # dev server at http://localhost:6006
|
|
52
|
+
npm run build-storybook # static build to storybook-static/
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Config lives in `.storybook/` (`main.ts`, `preview.tsx`, `preview-head.html`
|
|
56
|
+
for the Google Fonts link); stories live in `stories/`, one file per
|
|
57
|
+
component, outside `src/` so they never end up in the published `dist/`.
|
|
58
|
+
`preview.tsx` registers Chart.js, imports `theme.css`, and adds a
|
|
59
|
+
light/dark toolbar toggle wired to the same `data-theme` attribute the rest
|
|
60
|
+
of the theme reads.
|
|
61
|
+
|
|
62
|
+
Stories exist for a representative set of ~22 components spanning every
|
|
63
|
+
category (actions, forms, feedback, overlays, data display, navigation,
|
|
64
|
+
disclosure), each with its meaningful states (disabled, error, empty,
|
|
65
|
+
open/closed, etc) - not literally all 72+ components. Add a
|
|
66
|
+
`ComponentName.stories.tsx` under `stories/` for anything else that needs
|
|
67
|
+
one; copy the shape of an existing story for the pattern (plain
|
|
68
|
+
presentational components take `args` directly, anything with
|
|
69
|
+
internal/controlled state needs a small wrapper component that owns
|
|
70
|
+
`useState` and is passed to `render`).
|
|
71
|
+
|
|
72
|
+
## Setup
|
|
73
|
+
|
|
74
|
+
1. Load the fonts (once, in `index.html`):
|
|
75
|
+
|
|
76
|
+
```html
|
|
77
|
+
<link
|
|
78
|
+
href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap"
|
|
79
|
+
rel="stylesheet"
|
|
80
|
+
/>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
2. Register Chart.js once, before any chart renders (e.g. top of `main.jsx`):
|
|
84
|
+
|
|
85
|
+
```js
|
|
86
|
+
import { installCharts } from 'northline'
|
|
87
|
+
installCharts()
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
3. Import the theme CSS once (pulls in tokens + base styles for every component):
|
|
91
|
+
|
|
92
|
+
```js
|
|
93
|
+
import 'northline/theme.css'
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
This must be a separate, explicit import - the built package's JS entry
|
|
97
|
+
does *not* pull in the CSS as a side effect (Vite's library build strips
|
|
98
|
+
CSS imports out of the compiled JS).
|
|
99
|
+
|
|
100
|
+
## Dark mode
|
|
101
|
+
|
|
102
|
+
Follows the OS/browser preference automatically (`prefers-color-scheme`).
|
|
103
|
+
To override it explicitly - e.g. an in-app theme toggle - set
|
|
104
|
+
`data-theme` on the `<html>` element:
|
|
105
|
+
|
|
106
|
+
```js
|
|
107
|
+
document.documentElement.dataset.theme = 'dark' // or 'light'
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Leaving `data-theme` unset falls back to the system preference. All
|
|
111
|
+
component surfaces, borders, text, and status tones (`Badge`/`Avatar`/
|
|
112
|
+
`Toast`) repaint via CSS custom properties - no component code needs to
|
|
113
|
+
know which theme is active.
|
|
114
|
+
|
|
115
|
+
**Known gap:** Chart.js canvases (`ChartCard` contents) are drawn with the
|
|
116
|
+
colors in `PALETTE`/`TOOLTIP_OPTS`/`dualAxisOptions` from `chartTheme.js`,
|
|
117
|
+
which are plain hex strings, not CSS variables - they don't repaint on
|
|
118
|
+
theme change. If you need charts to follow the theme too, re-create the
|
|
119
|
+
chart (or update its options) when `data-theme`/`prefers-color-scheme`
|
|
120
|
+
changes.
|
|
121
|
+
|
|
122
|
+
## Components
|
|
123
|
+
|
|
124
|
+
| Component | Purpose |
|
|
125
|
+
|---|---|
|
|
126
|
+
| `ScoreCard` | KPI card: label, big value, colored delta, optional sparkline trend |
|
|
127
|
+
| `Sparkline` | Standalone inline SVG trend line |
|
|
128
|
+
| `ChartCard` | Draggable/resizable widget wrapper around a Chart.js chart, with an info tooltip |
|
|
129
|
+
| `Select` | Themed dropdown (single or `multiple` checkbox mode) — native `<option>` popups can't be restyled, so this is a full custom menu |
|
|
130
|
+
| `DateRangePicker` | Single-trigger calendar for picking a from/to range |
|
|
131
|
+
| `InfoTooltip` | Small (i) badge revealing a hover/focus tooltip |
|
|
132
|
+
| `Tabs` | Horizontal tab bar with an optional `comingSoon` disabled + badge state |
|
|
133
|
+
| `Button` | `primary` / `secondary` / `ghost` / `danger` variants, `sm` size |
|
|
134
|
+
| `Badge` | Status pill with pastel tones (`blue`, `teal`, `purple`, `orange`, `red`, `green`) and optional dot |
|
|
135
|
+
| `Input` | Labeled text field with hint/error state |
|
|
136
|
+
| `Switch` | Themed toggle backed by a native checkbox |
|
|
137
|
+
| `Table` | Plain data table: `columns` (`key`, `header`, `align`, `render`) + `rows`, optional row click |
|
|
138
|
+
| `Modal` | Portal-rendered dialog: `open`, `onClose`, `title`, `footer`, `size` (`sm`/`md`/`lg`) |
|
|
139
|
+
| `ToastProvider` / `useToast` | Wrap the app once, then call `show(message, { tone, duration })` from anywhere |
|
|
140
|
+
| `Checkbox` | Standalone themed checkbox |
|
|
141
|
+
| `RadioGroup` (+ `Radio`) | Themed radio group from an `options` list, or compose individual `Radio`s |
|
|
142
|
+
| `Textarea` | Multi-line counterpart to `Input`, same label/hint/error shape |
|
|
143
|
+
| `Skeleton` | Loading placeholder: `text` / `circle` / `rect` variants |
|
|
144
|
+
| `Menu` | Kebab-style popover action list (row actions, etc.) - lighter than `Select` |
|
|
145
|
+
| `Pagination` | Page-number list with prev/next, collapsing to ellipses for large page counts |
|
|
146
|
+
| `Breadcrumbs` | Location trail from an `items` list; last item renders as current page |
|
|
147
|
+
| `ProgressBar` | Linear quota/progress bar with optional label + percentage |
|
|
148
|
+
| `Gauge` | Circular counterpart to `ProgressBar`, value/label centered in the ring |
|
|
149
|
+
| `Avatar` | Image avatar, or a deterministic pastel initials badge when no `src` |
|
|
150
|
+
| `Card` | Plain flat bordered panel - the shared surface `ScoreCard`/`ChartCard` build on |
|
|
151
|
+
| `EmptyState` | Centered zero-data placeholder: icon, title, description, action |
|
|
152
|
+
| `Spinner` | Small themed loading spinner |
|
|
153
|
+
| `Accordion` | Expandable section list, single- or multi-open, controlled or uncontrolled |
|
|
154
|
+
| `SegmentedControl` | Button-group toggle for a small fixed set of options - lighter than `Tabs` |
|
|
155
|
+
| `ChartLegend` | Themed HTML legend to pair with a canvas chart whose own legend is switched off |
|
|
156
|
+
| `MiniBar` | Inline SVG bar sparkline - the bar-chart counterpart to `Sparkline` |
|
|
157
|
+
| `BulletChart` | Compact target-vs-actual bullet graph (fill + target tick in one track) |
|
|
158
|
+
| `Slider` | Themed range input (native `<input type="range">`, styled thumb/track) |
|
|
159
|
+
| `Stepper` | Horizontal multi-step progress indicator for wizard/setup flows |
|
|
160
|
+
| `Drawer` | Slide-in side panel - `Modal`'s edge-anchored counterpart |
|
|
161
|
+
| `Popover` | Generic anchored popover - arbitrary content, vs. `Menu`'s fixed action list |
|
|
162
|
+
| `TagInput` | Multi-value chip input: Enter/comma to add, Backspace to remove the last |
|
|
163
|
+
| `SearchInput` | Text input with a search icon and a clear button once there's a value |
|
|
164
|
+
| `CopyButton` | Icon button that copies text to the clipboard with brief "Copied" feedback |
|
|
165
|
+
| `StatusDot` | Bare colored indicator dot with optional label and `pulse` for a "live" state |
|
|
166
|
+
| `DescriptionList` | Label/value pairs grid for detail panels and drawers |
|
|
167
|
+
|
|
168
|
+
Generic, non-dashboard-specific primitives (typography/layout, feedback, remaining form inputs, data display, app shell) - for any app built on Northline, not just dashboards:
|
|
169
|
+
|
|
170
|
+
| Component | Purpose |
|
|
171
|
+
|---|---|
|
|
172
|
+
| `Text` | Generic text primitive: `size`, `weight`, `color`, `mono` |
|
|
173
|
+
| `Heading` | `level` 1-4 heading with Northline's display type scale |
|
|
174
|
+
| `Container` | Centered max-width content wrapper (`sm`/`md`/`lg`/`xl`/`full`) |
|
|
175
|
+
| `Stack` (+ `VStack`/`HStack`) | Flex layout with a consistent `gap` |
|
|
176
|
+
| `Grid` | Responsive-ish column grid (`columns`, `gap`) |
|
|
177
|
+
| `Divider` | Visual separator, plain or with a centered `label` |
|
|
178
|
+
| `Link` | Themed anchor, `external` adds `target="_blank"` safely |
|
|
179
|
+
| `Alert` | Persistent inline status banner (`info`/`success`/`warning`/`danger`), optional `onDismiss` |
|
|
180
|
+
| `IconButton` | Icon-only button, `Button`'s square counterpart |
|
|
181
|
+
| `Tooltip` | Generic hover/focus tooltip wrapping any single child element |
|
|
182
|
+
| `Fieldset` | The label+hint+error chrome `Input`/`Textarea` bake in, for custom controls |
|
|
183
|
+
| `Combobox` | Searchable/filterable select (free-text narrows the option list) |
|
|
184
|
+
| `NumberStepper` | Quantity input with +/- buttons, clamped to `min`/`max` |
|
|
185
|
+
| `FileUpload` | Drag-and-drop dropzone backed by a native file input |
|
|
186
|
+
| `DatePicker` | Single-date counterpart to `DateRangePicker` |
|
|
187
|
+
| `Rating` | Star rating, interactive or `readOnly` |
|
|
188
|
+
| `List` | Generic styled list, lighter than `Table` |
|
|
189
|
+
| `Timeline` | Vertical activity/event feed with a connected dot rail |
|
|
190
|
+
| `AvatarGroup` | Overlapping avatar stack with a "+N" overflow badge |
|
|
191
|
+
| `CodeBlock` | Monospace code snippet frame with optional language tag + copy button |
|
|
192
|
+
| `Kbd` | Keyboard-shortcut chip |
|
|
193
|
+
| `Tree` | Nested expandable hierarchy (file trees, category trees) |
|
|
194
|
+
| `Navbar` | App header bar: brand + arbitrary nav items/actions |
|
|
195
|
+
| `Sidebar` | Persistent side navigation rail, with a `collapsed` icon-only mode |
|
|
196
|
+
| `ButtonGroup` | Visually merges adjacent `Button`s into one segmented-looking group |
|
|
197
|
+
| `ColorPicker` | Preset swatch grid plus a native color input for anything else |
|
|
198
|
+
| `Icon` | Inline-SVG icon set (`name`, `size`, `color`, `filled`) - see Icons below |
|
|
199
|
+
| `PasswordInput` | `Input`'s password variant with a show/hide eye toggle |
|
|
200
|
+
| `OTPInput` | Segmented verification-code input, auto-advancing with paste support |
|
|
201
|
+
| `LoadingOverlay` | Dims and blocks a section while `active`, with a centered `Spinner` |
|
|
202
|
+
| `ErrorBoundary` | Class-component error boundary with a themed fallback `Alert` and retry |
|
|
203
|
+
| `Carousel` | Single-item-at-a-time carousel with prev/next controls and dot indicators |
|
|
204
|
+
| `Portal` | Renders into `document.body` - the mechanism `Modal`/`Drawer`/`Toast` use internally |
|
|
205
|
+
| `useClickOutside` (hook) | The click-outside/Escape pattern used internally by several overlay components |
|
|
206
|
+
|
|
207
|
+
## Icons
|
|
208
|
+
|
|
209
|
+
Northline only ever uses inline SVG for icons - no emoji, no unicode symbol
|
|
210
|
+
characters, no icon fonts. They render inconsistently across platforms
|
|
211
|
+
(color-emoji fonts, missing glyphs, baseline misalignment) and can't be
|
|
212
|
+
recolored to match the theme. Every icon-shaped bit of UI in the kit (Modal's
|
|
213
|
+
close button, Menu's kebab, Pagination's chevrons, CopyButton, Alert's status
|
|
214
|
+
icons, etc) is built on the shared `Icon` component:
|
|
215
|
+
|
|
216
|
+
```jsx
|
|
217
|
+
import { Icon } from 'northline'
|
|
218
|
+
|
|
219
|
+
<Icon name="trash" size={16} />
|
|
220
|
+
<Icon name="star" filled />
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
`color` defaults to `currentColor`, so an icon inside a themed button/link
|
|
224
|
+
inherits that element's color automatically. If you need an icon `Icon`
|
|
225
|
+
doesn't have yet, add a path to the `PATHS` map in
|
|
226
|
+
`src/components/Icon.tsx` rather than reaching for an emoji or a separate
|
|
227
|
+
one-off icon component.
|
|
228
|
+
|
|
229
|
+
## Chart helpers
|
|
230
|
+
|
|
231
|
+
`chartTheme.js` exports `PALETTE`, `TOOLTIP_OPTS`, `getChartColors()` and
|
|
232
|
+
`onThemeChange()` (see Dark mode above), plus one options builder per chart
|
|
233
|
+
shape - each reads the active theme's colors fresh on every call:
|
|
234
|
+
|
|
235
|
+
| Helper | Chart shape |
|
|
236
|
+
|---|---|
|
|
237
|
+
| `dualAxisOptions(rightUnit, opts)` | Bar+line combo, left axis raw value / right axis 0-100% |
|
|
238
|
+
| `donutOptions(opts)` | Pie/donut (`cutout`, `showLegend`) |
|
|
239
|
+
| `horizontalBarOptions(opts)` | Ranked horizontal bars |
|
|
240
|
+
| `areaOptions(opts)` | Single filled-line trend |
|
|
241
|
+
| `stackedBarOptions(opts)` | Stacked bars (composition over time) |
|
|
242
|
+
| `radarOptions()` | Radar/spider, multi-metric comparison |
|
|
243
|
+
|
|
244
|
+
Plus `rollingAverage` for moving-average series.
|
|
245
|
+
|
|
246
|
+
## What's app-specific (not in this package)
|
|
247
|
+
|
|
248
|
+
Filter *logic* (which fields exist, how they combine) and page layout
|
|
249
|
+
(`.app`, `.filters` container, breadcrumb, `.data-table`) stay in the
|
|
250
|
+
consuming app — only the reusable visual system lives here.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ChartOptions } from 'chart.js';
|
|
2
|
+
export declare const PALETTE: string[];
|
|
3
|
+
export declare const AXIS_TICK_FONT: {
|
|
4
|
+
size: number;
|
|
5
|
+
family: string;
|
|
6
|
+
};
|
|
7
|
+
export interface ChartColors {
|
|
8
|
+
gridColor: string;
|
|
9
|
+
axisColor: string;
|
|
10
|
+
tooltip: {
|
|
11
|
+
backgroundColor: string;
|
|
12
|
+
titleColor: string;
|
|
13
|
+
bodyColor: string;
|
|
14
|
+
borderColor: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export declare function getChartColors(): ChartColors;
|
|
18
|
+
export declare const AXIS_COLOR: string;
|
|
19
|
+
export declare const GRID_COLOR: string;
|
|
20
|
+
export declare const TOOLTIP_OPTS: {
|
|
21
|
+
borderWidth: number;
|
|
22
|
+
padding: number;
|
|
23
|
+
cornerRadius: number;
|
|
24
|
+
titleFont: {
|
|
25
|
+
size: number;
|
|
26
|
+
weight: number;
|
|
27
|
+
family: string;
|
|
28
|
+
};
|
|
29
|
+
bodyFont: {
|
|
30
|
+
size: number;
|
|
31
|
+
family: string;
|
|
32
|
+
};
|
|
33
|
+
backgroundColor: string;
|
|
34
|
+
titleColor: string;
|
|
35
|
+
bodyColor: string;
|
|
36
|
+
borderColor: string;
|
|
37
|
+
};
|
|
38
|
+
export declare function onThemeChange(callback: () => void): () => void;
|
|
39
|
+
export interface DualAxisOptionsOpts {
|
|
40
|
+
rotateXTicks?: boolean;
|
|
41
|
+
maxTicks?: number;
|
|
42
|
+
longLabels?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export declare function dualAxisOptions(rightUnit: string, { rotateXTicks, maxTicks, longLabels }?: DualAxisOptionsOpts): ChartOptions<'bar'>;
|
|
45
|
+
export interface DonutOptionsOpts {
|
|
46
|
+
cutout?: string | number;
|
|
47
|
+
showLegend?: boolean;
|
|
48
|
+
}
|
|
49
|
+
export declare function donutOptions({ cutout, showLegend }?: DonutOptionsOpts): ChartOptions<'doughnut'>;
|
|
50
|
+
export interface HorizontalBarOptionsOpts {
|
|
51
|
+
maxTicks?: number;
|
|
52
|
+
beginAtZero?: boolean;
|
|
53
|
+
}
|
|
54
|
+
export declare function horizontalBarOptions({ maxTicks, beginAtZero }?: HorizontalBarOptionsOpts): ChartOptions<'bar'>;
|
|
55
|
+
export interface AreaOptionsOpts {
|
|
56
|
+
maxTicks?: number;
|
|
57
|
+
beginAtZero?: boolean;
|
|
58
|
+
unit?: string;
|
|
59
|
+
}
|
|
60
|
+
export declare function areaOptions({ maxTicks, beginAtZero, unit }?: AreaOptionsOpts): ChartOptions<'line'>;
|
|
61
|
+
export interface StackedBarOptionsOpts {
|
|
62
|
+
maxTicks?: number;
|
|
63
|
+
rotateXTicks?: boolean;
|
|
64
|
+
}
|
|
65
|
+
export declare function stackedBarOptions({ maxTicks, rotateXTicks }?: StackedBarOptionsOpts): ChartOptions<'bar'>;
|
|
66
|
+
export declare function radarOptions(): ChartOptions<'radar'>;
|
|
67
|
+
export declare function rollingAverage<T extends Record<string, unknown>>(series: T[], key: keyof T, windowSize: number): (number | null)[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface AccordionItem {
|
|
3
|
+
id: string;
|
|
4
|
+
title: ReactNode;
|
|
5
|
+
content: ReactNode;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface AccordionProps {
|
|
9
|
+
items: AccordionItem[];
|
|
10
|
+
/** Controlled: which item ids are open. Omit to let Accordion manage its own state. */
|
|
11
|
+
openIds?: string[];
|
|
12
|
+
onChange?: (openIds: string[]) => void;
|
|
13
|
+
/** Allow more than one section open at once. Default: false (single-open). */
|
|
14
|
+
allowMultiple?: boolean;
|
|
15
|
+
defaultOpenIds?: string[];
|
|
16
|
+
}
|
|
17
|
+
export default function Accordion({ items, openIds, onChange, allowMultiple, defaultOpenIds, }: AccordionProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type AlertTone = 'info' | 'success' | 'warning' | 'danger';
|
|
3
|
+
export interface AlertProps {
|
|
4
|
+
tone?: AlertTone;
|
|
5
|
+
title?: ReactNode;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
onDismiss?: () => void;
|
|
8
|
+
}
|
|
9
|
+
export default function Alert({ tone, title, children, onDismiss }: AlertProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BadgeTone } from './Badge';
|
|
2
|
+
type AvatarTone = Exclude<BadgeTone, 'neutral'>;
|
|
3
|
+
export interface AvatarProps {
|
|
4
|
+
name?: string;
|
|
5
|
+
src?: string;
|
|
6
|
+
size?: number;
|
|
7
|
+
tone?: AvatarTone;
|
|
8
|
+
}
|
|
9
|
+
export default function Avatar({ name, src, size, tone }: AvatarProps): import('react').JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type BadgeTone = 'neutral' | 'blue' | 'teal' | 'purple' | 'orange' | 'red' | 'green';
|
|
3
|
+
export interface BadgeProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
tone?: BadgeTone;
|
|
6
|
+
dot?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export default function Badge({ children, tone, dot }: BadgeProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { BadgeTone } from './Badge';
|
|
3
|
+
export interface BulletChartProps {
|
|
4
|
+
value: number;
|
|
5
|
+
target: number;
|
|
6
|
+
max?: number;
|
|
7
|
+
tone?: Exclude<BadgeTone, 'neutral'>;
|
|
8
|
+
label?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export default function BulletChart({ value, target, max, tone, label }: BulletChartProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes } from 'react';
|
|
2
|
+
export interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'size'> {
|
|
3
|
+
variant?: 'primary' | 'secondary' | 'ghost' | 'danger';
|
|
4
|
+
size?: 'sm' | 'md';
|
|
5
|
+
}
|
|
6
|
+
export default function Button({ children, variant, size, type, disabled, onClick, ...rest }: ButtonProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DragEvent, ReactNode } from 'react';
|
|
2
|
+
export interface ChartCardSize {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
}
|
|
6
|
+
export interface ChartCardProps {
|
|
7
|
+
id: string;
|
|
8
|
+
title: ReactNode;
|
|
9
|
+
info?: string;
|
|
10
|
+
height?: number | string;
|
|
11
|
+
width?: number | string;
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
onDragStart?: (e: DragEvent<HTMLDivElement>, id: string) => void;
|
|
14
|
+
onDragOver?: (id: string) => void;
|
|
15
|
+
onDrop?: (id: string) => void;
|
|
16
|
+
onDragEnd?: () => void;
|
|
17
|
+
onResize?: (id: string, size: ChartCardSize) => void;
|
|
18
|
+
registerRef?: (id: string, node: HTMLDivElement | null) => void;
|
|
19
|
+
isDragOver?: boolean;
|
|
20
|
+
isDragging?: boolean;
|
|
21
|
+
draggable?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export default function ChartCard({ id, title, info, height, width, children, onDragStart, onDragOver, onDrop, onDragEnd, onResize, registerRef, isDragOver, isDragging, draggable, }: ChartCardProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface ChartLegendItem {
|
|
2
|
+
label: string;
|
|
3
|
+
color: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ChartLegendProps {
|
|
6
|
+
items: ChartLegendItem[];
|
|
7
|
+
hidden?: string[];
|
|
8
|
+
onToggle?: (label: string) => void;
|
|
9
|
+
}
|
|
10
|
+
export default function ChartLegend({ items, hidden, onToggle }: ChartLegendProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface CheckboxProps {
|
|
3
|
+
checked: boolean;
|
|
4
|
+
onChange: (checked: boolean) => void;
|
|
5
|
+
label?: ReactNode;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export default function Checkbox({ checked, onChange, label, disabled }: CheckboxProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface ComboboxOption {
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ComboboxProps {
|
|
6
|
+
value: string;
|
|
7
|
+
onChange: (value: string) => void;
|
|
8
|
+
options: ComboboxOption[];
|
|
9
|
+
label?: string;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export default function Combobox({ value, onChange, options, label, placeholder, disabled }: ComboboxProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface ContainerProps {
|
|
3
|
+
size?: 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export default function Container({ size, children, className }: ContainerProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface DatePickerProps {
|
|
2
|
+
value?: string | null;
|
|
3
|
+
min?: string | null;
|
|
4
|
+
max?: string | null;
|
|
5
|
+
onChange: (date: string) => void;
|
|
6
|
+
label?: string;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
}
|
|
9
|
+
export default function DatePicker({ value, min, max, onChange, label, placeholder }: DatePickerProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface DateRangePickerProps {
|
|
2
|
+
from?: string | null;
|
|
3
|
+
to?: string | null;
|
|
4
|
+
min?: string | null;
|
|
5
|
+
max?: string | null;
|
|
6
|
+
onChange: (from: string, to: string) => void;
|
|
7
|
+
label?: string;
|
|
8
|
+
}
|
|
9
|
+
export default function DateRangePicker({ from, to, min, max, onChange, label }: DateRangePickerProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface DescriptionItem {
|
|
3
|
+
label: ReactNode;
|
|
4
|
+
value: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export interface DescriptionListProps {
|
|
7
|
+
items: DescriptionItem[];
|
|
8
|
+
columns?: number;
|
|
9
|
+
}
|
|
10
|
+
export default function DescriptionList({ items, columns }: DescriptionListProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface DrawerProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onClose?: () => void;
|
|
5
|
+
title?: ReactNode;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
footer?: ReactNode;
|
|
8
|
+
side?: 'left' | 'right';
|
|
9
|
+
width?: number;
|
|
10
|
+
}
|
|
11
|
+
export default function Drawer({ open, onClose, title, children, footer, side, width }: DrawerProps): import('react').ReactPortal | null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface EmptyStateProps {
|
|
3
|
+
icon?: ReactNode;
|
|
4
|
+
title: ReactNode;
|
|
5
|
+
description?: ReactNode;
|
|
6
|
+
action?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export default function EmptyState({ icon, title, description, action }: EmptyStateProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Component, ErrorInfo, ReactNode } from 'react';
|
|
2
|
+
export interface ErrorBoundaryProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
/** Custom fallback UI. Given the caught error and a `reset()` to retry. */
|
|
5
|
+
fallback?: (error: Error, reset: () => void) => ReactNode;
|
|
6
|
+
onError?: (error: Error, info: ErrorInfo) => void;
|
|
7
|
+
}
|
|
8
|
+
interface ErrorBoundaryState {
|
|
9
|
+
error: Error | null;
|
|
10
|
+
}
|
|
11
|
+
export default class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
12
|
+
state: ErrorBoundaryState;
|
|
13
|
+
static getDerivedStateFromError(error: Error): ErrorBoundaryState;
|
|
14
|
+
componentDidCatch(error: Error, info: ErrorInfo): void;
|
|
15
|
+
reset: () => void;
|
|
16
|
+
render(): string | number | bigint | boolean | import('react').JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface FieldsetProps {
|
|
3
|
+
label?: ReactNode;
|
|
4
|
+
hint?: ReactNode;
|
|
5
|
+
error?: boolean;
|
|
6
|
+
htmlFor?: string;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export default function Fieldset({ label, hint, error, htmlFor, children }: FieldsetProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface FileUploadProps {
|
|
3
|
+
onFiles: (files: File[]) => void;
|
|
4
|
+
accept?: string;
|
|
5
|
+
multiple?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
label?: ReactNode;
|
|
8
|
+
hint?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export default function FileUpload({ onFiles, accept, multiple, disabled, label, hint, }: FileUploadProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { BadgeTone } from './Badge';
|
|
3
|
+
export interface GaugeProps {
|
|
4
|
+
value: number;
|
|
5
|
+
max?: number;
|
|
6
|
+
tone?: Exclude<BadgeTone, 'neutral'>;
|
|
7
|
+
size?: number;
|
|
8
|
+
label?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export default function Gauge({ value, max, tone, size, label }: GaugeProps): import('react').JSX.Element;
|