@kb.ui/react 0.12.2 → 0.13.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 +4 -0
- package/dist/components/Button/Button.d.ts +3 -1
- package/dist/components/Dialog/Dialog.d.ts +1 -1
- package/dist/components/FilterChip/FilterChip.d.ts +29 -0
- package/dist/components/ToggleButton/ToggleButton.d.ts +12 -0
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +12 -0
- package/dist/components/Toolbar/Toolbar.d.ts +1 -0
- package/dist/components/TreeList/TreeList.d.ts +27 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +856 -624
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/docs/components/Button.md +6 -0
- package/docs/components/Dialog.md +4 -2
- package/docs/components/FilterChip.md +74 -0
- package/docs/components/ToggleButton.md +53 -0
- package/docs/components/ToggleGroup.md +59 -0
- package/docs/components/TreeList.md +64 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -88,6 +88,8 @@ See [Media and identity](../../docs/guides/media-and-identity.md) for responsive
|
|
|
88
88
|
| <a id="dialog"></a>[`Dialog`](docs/components/Dialog.md) | Keep a focused task in a dialog while the page waits behind it. |
|
|
89
89
|
| <a id="confirmaction"></a>[`ConfirmAction`](docs/components/ConfirmAction.md) | Put a destructive action behind one confirmation that closes only after success. |
|
|
90
90
|
| <a id="menu"></a>[`Menu`](docs/components/Menu.md) | Keep related actions in a compact popup menu. |
|
|
91
|
+
| <a id="togglebutton"></a>[`ToggleButton`](docs/components/ToggleButton.md) | Turn a persistent option on or off. |
|
|
92
|
+
| <a id="togglegroup"></a>[`ToggleGroup`](docs/components/ToggleGroup.md) | Toggle multiple related options with arrow-key navigation. |
|
|
91
93
|
| <a id="toolbar"></a>[`Toolbar`](docs/components/Toolbar.md) | Group related actions with arrow-key navigation. |
|
|
92
94
|
|
|
93
95
|
### Forms
|
|
@@ -102,6 +104,7 @@ See [Media and identity](../../docs/guides/media-and-identity.md) for responsive
|
|
|
102
104
|
| <a id="formactions"></a>[`FormActions`](docs/components/FormActions.md) | Align submit, reset, and secondary actions at the end of a form. |
|
|
103
105
|
| <a id="formsection"></a>[`FormSection`](docs/components/FormSection.md) | A headed group of related fields with its error and actions. |
|
|
104
106
|
| <a id="input"></a>[`Input`](docs/components/Input.md) | Collect text with a clear label, help text, and error feedback. |
|
|
107
|
+
| <a id="filterchip"></a>[`FilterChip`](docs/components/FilterChip.md) | Toggle or remove a visible filter. |
|
|
105
108
|
| <a id="multiselect"></a>[`MultiSelect`](docs/components/MultiSelect.md) | Search a list and keep multiple selections visible as removable chips. |
|
|
106
109
|
| <a id="numberfield"></a>[`NumberField`](docs/components/NumberField.md) | Enter a number by typing or using step buttons. |
|
|
107
110
|
| <a id="radiogroup"></a>[`RadioGroup`](docs/components/RadioGroup.md) | Choose one option from a visible group. |
|
|
@@ -153,6 +156,7 @@ See [Media and identity](../../docs/guides/media-and-identity.md) for responsive
|
|
|
153
156
|
|---|---|
|
|
154
157
|
| <a id="table"></a>[`Table`](docs/components/Table.md) | Compare fields across records with sorting, selection, actions and sticky layouts. |
|
|
155
158
|
| <a id="descriptionlist"></a>[`DescriptionList`](docs/components/DescriptionList.md) | Scan labeled facts with aligned, responsive key/value presentation. |
|
|
159
|
+
| <a id="treelist"></a>[`TreeList`](docs/components/TreeList.md) | Browse a hierarchy with collapsible branches. |
|
|
156
160
|
| <a id="collectionlist"></a>[`CollectionList`](docs/components/CollectionList.md) | Group unordered or ordered records with shared alignment and spacing. |
|
|
157
161
|
| <a id="collectionrow"></a>[`CollectionRow`](docs/components/CollectionRow.md) | Summarize a record with details, metadata, selection and independent actions. |
|
|
158
162
|
|
|
@@ -6,6 +6,8 @@ type ButtonBaseProps = Omit<Base.Props, "className"> & {
|
|
|
6
6
|
className?: string;
|
|
7
7
|
/** Action emphasis: primary main, secondary supporting, ghost quiet, danger destructive. */
|
|
8
8
|
variant?: ButtonVariant;
|
|
9
|
+
/** Shows progress and blocks activation while preserving the action name and focus. */
|
|
10
|
+
loading?: boolean | undefined;
|
|
9
11
|
};
|
|
10
12
|
/** Navigation use: pass render={<a href/>} nativeButton={false} role="link". Icon size needs aria-label. */
|
|
11
13
|
export type ButtonProps = ButtonBaseProps & ({
|
|
@@ -15,5 +17,5 @@ export type ButtonProps = ButtonBaseProps & ({
|
|
|
15
17
|
size: "icon";
|
|
16
18
|
"aria-label": string;
|
|
17
19
|
});
|
|
18
|
-
export declare function Button({ variant, size, className, ...props }: ButtonProps): import("react").JSX.Element;
|
|
20
|
+
export declare function Button({ variant, size, className, loading, ...props }: ButtonProps): import("react").JSX.Element;
|
|
19
21
|
export {};
|
|
@@ -15,7 +15,7 @@ export type DialogDescriptionProps = Omit<Base.Description.Props, "className"> &
|
|
|
15
15
|
export type DialogActionsProps = ComponentProps<"div">;
|
|
16
16
|
export type DialogSectionProps = ComponentProps<"div">;
|
|
17
17
|
export type DialogContentProps = Omit<Base.Popup.Props, "className" | "title"> & {
|
|
18
|
-
/** Centered dialog or
|
|
18
|
+
/** Centered dialog or responsive drawer that becomes a bottom sheet at 550px and below. */
|
|
19
19
|
layout?: "center" | "drawer";
|
|
20
20
|
/** Accessible name; mutually exclusive with a composed Dialog.Title. */
|
|
21
21
|
title?: ReactNode;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { type ClassNames } from "../../utils/kb";
|
|
3
|
+
export type FilterChipSlot = "root" | "label" | "select" | "indicator" | "remove";
|
|
4
|
+
type FilterChipSelection = {
|
|
5
|
+
/** Whether the filter is currently applied. */
|
|
6
|
+
selected: boolean;
|
|
7
|
+
/** Receives the next selection when the label button is activated. */
|
|
8
|
+
onSelectedChange: (selected: boolean) => void;
|
|
9
|
+
};
|
|
10
|
+
type FilterChipRemoval = {
|
|
11
|
+
/** Called when the remove button is activated. */
|
|
12
|
+
onRemove: () => void;
|
|
13
|
+
/** Accessible name for the remove button. Defaults to `Remove ${label}`. */
|
|
14
|
+
removeLabel?: string | undefined;
|
|
15
|
+
};
|
|
16
|
+
export type FilterChipProps = Omit<ComponentProps<"span">, "aria-pressed" | "children" | "dangerouslySetInnerHTML" | "role" | "tabIndex"> & {
|
|
17
|
+
"aria-pressed"?: never;
|
|
18
|
+
/** Visible label and accessible name for the selection button. */
|
|
19
|
+
label: string;
|
|
20
|
+
/** Disables the available buttons. */
|
|
21
|
+
disabled?: boolean | undefined;
|
|
22
|
+
/** Classes for inner parts, keyed by part. */
|
|
23
|
+
classNames?: ClassNames<FilterChipSlot> | undefined;
|
|
24
|
+
} & ((FilterChipSelection & Partial<FilterChipRemoval>) | (FilterChipRemoval & {
|
|
25
|
+
selected?: undefined;
|
|
26
|
+
onSelectedChange?: undefined;
|
|
27
|
+
}));
|
|
28
|
+
export declare function FilterChip({ label, selected, onSelectedChange, onRemove, removeLabel, disabled, className, classNames, "aria-pressed": _ariaPressed, ...props }: FilterChipProps): import("react").JSX.Element;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Toggle as Base } from "@base-ui/react/toggle";
|
|
2
|
+
import type { Ref } from "react";
|
|
3
|
+
type ManagedProp = "aria-pressed" | "form" | "nativeButton" | "render" | "role" | "type";
|
|
4
|
+
export type ToggleButtonProps<Value extends string = string> = Omit<Base.Props<Value>, "className" | ManagedProp> & Partial<Record<ManagedProp, never>> & {
|
|
5
|
+
/** Extra class on the button. */
|
|
6
|
+
className?: string | undefined;
|
|
7
|
+
/** Ref to the underlying button. */
|
|
8
|
+
ref?: Ref<HTMLButtonElement> | undefined;
|
|
9
|
+
};
|
|
10
|
+
/** A button with a persistent pressed state and a stable name. */
|
|
11
|
+
export declare function ToggleButton<Value extends string = string>({ children, className, disabled, hidden, "aria-pressed": _ariaPressed, form: _form, nativeButton: _nativeButton, render: _render, role: _role, type: _type, ...props }: ToggleButtonProps<Value>): import("react").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ToggleGroup as Base } from "@base-ui/react/toggle-group";
|
|
2
|
+
import { type Ref } from "react";
|
|
3
|
+
type ManagedProp = "aria-orientation" | "multiple" | "render" | "role";
|
|
4
|
+
export type ToggleGroupProps<Value extends string = string> = Omit<Base.Props<Value>, "className" | ManagedProp> & Partial<Record<ManagedProp, never>> & {
|
|
5
|
+
/** Extra class on the group. */
|
|
6
|
+
className?: string | undefined;
|
|
7
|
+
/** Ref to the underlying group. */
|
|
8
|
+
ref?: Ref<HTMLDivElement> | undefined;
|
|
9
|
+
};
|
|
10
|
+
/** A named group of independently pressed toggle buttons with arrow-key navigation. */
|
|
11
|
+
export declare function ToggleGroup<Value extends string = string>({ className, dir, disabled, loopFocus, onKeyDown, orientation, ref, "aria-orientation": _ariaOrientation, render: _render, role: _role, ...props }: ToggleGroupProps<Value>): import("react").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Toolbar as Base } from "@base-ui/react/toolbar";
|
|
2
2
|
import { type ButtonVariant } from "../Button/Button";
|
|
3
|
+
export declare const ToolbarFocusContext: import("react").Context<boolean>;
|
|
3
4
|
/** One tab stop for a row of actions; arrow keys move between them. Name it with aria-label. */
|
|
4
5
|
export type ToolbarProps = Omit<Base.Root.Props, "className"> & {
|
|
5
6
|
/** Plain class string; Base UI's function form is not supported. */
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type ComponentProps, type ReactNode } from "react";
|
|
2
|
+
import { type ClassNames } from "../../utils/kb";
|
|
3
|
+
export type TreeListItem = {
|
|
4
|
+
/** Stable identifier, unique within the tree. */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Display content. Branch labels accept text and noninteractive inline content. */
|
|
7
|
+
label: ReactNode;
|
|
8
|
+
/** Nested items. Omit or pass an empty array for a leaf. */
|
|
9
|
+
children?: readonly TreeListItem[] | undefined;
|
|
10
|
+
};
|
|
11
|
+
type TreeListPart = "root" | "item" | "trigger" | "label" | "branch";
|
|
12
|
+
export type TreeListProps = Omit<ComponentProps<"ul">, "children"> & {
|
|
13
|
+
/** Ordered items at the root of the tree. */
|
|
14
|
+
items: readonly TreeListItem[];
|
|
15
|
+
/** Expanded branch IDs when expansion is controlled. */
|
|
16
|
+
expandedIds?: readonly string[] | undefined;
|
|
17
|
+
/** Initially expanded branch IDs when expansion is uncontrolled. */
|
|
18
|
+
defaultExpandedIds?: readonly string[] | undefined;
|
|
19
|
+
/** Reports the next expanded branch IDs after an activation. */
|
|
20
|
+
onExpandedChange?: ((ids: string[]) => void) | undefined;
|
|
21
|
+
/** Number of child levels that add indentation, starting below the root. */
|
|
22
|
+
maxVisualDepth?: number | undefined;
|
|
23
|
+
/** Extra classes for the root, items, buttons, labels and nested lists. */
|
|
24
|
+
classNames?: ClassNames<TreeListPart> | undefined;
|
|
25
|
+
};
|
|
26
|
+
export declare function TreeList({ items, expandedIds, defaultExpandedIds, onExpandedChange, maxVisualDepth, className, classNames, ...props }: TreeListProps): import("react").JSX.Element;
|
|
27
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export { EmptyState, type EmptyStateHeadingLevel, type EmptyStateProps, type Emp
|
|
|
27
27
|
export { ErrorSummary, type ErrorSummaryHeadingLevel, type ErrorSummaryItem, type ErrorSummaryPart, type ErrorSummaryProps, } from "./components/ErrorSummary/ErrorSummary";
|
|
28
28
|
export { Fieldset, type FieldsetPart, type FieldsetProps, } from "./components/Fieldset/Fieldset";
|
|
29
29
|
export { FileInput, type FileInputItem, type FileInputProps, } from "./components/FileInput/FileInput";
|
|
30
|
+
export { FilterChip, type FilterChipProps, type FilterChipSlot, } from "./components/FilterChip/FilterChip";
|
|
30
31
|
export { Form, type FormPart, type FormProps, type FormWidth } from "./components/Form/Form";
|
|
31
32
|
export { FormActions, type FormActionsAlign, type FormActionsProps, } from "./components/FormActions/FormActions";
|
|
32
33
|
export { FormSection, type FormSectionHeadingLevel, type FormSectionLayout, type FormSectionPart, type FormSectionProps, } from "./components/FormSection/FormSection";
|
|
@@ -65,8 +66,11 @@ export { Text, type TextElement, type TextProps, type TextSize, type TextTone, }
|
|
|
65
66
|
export { Textarea, type TextareaPart, type TextareaProps, type TextareaResize, } from "./components/Textarea/Textarea";
|
|
66
67
|
export { Thumbnail, type ThumbnailProps } from "./components/Thumbnail/Thumbnail";
|
|
67
68
|
export { createToastManager, Toast, type ToastActionProps, type ToastAddOptions, type ToastCloseProps, type ToastContentProps, type ToastDescriptionProps, type ToastManager, type ToastObject, type ToastPlacement, type ToastPromiseOptions, type ToastProps, type ToastProviderProps, type ToastTitleProps, type ToastTone, type ToastUpdateOptions, type ToastViewportProps, useToastManager, } from "./components/Toast/Toast";
|
|
69
|
+
export { ToggleButton, type ToggleButtonProps } from "./components/ToggleButton/ToggleButton";
|
|
70
|
+
export { ToggleGroup, type ToggleGroupProps } from "./components/ToggleGroup/ToggleGroup";
|
|
68
71
|
export { Toolbar, type ToolbarButtonProps, type ToolbarGroupProps, type ToolbarProps, type ToolbarSeparatorProps, } from "./components/Toolbar/Toolbar";
|
|
69
72
|
export { Tooltip, type TooltipProps } from "./components/Tooltip/Tooltip";
|
|
73
|
+
export { TreeList, type TreeListItem, type TreeListProps } from "./components/TreeList/TreeList";
|
|
70
74
|
export { type ClassNames, kb } from "./utils/kb";
|
|
71
75
|
export type { LayoutAlign, LayoutGap } from "./utils/layout";
|
|
72
76
|
export type { CopyFeedbackProps, CopyState } from "./utils/useClipboard";
|