@inkorange/space-ui 1.0.4 → 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/README.md +9 -12
- package/dist/components/AlertDialog.d.ts +17 -8
- package/dist/components/Card.d.ts +13 -0
- package/dist/components/Dialog.d.ts +12 -12
- package/dist/components/DropdownMenu.d.ts +30 -28
- package/dist/components/Message.d.ts +33 -0
- package/dist/components/RadioGroup.d.ts +17 -9
- package/dist/components/Select.d.ts +30 -47
- package/dist/components/Tabs.d.ts +21 -14
- package/dist/components/TextField.d.ts +6 -10
- package/dist/components/icons.d.ts +3 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +8 -8
- package/dist/index.js +913 -886
- package/dist/index.js.map +1 -1
- package/dist/space-ui.css +1 -1
- package/dist/tokens.css +16 -0
- package/package.json +1 -1
- package/dist/components/ScrollArea.d.ts +0 -14
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@inkorange/space-ui)
|
|
6
6
|

|
|
7
|
-

|
|
8
8
|

|
|
9
9
|
[](https://space-components.vercel.app)
|
|
10
10
|
|
|
@@ -18,7 +18,7 @@ compose and nothing to opt into.
|
|
|
18
18
|
resolve against the registry rather than the repository. This sheet is a
|
|
19
19
|
screenshot of the real components, shot from the gallery — see
|
|
20
20
|
`pnpm assets`. -->
|
|
21
|
-
<img alt="Stickersheet: Button, Badge, Select, TextField, Slider, Progress, IconToggle, RadioGroup, Loader, Tabs, icons, Text, TextArea
|
|
21
|
+
<img alt="Stickersheet: Button, Badge, Select, TextField, Slider, Progress, IconToggle, RadioGroup, Loader, Tabs, icons, Text, TextArea and Card — plain and with an image — and a Message banner on a dark ground"
|
|
22
22
|
src="https://raw.githubusercontent.com/inkorange/space-ui/main/.github/assets/components.jpg"
|
|
23
23
|
width="100%">
|
|
24
24
|
|
|
@@ -75,14 +75,11 @@ screen at once — the kind of interface where someone is adjusting values and
|
|
|
75
75
|
watching something respond.
|
|
76
76
|
|
|
77
77
|
```tsx
|
|
78
|
-
<Select
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
))}
|
|
84
|
-
</Select.Content>
|
|
85
|
-
</Select.Root>
|
|
78
|
+
<Select value={star} onValueChange={setStar}>
|
|
79
|
+
{types.map((t) => (
|
|
80
|
+
<Select.Item key={t} value={t}>{t}-type star</Select.Item>
|
|
81
|
+
))}
|
|
82
|
+
</Select>
|
|
86
83
|
```
|
|
87
84
|
|
|
88
85
|
The small things are handled so you never have to notice them. That Select
|
|
@@ -165,10 +162,10 @@ it exposes.
|
|
|
165
162
|
| | |
|
|
166
163
|
| --- | --- |
|
|
167
164
|
| **Typography** | [Text](https://space-components.vercel.app/?story=components--typography--text-sizes) · [Link](https://space-components.vercel.app/?story=components--typography--text-sizes) · [Heading](https://space-components.vercel.app/?story=components--typography--headings) · [Badge](https://space-components.vercel.app/?story=components--typography--badges) · [Separator](https://space-components.vercel.app/?story=components--typography--separator) |
|
|
168
|
-
| **Layout** | [Card](https://space-components.vercel.app/?story=components--layout--card) · [Flex](https://space-components.vercel.app/?story=components--layout--flex-and-grid) · [Grid](https://space-components.vercel.app/?story=components--layout--flex-and-grid) · [Box](https://space-components.vercel.app/?story=components--layout--flex-and-grid)
|
|
165
|
+
| **Layout** | [Card](https://space-components.vercel.app/?story=components--layout--card) · [Flex](https://space-components.vercel.app/?story=components--layout--flex-and-grid) · [Grid](https://space-components.vercel.app/?story=components--layout--flex-and-grid) · [Box](https://space-components.vercel.app/?story=components--layout--flex-and-grid) |
|
|
169
166
|
| **Forms** | [TextField](https://space-components.vercel.app/?story=components--forms--text-field) · [TextArea](https://space-components.vercel.app/?story=components--forms--text-area) · [Select](https://space-components.vercel.app/?story=components--forms--select) · [Slider](https://space-components.vercel.app/?story=components--forms--slider) · [RadioGroup](https://space-components.vercel.app/?story=components--forms--radio-group) |
|
|
170
167
|
| **Buttons** | [Button](https://space-components.vercel.app/?story=components--buttons--buttons) · [IconToggle](https://space-components.vercel.app/?story=components--buttons--icon-toggle) |
|
|
171
|
-
| **Feedback** | [Loader](https://space-components.vercel.app/?story=components--
|
|
168
|
+
| **Feedback** | [Loader](https://space-components.vercel.app/?story=components--feedback--loader) · [Progress](https://space-components.vercel.app/?story=components--feedback--progress) · [Message](https://space-components.vercel.app/?story=components--feedback--message) |
|
|
172
169
|
| **Overlays** | [Dialog](https://space-components.vercel.app/?story=components--overlays--dialog) · [AlertDialog](https://space-components.vercel.app/?story=components--overlays--alert-dialog) · [DropdownMenu](https://space-components.vercel.app/?story=components--overlays--dropdown-menu) · [Tabs](https://space-components.vercel.app/?story=components--overlays--tabs) · [Tooltip](https://space-components.vercel.app/?story=components--overlays--tooltip) |
|
|
173
170
|
| **Icons** | [20 icons](https://space-components.vercel.app/?story=components--icons--all-icons) |
|
|
174
171
|
| **Foundations** | [Color](https://space-components.vercel.app/?story=foundations--color) · [Spacing](https://space-components.vercel.app/?story=foundations--spacing) · [Type scale](https://space-components.vercel.app/?story=foundations--type-scale) · [Motion](https://space-components.vercel.app/?story=foundations--motion) · [Token usage](https://space-components.vercel.app/?story=foundations--token-usage) |
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
-
import { Trigger
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { Trigger, Close, Content, Title, Description, type DialogProps } from "./Dialog";
|
|
2
|
+
export type { DialogProps as AlertDialogProps };
|
|
3
|
+
/**
|
|
4
|
+
* A modal that interrupts to confirm something consequential.
|
|
5
|
+
*
|
|
6
|
+
* Unlike a Dialog it has no backdrop dismissal, because dismissing an alert
|
|
7
|
+
* by missing it is not a decision. Put `Cancel` before `Action` so the safe
|
|
8
|
+
* choice takes focus when it opens.
|
|
9
|
+
*/
|
|
10
|
+
export declare const AlertDialog: (({ open, onOpenChange, children }: DialogProps) => import("react").JSX.Element) & {
|
|
11
|
+
Trigger: typeof Trigger;
|
|
12
|
+
Content: typeof Content;
|
|
13
|
+
Title: typeof Title;
|
|
14
|
+
Description: typeof Description;
|
|
15
|
+
Cancel: typeof Close;
|
|
16
|
+
Action: typeof Close;
|
|
17
|
+
};
|
|
@@ -2,6 +2,15 @@ import type * as React from "react";
|
|
|
2
2
|
import { type ReactNode } from "react";
|
|
3
3
|
import { type SpacingProps } from "./propShared";
|
|
4
4
|
export interface CardProps extends SpacingProps, React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/** A media element to sit at the top of the card, full-bleed to its edges.
|
|
6
|
+
* Pass whatever your framework renders — a plain `<img>`, a `next/image`,
|
|
7
|
+
* a `<video>` — and the card frames it: cropped to fill, top corners
|
|
8
|
+
* matched to its own radius, and a reserved box so the layout does not
|
|
9
|
+
* jump when it loads.
|
|
10
|
+
*
|
|
11
|
+
* The reserved box is `--sp-card-image-ratio` (default `16 / 10`). Set it
|
|
12
|
+
* per card for a different crop. */
|
|
13
|
+
image?: ReactNode;
|
|
5
14
|
/** The card's contents. */
|
|
6
15
|
children?: ReactNode;
|
|
7
16
|
}
|
|
@@ -9,5 +18,9 @@ export interface CardProps extends SpacingProps, React.HTMLAttributes<HTMLDivEle
|
|
|
9
18
|
* A translucent panel for grouping related content, one step above the page
|
|
10
19
|
* surface. Its 12px inset is a deliberate exception to the 8pt grid, kept for
|
|
11
20
|
* parity with the app this was extracted from.
|
|
21
|
+
*
|
|
22
|
+
* Pass `image` for a media card. The image is framed by the card rather than
|
|
23
|
+
* being an ordinary child, so every card in a row reserves the same box
|
|
24
|
+
* before its image loads and none of them reflow when it does.
|
|
12
25
|
*/
|
|
13
26
|
export declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -14,26 +14,19 @@ export interface DialogCtx {
|
|
|
14
14
|
setHasDesc: (v: boolean) => void;
|
|
15
15
|
}
|
|
16
16
|
export declare const useDialog: () => DialogCtx;
|
|
17
|
-
export interface
|
|
17
|
+
export interface DialogProps {
|
|
18
18
|
/** Controls the dialog. Omit both this and onOpenChange to let the dialog
|
|
19
19
|
* manage its own state. */
|
|
20
20
|
open?: boolean;
|
|
21
21
|
/** Called whenever the dialog opens or closes, including via Escape or a
|
|
22
22
|
* backdrop click. */
|
|
23
23
|
onOpenChange?: (o: boolean) => void;
|
|
24
|
-
/** A Trigger and a Content
|
|
24
|
+
/** A `Trigger` and a `Content`, in any arrangement — this renders
|
|
25
|
+
* nothing itself, so they can sit anywhere beneath it. */
|
|
25
26
|
children?: ReactNode;
|
|
26
27
|
}
|
|
27
|
-
/** Shared by Dialog
|
|
28
|
-
export declare function makeRoot(alert: boolean): ({ open, onOpenChange, children }:
|
|
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;
|
|
28
|
+
/** Shared by Dialog and AlertDialog; only the alert flag differs. */
|
|
29
|
+
export declare function makeRoot(alert: boolean): ({ open, onOpenChange, children }: DialogProps) => React.JSX.Element;
|
|
37
30
|
/**
|
|
38
31
|
* Opens the dialog. Chains onto its child's existing click handler rather
|
|
39
32
|
* than replacing it, and renders no element of its own — so the child stays
|
|
@@ -79,3 +72,10 @@ export declare function Title({ className, ...rest }: HeadingProps): React.JSX.E
|
|
|
79
72
|
* description. Optional, and only announced when present.
|
|
80
73
|
*/
|
|
81
74
|
export declare function Description(props: TextProps): React.JSX.Element;
|
|
75
|
+
export declare const Dialog: (({ open, onOpenChange, children }: DialogProps) => React.JSX.Element) & {
|
|
76
|
+
Trigger: typeof Trigger;
|
|
77
|
+
Close: typeof Close;
|
|
78
|
+
Content: typeof Content;
|
|
79
|
+
Title: typeof Title;
|
|
80
|
+
Description: typeof Description;
|
|
81
|
+
};
|
|
@@ -1,42 +1,38 @@
|
|
|
1
1
|
import type * as React from "react";
|
|
2
2
|
import { type ReactNode } from "react";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
|
|
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, }: {
|
|
3
|
+
import { type ButtonProps } from "./Button";
|
|
4
|
+
export interface DropdownMenuProps extends Omit<ButtonProps, "children"> {
|
|
5
|
+
/** The trigger's content. The trigger is always a Button, so this is what
|
|
6
|
+
* goes inside it — text, or an icon with `iconOnly`. */
|
|
7
|
+
label: ReactNode;
|
|
25
8
|
/** Which edge of the trigger the menu lines up with. Use `end` when the
|
|
26
9
|
* trigger sits near the right edge and the menu would overflow. */
|
|
27
10
|
align?: "start" | "end";
|
|
28
|
-
/**
|
|
11
|
+
/** `DropdownMenu.Item`, `.Separator` and `.Label`, in any order. */
|
|
29
12
|
children?: ReactNode;
|
|
30
|
-
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A menu of actions hung off a button.
|
|
16
|
+
*
|
|
17
|
+
* The trigger is built in and is always a Button — a dropdown whose trigger
|
|
18
|
+
* looked like anything else was never a shape worth supporting, and making it
|
|
19
|
+
* arbitrary cost a `cloneElement` that had to graft aria wiring and a click
|
|
20
|
+
* handler onto someone else's element.
|
|
21
|
+
*
|
|
22
|
+
* The menu rides the platform's top layer via `popover`, so click-outside
|
|
23
|
+
* dismissal and stacking come from the browser rather than an approximation.
|
|
24
|
+
* Arrows move between items, Escape closes and returns focus to the trigger.
|
|
25
|
+
*/
|
|
26
|
+
declare function DropdownMenuRoot({ label, align, children, ...buttonProps }: DropdownMenuProps): React.JSX.Element;
|
|
31
27
|
/**
|
|
32
28
|
* A non-interactive heading for a group of items. Skipped by arrow-key
|
|
33
29
|
* navigation, since there is nothing to activate.
|
|
34
30
|
*/
|
|
35
|
-
|
|
31
|
+
declare function Label({ children, }: {
|
|
36
32
|
/** Heading text for the group beneath it. Not focusable. */
|
|
37
33
|
children?: ReactNode;
|
|
38
34
|
}): React.JSX.Element;
|
|
39
|
-
export interface
|
|
35
|
+
export interface DropdownMenuItemProps {
|
|
40
36
|
/** Render the child element instead of the default item — for a link that
|
|
41
37
|
* should stay an anchor rather than becoming a button. */
|
|
42
38
|
asChild?: boolean;
|
|
@@ -54,9 +50,15 @@ export interface ItemProps {
|
|
|
54
50
|
* Pass `color="danger"` for a destructive action so it reads differently from
|
|
55
51
|
* its neighbours before it is chosen, not after.
|
|
56
52
|
*/
|
|
57
|
-
|
|
53
|
+
declare function Item({ asChild, color, onSelect, children }: DropdownMenuItemProps): React.JSX.Element;
|
|
58
54
|
/**
|
|
59
55
|
* A rule between groups of items — for separating a destructive action from
|
|
60
56
|
* routine ones, so the two are not adjacent to a moving cursor.
|
|
61
57
|
*/
|
|
62
|
-
|
|
58
|
+
declare function Separator(): React.JSX.Element;
|
|
59
|
+
export declare const DropdownMenu: typeof DropdownMenuRoot & {
|
|
60
|
+
Item: typeof Item;
|
|
61
|
+
Separator: typeof Separator;
|
|
62
|
+
Label: typeof Label;
|
|
63
|
+
};
|
|
64
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
export type MessageVariant = "info" | "warning" | "alert";
|
|
4
|
+
export interface MessageProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
5
|
+
/** Which message this is. `info` states something, `warning` flags a risk
|
|
6
|
+
* worth acting on, `alert` reports something already wrong. Default
|
|
7
|
+
* `info`. */
|
|
8
|
+
variant?: MessageVariant;
|
|
9
|
+
/** An optional bold line above the body. Omit for a single-line message —
|
|
10
|
+
* a title that merely restates the body is noise.
|
|
11
|
+
*
|
|
12
|
+
* This shadows the HTML `title` attribute, which took a string and showed
|
|
13
|
+
* a browser tooltip. A tooltip on a banner nobody hovers was never the
|
|
14
|
+
* useful reading of the name. */
|
|
15
|
+
title?: ReactNode;
|
|
16
|
+
/** Replaces the variant's own glyph. Pass `null` for no icon at all. */
|
|
17
|
+
icon?: ReactNode;
|
|
18
|
+
/** The message. */
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A banner that tells the reader something about the state of the page — a
|
|
23
|
+
* risk, a result, a failure.
|
|
24
|
+
*
|
|
25
|
+
* The three variants do not merely change hue. `info` is lit like the rest of
|
|
26
|
+
* the system, cool and calm; `warning` warms the rim to amber; `alert` uses
|
|
27
|
+
* the ember treatment, the same warm limb the destructive Button wears. Each
|
|
28
|
+
* carries its own glyph so the kind of message reads before the words do.
|
|
29
|
+
*
|
|
30
|
+
* For a decision the reader must make, reach for `AlertDialog` instead — a
|
|
31
|
+
* message states, it does not ask.
|
|
32
|
+
*/
|
|
33
|
+
export declare const Message: React.ForwardRefExoticComponent<MessageProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as React from "react";
|
|
2
2
|
import { type ReactNode } from "react";
|
|
3
|
-
export interface
|
|
3
|
+
export interface RadioGroupProps {
|
|
4
4
|
/** The selected item's value. Fully controlled. */
|
|
5
5
|
value: string;
|
|
6
6
|
/** Called with the newly selected value. */
|
|
@@ -9,15 +9,15 @@ export interface RootProps {
|
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
/** Merged onto the group wrapper. */
|
|
11
11
|
className?: string;
|
|
12
|
-
/**
|
|
12
|
+
/** One or more `RadioGroup.Item`. */
|
|
13
13
|
children?: ReactNode;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* A single-choice control for short lists, where seeing every option at once
|
|
17
17
|
* matters more than saving space. Reach for Select when it does not.
|
|
18
18
|
*/
|
|
19
|
-
|
|
20
|
-
export interface
|
|
19
|
+
declare function RadioGroupRoot({ value, onValueChange, disabled, className, children }: RadioGroupProps): React.JSX.Element;
|
|
20
|
+
export interface RadioGroupItemProps {
|
|
21
21
|
/** Reported to the group's onValueChange when chosen. */
|
|
22
22
|
value: string;
|
|
23
23
|
/** Disables this option only. */
|
|
@@ -25,8 +25,16 @@ export interface ItemProps {
|
|
|
25
25
|
/** The option's label. Part of the click target, not merely beside it. */
|
|
26
26
|
children?: ReactNode;
|
|
27
27
|
}
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
|
|
28
|
+
/**
|
|
29
|
+
* One option.
|
|
30
|
+
*
|
|
31
|
+
* With children it labels itself: a <label> wraps the input, the orb and the
|
|
32
|
+
* children, so the text is part of the click target. Without children it
|
|
33
|
+
* emits a bare span instead, so an OUTER label can own the association —
|
|
34
|
+
* nesting one label inside another is invalid HTML.
|
|
35
|
+
*/
|
|
36
|
+
declare function Item({ value, disabled, children }: RadioGroupItemProps): React.JSX.Element;
|
|
37
|
+
export declare const RadioGroup: typeof RadioGroupRoot & {
|
|
38
|
+
Item: typeof Item;
|
|
39
|
+
};
|
|
40
|
+
export {};
|
|
@@ -1,70 +1,53 @@
|
|
|
1
1
|
import type * as React from "react";
|
|
2
2
|
import { type ReactNode } from "react";
|
|
3
|
-
export interface
|
|
3
|
+
export interface SelectProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "value" | "children" | "onChange"> {
|
|
4
4
|
/** The selected item's value. Fully controlled. */
|
|
5
5
|
value: string;
|
|
6
6
|
/** Called with the newly selected value. */
|
|
7
7
|
onValueChange: (v: string) => void;
|
|
8
8
|
/** Blocks the trigger and removes it from the tab order. */
|
|
9
9
|
disabled?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
|
|
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
|
-
*/
|
|
10
|
+
/** Shown when nothing is selected. Counts toward the control's width, so
|
|
11
|
+
* selecting an option never resizes it. */
|
|
24
12
|
placeholder?: string;
|
|
25
|
-
/** Ambient motion: the lit arc orbiting the rim. The glass skin itself
|
|
26
|
-
*
|
|
13
|
+
/** Ambient motion: the lit arc orbiting the rim. The glass skin itself is
|
|
14
|
+
* always applied. Default true. */
|
|
27
15
|
animated?: boolean;
|
|
16
|
+
/** One or more `Select.Item`. Anything else is ignored for selection but
|
|
17
|
+
* still rendered in the panel. */
|
|
18
|
+
children?: ReactNode;
|
|
28
19
|
}
|
|
29
20
|
/**
|
|
30
|
-
*
|
|
21
|
+
* A single-choice menu for lists too long to show inline. Fully controlled.
|
|
31
22
|
*
|
|
32
|
-
*
|
|
33
|
-
* — capped by `--sp-select-trigger-max-width`, past which the label
|
|
23
|
+
* The control sizes itself to its widest option, so it never changes width as
|
|
24
|
+
* you select — capped by `--sp-select-trigger-max-width`, past which the label
|
|
34
25
|
* 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
26
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
27
|
+
* Reads its options at render time rather than through effects, so the right
|
|
28
|
+
* label shows on first paint and under SSR.
|
|
29
|
+
*
|
|
30
|
+
* Every prop other than the ones listed lands on the trigger button, which is
|
|
31
|
+
* the focusable control — so `aria-label`, `id`, `name` and `onBlur` go where
|
|
32
|
+
* you would expect.
|
|
54
33
|
*/
|
|
55
|
-
|
|
56
|
-
export interface
|
|
34
|
+
declare function SelectRoot({ value, onValueChange, disabled, placeholder, animated, className, children, ...rest }: SelectProps): React.JSX.Element;
|
|
35
|
+
export interface SelectItemProps {
|
|
57
36
|
/** Reported to onValueChange when chosen. */
|
|
58
37
|
value: string;
|
|
59
|
-
/** Skipped by keyboard navigation and not selectable. Still contributes
|
|
60
|
-
*
|
|
38
|
+
/** Skipped by keyboard navigation and not selectable. Still contributes its
|
|
39
|
+
* width to the control's sizing. */
|
|
61
40
|
disabled?: boolean;
|
|
62
|
-
/** Shown in the panel and, once selected, in the
|
|
63
|
-
* read correctly in both places. */
|
|
41
|
+
/** Shown in the panel and, once selected, in the closed control — so it has
|
|
42
|
+
* to read correctly in both places. */
|
|
64
43
|
children?: ReactNode;
|
|
65
44
|
}
|
|
66
45
|
/**
|
|
67
|
-
* One option. Its children are what the
|
|
68
|
-
* anything rendered here has to read correctly in both places.
|
|
46
|
+
* One option. Its children are what the closed control displays once
|
|
47
|
+
* selected, so anything rendered here has to read correctly in both places.
|
|
69
48
|
*/
|
|
70
|
-
|
|
49
|
+
declare function Item({ value, disabled, children }: SelectItemProps): React.JSX.Element;
|
|
50
|
+
export declare const Select: typeof SelectRoot & {
|
|
51
|
+
Item: typeof Item;
|
|
52
|
+
};
|
|
53
|
+
export {};
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import type * as React from "react";
|
|
2
2
|
import { type ReactNode } from "react";
|
|
3
|
-
|
|
4
|
-
* Wraps a tab set and owns which tab is showing. Fully controlled — pass
|
|
5
|
-
* `value` and `onValueChange`; there is no uncontrolled mode.
|
|
6
|
-
*
|
|
7
|
-
* Renders a plain div, so it imposes no layout of its own. It also mints the
|
|
8
|
-
* id that pairs each Trigger with its Content, which is why every part has to
|
|
9
|
-
* sit inside a Root rather than being usable on its own.
|
|
10
|
-
*/
|
|
11
|
-
export declare function Root({ value, onValueChange, className, children }: {
|
|
3
|
+
export interface TabsProps {
|
|
12
4
|
/** The selected tab's value. Fully controlled — there is no default. */
|
|
13
5
|
value: string;
|
|
14
6
|
/** Called with the newly selected tab's value. */
|
|
15
7
|
onValueChange: (v: string) => void;
|
|
16
8
|
/** Merged onto the wrapper div, which is otherwise unstyled. */
|
|
17
9
|
className?: string;
|
|
18
|
-
/** A List and the
|
|
10
|
+
/** A `Tabs.List` and the `Tabs.Content`s it switches between. */
|
|
19
11
|
children?: ReactNode;
|
|
20
|
-
}
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Wraps a tab set and owns which tab is showing. Fully controlled — pass
|
|
15
|
+
* `value` and `onValueChange`; there is no uncontrolled mode.
|
|
16
|
+
*
|
|
17
|
+
* Renders a plain div, so it imposes no layout of its own. It also mints the
|
|
18
|
+
* id that pairs each Trigger with its Content, which is why every part has to
|
|
19
|
+
* sit inside it rather than being usable on its own.
|
|
20
|
+
*/
|
|
21
|
+
declare function TabsRoot({ value, onValueChange, className, children }: TabsProps): React.JSX.Element;
|
|
21
22
|
/**
|
|
22
23
|
* The row of triggers, and the keyboard model for the set: arrow keys move
|
|
23
24
|
* between tabs, Home and End jump to the ends, each moving focus and
|
|
@@ -26,7 +27,7 @@ export declare function Root({ value, onValueChange, className, children }: {
|
|
|
26
27
|
* Bottom-aligns its children, so an active tab that grows taller rises above
|
|
27
28
|
* its neighbours instead of pushing the row down — the folder-tab effect.
|
|
28
29
|
*/
|
|
29
|
-
|
|
30
|
+
declare function List({ children, }: {
|
|
30
31
|
/** The Triggers. Their order is the tab order. */
|
|
31
32
|
children?: ReactNode;
|
|
32
33
|
}): React.JSX.Element;
|
|
@@ -37,7 +38,7 @@ export declare function List({ children, }: {
|
|
|
37
38
|
* Emits `data-state="active" | "inactive"`, which is the hook the active
|
|
38
39
|
* styling keys off — useful if you are restyling tabs from outside.
|
|
39
40
|
*/
|
|
40
|
-
|
|
41
|
+
declare function Trigger({ value, className, children, ...rest }: {
|
|
41
42
|
/** Selects this value. Must match the Content it reveals. */
|
|
42
43
|
value: string;
|
|
43
44
|
/** Merged with the tab's own classes rather than replacing them. */
|
|
@@ -53,9 +54,15 @@ export declare function Trigger({ value, className, children, ...rest }: {
|
|
|
53
54
|
* Carries no styling: the surface a tab set seats onto is the consumer's, and
|
|
54
55
|
* should match `--sp-tabs-surface-color` so the active tab connects to it.
|
|
55
56
|
*/
|
|
56
|
-
|
|
57
|
+
declare function Content({ value, children, }: {
|
|
57
58
|
/** Shown while this matches the Root's value. Must match a Trigger. */
|
|
58
59
|
value: string;
|
|
59
60
|
/** Panel contents. Unmounted while another tab is selected. */
|
|
60
61
|
children?: ReactNode;
|
|
61
62
|
}): React.JSX.Element | null;
|
|
63
|
+
export declare const Tabs: typeof TabsRoot & {
|
|
64
|
+
List: typeof List;
|
|
65
|
+
Trigger: typeof Trigger;
|
|
66
|
+
Content: typeof Content;
|
|
67
|
+
};
|
|
68
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as React from "react";
|
|
2
2
|
import { type ReactNode } from "react";
|
|
3
|
-
export interface
|
|
3
|
+
export interface TextFieldProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "className" | "style"> {
|
|
4
4
|
/** Merged onto the field wrapper, not the inner input. */
|
|
5
5
|
className?: string;
|
|
6
6
|
/** Ambient motion on the rim. The glass skin is always applied.
|
|
@@ -11,20 +11,16 @@ export interface RootProps extends Omit<React.InputHTMLAttributes<HTMLInputEleme
|
|
|
11
11
|
/** Slots rendered inside the field, alongside the input. */
|
|
12
12
|
children?: ReactNode;
|
|
13
13
|
}
|
|
14
|
-
/**
|
|
15
|
-
* Single-line text entry. Composed as a Root so slots can sit alongside the
|
|
16
|
-
* input inside the same field surface.
|
|
17
|
-
*
|
|
18
|
-
* Props land on the inner input, so `value`, `onChange` and the rest behave
|
|
19
|
-
* as they would on a bare input.
|
|
20
|
-
*/
|
|
21
|
-
export declare const Root: React.ForwardRefExoticComponent<RootProps & React.RefAttributes<HTMLInputElement>>;
|
|
22
14
|
/**
|
|
23
15
|
* A fixed element inside the field, before or after the input — an icon, a
|
|
24
16
|
* unit, a short affordance. Sits within the field's surface rather than
|
|
25
17
|
* beside it, and does not shrink as the input fills.
|
|
26
18
|
*/
|
|
27
|
-
|
|
19
|
+
declare function Slot({ children, }: {
|
|
28
20
|
/** The slot's contents — an icon, a unit, a short affordance. */
|
|
29
21
|
children?: ReactNode;
|
|
30
22
|
}): React.JSX.Element;
|
|
23
|
+
export declare const TextField: React.ForwardRefExoticComponent<TextFieldProps & React.RefAttributes<HTMLInputElement>> & {
|
|
24
|
+
Slot: typeof Slot;
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
@@ -25,3 +25,6 @@ export declare function ChevronLeftIcon(props: IconProps): React.JSX.Element;
|
|
|
25
25
|
export declare function BookmarkIcon(props: IconProps): React.JSX.Element;
|
|
26
26
|
/** Dialog dismiss glyph — a plain X, used by Dialog.Content's corner button. */
|
|
27
27
|
export declare function XIcon(props: IconProps): React.JSX.Element;
|
|
28
|
+
export declare function InfoCircledIcon(props: IconProps): React.JSX.Element;
|
|
29
|
+
export declare function ExclamationTriangleIcon(props: IconProps): React.JSX.Element;
|
|
30
|
+
export declare function CrossCircledIcon(props: IconProps): React.JSX.Element;
|