@surrealdb/ui 2.2.0 → 3.0.0-beta.1

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: `#0B0A10` 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;
@@ -1521,6 +1571,8 @@ export declare const iconSidekick: string;
1521
1571
 
1522
1572
  export declare const iconSpectron: string;
1523
1573
 
1574
+ export declare const iconSplit: string;
1575
+
1524
1576
  export declare const iconStar: string;
1525
1577
 
1526
1578
  export declare const iconStarPlus: string;
@@ -1630,7 +1682,7 @@ declare type Language = "csharp" | "rust" | "javascript" | "typescript" | "surre
1630
1682
  */
1631
1683
  export declare function layoutTiles<Context>(registry: TileRegistry<Context>, specs: readonly TileSpec[], columns?: number): TileValue[];
1632
1684
 
1633
- /** Surreal Lilac — the primary action color, and the Database product color. */
1685
+ /** Surreal Lilac — the Database product color, and the default accent. */
1634
1686
  export declare const LILAC: MantineColorsTuple;
1635
1687
 
1636
1688
  export declare function limitsOfTile<Context>(registry: TileRegistry<Context>, type: string): TileLimits | undefined;
@@ -2200,20 +2252,15 @@ export declare interface NoteProps extends NoteAlertProps, StylesApiProps<NoteFa
2200
2252
  export declare type NoteStylesNames = "root" | "title" | "icon" | "label";
2201
2253
 
2202
2254
  /**
2203
- * Obsidian — the purple-tinted neutral used for every surface.
2204
- *
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.
2255
+ * Obsidian — the purple-tinted neutral for text, lines and interactive fills.
2209
2256
  *
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.
2257
+ * Text, hairlines, the neutral action fill and the tracks of selection
2258
+ * controls read Obsidian. Surfaces never do: they live on {@link GRAPHITE}, so a
2259
+ * page stays a quiet grey while what sits on it carries the brand's tint.
2214
2260
  *
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.
2261
+ * Every shade is taken from the brand toolkit: `#F1F1F6` light, `#B0AEC6`
2262
+ * bright, `#8986A2` text, `#706D8F` light, `#4A4761` mid, `#242132` and
2263
+ * `#0F0D19` dark.
2217
2264
  */
2218
2265
  export declare const OBSIDIAN: MantineColorsTuple;
2219
2266
 
@@ -3423,11 +3470,11 @@ export declare interface SlashStore {
3423
3470
  }
3424
3471
 
3425
3472
  /**
3426
- * Slate — the blue-tinted neutral used for every text role.
3473
+ * Slate — the blue-tinted neutral that painted text before 3.0.
3427
3474
  *
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.
3475
+ * Kept for compatibility: it stays registered so a consumer reading `slate` or
3476
+ * `--mantine-color-slate-*` keeps its colour. The kit's own roles no longer use
3477
+ * it, since text moved to {@link OBSIDIAN}; new work should read the text tokens.
3431
3478
  */
3432
3479
  export declare const SLATE: MantineColorsTuple;
3433
3480
 
