basalt-ui 2.13.1 → 2.13.3
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/CHANGELOG.md +19 -0
- package/MIGRATING.md +25 -12
- package/README.md +1 -1
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +6 -5
- package/dist/charts/cursor.d.ts +33 -7
- package/dist/charts/cursor.d.ts.map +1 -1
- package/dist/charts/cursor.js +31 -10
- package/dist/charts/legend.d.ts +19 -3
- package/dist/charts/legend.d.ts.map +1 -1
- package/dist/charts/legend.js +33 -15
- package/dist/charts/marks.d.ts.map +1 -1
- package/dist/charts/marks.js +24 -28
- package/dist/charts/panel.d.ts.map +1 -1
- package/dist/charts/panel.js +4 -4
- package/dist/charts/types.d.ts +3 -2
- package/dist/charts/types.d.ts.map +1 -1
- package/dist/provider/create-router.d.ts +9 -4
- package/dist/provider/create-router.d.ts.map +1 -1
- package/dist/provider/create-router.js +1 -19
- package/dist/provider/error-fallback.module.css +4 -15
- package/dist/provider/error-fallback.module.css.d.ts +0 -1
- package/dist/provider/fallback.module.css +37 -0
- package/dist/provider/fallback.module.css.d.ts +11 -0
- package/dist/provider/index.d.ts.map +1 -1
- package/dist/provider/index.js +2 -1
- package/dist/provider/route-defaults.d.ts +10 -0
- package/dist/provider/route-defaults.d.ts.map +1 -0
- package/dist/provider/route-defaults.js +25 -0
- package/dist/provider/route-defaults.module.css +39 -0
- package/dist/provider/route-defaults.module.css.d.ts +10 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +4 -1
- package/llms.txt +2 -2
- package/package.json +1 -1
- package/src/charts/compile.ts +8 -10
- package/src/charts/cursor.ts +69 -19
- package/src/charts/legend.tsx +40 -19
- package/src/charts/marks.ts +28 -29
- package/src/charts/panel.tsx +4 -4
- package/src/charts/types.ts +3 -2
- package/src/provider/create-router.tsx +2 -36
- package/src/provider/error-fallback.module.css +4 -15
- package/src/provider/error-fallback.module.css.d.ts +0 -1
- package/src/provider/fallback.module.css +37 -0
- package/src/provider/fallback.module.css.d.ts +11 -0
- package/src/provider/index.tsx +2 -1
- package/src/provider/route-defaults.module.css +39 -0
- package/src/provider/route-defaults.module.css.d.ts +10 -0
- package/src/provider/route-defaults.tsx +39 -0
- package/src/theme/__snapshots__/plain-theme.test.ts.snap +2 -0
- package/src/theme/index.ts +4 -1
package/src/charts/panel.tsx
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* `state`, cursor binding, tooltip surface, guides — is the rung's or lives here once.
|
|
7
7
|
*/
|
|
8
8
|
import { crosshair } from '@tanstack/charts/crosshair'
|
|
9
|
-
import { tooltip as tooltipHost } from '@tanstack/charts/tooltip'
|
|
10
9
|
import { portal } from '@tanstack/charts/tooltip/portal'
|
|
11
10
|
import type {
|
|
12
11
|
ChartBuildContext,
|
|
@@ -23,7 +22,7 @@ import { ChartShell } from './CartesianChart'
|
|
|
23
22
|
import type { ChartShellProps, ShellContext } from './CartesianChart'
|
|
24
23
|
import { defaultFormatX, engineRow, utcHeaderDate, visibleSeries, xGuide, yGuide } from './compile'
|
|
25
24
|
import type { CartesianDefinition } from './compile'
|
|
26
|
-
import { cursorBinding,
|
|
25
|
+
import { cursorBinding, followerOptions, quietWhileFollowing } from './cursor'
|
|
27
26
|
import { plotAccess } from './plot-context'
|
|
28
27
|
import type { PlotAccess } from './plot-context'
|
|
29
28
|
import type { XScaleModel } from './scales'
|
|
@@ -210,7 +209,7 @@ function panelDefinition<T, X extends ChartX>(
|
|
|
210
209
|
}
|
|
211
210
|
const definition: CartesianDefinition = {
|
|
212
211
|
chart: () => composed,
|
|
213
|
-
focus:
|
|
212
|
+
focus: 'group-x',
|
|
214
213
|
maxFocusDistance: Number.POSITIVE_INFINITY,
|
|
215
214
|
cursor: cursorBinding({
|
|
216
215
|
group: cursorGroup,
|
|
@@ -223,7 +222,8 @@ function panelDefinition<T, X extends ChartX>(
|
|
|
223
222
|
props.tooltip === false
|
|
224
223
|
? false
|
|
225
224
|
: {
|
|
226
|
-
use:
|
|
225
|
+
use: quietWhileFollowing,
|
|
226
|
+
...followerOptions(tooltip, cursorGroup, chartId),
|
|
227
227
|
portal,
|
|
228
228
|
anchor: 'group-center',
|
|
229
229
|
content: (points: readonly ChartPoint[]) => {
|
package/src/charts/types.ts
CHANGED
|
@@ -70,8 +70,9 @@ export type ChartSeries<T> = {
|
|
|
70
70
|
/** A marker at a point (a PR star, a status dot); `null` for none. Always-on markers are `Lines`'
|
|
71
71
|
* alone. On a `CartesianChart` with consumer `marks` only the CURSOR dot of a `cursorValue`
|
|
72
72
|
* series reads `getMarker` (its `color`): without `cursorValue` it is ignored there, so draw a
|
|
73
|
-
* persistent dot in `marks` yourself. Each distinct color is one extra mark:
|
|
74
|
-
* categorical set (statuses, buckets), never a continuous scale.
|
|
73
|
+
* persistent dot in `marks` yourself. Each distinct color of an always-on marker is one extra mark:
|
|
74
|
+
* keep those a small categorical set (statuses, buckets), never a continuous scale. Only the
|
|
75
|
+
* `cursorValue` cursor dot is ONE mark whatever its colors. */
|
|
75
76
|
getMarker?:
|
|
76
77
|
| ((d: T) => {
|
|
77
78
|
color?: string | undefined
|
|
@@ -5,13 +5,12 @@
|
|
|
5
5
|
* pending / error / not-found components, and the route view transition (direction from the
|
|
6
6
|
* `BasaltShell` nav order, V2-SPEC § 5).
|
|
7
7
|
*/
|
|
8
|
-
import { Button, Center, Loader, Stack, Text } from '@mantine/core'
|
|
9
8
|
import type { QueryClient, QueryClientConfig } from '@tanstack/react-query'
|
|
10
9
|
import { Router, createRouter } from '@tanstack/react-router'
|
|
11
|
-
import type { AnyRoute,
|
|
12
|
-
import { toErrorMessage } from '../common/errors'
|
|
10
|
+
import type { AnyRoute, RouterHistory } from '@tanstack/react-router'
|
|
13
11
|
import { makeQueryClient } from '../query-client'
|
|
14
12
|
import type { RouterHook } from '../telemetry'
|
|
13
|
+
import { ErrorComponent, NotFoundComponent, PendingComponent } from './route-defaults'
|
|
15
14
|
import {
|
|
16
15
|
guardViewTransitionRejections,
|
|
17
16
|
routeViewTransition,
|
|
@@ -49,39 +48,6 @@ export type BasaltRouter<
|
|
|
49
48
|
readonly [basaltRouterBrand]: true
|
|
50
49
|
}
|
|
51
50
|
|
|
52
|
-
function PendingComponent() {
|
|
53
|
-
return (
|
|
54
|
-
<Center py="xl">
|
|
55
|
-
<Loader size="sm" />
|
|
56
|
-
</Center>
|
|
57
|
-
)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function ErrorComponent({ error, reset }: ErrorComponentProps) {
|
|
61
|
-
return (
|
|
62
|
-
<Stack align="flex-start" gap="xs" p="md">
|
|
63
|
-
<Text fw={600}>Something went wrong</Text>
|
|
64
|
-
<Text c="dimmed" size="sm">
|
|
65
|
-
{toErrorMessage(error)}
|
|
66
|
-
</Text>
|
|
67
|
-
<Button size="compact-sm" variant="default" onClick={reset}>
|
|
68
|
-
Try again
|
|
69
|
-
</Button>
|
|
70
|
-
</Stack>
|
|
71
|
-
)
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function NotFoundComponent() {
|
|
75
|
-
return (
|
|
76
|
-
<Stack gap={4} p="md">
|
|
77
|
-
<Text fw={600}>Page not found</Text>
|
|
78
|
-
<Text c="dimmed" size="sm">
|
|
79
|
-
This address does not match any page.
|
|
80
|
-
</Text>
|
|
81
|
-
</Stack>
|
|
82
|
-
)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
51
|
/** The options `createBasaltRouter` owns. Each is `never` on it: basalt's, not a consumer knob. */
|
|
86
52
|
type ManagedKeys = Exclude<keyof BasaltRouterOptions, 'context'>
|
|
87
53
|
|
|
@@ -1,21 +1,10 @@
|
|
|
1
|
-
/* The boundary renders ABOVE MantineProvider, so its fallback is plain HTML styled here
|
|
2
|
-
Mantine primitive, no inline style object (hidden-inline-style).
|
|
1
|
+
/* The boundary renders ABOVE MantineProvider, so its fallback is plain HTML styled here and in the
|
|
2
|
+
shared fallback.module.css — no Mantine primitive, no inline style object (hidden-inline-style). */
|
|
3
3
|
.root {
|
|
4
4
|
max-width: 32rem;
|
|
5
5
|
margin: 0 auto;
|
|
6
|
-
padding: var(--vx-space-stack-xl);
|
|
6
|
+
padding: var(--vx-space-stack-xl, 2rem);
|
|
7
7
|
display: flex;
|
|
8
8
|
flex-direction: column;
|
|
9
|
-
gap: var(--vx-space-stack-md);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.reload {
|
|
13
|
-
align-self: flex-start;
|
|
14
|
-
font: inherit;
|
|
15
|
-
cursor: pointer;
|
|
16
|
-
padding: var(--vx-space-stack-xs) var(--vx-space-stack-md);
|
|
17
|
-
border: 1px solid var(--vx-divider);
|
|
18
|
-
border-radius: var(--vx-radius-ctrl);
|
|
19
|
-
background: transparent;
|
|
20
|
-
color: inherit;
|
|
9
|
+
gap: var(--vx-space-stack-md, 1rem);
|
|
21
10
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* The plain-HTML fallback vocabulary shared by RootBoundary's fallback and the router's default
|
|
2
|
+
screens: both render where Mantine may be absent, so neither can use a Mantine primitive. Every
|
|
3
|
+
--vx-* read carries a literal fallback, so they look right with the provider, with only
|
|
4
|
+
tokens.css, or with nothing. */
|
|
5
|
+
.stack {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
align-items: flex-start;
|
|
9
|
+
gap: var(--vx-space-stack-xs, 0.5rem);
|
|
10
|
+
padding: var(--vx-space-stack-md, 1rem);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.title {
|
|
14
|
+
margin: 0;
|
|
15
|
+
font-weight: 600;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.text {
|
|
19
|
+
margin: 0;
|
|
20
|
+
font-size: var(--vx-text-sm, 0.875rem);
|
|
21
|
+
color: var(--vx-ink2, inherit);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.action {
|
|
25
|
+
align-self: flex-start;
|
|
26
|
+
min-width: 2.75rem;
|
|
27
|
+
min-height: 2.75rem;
|
|
28
|
+
font: inherit;
|
|
29
|
+
font-size: var(--vx-text-sm, 0.875rem);
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
padding: 0.25rem var(--vx-space-stack-md, 0.75rem);
|
|
32
|
+
border: 1px solid currentColor;
|
|
33
|
+
border: 1px solid var(--vx-divider, color-mix(in srgb, currentColor 25%, transparent));
|
|
34
|
+
border-radius: var(--vx-radius-ctrl, 6px);
|
|
35
|
+
background: transparent;
|
|
36
|
+
color: inherit;
|
|
37
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed CSS-module declaration (the S4 CSS-modules path). Named string props — not an index
|
|
3
|
+
* signature — so dot access stays verbatim under the package's strict flags.
|
|
4
|
+
*/
|
|
5
|
+
declare const classes: {
|
|
6
|
+
readonly stack: string
|
|
7
|
+
readonly title: string
|
|
8
|
+
readonly text: string
|
|
9
|
+
readonly action: string
|
|
10
|
+
}
|
|
11
|
+
export default classes
|
package/src/provider/index.tsx
CHANGED
|
@@ -22,6 +22,7 @@ import type { AnyRouter } from '@tanstack/react-router'
|
|
|
22
22
|
import { Component, Suspense, lazy, useEffect, useMemo, useRef, useState } from 'react'
|
|
23
23
|
import type { ErrorInfo, ReactNode } from 'react'
|
|
24
24
|
import fallbackClasses from './error-fallback.module.css'
|
|
25
|
+
import sharedFallback from './fallback.module.css'
|
|
25
26
|
import { cssVariablesResolver } from '../theme'
|
|
26
27
|
import { useLabTheme } from './lab-theme'
|
|
27
28
|
import { buildDensityCss, buildFontsCss, buildPaletteCss, buildRadiusCss } from '../tokens/core'
|
|
@@ -142,7 +143,7 @@ function DefaultErrorFallback(): ReactNode {
|
|
|
142
143
|
/>
|
|
143
144
|
<button
|
|
144
145
|
type="button"
|
|
145
|
-
className={
|
|
146
|
+
className={sharedFallback.action}
|
|
146
147
|
onClick={() => window.location.reload()}
|
|
147
148
|
>
|
|
148
149
|
Reload page
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* The router's default screens render at the route that failed, which can be ABOVE BasaltProvider.
|
|
2
|
+
Shared stack/title/text/action live in fallback.module.css; same literal-fallback rule. */
|
|
3
|
+
.center {
|
|
4
|
+
display: flex;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
padding: var(--vx-space-stack-xl, 2rem) 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.spinner {
|
|
10
|
+
width: 1.25rem;
|
|
11
|
+
height: 1.25rem;
|
|
12
|
+
border: 2px solid currentColor;
|
|
13
|
+
border-top-color: currentColor;
|
|
14
|
+
border: 2px solid color-mix(in srgb, currentColor 20%, transparent);
|
|
15
|
+
border-top-color: var(--vx-accent, currentColor);
|
|
16
|
+
border-radius: 50%;
|
|
17
|
+
animation: spin 0.8s linear infinite;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@keyframes spin {
|
|
21
|
+
to {
|
|
22
|
+
transform: rotate(360deg);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* A static ring is still a loading mark; the aria-label carries the state. */
|
|
27
|
+
@media (prefers-reduced-motion: reduce) {
|
|
28
|
+
.spinner {
|
|
29
|
+
animation: none;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* Not-found is a statement, not an error with an action: its own column, no flex-start alignment. */
|
|
34
|
+
.notFound {
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
gap: 4px;
|
|
38
|
+
padding: var(--vx-space-stack-md, 1rem);
|
|
39
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed CSS-module declaration (the S4 CSS-modules path). Named string props — not an index
|
|
3
|
+
* signature — so dot access stays verbatim under the package's strict flags.
|
|
4
|
+
*/
|
|
5
|
+
declare const classes: {
|
|
6
|
+
readonly center: string
|
|
7
|
+
readonly spinner: string
|
|
8
|
+
readonly notFound: string
|
|
9
|
+
}
|
|
10
|
+
export default classes
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The router's default pending / error / not-found screens. Provider-free on purpose: a route's
|
|
3
|
+
* screen renders at the route that failed, which can sit above `BasaltProvider` (a root-level error,
|
|
4
|
+
* or a pathless-layout provider), so no Mantine primitive. Wired by `createBasaltRouter`.
|
|
5
|
+
*/
|
|
6
|
+
import type { ErrorComponentProps } from '@tanstack/react-router'
|
|
7
|
+
import { toErrorMessage } from '../common/errors'
|
|
8
|
+
import fallback from './fallback.module.css'
|
|
9
|
+
import classes from './route-defaults.module.css'
|
|
10
|
+
|
|
11
|
+
export function PendingComponent() {
|
|
12
|
+
return (
|
|
13
|
+
<div className={classes.center}>
|
|
14
|
+
<output className={classes.spinner} aria-label="Loading" />
|
|
15
|
+
</div>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// No log here: `defaultOnCatch` (create-router.tsx) already reports every route error.
|
|
20
|
+
export function ErrorComponent({ error, reset }: ErrorComponentProps) {
|
|
21
|
+
return (
|
|
22
|
+
<div className={fallback.stack} role="alert">
|
|
23
|
+
<p className={fallback.title}>Something went wrong</p>
|
|
24
|
+
<p className={fallback.text}>{toErrorMessage(error)}</p>
|
|
25
|
+
<button type="button" className={fallback.action} onClick={reset}>
|
|
26
|
+
Try again
|
|
27
|
+
</button>
|
|
28
|
+
</div>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function NotFoundComponent() {
|
|
33
|
+
return (
|
|
34
|
+
<div className={classes.notFound}>
|
|
35
|
+
<p className={fallback.title}>Page not found</p>
|
|
36
|
+
<p className={fallback.text}>This address does not match any page.</p>
|
|
37
|
+
</div>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
@@ -473,6 +473,7 @@ exports[`createBasaltTheme() shape and resolver output default 1`] = `
|
|
|
473
473
|
},
|
|
474
474
|
"defaultProps": {
|
|
475
475
|
"closeButtonProps": {
|
|
476
|
+
"aria-label": "Close",
|
|
476
477
|
"data-basalt-hit": true,
|
|
477
478
|
},
|
|
478
479
|
"radius": 8,
|
|
@@ -1565,6 +1566,7 @@ exports[`createBasaltTheme() shape and resolver output all knobs 1`] = `
|
|
|
1565
1566
|
},
|
|
1566
1567
|
"defaultProps": {
|
|
1567
1568
|
"closeButtonProps": {
|
|
1569
|
+
"aria-label": "Close",
|
|
1568
1570
|
"data-basalt-hit": true,
|
|
1569
1571
|
},
|
|
1570
1572
|
"radius": 11,
|
package/src/theme/index.ts
CHANGED
|
@@ -1018,7 +1018,10 @@ function buildTheme(data: PaletteData, options: BuildThemeOptions = {}): Mantine
|
|
|
1018
1018
|
// behind it. Title = head font; close button = the ghost idiom (floating.module.css). Below the
|
|
1019
1019
|
// `medium` size class the Modal is a bottom sheet (floating.module.css `sheet*`).
|
|
1020
1020
|
Modal: ext<typeof Modal>({
|
|
1021
|
-
defaultProps: {
|
|
1021
|
+
defaultProps: {
|
|
1022
|
+
radius: radius.floating,
|
|
1023
|
+
closeButtonProps: { ...HIT_ATTR, 'aria-label': 'Close' },
|
|
1024
|
+
},
|
|
1022
1025
|
classNames: {
|
|
1023
1026
|
close: floatingClasses.closeButton,
|
|
1024
1027
|
inner: floatingClasses.sheetInner,
|