@itwin/itwinui-react 5.0.0-alpha.1 → 5.0.0-alpha.3
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 +21 -0
- package/dist/DEV/bricks/Anchor.js +1 -1
- package/dist/DEV/bricks/Button.js +1 -1
- package/dist/DEV/bricks/Checkbox.js +3 -1
- package/dist/DEV/bricks/Chip.js +21 -0
- package/dist/DEV/bricks/Description.js +27 -0
- package/dist/DEV/bricks/DropdownMenu.js +20 -1
- package/dist/DEV/bricks/Field.js +56 -5
- package/dist/DEV/bricks/Icon.js +32 -1
- package/dist/DEV/bricks/IconButton.js +3 -0
- package/dist/DEV/bricks/Kbd.js +36 -4
- package/dist/DEV/bricks/Radio.js +3 -1
- package/dist/DEV/bricks/Select.js +6 -3
- package/dist/DEV/bricks/Spinner.js +40 -0
- package/dist/DEV/bricks/Switch.js +3 -1
- package/dist/DEV/bricks/Tabs.js +1 -1
- package/dist/DEV/bricks/TextBox.js +30 -3
- package/dist/DEV/bricks/Tooltip.js +3 -3
- package/dist/DEV/bricks/Tree.js +119 -34
- package/dist/DEV/bricks/index.js +8 -0
- package/dist/DEV/bricks/styles.css.js +1 -1
- package/dist/DEV/bricks/~hooks.js +15 -2
- package/dist/DEV/foundations/styles.css.js +1 -1
- package/dist/bricks/Anchor.js +1 -1
- package/dist/bricks/Button.js +1 -1
- package/dist/bricks/Checkbox.js +3 -1
- package/dist/bricks/Chip.d.ts +22 -0
- package/dist/bricks/Chip.js +20 -0
- package/dist/bricks/Description.d.ts +20 -0
- package/dist/bricks/Description.js +27 -0
- package/dist/bricks/DropdownMenu.d.ts +13 -1
- package/dist/bricks/DropdownMenu.js +19 -1
- package/dist/bricks/Field.d.ts +8 -0
- package/dist/bricks/Field.js +56 -5
- package/dist/bricks/Icon.d.ts +3 -0
- package/dist/bricks/Icon.js +31 -1
- package/dist/bricks/IconButton.js +3 -0
- package/dist/bricks/Kbd.d.ts +30 -0
- package/dist/bricks/Kbd.js +29 -4
- package/dist/bricks/Radio.js +3 -1
- package/dist/bricks/Select.d.ts +8 -1
- package/dist/bricks/Select.js +6 -3
- package/dist/bricks/Spinner.d.ts +31 -0
- package/dist/bricks/Spinner.js +39 -0
- package/dist/bricks/Switch.js +3 -1
- package/dist/bricks/Tabs.d.ts +1 -1
- package/dist/bricks/Tabs.js +1 -1
- package/dist/bricks/TextBox.d.ts +23 -2
- package/dist/bricks/TextBox.js +29 -3
- package/dist/bricks/Tooltip.js +3 -3
- package/dist/bricks/Tree.d.ts +76 -13
- package/dist/bricks/Tree.js +116 -32
- package/dist/bricks/index.d.ts +4 -0
- package/dist/bricks/index.js +8 -0
- package/dist/bricks/styles.css.js +1 -1
- package/dist/bricks/~hooks.d.ts +16 -0
- package/dist/bricks/~hooks.js +15 -2
- package/dist/foundations/styles.css.js +1 -1
- package/package.json +2 -2
- package/dist/DEV/bricks/Textarea.js +0 -30
- package/dist/bricks/Textarea.d.ts +0 -24
- package/dist/bricks/Textarea.js +0 -29
package/dist/bricks/TextBox.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Icon } from "./Icon.js";
|
|
3
|
-
import { Textarea } from "./Textarea.js";
|
|
4
3
|
import { type FocusableProps, type BaseProps } from "./~utils.js";
|
|
5
4
|
interface BaseInputProps extends FocusableProps<"input"> {
|
|
6
5
|
}
|
|
@@ -39,6 +38,28 @@ interface TextBoxInputProps extends Omit<BaseInputProps, "children" | "type"> {
|
|
|
39
38
|
* For a multiline text input, use the `TextBox.Textarea` component.
|
|
40
39
|
*/
|
|
41
40
|
declare const TextBoxInput: React.ForwardRefExoticComponent<TextBoxInputProps & React.RefAttributes<HTMLElement | HTMLInputElement>>;
|
|
41
|
+
interface TextareaProps extends FocusableProps<"textarea"> {
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A styled textarea element that allows users to enter multiline text values.
|
|
45
|
+
*
|
|
46
|
+
* Example usage:
|
|
47
|
+
* ```tsx
|
|
48
|
+
* <TextBox.Textarea defaultValue="Hello" />
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* Works well with the `Field` and `Label` components.
|
|
52
|
+
* ```tsx
|
|
53
|
+
* <Field>
|
|
54
|
+
* <Label>Leave a comment, be kind</Label>
|
|
55
|
+
* <TextBox.Textarea />
|
|
56
|
+
* </Field>
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* Underneath, it's an HTML textarea, i.e. `<textarea>`, so it supports the same props, including
|
|
60
|
+
* `value`, `defaultValue`, `onChange`, and `disabled`.
|
|
61
|
+
*/
|
|
62
|
+
declare const TextBoxTextarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLElement | HTMLTextAreaElement>>;
|
|
42
63
|
interface TextBoxRootProps extends BaseProps {
|
|
43
64
|
}
|
|
44
65
|
/**
|
|
@@ -76,4 +97,4 @@ interface TextBoxTextProps extends BaseProps<"span"> {
|
|
|
76
97
|
* A static text decoration for the `TextBox.Root` component. Can be added before or after the `TextBox.Input`.
|
|
77
98
|
*/
|
|
78
99
|
declare const TextBoxText: React.ForwardRefExoticComponent<TextBoxTextProps & React.RefAttributes<HTMLElement | HTMLSpanElement>>;
|
|
79
|
-
export { TextBoxRoot as Root, TextBoxInput as Input, Textarea, TextBoxIcon as Icon, TextBoxText as Text, };
|
|
100
|
+
export { TextBoxRoot as Root, TextBoxInput as Input, TextBoxTextarea as Textarea, TextBoxIcon as Icon, TextBoxText as Text, };
|
package/dist/bricks/TextBox.js
CHANGED
|
@@ -2,13 +2,13 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import * as Ariakit from "@ariakit/react";
|
|
4
4
|
import cx from "classnames";
|
|
5
|
-
import { useFieldId } from "./Field.js";
|
|
5
|
+
import { useFieldDescribedBy, useFieldId } from "./Field.js";
|
|
6
6
|
import { Icon } from "./Icon.js";
|
|
7
|
-
import { Textarea } from "./Textarea.js";
|
|
8
7
|
import { useMergedRefs } from "./~hooks.js";
|
|
9
8
|
import { forwardRef } from "./~utils.js";
|
|
10
9
|
const TextBoxInput = forwardRef(
|
|
11
10
|
(props, forwardedRef) => {
|
|
11
|
+
const describedBy = useFieldDescribedBy(props["aria-describedby"]);
|
|
12
12
|
const fieldId = useFieldId();
|
|
13
13
|
const rootContext = React.useContext(TextBoxRootContext);
|
|
14
14
|
const setDisabled = rootContext?.setDisabled;
|
|
@@ -20,7 +20,9 @@ const TextBoxInput = forwardRef(
|
|
|
20
20
|
{
|
|
21
21
|
id: fieldId,
|
|
22
22
|
...props,
|
|
23
|
+
"aria-describedby": describedBy,
|
|
23
24
|
className: cx({ "\u{1F95D}-text-box": !rootContext }, props.className),
|
|
25
|
+
placeholder: props.placeholder ?? " ",
|
|
24
26
|
render: /* @__PURE__ */ jsx(
|
|
25
27
|
Ariakit.Focusable,
|
|
26
28
|
{
|
|
@@ -33,6 +35,30 @@ const TextBoxInput = forwardRef(
|
|
|
33
35
|
);
|
|
34
36
|
}
|
|
35
37
|
);
|
|
38
|
+
const TextBoxTextarea = forwardRef(
|
|
39
|
+
(props, forwardedRef) => {
|
|
40
|
+
const fieldId = useFieldId();
|
|
41
|
+
const describedBy = useFieldDescribedBy(props["aria-describedby"]);
|
|
42
|
+
return /* @__PURE__ */ jsx(
|
|
43
|
+
Ariakit.Role.textarea,
|
|
44
|
+
{
|
|
45
|
+
id: fieldId,
|
|
46
|
+
...props,
|
|
47
|
+
className: cx("\u{1F95D}-text-box", props.className),
|
|
48
|
+
"aria-describedby": describedBy,
|
|
49
|
+
placeholder: props.placeholder ?? " ",
|
|
50
|
+
render: /* @__PURE__ */ jsx(
|
|
51
|
+
Ariakit.Focusable,
|
|
52
|
+
{
|
|
53
|
+
accessibleWhenDisabled: true,
|
|
54
|
+
render: props.render || /* @__PURE__ */ jsx("textarea", {})
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
ref: forwardedRef
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
);
|
|
36
62
|
const TextBoxRoot = forwardRef(
|
|
37
63
|
(props, forwardedRef) => {
|
|
38
64
|
const inputRef = React.useRef(null);
|
|
@@ -92,5 +118,5 @@ export {
|
|
|
92
118
|
TextBoxInput as Input,
|
|
93
119
|
TextBoxRoot as Root,
|
|
94
120
|
TextBoxText as Text,
|
|
95
|
-
Textarea
|
|
121
|
+
TextBoxTextarea as Textarea
|
|
96
122
|
};
|
package/dist/bricks/Tooltip.js
CHANGED
|
@@ -5,12 +5,12 @@ import * as Ariakit from "@ariakit/react";
|
|
|
5
5
|
import { forwardRef, supportsPopover } from "./~utils.js";
|
|
6
6
|
const Tooltip = forwardRef(
|
|
7
7
|
(props, forwardedRef) => {
|
|
8
|
+
const generatedId = React.useId();
|
|
8
9
|
const {
|
|
9
10
|
content,
|
|
10
11
|
children,
|
|
11
|
-
className,
|
|
12
12
|
type = "description",
|
|
13
|
-
id =
|
|
13
|
+
id = generatedId,
|
|
14
14
|
defaultOpen: defaultOpenProp,
|
|
15
15
|
open: openProp,
|
|
16
16
|
setOpen: setOpenProp,
|
|
@@ -53,7 +53,7 @@ const Tooltip = forwardRef(
|
|
|
53
53
|
"aria-hidden": "true",
|
|
54
54
|
...rest,
|
|
55
55
|
unmountOnHide,
|
|
56
|
-
className: cx("\u{1F95D}-tooltip", className),
|
|
56
|
+
className: cx("\u{1F95D}-tooltip", props.className),
|
|
57
57
|
ref: forwardedRef,
|
|
58
58
|
id,
|
|
59
59
|
style: {
|
package/dist/bricks/Tree.d.ts
CHANGED
|
@@ -1,23 +1,86 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { IconButton } from "./IconButton.js";
|
|
3
2
|
import { type BaseProps } from "./~utils.js";
|
|
4
3
|
interface TreeProps extends BaseProps {
|
|
5
4
|
}
|
|
5
|
+
/**
|
|
6
|
+
* A tree is a hierarchical list of items that can be expanded or collapsed, or optionally selected.
|
|
7
|
+
*
|
|
8
|
+
* `Tree.Root` is the root component for a tree. `Tree.Item`s can be nested inside a `Tree.Root` to create a hierarchical tree structure.
|
|
9
|
+
*
|
|
10
|
+
* Example:
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <Tree.Root>
|
|
13
|
+
* <Tree.Item label="Parent 1">
|
|
14
|
+
* <Tree.Item label="Child 1.1" />
|
|
15
|
+
* <Tree.Item label="Child 1.2" />
|
|
16
|
+
* </Tree.Item>
|
|
17
|
+
* <Tree.Item label="Parent 2">
|
|
18
|
+
* <Tree.Item label="Child 2.1" />
|
|
19
|
+
* </Tree.Item>
|
|
20
|
+
* </Tree.Root>
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
6
23
|
declare const Tree: React.ForwardRefExoticComponent<TreeProps & React.RefAttributes<HTMLElement | HTMLDivElement>>;
|
|
7
24
|
interface TreeItemProps extends Omit<BaseProps, "content"> {
|
|
8
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Specifies if the tree item is selected.
|
|
27
|
+
*
|
|
28
|
+
* If `undefined`, the tree item is not selectable.
|
|
29
|
+
*
|
|
30
|
+
* @default undefined
|
|
31
|
+
*/
|
|
9
32
|
selected?: boolean;
|
|
10
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Callback fired when the tree item is selected.
|
|
35
|
+
*
|
|
36
|
+
* Should be used with the `selected` prop.
|
|
37
|
+
*/
|
|
38
|
+
onSelectedChange?: (selected: boolean) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Specifies if the tree item is expanded.
|
|
41
|
+
*
|
|
42
|
+
* Used to determine if a tree item is a parent node. If `undefined`, it is a leaf node (i.e. not expandable).
|
|
43
|
+
*
|
|
44
|
+
* @default undefined
|
|
45
|
+
* */
|
|
11
46
|
expanded?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Callback fired when the tree item is expanded.
|
|
49
|
+
*
|
|
50
|
+
* Should be used with the `expanded` prop.
|
|
51
|
+
*/
|
|
52
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
53
|
+
/**
|
|
54
|
+
* Icon to be displayed inside the tree item.
|
|
55
|
+
*
|
|
56
|
+
* Can be a URL of an SVG from the `kiwi-icons` package, or a JSX element.
|
|
57
|
+
*/
|
|
58
|
+
icon?: string | React.JSX.Element;
|
|
59
|
+
/** The label to display for the tree item. */
|
|
60
|
+
label?: React.ReactNode;
|
|
61
|
+
/** The actions available for the tree item. */
|
|
62
|
+
actions?: React.ReactNode;
|
|
12
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* A treeitem is a node in a tree structure that may be expanded or collapsed to reveal or hide its descendants.
|
|
66
|
+
*
|
|
67
|
+
* `Tree.Item`s can be nested as JSX elements inside a `Tree.Root` to create a hierarchical tree structure.
|
|
68
|
+
*
|
|
69
|
+
* Example:
|
|
70
|
+
* ```tsx
|
|
71
|
+
* <Tree.Root>
|
|
72
|
+
* <Tree.Item label="Parent">
|
|
73
|
+
* <Tree.Item label="Child 1" />
|
|
74
|
+
* <Tree.Item label="Child 2" />
|
|
75
|
+
* </Tree.Item>
|
|
76
|
+
* </Tree.Root>
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* The `label` and `icon` props can be used to specify the treeitem's own content. `children` is only used for nested items.
|
|
80
|
+
*
|
|
81
|
+
* The `expanded` and `onExpandedChange` props can be used to control the expansion state of a treeitem.
|
|
82
|
+
*
|
|
83
|
+
* The `selected` and `onSelectedChange` props can be used to control the selection state of a treeitem.
|
|
84
|
+
*/
|
|
13
85
|
declare const TreeItem: React.ForwardRefExoticComponent<TreeItemProps & React.RefAttributes<HTMLElement | HTMLDivElement>>;
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
declare const TreeItemContent: React.ForwardRefExoticComponent<TreeItemContentProps & React.RefAttributes<HTMLElement | HTMLSpanElement>>;
|
|
17
|
-
type IconButtonProps = React.ComponentProps<typeof IconButton>;
|
|
18
|
-
interface TreeItemExpanderProps extends Omit<IconButtonProps, "variant" | "label" | "icon"> {
|
|
19
|
-
label?: IconButtonProps["label"];
|
|
20
|
-
icon?: IconButtonProps["icon"];
|
|
21
|
-
}
|
|
22
|
-
declare const TreeItemExpander: React.ForwardRefExoticComponent<Omit<TreeItemExpanderProps, "ref"> & React.RefAttributes<HTMLElement | HTMLButtonElement>>;
|
|
23
|
-
export { Tree as Root, TreeItem as Item, TreeItemExpander as Expander, TreeItemContent as Content, };
|
|
86
|
+
export { Tree as Root, TreeItem as Item };
|
package/dist/bricks/Tree.js
CHANGED
|
@@ -6,14 +6,54 @@ import * as ListItem from "./ListItem.js";
|
|
|
6
6
|
import { IconButton } from "./IconButton.js";
|
|
7
7
|
import { Icon } from "./Icon.js";
|
|
8
8
|
import { forwardRef } from "./~utils.js";
|
|
9
|
+
import { useEventHandlers } from "./~hooks.js";
|
|
9
10
|
const Tree = forwardRef((props, forwardedRef) => {
|
|
10
|
-
|
|
11
|
+
const composite = Ariakit.useCompositeStore({ orientation: "vertical" });
|
|
12
|
+
return /* @__PURE__ */ jsx(
|
|
13
|
+
Ariakit.Role.div,
|
|
14
|
+
{
|
|
15
|
+
role: "tree",
|
|
16
|
+
...props,
|
|
17
|
+
render: /* @__PURE__ */ jsx(Ariakit.Composite, { store: composite }),
|
|
18
|
+
className: cx("\u{1F95D}-tree", props.className),
|
|
19
|
+
ref: forwardedRef,
|
|
20
|
+
children: props.children
|
|
21
|
+
}
|
|
22
|
+
);
|
|
11
23
|
});
|
|
12
24
|
const TreeItem = forwardRef((props, forwardedRef) => {
|
|
13
|
-
const {
|
|
25
|
+
const {
|
|
26
|
+
selected,
|
|
27
|
+
children,
|
|
28
|
+
expanded,
|
|
29
|
+
icon,
|
|
30
|
+
label,
|
|
31
|
+
actions,
|
|
32
|
+
style,
|
|
33
|
+
onSelectedChange,
|
|
34
|
+
onExpandedChange,
|
|
35
|
+
onClick: onClickProp,
|
|
36
|
+
onKeyDown: onKeyDownProp,
|
|
37
|
+
...rest
|
|
38
|
+
} = props;
|
|
14
39
|
const parentContext = React.useContext(TreeItemContext);
|
|
15
40
|
const level = parentContext ? parentContext.level + 1 : 1;
|
|
16
|
-
const
|
|
41
|
+
const handleClick = (event) => {
|
|
42
|
+
if (selected === void 0) return;
|
|
43
|
+
event.stopPropagation();
|
|
44
|
+
onSelectedChange?.(!selected);
|
|
45
|
+
};
|
|
46
|
+
const handleKeyDown = (event) => {
|
|
47
|
+
if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (expanded === void 0) return;
|
|
51
|
+
if (event.key === "ArrowRight" || event.key === "ArrowLeft") {
|
|
52
|
+
event.preventDefault();
|
|
53
|
+
onExpandedChange?.(event.key === "ArrowRight");
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const contentId = React.useId();
|
|
17
57
|
return /* @__PURE__ */ jsx(
|
|
18
58
|
TreeItemContext.Provider,
|
|
19
59
|
{
|
|
@@ -21,58 +61,104 @@ const TreeItem = forwardRef((props, forwardedRef) => {
|
|
|
21
61
|
() => ({
|
|
22
62
|
level,
|
|
23
63
|
expanded,
|
|
24
|
-
selected
|
|
64
|
+
selected,
|
|
65
|
+
contentId
|
|
25
66
|
}),
|
|
26
|
-
[level, expanded, selected]
|
|
67
|
+
[level, expanded, selected, contentId]
|
|
27
68
|
),
|
|
28
|
-
children: /* @__PURE__ */ jsxs(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
{
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
69
|
+
children: /* @__PURE__ */ jsxs(
|
|
70
|
+
Ariakit.CompositeItem,
|
|
71
|
+
{
|
|
72
|
+
render: /* @__PURE__ */ jsx(Ariakit.Role, { ...rest }),
|
|
73
|
+
onClick: useEventHandlers(
|
|
74
|
+
onClickProp,
|
|
75
|
+
handleClick
|
|
76
|
+
),
|
|
77
|
+
onKeyDown: useEventHandlers(
|
|
78
|
+
onKeyDownProp,
|
|
79
|
+
handleKeyDown
|
|
80
|
+
),
|
|
81
|
+
role: "treeitem",
|
|
82
|
+
"aria-expanded": expanded,
|
|
83
|
+
"aria-selected": selected,
|
|
84
|
+
"aria-labelledby": contentId,
|
|
85
|
+
className: cx("\u{1F95D}-tree-item", props.className),
|
|
86
|
+
ref: forwardedRef,
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ jsxs(
|
|
89
|
+
ListItem.Root,
|
|
90
|
+
{
|
|
91
|
+
"data-kiwi-expanded": expanded,
|
|
92
|
+
"data-kiwi-selected": selected,
|
|
93
|
+
className: "\u{1F95D}-tree-item-node",
|
|
94
|
+
style: { "--\u{1F95D}tree-item-level": level },
|
|
95
|
+
role: void 0,
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ jsx(
|
|
98
|
+
TreeItemExpander,
|
|
99
|
+
{
|
|
100
|
+
onClick: () => {
|
|
101
|
+
if (expanded === void 0) return;
|
|
102
|
+
onExpandedChange?.(!expanded);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { href: icon }) : icon,
|
|
107
|
+
/* @__PURE__ */ jsx(TreeItemContent, { label }),
|
|
108
|
+
/* @__PURE__ */ jsx(TreeItemActions, { children: actions })
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
children && /* @__PURE__ */ jsx("div", { role: "group", children })
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
)
|
|
48
116
|
}
|
|
49
117
|
);
|
|
50
118
|
});
|
|
51
119
|
const TreeItemContent = forwardRef(
|
|
52
120
|
(props, forwardedRef) => {
|
|
53
|
-
const {
|
|
121
|
+
const { label, ...rest } = props;
|
|
122
|
+
const { contentId } = React.useContext(TreeItemContext) ?? {};
|
|
54
123
|
return /* @__PURE__ */ jsx(
|
|
55
124
|
ListItem.Content,
|
|
56
125
|
{
|
|
57
126
|
...rest,
|
|
127
|
+
id: contentId,
|
|
58
128
|
className: cx("\u{1F95D}-tree-item-content", props.className),
|
|
59
129
|
ref: forwardedRef,
|
|
60
|
-
children:
|
|
130
|
+
children: label
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
const TreeItemActions = forwardRef(
|
|
136
|
+
(props, forwardedRef) => {
|
|
137
|
+
const { visible, ...rest } = props;
|
|
138
|
+
return /* @__PURE__ */ jsx(
|
|
139
|
+
Ariakit.Toolbar,
|
|
140
|
+
{
|
|
141
|
+
...rest,
|
|
142
|
+
onClick: useEventHandlers(props.onClick, (e) => e.stopPropagation()),
|
|
143
|
+
className: cx("\u{1F95D}-tree-item-actions", props.className),
|
|
144
|
+
"data-kiwi-visible": visible,
|
|
145
|
+
ref: forwardedRef,
|
|
146
|
+
children: props.children
|
|
61
147
|
}
|
|
62
148
|
);
|
|
63
149
|
}
|
|
64
150
|
);
|
|
65
151
|
const TreeItemExpander = forwardRef(
|
|
66
152
|
(props, forwardedRef) => {
|
|
67
|
-
const context = React.useContext(TreeItemContext);
|
|
68
|
-
const expanded = context?.expanded;
|
|
69
153
|
return /* @__PURE__ */ jsx(
|
|
70
154
|
IconButton,
|
|
71
155
|
{
|
|
156
|
+
tabIndex: -1,
|
|
157
|
+
"aria-hidden": "true",
|
|
72
158
|
icon: /* @__PURE__ */ jsx(TreeChevron, {}),
|
|
73
159
|
label: "Toggle",
|
|
74
|
-
"aria-expanded": expanded === void 0 ? void 0 : expanded,
|
|
75
160
|
...props,
|
|
161
|
+
onClick: useEventHandlers(props.onClick, (e) => e.stopPropagation()),
|
|
76
162
|
className: cx("\u{1F95D}-tree-item-expander", props.className),
|
|
77
163
|
variant: "ghost",
|
|
78
164
|
labelVariant: "visually-hidden",
|
|
@@ -106,8 +192,6 @@ const TreeChevron = forwardRef(
|
|
|
106
192
|
);
|
|
107
193
|
const TreeItemContext = React.createContext(void 0);
|
|
108
194
|
export {
|
|
109
|
-
TreeItemContent as Content,
|
|
110
|
-
TreeItemExpander as Expander,
|
|
111
195
|
TreeItem as Item,
|
|
112
196
|
Tree as Root
|
|
113
197
|
};
|
package/dist/bricks/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ export { Root } from "./Root.js";
|
|
|
2
2
|
export { Anchor } from "./Anchor.js";
|
|
3
3
|
export { Button } from "./Button.js";
|
|
4
4
|
export { Checkbox } from "./Checkbox.js";
|
|
5
|
+
export { Chip } from "./Chip.js";
|
|
6
|
+
export { Description } from "./Description.js";
|
|
5
7
|
export * as DropdownMenu from "./DropdownMenu.js";
|
|
6
8
|
export { Divider } from "./Divider.js";
|
|
7
9
|
export { Icon } from "./Icon.js";
|
|
@@ -11,9 +13,11 @@ export { Kbd } from "./Kbd.js";
|
|
|
11
13
|
export { Label } from "./Label.js";
|
|
12
14
|
export { Radio } from "./Radio.js";
|
|
13
15
|
export * as Select from "./Select.js";
|
|
16
|
+
export { Spinner } from "./Spinner.js";
|
|
14
17
|
export { Switch } from "./Switch.js";
|
|
15
18
|
export * as Tabs from "./Tabs.js";
|
|
16
19
|
export { Text } from "./Text.js";
|
|
17
20
|
export * as TextBox from "./TextBox.js";
|
|
21
|
+
export * as Tree from "./Tree.js";
|
|
18
22
|
export { Tooltip } from "./Tooltip.js";
|
|
19
23
|
export { VisuallyHidden } from "./VisuallyHidden.js";
|
package/dist/bricks/index.js
CHANGED
|
@@ -3,6 +3,8 @@ import { Root } from "./Root.js";
|
|
|
3
3
|
import { Anchor } from "./Anchor.js";
|
|
4
4
|
import { Button } from "./Button.js";
|
|
5
5
|
import { Checkbox } from "./Checkbox.js";
|
|
6
|
+
import { Chip } from "./Chip.js";
|
|
7
|
+
import { Description } from "./Description.js";
|
|
6
8
|
import * as DropdownMenu from "./DropdownMenu.js";
|
|
7
9
|
import { Divider } from "./Divider.js";
|
|
8
10
|
import { Icon } from "./Icon.js";
|
|
@@ -12,16 +14,20 @@ import { Kbd } from "./Kbd.js";
|
|
|
12
14
|
import { Label } from "./Label.js";
|
|
13
15
|
import { Radio } from "./Radio.js";
|
|
14
16
|
import * as Select from "./Select.js";
|
|
17
|
+
import { Spinner } from "./Spinner.js";
|
|
15
18
|
import { Switch } from "./Switch.js";
|
|
16
19
|
import * as Tabs from "./Tabs.js";
|
|
17
20
|
import { Text } from "./Text.js";
|
|
18
21
|
import * as TextBox from "./TextBox.js";
|
|
22
|
+
import * as Tree from "./Tree.js";
|
|
19
23
|
import { Tooltip } from "./Tooltip.js";
|
|
20
24
|
import { VisuallyHidden } from "./VisuallyHidden.js";
|
|
21
25
|
export {
|
|
22
26
|
Anchor,
|
|
23
27
|
Button,
|
|
24
28
|
Checkbox,
|
|
29
|
+
Chip,
|
|
30
|
+
Description,
|
|
25
31
|
Divider,
|
|
26
32
|
DropdownMenu,
|
|
27
33
|
Field,
|
|
@@ -32,10 +38,12 @@ export {
|
|
|
32
38
|
Radio,
|
|
33
39
|
Root,
|
|
34
40
|
Select,
|
|
41
|
+
Spinner,
|
|
35
42
|
Switch,
|
|
36
43
|
Tabs,
|
|
37
44
|
Text,
|
|
38
45
|
TextBox,
|
|
39
46
|
Tooltip,
|
|
47
|
+
Tree,
|
|
40
48
|
VisuallyHidden
|
|
41
49
|
};
|