@@ -3570,7 +3617,7 @@ export declare interface StackerSettings {
3570
3617
  variant?: StackerKind;
3571
3618
  /** Edge the drawer is anchored to. Ignored for modals. @default "right" */
3572
3619
  side?: StackerSide;
3573
- /** Allow dragging the drawer towards its edge to dismiss it. Ignored for modals. @default false */
3620
+ /** Allow dragging the drawer towards its edge to dismiss it, on touch screens only. Ignored for modals. @default false */
3574
3621
  draggable?: boolean;
3575
3622
  /** Content area size — modal width or drawer extent. Defaults: modal `"lg"`, drawer `"md"`. */
3576
3623
  size?: MantineSize | (string & {}) | number;
@@ -3640,26 +3687,26 @@ export declare type StatusIconStylesNames = "root" | "icon";
3640
3687
  export declare type StatusVariant = "success" | "warning" | "error" | "neutral";
3641
3688
 
3642
3689
  /**
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.
3690
+ * A vertical list of steps that expand one at a time. Each step has a two-digit
3691
+ * number on a rail, joined to the next by a hairline, and a clickable title;
3692
+ * activating a step reveals its content, with an optional button to advance.
3646
3693
  */
3647
3694
  export declare const StepperTimeline: MantineComponent<StepperTimelineFactory>;
3648
3695
 
3649
3696
  export declare type StepperTimelineFactory = Factory<{
3650
3697
  props: StepperTimelineProps;
3651
- ref: HTMLDivElement;
3698
+ ref: HTMLOListElement;
3652
3699
  stylesNames: StepperTimelineStylesNames;
3653
3700
  }>;
3654
3701
 
3655
3702
  export declare interface StepperTimelineItem {
3656
- /** Heading shown next to the bullet — clicking it activates the step. */
3703
+ /** Heading shown beside the step number; clicking it activates the step. */
3657
3704
  title: ReactNode;
3658
3705
  /** Body revealed when the step is active. */
3659
3706
  content: ReactNode;
3660
3707
  }
3661
3708
 
3662
- export declare interface StepperTimelineProps extends Omit<TimelineProps, "active" | "children" | "attributes" | "classNames" | "styles" | "unstyled" | "variant" | "vars">, StylesApiProps<StepperTimelineFactory> {
3709
+ export declare interface StepperTimelineProps extends BoxProps, StylesApiProps<StepperTimelineFactory>, ElementProps<"ol"> {
3663
3710
  /** Ordered list of steps to render. */
3664
3711
  items: StepperTimelineItem[];
3665
3712
  /** Index of the active (expanded) step in controlled mode. */
@@ -3674,7 +3721,7 @@ export declare interface StepperTimelineProps extends Omit<TimelineProps, "activ
3674
3721
  hideContinue?: boolean;
3675
3722
  }
3676
3723
 
3677
- export declare type StepperTimelineStylesNames = "root" | "item" | "bullet" | "title" | "content" | "continue";
3724
+ export declare type StepperTimelineStylesNames = "root" | "item" | "rail" | "bullet" | "line" | "body" | "title" | "content" | "continue";
3678
3725
 
3679
3726
  /**
3680
3727
  * Suggest completions at the start of each line
@@ -3686,18 +3733,41 @@ export declare const SURREAL_CDN_BASE = "https://cdn.surrealdb.com";
3686
3733
  /** Every palette the UI Kit adds on top of Mantine's defaults. */
3687
3734
  export declare const SURREAL_COLORS: Record<SurrealColor, MantineColorsTuple>;
3688
3735
 
3736
+ /**
3737
+ * The kit's layer transitions, as Mantine transitions: pass one as
3738
+ * `transitionProps={{ transition: SURREAL_TRANSITIONS.modal }}`, with
3739
+ * {@link EASE_BACK} for a modal, {@link EASE_BACK_SUBTLE} for a drawer and
3740
+ * {@link EASE_OUT} for the rest.
3741
+ *
3742
+ * - `modal` fades and scales in about its centre.
3743
+ * - `drawer` slides in from wholly off the edge it opens from, with no fade or
3744
+ * scale. The kit's `Drawer` sets the side from its `position`; elsewhere use
3745
+ * {@link drawerTransition} with the side.
3746
+ * - `floating` - menus, popovers, hover cards, dropdowns and tooltips - fades and
3747
+ * scales in from the side facing what opened it. The origin is read from
3748
+ * `--surreal-floating-origin`, which the kit's dropdown styles set from the
3749
+ * dropdown's placement.
3750
+ */
3751
+ export declare const SURREAL_TRANSITIONS: {
3752
+ modal: MantineTransition;
3753
+ drawer: MantineTransition;
3754
+ floating: MantineTransition;
3755
+ };
3756
+
3689
3757
  /** 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";
3758
+ export declare type SurrealColor = "pink" | "lilac" | "purple" | "violet" | "obsidian" | "graphite" | "accent" | "slate";
3691
3759
 
3692
3760
  /**
3693
3761
  * The UI Kit's CSS variables resolver.
3694
3762
  *
3695
- * It does two things Mantine cannot do on its own:
3763
+ * It does three things Mantine cannot do on its own:
3696
3764
  *
3697
3765
  * 1. Rewrites every scheme-dependent Mantine variable as a `light-dark()`
3698
3766
  * expression so that scheme islands work (ADR 0001).
3699
3767
  * 2. Emits the brand foreground tokens, switching Lilac and Pink to a black
3700
3768
  * foreground when `theme.other.contrastMode` is enabled (ADR 0003).
3769
+ * 3. Maps Mantine's stock `gray` and `dark` shades onto the kit's roles, so no
3770
+ * component falls back to a grey the kit does not use.
3701
3771
  */
3702
3772
  export declare const surrealCssVariablesResolver: CSSVariablesResolver;
3703
3773
 
@@ -3729,8 +3799,8 @@ export declare type SurrealProduct = "database" | "memory";
3729
3799
  *
3730
3800
  * Two departures from Mantine's default:
3731
3801
  *
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.
3802
+ * 1. A control that did not ask for a color is neutral: the primary action is
3803
+ * the `--surreal-action` fill, never a brand hue.
3734
3804
  * 2. Brand fills keep a white foreground, including where Mantine's luminance
3735
3805
  * check would pick black. The foreground comes from a token so that
3736
3806
  * `other.contrastMode` can flip it where black genuinely measures better.
@@ -3890,6 +3960,12 @@ export declare interface TileChromeValue {
3890
3960
  menu: (label: string) => ReactNode;
3891
3961
  }
3892
3962
 
3963
+ /** A column of a tile's list beside the name. Optional ones give way first as the tile narrows. */
3964
+ export declare interface TileColumn {
3965
+ label: string;
3966
+ isOptional?: boolean;
3967
+ }
3968
+
3893
3969
  export declare interface TileConfiguratorProps<Config, Context> {
3894
3970
  context: Context;
3895
3971
  /** Finishes adding the tile with the settings chosen. */
@@ -4020,7 +4096,7 @@ export declare interface TileLimits {
4020
4096
  * width allows, filling each column top to bottom, and the tile's footer leads
4021
4097
  * to the rest. A scrollable list shows them all instead, row by row.
4022
4098
  */
4023
- export declare function TileList<T>({ items, rowHeight, columnWidth, maxColumns, isPending, isScrollable, empty, renderItem, itemKey, }: TileListProps<T>): ReactNode;
4099
+ export declare function TileList<T>({ items, rowHeight, columnWidth, maxColumns, isPending, isScrollable, empty, columns: tableColumns, nameLabel, renderItem, itemKey, }: TileListProps<T>): ReactNode;
4024
4100
 
4025
4101
  export declare interface TileListProps<T> {
4026
4102
  items: readonly T[];
@@ -4033,6 +4109,13 @@ export declare interface TileListProps<T> {
4033
4109
  isScrollable?: boolean;
4034
4110
  /** Shown in place of the list while there is nothing in it. */
4035
4111
  empty: ReactNode;
4112
+ /**
4113
+ * Lays the list out as a table: a head naming each column above a single
4114
+ * column of rows, whose `TileRow`s pass their values as `cells`.
4115
+ */
4116
+ columns?: readonly TileColumn[];
4117
+ /** Heads the name column of a list with `columns`. */
4118
+ nameLabel?: string;
4036
4119
  renderItem: (item: T) => ReactNode;
4037
4120
  itemKey: (item: T) => string;
4038
4121
  }
@@ -4095,6 +4178,11 @@ export declare interface TileRowProps {
4095
4178
  trailing?: string;
4096
4179
  /** The trailing marker of a row that leads somewhere. Defaults to a chevron. */
4097
4180
  marker?: string | null;
4181
+ /**
4182
+ * The row's value in each of its list's `columns`, in order. Lines up under
4183
+ * the list's head; cells of columns that gave way are left out.
4184
+ */
4185
+ cells?: readonly ReactNode[];
4098
4186
  isDimmed?: boolean;
4099
4187
  onClick?: () => void;
4100
4188
  }
@@ -4219,6 +4307,16 @@ export declare interface TileValue extends TileRect {
4219
4307
  /** The top-most open item, or undefined when nothing is open. */
4220
4308
  export declare function topOpened(items: StackerItem[]): StackerItem | undefined;
4221
4309
 
4310
+ /** How long the kit's layer transitions take, in milliseconds. */
4311
+ export declare const TRANSITION_DURATION: {
4312
+ readonly overlay: 220;
4313
+ readonly drawer: 280;
4314
+ readonly floating: 150;
4315
+ };
4316
+
4317
+ /** The side a drawer opens from. */
4318
+ export declare type TransitionSide = "left" | "right" | "top" | "bottom";
4319
+
4222
4320
  /** Trim `{#id}` from the end of a heading source range (returns new exclusive `titleTo`). */
4223
4321
  export declare function trimCustomHeadingIdFromRange(source: {
4224
4322
  slice(from: number, to: number): string;
@@ -4451,7 +4549,7 @@ declare module "@mantine/core" {
4451
4549
  }
4452
4550
 
4453
4551
  declare module "@mantine/core" {
4454
- type ExtendedCustomColors = "pink" | "lilac" | "purple" | "violet" | "obsidian" | "slate" | import("@mantine/core").DefaultMantineColor;
4552
+ type ExtendedCustomColors = "pink" | "lilac" | "purple" | "violet" | "obsidian" | "graphite" | "accent" | "slate" | import("@mantine/core").DefaultMantineColor;
4455
4553
  interface MantineThemeColorsOverride {
4456
4554
  colors: Record<ExtendedCustomColors, import("@mantine/core").MantineColorsTuple>;
4457
4555
  }