@itwin/itwinui-react 5.0.0-alpha.12 → 5.0.0-alpha.14
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/CHANGELOG.md +24 -0
- package/README.md +31 -0
- package/dist/DEV/bricks/Anchor.js +2 -2
- package/dist/DEV/bricks/Avatar.js +1 -1
- package/dist/DEV/bricks/Badge.js +1 -1
- package/dist/DEV/bricks/Button.js +2 -2
- package/dist/DEV/bricks/Checkbox.js +2 -4
- package/dist/DEV/bricks/Chip.js +3 -3
- package/dist/DEV/bricks/Description.js +1 -1
- package/dist/DEV/bricks/Divider.js +1 -1
- package/dist/DEV/bricks/DropdownMenu.js +23 -16
- package/dist/DEV/bricks/ErrorRegion.js +106 -0
- package/dist/DEV/bricks/Field.internal.js +2 -5
- package/dist/DEV/bricks/Field.js +17 -16
- package/dist/DEV/bricks/Icon.js +28 -7
- package/dist/DEV/bricks/IconButton.internal.js +23 -0
- package/dist/DEV/bricks/IconButton.js +24 -19
- package/dist/DEV/bricks/Kbd.js +3 -3
- package/dist/DEV/bricks/Label.js +1 -1
- package/dist/DEV/bricks/Radio.js +2 -4
- package/dist/DEV/bricks/Root.js +11 -11
- package/dist/DEV/bricks/Select.js +4 -7
- package/dist/DEV/bricks/Switch.js +2 -4
- package/dist/DEV/bricks/Table.js +2 -2
- package/dist/DEV/bricks/Tabs.js +1 -1
- package/dist/DEV/bricks/TextBox.js +6 -8
- package/dist/DEV/bricks/Toolbar.js +27 -0
- package/dist/DEV/bricks/Tooltip.js +4 -4
- package/dist/DEV/bricks/Tree.js +3 -3
- package/dist/DEV/bricks/TreeItem.js +254 -166
- package/dist/DEV/bricks/VisuallyHidden.js +10 -2
- package/dist/DEV/bricks/index.js +6 -2
- package/dist/DEV/bricks/styles.css.js +1 -1
- package/dist/DEV/bricks/~hooks.js +1 -1
- package/dist/DEV/bricks/~utils.Dot.js +22 -0
- package/dist/DEV/bricks/~utils.ListItem.js +2 -2
- package/dist/DEV/foundations/styles.css.js +1 -1
- package/dist/bricks/Anchor.d.ts +1 -1
- package/dist/bricks/Anchor.js +2 -2
- package/dist/bricks/Avatar.d.ts +1 -1
- package/dist/bricks/Avatar.js +1 -1
- package/dist/bricks/Badge.d.ts +1 -1
- package/dist/bricks/Badge.js +1 -1
- package/dist/bricks/Button.d.ts +1 -1
- package/dist/bricks/Button.js +2 -2
- package/dist/bricks/Checkbox.d.ts +2 -2
- package/dist/bricks/Checkbox.js +2 -4
- package/dist/bricks/Chip.d.ts +1 -1
- package/dist/bricks/Chip.js +3 -3
- package/dist/bricks/Description.d.ts +1 -1
- package/dist/bricks/Description.js +1 -1
- package/dist/bricks/Divider.d.ts +2 -2
- package/dist/bricks/Divider.js +1 -1
- package/dist/bricks/DropdownMenu.d.ts +5 -3
- package/dist/bricks/DropdownMenu.js +23 -16
- package/dist/bricks/ErrorRegion.d.ts +83 -0
- package/dist/bricks/ErrorRegion.js +104 -0
- package/dist/bricks/Field.d.ts +8 -2
- package/dist/bricks/Field.internal.d.ts +2 -1
- package/dist/bricks/Field.internal.js +2 -5
- package/dist/bricks/Field.js +17 -16
- package/dist/bricks/Icon.d.ts +4 -1
- package/dist/bricks/Icon.js +27 -7
- package/dist/bricks/IconButton.internal.d.ts +10 -0
- package/dist/bricks/IconButton.internal.js +22 -0
- package/dist/bricks/IconButton.js +24 -19
- package/dist/bricks/Kbd.d.ts +2 -2
- package/dist/bricks/Kbd.js +3 -3
- package/dist/bricks/Label.d.ts +1 -1
- package/dist/bricks/Label.js +1 -1
- package/dist/bricks/ProgressBar.d.ts +8 -2
- package/dist/bricks/Radio.d.ts +2 -2
- package/dist/bricks/Radio.js +2 -4
- package/dist/bricks/Root.d.ts +1 -1
- package/dist/bricks/Root.js +11 -11
- package/dist/bricks/Select.d.ts +1 -1
- package/dist/bricks/Select.js +4 -7
- package/dist/bricks/Skeleton.d.ts +1 -1
- package/dist/bricks/Spinner.d.ts +1 -1
- package/dist/bricks/Switch.d.ts +2 -2
- package/dist/bricks/Switch.js +2 -4
- package/dist/bricks/Table.d.ts +1 -1
- package/dist/bricks/Table.js +2 -2
- package/dist/bricks/Tabs.d.ts +1 -1
- package/dist/bricks/Tabs.js +1 -1
- package/dist/bricks/Text.d.ts +1 -1
- package/dist/bricks/TextBox.d.ts +1 -1
- package/dist/bricks/TextBox.js +6 -8
- package/dist/bricks/Toolbar.d.ts +36 -0
- package/dist/bricks/Toolbar.js +25 -0
- package/dist/bricks/Tooltip.d.ts +2 -2
- package/dist/bricks/Tooltip.js +4 -4
- package/dist/bricks/Tree.d.ts +2 -2
- package/dist/bricks/Tree.js +3 -3
- package/dist/bricks/TreeItem.d.ts +24 -8
- package/dist/bricks/TreeItem.js +243 -164
- package/dist/bricks/VisuallyHidden.d.ts +1 -1
- package/dist/bricks/VisuallyHidden.js +10 -2
- package/dist/bricks/index.d.ts +3 -1
- package/dist/bricks/index.js +6 -2
- package/dist/bricks/styles.css.js +1 -1
- package/dist/bricks/~hooks.js +1 -1
- package/dist/bricks/~utils.Dot.d.ts +11 -0
- package/dist/bricks/~utils.Dot.js +21 -0
- package/dist/bricks/~utils.ListItem.d.ts +1 -1
- package/dist/bricks/~utils.ListItem.js +2 -2
- package/dist/bricks/~utils.d.ts +1 -1
- package/dist/foundations/styles.css.js +1 -1
- package/package.json +1 -1
package/dist/bricks/Label.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import cx from "classnames";
|
|
3
2
|
import { Role } from "@ariakit/react/role";
|
|
3
|
+
import cx from "classnames";
|
|
4
4
|
import { forwardRef } from "./~utils.js";
|
|
5
5
|
const Label = forwardRef((props, forwardedRef) => {
|
|
6
6
|
return /* @__PURE__ */ jsx(
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
interface ProgressBarProps extends Omit<BaseProps, "aria-labelledby"
|
|
1
|
+
import type { BaseProps } from "./~utils.js";
|
|
2
|
+
interface ProgressBarProps extends Omit<BaseProps, "aria-labelledby"> {
|
|
3
|
+
/**
|
|
4
|
+
* Label for the progress bar.
|
|
5
|
+
*
|
|
6
|
+
* This prop is required because `role="progressbar"` requires an accessible name.
|
|
7
|
+
*/
|
|
8
|
+
"aria-labelledby": string;
|
|
3
9
|
/**
|
|
4
10
|
* The size of the progress bar.
|
|
5
11
|
* @default "medium"
|
package/dist/bricks/Radio.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { RadioProps as AkRadioProps } from "@ariakit/react/radio";
|
|
2
|
+
import type { FocusableProps } from "./~utils.js";
|
|
3
3
|
type InputBaseProps = Omit<FocusableProps<"input">, "defaultValue" | "value">;
|
|
4
4
|
type RadioOwnProps = Pick<AkRadioProps, "value" | "checked" | "onChange">;
|
|
5
5
|
interface RadioProps extends InputBaseProps, RadioOwnProps {
|
package/dist/bricks/Radio.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Radio as AkRadio } from "@ariakit/react/radio";
|
|
2
3
|
import cx from "classnames";
|
|
3
|
-
import {
|
|
4
|
-
Radio as AkRadio
|
|
5
|
-
} from "@ariakit/react/radio";
|
|
6
|
-
import { forwardRef } from "./~utils.js";
|
|
7
4
|
import { useFieldControlType } from "./Field.internal.js";
|
|
5
|
+
import { forwardRef } from "./~utils.js";
|
|
8
6
|
const Radio = forwardRef((props, forwardedRef) => {
|
|
9
7
|
useFieldControlType("checkable");
|
|
10
8
|
return /* @__PURE__ */ jsx(
|
package/dist/bricks/Root.d.ts
CHANGED
package/dist/bricks/Root.js
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import * as ReactDOM from "react-dom";
|
|
4
|
-
import { Role } from "@ariakit/react/role";
|
|
5
2
|
import { PortalContext } from "@ariakit/react/portal";
|
|
3
|
+
import { Role } from "@ariakit/react/role";
|
|
6
4
|
import cx from "classnames";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import * as ReactDOM from "react-dom";
|
|
7
7
|
import foundationsCss from "../foundations/styles.css.js";
|
|
8
|
+
import {
|
|
9
|
+
HtmlSanitizerContext,
|
|
10
|
+
RootNodeContext,
|
|
11
|
+
spriteSheetId,
|
|
12
|
+
useRootNode
|
|
13
|
+
} from "./Root.internal.js";
|
|
8
14
|
import bricksCss from "./styles.css.js";
|
|
15
|
+
import { useLayoutEffect, useMergedRefs } from "./~hooks.js";
|
|
9
16
|
import {
|
|
10
17
|
forwardRef,
|
|
11
18
|
getOwnerDocument,
|
|
@@ -13,13 +20,6 @@ import {
|
|
|
13
20
|
isBrowser,
|
|
14
21
|
isDocument
|
|
15
22
|
} from "./~utils.js";
|
|
16
|
-
import { useLayoutEffect, useMergedRefs } from "./~hooks.js";
|
|
17
|
-
import {
|
|
18
|
-
HtmlSanitizerContext,
|
|
19
|
-
RootNodeContext,
|
|
20
|
-
spriteSheetId,
|
|
21
|
-
useRootNode
|
|
22
|
-
} from "./Root.internal.js";
|
|
23
23
|
const css = foundationsCss + bricksCss;
|
|
24
24
|
const Root = forwardRef((props, forwardedRef) => {
|
|
25
25
|
const {
|
|
@@ -187,7 +187,7 @@ function InlineSpriteSheet() {
|
|
|
187
187
|
}
|
|
188
188
|
function loadFonts(rootNode) {
|
|
189
189
|
const ownerWindow = getWindow(rootNode);
|
|
190
|
-
if (!ownerWindow || Array.from(ownerWindow.document.fonts).some(
|
|
190
|
+
if (!ownerWindow?.document?.fonts || Array.from(ownerWindow.document.fonts).some(
|
|
191
191
|
(font) => font.family === "InterVariable"
|
|
192
192
|
)) {
|
|
193
193
|
return;
|
package/dist/bricks/Select.d.ts
CHANGED
package/dist/bricks/Select.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import cx from "classnames";
|
|
4
2
|
import { Role } from "@ariakit/react/role";
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
isBrowser
|
|
8
|
-
} from "./~utils.js";
|
|
9
|
-
import { DisclosureArrow } from "./Icon.js";
|
|
3
|
+
import cx from "classnames";
|
|
4
|
+
import * as React from "react";
|
|
10
5
|
import { useFieldControlType } from "./Field.internal.js";
|
|
6
|
+
import { DisclosureArrow } from "./Icon.js";
|
|
7
|
+
import { forwardRef, isBrowser } from "./~utils.js";
|
|
11
8
|
const supportsHas = isBrowser && CSS?.supports?.("selector(:has(+ *))");
|
|
12
9
|
const HtmlSelectContext = React.createContext(() => {
|
|
13
10
|
});
|
package/dist/bricks/Spinner.d.ts
CHANGED
package/dist/bricks/Switch.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { CheckboxProps as AkCheckboxProps } from "@ariakit/react/checkbox";
|
|
2
|
+
import type { FocusableProps } from "./~utils.js";
|
|
3
3
|
type InputBaseProps = Omit<FocusableProps<"input">, "defaultValue" | "value">;
|
|
4
4
|
type CheckboxOwnProps = Pick<AkCheckboxProps, "value" | "defaultChecked" | "checked" | "onChange">;
|
|
5
5
|
interface SwitchProps extends InputBaseProps, CheckboxOwnProps {
|
package/dist/bricks/Switch.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Checkbox as AkCheckbox } from "@ariakit/react/checkbox";
|
|
2
3
|
import cx from "classnames";
|
|
3
|
-
import {
|
|
4
|
-
Checkbox as AkCheckbox
|
|
5
|
-
} from "@ariakit/react/checkbox";
|
|
6
|
-
import { forwardRef } from "./~utils.js";
|
|
7
4
|
import { useFieldControlType } from "./Field.internal.js";
|
|
5
|
+
import { forwardRef } from "./~utils.js";
|
|
8
6
|
const Switch = forwardRef(
|
|
9
7
|
(props, forwardedRef) => {
|
|
10
8
|
useFieldControlType("checkable");
|
package/dist/bricks/Table.d.ts
CHANGED
package/dist/bricks/Table.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Role } from "@ariakit/react/role";
|
|
3
|
-
import * as React from "react";
|
|
4
3
|
import cx from "classnames";
|
|
5
|
-
import
|
|
4
|
+
import * as React from "react";
|
|
6
5
|
import { useMergedRefs, useSafeContext } from "./~hooks.js";
|
|
6
|
+
import { forwardRef } from "./~utils.js";
|
|
7
7
|
const TableContext = React.createContext(void 0);
|
|
8
8
|
const TableHeaderContext = React.createContext(false);
|
|
9
9
|
const HtmlTable = forwardRef((props, forwardedRef) => {
|
package/dist/bricks/Tabs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as AkTab from "@ariakit/react/tab";
|
|
2
|
-
import {
|
|
2
|
+
import type { BaseProps, FocusableProps } from "./~utils.js";
|
|
3
3
|
interface TabsProps extends Pick<AkTab.TabProviderProps, "defaultSelectedId" | "selectedId" | "setSelectedId" | "selectOnMove" | "children"> {
|
|
4
4
|
}
|
|
5
5
|
/**
|
package/dist/bricks/Tabs.js
CHANGED
package/dist/bricks/Text.d.ts
CHANGED
package/dist/bricks/TextBox.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Icon } from "./Icon.js";
|
|
3
|
-
import {
|
|
3
|
+
import type { BaseProps, FocusableProps } from "./~utils.js";
|
|
4
4
|
interface BaseInputProps extends FocusableProps<"input"> {
|
|
5
5
|
}
|
|
6
6
|
interface TextBoxInputProps extends Omit<BaseInputProps, "children" | "type"> {
|
package/dist/bricks/TextBox.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { Role } from "@ariakit/react/role";
|
|
4
2
|
import { Focusable } from "@ariakit/react/focusable";
|
|
3
|
+
import { Role } from "@ariakit/react/role";
|
|
5
4
|
import cx from "classnames";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { useFieldControlType } from "./Field.internal.js";
|
|
6
7
|
import { Icon } from "./Icon.js";
|
|
7
|
-
import { useMergedRefs } from "./~hooks.js";
|
|
8
|
+
import { useEventHandlers, useMergedRefs } from "./~hooks.js";
|
|
8
9
|
import { forwardRef } from "./~utils.js";
|
|
9
|
-
import { useFieldControlType } from "./Field.internal.js";
|
|
10
10
|
const TextBoxInput = forwardRef(
|
|
11
11
|
(props, forwardedRef) => {
|
|
12
12
|
useFieldControlType("textlike");
|
|
@@ -70,14 +70,12 @@ const TextBoxRoot = forwardRef(
|
|
|
70
70
|
...props,
|
|
71
71
|
"data-kiwi-disabled": disabled,
|
|
72
72
|
className: cx("\u{1F95D}-text-box", props.className),
|
|
73
|
-
onPointerDown: (e) => {
|
|
74
|
-
props.onPointerDown?.(e);
|
|
75
|
-
if (e.defaultPrevented) return;
|
|
73
|
+
onPointerDown: useEventHandlers(props.onPointerDown, (e) => {
|
|
76
74
|
if (disabled) return;
|
|
77
75
|
if (e.target !== e.currentTarget) return;
|
|
78
76
|
e.preventDefault();
|
|
79
77
|
inputRef.current?.focus();
|
|
80
|
-
},
|
|
78
|
+
}),
|
|
81
79
|
ref: forwardedRef
|
|
82
80
|
}
|
|
83
81
|
)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { BaseProps } from "./~utils.js";
|
|
3
|
+
interface ToolbarProps extends BaseProps {
|
|
4
|
+
/** Must be set to `"solid"` for now. */
|
|
5
|
+
variant: "solid";
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A toolbar for grouping related interactive elements.
|
|
9
|
+
*
|
|
10
|
+
* Follows the [ARIA Toolbar pattern](https://www.w3.org/WAI/ARIA/apg/patterns/toolbar/) for reducing the number of tab stops.
|
|
11
|
+
*
|
|
12
|
+
* Example:
|
|
13
|
+
* ```jsx
|
|
14
|
+
* <Toolbar.Group variant="solid">
|
|
15
|
+
* <Toolbar.Item render={…} />
|
|
16
|
+
* <Toolbar.Item render={…} />
|
|
17
|
+
* <Toolbar.Item render={…} />
|
|
18
|
+
* </Toolbar.Group>
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
declare const ToolbarGroup: React.ForwardRefExoticComponent<ToolbarProps & React.RefAttributes<HTMLElement | HTMLDivElement>>;
|
|
22
|
+
interface ToolbarItemProps extends Omit<BaseProps<"button">, "render">, Required<Pick<BaseProps, "render">> {
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* An item within the toolbar.
|
|
26
|
+
* Should be used with the `render` prop.
|
|
27
|
+
*
|
|
28
|
+
* Example:
|
|
29
|
+
* ```jsx
|
|
30
|
+
* <Toolbar.Item
|
|
31
|
+
* render={<IconButton variant="ghost" … />}
|
|
32
|
+
* />
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
declare const ToolbarItem: React.ForwardRefExoticComponent<ToolbarItemProps & React.RefAttributes<HTMLElement | HTMLButtonElement>>;
|
|
36
|
+
export { ToolbarGroup as Group, ToolbarItem as Item };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as Toolbar from "@ariakit/react/toolbar";
|
|
3
|
+
import cx from "classnames";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { IconButtonContext } from "./IconButton.internal.js";
|
|
6
|
+
import { forwardRef } from "./~utils.js";
|
|
7
|
+
const ToolbarGroup = forwardRef((props, forwardedRef) => {
|
|
8
|
+
return /* @__PURE__ */ jsx(IconButtonContext, { value: React.useMemo(() => ({ iconSize: "large" }), []), children: /* @__PURE__ */ jsx(
|
|
9
|
+
Toolbar.Toolbar,
|
|
10
|
+
{
|
|
11
|
+
...props,
|
|
12
|
+
className: cx("\u{1F95D}-toolbar", props.className),
|
|
13
|
+
ref: forwardedRef
|
|
14
|
+
}
|
|
15
|
+
) });
|
|
16
|
+
});
|
|
17
|
+
const ToolbarItem = forwardRef(
|
|
18
|
+
(props, forwardedRef) => {
|
|
19
|
+
return /* @__PURE__ */ jsx(Toolbar.ToolbarItem, { ...props, ref: forwardedRef });
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
export {
|
|
23
|
+
ToolbarGroup as Group,
|
|
24
|
+
ToolbarItem as Item
|
|
25
|
+
};
|
package/dist/bricks/Tooltip.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
1
|
import * as AkTooltip from "@ariakit/react/tooltip";
|
|
3
|
-
import
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import type { FocusableProps } from "./~utils.js";
|
|
4
4
|
interface TooltipProps extends Omit<FocusableProps<"div">, "content">, Pick<AkTooltip.TooltipProps, "open" | "unmountOnHide">, Pick<AkTooltip.TooltipProviderProps, "defaultOpen" | "setOpen"> {
|
|
5
5
|
/**
|
|
6
6
|
* The content to be displayed inside the tooltip when the trigger element is hovered or focused.
|
package/dist/bricks/Tooltip.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import cx from "classnames";
|
|
4
|
-
import * as AkTooltip from "@ariakit/react/tooltip";
|
|
5
2
|
import { useStoreState } from "@ariakit/react/store";
|
|
6
|
-
import
|
|
3
|
+
import * as AkTooltip from "@ariakit/react/tooltip";
|
|
4
|
+
import cx from "classnames";
|
|
5
|
+
import * as React from "react";
|
|
7
6
|
import { usePopoverApi } from "./~hooks.js";
|
|
7
|
+
import { forwardRef } from "./~utils.js";
|
|
8
8
|
const Tooltip = forwardRef(
|
|
9
9
|
(props, forwardedRef) => {
|
|
10
10
|
const generatedId = React.useId();
|
package/dist/bricks/Tree.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Action as TreeItemAction, Root as TreeItemRoot } from "./TreeItem.js";
|
|
2
|
+
import type { BaseProps } from "./~utils.js";
|
|
3
3
|
interface TreeProps extends BaseProps {
|
|
4
4
|
}
|
|
5
5
|
/**
|
package/dist/bricks/Tree.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import { Composite, useCompositeStore } from "@ariakit/react/composite";
|
|
3
3
|
import { Role } from "@ariakit/react/role";
|
|
4
|
-
import
|
|
4
|
+
import cx from "classnames";
|
|
5
|
+
import { Action as TreeItemAction, Root as TreeItemRoot } from "./TreeItem.js";
|
|
5
6
|
import { forwardRef } from "./~utils.js";
|
|
6
|
-
import { Root as TreeItemRoot, Action as TreeItemAction } from "./TreeItem.js";
|
|
7
7
|
const Tree = forwardRef((props, forwardedRef) => {
|
|
8
8
|
const composite = useCompositeStore({ orientation: "vertical" });
|
|
9
9
|
return /* @__PURE__ */ jsx(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
interface
|
|
2
|
+
import type { BaseProps } from "./~utils.js";
|
|
3
|
+
interface TreeItemProps extends Omit<BaseProps, "content" | "children"> {
|
|
4
4
|
/** Specifies the nesting level of the tree item. Nesting levels start at 1. */
|
|
5
5
|
"aria-level": number;
|
|
6
6
|
/** Defines tree item position in the current level of tree items. Integer greater than or equal to 1. */
|
|
@@ -93,13 +93,14 @@ interface TreeItemRootProps extends Omit<BaseProps, "content" | "children"> {
|
|
|
93
93
|
actions?: React.ReactNode[];
|
|
94
94
|
/**
|
|
95
95
|
* Specifies if the tree item is in an error state.
|
|
96
|
+
* The id for an associated error message (e.g. `<ErrorRegion.Item>`) can be passed as a string.
|
|
96
97
|
*
|
|
97
|
-
* Can be combined with the `actions` prop to display an error-related action.
|
|
98
|
-
* action will be made visible by default.
|
|
98
|
+
* Can be combined with the `actions` prop to display an error-related action (e.g. "Retry").
|
|
99
|
+
* The first action will be made visible by default.
|
|
99
100
|
*
|
|
100
101
|
* @default false
|
|
101
102
|
*/
|
|
102
|
-
error?: boolean;
|
|
103
|
+
error?: boolean | string;
|
|
103
104
|
}
|
|
104
105
|
/**
|
|
105
106
|
* A treeitem is a node in a tree structure that may be expanded or collapsed to reveal or hide its descendants.
|
|
@@ -127,7 +128,7 @@ interface TreeItemRootProps extends Omit<BaseProps, "content" | "children"> {
|
|
|
127
128
|
*
|
|
128
129
|
* Secondary actions can be passed into the `actions` prop.
|
|
129
130
|
*/
|
|
130
|
-
declare const
|
|
131
|
+
declare const TreeItem: React.NamedExoticComponent<TreeItemProps & React.RefAttributes<HTMLElement | HTMLDivElement>>;
|
|
131
132
|
interface TreeItemActionProps extends Omit<BaseProps<"button">, "children"> {
|
|
132
133
|
/**
|
|
133
134
|
* Label for the action.
|
|
@@ -155,6 +156,21 @@ interface TreeItemActionProps extends Omit<BaseProps<"button">, "children"> {
|
|
|
155
156
|
* to `true` when `error` is set).
|
|
156
157
|
*/
|
|
157
158
|
visible?: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* A small dot displayed in the corner of the action.
|
|
161
|
+
*
|
|
162
|
+
* The value of this prop gets used as the button's "accessible description".
|
|
163
|
+
*
|
|
164
|
+
* Example:
|
|
165
|
+
* ```tsx
|
|
166
|
+
* <Tree.ItemAction
|
|
167
|
+
* label="Filter"
|
|
168
|
+
* dot="Some filters applied"
|
|
169
|
+
* icon={…}
|
|
170
|
+
* />
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
dot?: string;
|
|
158
174
|
}
|
|
159
175
|
/**
|
|
160
176
|
* A secondary action for `<Tree.Item>`, to be passed into the `actions` prop. The action is typically
|
|
@@ -163,5 +179,5 @@ interface TreeItemActionProps extends Omit<BaseProps<"button">, "children"> {
|
|
|
163
179
|
* By default, the action appears only when the treeitem has hover/focus or an error. This behavior can
|
|
164
180
|
* be overridden using the `visible` prop.
|
|
165
181
|
*/
|
|
166
|
-
declare const TreeItemAction: React.
|
|
167
|
-
export {
|
|
182
|
+
declare const TreeItemAction: React.NamedExoticComponent<TreeItemActionProps & React.RefAttributes<HTMLElement | HTMLButtonElement>>;
|
|
183
|
+
export { TreeItem as Root, TreeItemAction as Action };
|