@zvk/ui 0.1.3 → 0.1.5

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 (42) hide show
  1. package/dist/components/alert-dialog/alert-dialog.d.ts +8 -5
  2. package/dist/components/alert-dialog/alert-dialog.js +21 -8
  3. package/dist/components/button/button.d.ts +3 -2
  4. package/dist/components/button/button.js +5 -1
  5. package/dist/components/calendar/calendar.d.ts +40 -5
  6. package/dist/components/calendar/calendar.js +17 -5
  7. package/dist/components/calendar/index.d.ts +1 -1
  8. package/dist/components/collapsible/collapsible.d.ts +3 -2
  9. package/dist/components/collapsible/collapsible.js +5 -1
  10. package/dist/components/command/command.d.ts +11 -4
  11. package/dist/components/command/command.js +27 -16
  12. package/dist/components/command/index.d.ts +1 -1
  13. package/dist/components/context-menu/context-menu.d.ts +17 -6
  14. package/dist/components/context-menu/context-menu.js +139 -36
  15. package/dist/components/dialog/dialog.d.ts +6 -4
  16. package/dist/components/dialog/dialog.js +14 -4
  17. package/dist/components/dropdown-menu/dropdown-menu.d.ts +13 -7
  18. package/dist/components/dropdown-menu/dropdown-menu.js +127 -72
  19. package/dist/components/hover-card/hover-card.d.ts +8 -2
  20. package/dist/components/hover-card/hover-card.js +8 -5
  21. package/dist/components/index.d.ts +7 -7
  22. package/dist/components/index.js +1 -1
  23. package/dist/components/menubar/menubar.d.ts +24 -5
  24. package/dist/components/menubar/menubar.js +182 -33
  25. package/dist/components/popover/popover.d.ts +8 -3
  26. package/dist/components/popover/popover.js +14 -5
  27. package/dist/components/sheet/sheet.d.ts +6 -4
  28. package/dist/components/sheet/sheet.js +21 -8
  29. package/dist/components/toast/index.d.ts +2 -2
  30. package/dist/components/toast/index.js +1 -1
  31. package/dist/components/toast/toast.d.ts +16 -2
  32. package/dist/components/toast/toast.js +44 -2
  33. package/dist/components/tooltip/tooltip.d.ts +8 -2
  34. package/dist/components/tooltip/tooltip.js +8 -5
  35. package/dist/internal/floating/placement-aliases.d.ts +7 -0
  36. package/dist/internal/floating/placement-aliases.js +13 -0
  37. package/dist/internal/slot/index.d.ts +2 -0
  38. package/dist/internal/slot/index.js +1 -0
  39. package/dist/internal/slot/slot.d.ts +6 -0
  40. package/dist/internal/slot/slot.js +53 -0
  41. package/dist/styles.css +21 -1
  42. package/package.json +2 -2
@@ -6,7 +6,9 @@ import { cn } from "../../utils/cn.js";
6
6
  import { useControllableState } from "../../hooks/use-controllable-state.js";
7
7
  import { createCollection } from "../../internal/collection/index.js";
8
8
  import { DismissableLayer } from "../../internal/dismissable-layer/index.js";
9
+ import { placementFromSideAlign, placementParts } from "../../internal/floating/placement-aliases.js";
9
10
  import { Portal } from "../../internal/portal/index.js";
11
+ import { Slot } from "../../internal/slot/index.js";
10
12
  const ContextMenuContext = React.createContext(null);
11
13
  function useContextMenuContext(calledBy) {
12
14
  const context = React.useContext(ContextMenuContext);
@@ -15,6 +17,18 @@ function useContextMenuContext(calledBy) {
15
17
  }
16
18
  return context;
17
19
  }
