@surrealdb/ui 2.2.0 → 3.0.0-beta.10

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/ui.d.ts CHANGED
@@ -40,6 +40,7 @@ import { MantineRadius } from '@mantine/core';
40
40
  import { MantineSize } from '@mantine/core';
41
41
  import { MantineSpacing } from '@mantine/core';
42
42
  import { MantineThemeOverride } from '@mantine/core';
43
+ import { MantineTransition } from '@mantine/core';
43
44
  import { PolymorphicFactory } from '@mantine/core';
44
45
  import * as portals from 'react-reverse-portal';
45
46
  import { PropsWithChildren } from 'react';
@@ -54,7 +55,6 @@ import { TabsListProps } from '@mantine/core';
54
55
  import { TabsProps as TabsProps_2 } from '@mantine/core';
55
56
  import { TabsTabProps } from '@mantine/core';
56
57
  import { TextProps } from '@mantine/core';
57
- import { TimelineProps } from '@mantine/core';
58
58
  import { TitleOrder } from '@mantine/core';
59
59
  import { TitleProps } from '@mantine/core';
60
60
  import { Tree } from '@lezer/common';
@@ -62,6 +62,16 @@ import { UnstyledButtonProps } from '@mantine/core';
62
62
  import { VariantColorsResolver } from '@mantine/core';
63
63
  import { VideoHTMLAttributes } from 'react';
64
64
 
65
+ /**
66
+ * Accent — the product colour of the surrounding region.
67
+ *
68
+ * Not a hue of its own: each shade names a token that `[data-surreal-accent]`
69
+ * points at Lilac (Database, and the default) or Violet (Agent Memory). Ask for
70
+ * it with `color="accent"` where a control should carry the product's identity;
71
+ * an uncoloured control stays neutral.
72
+ */
73
+ export declare const ACCENT: MantineColorsTuple;
74
+
65
75
  /**
66
76
  * A keybind used to accept a completion
67
77
  */
@@ -842,6 +852,9 @@ export declare type DisplayStylesNames = "root";
842
852
 
843
853
  export declare const Drawer: DrawerCompound;
844
854
 
855
+ /** Every drawer transition, by side, for a `Drawer` whose side is known up front. */
856
+ export declare const DRAWER_TRANSITIONS: Record<TransitionSide, MantineTransition>;
857
+
845
858
  declare function DrawerBody({ lane, children, className, ...rest }: DrawerBodyProps): ReactNode;
846
859
 
