@gradeui/ui 1.0.0 → 1.2.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/components/ui/banner.md +146 -0
- package/components/ui/card.md +170 -15
- package/components/ui/code.md +133 -0
- package/components/ui/composer.md +226 -0
- package/components/ui/dialog.md +106 -13
- package/components/ui/dropdown-menu.md +93 -4
- package/components/ui/hover-card.md +98 -4
- package/components/ui/message.md +229 -0
- package/components/ui/popover.md +119 -7
- package/components/ui/section-block.md +153 -0
- package/components/ui/sheet.md +98 -6
- package/dist/contracts.js +48 -4
- package/dist/contracts.js.map +1 -1
- package/dist/contracts.mjs +48 -4
- package/dist/contracts.mjs.map +1 -1
- package/dist/index.d.mts +1027 -29
- package/dist/index.d.ts +1027 -29
- package/dist/index.js +102 -49
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +102 -49
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +15 -1
package/dist/index.d.mts
CHANGED
|
@@ -9,6 +9,8 @@ import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
|
9
9
|
import { DayPicker, DayButton, DateRange } from 'react-day-picker';
|
|
10
10
|
import { UseEmblaCarouselType } from 'embla-carousel-react';
|
|
11
11
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
12
|
+
import { Language } from 'prism-react-renderer';
|
|
13
|
+
import { LexicalEditor } from 'lexical';
|
|
12
14
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
13
15
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
14
16
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
@@ -172,14 +174,14 @@ declare const MediaSurfaceContract: _gradeui_contracts.ComponentContract<{
|
|
|
172
174
|
description: z.ZodOptional<z.ZodString>;
|
|
173
175
|
}, "strip", z.ZodTypeAny, {
|
|
174
176
|
kind: "book";
|
|
175
|
-
description?: string | undefined;
|
|
176
177
|
title?: string | undefined;
|
|
178
|
+
description?: string | undefined;
|
|
177
179
|
author?: string | undefined;
|
|
178
180
|
isbn?: string | undefined;
|
|
179
181
|
}, {
|
|
180
182
|
kind: "book";
|
|
181
|
-
description?: string | undefined;
|
|
182
183
|
title?: string | undefined;
|
|
184
|
+
description?: string | undefined;
|
|
183
185
|
author?: string | undefined;
|
|
184
186
|
isbn?: string | undefined;
|
|
185
187
|
}>, z.ZodObject<{
|
|
@@ -249,11 +251,11 @@ declare const MediaSurfaceContract: _gradeui_contracts.ComponentContract<{
|
|
|
249
251
|
kind: z.ZodLiteral<"generic">;
|
|
250
252
|
prompt: z.ZodString;
|
|
251
253
|
}, "strip", z.ZodTypeAny, {
|
|
252
|
-
kind: "generic";
|
|
253
254
|
prompt: string;
|
|
254
|
-
}, {
|
|
255
255
|
kind: "generic";
|
|
256
|
+
}, {
|
|
256
257
|
prompt: string;
|
|
258
|
+
kind: "generic";
|
|
257
259
|
}>, z.ZodUnion<[z.ZodObject<{
|
|
258
260
|
kind: z.ZodLiteral<"video">;
|
|
259
261
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -379,10 +381,10 @@ declare const AccordionContent: React$1.ForwardRefExoticComponent<Omit<Accordion
|
|
|
379
381
|
* `variant="warning"` or `variant="info"` depending on temperature.
|
|
380
382
|
*/
|
|
381
383
|
declare const calloutVariants: (props?: ({
|
|
382
|
-
variant?: "default" | "
|
|
384
|
+
variant?: "default" | "info" | "success" | "warning" | "destructive" | null | undefined;
|
|
383
385
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
384
386
|
declare const Callout: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
|
|
385
|
-
variant?: "default" | "
|
|
387
|
+
variant?: "default" | "info" | "success" | "warning" | "destructive" | null | undefined;
|
|
386
388
|
} & class_variance_authority_types.ClassProp) | undefined) => string> & React$1.RefAttributes<HTMLDivElement>>;
|
|
387
389
|
declare const CalloutTitle: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLHeadingElement> & React$1.RefAttributes<HTMLParagraphElement>>;
|
|
388
390
|
declare const CalloutDescription: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLParagraphElement> & React$1.RefAttributes<HTMLParagraphElement>>;
|
|
@@ -465,18 +467,142 @@ interface AppShellFooterProps extends React$1.HTMLAttributes<HTMLElement>, Varia
|
|
|
465
467
|
}
|
|
466
468
|
declare const AppShellFooter: React$1.ForwardRefExoticComponent<AppShellFooterProps & React$1.RefAttributes<HTMLElement>>;
|
|
467
469
|
|
|
468
|
-
|
|
470
|
+
/**
|
|
471
|
+
* Avatar — circular user/entity glyph. Wraps Radix's avatar primitive
|
|
472
|
+
* with two ergonomic additions over the base shadcn shape:
|
|
473
|
+
*
|
|
474
|
+
* size — t-shirt scale (xs / sm / md / lg / xl) so consumers pick a
|
|
475
|
+
* token instead of writing `h-7 w-7` every time. Defaults
|
|
476
|
+
* to md (40px) to preserve previous behaviour.
|
|
477
|
+
*
|
|
478
|
+
* tone — on AvatarFallback only. Picks a tinted bg/text colour
|
|
479
|
+
* pair (violet / amber / emerald / sky / rose / plum / lime /
|
|
480
|
+
* primary / muted). Default `muted` matches the previous
|
|
481
|
+
* `bg-muted` behaviour. Reach for explicit tones when each
|
|
482
|
+
* author needs a stable colour mapping (chat avatars, comment
|
|
483
|
+
* threads, member lists).
|
|
484
|
+
*
|
|
485
|
+
* Both additions are backwards compatible — code that passed className
|
|
486
|
+
* directly still works and overrides the variant defaults.
|
|
487
|
+
*/
|
|
488
|
+
declare const avatarSizes: (props?: ({
|
|
489
|
+
size?: "sm" | "md" | "lg" | "xs" | "xl" | null | undefined;
|
|
490
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
491
|
+
interface AvatarProps extends React$1.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>, VariantProps<typeof avatarSizes> {
|
|
492
|
+
}
|
|
493
|
+
declare const Avatar: React$1.ForwardRefExoticComponent<AvatarProps & React$1.RefAttributes<HTMLSpanElement>>;
|
|
469
494
|
declare const AvatarImage: React$1.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarImageProps & React$1.RefAttributes<HTMLImageElement>, "ref"> & React$1.RefAttributes<HTMLImageElement>>;
|
|
470
|
-
declare const
|
|
495
|
+
declare const avatarFallbackTones: (props?: ({
|
|
496
|
+
tone?: "muted" | "primary" | "violet" | "amber" | "emerald" | "sky" | "rose" | "plum" | "lime" | null | undefined;
|
|
497
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
498
|
+
interface AvatarFallbackProps extends React$1.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>, VariantProps<typeof avatarFallbackTones> {
|
|
499
|
+
}
|
|
500
|
+
declare const AvatarFallback: React$1.ForwardRefExoticComponent<AvatarFallbackProps & React$1.RefAttributes<HTMLSpanElement>>;
|
|
471
501
|
|
|
472
502
|
declare const badgeVariants: (props?: ({
|
|
473
|
-
variant?: "default" | "
|
|
503
|
+
variant?: "default" | "info" | "success" | "warning" | "destructive" | "outline" | "secondary" | "highlight" | "success-soft" | "warning-soft" | "destructive-soft" | "info-soft" | "highlight-soft" | "success-outline" | "warning-outline" | "destructive-outline" | "info-outline" | null | undefined;
|
|
474
504
|
rounded?: "default" | "full" | null | undefined;
|
|
475
505
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
476
506
|
interface BadgeProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
477
507
|
}
|
|
478
508
|
declare function Badge({ className, variant, rounded, ...props }: BadgeProps): React$1.JSX.Element;
|
|
479
509
|
|
|
510
|
+
/**
|
|
511
|
+
* Surface — what a container is *made of*.
|
|
512
|
+
*
|
|
513
|
+
* Shared across every component that surfaces content (Card, Dialog,
|
|
514
|
+
* Sheet, Popover, DropdownMenu, HoverCard, SectionBlock). Picking the
|
|
515
|
+
* material is a first-class prop axis on each of those components,
|
|
516
|
+
* orthogonal to elevation (how high) and aura (what it radiates) — see
|
|
517
|
+
* gradeui/PRESENCE.md for the three-axis model.
|
|
518
|
+
*
|
|
519
|
+
* Putting this on the prop API instead of leaving it as a className
|
|
520
|
+
* escape-hatch buys three things:
|
|
521
|
+
*
|
|
522
|
+
* 1. Studio's inspector surfaces a `surface` knob on every container
|
|
523
|
+
* so users can flip the material without touching code.
|
|
524
|
+
* 2. The model has a first-class vocabulary to pick from — without
|
|
525
|
+
* this it reaches for `bg-card/40 backdrop-blur-md` Tailwind soup
|
|
526
|
+
* and loses the edge highlight + theme-aware blur tuning.
|
|
527
|
+
* 3. Themes can retune `--surface-blur-*` / `--surface-alpha-*`
|
|
528
|
+
* centrally and every container moves with them.
|
|
529
|
+
*
|
|
530
|
+
* The CSS classes referenced here live in packages/ui/styles/globals.css
|
|
531
|
+
* (and the apps/docs mirror) under the SURFACE CLASSES section.
|
|
532
|
+
*/
|
|
533
|
+
type Surface = "solid" | "translucent" | "glass" | "glass-strong";
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* Banner — full-width horizontal strip surfacing system-level state or
|
|
537
|
+
* announcements that should stay visible until acknowledged.
|
|
538
|
+
*
|
|
539
|
+
* The shape is the difference from Callout:
|
|
540
|
+
*
|
|
541
|
+
* Callout = inline boxed message in the layout flow (rounded box,
|
|
542
|
+
* body-paragraph width, lives inside a Card/Section).
|
|
543
|
+
* Banner = full-bleed horizontal strip across a page / panel /
|
|
544
|
+
* AppShellHeader top. Single-line by default.
|
|
545
|
+
*
|
|
546
|
+
* Use cases that should be Banner, not Callout, not Dialog:
|
|
547
|
+
* - "You're previewing this from main — switch to your branch"
|
|
548
|
+
* - "We're investigating an incident affecting search"
|
|
549
|
+
* - "Send your design to Figma — get the Grade plugin"
|
|
550
|
+
* - "New: scaffold-playground tab"
|
|
551
|
+
*
|
|
552
|
+
* Three Presence axes apply: variant (intent colour), surface
|
|
553
|
+
* (material), shadow utilities for elevation. The default is
|
|
554
|
+
* `variant="default" surface="solid"`, which yields a calm announcement
|
|
555
|
+
* strip in the active theme. Status variants pick up the soft / deep
|
|
556
|
+
* token pairs (`--info-soft` + `--info-deep`, etc.), same pattern as
|
|
557
|
+
* Callout.
|
|
558
|
+
*
|
|
559
|
+
* AUTHORING ORIGIN: this primitive was extracted out of
|
|
560
|
+
* `apps/docs/components/studio/figma-intro-banner.tsx` after the user
|
|
561
|
+
* flagged that ad-hoc banner as invisible — it was reaching for
|
|
562
|
+
* `--gds-primary` / `--gds-border` / `--gds-foreground` tokens that
|
|
563
|
+
* don't exist (our tokens are unprefixed). The inline-style fallbacks
|
|
564
|
+
* kicked in and the chrome washed out completely. Banner exists so the
|
|
565
|
+
* "I need a one-line announcement strip" need lands in a primitive that
|
|
566
|
+
* cannot get the token names wrong.
|
|
567
|
+
*/
|
|
568
|
+
declare const bannerVariants: (props?: ({
|
|
569
|
+
variant?: "default" | "info" | "success" | "warning" | "destructive" | "announcement" | null | undefined;
|
|
570
|
+
align?: "center" | "start" | "between" | null | undefined;
|
|
571
|
+
sticky?: boolean | null | undefined;
|
|
572
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
573
|
+
interface BannerProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, "title">, VariantProps<typeof bannerVariants> {
|
|
574
|
+
/**
|
|
575
|
+
* Material the banner is *made of*. Defaults to `solid` (the
|
|
576
|
+
* variant's tinted bg). `glass` is useful when the banner sits over
|
|
577
|
+
* a hero image / generative backdrop and the imagery underneath
|
|
578
|
+
* should remain visible.
|
|
579
|
+
*/
|
|
580
|
+
surface?: Surface;
|
|
581
|
+
/**
|
|
582
|
+
* Show a close button at the trailing end. The button calls
|
|
583
|
+
* `onDismiss` if provided; otherwise the consumer controls
|
|
584
|
+
* visibility via standard React state on the parent.
|
|
585
|
+
*/
|
|
586
|
+
dismissible?: boolean;
|
|
587
|
+
/**
|
|
588
|
+
* Callback when the user clicks the trailing close button. Required
|
|
589
|
+
* when `dismissible` is set if you want the banner to actually
|
|
590
|
+
* disappear (the primitive itself stays controlled).
|
|
591
|
+
*/
|
|
592
|
+
onDismiss?: () => void;
|
|
593
|
+
/**
|
|
594
|
+
* Leading slot — typically a single Lucide icon. The status icon
|
|
595
|
+
* is NOT inferred from variant; pass the one that fits your message.
|
|
596
|
+
*/
|
|
597
|
+
icon?: React$1.ReactNode;
|
|
598
|
+
/**
|
|
599
|
+
* Optional trailing action — usually a Button or anchor. Sits to the
|
|
600
|
+
* left of the dismiss button.
|
|
601
|
+
*/
|
|
602
|
+
action?: React$1.ReactNode;
|
|
603
|
+
}
|
|
604
|
+
declare const Banner: React$1.ForwardRefExoticComponent<BannerProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
605
|
+
|
|
480
606
|
/**
|
|
481
607
|
* Button — primary action primitive.
|
|
482
608
|
*
|
|
@@ -497,8 +623,8 @@ declare function Badge({ className, variant, rounded, ...props }: BadgeProps): R
|
|
|
497
623
|
* consistent across primitives.
|
|
498
624
|
*/
|
|
499
625
|
declare const buttonVariants: (props?: ({
|
|
500
|
-
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "
|
|
501
|
-
size?: "default" | "
|
|
626
|
+
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | "raised" | null | undefined;
|
|
627
|
+
size?: "default" | "icon" | "sm" | "md" | "lg" | null | undefined;
|
|
502
628
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
503
629
|
interface ButtonProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
504
630
|
asChild?: boolean;
|
|
@@ -649,7 +775,22 @@ declare const Carousel: CarouselRootComponent;
|
|
|
649
775
|
|
|
650
776
|
declare function useCarouselApi(): EmblaApi | undefined;
|
|
651
777
|
|
|
652
|
-
|
|
778
|
+
interface CardProps extends React$1.HTMLAttributes<HTMLDivElement> {
|
|
779
|
+
/**
|
|
780
|
+
* What the card surface is *made of*. Composes with `shadow-elevation-*`
|
|
781
|
+
* (depth) and `gds-aura-*` (state signal) — see PRESENCE.md.
|
|
782
|
+
*
|
|
783
|
+
* - `solid` (default): opaque `bg-card`.
|
|
784
|
+
* - `translucent`: ~82% opacity, no blur. Menu sheets, popovers.
|
|
785
|
+
* - `glass`: ~58% opacity + 14px blur + edge highlight. Floating panels.
|
|
786
|
+
* - `glass-strong`: ~42% opacity + 24px blur. Full-page overlays.
|
|
787
|
+
*
|
|
788
|
+
* When `surface` is set to anything other than `solid`, the base
|
|
789
|
+
* `bg-card` is dropped so the glass alpha can pass through.
|
|
790
|
+
*/
|
|
791
|
+
surface?: Surface;
|
|
792
|
+
}
|
|
793
|
+
declare const Card: React$1.ForwardRefExoticComponent<CardProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
653
794
|
declare const CardHeader: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
654
795
|
declare const CardTitle: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
655
796
|
declare const CardDescription: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
@@ -658,6 +799,822 @@ declare const CardFooter: React$1.ForwardRefExoticComponent<React$1.HTMLAttribut
|
|
|
658
799
|
|
|
659
800
|
declare const Checkbox: React$1.ForwardRefExoticComponent<Omit<CheckboxPrimitive.CheckboxProps & React$1.RefAttributes<HTMLButtonElement>, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
660
801
|
|
|
802
|
+
/**
|
|
803
|
+
* Code — syntax-highlighted code surface with diff, line-emphasis, and
|
|
804
|
+
* reveal animation modes. Designed for marketing heroes ("diff hero"),
|
|
805
|
+
* docs blocks, and changelog entries.
|
|
806
|
+
*
|
|
807
|
+
* Engine choice: prism-react-renderer. Sync, ~6kb, render-prop API hands
|
|
808
|
+
* us `tokens` as data. Already in use in Studio's CodeView so the repo
|
|
809
|
+
* has one highlighter, not two. Async highlighters (shiki) would either
|
|
810
|
+
* flash unstyled on hydration or balloon the marketing bundle once you
|
|
811
|
+
* include enough langs to matter. See gradeui/STUDIO.md for the Studio
|
|
812
|
+
* variant.
|
|
813
|
+
*
|
|
814
|
+
* Theme is CSS-variable driven (`--gds-code-*`), so token palette
|
|
815
|
+
* inverts with the theme without us re-rendering a different prism
|
|
816
|
+
* theme. The prism `theme` prop just hands each token type a
|
|
817
|
+
* `color: var(--gds-code-<thing>)` so the cascade does the work.
|
|
818
|
+
*
|
|
819
|
+
* Animation strategy: motion (already a dep). `reveal="lines"` staggers
|
|
820
|
+
* each line in; `typewriter` reveals tokens one-at-a-time per line;
|
|
821
|
+
* `diff` plays the removed → added swap. The `trigger` prop selects
|
|
822
|
+
* what kicks it off — `inView` is the common case for scroll-driven
|
|
823
|
+
* marketing surfaces; `mount` fires immediately; `manual` reads `play`.
|
|
824
|
+
*/
|
|
825
|
+
type CodeLanguage = Language;
|
|
826
|
+
type CodeReveal = "none" | "lines" | "typewriter" | "diff";
|
|
827
|
+
type CodeTrigger = "mount" | "inView" | "manual";
|
|
828
|
+
type CodeSpeed = "slow" | "normal" | "fast";
|
|
829
|
+
type CodeSize = "xs" | "sm" | "md";
|
|
830
|
+
/**
|
|
831
|
+
* Step shape for scripted terminal / CLI sessions. Lives on `<Code>`
|
|
832
|
+
* itself rather than a sibling `CodeSequence` so the theme bridge,
|
|
833
|
+
* prompt prop, cursor, surface tokens, and prism highlighter aren't
|
|
834
|
+
* duplicated. When `steps` is provided, it overrides `source` + `reveal`
|
|
835
|
+
* and runs the machine below internally.
|
|
836
|
+
*
|
|
837
|
+
* - `type` — types text into the buffer as if a user were typing
|
|
838
|
+
* - `output` — appends text instantly as command output (no prompt,
|
|
839
|
+
* no per-char delay, often muted in render)
|
|
840
|
+
* - `wait` — pauses for `ms` milliseconds before the next step
|
|
841
|
+
* - `clear` — wipes the buffer (terminal `clear`)
|
|
842
|
+
*/
|
|
843
|
+
type CodeStep = {
|
|
844
|
+
type: "type";
|
|
845
|
+
text: string;
|
|
846
|
+
speed?: CodeSpeed;
|
|
847
|
+
} | {
|
|
848
|
+
type: "output";
|
|
849
|
+
text: string;
|
|
850
|
+
} | {
|
|
851
|
+
type: "wait";
|
|
852
|
+
ms: number;
|
|
853
|
+
} | {
|
|
854
|
+
type: "clear";
|
|
855
|
+
};
|
|
856
|
+
interface CodeDiff {
|
|
857
|
+
/** 1-indexed line numbers marked as added (green bg + `+` gutter). */
|
|
858
|
+
added?: number[];
|
|
859
|
+
/** 1-indexed line numbers marked as removed (red bg + `-` gutter). */
|
|
860
|
+
removed?: number[];
|
|
861
|
+
}
|
|
862
|
+
interface CodeProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
863
|
+
/**
|
|
864
|
+
* Source code to render. Optional when `steps` is provided — the
|
|
865
|
+
* scripted machine builds its own buffer and ignores `source`. When
|
|
866
|
+
* neither `source` nor `steps` is set, the block renders empty.
|
|
867
|
+
*/
|
|
868
|
+
source?: string;
|
|
869
|
+
/** Prism language id — `tsx` handles JSX too. Defaults to `tsx`. */
|
|
870
|
+
language?: CodeLanguage;
|
|
871
|
+
/**
|
|
872
|
+
* 1-indexed lines (or `[start, end]` ranges) to emphasise with the
|
|
873
|
+
* highlight background. Composes with `diff` — diff colours win.
|
|
874
|
+
*/
|
|
875
|
+
highlight?: number | number[] | Array<number | [number, number]>;
|
|
876
|
+
/** Diff mode — paints +added / -removed lines and renders a gutter. */
|
|
877
|
+
diff?: CodeDiff;
|
|
878
|
+
/** Reveal animation. Defaults to `none`. */
|
|
879
|
+
reveal?: CodeReveal;
|
|
880
|
+
/** What triggers the reveal. Defaults to `mount`. */
|
|
881
|
+
trigger?: CodeTrigger;
|
|
882
|
+
/** For `trigger="manual"` — set true to play. */
|
|
883
|
+
play?: boolean;
|
|
884
|
+
/**
|
|
885
|
+
* Animation feel — slow / normal (default) / fast. Maps onto sensible
|
|
886
|
+
* stagger + pre-reveal delay values so authors don't have to think.
|
|
887
|
+
* Explicit `stagger` / `delay` override the preset if provided.
|
|
888
|
+
*/
|
|
889
|
+
speed?: CodeSpeed;
|
|
890
|
+
/** Delay before the reveal starts (ms). Overrides the `speed` preset. */
|
|
891
|
+
delay?: number;
|
|
892
|
+
/**
|
|
893
|
+
* Per-line stagger for `lines`/`diff`, per-token for `typewriter`
|
|
894
|
+
* (ms). Overrides the `speed` preset.
|
|
895
|
+
*/
|
|
896
|
+
stagger?: number;
|
|
897
|
+
/** Show 1-indexed line numbers in a gutter. */
|
|
898
|
+
showLineNumbers?: boolean;
|
|
899
|
+
/** Optional filename / label in the chrome header. */
|
|
900
|
+
filename?: string;
|
|
901
|
+
/** Wrap long lines instead of horizontal scroll. */
|
|
902
|
+
wrap?: boolean;
|
|
903
|
+
/** Hide the surrounding chrome (border, header, padding). */
|
|
904
|
+
bare?: boolean;
|
|
905
|
+
/**
|
|
906
|
+
* String prepended to every line. Use for terminal emulation
|
|
907
|
+
* (`prompt="$ "` for bash, `prompt="> "` for PowerShell, `prompt=">>> "`
|
|
908
|
+
* for Python REPL). Prompt characters render in muted token colour,
|
|
909
|
+
* don't pick up the typewriter stagger (they're chrome, not content),
|
|
910
|
+
* and are aria-hidden so screen readers don't read them.
|
|
911
|
+
*/
|
|
912
|
+
prompt?: string;
|
|
913
|
+
/**
|
|
914
|
+
* Show a blinking cursor at the tail of the reveal — implies the
|
|
915
|
+
* "typing" gesture in marketing demos and terminal sessions.
|
|
916
|
+
* Defaults to `true` when `reveal="typewriter"`, `false` otherwise.
|
|
917
|
+
* Pass explicit `true` to keep the cursor up after a `lines` reveal
|
|
918
|
+
* completes, or `false` to hide it on a typewriter run.
|
|
919
|
+
*/
|
|
920
|
+
cursor?: boolean;
|
|
921
|
+
/**
|
|
922
|
+
* Scripted terminal session. When provided, takes precedence over
|
|
923
|
+
* `source` + `reveal` — the component runs the step machine,
|
|
924
|
+
* progressively appending characters per step. Pairs naturally with
|
|
925
|
+
* `language="bash"` + `prompt="$ "` + `cursor` (all default-on).
|
|
926
|
+
*
|
|
927
|
+
* Output lines are rendered without a prompt prefix and at a muted
|
|
928
|
+
* token colour so they read as command output rather than input.
|
|
929
|
+
* Use `wait` between commands to let the user catch up.
|
|
930
|
+
*
|
|
931
|
+
* Example:
|
|
932
|
+
* <Code language="bash" prompt="$ " steps={[
|
|
933
|
+
* { type: "type", text: "pnpm add @gradeui/ui" },
|
|
934
|
+
* { type: "wait", ms: 500 },
|
|
935
|
+
* { type: "output", text: "added 47 packages in 2.3s" },
|
|
936
|
+
* { type: "type", text: "pnpm gradeui init" },
|
|
937
|
+
* ]} />
|
|
938
|
+
*/
|
|
939
|
+
steps?: CodeStep[];
|
|
940
|
+
/**
|
|
941
|
+
* When `steps` is set: loops the sequence forever after completion
|
|
942
|
+
* (with a 2s pause + clear between cycles). For "always-on" hero
|
|
943
|
+
* demos that need to keep playing.
|
|
944
|
+
*/
|
|
945
|
+
loop?: boolean;
|
|
946
|
+
/**
|
|
947
|
+
* Container sizing — `auto` (default) grows with the rendered lines.
|
|
948
|
+
* A number is treated as pixels (`300` → `300px`); a string is passed
|
|
949
|
+
* through as CSS (`"20rem"`, `"50vh"`, `"calc(100vh - 4rem)"`).
|
|
950
|
+
*
|
|
951
|
+
* Overflowing content scrolls. Pair with `wrap` to break long lines
|
|
952
|
+
* instead of horizontal scroll.
|
|
953
|
+
*/
|
|
954
|
+
/**
|
|
955
|
+
* Type-scale preset. `xs` (12px) for dense changelog cards and inline
|
|
956
|
+
* code in tables; `sm` (14px, default) for marketing heroes and most
|
|
957
|
+
* docs blocks; `md` (16px) for "this is the focal point" displays
|
|
958
|
+
* like AI-output demos and large screen-capture replacements.
|
|
959
|
+
*
|
|
960
|
+
* Composes with `maxLines` correctly because the container height
|
|
961
|
+
* uses `1lh` which inherits whatever line-height the size class
|
|
962
|
+
* produces — switching size resizes the container automatically.
|
|
963
|
+
*/
|
|
964
|
+
size?: CodeSize;
|
|
965
|
+
height?: number | string | "auto";
|
|
966
|
+
/**
|
|
967
|
+
* Cap the visible line count — the container is fixed at exactly
|
|
968
|
+
* `maxLines * 1lh` and additional lines scroll. Use for terminal
|
|
969
|
+
* windows ("show me the last 8 lines"), code-tour cards, and
|
|
970
|
+
* marketing surfaces that need a stable vertical rhythm regardless
|
|
971
|
+
* of how much content is in the snippet.
|
|
972
|
+
*
|
|
973
|
+
* Wins over `height` when both are set.
|
|
974
|
+
*/
|
|
975
|
+
maxLines?: number;
|
|
976
|
+
}
|
|
977
|
+
declare const Code: React$1.ForwardRefExoticComponent<CodeProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
978
|
+
|
|
979
|
+
/**
|
|
980
|
+
* Message — the canonical "avatar + author + timestamp + body" row.
|
|
981
|
+
*
|
|
982
|
+
* THE primitive for any chat message, comment, post-reply, activity-log
|
|
983
|
+
* entry, or notification row that follows the people-and-text shape.
|
|
984
|
+
* Surfaced after three scaffolds (chat, comments, hero preview) all
|
|
985
|
+
* re-rolled the same flex layout inline — that was the signal.
|
|
986
|
+
*
|
|
987
|
+
* Slot-based composition for the avatar so consumers pass whatever
|
|
988
|
+
* Avatar variant fits their surface (sized, toned, image, fallback).
|
|
989
|
+
* Message doesn't pick an Avatar shape for you — it just hosts.
|
|
990
|
+
*
|
|
991
|
+
* <Message
|
|
992
|
+
* author="alice"
|
|
993
|
+
* timestamp="11:24"
|
|
994
|
+
* avatar={
|
|
995
|
+
* <Avatar size="sm">
|
|
996
|
+
* <AvatarFallback tone="violet">A</AvatarFallback>
|
|
997
|
+
* </Avatar>
|
|
998
|
+
* }
|
|
999
|
+
* >
|
|
1000
|
+
* Post copy is in the doc.
|
|
1001
|
+
* </Message>
|
|
1002
|
+
*
|
|
1003
|
+
* For "your messages right-aligned" chat surfaces (iMessage / WhatsApp
|
|
1004
|
+
* / your own DM threads), pass `align="end"` and the row + content
|
|
1005
|
+
* mirror.
|
|
1006
|
+
*
|
|
1007
|
+
* Anti-patterns to avoid (caught from real scaffold use):
|
|
1008
|
+
*
|
|
1009
|
+
* - Don't roll a custom "AuthorDot" inline — Avatar with
|
|
1010
|
+
* <AvatarFallback tone="..."> covers the colored-initials case
|
|
1011
|
+
* cleanly and stays themable.
|
|
1012
|
+
* - Don't use Message for non-people activity (system events,
|
|
1013
|
+
* log lines). Reach for Callout or a plain Row.
|
|
1014
|
+
*/
|
|
1015
|
+
interface MessageProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
1016
|
+
/** Display name of the message author. */
|
|
1017
|
+
author: string;
|
|
1018
|
+
/**
|
|
1019
|
+
* Timestamp string ("11:24", "2 hours ago") OR any node for custom
|
|
1020
|
+
* formatting (tooltip-wrapped time, link to permalink, etc).
|
|
1021
|
+
*/
|
|
1022
|
+
timestamp?: React$1.ReactNode;
|
|
1023
|
+
/**
|
|
1024
|
+
* Avatar slot. Pass any `<Avatar>` composition. When omitted, the
|
|
1025
|
+
* row renders without an avatar column — handy for grouped messages
|
|
1026
|
+
* from the same author where only the first row shows the avatar.
|
|
1027
|
+
*/
|
|
1028
|
+
avatar?: React$1.ReactNode;
|
|
1029
|
+
/**
|
|
1030
|
+
* Small chip(s) next to the author name. Use for "OP", "Bot",
|
|
1031
|
+
* "Admin", or any role/state badge that belongs in the header
|
|
1032
|
+
* rhythm rather than the body.
|
|
1033
|
+
*/
|
|
1034
|
+
badge?: React$1.ReactNode;
|
|
1035
|
+
/**
|
|
1036
|
+
* Editing state — renders an "(edited)" hint next to the timestamp.
|
|
1037
|
+
* Pass a string to customise the label (e.g. "(edited 2 minutes ago)").
|
|
1038
|
+
*/
|
|
1039
|
+
edited?: boolean | string;
|
|
1040
|
+
/**
|
|
1041
|
+
* Pinned state — renders a small pin glyph at the top of the row.
|
|
1042
|
+
* Surfaces "this is a sticky / pinned message" in Slack-style feeds.
|
|
1043
|
+
*/
|
|
1044
|
+
pinned?: boolean;
|
|
1045
|
+
/**
|
|
1046
|
+
* End-of-header slot. Common use: a hover-revealed Row of small
|
|
1047
|
+
* icon buttons (reply / react / pin / more). Pushed to the right
|
|
1048
|
+
* with `ml-auto`.
|
|
1049
|
+
*/
|
|
1050
|
+
actions?: React$1.ReactNode;
|
|
1051
|
+
/**
|
|
1052
|
+
* Reactions slot — renders below the body. Typically a Row of
|
|
1053
|
+
* reaction chips (emoji + count). Hidden when no node is passed.
|
|
1054
|
+
*/
|
|
1055
|
+
reactions?: React$1.ReactNode;
|
|
1056
|
+
/**
|
|
1057
|
+
* Thread / reply count — renders a "N replies" link affordance
|
|
1058
|
+
* below the body. Click handler is the consumer's responsibility.
|
|
1059
|
+
* Wire `onThreadClick` if you want the built-in button to fire.
|
|
1060
|
+
*/
|
|
1061
|
+
threadCount?: number;
|
|
1062
|
+
/** Fires when the built-in "N replies" affordance is clicked. */
|
|
1063
|
+
onThreadClick?: () => void;
|
|
1064
|
+
/**
|
|
1065
|
+
* Visual alignment. `start` (default) puts the avatar on the left
|
|
1066
|
+
* — the standard chat / comment shape. `end` mirrors the row so the
|
|
1067
|
+
* avatar sits on the right and the content right-aligns — use for
|
|
1068
|
+
* "your messages" in DM threads.
|
|
1069
|
+
*/
|
|
1070
|
+
align?: "start" | "end";
|
|
1071
|
+
/**
|
|
1072
|
+
* Body content (the message text). Accepts any node so consumers
|
|
1073
|
+
* can embed rich content — Markdown-rendered prose, images,
|
|
1074
|
+
* embedded cards, etc. Plain text is the common case.
|
|
1075
|
+
*/
|
|
1076
|
+
children: React$1.ReactNode;
|
|
1077
|
+
}
|
|
1078
|
+
declare const Message: React$1.ForwardRefExoticComponent<MessageProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
1079
|
+
|
|
1080
|
+
/**
|
|
1081
|
+
* Shared types + presets for scripted component demos.
|
|
1082
|
+
*
|
|
1083
|
+
* Lives at the bottom of the demo primitive stack so the hook, the
|
|
1084
|
+
* cursor, and any component that opts in (`<Code>`, `<Composer>`,
|
|
1085
|
+
* `<DemoStage>`) all read from one definition of "what slow / normal /
|
|
1086
|
+
* fast feels like" and one definition of "when do we start playing".
|
|
1087
|
+
*
|
|
1088
|
+
* If you ever want to retune the cadence of every demo on the marketing
|
|
1089
|
+
* site at once, this is the file to edit.
|
|
1090
|
+
*/
|
|
1091
|
+
/**
|
|
1092
|
+
* Animation feel. Maps onto a triple of timing values so authors can
|
|
1093
|
+
* pick a vibe (slow / normal / fast) instead of hand-tuning ms.
|
|
1094
|
+
* Components that need finer control can still override the resolved
|
|
1095
|
+
* values per-instance.
|
|
1096
|
+
*/
|
|
1097
|
+
type DemoSpeed = "slow" | "normal" | "fast";
|
|
1098
|
+
/**
|
|
1099
|
+
* What kicks the demo off:
|
|
1100
|
+
* - `mount` plays immediately on first paint
|
|
1101
|
+
* - `inView` waits for the container to cross the viewport threshold
|
|
1102
|
+
* - `manual` driven by the `play` prop or imperative ref
|
|
1103
|
+
*/
|
|
1104
|
+
type DemoTrigger = "mount" | "inView" | "manual";
|
|
1105
|
+
/**
|
|
1106
|
+
* Speed presets shared across every scripted-demo surface. Three
|
|
1107
|
+
* unambiguously distinct feels: `slow` is "I am being shown", `normal`
|
|
1108
|
+
* is "I am being told", `fast` is "I am being briefed".
|
|
1109
|
+
*
|
|
1110
|
+
* - `tokenStagger` per-character cadence for typing-style steps
|
|
1111
|
+
* - `lineStagger` per-line cadence for reveal-style demos
|
|
1112
|
+
* - `preDelay` pause after the trigger fires before the first tick
|
|
1113
|
+
* - `fadeMs` default enter-transition duration for revealed parts
|
|
1114
|
+
*/
|
|
1115
|
+
declare const DEMO_SPEED_PRESETS: Record<DemoSpeed, {
|
|
1116
|
+
tokenStagger: number;
|
|
1117
|
+
lineStagger: number;
|
|
1118
|
+
preDelay: number;
|
|
1119
|
+
fadeMs: number;
|
|
1120
|
+
}>;
|
|
1121
|
+
|
|
1122
|
+
/**
|
|
1123
|
+
* Cancellable sleep + type helpers for scripted demos.
|
|
1124
|
+
*
|
|
1125
|
+
* The runner threads an `AbortSignal` through every step so a `stop()`
|
|
1126
|
+
* call (or an unmount) can short-circuit long waits and typing loops
|
|
1127
|
+
* cleanly. Consumers write `await sleep(ms, signal)` inside their
|
|
1128
|
+
* interpret callback and the cancellation is automatic.
|
|
1129
|
+
*
|
|
1130
|
+
* Note: this throws DOMException("Aborted", "AbortError") on cancel.
|
|
1131
|
+
* The runner's outer try/catch swallows that specific error and exits;
|
|
1132
|
+
* any other rejection bubbles up so authoring bugs aren't silenced.
|
|
1133
|
+
*/
|
|
1134
|
+
/**
|
|
1135
|
+
* Promisified setTimeout that resolves after `ms` milliseconds, or
|
|
1136
|
+
* rejects with an AbortError if the signal fires first. Resolves
|
|
1137
|
+
* immediately if `ms <= 0`.
|
|
1138
|
+
*/
|
|
1139
|
+
declare function sleep(ms: number, signal?: AbortSignal): Promise<void>;
|
|
1140
|
+
/**
|
|
1141
|
+
* Type `text` one character at a time, calling `onTick(partial)` for
|
|
1142
|
+
* each prefix. Stagger between ticks defaults to 22ms (the `normal`
|
|
1143
|
+
* speed preset's `tokenStagger`).
|
|
1144
|
+
*
|
|
1145
|
+
* `onTick` receives the cumulative typed text (not the new char), so
|
|
1146
|
+
* consumers can do `setBuffer(prefix + partial)` without tracking state
|
|
1147
|
+
* themselves. The final call fires with the complete text — there's no
|
|
1148
|
+
* separate "done" callback.
|
|
1149
|
+
*/
|
|
1150
|
+
declare function typeText(text: string, onTick: (partial: string) => void, stagger?: number, signal?: AbortSignal): Promise<void>;
|
|
1151
|
+
|
|
1152
|
+
/**
|
|
1153
|
+
* useScriptedDemo — the shared step-machine hook behind every
|
|
1154
|
+
* scripted-demo surface in gradeui (`<Code>`, `<Composer>`,
|
|
1155
|
+
* `<DemoStage>`, anything else that wants the same play / stop / speed
|
|
1156
|
+
* semantics).
|
|
1157
|
+
*
|
|
1158
|
+
* Generic over the Step type. Each consumer defines its own verbs
|
|
1159
|
+
* (Code has `output`, Composer has `mention`, DemoStage has `reveal`)
|
|
1160
|
+
* and passes an `interpret(step, ctx)` callback that executes one
|
|
1161
|
+
* step. The hook owns: sequencing, cancellation, trigger detection
|
|
1162
|
+
* (mount / inView / manual), loop, pre-delay, completion signal, and
|
|
1163
|
+
* the imperative play() / stop() API.
|
|
1164
|
+
*
|
|
1165
|
+
* Authoring guide for `interpret`:
|
|
1166
|
+
* - `await sleep(ms, ctx.signal)` for any pause so stop() can short
|
|
1167
|
+
* a long wait cleanly.
|
|
1168
|
+
* - `await typeText(text, onTick, stagger, ctx.signal)` for typing
|
|
1169
|
+
* loops, again so stop() interrupts mid-character.
|
|
1170
|
+
* - Read `ctx.speed` to grab the resolved DEMO_SPEED_PRESETS entry
|
|
1171
|
+
* when a step doesn't pin its own cadence.
|
|
1172
|
+
* - Throw nothing on cancel — the helpers do it for you. Anything
|
|
1173
|
+
* else thrown is treated as a real bug and bubbles to the console.
|
|
1174
|
+
*/
|
|
1175
|
+
interface ScriptedDemoContext {
|
|
1176
|
+
/** Resolved speed preset for the current run. */
|
|
1177
|
+
speed: (typeof DEMO_SPEED_PRESETS)[DemoSpeed];
|
|
1178
|
+
/** AbortSignal that fires on stop() / unmount / steps change. */
|
|
1179
|
+
signal: AbortSignal;
|
|
1180
|
+
/** Live cancellation check for code paths that can't take a signal. */
|
|
1181
|
+
cancelled: () => boolean;
|
|
1182
|
+
}
|
|
1183
|
+
interface UseScriptedDemoOptions<TStep> {
|
|
1184
|
+
/** The steps to run. Undefined or empty means "no script". */
|
|
1185
|
+
steps?: TStep[];
|
|
1186
|
+
/**
|
|
1187
|
+
* Per-step interpreter. Receives one step + a context with timing
|
|
1188
|
+
* helpers, runs whatever the step means, and returns when done.
|
|
1189
|
+
* Synchronous or async — the runner awaits either.
|
|
1190
|
+
*/
|
|
1191
|
+
interpret: (step: TStep, ctx: ScriptedDemoContext) => Promise<void> | void;
|
|
1192
|
+
/** Animation feel. Defaults to `normal`. */
|
|
1193
|
+
speed?: DemoSpeed;
|
|
1194
|
+
/** What kicks the script off. Defaults to `mount`. */
|
|
1195
|
+
trigger?: DemoTrigger;
|
|
1196
|
+
/** For `trigger="manual"` — flip true to play. */
|
|
1197
|
+
play?: boolean;
|
|
1198
|
+
/** Loop the sequence forever after completion. Pause length controlled by `loopDelay`. */
|
|
1199
|
+
loop?: boolean;
|
|
1200
|
+
/**
|
|
1201
|
+
* Milliseconds to pause between loop cycles. Only applies when
|
|
1202
|
+
* `loop` is true. Defaults to 2000. Marketing surfaces that want
|
|
1203
|
+
* the demo to breathe between repeats bump this to 4000-6000; tight
|
|
1204
|
+
* inline demos drop it to 800.
|
|
1205
|
+
*/
|
|
1206
|
+
loopDelay?: number;
|
|
1207
|
+
/** Container ref for inView detection. Required when `trigger="inView"`. */
|
|
1208
|
+
containerRef?: React$1.RefObject<HTMLElement | null>;
|
|
1209
|
+
/**
|
|
1210
|
+
* Fires when one loop iteration completes (or the whole run, when
|
|
1211
|
+
* `loop` is false). Consumers can use this to reset their buffer or
|
|
1212
|
+
* fire a parent callback.
|
|
1213
|
+
*/
|
|
1214
|
+
onComplete?: () => void;
|
|
1215
|
+
/**
|
|
1216
|
+
* Fires before each loop iteration starts (after the 2s pause).
|
|
1217
|
+
* Use to reset per-iteration state in the consumer.
|
|
1218
|
+
*/
|
|
1219
|
+
onLoopReset?: () => void;
|
|
1220
|
+
}
|
|
1221
|
+
interface ScriptedDemoState {
|
|
1222
|
+
/** True while the runner is actively walking steps. */
|
|
1223
|
+
isPlaying: boolean;
|
|
1224
|
+
/** True after the last step has run (and stays true until reset). */
|
|
1225
|
+
isComplete: boolean;
|
|
1226
|
+
/** 0-indexed pointer to the currently executing step, or -1 idle. */
|
|
1227
|
+
currentIndex: number;
|
|
1228
|
+
/** Imperative trigger. Mostly for `trigger="manual"` ref handles. */
|
|
1229
|
+
play: () => void;
|
|
1230
|
+
/** Cancel the in-flight script. Idempotent. */
|
|
1231
|
+
stop: () => void;
|
|
1232
|
+
/**
|
|
1233
|
+
* One-shot replay. Cancels any in-flight run, then re-plays from
|
|
1234
|
+
* step 0. Pass a delay in ms to schedule the replay (useful for
|
|
1235
|
+
* "play, finish, breathe, play once more" cadences without the
|
|
1236
|
+
* commitment of `loop`).
|
|
1237
|
+
*/
|
|
1238
|
+
restart: (delayMs?: number) => void;
|
|
1239
|
+
}
|
|
1240
|
+
declare function useScriptedDemo<TStep>(opts: UseScriptedDemoOptions<TStep>): ScriptedDemoState;
|
|
1241
|
+
|
|
1242
|
+
/**
|
|
1243
|
+
* BlinkingCursor — the shared caret used by every scripted-demo
|
|
1244
|
+
* surface in gradeui. Styled via CSS variables so each host (Code's
|
|
1245
|
+
* terminal, Composer's inline caret, future surfaces) can tweak
|
|
1246
|
+
* dimensions and colour without forking the component.
|
|
1247
|
+
*
|
|
1248
|
+
* Tokens read from the cascade:
|
|
1249
|
+
* --gds-demo-cursor-color defaults to currentColor
|
|
1250
|
+
* --gds-demo-cursor-width defaults to 0.55ch (a hair narrower than
|
|
1251
|
+
* a monospace char so it reads as a caret
|
|
1252
|
+
* rather than a block)
|
|
1253
|
+
* --gds-demo-cursor-height defaults to 1.1em
|
|
1254
|
+
*
|
|
1255
|
+
* The animation lives in `styles/globals.css` as `.gds-demo-cursor`
|
|
1256
|
+
* (alongside the other demo primitives). Keeping it in CSS rather
|
|
1257
|
+
* than motion / framer keeps the cursor available in environments
|
|
1258
|
+
* that disable JS animation but still render the page.
|
|
1259
|
+
*/
|
|
1260
|
+
interface BlinkingCursorProps extends Omit<React$1.HTMLAttributes<HTMLSpanElement>, "children"> {
|
|
1261
|
+
/**
|
|
1262
|
+
* Visual variant. `inline` (default) is for caret-in-text demos
|
|
1263
|
+
* (Code, Composer). `block` is for terminal-style square cursors
|
|
1264
|
+
* that fill a character cell.
|
|
1265
|
+
*/
|
|
1266
|
+
variant?: "inline" | "block";
|
|
1267
|
+
}
|
|
1268
|
+
declare const BlinkingCursor: React$1.ForwardRefExoticComponent<BlinkingCursorProps & React$1.RefAttributes<HTMLSpanElement>>;
|
|
1269
|
+
|
|
1270
|
+
/**
|
|
1271
|
+
* DemoStage + Reveal — staged appearance for whole-interface demos.
|
|
1272
|
+
*
|
|
1273
|
+
* Drop `<Reveal id="hero">…</Reveal>` around any subtree that should
|
|
1274
|
+
* appear on cue. Wrap a region in `<DemoStage steps={…}>` and the
|
|
1275
|
+
* script drives which targets become visible, in what order, with
|
|
1276
|
+
* what cadence. Same speed / trigger / loop / play semantics as
|
|
1277
|
+
* `<Code>` and `<Composer>`.
|
|
1278
|
+
*
|
|
1279
|
+
* Why a context-based pattern instead of one-component-per-region:
|
|
1280
|
+
* - Authoring stays declarative — the script reads as a storyboard,
|
|
1281
|
+
* not as a stack of imperative ref calls.
|
|
1282
|
+
* - Reveals can live deep in a subtree without prop-drilling.
|
|
1283
|
+
* - The same `<Reveal>` works whether or not a parent stage exists
|
|
1284
|
+
* (it just renders visible if there's no context, so the same
|
|
1285
|
+
* markup ships to production without the demo wrapper).
|
|
1286
|
+
*
|
|
1287
|
+
* Reduced motion: if the user has `prefers-reduced-motion`, every
|
|
1288
|
+
* Reveal renders immediately at its destination state — the stage's
|
|
1289
|
+
* script still walks, but the visual transitions are no-ops.
|
|
1290
|
+
*/
|
|
1291
|
+
type RevealStep = {
|
|
1292
|
+
type: "reveal";
|
|
1293
|
+
target: string;
|
|
1294
|
+
} | {
|
|
1295
|
+
type: "reveal-all";
|
|
1296
|
+
} | {
|
|
1297
|
+
type: "hide";
|
|
1298
|
+
target: string;
|
|
1299
|
+
} | {
|
|
1300
|
+
type: "wait";
|
|
1301
|
+
ms: number;
|
|
1302
|
+
} | {
|
|
1303
|
+
type: "reset";
|
|
1304
|
+
};
|
|
1305
|
+
type RevealAnimation = "fade" | "fade-up" | "fade-down" | "fade-left" | "fade-right" | "scale" | "none";
|
|
1306
|
+
interface DemoStageProps {
|
|
1307
|
+
/** Steps that drive which Reveals are visible at what time. */
|
|
1308
|
+
steps?: RevealStep[];
|
|
1309
|
+
/** Speed preset. Same vocabulary as Code / Composer. */
|
|
1310
|
+
speed?: DemoSpeed;
|
|
1311
|
+
/** When the stage starts running. Defaults to `mount`. */
|
|
1312
|
+
trigger?: DemoTrigger;
|
|
1313
|
+
/** For trigger="manual" — flip true to play. */
|
|
1314
|
+
play?: boolean;
|
|
1315
|
+
/** Loop the script forever. */
|
|
1316
|
+
loop?: boolean;
|
|
1317
|
+
/** Default enter animation for child Reveals that don't override. */
|
|
1318
|
+
defaultAnimation?: RevealAnimation;
|
|
1319
|
+
/**
|
|
1320
|
+
* Render content visible by default (every target shown) when the
|
|
1321
|
+
* stage has no steps. Useful for sharing the same JSX between live
|
|
1322
|
+
* production use and demo playback.
|
|
1323
|
+
*/
|
|
1324
|
+
visibleWhenIdle?: boolean;
|
|
1325
|
+
className?: string;
|
|
1326
|
+
children: React$1.ReactNode;
|
|
1327
|
+
}
|
|
1328
|
+
declare function DemoStage({ steps, speed, trigger, play, loop, defaultAnimation, visibleWhenIdle, className, children, }: DemoStageProps): React$1.JSX.Element;
|
|
1329
|
+
interface RevealProps {
|
|
1330
|
+
/** Stage target id. The matching `{ type: "reveal", target: id }` step shows this. */
|
|
1331
|
+
id: string;
|
|
1332
|
+
/** Enter animation. Falls back to the parent stage's `defaultAnimation`. */
|
|
1333
|
+
animation?: RevealAnimation;
|
|
1334
|
+
/** Override transition duration (ms). Defaults to the stage speed's fadeMs. */
|
|
1335
|
+
durationMs?: number;
|
|
1336
|
+
/**
|
|
1337
|
+
* When true and there's no parent DemoStage, render hidden anyway.
|
|
1338
|
+
* Default false — naked usage renders visible so production markup
|
|
1339
|
+
* matches demo markup.
|
|
1340
|
+
*/
|
|
1341
|
+
hideOutsideStage?: boolean;
|
|
1342
|
+
/**
|
|
1343
|
+
* Fires when this Reveal transitions from hidden to visible. Use to
|
|
1344
|
+
* kick off a nested scripted demo (Composer.restart(), Code.play(),
|
|
1345
|
+
* etc) at the moment the user actually sees the surface. Without
|
|
1346
|
+
* this hook, nested demos with `trigger="mount"` would run while
|
|
1347
|
+
* still hidden and the user would miss the animation entirely.
|
|
1348
|
+
*/
|
|
1349
|
+
onReveal?: () => void;
|
|
1350
|
+
/**
|
|
1351
|
+
* Fires when this Reveal transitions from visible to hidden (e.g.
|
|
1352
|
+
* because the stage script ran a `hide` step or looped via `reset`).
|
|
1353
|
+
* Use to pause/reset nested state.
|
|
1354
|
+
*/
|
|
1355
|
+
onHide?: () => void;
|
|
1356
|
+
className?: string;
|
|
1357
|
+
children: React$1.ReactNode;
|
|
1358
|
+
}
|
|
1359
|
+
declare function Reveal({ id, animation, durationMs, hideOutsideStage, onReveal, onHide, className, children, }: RevealProps): React$1.JSX.Element;
|
|
1360
|
+
|
|
1361
|
+
/**
|
|
1362
|
+
* Composer — the generic text composition surface for the design system.
|
|
1363
|
+
*
|
|
1364
|
+
* The answer wherever a user is composing a message: AI chat input,
|
|
1365
|
+
* comment thread reply, post-body editor, future copilot panels.
|
|
1366
|
+
* Replaces the textarea-with-buttons pattern that hosts kept rolling
|
|
1367
|
+
* by hand.
|
|
1368
|
+
*
|
|
1369
|
+
* Built on Lexical (Meta's React-first editor framework) so it can do:
|
|
1370
|
+
* - rich text formatting (B / I / U / S / code, headings, blockquote,
|
|
1371
|
+
* pullquote, lists)
|
|
1372
|
+
* - mentions and slash commands via lexical-beautiful-mentions, with
|
|
1373
|
+
* a typeahead popover and theme-able tokens
|
|
1374
|
+
* - image attachments (paperclip + clipboard paste) when opted in
|
|
1375
|
+
* - scripted demo playback for marketing surfaces (types text, opens
|
|
1376
|
+
* mention popovers, applies formatting, all via the same step
|
|
1377
|
+
* vocabulary as <Code>)
|
|
1378
|
+
*
|
|
1379
|
+
* Slot-based composition for the action row: hosts that need custom
|
|
1380
|
+
* affordances (template picker, voice button, attach-document) pass
|
|
1381
|
+
* `leftActions` / `rightActions`. Default Send / Stop / paperclip
|
|
1382
|
+
* render only when the host hasn't replaced the slot.
|
|
1383
|
+
*
|
|
1384
|
+
* Hosts that want the canned "chat composer with paperclip + send"
|
|
1385
|
+
* preset should reach for `<AIChatComposer>` instead, which configures
|
|
1386
|
+
* this Composer with the right slots wired up.
|
|
1387
|
+
*
|
|
1388
|
+
* Scripted demos: same `speed` / `trigger` / `play` / `loop` vocabulary
|
|
1389
|
+
* as `<Code>`, sharing the underlying `useScriptedDemo` hook from
|
|
1390
|
+
* `lib/demo/`. The Composer adds its own verbs (`mention`, `format`,
|
|
1391
|
+
* `select`, `submit`) on top of the universal `type` / `wait` / `clear`.
|
|
1392
|
+
*/
|
|
1393
|
+
type ComposerFormat = "bold" | "italic" | "underline" | "strikethrough" | "code" | "h1" | "h2" | "h3" | "blockquote" | "pullquote" | "ul" | "ol";
|
|
1394
|
+
interface ComposerMentionItem {
|
|
1395
|
+
id: string;
|
|
1396
|
+
/** Display value (without the trigger char). */
|
|
1397
|
+
value: string;
|
|
1398
|
+
/** Optional secondary label shown in the suggester. */
|
|
1399
|
+
label?: string;
|
|
1400
|
+
/** Avatar URL or initials for the suggester row. */
|
|
1401
|
+
avatar?: string;
|
|
1402
|
+
/** Arbitrary payload the host can attach to the mention. */
|
|
1403
|
+
data?: Record<string, unknown>;
|
|
1404
|
+
}
|
|
1405
|
+
interface ComposerTriggerConfig {
|
|
1406
|
+
/** The trigger character, eg. "@" or "/". */
|
|
1407
|
+
char: string;
|
|
1408
|
+
/**
|
|
1409
|
+
* Items to populate the suggester. Either a static array or a
|
|
1410
|
+
* resolver function (sync or async) that receives the typed query.
|
|
1411
|
+
* The plugin filters automatically when items is an array.
|
|
1412
|
+
*/
|
|
1413
|
+
items: ComposerMentionItem[] | ((query: string) => ComposerMentionItem[] | Promise<ComposerMentionItem[]>);
|
|
1414
|
+
/**
|
|
1415
|
+
* Whether to strip the trigger char on insert. Defaults: keep for
|
|
1416
|
+
* "@" (mentions read as "@alice"), strip for "/" (commands read as
|
|
1417
|
+
* "Insert image" not "/insert-image").
|
|
1418
|
+
*/
|
|
1419
|
+
stripTrigger?: boolean;
|
|
1420
|
+
}
|
|
1421
|
+
interface ComposerAttachmentConfig {
|
|
1422
|
+
/** Master enable. Set true on the prop to use defaults, or pass a config object. */
|
|
1423
|
+
enabled?: boolean;
|
|
1424
|
+
/** HTML accept attribute on the file input. Default "image/*". */
|
|
1425
|
+
accept?: string;
|
|
1426
|
+
/** Max number of attachments. Default 10. */
|
|
1427
|
+
maxItems?: number;
|
|
1428
|
+
/** Allow multiple selection in the file picker. Default true. */
|
|
1429
|
+
multiple?: boolean;
|
|
1430
|
+
}
|
|
1431
|
+
interface ComposerAttachment {
|
|
1432
|
+
id: string;
|
|
1433
|
+
file: File;
|
|
1434
|
+
/** Object URL owned by the composer. Hosts must NOT revoke it. */
|
|
1435
|
+
previewUrl: string;
|
|
1436
|
+
name: string;
|
|
1437
|
+
}
|
|
1438
|
+
interface ComposerContent {
|
|
1439
|
+
/** Plain text representation of the editor contents (whitespace preserved). */
|
|
1440
|
+
text: string;
|
|
1441
|
+
/** Lexical editor state serialised to JSON (for round-trip persistence). */
|
|
1442
|
+
json: string;
|
|
1443
|
+
/** Resolved mention tokens in document order. */
|
|
1444
|
+
mentions: Array<{
|
|
1445
|
+
trigger: string;
|
|
1446
|
+
value: string;
|
|
1447
|
+
data?: Record<string, unknown>;
|
|
1448
|
+
}>;
|
|
1449
|
+
}
|
|
1450
|
+
interface ComposerHandle {
|
|
1451
|
+
/** Run a demo script imperatively (vs. via `steps` + `trigger="manual"`). */
|
|
1452
|
+
play: (steps: ComposerStep[]) => void;
|
|
1453
|
+
/** Cancel an in-flight demo. Idempotent. */
|
|
1454
|
+
stop: () => void;
|
|
1455
|
+
/**
|
|
1456
|
+
* One-shot replay of the configured `steps`. Cancels any in-flight
|
|
1457
|
+
* run, clears the editor, replays from step 0. Pass a delay (ms) to
|
|
1458
|
+
* schedule the replay (useful for chaining demos). Requires `steps`
|
|
1459
|
+
* to be configured.
|
|
1460
|
+
*/
|
|
1461
|
+
restart: (delayMs?: number) => void;
|
|
1462
|
+
/** Move focus into the editor. */
|
|
1463
|
+
focus: () => void;
|
|
1464
|
+
/** Wipe the editor. */
|
|
1465
|
+
clear: () => void;
|
|
1466
|
+
/** Insert plain text at the current selection. */
|
|
1467
|
+
insert: (text: string) => void;
|
|
1468
|
+
/** Snapshot the current content + mentions. */
|
|
1469
|
+
getContent: () => ComposerContent;
|
|
1470
|
+
/** Direct access to the underlying Lexical editor (escape hatch). */
|
|
1471
|
+
getEditor: () => LexicalEditor | null;
|
|
1472
|
+
}
|
|
1473
|
+
/**
|
|
1474
|
+
* Demo step vocabulary for Composer scripts. Shares `type` / `wait` /
|
|
1475
|
+
* `clear` with the universal `lib/demo` verbs; adds composer-specific
|
|
1476
|
+
* `mention`, `format`, `select`, `newline`, `submit` on top.
|
|
1477
|
+
*/
|
|
1478
|
+
type ComposerStep = {
|
|
1479
|
+
type: "type";
|
|
1480
|
+
text: string;
|
|
1481
|
+
speed?: DemoSpeed;
|
|
1482
|
+
} | {
|
|
1483
|
+
type: "wait";
|
|
1484
|
+
ms: number;
|
|
1485
|
+
} | {
|
|
1486
|
+
type: "clear";
|
|
1487
|
+
} | {
|
|
1488
|
+
type: "newline";
|
|
1489
|
+
} | {
|
|
1490
|
+
type: "submit";
|
|
1491
|
+
} | {
|
|
1492
|
+
type: "mention";
|
|
1493
|
+
/** Trigger char (must match a registered ComposerTriggerConfig.char). */
|
|
1494
|
+
trigger: string;
|
|
1495
|
+
/** Value to insert (without the trigger). Looks up the matching item by `value`. */
|
|
1496
|
+
value: string;
|
|
1497
|
+
/** Optional pre-typed query — the demo types this after the trigger char before "selecting" the value, to show the typeahead in action. */
|
|
1498
|
+
query?: string;
|
|
1499
|
+
} | {
|
|
1500
|
+
type: "format";
|
|
1501
|
+
format: ComposerFormat;
|
|
1502
|
+
} | {
|
|
1503
|
+
type: "select";
|
|
1504
|
+
/** Substring to find and select. First match wins. */
|
|
1505
|
+
text: string;
|
|
1506
|
+
};
|
|
1507
|
+
interface ComposerProps {
|
|
1508
|
+
/** Placeholder copy shown when empty. */
|
|
1509
|
+
placeholder?: string;
|
|
1510
|
+
/** Initial plain text content. For richer initial state, use `initialJson`. */
|
|
1511
|
+
initialText?: string;
|
|
1512
|
+
/** Initial Lexical state JSON (from a previous `onSubmit` round-trip). */
|
|
1513
|
+
initialJson?: string;
|
|
1514
|
+
/**
|
|
1515
|
+
* Available formats. Pass false to disable rich text entirely
|
|
1516
|
+
* (plain text mode, half the bundle weight, no toolbar). Default
|
|
1517
|
+
* enables a sensible set for most chat / comment surfaces.
|
|
1518
|
+
*/
|
|
1519
|
+
formats?: ComposerFormat[] | false;
|
|
1520
|
+
/**
|
|
1521
|
+
* Render the formatting toolbar. Default false because most uses
|
|
1522
|
+
* are short-form. Set true (or "top") to show the toolbar above the
|
|
1523
|
+
* editor. "floating" is planned; not yet implemented.
|
|
1524
|
+
*/
|
|
1525
|
+
toolbar?: boolean | "top";
|
|
1526
|
+
/**
|
|
1527
|
+
* Mention / slash command configs. Each entry registers one trigger
|
|
1528
|
+
* char and its items. Pass `[{ char: "@", items: people }, { char: "/", items: commands }]`
|
|
1529
|
+
* for the common chat-app setup.
|
|
1530
|
+
*/
|
|
1531
|
+
triggers?: ComposerTriggerConfig[];
|
|
1532
|
+
/**
|
|
1533
|
+
* Image attachments (paperclip + clipboard paste). Pass true for
|
|
1534
|
+
* defaults, an object to customise, or omit/false to skip the
|
|
1535
|
+
* attachment plumbing entirely.
|
|
1536
|
+
*/
|
|
1537
|
+
attachments?: boolean | ComposerAttachmentConfig;
|
|
1538
|
+
/** Fires when the user submits (Enter, click Send, or scripted `submit` step). */
|
|
1539
|
+
onSubmit?: (content: ComposerContent, attachments?: ComposerAttachment[]) => void;
|
|
1540
|
+
/**
|
|
1541
|
+
* Fires on every editor change with the current plain text. Use for
|
|
1542
|
+
* length validation, controlled-value bridges (eg. AIChatComposer
|
|
1543
|
+
* forwarding to a host's `value`/`onChange` pair), or live preview
|
|
1544
|
+
* surfaces. Cheap, called frequently; debounce if you need the
|
|
1545
|
+
* Lexical state JSON (use `getContent()` via ref instead).
|
|
1546
|
+
*/
|
|
1547
|
+
onChange?: (text: string) => void;
|
|
1548
|
+
/**
|
|
1549
|
+
* Loading state — disables the editor + paperclip and swaps the
|
|
1550
|
+
* default Send button for Stop. Has no effect when `rightActions`
|
|
1551
|
+
* overrides the default Send.
|
|
1552
|
+
*/
|
|
1553
|
+
isLoading?: boolean;
|
|
1554
|
+
/** Stop handler — required for Stop to be active when loading. */
|
|
1555
|
+
onStop?: () => void;
|
|
1556
|
+
/** Hard character cap. */
|
|
1557
|
+
maxLength?: number;
|
|
1558
|
+
/** Auto-focus the editor on mount. Default false. */
|
|
1559
|
+
autoFocus?: boolean;
|
|
1560
|
+
/** Whether Enter submits. Default true (Shift-Enter still inserts a newline). */
|
|
1561
|
+
submitOnEnter?: boolean;
|
|
1562
|
+
/**
|
|
1563
|
+
* Custom content for the left action slot. Replaces the default
|
|
1564
|
+
* paperclip button when `attachments` is enabled.
|
|
1565
|
+
*/
|
|
1566
|
+
leftActions?: React$1.ReactNode;
|
|
1567
|
+
/**
|
|
1568
|
+
* Custom content for the right action slot. Replaces the default
|
|
1569
|
+
* Send / Stop button. Use the `useComposer()` hook inside to access
|
|
1570
|
+
* imperative methods.
|
|
1571
|
+
*/
|
|
1572
|
+
rightActions?: React$1.ReactNode;
|
|
1573
|
+
/** Hide the default Send button without replacing it. */
|
|
1574
|
+
hideSend?: boolean;
|
|
1575
|
+
/** Scripted demo steps. */
|
|
1576
|
+
steps?: ComposerStep[];
|
|
1577
|
+
/** What kicks the script off. Defaults to "mount". */
|
|
1578
|
+
trigger?: DemoTrigger;
|
|
1579
|
+
/** For trigger="manual" — flip true to play. */
|
|
1580
|
+
play?: boolean;
|
|
1581
|
+
/** Animation feel. */
|
|
1582
|
+
speed?: DemoSpeed;
|
|
1583
|
+
/** Loop the script forever. */
|
|
1584
|
+
loop?: boolean;
|
|
1585
|
+
/**
|
|
1586
|
+
* Pause between loop iterations (ms). Defaults to 2000. Marketing
|
|
1587
|
+
* heroes that want the demo to breathe between repeats bump this
|
|
1588
|
+
* higher; tight inline demos drop it.
|
|
1589
|
+
*/
|
|
1590
|
+
loopDelay?: number;
|
|
1591
|
+
/**
|
|
1592
|
+
* Fires once per loop cycle, AFTER the loopDelay pause and BEFORE
|
|
1593
|
+
* the script replays. Use to reset parent state that the script
|
|
1594
|
+
* mutated via onSubmit (e.g., wipe a messages list back to its
|
|
1595
|
+
* seed before the demo types into it again). The editor is cleared
|
|
1596
|
+
* automatically — you only need this hook if state outside the
|
|
1597
|
+
* Composer needs to reset too.
|
|
1598
|
+
*/
|
|
1599
|
+
onLoopReset?: () => void;
|
|
1600
|
+
/**
|
|
1601
|
+
* Bare mode — strip the card chrome (border / bg / rounding). Use
|
|
1602
|
+
* when embedding inside an existing card or column layout.
|
|
1603
|
+
*/
|
|
1604
|
+
bare?: boolean;
|
|
1605
|
+
/**
|
|
1606
|
+
* Read-only mode — disables editing AND focusability. Programmatic
|
|
1607
|
+
* updates (including scripted demo playback) still work. Use for
|
|
1608
|
+
* marketing surfaces that render a Composer purely for show, so the
|
|
1609
|
+
* scripted typing doesn't steal focus from other inputs on the page.
|
|
1610
|
+
* Hides the default Send / paperclip action row.
|
|
1611
|
+
*/
|
|
1612
|
+
readOnly?: boolean;
|
|
1613
|
+
className?: string;
|
|
1614
|
+
}
|
|
1615
|
+
declare const Composer: React$1.ForwardRefExoticComponent<ComposerProps & React$1.RefAttributes<ComposerHandle>>;
|
|
1616
|
+
declare const ComposerReply: React$1.ForwardRefExoticComponent<ComposerProps & React$1.RefAttributes<ComposerHandle>>;
|
|
1617
|
+
|
|
661
1618
|
/**
|
|
662
1619
|
* DatePicker + DateRangePicker
|
|
663
1620
|
*
|
|
@@ -728,7 +1685,21 @@ declare const DialogTrigger: React$1.ForwardRefExoticComponent<DialogPrimitive.D
|
|
|
728
1685
|
declare const DialogPortal: React$1.FC<DialogPrimitive.DialogPortalProps>;
|
|
729
1686
|
declare const DialogClose: React$1.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
730
1687
|
declare const DialogOverlay: React$1.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
731
|
-
|
|
1688
|
+
interface DialogContentProps extends React$1.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {
|
|
1689
|
+
/**
|
|
1690
|
+
* What the dialog surface is *made of*. Composes with the overlay
|
|
1691
|
+
* scrim — see PRESENCE.md and dialog.md for scenarios.
|
|
1692
|
+
*
|
|
1693
|
+
* - `solid` (default): opaque `bg-background`.
|
|
1694
|
+
* - `translucent`: ~82% opacity, no blur — "presence without drama".
|
|
1695
|
+
* - `glass`: 58% opacity + 14px blur + edge highlight. The page
|
|
1696
|
+
* underneath shows through softly.
|
|
1697
|
+
* - `glass-strong`: 42% opacity + 24px blur. For dialogs that should
|
|
1698
|
+
* feel like an overlay rather than a panel.
|
|
1699
|
+
*/
|
|
1700
|
+
surface?: Surface;
|
|
1701
|
+
}
|
|
1702
|
+
declare const DialogContent: React$1.ForwardRefExoticComponent<DialogContentProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
732
1703
|
declare const DialogHeader: {
|
|
733
1704
|
({ className, ...props }: React$1.HTMLAttributes<HTMLDivElement>): React$1.JSX.Element;
|
|
734
1705
|
displayName: string;
|
|
@@ -749,8 +1720,20 @@ declare const DropdownMenuRadioGroup: React$1.ForwardRefExoticComponent<Dropdown
|
|
|
749
1720
|
declare const DropdownMenuSubTrigger: React$1.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSubTriggerProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
750
1721
|
inset?: boolean;
|
|
751
1722
|
} & React$1.RefAttributes<HTMLDivElement>>;
|
|
752
|
-
|
|
753
|
-
|
|
1723
|
+
interface DropdownMenuSubContentProps extends React$1.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent> {
|
|
1724
|
+
/** What the submenu surface is *made of*. See dropdown-menu.md. */
|
|
1725
|
+
surface?: Surface;
|
|
1726
|
+
}
|
|
1727
|
+
declare const DropdownMenuSubContent: React$1.ForwardRefExoticComponent<DropdownMenuSubContentProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
1728
|
+
interface DropdownMenuContentProps extends React$1.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content> {
|
|
1729
|
+
/**
|
|
1730
|
+
* What the menu surface is *made of*. `solid` (default) is `bg-popover`.
|
|
1731
|
+
* `translucent` matches Apple HIG / iOS menu sheets. `glass` for menus
|
|
1732
|
+
* floating over rich canvases. See dropdown-menu.md.
|
|
1733
|
+
*/
|
|
1734
|
+
surface?: Surface;
|
|
1735
|
+
}
|
|
1736
|
+
declare const DropdownMenuContent: React$1.ForwardRefExoticComponent<DropdownMenuContentProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
754
1737
|
declare const DropdownMenuItem: React$1.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuItemProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
755
1738
|
inset?: boolean;
|
|
756
1739
|
} & React$1.RefAttributes<HTMLDivElement>>;
|
|
@@ -791,7 +1774,15 @@ declare const Label: React$1.ForwardRefExoticComponent<Omit<LabelPrimitive.Label
|
|
|
791
1774
|
declare const Popover: React$1.FC<PopoverPrimitive.PopoverProps>;
|
|
792
1775
|
declare const PopoverTrigger: React$1.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
793
1776
|
declare const PopoverAnchor: React$1.ForwardRefExoticComponent<PopoverPrimitive.PopoverAnchorProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
794
|
-
|
|
1777
|
+
interface PopoverContentProps extends React$1.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> {
|
|
1778
|
+
/**
|
|
1779
|
+
* What the popover surface is *made of*. Defaults to `solid`
|
|
1780
|
+
* (`bg-popover`). `translucent` is the Apple HIG menu-sheet feel.
|
|
1781
|
+
* `glass` for floating panels over rich canvases.
|
|
1782
|
+
*/
|
|
1783
|
+
surface?: Surface;
|
|
1784
|
+
}
|
|
1785
|
+
declare const PopoverContent: React$1.ForwardRefExoticComponent<PopoverContentProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
795
1786
|
|
|
796
1787
|
declare const Progress: React$1.ForwardRefExoticComponent<Omit<ProgressPrimitive.ProgressProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
797
1788
|
|
|
@@ -921,7 +1912,7 @@ declare const RadioGroupItem: React$1.ForwardRefExoticComponent<Omit<RadioGroupP
|
|
|
921
1912
|
* </ResizablePanelGroup>
|
|
922
1913
|
*/
|
|
923
1914
|
declare const ResizablePanelGroup: ({ className, ...props }: React$1.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => React$1.JSX.Element;
|
|
924
|
-
declare const ResizablePanel: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<
|
|
1915
|
+
declare const ResizablePanel: React$1.ForwardRefExoticComponent<Omit<React$1.HTMLAttributes<HTMLHeadElement | HTMLElement | HTMLLinkElement | HTMLDivElement | HTMLObjectElement | HTMLAnchorElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBodyElement | HTMLBRElement | HTMLButtonElement | HTMLCanvasElement | HTMLTableColElement | HTMLDataElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDialogElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLFormElement | HTMLHeadingElement | HTMLHRElement | HTMLHtmlElement | HTMLIFrameElement | HTMLImageElement | HTMLInputElement | HTMLLabelElement | HTMLLegendElement | HTMLLIElement | HTMLMapElement | HTMLMetaElement | HTMLMeterElement | HTMLOListElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLParagraphElement | HTMLPreElement | HTMLProgressElement | HTMLScriptElement | HTMLSelectElement | HTMLSlotElement | HTMLSourceElement | HTMLSpanElement | HTMLStyleElement | HTMLTableElement | HTMLTableSectionElement | HTMLTableCellElement | HTMLTemplateElement | HTMLTextAreaElement | HTMLTimeElement | HTMLTitleElement | HTMLTableRowElement | HTMLTrackElement | HTMLUListElement | HTMLVideoElement | HTMLTableCaptionElement | HTMLMenuElement | HTMLPictureElement>, "id" | "onResize"> & {
|
|
925
1916
|
className?: string | undefined;
|
|
926
1917
|
collapsedSize?: number | undefined;
|
|
927
1918
|
collapsible?: boolean | undefined;
|
|
@@ -961,8 +1952,8 @@ declare const ResizableHandle: ({ withHandle, className, ...props }: React$1.Com
|
|
|
961
1952
|
*/
|
|
962
1953
|
declare const rowVariants: (props?: ({
|
|
963
1954
|
gap?: "none" | "sm" | "md" | "lg" | "xs" | "xl" | "2xl" | null | undefined;
|
|
964
|
-
align?: "
|
|
965
|
-
justify?: "
|
|
1955
|
+
align?: "center" | "start" | "end" | "stretch" | "baseline" | null | undefined;
|
|
1956
|
+
justify?: "center" | "start" | "between" | "end" | "around" | "evenly" | null | undefined;
|
|
966
1957
|
wrap?: boolean | null | undefined;
|
|
967
1958
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
968
1959
|
interface RowProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProps<typeof rowVariants> {
|
|
@@ -997,7 +1988,7 @@ declare const Row: React$1.ForwardRefExoticComponent<RowProps & React$1.RefAttri
|
|
|
997
1988
|
declare const gridVariants: (props?: ({
|
|
998
1989
|
cols?: "1" | "2" | "3" | "4" | "5" | "6" | "12" | null | undefined;
|
|
999
1990
|
gap?: "none" | "sm" | "md" | "lg" | "xs" | "xl" | "2xl" | null | undefined;
|
|
1000
|
-
align?: "
|
|
1991
|
+
align?: "center" | "start" | "end" | "stretch" | null | undefined;
|
|
1001
1992
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
1002
1993
|
interface GridProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProps<typeof gridVariants> {
|
|
1003
1994
|
/** When true, render as the single child element via Radix Slot — lets
|
|
@@ -1029,10 +2020,10 @@ declare const Grid: React$1.ForwardRefExoticComponent<GridProps & React$1.RefAtt
|
|
|
1029
2020
|
* case. Flex is the escape hatch, not the default.
|
|
1030
2021
|
*/
|
|
1031
2022
|
declare const flexVariants: (props?: ({
|
|
1032
|
-
direction?: "
|
|
2023
|
+
direction?: "col" | "row" | "row-reverse" | "col-reverse" | null | undefined;
|
|
1033
2024
|
gap?: "none" | "sm" | "md" | "lg" | "xs" | "xl" | "2xl" | null | undefined;
|
|
1034
|
-
align?: "
|
|
1035
|
-
justify?: "
|
|
2025
|
+
align?: "center" | "start" | "end" | "stretch" | "baseline" | null | undefined;
|
|
2026
|
+
justify?: "center" | "start" | "between" | "end" | "around" | "evenly" | null | undefined;
|
|
1036
2027
|
wrap?: "wrap" | "nowrap" | "wrap-reverse" | null | undefined;
|
|
1037
2028
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
1038
2029
|
interface FlexProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProps<typeof flexVariants> {
|
|
@@ -1078,9 +2069,16 @@ declare const SheetClose: React$1.ForwardRefExoticComponent<DialogPrimitive.Dial
|
|
|
1078
2069
|
declare const SheetPortal: React$1.FC<DialogPrimitive.DialogPortalProps>;
|
|
1079
2070
|
declare const SheetOverlay: React$1.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
1080
2071
|
declare const sheetVariants: (props?: ({
|
|
1081
|
-
side?: "
|
|
2072
|
+
side?: "bottom" | "top" | "right" | "left" | null | undefined;
|
|
1082
2073
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
1083
2074
|
interface SheetContentProps extends React$1.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>, VariantProps<typeof sheetVariants> {
|
|
2075
|
+
/**
|
|
2076
|
+
* What the sheet panel is *made of*. `solid` is the default opaque
|
|
2077
|
+
* `bg-background`. `glass` lets the page show through with a 14px
|
|
2078
|
+
* blur — the canonical "inspector panel" feel. Composes with the
|
|
2079
|
+
* overlay scrim. See sheet.md for scenarios.
|
|
2080
|
+
*/
|
|
2081
|
+
surface?: Surface;
|
|
1084
2082
|
}
|
|
1085
2083
|
declare const SheetContent: React$1.ForwardRefExoticComponent<SheetContentProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
1086
2084
|
declare const SheetHeader: {
|
|
@@ -1210,8 +2208,8 @@ declare const Sortable: SortableRootComponent;
|
|
|
1210
2208
|
*/
|
|
1211
2209
|
declare const stackVariants: (props?: ({
|
|
1212
2210
|
gap?: "none" | "sm" | "md" | "lg" | "xs" | "xl" | "2xl" | null | undefined;
|
|
1213
|
-
align?: "
|
|
1214
|
-
justify?: "
|
|
2211
|
+
align?: "center" | "start" | "end" | "stretch" | null | undefined;
|
|
2212
|
+
justify?: "center" | "start" | "between" | "end" | "around" | "evenly" | null | undefined;
|
|
1215
2213
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
1216
2214
|
interface StackProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProps<typeof stackVariants> {
|
|
1217
2215
|
/** When true, render as the single child element via Radix Slot — lets
|
|
@@ -1431,8 +2429,8 @@ declare const ToggleGroupItem: React$1.ForwardRefExoticComponent<Omit<ToggleGrou
|
|
|
1431
2429
|
* persistent footer toolbars on mobile-style layouts.
|
|
1432
2430
|
*/
|
|
1433
2431
|
declare const toolbarVariants: (props?: ({
|
|
1434
|
-
position?: "
|
|
1435
|
-
variant?: "default" | "
|
|
2432
|
+
position?: "bottom" | "top" | "inline" | null | undefined;
|
|
2433
|
+
variant?: "default" | "transparent" | "subtle" | null | undefined;
|
|
1436
2434
|
size?: "sm" | "md" | "lg" | null | undefined;
|
|
1437
2435
|
sticky?: boolean | null | undefined;
|
|
1438
2436
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
@@ -2758,4 +3756,4 @@ declare function GradeModeSwitcher({ className, variant }: GradeModeSwitcherProp
|
|
|
2758
3756
|
*/
|
|
2759
3757
|
declare function ThemeToggle(): React$1.JSX.Element;
|
|
2760
3758
|
|
|
2761
|
-
export { ALL_MODES, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AppShell, AppShellAside, type AppShellAsideProps, AppShellFooter, type AppShellFooterProps, AppShellHeader, type AppShellHeaderProps, AppShellMain, type AppShellMainProps, AppShellNav, type AppShellNavProps, type AppShellProps, Avatar, AvatarFallback, AvatarImage, BUILT_IN_INPUTS, Badge, type BaseMediaProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, type BreadcrumbMenuItem, BreadcrumbMenuTrigger, BreadcrumbPage, BreadcrumbSeparator, Button, type ButtonShape, COMPONENT_CONTRACTS, Calendar, CalendarDayButton, Callout, CalloutDescription, CalloutTitle, Card, CardContent, CardDescription, CardFooter, CardHeader, type CardStyle, CardTitle, Carousel, CarouselArrows, type CarouselArrowsProps, type AutoplayConfig as CarouselAutoplayConfig, CarouselDots, type CarouselDotsProps, type CarouselNavButtonProps, CarouselNext, CarouselPrev, type CarouselProps, CarouselSlide, type CarouselSlideProps, CarouselVideoSlide, type CarouselVideoSlideProps, type ChartPalette, Checkbox, type ColorIntensity, DatePicker, type DatePickerProps, DateRangePicker, type DateRangePickerProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FRAGMENT_HEADER, Flex, type FlexProps, type FontKey, GRADE_PRE_HYDRATION_SCRIPT, type GeneratedTheme, GradeModeSwitcher, GradeThemeProvider, type GradeThemeProviderProps, GradeThemeSwitcher, Grid, type GridProps, Input, type InputStyle, Label, LenisProvider, Map, MapHandle, MapMarker, MapMarkerProps, MapProps, type MediaAspect, type MediaRadius, MediaSurface, MediaSurfaceContract, type MediaSurfaceProps, type ModeName, MultiSelect, type MultiSelectOption, type MultiSelectProps, type OKLCHTriplet, type Palette, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, type PostPreset, Progress, RadioGroup, RadioGroupItem, type RadiusStyle, type Ramp, ResizableHandle, ResizablePanel, ResizablePanelGroup, RivePlayer, type RivePlayerProps, Row, type RowProps, type SceneContext, type SceneFactory, type SceneHandle, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, ShaderCompileError, type ShaderPreset, ShaderPresetPicker, type ShaderPresetPickerProps, ShaderPresetPreview, type ShaderPresetPreviewProps, type ShadowIntensity, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, type SidebarContentProps, SidebarFooter, type SidebarFooterProps, SidebarHeader, type SidebarHeaderProps, SidebarItem, type SidebarItemProps, type SidebarProps, SidebarSection, type SidebarSectionProps, SidebarTreeItem, type SidebarTreeItemProps, Skeleton, Slider, Sortable, SortableGroup, type SortableGroupProps, SortableHandle, type SortableHandleProps, SortableItem, type SortableItemProps, type SortableProps, type SpacingDensity, Stack, type StackProps, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, type ThemeInput, ThemeToggle, ThreeScene, type ThreeSceneProps, Toggle, ToggleGroup, ToggleGroupItem, Toolbar, type ToolbarProps, ToolbarSlot, type ToolbarSlotProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type TypeScalePreset, VideoPlayer, type VideoPlayerProps, asideVariants as appShellAsideVariants, footerVariants as appShellFooterVariants, headerVariants as appShellHeaderVariants, mainVariants as appShellMainVariants, navVariants as appShellNavVariants, applyThemeToRoot, badgeVariants, buildFragmentShaderScene, builtInThemes, buttonVariants, calloutVariants, calmInput, cn, defaultPostPreset, defaultThemeId, deleteUserTheme, duplicateTheme, energyInput, flexVariants, generateTheme, getComponentContract, getTheme, gridVariants, listContractedComponents, listThemes, listUserThemes, loadUserThemeInput, postPresets, rowVariants, saveUserTheme, sceneRegistry, shaderPresetById, shaderPresets, shellVariants, stackVariants, themeToCSSVars, toggleVariants, useCarouselApi, useGradeTheme, useMaybeGradeTheme, usePrefersReducedMotion };
|
|
3759
|
+
export { ALL_MODES, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AppShell, AppShellAside, type AppShellAsideProps, AppShellFooter, type AppShellFooterProps, AppShellHeader, type AppShellHeaderProps, AppShellMain, type AppShellMainProps, AppShellNav, type AppShellNavProps, type AppShellProps, Avatar, AvatarFallback, AvatarImage, BUILT_IN_INPUTS, Badge, Banner, type BannerProps, type BaseMediaProps, BlinkingCursor, type BlinkingCursorProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, type BreadcrumbMenuItem, BreadcrumbMenuTrigger, BreadcrumbPage, BreadcrumbSeparator, Button, type ButtonShape, COMPONENT_CONTRACTS, Calendar, CalendarDayButton, Callout, CalloutDescription, CalloutTitle, Card, CardContent, CardDescription, CardFooter, CardHeader, type CardStyle, CardTitle, Carousel, CarouselArrows, type CarouselArrowsProps, type AutoplayConfig as CarouselAutoplayConfig, CarouselDots, type CarouselDotsProps, type CarouselNavButtonProps, CarouselNext, CarouselPrev, type CarouselProps, CarouselSlide, type CarouselSlideProps, CarouselVideoSlide, type CarouselVideoSlideProps, type ChartPalette, Checkbox, Code, type CodeDiff, type CodeLanguage, type CodeProps, type CodeReveal, type CodeTrigger, type ColorIntensity, Composer, type ComposerAttachment, type ComposerAttachmentConfig, type ComposerContent, type ComposerFormat, type ComposerHandle, type ComposerMentionItem, type ComposerProps, ComposerReply, type ComposerStep, type ComposerTriggerConfig, DEMO_SPEED_PRESETS, DatePicker, type DatePickerProps, DateRangePicker, type DateRangePickerProps, type DemoSpeed, DemoStage, type DemoStageProps, type DemoTrigger, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, FRAGMENT_HEADER, Flex, type FlexProps, type FontKey, GRADE_PRE_HYDRATION_SCRIPT, type GeneratedTheme, GradeModeSwitcher, GradeThemeProvider, type GradeThemeProviderProps, GradeThemeSwitcher, Grid, type GridProps, Input, type InputStyle, Label, LenisProvider, Map, MapHandle, MapMarker, MapMarkerProps, MapProps, type MediaAspect, type MediaRadius, MediaSurface, MediaSurfaceContract, type MediaSurfaceProps, Message, type MessageProps, type ModeName, MultiSelect, type MultiSelectOption, type MultiSelectProps, type OKLCHTriplet, type Palette, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, type PostPreset, Progress, RadioGroup, RadioGroupItem, type RadiusStyle, type Ramp, ResizableHandle, ResizablePanel, ResizablePanelGroup, Reveal, type RevealAnimation, type RevealProps, type RevealStep, RivePlayer, type RivePlayerProps, Row, type RowProps, type SceneContext, type SceneFactory, type SceneHandle, type ScriptedDemoContext, type ScriptedDemoState, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, ShaderCompileError, type ShaderPreset, ShaderPresetPicker, type ShaderPresetPickerProps, ShaderPresetPreview, type ShaderPresetPreviewProps, type ShadowIntensity, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, type SidebarContentProps, SidebarFooter, type SidebarFooterProps, SidebarHeader, type SidebarHeaderProps, SidebarItem, type SidebarItemProps, type SidebarProps, SidebarSection, type SidebarSectionProps, SidebarTreeItem, type SidebarTreeItemProps, Skeleton, Slider, Sortable, SortableGroup, type SortableGroupProps, SortableHandle, type SortableHandleProps, SortableItem, type SortableItemProps, type SortableProps, type SpacingDensity, Stack, type StackProps, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, type ThemeInput, ThemeToggle, ThreeScene, type ThreeSceneProps, Toggle, ToggleGroup, ToggleGroupItem, Toolbar, type ToolbarProps, ToolbarSlot, type ToolbarSlotProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type TypeScalePreset, type UseScriptedDemoOptions, VideoPlayer, type VideoPlayerProps, asideVariants as appShellAsideVariants, footerVariants as appShellFooterVariants, headerVariants as appShellHeaderVariants, mainVariants as appShellMainVariants, navVariants as appShellNavVariants, applyThemeToRoot, badgeVariants, bannerVariants, buildFragmentShaderScene, builtInThemes, buttonVariants, calloutVariants, calmInput, cn, defaultPostPreset, defaultThemeId, deleteUserTheme, sleep as demoSleep, typeText as demoTypeText, duplicateTheme, energyInput, flexVariants, generateTheme, getComponentContract, getTheme, gridVariants, listContractedComponents, listThemes, listUserThemes, loadUserThemeInput, postPresets, rowVariants, saveUserTheme, sceneRegistry, shaderPresetById, shaderPresets, shellVariants, stackVariants, themeToCSSVars, toggleVariants, useCarouselApi, useGradeTheme, useMaybeGradeTheme, usePrefersReducedMotion, useScriptedDemo };
|