@inkorange/space-ui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/components/AlertDialog.d.ts +8 -0
- package/dist/components/Badge.d.ts +42 -0
- package/dist/components/Box.d.ts +15 -0
- package/dist/components/Button.d.ts +20 -0
- package/dist/components/Card.d.ts +13 -0
- package/dist/components/Dialog.d.ts +81 -0
- package/dist/components/DropdownMenu.d.ts +62 -0
- package/dist/components/Flex.d.ts +29 -0
- package/dist/components/Grid.d.ts +28 -0
- package/dist/components/Heading.d.ts +28 -0
- package/dist/components/IconToggle.d.ts +29 -0
- package/dist/components/Link.d.ts +22 -0
- package/dist/components/Loader.d.ts +15 -0
- package/dist/components/Progress.d.ts +14 -0
- package/dist/components/RadioGroup.d.ts +32 -0
- package/dist/components/ScrollArea.d.ts +14 -0
- package/dist/components/Select.d.ts +70 -0
- package/dist/components/Separator.d.ts +11 -0
- package/dist/components/Slider.d.ts +28 -0
- package/dist/components/Tabs.d.ts +61 -0
- package/dist/components/Text.d.ts +34 -0
- package/dist/components/TextArea.d.ts +16 -0
- package/dist/components/TextField.d.ts +30 -0
- package/dist/components/Tooltip.d.ts +18 -0
- package/dist/components/icons.d.ts +27 -0
- package/dist/components/propShared.d.ts +11 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +1356 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/seededRandom.d.ts +6 -0
- package/dist/space-ui.css +1 -0
- package/dist/spaceControls.cjs +2 -0
- package/dist/spaceControls.cjs.map +1 -0
- package/dist/spaceControls.js +6 -0
- package/dist/spaceControls.js.map +1 -0
- package/dist/spaceControls.module-Bk7m5-Ag.js +13 -0
- package/dist/spaceControls.module-Bk7m5-Ag.js.map +1 -0
- package/dist/spaceControls.module-yIFvZ0rt.cjs +2 -0
- package/dist/spaceControls.module-yIFvZ0rt.cjs.map +1 -0
- package/dist/styles/spaceControls.d.ts +2 -0
- package/dist/tokens.css +176 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Chris West
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Trigger as DialogTrigger, Close as DialogClose, Content as DialogContent, Title as DialogTitle, Description as DialogDescription } from "./Dialog";
|
|
2
|
+
export declare const Root: ({ open, onOpenChange, children }: import("./Dialog").RootProps) => import("react").JSX.Element;
|
|
3
|
+
export declare const Trigger: typeof DialogTrigger;
|
|
4
|
+
export declare const Content: typeof DialogContent;
|
|
5
|
+
export declare const Title: typeof DialogTitle;
|
|
6
|
+
export declare const Description: typeof DialogDescription;
|
|
7
|
+
export declare const Cancel: typeof DialogClose;
|
|
8
|
+
export declare const Action: typeof DialogClose;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
import { type SpacingProps } from "./propShared";
|
|
4
|
+
/**
|
|
5
|
+
* Roles whose colour carries meaning — status and emphasis.
|
|
6
|
+
*/
|
|
7
|
+
export type BadgeSemanticColor = "muted" | "primary" | "success" | "warning" | "danger";
|
|
8
|
+
/**
|
|
9
|
+
* Categorical hues for telling data apart — star classes, planet types — where
|
|
10
|
+
* the colour distinguishes rather than signals. These deliberately keep hue
|
|
11
|
+
* names: for a categorical scale the hue IS the identity, and calling one
|
|
12
|
+
* "tertiary" would imply a ranking that does not exist.
|
|
13
|
+
*/
|
|
14
|
+
export type BadgeCategoricalColor = "cyan" | "purple" | "orange" | "yellow" | "accent";
|
|
15
|
+
export type BadgeColor = BadgeSemanticColor | BadgeCategoricalColor;
|
|
16
|
+
export interface BadgeProps extends SpacingProps, Omit<React.HTMLAttributes<HTMLSpanElement>, "color"> {
|
|
17
|
+
/** Semantic role or categorical hue. Roles carry meaning — pick one
|
|
18
|
+
* that matches the state, not the look you want.
|
|
19
|
+
*/
|
|
20
|
+
color?: BadgeColor;
|
|
21
|
+
/** `soft` is a tinted wash for dense lists; `solid` is a filled chip
|
|
22
|
+
* for a badge that must win attention.
|
|
23
|
+
*/
|
|
24
|
+
variant?: "soft" | "solid";
|
|
25
|
+
/** 1 is the default chip; 2 is for standalone use away from body text. */
|
|
26
|
+
size?: "1" | "2";
|
|
27
|
+
/** Badges are single-line by default (Radix parity). Long free-text
|
|
28
|
+
* content — e.g. user-named star systems on planet cards — opts into
|
|
29
|
+
* wrapping so it can't overflow its card. */
|
|
30
|
+
wrap?: boolean;
|
|
31
|
+
/** Label text. Keep it short — a badge that wraps stops reading as one. */
|
|
32
|
+
children?: ReactNode;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A compact status label. Colour is the message, so choose it for meaning:
|
|
36
|
+
* the semantic roles say safe, pending or destructive, while the categorical
|
|
37
|
+
* hues only tell one kind of thing from another and carry no judgement.
|
|
38
|
+
*
|
|
39
|
+
* Single-line by default, since a badge that wraps stops reading as a badge.
|
|
40
|
+
* Opt into `wrap` for free text you do not control.
|
|
41
|
+
*/
|
|
42
|
+
export declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
import { type SpacingProps } from "./propShared";
|
|
4
|
+
export interface BoxProps extends SpacingProps, React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/** Anything. Box adds no styling of its own. */
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A plain div that understands the spacing scale. The escape hatch for when
|
|
10
|
+
* you need margin or padding on the grid but no layout behaviour with it.
|
|
11
|
+
*
|
|
12
|
+
* Renders nothing of its own — no class, no styling — so it never interferes
|
|
13
|
+
* with whatever you put inside.
|
|
14
|
+
*/
|
|
15
|
+
export declare const Box: React.ForwardRefExoticComponent<BoxProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
2
|
+
/** Circular, icon-only sizing (e.g. the share glyph). */
|
|
3
|
+
iconOnly?: boolean;
|
|
4
|
+
/** Warm red-dwarf rim for destructive-ish actions (e.g. Clear). */
|
|
5
|
+
ember?: boolean;
|
|
6
|
+
/** md = default. lg = hero CTAs. sm = compact dialog actions. micro = tiny steppers (no stars/glint). */
|
|
7
|
+
size?: "sm" | "md" | "lg" | "micro";
|
|
8
|
+
/** Stretch to the container width (sticky footers). */
|
|
9
|
+
fullWidth?: boolean;
|
|
10
|
+
/** Ambient motion: the orbiting rim, the glint sweep, and the twinkling
|
|
11
|
+
* stars. Set false for dense UI or long lists where the movement
|
|
12
|
+
* distracts. The glass look itself is not optional. Default true. */
|
|
13
|
+
animated?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* "Limb-lit glass" button: cosmic glass capsule whose rim glows like a planet's
|
|
17
|
+
* sunlit atmosphere limb, with twinkling stars inside and a periodic glint
|
|
18
|
+
* sweep. Plain <button>, so it composes with Radix Dialog.Trigger (Slot).
|
|
19
|
+
*/
|
|
20
|
+
export declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
import { type SpacingProps } from "./propShared";
|
|
4
|
+
export interface CardProps extends SpacingProps, React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/** The card's contents. */
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A translucent panel for grouping related content, one step above the page
|
|
10
|
+
* surface. Its 12px inset is a deliberate exception to the 8pt grid, kept for
|
|
11
|
+
* parity with the app this was extracted from.
|
|
12
|
+
*/
|
|
13
|
+
export declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
import { type HeadingProps } from "./Heading";
|
|
4
|
+
import { type TextProps } from "./Text";
|
|
5
|
+
export interface DialogCtx {
|
|
6
|
+
open: boolean;
|
|
7
|
+
setOpen: (o: boolean) => void;
|
|
8
|
+
titleId: string;
|
|
9
|
+
descId: string;
|
|
10
|
+
/** alert dialogs: no backdrop light-dismiss */
|
|
11
|
+
alert?: boolean;
|
|
12
|
+
/** whether a Description is currently mounted (drives aria-describedby) */
|
|
13
|
+
hasDesc: boolean;
|
|
14
|
+
setHasDesc: (v: boolean) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const useDialog: () => DialogCtx;
|
|
17
|
+
export interface RootProps {
|
|
18
|
+
/** Controls the dialog. Omit both this and onOpenChange to let the dialog
|
|
19
|
+
* manage its own state. */
|
|
20
|
+
open?: boolean;
|
|
21
|
+
/** Called whenever the dialog opens or closes, including via Escape or a
|
|
22
|
+
* backdrop click. */
|
|
23
|
+
onOpenChange?: (o: boolean) => void;
|
|
24
|
+
/** A Trigger and a Content. */
|
|
25
|
+
children?: ReactNode;
|
|
26
|
+
}
|
|
27
|
+
/** Shared by Dialog.Root and AlertDialog.Root (alert flag differs). */
|
|
28
|
+
export declare function makeRoot(alert: boolean): ({ open, onOpenChange, children }: RootProps) => React.JSX.Element;
|
|
29
|
+
/**
|
|
30
|
+
* Owns a dialog's open state. Works controlled via `open`/`onOpenChange`, or
|
|
31
|
+
* uncontrolled if you pass neither.
|
|
32
|
+
*
|
|
33
|
+
* Renders nothing itself — it only provides context, so Trigger and Content
|
|
34
|
+
* can sit anywhere beneath it in the tree.
|
|
35
|
+
*/
|
|
36
|
+
export declare const Root: ({ open, onOpenChange, children }: RootProps) => React.JSX.Element;
|
|
37
|
+
/**
|
|
38
|
+
* Opens the dialog. Chains onto its child's existing click handler rather
|
|
39
|
+
* than replacing it, and renders no element of its own — so the child stays
|
|
40
|
+
* whatever it already was, button or otherwise.
|
|
41
|
+
*/
|
|
42
|
+
export declare function Trigger({ children, }: {
|
|
43
|
+
/** The control that opens the dialog. Its own onClick still fires. */
|
|
44
|
+
children?: ReactNode;
|
|
45
|
+
}): React.JSX.Element;
|
|
46
|
+
/**
|
|
47
|
+
* Closes the dialog. Same shape as Trigger: wraps its child, adds a close on
|
|
48
|
+
* click, and adds no markup.
|
|
49
|
+
*/
|
|
50
|
+
export declare function Close({ children, }: {
|
|
51
|
+
/** The control that closes the dialog. Its own onClick still fires. */
|
|
52
|
+
children?: ReactNode;
|
|
53
|
+
}): React.JSX.Element;
|
|
54
|
+
export interface ContentProps extends React.HTMLAttributes<HTMLDialogElement> {
|
|
55
|
+
/** Padding and radius step. 4 is roomier, for dialogs carrying a form. */
|
|
56
|
+
size?: "3" | "4";
|
|
57
|
+
/** Caps the dialog's width, e.g. "480px". Without it the dialog uses its
|
|
58
|
+
* own default and grows with its content. */
|
|
59
|
+
maxWidth?: string;
|
|
60
|
+
/** Dialog contents. Include a Title — it is the accessible name. */
|
|
61
|
+
children?: ReactNode;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The dialog surface. Built on the native `<dialog>` element, so the browser
|
|
65
|
+
* supplies the top layer, focus trapping and Escape handling rather than the
|
|
66
|
+
* library reimplementing them.
|
|
67
|
+
*
|
|
68
|
+
* Dismissible by Escape or a click on the backdrop; AlertDialog's Content
|
|
69
|
+
* deliberately is not.
|
|
70
|
+
*/
|
|
71
|
+
export declare function Content({ size, maxWidth, className, style, children, ...rest }: ContentProps): React.JSX.Element;
|
|
72
|
+
/**
|
|
73
|
+
* The dialog's accessible name. Wire one up for every dialog — it is what a
|
|
74
|
+
* screen reader announces when the dialog opens.
|
|
75
|
+
*/
|
|
76
|
+
export declare function Title({ className, ...rest }: HeadingProps): React.JSX.Element;
|
|
77
|
+
/**
|
|
78
|
+
* Supporting copy beneath the title, registered as the dialog's accessible
|
|
79
|
+
* description. Optional, and only announced when present.
|
|
80
|
+
*/
|
|
81
|
+
export declare function Description(props: TextProps): React.JSX.Element;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Owns a menu's open state and closes it on an outside click or Escape.
|
|
5
|
+
* Renders nothing of its own.
|
|
6
|
+
*/
|
|
7
|
+
export declare function Root({ children, }: {
|
|
8
|
+
/** A Trigger and a Content. */
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
}): React.JSX.Element;
|
|
11
|
+
/**
|
|
12
|
+
* The control that opens the menu, and the element the menu is positioned
|
|
13
|
+
* against. Wraps its child rather than rendering a button of its own.
|
|
14
|
+
*/
|
|
15
|
+
export declare function Trigger({ children, }: {
|
|
16
|
+
/** The control that opens the menu, and what the menu anchors to. */
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
}): React.ReactElement<Record<string, unknown>, string | React.JSXElementConstructor<any>> | null;
|
|
19
|
+
/**
|
|
20
|
+
* The menu surface, anchored to the trigger and aligned to its start or end
|
|
21
|
+
* edge. Owns the keyboard model: arrows move between items, Escape closes and
|
|
22
|
+
* returns focus to the trigger.
|
|
23
|
+
*/
|
|
24
|
+
export declare function Content({ align, children, }: {
|
|
25
|
+
/** Which edge of the trigger the menu lines up with. Use `end` when the
|
|
26
|
+
* trigger sits near the right edge and the menu would overflow. */
|
|
27
|
+
align?: "start" | "end";
|
|
28
|
+
/** Items, Labels and Separators. */
|
|
29
|
+
children?: ReactNode;
|
|
30
|
+
}): React.JSX.Element;
|
|
31
|
+
/**
|
|
32
|
+
* A non-interactive heading for a group of items. Skipped by arrow-key
|
|
33
|
+
* navigation, since there is nothing to activate.
|
|
34
|
+
*/
|
|
35
|
+
export declare function Label({ children, }: {
|
|
36
|
+
/** Heading text for the group beneath it. Not focusable. */
|
|
37
|
+
children?: ReactNode;
|
|
38
|
+
}): React.JSX.Element;
|
|
39
|
+
export interface ItemProps {
|
|
40
|
+
/** Render the child element instead of the default item — for a link that
|
|
41
|
+
* should stay an anchor rather than becoming a button. */
|
|
42
|
+
asChild?: boolean;
|
|
43
|
+
/** Marks a destructive action, so it reads differently before it is
|
|
44
|
+
* chosen rather than after. */
|
|
45
|
+
color?: "danger";
|
|
46
|
+
/** Runs when the item is chosen; the menu closes either way. */
|
|
47
|
+
onSelect?: () => void | Promise<void>;
|
|
48
|
+
/** The item's label. */
|
|
49
|
+
children?: ReactNode;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* One menu action. `onSelect` fires and the menu closes.
|
|
53
|
+
*
|
|
54
|
+
* Pass `color="danger"` for a destructive action so it reads differently from
|
|
55
|
+
* its neighbours before it is chosen, not after.
|
|
56
|
+
*/
|
|
57
|
+
export declare function Item({ asChild, color, onSelect, children }: ItemProps): React.JSX.Element;
|
|
58
|
+
/**
|
|
59
|
+
* A rule between groups of items — for separating a destructive action from
|
|
60
|
+
* routine ones, so the two are not adjacent to a moving cursor.
|
|
61
|
+
*/
|
|
62
|
+
export declare function Separator(): React.JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
import { type SpacingProps } from "./propShared";
|
|
4
|
+
export interface FlexProps extends SpacingProps, React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/** Render the single child element instead of a wrapper div, merging
|
|
6
|
+
* the flex styling onto it. Avoids a redundant layer in the DOM. */
|
|
7
|
+
asChild?: boolean;
|
|
8
|
+
/** Gap step: 1=4px, 2=8px, 3=12px, 4=16px, 5=24px, 6=32px. Note step 3
|
|
9
|
+
* is 12px — off the 8pt grid, kept for parity with the shipped app. */
|
|
10
|
+
gap?: "1" | "2" | "3" | "4" | "5" | "6";
|
|
11
|
+
/** Main axis. Default `row`. */
|
|
12
|
+
direction?: "row" | "column";
|
|
13
|
+
/** Cross-axis alignment (`align-items`). */
|
|
14
|
+
align?: "start" | "center" | "end" | "baseline" | "stretch";
|
|
15
|
+
/** Main-axis distribution (`justify-content`). */
|
|
16
|
+
justify?: "start" | "center" | "end" | "between";
|
|
17
|
+
/** Wrapping behaviour. Default is the browser's `nowrap`. */
|
|
18
|
+
wrap?: "wrap" | "nowrap";
|
|
19
|
+
/** The items to lay out. */
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A flex row or column whose gap comes from the spacing scale, so layouts
|
|
24
|
+
* inherit the 8pt grid instead of restating it in pixels.
|
|
25
|
+
*
|
|
26
|
+
* `asChild` merges the layout onto its only child rather than adding a
|
|
27
|
+
* wrapper, for when an extra div would break a grid or a selector.
|
|
28
|
+
*/
|
|
29
|
+
export declare const Flex: React.ForwardRefExoticComponent<FlexProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
import { type SpacingProps } from "./propShared";
|
|
4
|
+
type Cols = "1" | "2" | "3";
|
|
5
|
+
export interface GridProps extends SpacingProps, React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
/** Column count, 1–3. Pass an object for responsive counts:
|
|
7
|
+
* `{ initial: "1", sm: "2", md: "3" }` — `initial` applies below the
|
|
8
|
+
* first breakpoint. */
|
|
9
|
+
columns?: Cols | {
|
|
10
|
+
initial?: Cols;
|
|
11
|
+
sm?: Cols;
|
|
12
|
+
md?: Cols;
|
|
13
|
+
};
|
|
14
|
+
/** Gap step: 1=4px, 2=8px, 3=12px, 4=16px, 5=24px, 6=32px. Same scale
|
|
15
|
+
* as Flex. */
|
|
16
|
+
gap?: "1" | "2" | "3" | "4" | "5" | "6";
|
|
17
|
+
/** The cells. */
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A simple column grid, 1-3 wide, with the same gap scale as Flex. Pass an
|
|
22
|
+
* object to `columns` for responsive counts.
|
|
23
|
+
*
|
|
24
|
+
* Deliberately narrow: anything more elaborate is a job for CSS grid directly
|
|
25
|
+
* rather than a prop API that would end up reinventing it.
|
|
26
|
+
*/
|
|
27
|
+
export declare const Grid: React.ForwardRefExoticComponent<GridProps & React.RefAttributes<HTMLDivElement>>;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
import { type SpacingProps } from "./propShared";
|
|
4
|
+
export interface HeadingProps extends SpacingProps, Omit<React.HTMLAttributes<HTMLHeadingElement>, "color"> {
|
|
5
|
+
/** Heading level to render. Default `h2`. Independent of `size`, so
|
|
6
|
+
* document outline stays correct without dictating appearance. */
|
|
7
|
+
as?: "h1" | "h2" | "h3" | "h4";
|
|
8
|
+
/** Font size step: 4=18px, 5=20px, 6=24px, 7=28px, 8=35px, 9=60px.
|
|
9
|
+
* Shares steps 4–6 with Text, so a Heading and Text can sit on the
|
|
10
|
+
* same line and match. */
|
|
11
|
+
size?: "4" | "5" | "6" | "7" | "8" | "9";
|
|
12
|
+
/** Semantic colour role. Omit for primary heading colour. */
|
|
13
|
+
color?: "muted" | "danger";
|
|
14
|
+
/** Centres the text. There is no `left`/`right` — headings are
|
|
15
|
+
* start-aligned unless deliberately centred. */
|
|
16
|
+
align?: "center";
|
|
17
|
+
/** The heading text. */
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A section heading. `as` sets the heading level and `size` sets the
|
|
22
|
+
* appearance, deliberately apart — so a visually small heading can still be
|
|
23
|
+
* an h2 where the document structure calls for one.
|
|
24
|
+
*
|
|
25
|
+
* Shares size steps 4-6 with Text, so a heading and body copy on the same
|
|
26
|
+
* line align.
|
|
27
|
+
*/
|
|
28
|
+
export declare const Heading: React.ForwardRefExoticComponent<HeadingProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export interface IconToggleOption<V extends string> {
|
|
3
|
+
value: V;
|
|
4
|
+
icon: ReactNode;
|
|
5
|
+
/** Used for aria-label and the hover tooltip. */
|
|
6
|
+
label: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A segmented icon toggle: every option is always visible in one pill, the
|
|
10
|
+
* selected one reads as active, clicking any option selects it. Built for the
|
|
11
|
+
* scene view switcher (planet / orrery / surface), where the old pattern —
|
|
12
|
+
* showing only the views you are NOT on and swapping icons on click — made
|
|
13
|
+
* the control's meaning flip under the cursor (owner: both icons should be
|
|
14
|
+
* "always visible, the selected one is the active one"). Generic over the
|
|
15
|
+
* option set so other icon-mode switchers can reuse it.
|
|
16
|
+
*/
|
|
17
|
+
export declare function IconToggle<V extends string>({ options, value, onValueChange, className, }: {
|
|
18
|
+
/** The segments, in display order. Every option is always visible —
|
|
19
|
+
* this is a segmented control, not a menu.
|
|
20
|
+
*/
|
|
21
|
+
options: IconToggleOption<V>[];
|
|
22
|
+
/** The selected option's value. Fully controlled. */
|
|
23
|
+
value: V;
|
|
24
|
+
/** Called with the newly selected value. Not called when the already
|
|
25
|
+
* selected option is clicked. */
|
|
26
|
+
onValueChange(next: V): void;
|
|
27
|
+
/** Merged onto the group wrapper. */
|
|
28
|
+
className?: string;
|
|
29
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
import { type SpacingProps } from "./propShared";
|
|
4
|
+
export interface LinkProps extends SpacingProps, Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "color"> {
|
|
5
|
+
/** Render the single child element instead of an `<a>`, merging link
|
|
6
|
+
* styling onto it. For wrapping a router's own Link component without
|
|
7
|
+
* nesting two anchors. */
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
/** Font size step: 1=12px, 2=14px, 3=16px. Matches Text's first three
|
|
10
|
+
* steps so inline links sit flush with surrounding copy. */
|
|
11
|
+
size?: "1" | "2" | "3";
|
|
12
|
+
/** Link text. With `asChild`, the single element to style as a link. */
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* An inline anchor, styled to sit inside running text without disturbing its
|
|
17
|
+
* rhythm. Sizes match Text's first three steps.
|
|
18
|
+
*
|
|
19
|
+
* Use `asChild` to wrap a router's own link component rather than nesting two
|
|
20
|
+
* anchors, which is invalid and breaks keyboard navigation.
|
|
21
|
+
*/
|
|
22
|
+
export declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface LoaderProps {
|
|
2
|
+
/** sm = inline/compact spots. md = default. lg = full-panel takeovers. */
|
|
3
|
+
size?: "sm" | "md" | "lg";
|
|
4
|
+
/** Visible caption under the spinner; also doubles as the accessible name. */
|
|
5
|
+
label?: string;
|
|
6
|
+
/** Merged onto the wrapper. */
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Orbital spinner: a small pulsing "planet" disc at the center of a static
|
|
11
|
+
* ring, with a "moon" dot traveling the ring. Dependency-free CSS animation
|
|
12
|
+
* so it composes cleanly wherever a lazy chunk or async panel needs a
|
|
13
|
+
* space-themed loading state (see SurfaceView's dynamic-import loader).
|
|
14
|
+
*/
|
|
15
|
+
export declare function Loader({ size, label, className }: LoaderProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
export interface ProgressProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/** Current progress, clamped between 0 and `max`. */
|
|
4
|
+
value: number;
|
|
5
|
+
/** The value representing complete. */
|
|
6
|
+
max?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A determinate bar for work you can measure — use Loader when you cannot.
|
|
10
|
+
*
|
|
11
|
+
* Speaks the same visual language as Slider, because a progress bar and a
|
|
12
|
+
* slider track are the same object: one you watch, one you drag.
|
|
13
|
+
*/
|
|
14
|
+
export declare function Progress({ value, max, className, style, ...rest }: ProgressProps): React.JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
export interface RootProps {
|
|
4
|
+
/** The selected item's value. Fully controlled. */
|
|
5
|
+
value: string;
|
|
6
|
+
/** Called with the newly selected value. */
|
|
7
|
+
onValueChange: (v: string) => void;
|
|
8
|
+
/** Disables every item at once. */
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/** Merged onto the group wrapper. */
|
|
11
|
+
className?: string;
|
|
12
|
+
/** The Items. */
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A single-choice control for short lists, where seeing every option at once
|
|
17
|
+
* matters more than saving space. Reach for Select when it does not.
|
|
18
|
+
*/
|
|
19
|
+
export declare function Root({ value, onValueChange, disabled, className, children }: RootProps): React.JSX.Element;
|
|
20
|
+
export interface ItemProps {
|
|
21
|
+
/** Reported to the group's onValueChange when chosen. */
|
|
22
|
+
value: string;
|
|
23
|
+
/** Disables this option only. */
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
/** The option's label. Part of the click target, not merely beside it. */
|
|
26
|
+
children?: ReactNode;
|
|
27
|
+
}
|
|
28
|
+
/** With children: self-labeling (<label> wraps input+orb+children) — the
|
|
29
|
+
* SaveShareDialog pattern. Without children: emits a bare span so an
|
|
30
|
+
* OUTER label (ConfigurationPanel's <Text as="label">) owns association —
|
|
31
|
+
* nesting labels would be invalid HTML. */
|
|
32
|
+
export declare function Item({ value, disabled, children }: ItemProps): React.JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
export interface ScrollAreaProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/** The scrollable content. */
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A region that scrolls independently of the page, with the scrollbar styled
|
|
9
|
+
* to match the dark surface rather than the browser default.
|
|
10
|
+
*
|
|
11
|
+
* Needs a bounded height from its parent or its context — without one there
|
|
12
|
+
* is nothing to scroll against.
|
|
13
|
+
*/
|
|
14
|
+
export declare const ScrollArea: React.ForwardRefExoticComponent<ScrollAreaProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
export interface RootProps {
|
|
4
|
+
/** The selected item's value. Fully controlled. */
|
|
5
|
+
value: string;
|
|
6
|
+
/** Called with the newly selected value. */
|
|
7
|
+
onValueChange: (v: string) => void;
|
|
8
|
+
/** Blocks the trigger and removes it from the tab order. */
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/** A Trigger and a Content. */
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A single-choice menu for lists too long to show inline. Fully controlled.
|
|
15
|
+
*
|
|
16
|
+
* Reads its options at render time rather than through effects, so the
|
|
17
|
+
* trigger shows the right label on first paint and under SSR.
|
|
18
|
+
*/
|
|
19
|
+
export declare function Root({ value, onValueChange, disabled, children }: RootProps): React.JSX.Element;
|
|
20
|
+
export interface TriggerProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "value"> {
|
|
21
|
+
/** Shown when nothing is selected. Counts toward the trigger's width,
|
|
22
|
+
* so selecting an option never resizes it.
|
|
23
|
+
*/
|
|
24
|
+
placeholder?: string;
|
|
25
|
+
/** Ambient motion: the lit arc orbiting the rim. The glass skin itself
|
|
26
|
+
* is always applied. Default true. */
|
|
27
|
+
animated?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The closed state of the Select, showing the selected item's own content.
|
|
31
|
+
*
|
|
32
|
+
* Sizes itself to its widest option, so it never changes width as you select
|
|
33
|
+
* — capped by `--sp-select-trigger-max-width`, past which the label
|
|
34
|
+
* ellipsizes.
|
|
35
|
+
*/
|
|
36
|
+
export declare function Trigger({ placeholder, animated, className, ...rest }: TriggerProps): React.JSX.Element;
|
|
37
|
+
export interface ContentProps {
|
|
38
|
+
/** Merged with the panel's own classes. */
|
|
39
|
+
className?: string;
|
|
40
|
+
/** Accepted for Radix call-site compatibility ("popper" everywhere);
|
|
41
|
+
* our listbox is always trigger-anchored. */
|
|
42
|
+
position?: string;
|
|
43
|
+
/** Ambient motion on the panel rim. Default true. */
|
|
44
|
+
animated?: boolean;
|
|
45
|
+
/** The Items. */
|
|
46
|
+
children?: ReactNode;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The option panel. Always mounted but hidden while closed, so the trigger
|
|
50
|
+
* can read its labels for sizing.
|
|
51
|
+
*
|
|
52
|
+
* Never narrower than the trigger, and grows to fit the longest option so
|
|
53
|
+
* labels only wrap when they truly must.
|
|
54
|
+
*/
|
|
55
|
+
export declare function Content({ className, position: _position, animated, children }: ContentProps): React.JSX.Element;
|
|
56
|
+
export interface ItemProps {
|
|
57
|
+
/** Reported to onValueChange when chosen. */
|
|
58
|
+
value: string;
|
|
59
|
+
/** Skipped by keyboard navigation and not selectable. Still contributes
|
|
60
|
+
* its width to the trigger's sizing. */
|
|
61
|
+
disabled?: boolean;
|
|
62
|
+
/** Shown in the panel and, once selected, in the trigger — so it has to
|
|
63
|
+
* read correctly in both places. */
|
|
64
|
+
children?: ReactNode;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* One option. Its children are what the trigger displays once selected, so
|
|
68
|
+
* anything rendered here has to read correctly in both places.
|
|
69
|
+
*/
|
|
70
|
+
export declare function Item({ value, disabled, children }: ItemProps): React.JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
export interface SeparatorProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
3
|
+
/** Length of the rule, 1 (shortest) to 4 (full width of its container). */
|
|
4
|
+
size?: "1" | "2" | "3" | "4";
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* A hairline rule for dividing content within a surface, where a full panel
|
|
8
|
+
* boundary would be too heavy. Exposed as `role="separator"`, so assistive
|
|
9
|
+
* technology hears the division too.
|
|
10
|
+
*/
|
|
11
|
+
export declare const Separator: React.ForwardRefExoticComponent<SeparatorProps & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
export interface SliderProps {
|
|
3
|
+
/** Current value, as a single-element array. Fully controlled. */
|
|
4
|
+
value: number[];
|
|
5
|
+
/** Called with the new value array as the thumb moves. */
|
|
6
|
+
onValueChange: (v: number[]) => void;
|
|
7
|
+
/** Lower bound. */
|
|
8
|
+
min: number;
|
|
9
|
+
/** Upper bound. */
|
|
10
|
+
max: number;
|
|
11
|
+
/** Smallest increment the thumb can move by. */
|
|
12
|
+
step: number;
|
|
13
|
+
/** Blocks interaction and removes it from the tab order. */
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/** Merged onto the wrapper. */
|
|
16
|
+
className?: string;
|
|
17
|
+
/** Accessible name. Required unless a visible label references it,
|
|
18
|
+
* since a slider has no text of its own.
|
|
19
|
+
*/
|
|
20
|
+
"aria-label"?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A range control for a continuous value.
|
|
24
|
+
*
|
|
25
|
+
* Takes and returns an array so multiple thumbs can be added later without a
|
|
26
|
+
* breaking change, even though it renders one today.
|
|
27
|
+
*/
|
|
28
|
+
export declare const Slider: React.ForwardRefExoticComponent<SliderProps & React.RefAttributes<HTMLInputElement>>;
|