847
860
  export declare interface DrawerBodyProps extends Omit<BoxProps, "children"> {
@@ -911,8 +924,34 @@ export declare interface DrawerState {
911
924
  portal: portals.HtmlPortalNode;
912
925
  }
913
926
 
927
+ /** The drawer transition for the side it opens from. */
928
+ export declare function drawerTransition(side: TransitionSide): MantineTransition;
929
+
930
+ /**
931
+ * The variables `SURREAL_TRANSITIONS.drawer` reads for the side a drawer opens
932
+ * from, which the kit's `Drawer` sets from its `position`: where it starts, and
933
+ * the shadow its surface bleeds past that edge with.
934
+ */
935
+ export declare function drawerTransitionVars(side: TransitionSide): Record<string, string>;
936
+
914
937
  declare type DynamicNode<T> = ReactNode | ((value: T) => ReactNode);
915
938
 
939
+ /**
940
+ * Easing for a layer that arrives with weight: it overshoots its final size a
941
+ * touch and settles back ("ease back"). Modals and drawers.
942
+ */
943
+ export declare const EASE_BACK = "cubic-bezier(0.34, 1.56, 0.64, 1)";
944
+
945
+ /**
946
+ * The ease back for a drawer: the same settle, far gentler. A drawer travels its
947
+ * whole width, so the modal's overshoot would carry it tens of pixels past its
948
+ * rest; this one carries it a few, early, and eases the rest of the way in slowly.
949
+ */
950
+ export declare const EASE_BACK_SUBTLE = "cubic-bezier(0.16, 1.18, 0.3, 1)";
951
+
952
+ /** Easing for a layer that simply arrives: quick out of the gate, no overshoot. */
953
+ export declare const EASE_OUT = "cubic-bezier(0.16, 1, 0.3, 1)";
954
+
916
955
  export declare interface EditorController {
917
956
  ref: RefObject<HTMLDivElement | null>;
918
957
  mounted: boolean;
@@ -1020,8 +1059,8 @@ export declare function extractTest(input: string): ExtractedCode;
1020
1059
  /**
1021
1060
  * The short uppercase line that names a section or product above a title.
1022
1061
  *
1023
- * Monospace, tracked out, and drawn in the accent of the surrounding subtree, so
1024
- * stamping `data-surreal-accent="memory"` turns it violet without a prop.
1062
+ * Tracked-out uppercase in the secondary text colour, so it names what follows
1063
+ * without competing with it. Pass `color` to carry a product hue.
1025
1064
  */
1026
1065
  export declare const Eyebrow: MantinePolymorphicComponent<EyebrowFactory>;
1027
1066
 
@@ -1040,7 +1079,7 @@ export declare type EyebrowFactory = PolymorphicFactory<{
1040
1079
  export declare interface EyebrowProps extends BoxProps, StylesApiProps<EyebrowFactory>, ElementProps<"p"> {
1041
1080
  /** Text size. @default `"xs"` */
1042
1081
  size?: MantineSize;
1043
- /** Overrides the accent color the eyebrow is drawn in. */
1082
+ /** Draws the eyebrow in a palette colour instead of the secondary text colour. */
1044
1083
  color?: MantineColor;
1045
1084
  }
1046
1085
 
@@ -1077,6 +1116,17 @@ export declare function getMarkdownEditorReady(state: EditorState): boolean;
1077
1116
  */
1078
1117
  export declare function getMarkdownMode(state: EditorState): MarkdownEditMode;
1079
1118
 
1119
+ /**
1120
+ * Graphite — the near-grey neutral used for every surface.
1121
+ *
1122
+ * The dark end is the page: `#0A090E` canvas, `#131218` surface and `#18171D`
1123
+ * raised. The light end is the same ramp read the other way, so a light page and
1124
+ * a dark one keep the same calm, barely tinted grey.
1125
+ *
1126
+ * Never use Graphite for text; text roles live on {@link OBSIDIAN}.
1127
+ */
1128
+ export declare const GRAPHITE: MantineColorsTuple;
1129
+
1080
1130
  /** A document heading with slug id, plain text, and depth. */
1081
1131
  declare interface Heading {
1082
1132
  id: string;
@@ -1346,6 +1396,8 @@ export declare const iconFullscreen: string;
1346
1396
 
1347
1397
  export declare const iconFunction: string;
1348
1398
 
1399
+ export declare const iconGauge: string;
1400
+
1349
1401
  export declare const iconGraphql: string;
1350
1402
 
1351
1403
  export declare const iconGrid: string;
@@ -1521,6 +1573,8 @@ export declare const iconSidekick: string;
1521
1573
 
1522
1574
  export declare const iconSpectron: string;
1523
1575
 
1576
+ export declare const iconSplit: string;
1577
+
1524
1578
  export declare const iconStar: string;
1525
1579
 
1526
1580
  export declare const iconStarPlus: string;
@@ -1630,7 +1684,7 @@ declare type Language = "csharp" | "rust" | "javascript" | "typescript" | "surre
1630
1684
  */
1631
1685
  export declare function layoutTiles<Context>(registry: TileRegistry<Context>, specs: readonly TileSpec[], columns?: number): TileValue[];
1632
1686
 
1633
- /** Surreal Lilac — the primary action color, and the Database product color. */
1687
+ /** Surreal Lilac — the Database product color, and the default accent. */
1634
1688
  export declare const LILAC: MantineColorsTuple;
1635
1689
 
1636
1690
  export declare function limitsOfTile<Context>(registry: TileRegistry<Context>, type: string): TileLimits | undefined;
@@ -2200,20 +2254,15 @@ export declare interface NoteProps extends NoteAlertProps, StylesApiProps<NoteFa
2200
2254
  export declare type NoteStylesNames = "root" | "title" | "icon" | "label";
2201
2255
 
2202
2256
  /**
2203
- * Obsidian — the purple-tinted neutral used for every surface.
2257
+ * Obsidian — the purple-tinted neutral for text, lines and interactive fills.
2204
2258
  *
2205
- * Never use Obsidian for text; text roles live on {@link SLATE}.
2206
- * Anchors come from the brand toolkit: `#F9FAFE` light surface, `#DADFE7`, and
2207
- * three dark steps: `#242132` paper, `#191723` page and `#0C0C12`, which is
2208
- * reserved for code.
2259
+ * Text, hairlines, the neutral action fill and the tracks of selection
2260
+ * controls read Obsidian. Surfaces never do: they live on {@link GRAPHITE}, so a
2261
+ * page stays a quiet grey while what sits on it carries the brand's tint.
2209
2262
  *
2210
- * The toolkit stops there, and the raised step above the paper has no slot of
2211
- * its own: a Mantine tuple holds ten shades and the dark end needs five. It is
2212
- * derived where it is used, lifting shade 7 by the OKLCH step the page takes to
2213
- * reach it.
2214
- *
2215
- * The two halves do not overlap. Light roles read shades 0 to 4, dark roles read
2216
- * 5 to 9, and shade 5 is the one both schemes share, for disabled text.
2263
+ * Every shade is taken from the brand toolkit: `#F1F1F6` light, `#B0AEC6`
2264
+ * bright, `#8986A2` text, `#706D8F` light, `#4A4761` mid, `#242132` and
2265
+ * `#0F0D19` dark.
2217
2266
  */
2218
2267
  export declare const OBSIDIAN: MantineColorsTuple;
2219
2268
 
@@ -3423,11 +3472,11 @@ export declare interface SlashStore {
3423
3472
  }
3424
3473
 
3425
3474
  /**
3426
- * Slate — the blue-tinted neutral used for every text role.
3475
+ * Slate — the blue-tinted neutral that painted text before 3.0.
3427
3476
  *
3428
- * Never use Slate for surfaces. Shades are picked so that the text roles land
3429
- * on values proven by the marketing site, and every role clears WCAG AA on both
3430
- * the light and dark canvas.
3477
+ * Kept for compatibility: it stays registered so a consumer reading `slate` or
3478
+ * `--mantine-color-slate-*` keeps its colour. The kit's own roles no longer use
3479
+ * it, since text moved to {@link OBSIDIAN}; new work should read the text tokens.
3431
3480
  */
3432
3481
  export declare const SLATE: MantineColorsTuple;
3433
3482
 
@@ -3570,7 +3619,7 @@ export declare interface StackerSettings {
3570
3619
  variant?: StackerKind;
3571
3620
  /** Edge the drawer is anchored to. Ignored for modals. @default "right" */
3572
3621
  side?: StackerSide;
3573
- /** Allow dragging the drawer towards its edge to dismiss it. Ignored for modals. @default false */
3622
+ /** Allow dragging the drawer towards its edge to dismiss it, on touch screens only. Ignored for modals. @default false */
3574
3623
  draggable?: boolean;
3575
3624
  /** Content area size — modal width or drawer extent. Defaults: modal `"lg"`, drawer `"md"`. */
3576
3625
  size?: MantineSize | (string & {}) | number;
@@ -3640,26 +3689,26 @@ export declare type StatusIconStylesNames = "root" | "icon";
3640
3689
  export declare type StatusVariant = "success" | "warning" | "error" | "neutral";
3641
3690
 
3642
3691
  /**
3643
- * A vertical timeline whose steps expand one at a time. Each step shows a
3644
- * numbered bullet and a clickable title; activating a step collapses the others
3645
- * and reveals its content, with an optional button to advance to the next step.
3692
+ * A vertical list of steps that expand one at a time. Each step has a two-digit
3693
+ * number on a rail, joined to the next by a hairline, and a clickable title;
3694
+ * activating a step reveals its content, with an optional button to advance.
3646
3695
  */
3647
3696
  export declare const StepperTimeline: MantineComponent<StepperTimelineFactory>;
3648
3697
 
3649
3698
  export declare type StepperTimelineFactory = Factory<{
3650
3699
  props: StepperTimelineProps;
3651
- ref: HTMLDivElement;
3700
+ ref: HTMLOListElement;
3652
3701
  stylesNames: StepperTimelineStylesNames;
3653
3702
  }>;
3654
3703
 
3655
3704
  export declare interface StepperTimelineItem {
3656
- /** Heading shown next to the bullet — clicking it activates the step. */
3705
+ /** Heading shown beside the step number; clicking it activates the step. */
3657
3706
  title: ReactNode;
3658
3707
  /** Body revealed when the step is active. */
3659
3708
  content: ReactNode;
3660
3709
  }
3661
3710
 
3662
- export declare interface StepperTimelineProps extends Omit<TimelineProps, "active" | "children" | "attributes" | "classNames" | "styles" | "unstyled" | "variant" | "vars">, StylesApiProps<StepperTimelineFactory> {
3711
+ export declare interface StepperTimelineProps extends BoxProps, StylesApiProps<StepperTimelineFactory>, ElementProps<"ol"> {
3663
3712
  /** Ordered list of steps to render. */
3664
3713
  items: StepperTimelineItem[];
3665
3714
  /** Index of the active (expanded) step in controlled mode. */
@@ -3674,7 +3723,7 @@ export declare interface StepperTimelineProps extends Omit<TimelineProps, "activ
3674
3723
  hideContinue?: boolean;
3675
3724
  }
3676
3725
 
3677
- export declare type StepperTimelineStylesNames = "root" | "item" | "bullet" | "title" | "content" | "continue";
3726
+ export declare type StepperTimelineStylesNames = "root" | "item" | "rail" | "bullet" | "line" | "body" | "title" | "content" | "continue";
3678
3727
 
3679
3728
  /**
3680
3729
  * Suggest completions at the start of each line
@@ -3686,18 +3735,41 @@ export declare const SURREAL_CDN_BASE = "https://cdn.surrealdb.com";
3686
3735
  /** Every palette the UI Kit adds on top of Mantine's defaults. */
3687
3736
  export declare const SURREAL_COLORS: Record<SurrealColor, MantineColorsTuple>;
3688
3737
 
3738
+ /**
3739
+ * The kit's layer transitions, as Mantine transitions: pass one as
3740
+ * `transitionProps={{ transition: SURREAL_TRANSITIONS.modal }}`, with
3741
+ * {@link EASE_BACK} for a modal, {@link EASE_BACK_SUBTLE} for a drawer and
3742
+ * {@link EASE_OUT} for the rest.
3743
+ *
3744
+ * - `modal` fades and scales in about its centre.
3745
+ * - `drawer` slides in from wholly off the edge it opens from, with no fade or
3746
+ * scale. The kit's `Drawer` sets the side from its `position`; elsewhere use
3747
+ * {@link drawerTransition} with the side.
3748
+ * - `floating` - menus, popovers, hover cards, dropdowns and tooltips - fades and
3749
+ * scales in from the side facing what opened it. The origin is read from
3750
+ * `--surreal-floating-origin`, which the kit's dropdown styles set from the
3751
+ * dropdown's placement.
3752
+ */
3753
+ export declare const SURREAL_TRANSITIONS: {
3754
+ modal: MantineTransition;
3755
+ drawer: MantineTransition;
3756
+ floating: MantineTransition;
3757
+ };
3758
+
3689
3759
  /** The name of every palette the UI Kit adds on top of Mantine's defaults. */
3690
- export declare type SurrealColor = "pink" | "lilac" | "purple" | "violet" | "obsidian" | "slate";
3760
+ export declare type SurrealColor = "pink" | "lilac" | "purple" | "violet" | "obsidian" | "graphite" | "accent" | "slate";
3691
3761
 
3692
3762
  /**
3693
3763
  * The UI Kit's CSS variables resolver.
3694
3764
  *
3695
- * It does two things Mantine cannot do on its own:
3765
+ * It does three things Mantine cannot do on its own:
3696
3766
  *
3697
3767
  * 1. Rewrites every scheme-dependent Mantine variable as a `light-dark()`
3698
3768
  * expression so that scheme islands work (ADR 0001).
3699
3769
  * 2. Emits the brand foreground tokens, switching Lilac and Pink to a black
3700
3770
  * foreground when `theme.other.contrastMode` is enabled (ADR 0003).
3771
+ * 3. Maps Mantine's stock `gray` and `dark` shades onto the kit's roles, so no
3772
+ * component falls back to a grey the kit does not use.
3701
3773
  */
3702
3774
  export declare const surrealCssVariablesResolver: CSSVariablesResolver;
3703
3775
 
@@ -3729,8 +3801,8 @@ export declare type SurrealProduct = "database" | "memory";
3729
3801
  *
3730
3802
  * Two departures from Mantine's default:
3731
3803
  *
3732
- * 1. A control that did not ask for a color follows the surrounding product
3733
- * accent, so a region stamped for Agent Memory turns violet without a prop.
3804
+ * 1. A control that did not ask for a color is neutral: the primary action is
3805
+ * the `--surreal-action` fill, never a brand hue.
3734
3806
  * 2. Brand fills keep a white foreground, including where Mantine's luminance
3735
3807
  * check would pick black. The foreground comes from a token so that
3736
3808
  * `other.contrastMode` can flip it where black genuinely measures better.
@@ -3890,6 +3962,12 @@ export declare interface TileChromeValue {
3890
3962
  menu: (label: string) => ReactNode;
3891
3963
  }
3892
3964
 
3965
+ /** A column of a tile's list beside the name. Optional ones give way first as the tile narrows. */
3966
+ export declare interface TileColumn {
3967
+ label: string;
3968
+ isOptional?: boolean;
3969
+ }
3970
+
3893
3971
  export declare interface TileConfiguratorProps<Config, Context> {
3894
3972
  context: Context;
3895
3973
  /** Finishes adding the tile with the settings chosen. */
@@ -4020,7 +4098,7 @@ export declare interface TileLimits {
4020
4098
  * width allows, filling each column top to bottom, and the tile's footer leads
4021
4099
  * to the rest. A scrollable list shows them all instead, row by row.
4022
4100
  */
4023
- export declare function TileList<T>({ items, rowHeight, columnWidth, maxColumns, isPending, isScrollable, empty, renderItem, itemKey, }: TileListProps<T>): ReactNode;
4101
+ export declare function TileList<T>({ items, rowHeight, columnWidth, maxColumns, isPending, isScrollable, empty, columns: tableColumns, nameLabel, renderItem, itemKey, }: TileListProps<T>): ReactNode;
4024
4102
 
4025
4103
  export declare interface TileListProps<T> {
4026
4104
  items: readonly T[];
@@ -4033,6 +4111,13 @@ export declare interface TileListProps<T> {
4033
4111
  isScrollable?: boolean;
4034
4112
  /** Shown in place of the list while there is nothing in it. */
4035
4113
  empty: ReactNode;
4114
+ /**
4115
+ * Lays the list out as a table: a head naming each column above a single
4116
+ * column of rows, whose `TileRow`s pass their values as `cells`.
4117
+ */
4118
+ columns?: readonly TileColumn[];
4119
+ /** Heads the name column of a list with `columns`. */
4120
+ nameLabel?: string;
4036
4121
  renderItem: (item: T) => ReactNode;
4037
4122
  itemKey: (item: T) => string;
4038
4123
  }
@@ -4095,6 +4180,11 @@ export declare interface TileRowProps {
4095
4180
  trailing?: string;
4096
4181
  /** The trailing marker of a row that leads somewhere. Defaults to a chevron. */
4097
4182
  marker?: string | null;
4183
+ /**
4184
+ * The row's value in each of its list's `columns`, in order. Lines up under
4185
+ * the list's head; cells of columns that gave way are left out.
4186
+ */
4187
+ cells?: readonly ReactNode[];
4098
4188
  isDimmed?: boolean;
4099
4189
  onClick?: () => void;
4100
4190
  }
@@ -4219,6 +4309,16 @@ export declare interface TileValue extends TileRect {
4219
4309
  /** The top-most open item, or undefined when nothing is open. */
4220
4310
  export declare function topOpened(items: StackerItem[]): StackerItem | undefined;
4221
4311
 
4312
+ /** How long the kit's layer transitions take, in milliseconds. */
4313
+ export declare const TRANSITION_DURATION: {
4314
+ readonly overlay: 220;
4315
+ readonly drawer: 280;
4316
+ readonly floating: 150;
4317
+ };
4318
+
4319
+ /** The side a drawer opens from. */
4320
+ export declare type TransitionSide = "left" | "right" | "top" | "bottom";
4321
+
4222
4322
  /** Trim `{#id}` from the end of a heading source range (returns new exclusive `titleTo`). */
4223
4323
  export declare function trimCustomHeadingIdFromRange(source: {
4224
4324
  slice(from: number, to: number): string;
@@ -4451,7 +4551,7 @@ declare module "@mantine/core" {
4451
4551
  }
4452
4552
 
4453
4553
  declare module "@mantine/core" {
4454
- type ExtendedCustomColors = "pink" | "lilac" | "purple" | "violet" | "obsidian" | "slate" | import("@mantine/core").DefaultMantineColor;
4554
+ type ExtendedCustomColors = "pink" | "lilac" | "purple" | "violet" | "obsidian" | "graphite" | "accent" | "slate" | import("@mantine/core").DefaultMantineColor;
4455
4555
  interface MantineThemeColorsOverride {
4456
4556
  colors: Record<ExtendedCustomColors, import("@mantine/core").MantineColorsTuple>;
4457
4557
  }
@@ -4461,6 +4561,6 @@ declare module "@mantine/core" {
4461
4561
  type ExtendedCustomSizes = import("@mantine/core").DefaultMantineSize | "2xl" | "3xl" | "4xl" | "5xl";
4462
4562
  interface MantineThemeSizesOverride {
4463
4563
  spacing: Record<ExtendedCustomSizes, string>;
4464
- fontSizes: Record<ExtendedCustomSizes, string>;
4564
+ fontSizes: Record<ExtendedCustomSizes | "2xs", string>;
4465
4565
  }
4466
4566
  }