20
+ function setComposedRef(internalRef, externalRef, node) {
21
+ internalRef.current = node;
22
+ if (typeof externalRef === "function") {
23
+ externalRef(node);
24
+ }
25
+ else if (externalRef !== undefined && externalRef !== null) {
26
+ externalRef.current = node;
27
+ }
28
+ }
29
+ function isActivationKey(key) {
30
+ return key === "Enter" || key === " " || key === "Space" || key === "Spacebar";
31
+ }
18
32
  function ContextMenuRoot({ children, className, defaultOpen = false, onOpenChange, open: openProp, ref, ...props }) {
19
33
  const [open, setOpen] = useControllableState({
20
34
  ...(openProp !== undefined ? { value: openProp } : {}),
@@ -58,19 +72,35 @@ function ContextMenuRoot({ children, className, defaultOpen = false, onOpenChang
58
72
  }), [close, contentId, getItems, open, openAt, point, registerItem, unregisterItem]);
59
73
  return (_jsx(ContextMenuContext.Provider, { value: contextValue, children: _jsx("div", { ...props, ref: ref, className: cn("liano-context-menu", className), "data-state": open ? "open" : "closed", children: children }) }));
60
74
  }
61
- function ContextMenuTrigger({ children, className, onContextMenu, onKeyDown, ref, ...props }) {
75
+ function ContextMenuTrigger({ asChild = false, children, className, onContextMenu, onKeyDown, ref, ...props }) {
62
76
  const { contentId, open, openAt } = useContextMenuContext("ContextMenu.Trigger");
63
- return (_jsx("span", { ...props, ref: ref, "aria-controls": contentId, "aria-expanded": open ? "true" : "false", className: cn("liano-context-menu__trigger", className), "data-state": open ? "open" : "closed", onContextMenu: composeEventHandlers(onContextMenu, (event) => {
77
+ const openFromPoint = (point, restoreFocusTo) => {
78
+ openAt(point, restoreFocusTo);
79
+ };
80
+ const triggerProps = {
81
+ ...props,
82
+ ref: ref,
83
+ "aria-controls": contentId,
84
+ "aria-expanded": open,
85
+ className: cn("liano-context-menu__trigger", className),
86
+ "data-state": open ? "open" : "closed",
87
+ onContextMenu: composeEventHandlers(onContextMenu, (event) => {
64
88
  event.preventDefault();
65
- openAt({ x: event.clientX, y: event.clientY }, document.activeElement instanceof HTMLElement ? document.activeElement : event.currentTarget);
66
- }), onKeyDown: composeEventHandlers(onKeyDown, (event) => {
89
+ openFromPoint({ x: event.clientX, y: event.clientY }, document.activeElement instanceof HTMLElement ? document.activeElement : event.currentTarget);
90
+ }),
91
+ onKeyDown: composeEventHandlers(onKeyDown, (event) => {
67
92
  if ((event.shiftKey && event.key === "F10") || event.key === "ContextMenu") {
68
93
  event.preventDefault();
69
94
  const target = document.activeElement instanceof HTMLElement ? document.activeElement : event.currentTarget;
70
95
  const rect = target.getBoundingClientRect();
71
- openAt({ x: rect.left, y: rect.bottom }, target);
96
+ openFromPoint({ x: rect.left, y: rect.bottom }, target);
72
97
  }
73
- }), children: children }));
98
+ })
99
+ };
100
+ if (asChild) {
101
+ return _jsx(Slot, { ...triggerProps, children: children });
102
+ }
103
+ return (_jsx("span", { ...props, ref: ref, "aria-controls": triggerProps["aria-controls"], "aria-expanded": triggerProps["aria-expanded"], className: triggerProps.className, "data-state": triggerProps["data-state"], onContextMenu: triggerProps.onContextMenu, onKeyDown: triggerProps.onKeyDown, children: children }));
74
104
  }
75
105
  function focusItem(items, index) {
76
106
  const enabled = items.filter((item) => item.data.disabled !== true && item.data.ref !== null);
@@ -84,8 +114,10 @@ function currentIndex(items) {
84
114
  const enabled = items.filter((item) => item.data.disabled !== true && item.data.ref !== null);
85
115
  return enabled.findIndex((item) => item.data.ref === document.activeElement);
86
116
  }
87
- function ContextMenuContent({ children, className, onKeyDown, ref, style, ...props }) {
117
+ function ContextMenuContent({ align, alignOffset: _alignOffset, children, className, onKeyDown, ref, side, style, ...props }) {
88
118
  const { close, contentId, getItems, open, point } = useContextMenuContext("ContextMenu.Content");
119
+ const contentPlacement = placementFromSideAlign(side, align, "bottom-start");
120
+ const contentPlacementParts = placementParts(contentPlacement);
89
121
  React.useLayoutEffect(() => {
90
122
  if (!open) {
91
123
  return;
@@ -95,7 +127,7 @@ function ContextMenuContent({ children, className, onKeyDown, ref, style, ...pro
95
127
  if (!open) {
96
128
  return null;
97
129
  }
98
- return (_jsx(Portal, { children: _jsx(DismissableLayer, { open: open, onDismiss: close, children: _jsx("div", { ...props, ref: ref, id: contentId, role: "menu", className: cn("liano-context-menu__content", className), style: { ...style, left: `${point.x}px`, top: `${point.y}px` }, onKeyDown: composeEventHandlers(onKeyDown, (event) => {
130
+ return (_jsx(Portal, { children: _jsx(DismissableLayer, { open: open, onDismiss: close, children: _jsx("div", { ...props, ref: ref, id: contentId, role: "menu", className: cn("liano-context-menu__content", className), "data-align": contentPlacementParts.align, "data-side": contentPlacementParts.side, style: { ...style, left: `${point.x}px`, top: `${point.y}px` }, onKeyDown: composeEventHandlers(onKeyDown, (event) => {
99
131
  const items = getItems();
100
132
  const index = currentIndex(items);
101
133
  if (event.key === "ArrowDown") {
@@ -113,7 +145,7 @@ function ContextMenuContent({ children, className, onKeyDown, ref, style, ...pro
113
145
  }
114
146
  }), children: children }) }) }));
115
147
  }
116
- function ContextMenuItem({ children, className, disabled, onClick, onKeyDown, onSelect, ref, tone = "default", type = "button", ...props }) {
148
+ function ContextMenuItem({ asChild = false, children, className, disabled, onClick, onKeyDown, onSelect, ref, tone = "default", type = "button", ...props }) {
117
149
  const { close, registerItem, unregisterItem } = useContextMenuContext("ContextMenu.Item");
118
150
  const itemId = React.useId();
119
151
  const itemRef = React.useRef(null);
@@ -126,27 +158,39 @@ function ContextMenuItem({ children, className, disabled, onClick, onKeyDown, on
126
158
  return;
127
159
  }
128
160
  onSelect?.(event);
129
- close();
161
+ if (!event.defaultPrevented) {
162
+ close();
163
+ }
130
164
  };
131
- return (_jsx("button", { ...props, ref: (node) => {
132
- itemRef.current = node;
133
- if (typeof ref === "function") {
134
- ref(node);
135
- }
136
- else if (ref) {
137
- ref.current = node;
138
- }
139
- }, type: type, role: "menuitem", disabled: disabled, "aria-disabled": disabled ? "true" : undefined, className: cn("liano-context-menu__item", className), "data-disabled": disabled ? "true" : undefined, "data-tone": tone, onClick: composeEventHandlers(onClick, select), onKeyDown: composeEventHandlers(onKeyDown, (event) => {
140
- if (event.key === "Enter" || event.key === " ") {
141
- event.preventDefault();
165
+ const itemProps = {
166
+ ...props,
167
+ ref: (node) => {
168
+ setComposedRef(itemRef, ref, node);
169
+ },
170
+ role: "menuitem",
171
+ "aria-disabled": disabled ? true : undefined,
172
+ className: cn("liano-context-menu__item", className),
173
+ "data-disabled": disabled ? "true" : undefined,
174
+ "data-tone": tone,
175
+ onClick: composeEventHandlers(onClick, select),
176
+ onKeyDown: composeEventHandlers(onKeyDown, (event) => {
177
+ if (isActivationKey(event.key)) {
142
178
  select(event);
179
+ event.preventDefault();
143
180
  }
144
- }), children: children }));
181
+ })
182
+ };
183
+ if (asChild) {
184
+ return _jsx(Slot, { ...itemProps, children: children });
185
+ }
186
+ return (_jsx("button", { ...props, ref: (node) => {
187
+ setComposedRef(itemRef, ref, node);
188
+ }, type: type, role: "menuitem", disabled: disabled, "aria-disabled": itemProps["aria-disabled"], className: itemProps.className, "data-disabled": itemProps["data-disabled"], "data-tone": itemProps["data-tone"], onClick: itemProps.onClick, onKeyDown: itemProps.onKeyDown, children: children }));
145
189
  }
146
190
  function ContextMenuLabel({ className, ref, ...props }) {
147
191
  return _jsx("div", { ...props, ref: ref, className: cn("liano-context-menu__label", className) });
148
192
  }
149
- function ContextMenuCheckboxItem({ checked, children, className, defaultChecked = false, disabled, onCheckedChange, onClick, onKeyDown, onSelect, ref, tone = "default", type = "button", ...props }) {
193
+ function ContextMenuCheckboxItem({ asChild = false, checked, children, className, defaultChecked = false, disabled, onCheckedChange, onClick, onKeyDown, onSelect, ref, tone = "default", type = "button", ...props }) {
150
194
  const { close, registerItem, unregisterItem } = useContextMenuContext("ContextMenu.CheckboxItem");
151
195
  const itemId = React.useId();
152
196
  const itemRef = React.useRef(null);
@@ -163,24 +207,82 @@ function ContextMenuCheckboxItem({ checked, children, className, defaultChecked
163
207
  if (disabled) {
164
208
  return;
165
209
  }
166
- setCurrentChecked((value) => !value);
167
210
  onSelect?.(event);
168
- close();
211
+ if (!event.defaultPrevented) {
212
+ setCurrentChecked((value) => !value);
213
+ close();
214
+ }
169
215
  };
170
- return (_jsxs("button", { ...props, ref: (node) => {
171
- itemRef.current = node;
172
- if (typeof ref === "function") {
173
- ref(node);
174
- }
175
- else if (ref) {
176
- ref.current = node;
177
- }
178
- }, type: type, role: "menuitemcheckbox", disabled: disabled, "aria-checked": currentChecked ? "true" : "false", "aria-disabled": disabled ? "true" : undefined, className: cn("liano-context-menu__item", "liano-context-menu__checkbox-item", className), "data-checked": currentChecked ? "true" : undefined, "data-disabled": disabled ? "true" : undefined, "data-tone": tone, onClick: composeEventHandlers(onClick, select), onKeyDown: composeEventHandlers(onKeyDown, (event) => {
179
- if (event.key === "Enter" || event.key === " ") {
216
+ const itemProps = {
217
+ ...props,
218
+ ref: (node) => {
219
+ setComposedRef(itemRef, ref, node);
220
+ },
221
+ role: "menuitemcheckbox",
222
+ "aria-checked": currentChecked,
223
+ "aria-disabled": disabled ? true : undefined,
224
+ className: cn("liano-context-menu__item", "liano-context-menu__checkbox-item", className),
225
+ "data-checked": currentChecked ? "true" : undefined,
226
+ "data-disabled": disabled ? "true" : undefined,
227
+ "data-tone": tone,
228
+ onClick: composeEventHandlers(onClick, select),
229
+ onKeyDown: composeEventHandlers(onKeyDown, (event) => {
230
+ if (isActivationKey(event.key)) {
231
+ select(event);
180
232
  event.preventDefault();
233
+ }
234
+ })
235
+ };
236
+ if (asChild) {
237
+ return _jsx(Slot, { ...itemProps, children: children });
238
+ }
239
+ return (_jsxs("button", { ...props, ref: (node) => {
240
+ setComposedRef(itemRef, ref, node);
241
+ }, type: type, role: "menuitemcheckbox", disabled: disabled, "aria-checked": itemProps["aria-checked"], "aria-disabled": itemProps["aria-disabled"], className: itemProps.className, "data-checked": itemProps["data-checked"], "data-disabled": itemProps["data-disabled"], "data-tone": itemProps["data-tone"], onClick: itemProps.onClick, onKeyDown: itemProps.onKeyDown, children: [_jsx("span", { className: "liano-context-menu__item-indicator", "aria-hidden": "true", children: currentChecked ? "✓" : "" }), _jsx("span", { className: "liano-context-menu__item-label", children: children })] }));
242
+ }
243
+ function ContextMenuRadioItem({ asChild = false, checked = false, children, className, disabled, onClick, onKeyDown, onSelect, ref, tone = "default", type = "button", ...props }) {
244
+ const { close, registerItem, unregisterItem } = useContextMenuContext("ContextMenu.RadioItem");
245
+ const itemId = React.useId();
246
+ const itemRef = React.useRef(null);
247
+ React.useLayoutEffect(() => {
248
+ registerItem(itemId, { disabled, ref: itemRef.current });
249
+ return () => unregisterItem(itemId);
250
+ }, [disabled, itemId, registerItem, unregisterItem]);
251
+ const select = (event) => {
252
+ if (disabled) {
253
+ return;
254
+ }
255
+ onSelect?.(event);
256
+ if (!event.defaultPrevented) {
257
+ close();
258
+ }
259
+ };
260
+ const itemProps = {
261
+ ...props,
262
+ ref: (node) => {
263
+ setComposedRef(itemRef, ref, node);
264
+ },
265
+ role: "menuitemradio",
266
+ "aria-checked": checked,
267
+ "aria-disabled": disabled ? true : undefined,
268
+ className: cn("liano-context-menu__item", "liano-context-menu__radio-item", className),
269
+ "data-checked": checked ? "true" : undefined,
270
+ "data-disabled": disabled ? "true" : undefined,
271
+ "data-tone": tone,
272
+ onClick: composeEventHandlers(onClick, select),
273
+ onKeyDown: composeEventHandlers(onKeyDown, (event) => {
274
+ if (isActivationKey(event.key)) {
181
275
  select(event);
276
+ event.preventDefault();
182
277
  }
183
- }), children: [_jsx("span", { className: "liano-context-menu__item-indicator", "aria-hidden": "true", children: currentChecked ? "✓" : "" }), _jsx("span", { className: "liano-context-menu__item-label", children: children })] }));
278
+ })
279
+ };
280
+ if (asChild) {
281
+ return _jsx(Slot, { ...itemProps, children: children });
282
+ }
283
+ return (_jsxs("button", { ...props, ref: (node) => {
284
+ setComposedRef(itemRef, ref, node);
285
+ }, type: type, role: "menuitemradio", disabled: disabled, "aria-checked": itemProps["aria-checked"], "aria-disabled": itemProps["aria-disabled"], className: itemProps.className, "data-checked": itemProps["data-checked"], "data-disabled": itemProps["data-disabled"], "data-tone": itemProps["data-tone"], onClick: itemProps.onClick, onKeyDown: itemProps.onKeyDown, children: [_jsx("span", { className: "liano-context-menu__item-indicator", "aria-hidden": "true", children: checked ? "●" : "" }), _jsx("span", { className: "liano-context-menu__item-label", children: children })] }));
184
286
  }
185
287
  function ContextMenuSeparator({ className, ref, ...props }) {
186
288
  return _jsx("div", { ...props, ref: ref, role: "separator", "aria-hidden": "true", className: cn("liano-context-menu__separator", className) });
@@ -190,6 +292,7 @@ export const ContextMenu = Object.assign(ContextMenuRoot, {
190
292
  Content: ContextMenuContent,
191
293
  Item: ContextMenuItem,
192
294
  Label: ContextMenuLabel,
295
+ RadioItem: ContextMenuRadioItem,
193
296
  Separator: ContextMenuSeparator,
194
297
  Trigger: ContextMenuTrigger
195
298
  });
@@ -10,7 +10,8 @@ export interface DialogProps extends React.HTMLAttributes<HTMLDivElement> {
10
10
  ref?: React.Ref<HTMLDivElement>;
11
11
  }
12
12
  export interface DialogTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
13
- ref?: React.Ref<HTMLButtonElement>;
13
+ asChild?: boolean;
14
+ ref?: React.Ref<HTMLButtonElement | HTMLElement>;
14
15
  }
15
16
  export interface DialogContentProps extends React.HTMLAttributes<HTMLDivElement> {
16
17
  forceMount?: boolean;
@@ -32,7 +33,8 @@ export interface DialogOverlayProps extends React.HTMLAttributes<HTMLDivElement>
32
33
  ref?: React.Ref<HTMLDivElement>;
33
34
  }
34
35
  export interface DialogCloseProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
35
- ref?: React.Ref<HTMLButtonElement>;
36
+ asChild?: boolean;
37
+ ref?: React.Ref<HTMLButtonElement | HTMLElement>;
36
38
  }
37
39
  interface DialogPortalProps {
38
40
  children: React.ReactNode;
@@ -46,8 +48,8 @@ declare function DialogHeader({ className, ref, ...props }: DialogHeaderProps):
46
48
  declare function DialogTitle({ className, ref, ...props }: DialogTitleProps): React.JSX.Element;
47
49
  declare function DialogDescription({ className, ref, ...props }: DialogDescriptionProps): React.JSX.Element;
48
50
  declare function DialogFooter({ className, ref, ...props }: DialogFooterProps): React.JSX.Element;
49
- declare function DialogTrigger({ className, disabled, onClick, ref, type, ...props }: DialogTriggerProps): React.JSX.Element;
50
- declare function DialogClose({ className, onClick, ref, type, ...props }: DialogCloseProps): React.JSX.Element;
51
+ declare function DialogTrigger({ asChild, className, disabled, onClick, ref, type, ...props }: DialogTriggerProps): React.JSX.Element;
52
+ declare function DialogClose({ asChild, className, disabled, onClick, ref, type, ...props }: DialogCloseProps): React.JSX.Element;
51
53
  type DialogComponent = typeof DialogRoot & {
52
54
  Close: typeof DialogClose;
53
55
  Content: typeof DialogContent;
@@ -8,6 +8,7 @@ import { DismissableLayer } from "../../internal/dismissable-layer/dismissable-l
8
8
  import { FocusScope } from "../../internal/focus/focus-scope.js";
9
9
  import { lockScroll, unlockScroll } from "../../internal/scroll-lock/scroll-lock.js";
10
10
  import { Portal } from "../../internal/portal/index.js";
11
+ import { Slot } from "../../internal/slot/index.js";
11
12
  const DialogContext = React.createContext(null);
12
13
  function useDialogContext(calledBy) {
13
14
  const context = React.useContext(DialogContext);
@@ -116,7 +117,7 @@ function DialogDescription({ className, ref, ...props }) {
116
117
  function DialogFooter({ className, ref, ...props }) {
117
118
  return _jsx("div", { ...props, ref: ref, className: cn("liano-dialog__footer", className) });
118
119
  }
119
- function DialogTrigger({ className, disabled, onClick, ref, type = "button", ...props }) {
120
+ function DialogTrigger({ asChild = false, className, disabled, onClick, ref, type = "button", ...props }) {
120
121
  const { open, setOpen, contentId, triggerRef } = useDialogContext("Dialog.Trigger");
121
122
  const handleClick = () => {
122
123
  if (disabled) {
@@ -124,13 +125,22 @@ function DialogTrigger({ className, disabled, onClick, ref, type = "button", ...
124
125
  }
125
126
  setOpen(true);
126
127
  };
128
+ if (asChild) {
129
+ return (_jsx(Slot, { ...props, ref: composeRefs(ref, triggerRef), "aria-controls": contentId, "aria-disabled": disabled ? true : undefined, "aria-expanded": open ? "true" : "false", className: cn("liano-dialog__trigger", className), "data-disabled": disabled ? "true" : undefined, "data-state": open ? "open" : "closed", onClick: composeEventHandlers(onClick, handleClick), children: props.children }));
130
+ }
127
131
  return (_jsx("button", { ...props, ref: composeRefs(ref, triggerRef), type: type, disabled: disabled, "aria-controls": contentId, "aria-expanded": open ? "true" : "false", "data-state": open ? "open" : "closed", className: cn("liano-dialog__trigger", className), onClick: composeEventHandlers(onClick, handleClick) }));
128
132
  }
129
- function DialogClose({ className, onClick, ref, type = "button", ...props }) {
133
+ function DialogClose({ asChild = false, className, disabled, onClick, ref, type = "button", ...props }) {
130
134
  const { close } = useDialogContext("Dialog.Close");
131
- return (_jsx("button", { ...props, ref: ref, type: type, className: cn("liano-dialog__close", className), onClick: composeEventHandlers(onClick, () => {
135
+ const handleClick = () => {
136
+ if (!disabled) {
132
137
  close();
133
- }) }));
138
+ }
139
+ };
140
+ if (asChild) {
141
+ return (_jsx(Slot, { ...props, ref: ref, "aria-disabled": disabled ? true : undefined, className: cn("liano-dialog__close", className), "data-disabled": disabled ? "true" : undefined, onClick: composeEventHandlers(onClick, handleClick), children: props.children }));
142
+ }
143
+ return (_jsx("button", { ...props, ref: ref, type: type, disabled: disabled, className: cn("liano-dialog__close", className), onClick: composeEventHandlers(onClick, handleClick) }));
134
144
  }
135
145
  export const Dialog = Object.assign(DialogRoot, {
136
146
  Close: DialogClose,
@@ -1,6 +1,7 @@
1
1
  import * as React from "react";
2
2
  import type { PortalProps } from "../../internal/portal/index.js";
3
3
  import type { FloatingPlacement } from "../../internal/floating/floating-types.js";
4
+ import type { FloatingAlign, FloatingSide } from "../../internal/floating/placement-aliases.js";
4
5
  export interface DropdownMenuProps extends React.HTMLAttributes<HTMLDivElement> {
5
6
  container?: PortalProps["container"];
6
7
  open?: boolean;
@@ -12,9 +13,13 @@ export interface DropdownMenuProps extends React.HTMLAttributes<HTMLDivElement>
12
13
  matchTriggerWidth?: boolean;
13
14
  }
14
15
  export interface DropdownMenuTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
15
- ref?: React.Ref<HTMLButtonElement>;
16
+ asChild?: boolean;
17
+ ref?: React.Ref<HTMLButtonElement | HTMLElement>;
16
18
  }
17
19
  export interface DropdownMenuContentProps extends React.HTMLAttributes<HTMLDivElement> {
20
+ side?: FloatingSide;
21
+ align?: FloatingAlign;
22
+ alignOffset?: number;
18
23
  sideOffset?: number;
19
24
  collisionPadding?: number;
20
25
  matchTriggerWidth?: boolean;
@@ -22,8 +27,9 @@ export interface DropdownMenuContentProps extends React.HTMLAttributes<HTMLDivEl
22
27
  ref?: React.Ref<HTMLDivElement>;
23
28
  }
24
29
  export interface DropdownMenuItemProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
30
+ asChild?: boolean;
25
31
  onSelect?: (event: React.SyntheticEvent<HTMLElement>) => void;
26
- ref?: React.Ref<HTMLButtonElement>;
32
+ ref?: React.Ref<HTMLButtonElement | HTMLElement>;
27
33
  }
28
34
  export interface DropdownMenuSeparatorProps extends React.HTMLAttributes<HTMLDivElement> {
29
35
  ref?: React.Ref<HTMLDivElement>;
@@ -51,15 +57,15 @@ export interface DropdownMenuSubProps extends React.HTMLAttributes<HTMLDivElemen
51
57
  ref?: React.Ref<HTMLDivElement>;
52
58
  }
53
59
  declare function DropdownMenuRoot({ children, className, container, defaultOpen, onOpenChange, open: openProp, placement, sideOffset, collisionPadding, matchTriggerWidth, ...props }: DropdownMenuProps): React.JSX.Element;
54
- declare function DropdownMenuTrigger({ className, disabled, onClick, ref, type, ...props }: DropdownMenuTriggerProps): React.JSX.Element;
55
- declare function DropdownMenuContent({ children, className, forceMount, sideOffset, collisionPadding, matchTriggerWidth, ref, onKeyDown, ...props }: DropdownMenuContentProps): React.JSX.Element | null;
56
- declare function DropdownMenuItem({ children, className, disabled, onClick, onSelect, onKeyDown, ref, ...props }: DropdownMenuItemProps): React.JSX.Element;
60
+ declare function DropdownMenuTrigger({ asChild, className, disabled, onClick, ref, type, ...props }: DropdownMenuTriggerProps): React.JSX.Element;
61
+ declare function DropdownMenuContent({ align, alignOffset: _alignOffset, children, className, forceMount, side, sideOffset, collisionPadding, matchTriggerWidth, ref, onKeyDown, ...props }: DropdownMenuContentProps): React.JSX.Element | null;
62
+ declare function DropdownMenuItem({ asChild, children, className, disabled, onClick, onSelect, onKeyDown, ref, ...props }: DropdownMenuItemProps): React.JSX.Element;
57
63
  declare function DropdownMenuSeparator({ className, ref, ...props }: DropdownMenuSeparatorProps): React.JSX.Element;
58
64
  declare function DropdownMenuLabel({ className, ref, ...props }: DropdownMenuLabelProps): React.JSX.Element;
59
65
  declare function DropdownMenuShortcut({ className, ref, ...props }: DropdownMenuShortcutProps): React.JSX.Element;
60
- declare function DropdownMenuCheckboxItem({ checked, children, className, defaultChecked, disabled, onCheckedChange, onClick, onKeyDown, onSelect, ref, ...props }: DropdownMenuCheckboxItemProps): React.JSX.Element;
66
+ declare function DropdownMenuCheckboxItem({ asChild, checked, children, className, defaultChecked, disabled, onCheckedChange, onClick, onKeyDown, onSelect, ref, ...props }: DropdownMenuCheckboxItemProps): React.JSX.Element;
61
67
  declare function DropdownMenuRadioGroup({ children, className, onValueChange, ref, value, ...props }: DropdownMenuRadioGroupProps): React.JSX.Element;
62
- declare function DropdownMenuRadioItem({ children, className, disabled, onClick, onKeyDown, onSelect, ref, value, ...props }: DropdownMenuRadioItemProps): React.JSX.Element;
68
+ declare function DropdownMenuRadioItem({ asChild, children, className, disabled, onClick, onKeyDown, onSelect, ref, value, ...props }: DropdownMenuRadioItemProps): React.JSX.Element;
63
69
  declare function DropdownMenuSub({ children, className, ref, ...props }: DropdownMenuSubProps): React.JSX.Element;
64
70
  type DropdownMenuComponent = typeof DropdownMenuRoot & {
65
71
  CheckboxItem: typeof DropdownMenuCheckboxItem;