@itwin/itwinui-react 5.0.0-alpha.7 → 5.0.0-alpha.9

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.
Files changed (87) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/LICENSE.md +1 -1
  3. package/README.md +6 -6
  4. package/dist/DEV/bricks/Anchor.js +4 -9
  5. package/dist/DEV/bricks/Avatar.js +2 -2
  6. package/dist/DEV/bricks/Badge.js +2 -2
  7. package/dist/DEV/bricks/Button.js +10 -3
  8. package/dist/DEV/bricks/Checkbox.js +4 -2
  9. package/dist/DEV/bricks/Chip.js +2 -2
  10. package/dist/DEV/bricks/Divider.js +3 -2
  11. package/dist/DEV/bricks/DropdownMenu.js +83 -33
  12. package/dist/DEV/bricks/Field.js +21 -17
  13. package/dist/DEV/bricks/Icon.js +5 -5
  14. package/dist/DEV/bricks/IconButton.js +14 -6
  15. package/dist/DEV/bricks/Kbd.internal.js +19 -0
  16. package/dist/DEV/bricks/Kbd.js +3 -18
  17. package/dist/DEV/bricks/Label.js +2 -2
  18. package/dist/DEV/bricks/Radio.js +4 -2
  19. package/dist/DEV/bricks/Root.js +35 -4
  20. package/dist/DEV/bricks/Select.js +3 -3
  21. package/dist/DEV/bricks/Spinner.js +2 -2
  22. package/dist/DEV/bricks/Switch.js +4 -2
  23. package/dist/DEV/bricks/Table.js +7 -7
  24. package/dist/DEV/bricks/Tabs.js +5 -5
  25. package/dist/DEV/bricks/Text.js +2 -2
  26. package/dist/DEV/bricks/TextBox.js +8 -7
  27. package/dist/DEV/bricks/Tooltip.js +11 -22
  28. package/dist/DEV/bricks/Tree.js +8 -202
  29. package/dist/DEV/bricks/TreeItem.js +219 -0
  30. package/dist/DEV/bricks/VisuallyHidden.js +2 -2
  31. package/dist/DEV/bricks/styles.css.js +2 -2
  32. package/dist/DEV/bricks/~hooks.js +31 -0
  33. package/dist/DEV/bricks/~utils.GhostAligner.js +13 -0
  34. package/dist/DEV/bricks/{ListItem.js → ~utils.ListItem.js} +6 -4
  35. package/dist/DEV/foundations/styles.css.js +2 -2
  36. package/dist/bricks/Anchor.js +4 -9
  37. package/dist/bricks/Avatar.js +2 -2
  38. package/dist/bricks/Badge.js +2 -2
  39. package/dist/bricks/Button.js +10 -3
  40. package/dist/bricks/Checkbox.d.ts +2 -2
  41. package/dist/bricks/Checkbox.js +4 -2
  42. package/dist/bricks/Chip.js +2 -2
  43. package/dist/bricks/Divider.d.ts +2 -2
  44. package/dist/bricks/Divider.js +3 -2
  45. package/dist/bricks/DropdownMenu.d.ts +38 -23
  46. package/dist/bricks/DropdownMenu.js +81 -33
  47. package/dist/bricks/Field.d.ts +5 -5
  48. package/dist/bricks/Field.js +21 -17
  49. package/dist/bricks/Icon.js +5 -5
  50. package/dist/bricks/IconButton.d.ts +20 -4
  51. package/dist/bricks/IconButton.js +14 -6
  52. package/dist/bricks/Kbd.d.ts +2 -17
  53. package/dist/bricks/Kbd.internal.d.ts +17 -0
  54. package/dist/bricks/Kbd.internal.js +19 -0
  55. package/dist/bricks/Kbd.js +3 -18
  56. package/dist/bricks/Label.js +2 -2
  57. package/dist/bricks/Radio.d.ts +2 -2
  58. package/dist/bricks/Radio.js +4 -2
  59. package/dist/bricks/Root.js +35 -4
  60. package/dist/bricks/Select.d.ts +1 -2
  61. package/dist/bricks/Select.js +3 -3
  62. package/dist/bricks/Spinner.js +2 -2
  63. package/dist/bricks/Switch.d.ts +2 -2
  64. package/dist/bricks/Switch.js +4 -2
  65. package/dist/bricks/Table.js +7 -7
  66. package/dist/bricks/Tabs.d.ts +4 -4
  67. package/dist/bricks/Tabs.js +5 -5
  68. package/dist/bricks/Text.d.ts +1 -1
  69. package/dist/bricks/Text.js +2 -2
  70. package/dist/bricks/TextBox.js +8 -7
  71. package/dist/bricks/Tooltip.d.ts +2 -2
  72. package/dist/bricks/Tooltip.js +11 -22
  73. package/dist/bricks/Tree.d.ts +3 -108
  74. package/dist/bricks/Tree.js +8 -196
  75. package/dist/bricks/TreeItem.d.ts +123 -0
  76. package/dist/bricks/TreeItem.js +214 -0
  77. package/dist/bricks/VisuallyHidden.js +2 -2
  78. package/dist/bricks/styles.css.js +2 -2
  79. package/dist/bricks/~hooks.d.ts +31 -1
  80. package/dist/bricks/~hooks.js +31 -0
  81. package/dist/bricks/~utils.GhostAligner.d.ts +22 -0
  82. package/dist/bricks/~utils.GhostAligner.js +13 -0
  83. package/dist/bricks/{ListItem.d.ts → ~utils.ListItem.d.ts} +6 -6
  84. package/dist/bricks/{ListItem.js → ~utils.ListItem.js} +6 -4
  85. package/dist/bricks/~utils.d.ts +6 -3
  86. package/dist/foundations/styles.css.js +2 -2
  87. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.0.0-alpha.9
