@itwin/itwinui-react 5.0.0-alpha.1 → 5.0.0-alpha.11
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 +102 -0
- package/LICENSE.md +1 -1
- package/README.md +6 -6
- package/dist/DEV/bricks/Anchor.js +5 -10
- package/dist/DEV/bricks/Avatar.js +24 -0
- package/dist/DEV/bricks/Badge.js +22 -0
- package/dist/DEV/bricks/Button.js +11 -4
- package/dist/DEV/bricks/Checkbox.js +17 -9
- package/dist/DEV/bricks/Chip.js +42 -0
- package/dist/DEV/bricks/Description.js +29 -0
- package/dist/DEV/bricks/Divider.js +3 -2
- package/dist/DEV/bricks/DropdownMenu.js +109 -30
- package/dist/DEV/bricks/Field.js +115 -14
- package/dist/DEV/bricks/Icon.js +177 -10
- package/dist/DEV/bricks/IconButton.js +14 -3
- package/dist/DEV/bricks/Kbd.internal.js +19 -0
- package/dist/DEV/bricks/Kbd.js +23 -6
- package/dist/DEV/bricks/Label.js +11 -8
- package/dist/DEV/bricks/ProgressBar.js +25 -0
- package/dist/DEV/bricks/Radio.js +17 -9
- package/dist/DEV/bricks/Root.internal.js +17 -0
- package/dist/DEV/bricks/Root.js +103 -26
- package/dist/DEV/bricks/Select.js +17 -11
- package/dist/DEV/bricks/Skeleton.js +24 -0
- package/dist/DEV/bricks/Spinner.js +55 -0
- package/dist/DEV/bricks/Switch.js +18 -10
- package/dist/DEV/bricks/Table.js +114 -0
- package/dist/DEV/bricks/Tabs.js +6 -6
- package/dist/DEV/bricks/Text.js +2 -2
- package/dist/DEV/bricks/TextBox.js +54 -16
- package/dist/DEV/bricks/Tooltip.js +17 -25
- package/dist/DEV/bricks/Tree.js +15 -107
- package/dist/DEV/bricks/TreeItem.js +227 -0
- package/dist/DEV/bricks/VisuallyHidden.js +2 -2
- package/dist/DEV/bricks/index.js +16 -0
- package/dist/DEV/bricks/styles.css.js +2 -2
- package/dist/DEV/bricks/~hooks.js +57 -3
- package/dist/DEV/bricks/~utils.GhostAligner.js +13 -0
- package/dist/DEV/bricks/{ListItem.js → ~utils.ListItem.js} +19 -3
- package/dist/DEV/bricks/~utils.js +17 -0
- package/dist/DEV/foundations/styles.css.js +2 -2
- package/dist/bricks/Anchor.js +5 -10
- package/dist/bricks/Avatar.d.ts +47 -0
- package/dist/bricks/Avatar.js +23 -0
- package/dist/bricks/Badge.d.ts +28 -0
- package/dist/bricks/Badge.js +21 -0
- package/dist/bricks/Button.js +11 -4
- package/dist/bricks/Checkbox.d.ts +2 -2
- package/dist/bricks/Checkbox.js +17 -9
- package/dist/bricks/Chip.d.ts +31 -0
- package/dist/bricks/Chip.js +41 -0
- package/dist/bricks/Description.d.ts +19 -0
- package/dist/bricks/Description.js +29 -0
- package/dist/bricks/Divider.d.ts +2 -2
- package/dist/bricks/Divider.js +3 -2
- package/dist/bricks/DropdownMenu.d.ts +41 -14
- package/dist/bricks/DropdownMenu.js +106 -30
- package/dist/bricks/Field.d.ts +23 -1
- package/dist/bricks/Field.js +115 -14
- package/dist/bricks/Icon.d.ts +43 -4
- package/dist/bricks/Icon.js +174 -10
- package/dist/bricks/IconButton.d.ts +20 -4
- package/dist/bricks/IconButton.js +14 -3
- package/dist/bricks/Kbd.d.ts +15 -0
- package/dist/bricks/Kbd.internal.d.ts +17 -0
- package/dist/bricks/Kbd.internal.js +19 -0
- package/dist/bricks/Kbd.js +16 -6
- package/dist/bricks/Label.js +11 -8
- package/dist/bricks/ProgressBar.d.ts +31 -0
- package/dist/bricks/ProgressBar.js +24 -0
- package/dist/bricks/Radio.d.ts +2 -2
- package/dist/bricks/Radio.js +17 -9
- package/dist/bricks/Root.d.ts +12 -0
- package/dist/bricks/Root.internal.d.ts +6 -0
- package/dist/bricks/Root.internal.js +17 -0
- package/dist/bricks/Root.js +103 -26
- package/dist/bricks/Select.d.ts +9 -3
- package/dist/bricks/Select.js +17 -11
- package/dist/bricks/Skeleton.d.ts +25 -0
- package/dist/bricks/Skeleton.js +23 -0
- package/dist/bricks/Spinner.d.ts +31 -0
- package/dist/bricks/Spinner.js +54 -0
- package/dist/bricks/Switch.d.ts +2 -2
- package/dist/bricks/Switch.js +18 -10
- package/dist/bricks/Table.d.ts +115 -0
- package/dist/bricks/Table.js +108 -0
- package/dist/bricks/Tabs.d.ts +4 -4
- package/dist/bricks/Tabs.js +6 -6
- package/dist/bricks/Text.d.ts +1 -1
- package/dist/bricks/Text.js +2 -2
- package/dist/bricks/TextBox.d.ts +23 -2
- package/dist/bricks/TextBox.js +53 -16
- package/dist/bricks/Tooltip.d.ts +2 -2
- package/dist/bricks/Tooltip.js +17 -25
- package/dist/bricks/Tree.d.ts +19 -20
- package/dist/bricks/Tree.js +14 -102
- package/dist/bricks/TreeItem.d.ts +129 -0
- package/dist/bricks/TreeItem.js +222 -0
- package/dist/bricks/VisuallyHidden.js +2 -2
- package/dist/bricks/index.d.ts +8 -0
- package/dist/bricks/index.js +16 -0
- package/dist/bricks/styles.css.js +2 -2
- package/dist/bricks/~hooks.d.ts +63 -0
- package/dist/bricks/~hooks.js +57 -3
- package/dist/bricks/~utils.GhostAligner.d.ts +22 -0
- package/dist/bricks/~utils.GhostAligner.js +13 -0
- package/dist/bricks/~utils.ListItem.d.ts +14 -0
- package/dist/bricks/{ListItem.js → ~utils.ListItem.js} +18 -3
- package/dist/bricks/~utils.d.ts +14 -3
- package/dist/bricks/~utils.js +17 -0
- package/dist/foundations/styles.css.js +2 -2
- package/package.json +14 -13
- package/dist/DEV/bricks/Textarea.js +0 -30
- package/dist/bricks/ListItem.d.ts +0 -10
- package/dist/bricks/Textarea.d.ts +0 -24
- package/dist/bricks/Textarea.js +0 -29
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type BaseProps } from "./~utils.js";
|
|
3
|
+
interface TableProps extends BaseProps {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* A table is a grid of rows and columns that displays data in a structured format.
|
|
7
|
+
*
|
|
8
|
+
* `Table.Root` is the root component for a table.
|
|
9
|
+
* `Table.Header`, `Table.Body`, and `Table.Cell` can be nested inside a `Table.Root` to create a table structure.
|
|
10
|
+
*
|
|
11
|
+
* Example:
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <Table.Root>
|
|
14
|
+
* <Table.Caption>Table Caption</Table.Caption>
|
|
15
|
+
* <Table.Header>
|
|
16
|
+
* <Table.Row>
|
|
17
|
+
* <Table.Cell>Header 1</Table.Cell>
|
|
18
|
+
* <Table.Cell>Header 2</Table.Cell>
|
|
19
|
+
* </Table.Row>
|
|
20
|
+
* </Table.Header>
|
|
21
|
+
*
|
|
22
|
+
* <Table.Body>
|
|
23
|
+
* <Table.Row>
|
|
24
|
+
* <Table.Cell>Cell 1.1</Table.Cell>
|
|
25
|
+
* <Table.Cell>Cell 1.2</Table.Cell>
|
|
26
|
+
* </Table.Row>
|
|
27
|
+
* <Table.Row>
|
|
28
|
+
* <Table.Cell>Cell 2.1</Table.Cell>
|
|
29
|
+
* <Table.Cell>Cell 2.2</Table.Cell>
|
|
30
|
+
* </Table.Row>
|
|
31
|
+
* </Table.Body>
|
|
32
|
+
* </Table.Root>
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
declare const Table: React.ForwardRefExoticComponent<TableProps & React.RefAttributes<HTMLElement | HTMLDivElement>>;
|
|
36
|
+
interface TableHeaderProps extends BaseProps {
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* `Table.Header` is a column component of cells that labels the columns of a table.
|
|
40
|
+
* `Table.Row` and `Table.Cell` can be nested inside a `Table.Header` to create a header row.
|
|
41
|
+
*
|
|
42
|
+
* Example:
|
|
43
|
+
* ```tsx
|
|
44
|
+
* <Table.Header>
|
|
45
|
+
* <Table.Row>
|
|
46
|
+
* <Table.Cell>Header 1</Table.Cell>
|
|
47
|
+
* <Table.Cell>Header 2</Table.Cell>
|
|
48
|
+
* </Table.Row>
|
|
49
|
+
* </Table.Header>
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
declare const TableHeader: React.ForwardRefExoticComponent<TableHeaderProps & React.RefAttributes<HTMLElement | HTMLDivElement>>;
|
|
53
|
+
interface TableBodyProps extends BaseProps {
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* `Table.Body` is a component that contains the rows of table data.
|
|
57
|
+
* Multiple `Table.Row`s and `Table.Cell`s can be nested inside a `Table.Body` to create a table body.
|
|
58
|
+
*
|
|
59
|
+
* This component intentionally does not set `role=rowgroup` because it is not properly supported.
|
|
60
|
+
*
|
|
61
|
+
* Example:
|
|
62
|
+
* ```tsx
|
|
63
|
+
* <Table.Body>
|
|
64
|
+
* <Table.Row>
|
|
65
|
+
* <Table.Cell>Cell 1.1</Table.Cell>
|
|
66
|
+
* <Table.Cell>Cell 1.2</Table.Cell>
|
|
67
|
+
* </Table.Row>
|
|
68
|
+
* <Table.Row>
|
|
69
|
+
* <Table.Cell>Cell 2.1</Table.Cell>
|
|
70
|
+
* <Table.Cell>Cell 2.2</Table.Cell>
|
|
71
|
+
* </Table.Row>
|
|
72
|
+
* </Table.Body>
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
declare const TableBody: React.ForwardRefExoticComponent<TableBodyProps & React.RefAttributes<HTMLElement | HTMLDivElement>>;
|
|
76
|
+
interface TableRowProps extends BaseProps {
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* `Table.Row` is a component that contains the cells of a table row.
|
|
80
|
+
*
|
|
81
|
+
* Example:
|
|
82
|
+
* ```tsx
|
|
83
|
+
* <Table.Row>
|
|
84
|
+
* <Table.Cell>Cell 1.1</Table.Cell>
|
|
85
|
+
* <Table.Cell>Cell 1.2</Table.Cell>
|
|
86
|
+
* </Table.Row>
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
declare const TableRow: React.ForwardRefExoticComponent<TableRowProps & React.RefAttributes<HTMLElement | HTMLDivElement>>;
|
|
90
|
+
interface TableCaptionProps extends BaseProps<"caption"> {
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* `Table.Caption` is a component that contains the caption of a table.
|
|
94
|
+
*
|
|
95
|
+
* Example:
|
|
96
|
+
* ```tsx
|
|
97
|
+
* <Table.Root>
|
|
98
|
+
* <Table.Caption>Table Caption</Table.Caption>
|
|
99
|
+
* …
|
|
100
|
+
* </Table.Root>
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
declare const TableCaption: React.ForwardRefExoticComponent<TableCaptionProps & React.RefAttributes<HTMLElement>>;
|
|
104
|
+
interface TableCellProps extends BaseProps<"span"> {
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* `Table.Cell` is a component that contains the data of a table cell.
|
|
108
|
+
*
|
|
109
|
+
* Example:
|
|
110
|
+
* ```tsx
|
|
111
|
+
* <Table.Cell>Cell 1.1</Table.Cell>
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
declare const TableCell: React.ForwardRefExoticComponent<TableCellProps & React.RefAttributes<HTMLElement | HTMLSpanElement>>;
|
|
115
|
+
export { Table as Root, TableHeader as Header, TableBody as Body, TableRow as Row, TableCaption as Caption, TableCell as Cell, };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Role } from "@ariakit/react/role";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import cx from "classnames";
|
|
5
|
+
import { forwardRef } from "./~utils.js";
|
|
6
|
+
import { useMergedRefs } from "./~hooks.js";
|
|
7
|
+
const TableContext = React.createContext({
|
|
8
|
+
setCaptionId: () => {
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const Table = forwardRef((props, forwardedRef) => {
|
|
12
|
+
const [captionId, setCaptionId] = React.useState();
|
|
13
|
+
const tableContext = React.useMemo(() => ({ setCaptionId }), []);
|
|
14
|
+
return /* @__PURE__ */ jsx(TableContext.Provider, { value: tableContext, children: /* @__PURE__ */ jsx(
|
|
15
|
+
Role,
|
|
16
|
+
{
|
|
17
|
+
...props,
|
|
18
|
+
className: cx("\u{1F95D}-table", props.className),
|
|
19
|
+
ref: forwardedRef,
|
|
20
|
+
role: "table",
|
|
21
|
+
"aria-labelledby": captionId,
|
|
22
|
+
children: props.children
|
|
23
|
+
}
|
|
24
|
+
) });
|
|
25
|
+
});
|
|
26
|
+
const TableHeaderContext = React.createContext(false);
|
|
27
|
+
const TableHeader = forwardRef(
|
|
28
|
+
(props, forwardedRef) => {
|
|
29
|
+
return /* @__PURE__ */ jsx(TableHeaderContext.Provider, { value: true, children: /* @__PURE__ */ jsx(
|
|
30
|
+
Role.div,
|
|
31
|
+
{
|
|
32
|
+
...props,
|
|
33
|
+
className: cx("\u{1F95D}-table-header", props.className),
|
|
34
|
+
ref: forwardedRef,
|
|
35
|
+
role: "rowgroup",
|
|
36
|
+
children: props.children
|
|
37
|
+
}
|
|
38
|
+
) });
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
const TableBody = forwardRef((props, forwardedRef) => {
|
|
42
|
+
return /* @__PURE__ */ jsx(
|
|
43
|
+
Role.div,
|
|
44
|
+
{
|
|
45
|
+
...props,
|
|
46
|
+
className: cx("\u{1F95D}-table-body", props.className),
|
|
47
|
+
ref: forwardedRef,
|
|
48
|
+
children: props.children
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
const TableRow = forwardRef((props, forwardedRef) => {
|
|
53
|
+
const { children, ...rest } = props;
|
|
54
|
+
return /* @__PURE__ */ jsx(
|
|
55
|
+
Role.div,
|
|
56
|
+
{
|
|
57
|
+
...rest,
|
|
58
|
+
className: cx("\u{1F95D}-table-row", props.className),
|
|
59
|
+
ref: forwardedRef,
|
|
60
|
+
role: "row",
|
|
61
|
+
children
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
});
|
|
65
|
+
const TableCaption = forwardRef(
|
|
66
|
+
(props, forwardedRef) => {
|
|
67
|
+
const fallbackId = React.useId();
|
|
68
|
+
const { id = fallbackId, children, ...rest } = props;
|
|
69
|
+
const { setCaptionId } = React.useContext(TableContext);
|
|
70
|
+
const captionIdRef = React.useCallback(
|
|
71
|
+
(element) => {
|
|
72
|
+
setCaptionId(element ? id : void 0);
|
|
73
|
+
},
|
|
74
|
+
[id, setCaptionId]
|
|
75
|
+
);
|
|
76
|
+
return /* @__PURE__ */ jsx(
|
|
77
|
+
Role,
|
|
78
|
+
{
|
|
79
|
+
...rest,
|
|
80
|
+
id,
|
|
81
|
+
className: cx("\u{1F95D}-table-caption", props.className),
|
|
82
|
+
ref: useMergedRefs(forwardedRef, captionIdRef),
|
|
83
|
+
children
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
const TableCell = forwardRef((props, forwardedRef) => {
|
|
89
|
+
const isWithinTableHeader = React.useContext(TableHeaderContext);
|
|
90
|
+
return /* @__PURE__ */ jsx(
|
|
91
|
+
Role.span,
|
|
92
|
+
{
|
|
93
|
+
...props,
|
|
94
|
+
className: cx("\u{1F95D}-table-cell", props.className),
|
|
95
|
+
ref: forwardedRef,
|
|
96
|
+
role: isWithinTableHeader ? "columnheader" : "cell",
|
|
97
|
+
children: props.children
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
});
|
|
101
|
+
export {
|
|
102
|
+
TableBody as Body,
|
|
103
|
+
TableCaption as Caption,
|
|
104
|
+
TableCell as Cell,
|
|
105
|
+
TableHeader as Header,
|
|
106
|
+
Table as Root,
|
|
107
|
+
TableRow as Row
|
|
108
|
+
};
|
package/dist/bricks/Tabs.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as AkTab from "@ariakit/react/tab";
|
|
3
3
|
import { type FocusableProps, type BaseProps } from "./~utils.js";
|
|
4
|
-
interface TabsProps extends Pick<
|
|
4
|
+
interface TabsProps extends Pick<AkTab.TabProviderProps, "defaultSelectedId" | "selectedId" | "setSelectedId" | "selectOnMove" | "children"> {
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
7
|
* A set of tabs that can be used to switch between different views.
|
|
@@ -53,7 +53,7 @@ interface TabListProps extends BaseProps {
|
|
|
53
53
|
* ```
|
|
54
54
|
*/
|
|
55
55
|
declare const TabList: React.ForwardRefExoticComponent<TabListProps & React.RefAttributes<HTMLElement | HTMLDivElement>>;
|
|
56
|
-
interface TabProps extends FocusableProps<"button">, Pick<
|
|
56
|
+
interface TabProps extends FocusableProps<"button">, Pick<AkTab.TabProps, "id"> {
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* An individual tab button that switches the selected tab panel when clicked.
|
|
@@ -67,7 +67,7 @@ interface TabProps extends FocusableProps<"button">, Pick<Ariakit.TabProps, "id"
|
|
|
67
67
|
* ```
|
|
68
68
|
*/
|
|
69
69
|
declare const Tab: React.ForwardRefExoticComponent<TabProps & React.RefAttributes<HTMLElement | HTMLButtonElement>>;
|
|
70
|
-
interface TabPanelProps extends
|
|
70
|
+
interface TabPanelProps extends FocusableProps<"div">, Pick<AkTab.TabPanelProps, "tabId" | "unmountOnHide" | "focusable"> {
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
73
73
|
* The actual content of a tab, shown when the tab is selected. Should be used as a child of `Tabs.Root`.
|
package/dist/bricks/Tabs.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import * as ReactDOM from "react-dom";
|
|
4
4
|
import cx from "classnames";
|
|
5
|
-
import * as
|
|
5
|
+
import * as AkTab from "@ariakit/react/tab";
|
|
6
6
|
import { useControlledState } from "./~hooks.js";
|
|
7
7
|
import { forwardRef } from "./~utils.js";
|
|
8
8
|
function Tabs(props) {
|
|
@@ -19,7 +19,7 @@ function Tabs(props) {
|
|
|
19
19
|
setSelectedIdProp
|
|
20
20
|
);
|
|
21
21
|
return /* @__PURE__ */ jsx(
|
|
22
|
-
|
|
22
|
+
AkTab.TabProvider,
|
|
23
23
|
{
|
|
24
24
|
selectedId,
|
|
25
25
|
setSelectedId: React.useCallback(
|
|
@@ -45,10 +45,10 @@ const TabList = forwardRef((props, forwardedRef) => {
|
|
|
45
45
|
const { tone = "neutral", ...rest } = props;
|
|
46
46
|
const viewTransitionName = `\u{1F95D}active-stripe-${React.useId().replaceAll(":", "_")}`;
|
|
47
47
|
return /* @__PURE__ */ jsx(
|
|
48
|
-
|
|
48
|
+
AkTab.TabList,
|
|
49
49
|
{
|
|
50
|
-
"data-kiwi-tone": tone,
|
|
51
50
|
...rest,
|
|
51
|
+
"data-kiwi-tone": tone,
|
|
52
52
|
className: cx("\u{1F95D}-tab-list", props.className),
|
|
53
53
|
style: {
|
|
54
54
|
"--\u{1F95D}tab-active-stripe-view-transition-name": viewTransitionName,
|
|
@@ -60,7 +60,7 @@ const TabList = forwardRef((props, forwardedRef) => {
|
|
|
60
60
|
});
|
|
61
61
|
const Tab = forwardRef((props, forwardedRef) => {
|
|
62
62
|
return /* @__PURE__ */ jsx(
|
|
63
|
-
|
|
63
|
+
AkTab.Tab,
|
|
64
64
|
{
|
|
65
65
|
accessibleWhenDisabled: true,
|
|
66
66
|
...props,
|
|
@@ -71,7 +71,7 @@ const Tab = forwardRef((props, forwardedRef) => {
|
|
|
71
71
|
});
|
|
72
72
|
const TabPanel = forwardRef((props, forwardedRef) => {
|
|
73
73
|
return /* @__PURE__ */ jsx(
|
|
74
|
-
|
|
74
|
+
AkTab.TabPanel,
|
|
75
75
|
{
|
|
76
76
|
...props,
|
|
77
77
|
className: cx("\u{1F95D}-tab-panel", props.className),
|
package/dist/bricks/Text.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ interface TextProps extends BaseProps {
|
|
|
3
3
|
/**
|
|
4
4
|
* The typography variant to use.
|
|
5
5
|
*/
|
|
6
|
-
variant
|
|
6
|
+
variant: "display-lg" | "display-md" | "display-sm" | "headline-lg" | "headline-md" | "headline-sm" | "body-lg" | "body-md" | "body-sm" | "caption-lg" | "caption-md" | "caption-sm" | "mono-sm";
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* An element with text styles applied. Useful for paragraphs, headings, and other text content.
|
package/dist/bricks/Text.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import { Role } from "@ariakit/react/role";
|
|
3
3
|
import cx from "classnames";
|
|
4
4
|
import { forwardRef } from "./~utils.js";
|
|
5
5
|
const Text = forwardRef((props, forwardedRef) => {
|
|
6
6
|
const { variant, ...rest } = props;
|
|
7
7
|
return /* @__PURE__ */ jsx(
|
|
8
|
-
|
|
8
|
+
Role,
|
|
9
9
|
{
|
|
10
10
|
...rest,
|
|
11
11
|
className: cx("\u{1F95D}-text", props.className),
|
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
|
@@ -1,34 +1,71 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import
|
|
3
|
+
import { Role } from "@ariakit/react/role";
|
|
4
|
+
import { Focusable } from "@ariakit/react/focusable";
|
|
4
5
|
import cx from "classnames";
|
|
5
|
-
import {
|
|
6
|
+
import { FieldControl } from "./Field.js";
|
|
6
7
|
import { Icon } from "./Icon.js";
|
|
7
|
-
import { Textarea } from "./Textarea.js";
|
|
8
8
|
import { useMergedRefs } from "./~hooks.js";
|
|
9
9
|
import { forwardRef } from "./~utils.js";
|
|
10
10
|
const TextBoxInput = forwardRef(
|
|
11
11
|
(props, forwardedRef) => {
|
|
12
|
-
const
|
|
12
|
+
const { id, ...rest } = props;
|
|
13
13
|
const rootContext = React.useContext(TextBoxRootContext);
|
|
14
14
|
const setDisabled = rootContext?.setDisabled;
|
|
15
15
|
React.useEffect(() => {
|
|
16
16
|
setDisabled?.(props.disabled);
|
|
17
17
|
}, [setDisabled, props.disabled]);
|
|
18
18
|
return /* @__PURE__ */ jsx(
|
|
19
|
-
|
|
19
|
+
FieldControl,
|
|
20
20
|
{
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
className: cx({ "\u{1F95D}-text-box": !rootContext }, props.className),
|
|
21
|
+
type: "textlike",
|
|
22
|
+
id,
|
|
24
23
|
render: /* @__PURE__ */ jsx(
|
|
25
|
-
|
|
24
|
+
Role.input,
|
|
26
25
|
{
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
readOnly: props.disabled,
|
|
27
|
+
...rest,
|
|
28
|
+
className: cx({ "\u{1F95D}-text-box": !rootContext }, props.className),
|
|
29
|
+
placeholder: props.placeholder ?? " ",
|
|
30
|
+
render: /* @__PURE__ */ jsx(
|
|
31
|
+
Focusable,
|
|
32
|
+
{
|
|
33
|
+
accessibleWhenDisabled: true,
|
|
34
|
+
render: props.render || /* @__PURE__ */ jsx("input", {})
|
|
35
|
+
}
|
|
36
|
+
),
|
|
37
|
+
ref: useMergedRefs(rootContext?.inputRef, forwardedRef)
|
|
29
38
|
}
|
|
30
|
-
)
|
|
31
|
-
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
const TextBoxTextarea = forwardRef(
|
|
45
|
+
(props, forwardedRef) => {
|
|
46
|
+
const { id, ...rest } = props;
|
|
47
|
+
return /* @__PURE__ */ jsx(
|
|
48
|
+
FieldControl,
|
|
49
|
+
{
|
|
50
|
+
type: "textlike",
|
|
51
|
+
id,
|
|
52
|
+
render: /* @__PURE__ */ jsx(
|
|
53
|
+
Role.textarea,
|
|
54
|
+
{
|
|
55
|
+
readOnly: props.disabled,
|
|
56
|
+
...rest,
|
|
57
|
+
className: cx("\u{1F95D}-text-box", props.className),
|
|
58
|
+
placeholder: props.placeholder ?? " ",
|
|
59
|
+
render: /* @__PURE__ */ jsx(
|
|
60
|
+
Focusable,
|
|
61
|
+
{
|
|
62
|
+
accessibleWhenDisabled: true,
|
|
63
|
+
render: props.render || /* @__PURE__ */ jsx("textarea", {})
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
ref: forwardedRef
|
|
67
|
+
}
|
|
68
|
+
)
|
|
32
69
|
}
|
|
33
70
|
);
|
|
34
71
|
}
|
|
@@ -42,7 +79,7 @@ const TextBoxRoot = forwardRef(
|
|
|
42
79
|
{
|
|
43
80
|
value: React.useMemo(() => ({ setDisabled, inputRef }), []),
|
|
44
81
|
children: /* @__PURE__ */ jsx(
|
|
45
|
-
|
|
82
|
+
Role.div,
|
|
46
83
|
{
|
|
47
84
|
...props,
|
|
48
85
|
"data-kiwi-disabled": disabled,
|
|
@@ -77,7 +114,7 @@ const TextBoxIcon = forwardRef(
|
|
|
77
114
|
const TextBoxText = forwardRef(
|
|
78
115
|
(props, forwardedRef) => {
|
|
79
116
|
return /* @__PURE__ */ jsx(
|
|
80
|
-
|
|
117
|
+
Role.span,
|
|
81
118
|
{
|
|
82
119
|
...props,
|
|
83
120
|
className: cx("\u{1F95D}-text-box-decoration", props.className),
|
|
@@ -92,5 +129,5 @@ export {
|
|
|
92
129
|
TextBoxInput as Input,
|
|
93
130
|
TextBoxRoot as Root,
|
|
94
131
|
TextBoxText as Text,
|
|
95
|
-
Textarea
|
|
132
|
+
TextBoxTextarea as Textarea
|
|
96
133
|
};
|
package/dist/bricks/Tooltip.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as AkTooltip from "@ariakit/react/tooltip";
|
|
3
3
|
import { type FocusableProps } from "./~utils.js";
|
|
4
|
-
interface TooltipProps extends Omit<FocusableProps<"div">, "content">, Pick<
|
|
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.
|
|
7
7
|
*/
|
package/dist/bricks/Tooltip.js
CHANGED
|
@@ -1,38 +1,29 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import cx from "classnames";
|
|
4
|
-
import * as
|
|
5
|
-
import {
|
|
4
|
+
import * as AkTooltip from "@ariakit/react/tooltip";
|
|
5
|
+
import { useStoreState } from "@ariakit/react/store";
|
|
6
|
+
import { forwardRef } from "./~utils.js";
|
|
7
|
+
import { usePopoverApi } from "./~hooks.js";
|
|
6
8
|
const Tooltip = forwardRef(
|
|
7
9
|
(props, forwardedRef) => {
|
|
10
|
+
const generatedId = React.useId();
|
|
8
11
|
const {
|
|
9
12
|
content,
|
|
10
13
|
children,
|
|
11
|
-
className,
|
|
12
14
|
type = "description",
|
|
13
|
-
id =
|
|
15
|
+
id = generatedId,
|
|
14
16
|
defaultOpen: defaultOpenProp,
|
|
15
17
|
open: openProp,
|
|
16
18
|
setOpen: setOpenProp,
|
|
17
19
|
unmountOnHide = type === "none",
|
|
18
20
|
...rest
|
|
19
21
|
} = props;
|
|
20
|
-
const store =
|
|
21
|
-
const open =
|
|
22
|
-
const popover =
|
|
23
|
-
store,
|
|
24
|
-
(state) => state.popoverElement
|
|
25
|
-
);
|
|
26
|
-
React.useEffect(
|
|
27
|
-
function syncPopoverWithOpenState() {
|
|
28
|
-
if (popover?.isConnected) {
|
|
29
|
-
popover?.togglePopover?.(open);
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
[open, popover]
|
|
33
|
-
);
|
|
22
|
+
const store = AkTooltip.useTooltipStore();
|
|
23
|
+
const open = useStoreState(store, (store2) => store2.open);
|
|
24
|
+
const popover = usePopoverApi(store);
|
|
34
25
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
35
|
-
|
|
26
|
+
AkTooltip.TooltipProvider,
|
|
36
27
|
{
|
|
37
28
|
store,
|
|
38
29
|
defaultOpen: defaultOpenProp,
|
|
@@ -40,28 +31,29 @@ const Tooltip = forwardRef(
|
|
|
40
31
|
setOpen: setOpenProp,
|
|
41
32
|
children: [
|
|
42
33
|
/* @__PURE__ */ jsx(
|
|
43
|
-
|
|
34
|
+
AkTooltip.TooltipAnchor,
|
|
44
35
|
{
|
|
45
36
|
render: children,
|
|
37
|
+
"data-has-popover-open": open || void 0,
|
|
46
38
|
...type === "description" && { "aria-describedby": id },
|
|
47
39
|
...type === "label" && { "aria-labelledby": id }
|
|
48
40
|
}
|
|
49
41
|
),
|
|
50
42
|
/* @__PURE__ */ jsx(
|
|
51
|
-
|
|
43
|
+
AkTooltip.Tooltip,
|
|
52
44
|
{
|
|
53
45
|
"aria-hidden": "true",
|
|
46
|
+
portal: true,
|
|
54
47
|
...rest,
|
|
55
48
|
unmountOnHide,
|
|
56
|
-
className: cx("\u{1F95D}-tooltip", className),
|
|
49
|
+
className: cx("\u{1F95D}-tooltip", props.className),
|
|
57
50
|
ref: forwardedRef,
|
|
58
51
|
id,
|
|
59
52
|
style: {
|
|
60
|
-
|
|
53
|
+
...popover.style,
|
|
61
54
|
...props.style
|
|
62
55
|
},
|
|
63
|
-
wrapperProps:
|
|
64
|
-
portal: !supportsPopover,
|
|
56
|
+
wrapperProps: popover.wrapperProps,
|
|
65
57
|
children: content
|
|
66
58
|
}
|
|
67
59
|
)
|
package/dist/bricks/Tree.d.ts
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { IconButton } from "./IconButton.js";
|
|
3
1
|
import { type BaseProps } from "./~utils.js";
|
|
2
|
+
import { Root as TreeItemRoot, Action as TreeItemAction } from "./TreeItem.js";
|
|
4
3
|
interface TreeProps extends BaseProps {
|
|
5
4
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
declare const
|
|
23
|
-
export { Tree as Root,
|
|
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 are rendered as a flat list in the `Tree.Root` component to create a hierarchical tree structure.
|
|
9
|
+
*
|
|
10
|
+
* Example:
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <Tree.Root>
|
|
13
|
+
* <Tree.Item label="Parent 1" aria-level={1} aria-posinset={1} aria-setsize={2} />
|
|
14
|
+
* <Tree.Item label="Child 1.1" aria-level={2} aria-posinset={1} aria-setsize={2} />
|
|
15
|
+
* <Tree.Item label="Child 1.2" aria-level={2} aria-posinset={2} aria-setsize={2} />
|
|
16
|
+
* <Tree.Item label="Parent 2" aria-level={1} aria-posinset={2} aria-setsize={2} />
|
|
17
|
+
* <Tree.Item label="Child 2.1" aria-level={2} aria-posinset={1} aria-setsize={1} />
|
|
18
|
+
* </Tree.Root>
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
declare const Tree: import("react").ForwardRefExoticComponent<TreeProps & import("react").RefAttributes<HTMLElement | HTMLDivElement>>;
|
|
22
|
+
export { Tree as Root, TreeItemRoot as Item, TreeItemAction as ItemAction };
|