@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/Checkbox.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 Checkbox = forwardRef(
|
|
9
7
|
(props, forwardedRef) => {
|
|
10
8
|
useFieldControlType("checkable");
|
package/dist/bricks/Chip.d.ts
CHANGED
package/dist/bricks/Chip.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Role } from "@ariakit/react/role";
|
|
2
3
|
import cx from "classnames";
|
|
3
4
|
import * as React from "react";
|
|
4
|
-
import { Role } from "@ariakit/react/role";
|
|
5
|
-
import { forwardRef } from "./~utils.js";
|
|
6
|
-
import { IconButton } from "./IconButton.js";
|
|
7
5
|
import { Dismiss } from "./Icon.js";
|
|
6
|
+
import { IconButton } from "./IconButton.js";
|
|
7
|
+
import { forwardRef } from "./~utils.js";
|
|
8
8
|
const Chip = forwardRef((props, forwardedRef) => {
|
|
9
9
|
const { variant = "solid", onDismiss, label, ...rest } = props;
|
|
10
10
|
const baseId = React.useId();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "./~utils.js";
|
|
3
2
|
import cx from "classnames";
|
|
4
3
|
import { Text } from "./Text.js";
|
|
4
|
+
import { forwardRef } from "./~utils.js";
|
|
5
5
|
const Description = forwardRef(
|
|
6
6
|
(props, forwardedRef) => {
|
|
7
7
|
const { tone, ...rest } = props;
|
package/dist/bricks/Divider.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { SeparatorProps } from "@ariakit/react/separator";
|
|
2
|
+
import type { BaseProps } from "./~utils.js";
|
|
3
3
|
interface DividerProps extends BaseProps<"hr">, Pick<SeparatorProps, "orientation"> {
|
|
4
4
|
/**
|
|
5
5
|
* If true, the divider will be purely presentational and will not have any associated semantics.
|
package/dist/bricks/Divider.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import cx from "classnames";
|
|
3
2
|
import { Role } from "@ariakit/react/role";
|
|
4
3
|
import { Separator } from "@ariakit/react/separator";
|
|
4
|
+
import cx from "classnames";
|
|
5
5
|
import { forwardRef } from "./~utils.js";
|
|
6
6
|
const Divider = forwardRef((props, forwardedRef) => {
|
|
7
7
|
const { presentational, ...rest } = props;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
2
|
+
import type { MenuItemCheckboxProps, MenuProviderProps } from "@ariakit/react/menu";
|
|
3
|
+
import type { PredefinedSymbol } from "./Kbd.internal.js";
|
|
4
|
+
import type { AnyString, BaseProps, FocusableProps } from "./~utils.js";
|
|
5
5
|
interface DropdownMenuProps extends Pick<MenuProviderProps, "children" | "placement" | "open" | "setOpen" | "defaultOpen"> {
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
@@ -59,6 +59,8 @@ declare const DropdownMenuButton: React.ForwardRefExoticComponent<DropdownMenuBu
|
|
|
59
59
|
interface DropdownMenuItemProps extends Omit<FocusableProps<"button">, "children">, Partial<Pick<DropdownMenuItemShortcutsProps, "shortcuts"> & Pick<DropdownMenuIconProps, "icon">> {
|
|
60
60
|
/** The primary text label for the menu-item. */
|
|
61
61
|
label: React.ReactNode;
|
|
62
|
+
/** Dot shown on the right end of the menu-item. Value will be used as accessible description. */
|
|
63
|
+
unstable_dot?: string;
|
|
62
64
|
}
|
|
63
65
|
/**
|
|
64
66
|
* A single menu item within the dropdown menu. Should be used as a child of `DropdownMenu.Content`.
|
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import cx from "classnames";
|
|
4
|
-
import * as ListItem from "./~utils.ListItem.js";
|
|
5
|
-
import { Button } from "./Button.js";
|
|
6
2
|
import { Button as ButtonAk } from "@ariakit/react/button";
|
|
7
|
-
import { Kbd } from "./Kbd.js";
|
|
8
|
-
import { Checkmark, DisclosureArrow, Icon } from "./Icon.js";
|
|
9
3
|
import {
|
|
10
|
-
forwardRef
|
|
11
|
-
} from "./~utils.js";
|
|
12
|
-
import { usePopoverApi } from "./~hooks.js";
|
|
13
|
-
import {
|
|
14
|
-
MenuProvider,
|
|
15
|
-
useMenuContext,
|
|
16
4
|
Menu,
|
|
17
5
|
MenuButton,
|
|
18
6
|
MenuItem,
|
|
19
|
-
MenuItemCheckbox
|
|
7
|
+
MenuItemCheckbox,
|
|
8
|
+
MenuProvider,
|
|
9
|
+
useMenuContext
|
|
20
10
|
} from "@ariakit/react/menu";
|
|
11
|
+
import { usePopoverContext } from "@ariakit/react/popover";
|
|
21
12
|
import { useStoreState } from "@ariakit/react/store";
|
|
13
|
+
import cx from "classnames";
|
|
14
|
+
import * as React from "react";
|
|
15
|
+
import { Button } from "./Button.js";
|
|
16
|
+
import { Checkmark, DisclosureArrow, Icon } from "./Icon.js";
|
|
22
17
|
import { predefinedSymbols } from "./Kbd.internal.js";
|
|
23
|
-
import {
|
|
18
|
+
import { Kbd } from "./Kbd.js";
|
|
19
|
+
import { usePopoverApi } from "./~hooks.js";
|
|
20
|
+
import { Dot } from "./~utils.Dot.js";
|
|
21
|
+
import * as ListItem from "./~utils.ListItem.js";
|
|
22
|
+
import { forwardRef } from "./~utils.js";
|
|
24
23
|
function DropdownMenuRoot(props) {
|
|
25
24
|
const {
|
|
26
25
|
children,
|
|
@@ -81,7 +80,8 @@ const DropdownMenuButton = forwardRef(
|
|
|
81
80
|
);
|
|
82
81
|
const DropdownMenuItem = forwardRef(
|
|
83
82
|
(props, forwardedRef) => {
|
|
84
|
-
const { label, shortcuts, icon, ...rest } = props;
|
|
83
|
+
const { label, shortcuts, icon, unstable_dot, ...rest } = props;
|
|
84
|
+
const dotId = React.useId();
|
|
85
85
|
return /* @__PURE__ */ jsxs(
|
|
86
86
|
MenuItem,
|
|
87
87
|
{
|
|
@@ -93,6 +93,7 @@ const DropdownMenuItem = forwardRef(
|
|
|
93
93
|
ButtonAk,
|
|
94
94
|
{
|
|
95
95
|
accessibleWhenDisabled: true,
|
|
96
|
+
"aria-describedby": dotId,
|
|
96
97
|
...rest,
|
|
97
98
|
className: cx("\u{1F95D}-dropdown-menu-item", props.className),
|
|
98
99
|
ref: forwardedRef
|
|
@@ -103,7 +104,13 @@ const DropdownMenuItem = forwardRef(
|
|
|
103
104
|
children: [
|
|
104
105
|
icon ? /* @__PURE__ */ jsx(DropdownMenuIcon, { icon }) : null,
|
|
105
106
|
/* @__PURE__ */ jsx(ListItem.Content, { render: /* @__PURE__ */ jsx("span", {}), children: label }),
|
|
106
|
-
shortcuts ? /* @__PURE__ */ jsx(DropdownMenuItemShortcuts, { shortcuts }) : null
|
|
107
|
+
shortcuts ? /* @__PURE__ */ jsx(DropdownMenuItemShortcuts, { shortcuts }) : null,
|
|
108
|
+
unstable_dot ? /* @__PURE__ */ jsx(
|
|
109
|
+
ListItem.Decoration,
|
|
110
|
+
{
|
|
111
|
+
render: /* @__PURE__ */ jsx(Dot, { id: dotId, className: "\u{1F95D}-dropdown-menu-item-dot", children: unstable_dot })
|
|
112
|
+
}
|
|
113
|
+
) : null
|
|
107
114
|
]
|
|
108
115
|
}
|
|
109
116
|
);
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { BaseProps } from "./~utils.js";
|
|
3
|
+
interface ErrorRegionRootProps extends Omit<BaseProps, "children"> {
|
|
4
|
+
/**
|
|
5
|
+
* Label for the error header, usually indicating the number of errors displayed.
|
|
6
|
+
* By default this is used as a name of the region navigational landmark, however an explicit `aria-label` or `aria-labelledby` is strongly suggested.
|
|
7
|
+
*
|
|
8
|
+
* Use `undefined` if you don't want to display errors rather than conditionally rendering the component.
|
|
9
|
+
*/
|
|
10
|
+
label?: React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* A list of error items where each item describes an individual error. Must be a list of `ErrorRegion.Item` components.
|
|
13
|
+
*/
|
|
14
|
+
items?: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* The controlled expanded state of the error.
|
|
17
|
+
*/
|
|
18
|
+
expanded?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Callback fired when the error is expanded.
|
|
21
|
+
*
|
|
22
|
+
* Should be used with the `expanded` prop.
|
|
23
|
+
*/
|
|
24
|
+
onExpandedChange?: (expanded: boolean) => void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A collapsible region that displays a list of error messages, which might originate from another
|
|
28
|
+
* component, such as `Tree`.
|
|
29
|
+
*
|
|
30
|
+
* This component is rendered as a [region landmark](https://www.w3.org/WAI/ARIA/apg/patterns/landmarks/examples/region.html)
|
|
31
|
+
* and should be labelled either using `label` or `aria-label`/`aria-labelledby`. Changes to the `label` prop will be
|
|
32
|
+
* announced communicated using a [live region](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Guides/Live_regions).
|
|
33
|
+
*
|
|
34
|
+
* Example:
|
|
35
|
+
* ```tsx
|
|
36
|
+
* <ErrorRegion.Root
|
|
37
|
+
* label="3 issues found"
|
|
38
|
+
* items={
|
|
39
|
+
* <>
|
|
40
|
+
* <ErrorRegion.Item message="…" />
|
|
41
|
+
* <ErrorRegion.Item message="…" />
|
|
42
|
+
* <ErrorRegion.Item message="…" />
|
|
43
|
+
* </>
|
|
44
|
+
* }
|
|
45
|
+
* />
|
|
46
|
+
*/
|
|
47
|
+
declare const ErrorRegionRoot: React.ForwardRefExoticComponent<ErrorRegionRootProps & React.RefAttributes<HTMLElement | HTMLDivElement>>;
|
|
48
|
+
interface ErrorRegionItemProps extends Omit<BaseProps, "children"> {
|
|
49
|
+
/**
|
|
50
|
+
* The error message. Consumers might consider using `Anchor` component to link to the associated element in the UI.
|
|
51
|
+
*/
|
|
52
|
+
message?: React.ReactNode;
|
|
53
|
+
/**
|
|
54
|
+
* The `id` of the message node which can be used to semantically associate the error item with the related UI item i.e. `Tree.Item`.
|
|
55
|
+
*/
|
|
56
|
+
messageId?: string;
|
|
57
|
+
/**
|
|
58
|
+
* The actions available for this item. Must be a list of anchors, each rendered as a button using `<Anchor render={<button />} />`.
|
|
59
|
+
*/
|
|
60
|
+
actions?: React.ReactNode;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* An individual error item within the `ErrorRegion` component. It displays an error message and optional actions.
|
|
64
|
+
*
|
|
65
|
+
* The `messageId` prop can be used to semantically associate the error item with the related UI item, such as a `Tree.Item`.
|
|
66
|
+
*
|
|
67
|
+
* Example:
|
|
68
|
+
* ```tsx
|
|
69
|
+
* <ErrorRegion.Item
|
|
70
|
+
* message={<>Something went wrong with <Anchor href="item-10001">Item 10001</Anchor>.</>}
|
|
71
|
+
* messageId="item-10001-error"
|
|
72
|
+
* actions={<Button>Retry</Button>}
|
|
73
|
+
* />
|
|
74
|
+
*
|
|
75
|
+
* <Tree.Item
|
|
76
|
+
* id="item-10001"
|
|
77
|
+
* label="Item 10001"
|
|
78
|
+
* error="item-10001-error"
|
|
79
|
+
* />
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
declare const ErrorRegionItem: React.ForwardRefExoticComponent<ErrorRegionItemProps & React.RefAttributes<HTMLElement | HTMLDivElement>>;
|
|
83
|
+
export { ErrorRegionRoot as Root, ErrorRegionItem as Item };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
Dialog,
|
|
4
|
+
DialogDisclosure,
|
|
5
|
+
DialogProvider
|
|
6
|
+
} from "@ariakit/react/dialog";
|
|
7
|
+
import { Role } from "@ariakit/react/role";
|
|
8
|
+
import cx from "classnames";
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
import { Button } from "./Button.js";
|
|
11
|
+
import { ChevronDown, StatusWarning } from "./Icon.js";
|
|
12
|
+
import { IconButtonPresentation } from "./IconButton.internal.js";
|
|
13
|
+
import { Text } from "./Text.js";
|
|
14
|
+
import { VisuallyHidden } from "./VisuallyHidden.js";
|
|
15
|
+
import { useControlledState } from "./~hooks.js";
|
|
16
|
+
import { forwardRef } from "./~utils.js";
|
|
17
|
+
const ErrorRegionRoot = forwardRef(
|
|
18
|
+
(props, forwardedRef) => {
|
|
19
|
+
const { label, items, expanded, onExpandedChange, ...rest } = props;
|
|
20
|
+
const labelId = React.useId();
|
|
21
|
+
const sectionLabelledBy = props["aria-labelledby"] ?? (props["aria-label"] ? void 0 : labelId);
|
|
22
|
+
const [open, setOpen] = useControlledState(
|
|
23
|
+
false,
|
|
24
|
+
expanded,
|
|
25
|
+
onExpandedChange
|
|
26
|
+
);
|
|
27
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
28
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { "aria-live": "polite", "aria-atomic": true, children: label }),
|
|
29
|
+
/* @__PURE__ */ jsx(DialogProvider, { open, setOpen, children: /* @__PURE__ */ jsx(
|
|
30
|
+
Role.section,
|
|
31
|
+
{
|
|
32
|
+
...rest,
|
|
33
|
+
"aria-labelledby": sectionLabelledBy,
|
|
34
|
+
className: cx("\u{1F95D}-error-region", props.className),
|
|
35
|
+
"data-kiwi-visible": !!label,
|
|
36
|
+
"data-kiwi-expanded": open,
|
|
37
|
+
ref: forwardedRef,
|
|
38
|
+
children: /* @__PURE__ */ jsxs("div", { className: "\u{1F95D}-error-region-container", children: [
|
|
39
|
+
/* @__PURE__ */ jsxs(
|
|
40
|
+
DialogDisclosure,
|
|
41
|
+
{
|
|
42
|
+
className: "\u{1F95D}-error-region-header",
|
|
43
|
+
render: /* @__PURE__ */ jsx(Button, { variant: "ghost" }),
|
|
44
|
+
children: [
|
|
45
|
+
/* @__PURE__ */ jsx(StatusWarning, { className: "\u{1F95D}-error-region-icon" }),
|
|
46
|
+
/* @__PURE__ */ jsx(
|
|
47
|
+
Text,
|
|
48
|
+
{
|
|
49
|
+
render: /* @__PURE__ */ jsx("span", {}),
|
|
50
|
+
id: labelId,
|
|
51
|
+
className: "\u{1F95D}-error-region-label",
|
|
52
|
+
variant: "body-sm",
|
|
53
|
+
children: label
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
/* @__PURE__ */ jsx(IconButtonPresentation, { inert: true, variant: "ghost", children: /* @__PURE__ */ jsx(ChevronDown, {}) })
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
/* @__PURE__ */ jsx(
|
|
61
|
+
Dialog,
|
|
62
|
+
{
|
|
63
|
+
className: "\u{1F95D}-error-region-dialog",
|
|
64
|
+
portal: false,
|
|
65
|
+
modal: false,
|
|
66
|
+
autoFocusOnShow: false,
|
|
67
|
+
"aria-labelledby": labelId,
|
|
68
|
+
children: /* @__PURE__ */ jsx("div", { className: "\u{1F95D}-error-region-items", role: "list", children: items })
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
] })
|
|
72
|
+
}
|
|
73
|
+
) })
|
|
74
|
+
] });
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
const ErrorRegionItem = forwardRef(
|
|
78
|
+
(props, forwardedRef) => {
|
|
79
|
+
const generatedId = React.useId();
|
|
80
|
+
const {
|
|
81
|
+
message,
|
|
82
|
+
messageId = `${generatedId}-message`,
|
|
83
|
+
actions,
|
|
84
|
+
...rest
|
|
85
|
+
} = props;
|
|
86
|
+
return /* @__PURE__ */ jsxs(
|
|
87
|
+
Role.div,
|
|
88
|
+
{
|
|
89
|
+
...rest,
|
|
90
|
+
role: "listitem",
|
|
91
|
+
className: cx("\u{1F95D}-error-region-item", props.className),
|
|
92
|
+
ref: forwardedRef,
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ jsx(Text, { id: messageId, variant: "body-sm", children: message }),
|
|
95
|
+
/* @__PURE__ */ jsx("div", { className: "\u{1F95D}-error-region-item-actions", children: actions })
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
export {
|
|
102
|
+
ErrorRegionItem as Item,
|
|
103
|
+
ErrorRegionRoot as Root
|
|
104
|
+
};
|
package/dist/bricks/Field.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { CollectionItemProps } from "@ariakit/react/collection";
|
|
3
|
+
import type { BaseProps } from "./~utils.js";
|
|
4
4
|
interface FieldRootProps extends BaseProps {
|
|
5
5
|
/**
|
|
6
6
|
* Allows overriding the default block layout for text controls.
|
|
@@ -50,6 +50,12 @@ interface FieldCollectionItemControlProps extends Pick<CollectionItemProps, "ren
|
|
|
50
50
|
/**
|
|
51
51
|
* The control component for the field.
|
|
52
52
|
*
|
|
53
|
+
* Use the `render` prop to render the control component.
|
|
54
|
+
*
|
|
55
|
+
* ```tsx
|
|
56
|
+
* <Field.Control render={<TextBox.Input />} />
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
53
59
|
* If the rendered component uses a compositional API, then use a function
|
|
54
60
|
* within `render` to apply the `controlProps` to the correct sub-component:
|
|
55
61
|
*
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { useCollectionStore } from "@ariakit/react/collection";
|
|
1
2
|
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
+
import type { CollectionProps } from "@ariakit/react/collection";
|
|
3
4
|
/**
|
|
4
5
|
* Ariakit’s unexported `CollectionStoreItem` type inferred.
|
|
5
6
|
* @private
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
useCollectionStore,
|
|
5
|
-
Collection
|
|
6
|
-
} from "@ariakit/react/collection";
|
|
2
|
+
import { Collection, useCollectionStore } from "@ariakit/react/collection";
|
|
7
3
|
import { useStoreState } from "@ariakit/react/store";
|
|
4
|
+
import * as React from "react";
|
|
8
5
|
function FieldCollection(props) {
|
|
9
6
|
const fieldElementCollection = useCollectionStore({
|
|
10
7
|
defaultItems: []
|
package/dist/bricks/Field.js
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import cx from "classnames";
|
|
4
|
-
import { Role } from "@ariakit/react/role";
|
|
5
2
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
CollectionItem,
|
|
4
|
+
useCollectionContext
|
|
8
5
|
} from "@ariakit/react/collection";
|
|
6
|
+
import { Role } from "@ariakit/react/role";
|
|
9
7
|
import { useStoreState } from "@ariakit/react/store";
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
FieldCollection,
|
|
13
|
-
FieldControlTypeContext
|
|
14
|
-
} from "./Field.internal.js";
|
|
15
|
-
import { Label } from "./Label.js";
|
|
8
|
+
import cx from "classnames";
|
|
9
|
+
import * as React from "react";
|
|
16
10
|
import { Description } from "./Description.js";
|
|
11
|
+
import { FieldCollection, FieldControlTypeContext } from "./Field.internal.js";
|
|
12
|
+
import { Label } from "./Label.js";
|
|
13
|
+
import { forwardRef } from "./~utils.js";
|
|
17
14
|
const FieldRoot = forwardRef((props, forwardedRef) => {
|
|
18
15
|
const { layout, ...rest } = props;
|
|
19
16
|
return /* @__PURE__ */ jsx(
|
|
@@ -34,11 +31,12 @@ const FieldRoot = forwardRef((props, forwardedRef) => {
|
|
|
34
31
|
const FieldLabel = forwardRef(
|
|
35
32
|
(props, forwardedRef) => {
|
|
36
33
|
const store = useCollectionContext();
|
|
37
|
-
const renderedItems = useStoreState(
|
|
34
|
+
const renderedItems = useStoreState(
|
|
35
|
+
store,
|
|
36
|
+
"renderedItems"
|
|
37
|
+
);
|
|
38
38
|
const fieldId = React.useMemo(
|
|
39
|
-
() => renderedItems?.find(
|
|
40
|
-
(item) => item.elementType === "control"
|
|
41
|
-
)?.id,
|
|
39
|
+
() => renderedItems?.find((item) => item.elementType === "control")?.id,
|
|
42
40
|
[renderedItems]
|
|
43
41
|
);
|
|
44
42
|
const getData = React.useCallback(
|
|
@@ -84,7 +82,10 @@ const FieldControl = forwardRef(
|
|
|
84
82
|
const store = useCollectionContext();
|
|
85
83
|
const generatedId = React.useId();
|
|
86
84
|
const { id = store ? generatedId : void 0, ...rest } = props;
|
|
87
|
-
const renderedItems = useStoreState(
|
|
85
|
+
const renderedItems = useStoreState(
|
|
86
|
+
store,
|
|
87
|
+
"renderedItems"
|
|
88
|
+
);
|
|
88
89
|
const describedBy = React.useMemo(() => {
|
|
89
90
|
const idRefList = renderedItems?.filter(
|
|
90
91
|
(item) => item.elementType === "description" || item.elementType === "error"
|
package/dist/bricks/Icon.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import type { BaseProps } from "./~utils.js";
|
|
3
3
|
interface IconProps extends Omit<BaseProps<"svg">, "children"> {
|
|
4
4
|
/**
|
|
5
5
|
* URL of the symbol sprite.
|
|
@@ -74,4 +74,7 @@ export declare const StatusWarning: React.ForwardRefExoticComponent<StatusWarnin
|
|
|
74
74
|
interface MoreHorizontalProps extends Omit<BaseProps<"svg">, "children"> {
|
|
75
75
|
}
|
|
76
76
|
export declare const MoreHorizontal: React.ForwardRefExoticComponent<MoreHorizontalProps & React.RefAttributes<HTMLElement | SVGSVGElement>>;
|
|
77
|
+
interface ChevronDownProps extends Omit<BaseProps<"svg">, "children"> {
|
|
78
|
+
}
|
|
79
|
+
export declare const ChevronDown: React.ForwardRefExoticComponent<ChevronDownProps & React.RefAttributes<HTMLElement | SVGSVGElement>>;
|
|
77
80
|
export {};
|
package/dist/bricks/Icon.js
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import { jsx } 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
|
-
getOwnerDocument,
|
|
8
|
-
parseDOM
|
|
9
|
-
} from "./~utils.js";
|
|
3
|
+
import cx from "classnames";
|
|
4
|
+
import * as React from "react";
|
|
10
5
|
import {
|
|
11
6
|
HtmlSanitizerContext,
|
|
12
7
|
spriteSheetId,
|
|
13
8
|
useRootNode
|
|
14
9
|
} from "./Root.internal.js";
|
|
15
10
|
import { useLatestRef, useSafeContext } from "./~hooks.js";
|
|
11
|
+
import { forwardRef, getOwnerDocument, parseDOM } from "./~utils.js";
|
|
16
12
|
const Icon = forwardRef((props, forwardedRef) => {
|
|
17
13
|
const { href: hrefProp, size, alt, ...rest } = props;
|
|
18
14
|
const isDecorative = !alt;
|
|
@@ -245,8 +241,32 @@ const MoreHorizontal = forwardRef(
|
|
|
245
241
|
);
|
|
246
242
|
}
|
|
247
243
|
);
|
|
244
|
+
const ChevronDown = forwardRef(
|
|
245
|
+
(props, forwardedRef) => {
|
|
246
|
+
return /* @__PURE__ */ jsx(
|
|
247
|
+
Icon,
|
|
248
|
+
{
|
|
249
|
+
...props,
|
|
250
|
+
render: /* @__PURE__ */ jsx(
|
|
251
|
+
Role.svg,
|
|
252
|
+
{
|
|
253
|
+
width: "16",
|
|
254
|
+
height: "16",
|
|
255
|
+
fill: "currentColor",
|
|
256
|
+
viewBox: "0 0 16 16",
|
|
257
|
+
render: props.render,
|
|
258
|
+
children: /* @__PURE__ */ jsx("path", { d: "M4.146 6.146a.5.5 0 0 1 .708 0L8 9.293l3.146-3.147a.5.5 0 0 1 .708.708l-3.5 3.5a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 0 1 0-.708Z" })
|
|
259
|
+
}
|
|
260
|
+
),
|
|
261
|
+
className: cx("\u{1F95D}-chevron-down", props.className),
|
|
262
|
+
ref: forwardedRef
|
|
263
|
+
}
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
);
|
|
248
267
|
export {
|
|
249
268
|
Checkmark,
|
|
269
|
+
ChevronDown,
|
|
250
270
|
DisclosureArrow,
|
|
251
271
|
Dismiss,
|
|
252
272
|
Icon,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { Button } from "./Button.js";
|
|
3
|
+
import type { BaseProps } from "./~utils.js";
|
|
4
|
+
export declare const IconButtonContext: React.Context<{
|
|
5
|
+
iconSize: "regular" | "large";
|
|
6
|
+
}>;
|
|
7
|
+
interface IconButtonPresentationProps extends BaseProps<"span">, Pick<React.ComponentProps<typeof Button>, "variant"> {
|
|
8
|
+
}
|
|
9
|
+
export declare const IconButtonPresentation: React.ForwardRefExoticComponent<IconButtonPresentationProps & React.RefAttributes<HTMLElement | HTMLSpanElement>>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Role } from "@ariakit/react/role";
|
|
3
|
+
import cx from "classnames";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { forwardRef } from "./~utils.js";
|
|
6
|
+
const IconButtonContext = React.createContext({ iconSize: "regular" });
|
|
7
|
+
const IconButtonPresentation = forwardRef((props, forwardedRef) => {
|
|
8
|
+
const { variant, ...rest } = props;
|
|
9
|
+
return /* @__PURE__ */ jsx(
|
|
10
|
+
Role.span,
|
|
11
|
+
{
|
|
12
|
+
...rest,
|
|
13
|
+
className: cx("\u{1F95D}-icon-button", "\u{1F95D}-button", props.className),
|
|
14
|
+
"data-kiwi-variant": variant,
|
|
15
|
+
ref: forwardedRef
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
});
|
|
19
|
+
export {
|
|
20
|
+
IconButtonContext,
|
|
21
|
+
IconButtonPresentation
|
|
22
|
+
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import cx from "classnames";
|
|
4
|
-
import { useToolbarContext, ToolbarItem } from "@ariakit/react/toolbar";
|
|
5
3
|
import { Button } from "./Button.js";
|
|
6
|
-
import { VisuallyHidden } from "./VisuallyHidden.js";
|
|
7
4
|
import { Icon } from "./Icon.js";
|
|
5
|
+
import {
|
|
6
|
+
IconButtonContext,
|
|
7
|
+
IconButtonPresentation
|
|
8
|
+
} from "./IconButton.internal.js";
|
|
8
9
|
import { Tooltip } from "./Tooltip.js";
|
|
10
|
+
import { VisuallyHidden } from "./VisuallyHidden.js";
|
|
11
|
+
import { Dot } from "./~utils.Dot.js";
|
|
9
12
|
import { forwardRef } from "./~utils.js";
|
|
10
13
|
const IconButton = forwardRef(
|
|
11
14
|
(props, forwardedRef) => {
|
|
@@ -13,23 +16,25 @@ const IconButton = forwardRef(
|
|
|
13
16
|
const baseId = React.useId();
|
|
14
17
|
const labelId = `${baseId}-label`;
|
|
15
18
|
const dotId = `${baseId}-dot`;
|
|
16
|
-
const
|
|
17
|
-
const button = /* @__PURE__ */
|
|
18
|
-
|
|
19
|
+
const { iconSize } = React.useContext(IconButtonContext);
|
|
20
|
+
const button = /* @__PURE__ */ jsx(
|
|
21
|
+
IconButtonPresentation,
|
|
19
22
|
{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
render: /* @__PURE__ */ jsxs(
|
|
24
|
+
Button,
|
|
25
|
+
{
|
|
26
|
+
"aria-pressed": isActive,
|
|
27
|
+
"aria-labelledby": labelId,
|
|
28
|
+
"aria-describedby": dot ? dotId : void 0,
|
|
29
|
+
...rest,
|
|
30
|
+
ref: forwardedRef,
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { id: labelId, children: label }),
|
|
33
|
+
typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { href: icon, size: iconSize }) : icon,
|
|
34
|
+
dot ? /* @__PURE__ */ jsx(Dot, { id: dotId, className: "\u{1F95D}-icon-button-dot", children: dot }) : null
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
)
|
|
33
38
|
}
|
|
34
39
|
);
|
|
35
40
|
if (labelVariant === "visually-hidden") {
|
package/dist/bricks/Kbd.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { PredefinedSymbol } from "./Kbd.internal.js";
|
|
2
|
+
import type { BaseProps } from "./~utils.js";
|
|
3
3
|
interface KbdProps extends BaseProps<"kbd"> {
|
|
4
4
|
/** @default "solid" */
|
|
5
5
|
variant?: "solid" | "muted" | "ghost";
|
package/dist/bricks/Kbd.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import cx from "classnames";
|
|
3
2
|
import { Role } from "@ariakit/react/role";
|
|
4
|
-
import
|
|
5
|
-
import { VisuallyHidden } from "./VisuallyHidden.js";
|
|
3
|
+
import cx from "classnames";
|
|
6
4
|
import { predefinedSymbols } from "./Kbd.internal.js";
|
|
5
|
+
import { VisuallyHidden } from "./VisuallyHidden.js";
|
|
6
|
+
import { forwardRef } from "./~utils.js";
|
|
7
7
|
const Kbd = forwardRef((props, forwardedRef) => {
|
|
8
8
|
const { variant = "solid", symbol, children, ...rest } = props;
|
|
9
9
|
let content = children;
|
package/dist/bricks/Label.d.ts
CHANGED