4
+
5
+ - Added `dot` prop to `<IconButton>` for showing a small "dot" next to the icon.
6
+ - Added `unstable_decorations` prop to `<Tree.Item>` for showing multiple decorations (e.g. icons).
7
+ - **breaking**: Replaced `<DropdownMenu.Item>` children with new `label` prop (see [#423](https://github.com/iTwin/design-system/pull/423)).
8
+ - Added `icon` prop to `<DropdownMenu.Item>` and `<DropdownMenu.CheckboxItem>`.
9
+ - Updated the `shortcuts` prop of `<DropdownMenu.Item>` to recognize predefined "symbols" (e.g. modifier keys).
10
+ - Updated `<Anchor>` and `<Badge>` visuals to match the latest design.
11
+ - Fixed forced-colors mode styling for `DropdownMenu`.
12
+
13
+ ## 5.0.0-alpha.8
14
+
15
+ - Added `description` prop to `<Tree.Item>` component for showing "sublabels".
16
+ - **breaking**: Updated `<Text>` component to require `variant` prop.
17
+ - (soft breaking) Removed `children` from `<Tree.Item>` prop types.
18
+ - Updated `DropdownMenu` padding.
19
+
3
20
  ## 5.0.0-alpha.7
4
21
 
5
22
  - Added new `<Avatar>` component.
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MIT License
2
2
 
3
- Copyright © 2024 Bentley Systems, Incorporated. All rights reserved.
3
+ Copyright © 2025 Bentley Systems, Incorporated. All rights reserved.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
 
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # @itwin/itwinui-react
2
2
 
3
- A React component library for the Kiwi design system.
3
+ A React component library for the next evolution of the iTwinUI design system.
4
4
 
5
5
  ## Usage
6
6
 
7
- To use components from the Kiwi design system in your app, you’ll need to wrap your app’s UI with Kiwi’s `<Root>` component, and specify the required `colorScheme` and `density` props:
7
+ To use components from the iTwinUI design system in your app, you’ll need to wrap your app’s UI with iTwinUI's `<Root>` component, and specify the required `colorScheme` and `density` props:
8
8
 
9
9
  ```jsx
10
10
  import { Root } from "@itwin/itwinui-react/bricks";
@@ -12,18 +12,18 @@ import { Root } from "@itwin/itwinui-react/bricks";
12
12
  export function App() {
13
13
  return (
14
14
  <Root colorScheme="dark" density="dense">
15
- {/* Use Kiwi design system components here */}
15
+ {/* Use design system components here */}
16
16
  </Root>
17
17
  );
18
18
  }
19
19
  ```
20
20
 
21
- This will ensure Kiwi’s styles are loaded to either the document or the encompassing shadow root.
21
+ This will ensure iTwinUI's styles are loaded to either the document or the encompassing shadow root.
22
22
 
23
23
  Once that’s in place you can import and use components from `@itwin/itwinui-react/bricks`.
24
24
 
25
25
  ## Contributing
26
26
 
27
- Are you interested in helping kiwi grow and expand? You can submit feature requests or bugs by creating [issues](https://github.com/iTwin/kiwi/issues).
27
+ Are you interested in helping iTwinUI grow and expand? You can submit feature requests or bugs by creating [issues](https://github.com/iTwin/design-system/issues).
28
28
 
29
- If you're interested in contributing code, please read [`CONTRIBUTING.md`](https://github.com/iTwin/kiwi/blob/main/CONTRIBUTING.md) for more information.
29
+ If you're interested in contributing code, please read [`CONTRIBUTING.md`](https://github.com/iTwin/design-system/blob/main/CONTRIBUTING.md) for more information.
@@ -1,22 +1,17 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import cx from "classnames";
3
- import * as Ariakit from "@ariakit/react";
3
+ import { Role } from "@ariakit/react/role";
4
+ import { Focusable } from "@ariakit/react/focusable";
4
5
  import { forwardRef } from "./~utils.js";
5
6
  const Anchor = forwardRef((props, forwardedRef) => {
6
7
  const { tone = "neutral", ...rest } = props;
7
8
  return /* @__PURE__ */ jsx(
8
- Ariakit.Role.a,
9
+ Role.a,
9
10
  {
10
11
  ...rest,
11
12
  "data-kiwi-tone": tone,
12
13
  className: cx("\u{1F95D}-anchor", props.className),
13
- render: /* @__PURE__ */ jsx(
14
- Ariakit.Focusable,
15
- {
16
- accessibleWhenDisabled: true,
17
- render: props.render || /* @__PURE__ */ jsx("a", {})
18
- }
19
- ),
14
+ render: /* @__PURE__ */ jsx(Focusable, { accessibleWhenDisabled: true, render: props.render || /* @__PURE__ */ jsx("a", {}) }),
20
15
  ref: forwardedRef
21
16
  }
22
17
  );
@@ -1,12 +1,12 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import cx from "classnames";
3
- import * as Ariakit from "@ariakit/react";
3
+ import { Role } from "@ariakit/react/role";
4
4
  import { forwardRef } from "./~utils.js";
5
5
  const Avatar = forwardRef((props, forwardedRef) => {
6
6
  const { size = "medium", initials, alt, image, children, ...rest } = props;
7
7
  const isDecorative = !alt;
8
8
  return /* @__PURE__ */ jsx(
9
- Ariakit.Role.span,
9
+ Role.span,
10
10
  {
11
11
  role: isDecorative ? void 0 : "img",
12
12
  "aria-label": isDecorative ? void 0 : alt,
@@ -1,11 +1,11 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import cx from "classnames";
3
- import * as Ariakit from "@ariakit/react";
3
+ import { Role } from "@ariakit/react/role";
4
4
  import { forwardRef } from "./~utils.js";
5
5
  const Badge = forwardRef((props, forwardedRef) => {
6
6
  const { tone = "neutral", variant = "solid", label, ...rest } = props;
7
7
  return /* @__PURE__ */ jsx(
8
- Ariakit.Role.span,
8
+ Role.span,
9
9
  {
10
10
  ...rest,
11
11
  "data-kiwi-tone": tone,
@@ -1,18 +1,25 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import cx from "classnames";
3
- import * as Ariakit from "@ariakit/react";
3
+ import { Button as AkButton } from "@ariakit/react/button";
4
4
  import { forwardRef } from "./~utils.js";
5
+ import { useGhostAlignment } from "./~utils.GhostAligner.js";
5
6
  const Button = forwardRef(
6
7
  (props, forwardedRef) => {
7
8
  const { variant = "solid", tone = "neutral", ...rest } = props;
9
+ const ghostAlignment = useGhostAlignment();
8
10
  return /* @__PURE__ */ jsx(
9
- Ariakit.Button,
11
+ AkButton,
10
12
  {
11
13
  accessibleWhenDisabled: true,
12
14
  ...rest,
13
15
  "data-kiwi-variant": variant,
14
16
  "data-kiwi-tone": tone,
15
- className: cx("\u{1F95D}-button", props.className),
17
+ "data-kiwi-ghost-align": variant === "ghost" ? ghostAlignment : void 0,
18
+ className: cx(
19
+ "\u{1F95D}-button",
20
+ { "\u{1F95D}-ghost-aligner": variant === "ghost" },
21
+ props.className
22
+ ),
16
23
  ref: forwardedRef
17
24
  }
18
25
  );
@@ -1,6 +1,8 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import cx from "classnames";
3
- import * as Ariakit from "@ariakit/react";
3
+ import {
4
+ Checkbox as AkCheckbox
5
+ } from "@ariakit/react/checkbox";
4
6
  import { FieldControl } from "./Field.js";
5
7
  import { forwardRef } from "./~utils.js";
6
8
  const Checkbox = forwardRef(
@@ -12,7 +14,7 @@ const Checkbox = forwardRef(
12
14
  type: "checkable",
13
15
  id,
14
16
  render: /* @__PURE__ */ jsx(
15
- Ariakit.Checkbox,
17
+ AkCheckbox,
16
18
  {
17
19
  accessibleWhenDisabled: true,
18
20
  ...rest,
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import cx from "classnames";
3
3
  import * as React from "react";
4
- import * as Ariakit from "@ariakit/react";
4
+ import { Role } from "@ariakit/react/role";
5
5
  import { forwardRef } from "./~utils.js";
6
6
  import { IconButton } from "./IconButton.js";
7
7
  import { Dismiss } from "./Icon.js";
@@ -11,7 +11,7 @@ const Chip = forwardRef((props, forwardedRef) => {
11
11
  const labelId = `${baseId}-label`;
12
12
  const dismissIconId = `${baseId}-dismiss`;
13
13
  return /* @__PURE__ */ jsxs(
14
- Ariakit.Role.div,
14
+ Role.div,
15
15
  {
16
16
  "data-kiwi-variant": variant,
17
17
  ...rest,
@@ -1,10 +1,11 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import cx from "classnames";
3
- import * as Ariakit from "@ariakit/react";
3
+ import { Role } from "@ariakit/react/role";
4
+ import { Separator } from "@ariakit/react/separator";
4
5
  import { forwardRef } from "./~utils.js";
5
6
  const Divider = forwardRef((props, forwardedRef) => {
6
7
  const { presentational, ...rest } = props;
7
- const Comp = presentational ? Ariakit.Role : Ariakit.Separator;
8
+ const Comp = presentational ? Role : Separator;
8
9
  return /* @__PURE__ */ jsx(
9
10
  Comp,
10
11
  {
@@ -1,12 +1,23 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import cx from "classnames";
4
- import * as Ariakit from "@ariakit/react";
5
- import * as ListItem from "./ListItem.js";
4
+ import * as ListItem from "./~utils.ListItem.js";
6
5
  import { Button } from "./Button.js";
7
6
  import { Kbd } from "./Kbd.js";
8
- import { Checkmark, DisclosureArrow } from "./Icon.js";
9
- import { forwardRef, supportsPopover } from "./~utils.js";
7
+ import { Checkmark, DisclosureArrow, Icon } from "./Icon.js";
8
+ import {
9
+ forwardRef
10
+ } from "./~utils.js";
11
+ import { usePopoverApi } from "./~hooks.js";
12
+ import {
13
+ MenuProvider,
14
+ useMenuContext,
15
+ Menu,
16
+ MenuButton,
17
+ MenuItem,
18
+ MenuItemCheckbox
19
+ } from "@ariakit/react/menu";
20
+ import { predefinedSymbols } from "./Kbd.internal.js";
10
21
  function DropdownMenu(props) {
11
22
  const {
12
23
  children,
@@ -15,21 +26,9 @@ function DropdownMenu(props) {
15
26
  setOpen: setOpenProp,
16
27
  defaultOpen: defaultOpenProp
17
28
  } = props;
18
- const store = Ariakit.useMenuStore();
19
- const open = Ariakit.useStoreState(store, (state) => state.open);
20
- const popover = Ariakit.useStoreState(store, (state) => state.popoverElement);
21
- React.useEffect(
22
- function syncPopoverWithOpenState() {
23
- if (popover?.isConnected) {
24
- popover?.togglePopover?.(open);
25
- }
26
- },
27
- [open, popover]
28
- );
29
29
  return /* @__PURE__ */ jsx(
30
- Ariakit.MenuProvider,
30
+ MenuProvider,
31
31
  {
32
- store,
33
32
  placement,
34
33
  defaultOpen: defaultOpenProp,
35
34
  open: openProp,
@@ -41,15 +40,16 @@ function DropdownMenu(props) {
41
40
  DEV: DropdownMenu.displayName = "DropdownMenu.Root";
42
41
  const DropdownMenuContent = forwardRef(
43
42
  (props, forwardedRef) => {
43
+ const popover = usePopoverApi(useMenuContext());
44
44
  return /* @__PURE__ */ jsx(
45
- Ariakit.Menu,
45
+ Menu,
46
46
  {
47
- portal: !supportsPopover,
47
+ portal: popover.portal,
48
48
  unmountOnHide: true,
49
49
  ...props,
50
50
  gutter: 4,
51
- style: { zIndex: supportsPopover ? void 0 : 9999, ...props.style },
52
- wrapperProps: { popover: "manual" },
51
+ style: { ...popover.style, ...props.style },
52
+ wrapperProps: popover.wrapperProps,
53
53
  className: cx("\u{1F95D}-dropdown-menu", props.className),
54
54
  ref: forwardedRef
55
55
  }
@@ -61,7 +61,7 @@ const DropdownMenuButton = forwardRef(
61
61
  (props, forwardedRef) => {
62
62
  const { accessibleWhenDisabled = true, children, ...rest } = props;
63
63
  return /* @__PURE__ */ jsx(
64
- Ariakit.MenuButton,
64
+ MenuButton,
65
65
  {
66
66
  accessibleWhenDisabled: true,
67
67
  render: /* @__PURE__ */ jsxs(Button, { accessibleWhenDisabled, children: [
@@ -78,13 +78,9 @@ const DropdownMenuButton = forwardRef(
78
78
  DEV: DropdownMenuButton.displayName = "DropdownMenu.Button";
79
79
  const DropdownMenuItem = forwardRef(
80
80
  (props, forwardedRef) => {
81
- const { shortcuts, ...rest } = props;
82
- const shortcutKeys = React.useMemo(() => {
83
- return typeof shortcuts === "string" ? shortcuts.split("+").map((key) => key.trim()) : [];
84
- }, [shortcuts]);
85
- const hasShortcuts = shortcutKeys.length > 0;
81
+ const { label, shortcuts, icon, ...rest } = props;
86
82
  return /* @__PURE__ */ jsxs(
87
- Ariakit.MenuItem,
83
+ MenuItem,
88
84
  {
89
85
  accessibleWhenDisabled: true,
90
86
  ...rest,
@@ -92,26 +88,80 @@ const DropdownMenuItem = forwardRef(
92
88
  className: cx("\u{1F95D}-dropdown-menu-item", props.className),
93
89
  ref: forwardedRef,
94
90
  children: [
95
- /* @__PURE__ */ jsx(ListItem.Content, { children: props.children }),
96
- hasShortcuts && /* @__PURE__ */ jsx(ListItem.Decoration, { className: "\u{1F95D}-dropdown-menu-item-shortcuts", children: shortcutKeys.map((key, index) => /* @__PURE__ */ jsx(Kbd, { variant: "ghost", children: key }, `${key + index}`)) })
91
+ icon ? /* @__PURE__ */ jsx(DropdownMenuIcon, { icon }) : null,
92
+ /* @__PURE__ */ jsx(ListItem.Content, { children: label }),
93
+ shortcuts ? /* @__PURE__ */ jsx(DropdownMenuItemShortcuts, { shortcuts }) : null
97
94
  ]
98
95
  }
99
96
  );
100
97
  }
101
98
  );
102
99
  DEV: DropdownMenuItem.displayName = "DropdownMenu.Item";
100
+ const DropdownMenuItemShortcuts = forwardRef((props, forwardedRef) => {
101
+ const { shortcuts, ...rest } = props;
102
+ const shortcutKeys = React.useMemo(() => {
103
+ return shortcuts.split("+").map((key) => ({
104
+ key: key.trim(),
105
+ isSymbol: key in predefinedSymbols
106
+ }));
107
+ }, [shortcuts]);
108
+ return /* @__PURE__ */ jsx(
109
+ ListItem.Decoration,
110
+ {
111
+ ...rest,
112
+ className: cx("\u{1F95D}-dropdown-menu-item-shortcuts", props.className),
113
+ ref: forwardedRef,
114
+ children: shortcutKeys.map(({ key, isSymbol }, index) => {
115
+ if (isSymbol) {
116
+ return /* @__PURE__ */ jsx(
117
+ Kbd,
118
+ {
119
+ variant: "ghost",
120
+ symbol: key
121
+ },
122
+ `${key + index}`
123
+ );
124
+ }
125
+ return /* @__PURE__ */ jsx(Kbd, { variant: "ghost", children: key }, `${key + index}`);
126
+ })
127
+ }
128
+ );
129
+ });
130
+ DEV: DropdownMenuItemShortcuts.displayName = "DropdownMenuItemShortcuts";
131
+ const DropdownMenuIcon = forwardRef(
132
+ (props, forwardedRef) => {
133
+ const { icon, ...rest } = props;
134
+ return /* @__PURE__ */ jsx(
135
+ ListItem.Decoration,
136
+ {
137
+ render: /* @__PURE__ */ jsx(
138
+ Icon,
139
+ {
140
+ href: typeof icon === "string" ? icon : void 0,
141
+ render: React.isValidElement(icon) ? icon : void 0
142
+ }
143
+ ),
144
+ ...rest,
145
+ ref: forwardedRef
146
+ }
147
+ );
148
+ }
149
+ );
150
+ DEV: DropdownMenuIcon.displayName = "DropdownMenuIcon";
103
151
  const DropdownMenuCheckboxItem = forwardRef((props, forwardedRef) => {
152
+ const { label, icon, ...rest } = props;
104
153
  return /* @__PURE__ */ jsxs(
105
- Ariakit.MenuItemCheckbox,
154
+ MenuItemCheckbox,
106
155
  {
107
156
  accessibleWhenDisabled: true,
108
157
  value: props.defaultChecked ? "on" : void 0,
109
- ...props,
158
+ ...rest,
110
159
  render: /* @__PURE__ */ jsx(ListItem.Root, { render: props.render }),
111
160
  className: cx("\u{1F95D}-dropdown-menu-item", props.className),
112
161
  ref: forwardedRef,
113
162
  children: [
114
- /* @__PURE__ */ jsx(ListItem.Content, { children: props.children }),
163
+ icon ? /* @__PURE__ */ jsx(DropdownMenuIcon, { icon }) : null,
164
+ /* @__PURE__ */ jsx(ListItem.Content, { children: label }),
115
165
  /* @__PURE__ */ jsx(
116
166
  ListItem.Decoration,
117
167
  {
@@ -1,7 +1,14 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
- import * as Ariakit from "@ariakit/react";
4
3
  import cx from "classnames";
4
+ import { Role } from "@ariakit/react/role";
5
+ import {
6
+ useCollectionStore,
7
+ Collection,
8
+ useCollectionContext,
9
+ CollectionItem
10
+ } from "@ariakit/react/collection";
11
+ import { useStoreState } from "@ariakit/react/store";
5
12
  import { forwardRef } from "./~utils.js";
6
13
  const Field = forwardRef((props, forwardedRef) => {
7
14
  const { layout, ...rest } = props;
@@ -9,7 +16,7 @@ const Field = forwardRef((props, forwardedRef) => {
9
16
  FieldCollection,
10
17
  {
11
18
  render: /* @__PURE__ */ jsx(
12
- Ariakit.Role.div,
19
+ Role.div,
13
20
  {
14
21
  ...rest,
15
22
  className: cx("\u{1F95D}-field", props.className),
@@ -22,13 +29,10 @@ const Field = forwardRef((props, forwardedRef) => {
22
29
  });
23
30
  DEV: Field.displayName = "Field";
24
31
  function FieldCollection(props) {
25
- const fieldElementCollection = Ariakit.useCollectionStore({
32
+ const fieldElementCollection = useCollectionStore({
26
33
  defaultItems: []
27
34
  });
28
- const renderedItems = Ariakit.useStoreState(
29
- fieldElementCollection,
30
- "renderedItems"
31
- );
35
+ const renderedItems = useStoreState(fieldElementCollection, "renderedItems");
32
36
  const [controlType, controlIndex] = React.useMemo(() => {
33
37
  const controlIndex2 = renderedItems.findIndex(
34
38
  (item) => item.elementType === "control"
@@ -43,7 +47,7 @@ function FieldCollection(props) {
43
47
  return labelIndex < controlIndex ? "before" : "after";
44
48
  }, [renderedItems, controlIndex]);
45
49
  return /* @__PURE__ */ jsx(
46
- Ariakit.Collection,
50
+ Collection,
47
51
  {
48
52
  ...props,
49
53
  store: fieldElementCollection,
@@ -53,10 +57,10 @@ function FieldCollection(props) {
53
57
  );
54
58
  }
55
59
  function FieldControl(props) {
56
- const store = Ariakit.useCollectionContext();
60
+ const store = useCollectionContext();
57
61
  const generatedId = React.useId();
58
62
  const { id = store ? generatedId : void 0, type, ...rest } = props;
59
- const renderedItems = Ariakit.useStoreState(store, "renderedItems");
63
+ const renderedItems = useStoreState(store, "renderedItems");
60
64
  const describedBy = React.useMemo(() => {
61
65
  const idRefList = renderedItems?.filter(
62
66
  (item) => item.elementType === "description"
@@ -72,17 +76,17 @@ function FieldControl(props) {
72
76
  [type]
73
77
  );
74
78
  return /* @__PURE__ */ jsx(
75
- Ariakit.CollectionItem,
79
+ CollectionItem,
76
80
  {
77
81
  id,
78
82
  getItem: getData,
79
- render: /* @__PURE__ */ jsx(Ariakit.Role, { ...rest, "aria-describedby": describedBy })
83
+ render: /* @__PURE__ */ jsx(Role, { ...rest, "aria-describedby": describedBy })
80
84
  }
81
85
  );
82
86
  }
83
87
  function FieldLabel(props) {
84
- const store = Ariakit.useCollectionContext();
85
- const renderedItems = Ariakit.useStoreState(store, "renderedItems");
88
+ const store = useCollectionContext();
89
+ const renderedItems = useStoreState(store, "renderedItems");
86
90
  const fieldId = React.useMemo(
87
91
  () => renderedItems?.find(
88
92
  (item) => item.elementType === "control"
@@ -97,10 +101,10 @@ function FieldLabel(props) {
97
101
  []
98
102
  );
99
103
  return /* @__PURE__ */ jsx(
100
- Ariakit.CollectionItem,
104
+ CollectionItem,
101
105
  {
102
106
  getItem: getData,
103
- render: /* @__PURE__ */ jsx(Ariakit.Role.label, { ...props, htmlFor: fieldId })
107
+ render: /* @__PURE__ */ jsx(Role.label, { ...props, htmlFor: fieldId })
104
108
  }
105
109
  );
106
110
  }
@@ -114,7 +118,7 @@ function FieldDescription(props) {
114
118
  }),
115
119
  []
116
120
  );
117
- return /* @__PURE__ */ jsx(Ariakit.CollectionItem, { ...rest, id, getItem: getData });
121
+ return /* @__PURE__ */ jsx(CollectionItem, { ...rest, id, getItem: getData });
118
122
  }
119
123
  export {
120
124
  Field,
@@ -1,14 +1,14 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import cx from "classnames";
4
- import * as Ariakit from "@ariakit/react";
4
+ import { Role } from "@ariakit/react/role";
5
5
  import { forwardRef } from "./~utils.js";
6
6
  const Icon = forwardRef((props, forwardedRef) => {
7
7
  const { href, size, alt, ...rest } = props;
8
8
  const iconId = toIconId(size);
9
9
  const isDecorative = !alt;
10
10
  return /* @__PURE__ */ jsx(
11
- Ariakit.Role.svg,
11
+ Role.svg,
12
12
  {
13
13
  "aria-hidden": isDecorative ? "true" : void 0,
14
14
  role: isDecorative ? void 0 : "img",
@@ -42,7 +42,7 @@ const DisclosureArrow = forwardRef(
42
42
  {
43
43
  ...rest,
44
44
  render: /* @__PURE__ */ jsx(
45
- Ariakit.Role.svg,
45
+ Role.svg,
46
46
  {
47
47
  width: "16",
48
48
  height: "16",
@@ -66,7 +66,7 @@ const Checkmark = forwardRef(
66
66
  {
67
67
  ...props,
68
68
  render: /* @__PURE__ */ jsx(
69
- Ariakit.Role.svg,
69
+ Role.svg,
70
70
  {
71
71
  width: "16",
72
72
  height: "16",
@@ -96,7 +96,7 @@ const Dismiss = forwardRef(
96
96
  {
97
97
  ...props,
98
98
  render: /* @__PURE__ */ jsx(
99
- Ariakit.Role.svg,
99
+ Role.svg,
100
100
  {
101
101
  width: "16",
102
102
  height: "16",
@@ -1,6 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
+ import * as React from "react";
2
3
  import cx from "classnames";
3
- import * as Ariakit from "@ariakit/react";
4
+ import { useToolbarContext, ToolbarItem } from "@ariakit/react/toolbar";
4
5
  import { Button } from "./Button.js";
5
6
  import { VisuallyHidden } from "./VisuallyHidden.js";
6
7
  import { Icon } from "./Icon.js";
@@ -8,19 +9,26 @@ import { Tooltip } from "./Tooltip.js";
8
9
  import { forwardRef } from "./~utils.js";
9
10
  const IconButton = forwardRef(
10
11
  (props, forwardedRef) => {
11
- const { label, icon, isActive, labelVariant, ...rest } = props;
12
- const toolbar = Ariakit.useToolbarContext();
12
+ const { label, icon, isActive, labelVariant, dot, ...rest } = props;
13
+ const baseId = React.useId();
14
+ const labelId = `${baseId}-label`;
15
+ const dotId = `${baseId}-dot`;
16
+ const toolbar = useToolbarContext();
13
17
  const button = /* @__PURE__ */ jsxs(
14
18
  Button,
15
19
  {
16
20
  "aria-pressed": isActive,
21
+ "aria-labelledby": labelId,
22
+ "aria-describedby": dot ? dotId : void 0,
17
23
  ...rest,
18
- render: toolbar ? /* @__PURE__ */ jsx(Ariakit.ToolbarItem, { render: props.render }) : props.render,
24
+ "data-kiwi-dot": dot ? "true" : void 0,
25
+ render: toolbar ? /* @__PURE__ */ jsx(ToolbarItem, { render: props.render }) : props.render,
19
26
  className: cx("\u{1F95D}-icon-button", props.className),
20
27
  ref: forwardedRef,
21
28
  children: [
22
- /* @__PURE__ */ jsx(VisuallyHidden, { children: label }),
23
- typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { href: icon }) : icon
29
+ /* @__PURE__ */ jsx(VisuallyHidden, { id: labelId, children: label }),
30
+ typeof icon === "string" ? /* @__PURE__ */ jsx(Icon, { href: icon }) : icon,
31
+ dot ? /* @__PURE__ */ jsx(VisuallyHidden, { id: dotId, "aria-hidden": "true", children: dot }) : null
24
32
  ]
25
33
  }
26
34
  );
@@ -0,0 +1,19 @@
1
+ const predefinedSymbols = {
2
+ Backspace: "\u232B",
3
+ Command: "\u2318",
4
+ Control: "Ctrl",
5
+ Down: "\u2193",
6
+ Eject: "\u23CF",
7
+ Enter: "\u21B5",
8
+ Escape: "Esc",
9
+ Left: "\u2190",
10
+ Option: "\u2325",
11
+ Right: "\u2192",
12
+ Shift: "\u21E7",
13
+ Space: "\u2423",
14
+ Tab: "Tab",
15
+ Up: "\u2191"
16
+ };
17
+ export {
18
+ predefinedSymbols
19
+ };
@@ -1,24 +1,9 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import cx from "classnames";
3
- import * as Ariakit from "@ariakit/react";
3
+ import { Role } from "@ariakit/react/role";
4
4
  import { forwardRef } from "./~utils.js";
5
5
  import { VisuallyHidden } from "./VisuallyHidden.js";
6
- const predefinedSymbols = {
7
- Backspace: "\u232B",
8
- Command: "\u2318",
9
- Control: "Ctrl",
10
- Down: "\u2193",
11
- Eject: "\u23CF",
12
- Enter: "\u21B5",
13
- Escape: "Esc",
14
- Left: "\u2190",
15
- Option: "\u2325",
16
- Right: "\u2192",
17
- Shift: "\u21E7",
18
- Space: "\u2423",
19
- Tab: "Tab",
20
- Up: "\u2191"
21
- };
6
+ import { predefinedSymbols } from "./Kbd.internal.js";
22
7
  const Kbd = forwardRef((props, forwardedRef) => {
23
8
  const { variant = "solid", symbol, children, ...rest } = props;
24
9
  DEV: {
@@ -36,7 +21,7 @@ const Kbd = forwardRef((props, forwardedRef) => {
36
21
  ] });
37
22
  }
38
23
  return /* @__PURE__ */ jsx(
39
- Ariakit.Role,
24
+ Role,
40
25
  {
41
26
  ...rest,
42
27
  "data-kiwi-variant": variant,
@@ -1,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import cx from "classnames";
3
- import * as Ariakit from "@ariakit/react";
3
+ import { Role } from "@ariakit/react/role";
4
4
  import { forwardRef } from "./~utils.js";
5
5
  import { FieldLabel } from "./Field.js";
6
6
  const Label = forwardRef((props, forwardedRef) => {
@@ -8,7 +8,7 @@ const Label = forwardRef((props, forwardedRef) => {
8
8
  FieldLabel,
9
9
  {
10
10
  render: /* @__PURE__ */ jsx(
11
- Ariakit.Role.label,
11
+ Role.label,
12
12
  {
13
13
  ...props,
14
14
  className: cx("\u{1F95D}-label", props.className),