@zvk/ui 0.1.5 → 0.1.7
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 +48 -0
- package/README.md +5 -5
- package/dist/components/accordion/accordion.js +4 -4
- package/dist/components/alert/alert.d.ts +5 -0
- package/dist/components/alert/alert.js +8 -4
- package/dist/components/alert/index.d.ts +1 -1
- package/dist/components/alert-dialog/alert-dialog.js +9 -9
- package/dist/components/avatar/avatar.js +1 -1
- package/dist/components/badge/badge.js +1 -1
- package/dist/components/breadcrumbs/breadcrumbs.js +3 -3
- package/dist/components/button/button.js +46 -2
- package/dist/components/calendar/calendar.js +3 -3
- package/dist/components/card/card.d.ts +5 -0
- package/dist/components/card/card.js +11 -7
- package/dist/components/card/index.d.ts +1 -1
- package/dist/components/carousel/carousel.js +7 -7
- package/dist/components/checkbox/checkbox.js +4 -4
- package/dist/components/code-block/code-block.js +2 -2
- package/dist/components/collapsible/collapsible.js +4 -4
- package/dist/components/combobox/combobox.js +6 -5
- package/dist/components/command/command-filter.d.ts +0 -1
- package/dist/components/command/command-filter.js +0 -3
- package/dist/components/command/command.js +9 -9
- package/dist/components/context-menu/context-menu.d.ts +3 -1
- package/dist/components/context-menu/context-menu.js +66 -12
- package/dist/components/context-menu/index.d.ts +1 -1
- package/dist/components/conversation/conversation.js +11 -11
- package/dist/components/copy-button/copy-button.js +2 -2
- package/dist/components/date-picker/date-picker.js +1 -1
- package/dist/components/dialog/dialog.js +11 -11
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +1 -1
- package/dist/components/dropdown-menu/dropdown-menu.js +20 -16
- package/dist/components/empty-state/empty-state.js +1 -1
- package/dist/components/error-boundary/error-boundary.js +1 -1
- package/dist/components/field/field.js +4 -4
- package/dist/components/file-upload-input/file-upload-input.js +2 -2
- package/dist/components/form/form.js +6 -6
- package/dist/components/hover-card/hover-card.d.ts +1 -1
- package/dist/components/hover-card/hover-card.js +7 -4
- package/dist/components/icon-button/icon-button.js +19 -1
- package/dist/components/index.d.ts +5 -5
- package/dist/components/input/input.js +1 -1
- package/dist/components/label/label.js +1 -1
- package/dist/components/menubar/index.d.ts +1 -1
- package/dist/components/menubar/menubar.d.ts +1 -1
- package/dist/components/menubar/menubar.js +42 -14
- package/dist/components/pagination/pagination.js +12 -12
- package/dist/components/popover/popover.d.ts +1 -1
- package/dist/components/popover/popover.js +30 -7
- package/dist/components/progress/progress.js +3 -3
- package/dist/components/radio-group/radio-group.js +3 -3
- package/dist/components/responsive-container/responsive-container.js +1 -1
- package/dist/components/scroll-area/scroll-area.js +4 -4
- package/dist/components/sectioned-sidebar-nav/sectioned-sidebar-nav.js +7 -7
- package/dist/components/select/select.js +66 -13
- package/dist/components/separator/separator.js +1 -1
- package/dist/components/sheet/sheet.js +12 -12
- package/dist/components/sidebar-shell/sidebar-shell.js +6 -6
- package/dist/components/skeleton/skeleton.js +1 -1
- package/dist/components/slider/slider.js +1 -1
- package/dist/components/spinner/spinner.js +1 -1
- package/dist/components/stat/stat.js +1 -1
- package/dist/components/switch/switch.js +3 -3
- package/dist/components/table/index.d.ts +1 -1
- package/dist/components/table/table.d.ts +5 -0
- package/dist/components/table/table.js +12 -8
- package/dist/components/tabs/tabs.js +4 -4
- package/dist/components/tabs-with-sidebar/tabs-with-sidebar.js +3 -3
- package/dist/components/textarea/textarea.js +1 -1
- package/dist/components/toast/toast.js +8 -8
- package/dist/components/toggle/toggle.js +1 -1
- package/dist/components/toggle-group/toggle-group.js +1 -1
- package/dist/components/tooltip/tooltip.d.ts +1 -1
- package/dist/components/tooltip/tooltip.js +6 -3
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/use-composed-refs.d.ts +2 -2
- package/dist/hooks/use-controllable-state.d.ts +2 -2
- package/dist/internal/floating/auto-update.js +21 -9
- package/dist/internal/floating/compute-position.js +13 -8
- package/dist/internal/floating/floating-types.d.ts +1 -0
- package/dist/internal/floating/index.d.ts +1 -0
- package/dist/internal/floating/use-floating-position.js +6 -4
- package/dist/internal/overlay-stack/overlay-stack.js +4 -1
- package/dist/styles.css +2065 -2022
- package/dist/tokens/index.d.ts +2 -2
- package/dist/tokens/index.js +1 -1
- package/dist/tokens/token-types.d.ts +5 -5
- package/dist/tokens/tokens.d.ts +16 -10
- package/dist/tokens/tokens.js +16 -10
- package/dist/utils/cn.d.ts +2 -2
- package/dist/utils/index.d.ts +1 -1
- package/package.json +14 -11
|
@@ -15,8 +15,8 @@ function joinIds(...ids) {
|
|
|
15
15
|
const value = ids.filter(Boolean).join(" ");
|
|
16
16
|
return value.length > 0 ? value : undefined;
|
|
17
17
|
}
|
|
18
|
-
function optionId(baseId,
|
|
19
|
-
return `${baseId}-option-${
|
|
18
|
+
function optionId(baseId, index) {
|
|
19
|
+
return `${baseId}-option-${index}`;
|
|
20
20
|
}
|
|
21
21
|
function composeRefs(...refs) {
|
|
22
22
|
return (node) => {
|
|
@@ -75,6 +75,7 @@ export function Combobox({ "aria-describedby": ariaDescribedBy, className, clear
|
|
|
75
75
|
const filteredOptions = options.filter((option) => commandItemMatches(option, query));
|
|
76
76
|
const activeOption = filteredOptions.find((option) => option.value === activeValue && option.disabled !== true) ??
|
|
77
77
|
firstEnabled(filteredOptions);
|
|
78
|
+
const activeOptionIndex = activeOption === undefined ? -1 : filteredOptions.findIndex((option) => option.value === activeOption.value);
|
|
78
79
|
React.useEffect(() => {
|
|
79
80
|
if (!open) {
|
|
80
81
|
setQuery(selectedOption?.label ?? "");
|
|
@@ -106,7 +107,7 @@ export function Combobox({ "aria-describedby": ariaDescribedBy, className, clear
|
|
|
106
107
|
const next = nextEnabled(filteredOptions, activeOption?.value, direction);
|
|
107
108
|
setActiveValue(next?.value);
|
|
108
109
|
}, [activeOption?.value, filteredOptions]);
|
|
109
|
-
const input = (_jsx("input", { ...props, ref: composeRefs(ref, inputRef, floating.referenceRef), id: inputId, role: "combobox", "aria-activedescendant": open &&
|
|
110
|
+
const input = (_jsx("input", { ...props, ref: composeRefs(ref, inputRef, floating.referenceRef), id: inputId, role: "combobox", "aria-activedescendant": open && activeOptionIndex >= 0 ? optionId(inputId, activeOptionIndex) : undefined, "aria-autocomplete": "list", "aria-controls": listboxId, "aria-describedby": describedBy, "aria-expanded": open ? "true" : "false", "aria-invalid": invalid ? "true" : undefined, className: cn("zvk-ui-combobox__input", className), "data-invalid": invalid ? "true" : undefined, "data-size": size, disabled: disabled, onBlur: onBlur, onChange: (event) => {
|
|
110
111
|
if (!open) {
|
|
111
112
|
setOpen(true);
|
|
112
113
|
}
|
|
@@ -144,9 +145,9 @@ export function Combobox({ "aria-describedby": ariaDescribedBy, className, clear
|
|
|
144
145
|
setOpen(false);
|
|
145
146
|
}
|
|
146
147
|
}), placeholder: placeholder, required: required, value: open ? query : selectedOption?.label ?? query }));
|
|
147
|
-
return (_jsxs("div", { className: "
|
|
148
|
+
return (_jsxs("div", { className: "zvk-ui-combobox", "data-disabled": disabled ? "true" : undefined, "data-invalid": invalid ? "true" : undefined, children: [hasLabel ? _jsx("label", { className: "zvk-ui-combobox__label", htmlFor: inputId, children: label }) : null, _jsxs("div", { className: "zvk-ui-combobox__control", children: [input, clearable && selectedValue !== null ? (_jsx("button", { type: "button", className: "zvk-ui-combobox__clear", "aria-label": "Clear selection", disabled: disabled, onMouseDown: (event) => event.preventDefault(), onClick: clearSelection, children: "Clear" })) : null] }), hasDescription ? _jsx("div", { className: "zvk-ui-combobox__description", id: descriptionId, children: description }) : null, hasError ? _jsx("div", { className: "zvk-ui-combobox__error", id: errorId, children: error }) : null, open ? (_jsx(Portal, { ...(container === undefined ? {} : { container }), children: _jsx(DismissableLayer, { open: open, onDismiss: () => setOpen(false), children: _jsx("div", { id: listboxId, role: "listbox", className: "zvk-ui-combobox__popup", ref: floating.floatingRef, style: floating.floatingStyle, children: filteredOptions.map((option, index) => {
|
|
148
149
|
const isActive = activeOption?.value === option.value;
|
|
149
150
|
const isSelected = selectedValue === option.value;
|
|
150
|
-
return (_jsx("div", { id: optionId(inputId,
|
|
151
|
+
return (_jsx("div", { id: optionId(inputId, index), role: "option", "aria-disabled": option.disabled ? "true" : undefined, "aria-selected": isSelected ? "true" : "false", className: "zvk-ui-combobox__option", "data-disabled": option.disabled ? "true" : undefined, "data-highlighted": isActive ? "true" : undefined, "data-selected": isSelected ? "true" : undefined, onMouseDown: (event) => event.preventDefault(), onClick: () => selectOption(option), children: option.label }, option.value));
|
|
151
152
|
}) }) }) })) : null] }));
|
|
152
153
|
}
|
|
@@ -4,4 +4,3 @@ export interface CommandFilterItem {
|
|
|
4
4
|
keywords?: readonly string[] | undefined;
|
|
5
5
|
}
|
|
6
6
|
export declare function commandItemMatches(item: CommandFilterItem, query: string): boolean;
|
|
7
|
-
export declare function filterCommandItems<Item extends CommandFilterItem>(items: readonly Item[], query: string): Item[];
|
|
@@ -9,6 +9,3 @@ export function commandItemMatches(item, query) {
|
|
|
9
9
|
const haystacks = [item.value, item.label, ...(item.keywords ?? [])];
|
|
10
10
|
return haystacks.some((value) => normalized(value).includes(needle));
|
|
11
11
|
}
|
|
12
|
-
export function filterCommandItems(items, query) {
|
|
13
|
-
return items.filter((item) => commandItemMatches(item, query));
|
|
14
|
-
}
|
|
@@ -105,12 +105,12 @@ function CommandRoot({ children, className, defaultValue = "", onItemSelect, onV
|
|
|
105
105
|
setQuery,
|
|
106
106
|
shouldFilter,
|
|
107
107
|
unregisterItem
|
|
108
|
-
}, children: _jsx("div", { ...props, ref: ref, className: cn("
|
|
108
|
+
}, children: _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-command", className), "cmdk-root": "", children: children }) }));
|
|
109
109
|
}
|
|
110
110
|
function CommandInput({ className, onKeyDown, onValueChange, placeholder, ref, value, ...props }) {
|
|
111
111
|
const { activeId, inputId, listId, moveActive, query, selectActive, setQuery } = useCommandContext("Command.Input");
|
|
112
112
|
const inputValue = value ?? query;
|
|
113
|
-
return (_jsx("input", { ...props, ref: ref, id: props.id ?? inputId, role: "searchbox", "aria-activedescendant": activeId, "aria-controls": listId, "aria-autocomplete": "list", className: cn("
|
|
113
|
+
return (_jsx("input", { ...props, ref: ref, id: props.id ?? inputId, role: "searchbox", "aria-activedescendant": activeId, "aria-controls": listId, "aria-autocomplete": "list", className: cn("zvk-ui-command__input", className), "cmdk-input": "", onChange: (event) => {
|
|
114
114
|
const nextValue = event.currentTarget.value;
|
|
115
115
|
onValueChange?.(nextValue);
|
|
116
116
|
setQuery(nextValue);
|
|
@@ -143,18 +143,18 @@ function CommandInput({ className, onKeyDown, onValueChange, placeholder, ref, v
|
|
|
143
143
|
}
|
|
144
144
|
function CommandList({ className, ref, ...props }) {
|
|
145
145
|
const { listId } = useCommandContext("Command.List");
|
|
146
|
-
return (_jsx("div", { ...props, ref: ref, id: props.id ?? listId, role: "listbox", className: cn("
|
|
146
|
+
return (_jsx("div", { ...props, ref: ref, id: props.id ?? listId, role: "listbox", className: cn("zvk-ui-command__list", className), "cmdk-list": "" }));
|
|
147
147
|
}
|
|
148
148
|
function CommandEmpty({ className, ref, ...props }) {
|
|
149
149
|
const { empty } = useCommandContext("Command.Empty");
|
|
150
150
|
if (!empty) {
|
|
151
151
|
return null;
|
|
152
152
|
}
|
|
153
|
-
return _jsx("div", { ...props, ref: ref, className: cn("
|
|
153
|
+
return _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-command__empty", className), "cmdk-empty": "" });
|
|
154
154
|
}
|
|
155
155
|
function CommandGroup({ children, className, heading, ref, ...props }) {
|
|
156
156
|
const headingId = React.useId();
|
|
157
|
-
return (_jsxs("div", { ...props, ref: ref, role: "group", "aria-labelledby": heading ? headingId : undefined, className: cn("
|
|
157
|
+
return (_jsxs("div", { ...props, ref: ref, role: "group", "aria-labelledby": heading ? headingId : undefined, className: cn("zvk-ui-command__group", className), "cmdk-group": "", children: [heading ? _jsx("div", { id: headingId, className: "zvk-ui-command__group-heading", "cmdk-group-heading": "", children: heading }) : null, children] }));
|
|
158
158
|
}
|
|
159
159
|
function CommandItem({ children, className, disabled, keywords, onClick, onSelect, ref, value, ...props }) {
|
|
160
160
|
const context = useCommandContext("Command.Item");
|
|
@@ -179,17 +179,17 @@ function CommandItem({ children, className, disabled, keywords, onClick, onSelec
|
|
|
179
179
|
if (!visible) {
|
|
180
180
|
return null;
|
|
181
181
|
}
|
|
182
|
-
return (_jsx("div", { ...props, ref: ref, id: id, role: "option", "aria-disabled": disabled ? "true" : undefined, "aria-selected": isActive ? "true" : "false", className: cn("
|
|
182
|
+
return (_jsx("div", { ...props, ref: ref, id: id, role: "option", "aria-disabled": disabled ? "true" : undefined, "aria-selected": isActive ? "true" : "false", className: cn("zvk-ui-command__item", className), "cmdk-item": "", "data-disabled": disabled ? "true" : undefined, "data-highlighted": isActive ? "true" : undefined, onClick: composeEventHandlers(onClick, () => {
|
|
183
183
|
if (!disabled) {
|
|
184
184
|
selectItem(id);
|
|
185
185
|
}
|
|
186
186
|
}), children: children }));
|
|
187
187
|
}
|
|
188
188
|
function CommandSeparator({ className, ref, ...props }) {
|
|
189
|
-
return (_jsx("div", { ...props, ref: ref, role: "separator", "aria-hidden": "true", className: cn("
|
|
189
|
+
return (_jsx("div", { ...props, ref: ref, role: "separator", "aria-hidden": "true", className: cn("zvk-ui-command__separator", className), "cmdk-separator": "" }));
|
|
190
190
|
}
|
|
191
191
|
function CommandShortcut({ className, ref, ...props }) {
|
|
192
|
-
return _jsx("span", { ...props, ref: ref, className: cn("
|
|
192
|
+
return _jsx("span", { ...props, ref: ref, className: cn("zvk-ui-command__shortcut", className) });
|
|
193
193
|
}
|
|
194
194
|
export function CommandDialog({ children, className, closeOnSelect = false, commandLabel = "Command menu", onOpenChange, ...props }) {
|
|
195
195
|
const handleItemSelect = React.useCallback(() => {
|
|
@@ -197,7 +197,7 @@ export function CommandDialog({ children, className, closeOnSelect = false, comm
|
|
|
197
197
|
onOpenChange?.(false);
|
|
198
198
|
}
|
|
199
199
|
}, [closeOnSelect, onOpenChange]);
|
|
200
|
-
return (_jsx(Dialog, { ...props, ...(onOpenChange ? { onOpenChange } : {}), children: _jsxs(Dialog.Content, { className: cn("
|
|
200
|
+
return (_jsx(Dialog, { ...props, ...(onOpenChange ? { onOpenChange } : {}), children: _jsxs(Dialog.Content, { className: cn("zvk-ui-command-dialog", className), children: [_jsx(Dialog.Title, { className: "zvk-ui-command-dialog__title", children: commandLabel }), _jsx(Command, { onItemSelect: handleItemSelect, children: children })] }) }));
|
|
201
201
|
}
|
|
202
202
|
export const Command = Object.assign(CommandRoot, {
|
|
203
203
|
Dialog: CommandDialog,
|
|
@@ -14,6 +14,8 @@ export interface ContextMenuContentProps extends React.HTMLAttributes<HTMLDivEle
|
|
|
14
14
|
side?: FloatingSide;
|
|
15
15
|
align?: FloatingAlign;
|
|
16
16
|
alignOffset?: number;
|
|
17
|
+
sideOffset?: number;
|
|
18
|
+
collisionPadding?: number;
|
|
17
19
|
ref?: React.Ref<HTMLDivElement>;
|
|
18
20
|
}
|
|
19
21
|
export interface ContextMenuItemProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
@@ -38,7 +40,7 @@ export interface ContextMenuRadioItemProps extends ContextMenuItemProps {
|
|
|
38
40
|
}
|
|
39
41
|
declare function ContextMenuRoot({ children, className, defaultOpen, onOpenChange, open: openProp, ref, ...props }: ContextMenuProps): React.JSX.Element;
|
|
40
42
|
declare function ContextMenuTrigger({ asChild, children, className, onContextMenu, onKeyDown, ref, ...props }: ContextMenuTriggerProps): React.JSX.Element;
|
|
41
|
-
declare function ContextMenuContent({ align, alignOffset
|
|
43
|
+
declare function ContextMenuContent({ align, alignOffset, children, className, collisionPadding, onKeyDown, ref, side, sideOffset, style, ...props }: ContextMenuContentProps): React.JSX.Element | null;
|
|
42
44
|
declare function ContextMenuItem({ asChild, children, className, disabled, onClick, onKeyDown, onSelect, ref, tone, type, ...props }: ContextMenuItemProps): React.JSX.Element;
|
|
43
45
|
declare function ContextMenuLabel({ className, ref, ...props }: ContextMenuLabelProps): React.JSX.Element;
|
|
44
46
|
declare function ContextMenuCheckboxItem({ asChild, checked, children, className, defaultChecked, disabled, onCheckedChange, onClick, onKeyDown, onSelect, ref, tone, type, ...props }: ContextMenuCheckboxItemProps): React.JSX.Element;
|
|
@@ -6,6 +6,7 @@ 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 { clamp, computeFloatingPosition } from "../../internal/floating/index.js";
|
|
9
10
|
import { placementFromSideAlign, placementParts } from "../../internal/floating/placement-aliases.js";
|
|
10
11
|
import { Portal } from "../../internal/portal/index.js";
|
|
11
12
|
import { Slot } from "../../internal/slot/index.js";
|
|
@@ -70,7 +71,7 @@ function ContextMenuRoot({ children, className, defaultOpen = false, onOpenChang
|
|
|
70
71
|
registerItem,
|
|
71
72
|
unregisterItem
|
|
72
73
|
}), [close, contentId, getItems, open, openAt, point, registerItem, unregisterItem]);
|
|
73
|
-
return (_jsx(ContextMenuContext.Provider, { value: contextValue, children: _jsx("div", { ...props, ref: ref, className: cn("
|
|
74
|
+
return (_jsx(ContextMenuContext.Provider, { value: contextValue, children: _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-context-menu", className), "data-state": open ? "open" : "closed", children: children }) }));
|
|
74
75
|
}
|
|
75
76
|
function ContextMenuTrigger({ asChild = false, children, className, onContextMenu, onKeyDown, ref, ...props }) {
|
|
76
77
|
const { contentId, open, openAt } = useContextMenuContext("ContextMenu.Trigger");
|
|
@@ -82,7 +83,7 @@ function ContextMenuTrigger({ asChild = false, children, className, onContextMen
|
|
|
82
83
|
ref: ref,
|
|
83
84
|
"aria-controls": contentId,
|
|
84
85
|
"aria-expanded": open,
|
|
85
|
-
className: cn("
|
|
86
|
+
className: cn("zvk-ui-context-menu__trigger", className),
|
|
86
87
|
"data-state": open ? "open" : "closed",
|
|
87
88
|
onContextMenu: composeEventHandlers(onContextMenu, (event) => {
|
|
88
89
|
event.preventDefault();
|
|
@@ -114,20 +115,73 @@ function currentIndex(items) {
|
|
|
114
115
|
const enabled = items.filter((item) => item.data.disabled !== true && item.data.ref !== null);
|
|
115
116
|
return enabled.findIndex((item) => item.data.ref === document.activeElement);
|
|
116
117
|
}
|
|
117
|
-
function ContextMenuContent({ align, alignOffset
|
|
118
|
+
function ContextMenuContent({ align, alignOffset = 0, children, className, collisionPadding = 4, onKeyDown, ref, side, sideOffset = 0, style, ...props }) {
|
|
118
119
|
const { close, contentId, getItems, open, point } = useContextMenuContext("ContextMenu.Content");
|
|
119
120
|
const contentPlacement = placementFromSideAlign(side, align, "bottom-start");
|
|
120
|
-
const
|
|
121
|
+
const [contentStyle, setContentStyle] = React.useState({});
|
|
122
|
+
const [resolvedPlacement, setResolvedPlacement] = React.useState(contentPlacement);
|
|
123
|
+
const contentRef = React.useRef(null);
|
|
124
|
+
const updatePosition = React.useCallback(() => {
|
|
125
|
+
const node = contentRef.current;
|
|
126
|
+
if (node === null || typeof window === "undefined") {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
const rect = node.getBoundingClientRect();
|
|
130
|
+
const computed = computeFloatingPosition({
|
|
131
|
+
reference: { x: point.x, y: point.y, width: 0, height: 0 },
|
|
132
|
+
floating: { x: 0, y: 0, width: rect.width, height: rect.height },
|
|
133
|
+
boundary: { x: 0, y: 0, width: window.innerWidth, height: window.innerHeight },
|
|
134
|
+
placement: contentPlacement,
|
|
135
|
+
strategy: "fixed",
|
|
136
|
+
offset: sideOffset,
|
|
137
|
+
alignmentOffset: alignOffset,
|
|
138
|
+
collisionPadding,
|
|
139
|
+
flip: true,
|
|
140
|
+
shift: true
|
|
141
|
+
});
|
|
142
|
+
const minX = collisionPadding;
|
|
143
|
+
const minY = collisionPadding;
|
|
144
|
+
const maxX = Math.max(minX, window.innerWidth - collisionPadding - rect.width);
|
|
145
|
+
const maxY = Math.max(minY, window.innerHeight - collisionPadding - rect.height);
|
|
146
|
+
setContentStyle({
|
|
147
|
+
position: computed.strategy,
|
|
148
|
+
left: `${clamp(computed.x, minX, maxX)}px`,
|
|
149
|
+
top: `${clamp(computed.y, minY, maxY)}px`
|
|
150
|
+
});
|
|
151
|
+
setResolvedPlacement(computed.placement);
|
|
152
|
+
}, [alignOffset, collisionPadding, contentPlacement, point.x, point.y, sideOffset]);
|
|
153
|
+
const schedulePositionUpdate = React.useCallback(() => {
|
|
154
|
+
if (typeof queueMicrotask === "function") {
|
|
155
|
+
queueMicrotask(updatePosition);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
window.setTimeout(updatePosition, 0);
|
|
159
|
+
}, [updatePosition]);
|
|
121
160
|
React.useLayoutEffect(() => {
|
|
122
161
|
if (!open) {
|
|
123
162
|
return;
|
|
124
163
|
}
|
|
125
164
|
queueMicrotask(() => focusItem(getItems(), 0));
|
|
126
165
|
}, [getItems, open]);
|
|
166
|
+
React.useLayoutEffect(() => {
|
|
167
|
+
if (!open) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
updatePosition();
|
|
171
|
+
window.addEventListener("resize", updatePosition);
|
|
172
|
+
return () => {
|
|
173
|
+
window.removeEventListener("resize", updatePosition);
|
|
174
|
+
};
|
|
175
|
+
}, [open, updatePosition]);
|
|
127
176
|
if (!open) {
|
|
128
177
|
return null;
|
|
129
178
|
}
|
|
130
|
-
return (_jsx(Portal, { children: _jsx(DismissableLayer, { open: open, onDismiss: close, children: _jsx("div", { ...props, ref:
|
|
179
|
+
return (_jsx(Portal, { children: _jsx(DismissableLayer, { open: open, onDismiss: close, children: _jsx("div", { ...props, ref: (node) => {
|
|
180
|
+
setComposedRef(contentRef, ref, node);
|
|
181
|
+
if (node !== null) {
|
|
182
|
+
schedulePositionUpdate();
|
|
183
|
+
}
|
|
184
|
+
}, id: contentId, role: "menu", className: cn("zvk-ui-context-menu__content", className), "data-align": placementParts(resolvedPlacement).align, "data-side": placementParts(resolvedPlacement).side, style: { ...style, ...contentStyle }, onKeyDown: composeEventHandlers(onKeyDown, (event) => {
|
|
131
185
|
const items = getItems();
|
|
132
186
|
const index = currentIndex(items);
|
|
133
187
|
if (event.key === "ArrowDown") {
|
|
@@ -169,7 +223,7 @@ function ContextMenuItem({ asChild = false, children, className, disabled, onCli
|
|
|
169
223
|
},
|
|
170
224
|
role: "menuitem",
|
|
171
225
|
"aria-disabled": disabled ? true : undefined,
|
|
172
|
-
className: cn("
|
|
226
|
+
className: cn("zvk-ui-context-menu__item", className),
|
|
173
227
|
"data-disabled": disabled ? "true" : undefined,
|
|
174
228
|
"data-tone": tone,
|
|
175
229
|
onClick: composeEventHandlers(onClick, select),
|
|
@@ -188,7 +242,7 @@ function ContextMenuItem({ asChild = false, children, className, disabled, onCli
|
|
|
188
242
|
}, 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 }));
|
|
189
243
|
}
|
|
190
244
|
function ContextMenuLabel({ className, ref, ...props }) {
|
|
191
|
-
return _jsx("div", { ...props, ref: ref, className: cn("
|
|
245
|
+
return _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-context-menu__label", className) });
|
|
192
246
|
}
|
|
193
247
|
function ContextMenuCheckboxItem({ asChild = false, checked, children, className, defaultChecked = false, disabled, onCheckedChange, onClick, onKeyDown, onSelect, ref, tone = "default", type = "button", ...props }) {
|
|
194
248
|
const { close, registerItem, unregisterItem } = useContextMenuContext("ContextMenu.CheckboxItem");
|
|
@@ -221,7 +275,7 @@ function ContextMenuCheckboxItem({ asChild = false, checked, children, className
|
|
|
221
275
|
role: "menuitemcheckbox",
|
|
222
276
|
"aria-checked": currentChecked,
|
|
223
277
|
"aria-disabled": disabled ? true : undefined,
|
|
224
|
-
className: cn("
|
|
278
|
+
className: cn("zvk-ui-context-menu__item", "zvk-ui-context-menu__checkbox-item", className),
|
|
225
279
|
"data-checked": currentChecked ? "true" : undefined,
|
|
226
280
|
"data-disabled": disabled ? "true" : undefined,
|
|
227
281
|
"data-tone": tone,
|
|
@@ -238,7 +292,7 @@ function ContextMenuCheckboxItem({ asChild = false, checked, children, className
|
|
|
238
292
|
}
|
|
239
293
|
return (_jsxs("button", { ...props, ref: (node) => {
|
|
240
294
|
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: "
|
|
295
|
+
}, 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: "zvk-ui-context-menu__item-indicator", "aria-hidden": "true", children: currentChecked ? "✓" : "" }), _jsx("span", { className: "zvk-ui-context-menu__item-label", children: children })] }));
|
|
242
296
|
}
|
|
243
297
|
function ContextMenuRadioItem({ asChild = false, checked = false, children, className, disabled, onClick, onKeyDown, onSelect, ref, tone = "default", type = "button", ...props }) {
|
|
244
298
|
const { close, registerItem, unregisterItem } = useContextMenuContext("ContextMenu.RadioItem");
|
|
@@ -265,7 +319,7 @@ function ContextMenuRadioItem({ asChild = false, checked = false, children, clas
|
|
|
265
319
|
role: "menuitemradio",
|
|
266
320
|
"aria-checked": checked,
|
|
267
321
|
"aria-disabled": disabled ? true : undefined,
|
|
268
|
-
className: cn("
|
|
322
|
+
className: cn("zvk-ui-context-menu__item", "zvk-ui-context-menu__radio-item", className),
|
|
269
323
|
"data-checked": checked ? "true" : undefined,
|
|
270
324
|
"data-disabled": disabled ? "true" : undefined,
|
|
271
325
|
"data-tone": tone,
|
|
@@ -282,10 +336,10 @@ function ContextMenuRadioItem({ asChild = false, checked = false, children, clas
|
|
|
282
336
|
}
|
|
283
337
|
return (_jsxs("button", { ...props, ref: (node) => {
|
|
284
338
|
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: "
|
|
339
|
+
}, 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: "zvk-ui-context-menu__item-indicator", "aria-hidden": "true", children: checked ? "●" : "" }), _jsx("span", { className: "zvk-ui-context-menu__item-label", children: children })] }));
|
|
286
340
|
}
|
|
287
341
|
function ContextMenuSeparator({ className, ref, ...props }) {
|
|
288
|
-
return _jsx("div", { ...props, ref: ref, role: "separator", "aria-hidden": "true", className: cn("
|
|
342
|
+
return _jsx("div", { ...props, ref: ref, role: "separator", "aria-hidden": "true", className: cn("zvk-ui-context-menu__separator", className) });
|
|
289
343
|
}
|
|
290
344
|
export const ContextMenu = Object.assign(ContextMenuRoot, {
|
|
291
345
|
CheckboxItem: ContextMenuCheckboxItem,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { ContextMenu } from "./context-menu.js";
|
|
2
|
-
export type { ContextMenuCheckboxItemProps, ContextMenuContentProps, ContextMenuItemProps, ContextMenuLabelProps, ContextMenuProps, ContextMenuSeparatorProps, ContextMenuTriggerProps } from "./context-menu.js";
|
|
2
|
+
export type { ContextMenuCheckboxItemProps, ContextMenuContentProps, ContextMenuItemProps, ContextMenuLabelProps, ContextMenuProps, ContextMenuRadioItemProps, ContextMenuSeparatorProps, ContextMenuTriggerProps } from "./context-menu.js";
|
|
@@ -2,38 +2,38 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { cn } from "../../utils/cn.js";
|
|
4
4
|
function ConversationRoot({ className, ref, ...props }) {
|
|
5
|
-
return _jsx("div", { ...props, ref: ref, className: cn("
|
|
5
|
+
return _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-conversation", className) });
|
|
6
6
|
}
|
|
7
7
|
function ConversationList({ className, ref, ...props }) {
|
|
8
|
-
return (_jsx("div", { ...props, ref: ref, "aria-label": props["aria-label"] ?? "Conversation", className: cn("
|
|
8
|
+
return (_jsx("div", { ...props, ref: ref, "aria-label": props["aria-label"] ?? "Conversation", className: cn("zvk-ui-conversation__list", className), role: "log" }));
|
|
9
9
|
}
|
|
10
10
|
function ConversationMessage({ className, ref, role, ...props }) {
|
|
11
|
-
return (_jsx("div", { ...props, ref: ref, className: cn("
|
|
11
|
+
return (_jsx("div", { ...props, ref: ref, className: cn("zvk-ui-conversation__message", className), "data-role": role }));
|
|
12
12
|
}
|
|
13
13
|
function ConversationMessageAvatar({ className, ref, ...props }) {
|
|
14
|
-
return _jsx("div", { ...props, ref: ref, className: cn("
|
|
14
|
+
return _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-conversation__message-avatar", className) });
|
|
15
15
|
}
|
|
16
16
|
function ConversationMessageContent({ className, ref, ...props }) {
|
|
17
|
-
return _jsx("div", { ...props, ref: ref, className: cn("
|
|
17
|
+
return _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-conversation__message-content", className) });
|
|
18
18
|
}
|
|
19
19
|
function ConversationResponse({ className, ref, ...props }) {
|
|
20
|
-
return _jsx("div", { ...props, ref: ref, className: cn("
|
|
20
|
+
return _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-conversation__response", className) });
|
|
21
21
|
}
|
|
22
22
|
function ConversationReasoning({ children, className, ref, title = "Reasoning", ...props }) {
|
|
23
|
-
return (_jsxs("details", { ...props, ref: ref, className: cn("
|
|
23
|
+
return (_jsxs("details", { ...props, ref: ref, className: cn("zvk-ui-conversation__reasoning", className), children: [_jsx("summary", { className: "zvk-ui-conversation__reasoning-summary", children: title }), _jsx("div", { className: "zvk-ui-conversation__reasoning-content", children: children })] }));
|
|
24
24
|
}
|
|
25
25
|
function ConversationTool({ children, className, ref, status = "pending", title, ...props }) {
|
|
26
|
-
return (_jsxs("div", { ...props, ref: ref, className: cn("
|
|
26
|
+
return (_jsxs("div", { ...props, ref: ref, className: cn("zvk-ui-conversation__tool", className), "data-status": status, children: [title ? _jsx("div", { className: "zvk-ui-conversation__tool-title", children: title }) : null, children ? _jsx("div", { className: "zvk-ui-conversation__tool-content", children: children }) : null] }));
|
|
27
27
|
}
|
|
28
28
|
function ConversationPromptInput({ className, ref, ...props }) {
|
|
29
|
-
return _jsx("form", { ...props, ref: ref, className: cn("
|
|
29
|
+
return _jsx("form", { ...props, ref: ref, className: cn("zvk-ui-conversation__prompt-input", className) });
|
|
30
30
|
}
|
|
31
31
|
function ConversationPromptInputTextarea({ className, ref, rows = 3, ...props }) {
|
|
32
|
-
return (_jsx("textarea", { ...props, ref: ref, className: cn("
|
|
32
|
+
return (_jsx("textarea", { ...props, ref: ref, className: cn("zvk-ui-conversation__prompt-textarea", className), rows: rows }));
|
|
33
33
|
}
|
|
34
34
|
function ConversationPromptInputSubmit({ className, disabled, loading = false, ref, type = "submit", ...props }) {
|
|
35
35
|
const isDisabled = disabled || loading;
|
|
36
|
-
return (_jsx("button", { ...props, ref: ref, "aria-busy": loading ? true : undefined, className: cn("
|
|
36
|
+
return (_jsx("button", { ...props, ref: ref, "aria-busy": loading ? true : undefined, className: cn("zvk-ui-conversation__prompt-submit", className), "data-disabled": isDisabled ? "true" : undefined, "data-loading": loading ? "true" : undefined, disabled: isDisabled, type: type }));
|
|
37
37
|
}
|
|
38
38
|
export const Conversation = Object.assign(ConversationRoot, {
|
|
39
39
|
List: ConversationList,
|
|
@@ -43,8 +43,8 @@ export function CopyButton({ className, copiedLabel = "Copied", disabled, errorL
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
const label = status === "copied" ? copiedLabel : status === "error" ? errorLabel : idleLabel;
|
|
46
|
-
return (_jsx("button", { ...props, ref: ref, className: cn("
|
|
46
|
+
return (_jsx("button", { ...props, ref: ref, className: cn("zvk-ui-copy-button", className), "data-size": size, "data-status": status, disabled: disabled, onClick: handleClick, type: type, children: label }));
|
|
47
47
|
}
|
|
48
48
|
export function CopyableText({ className, copyLabel, label, ref, truncate, value, ...props }) {
|
|
49
|
-
return (_jsxs("div", { ...props, ref: ref, className: cn("
|
|
49
|
+
return (_jsxs("div", { ...props, ref: ref, className: cn("zvk-ui-copyable-text", className), children: [label ? _jsx("span", { className: "zvk-ui-copyable-text__label", children: label }) : null, _jsx("code", { className: "zvk-ui-copyable-text__value", "data-truncate": truncate ? "true" : undefined, children: value }), _jsx(CopyButton, { idleLabel: copyLabel ?? "Copy", value: value })] }));
|
|
50
50
|
}
|
|
@@ -46,5 +46,5 @@ export function DatePicker({ defaultValue = null, description, disabledDate, err
|
|
|
46
46
|
onValueChange?.(date);
|
|
47
47
|
setOpen(false);
|
|
48
48
|
};
|
|
49
|
-
return (_jsxs(Field, { className: "
|
|
49
|
+
return (_jsxs(Field, { className: "zvk-ui-date-picker", invalid: hasError, ...fieldRefProps, children: [hasLabel ? _jsx(Field.Label, { htmlFor: triggerId, children: label }) : null, _jsxs(Popover, { open: open, onOpenChange: setOpen, placement: "bottom-start", children: [_jsx(Popover.Trigger, { "aria-describedby": describedBy, "aria-invalid": hasError ? true : undefined, "aria-label": hasLabel ? undefined : "Selected date", className: cn("zvk-ui-date-picker__trigger", !currentValue && "zvk-ui-date-picker__trigger--placeholder"), id: triggerId, children: _jsx("span", { className: "zvk-ui-date-picker__value", children: currentValue ? formatDate(currentValue) : placeholder }) }), _jsx(Popover.Content, { className: "zvk-ui-date-picker__content", matchTriggerWidth: false, sideOffset: 4, children: _jsx(Calendar, { ...calendarProps, selected: currentValue, onSelect: handleSelect }) })] }), hasRenderableNode(description) ? _jsx(Field.Description, { id: descriptionId, children: description }) : null, hasError ? _jsx(Field.Error, { id: errorId, children: error }) : null] }));
|
|
50
50
|
}
|
|
@@ -77,7 +77,7 @@ function DialogRoot({ children, className, container, defaultOpen = false, disab
|
|
|
77
77
|
triggerRef,
|
|
78
78
|
disableOutsidePointerDown,
|
|
79
79
|
disableEscapeKeyDown
|
|
80
|
-
}, children: _jsx("div", { ...props, ref: ref, className: cn("
|
|
80
|
+
}, children: _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-dialog", className), "data-state": open ? "open" : "closed", children: children }) }));
|
|
81
81
|
}
|
|
82
82
|
function DialogPortal({ container, children }) {
|
|
83
83
|
if (container === undefined) {
|
|
@@ -86,36 +86,36 @@ function DialogPortal({ container, children }) {
|
|
|
86
86
|
return _jsx(Portal, { container: container, children: children });
|
|
87
87
|
}
|
|
88
88
|
function DialogOverlay({ className, ref, ...props }) {
|
|
89
|
-
return _jsx("div", { ...props, ref: ref, className: cn("
|
|
89
|
+
return _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-dialog__overlay", className) });
|
|
90
90
|
}
|
|
91
91
|
function DialogContent({ className, children, forceMount = false, ref, ...props }) {
|
|
92
92
|
const { close, container, contentId, describedBy, disableEscapeKeyDown, disableOutsidePointerDown, labelledBy, open } = useDialogContext("Dialog.Content");
|
|
93
93
|
if (!open && !forceMount) {
|
|
94
94
|
return null;
|
|
95
95
|
}
|
|
96
|
-
const content = (_jsx("div", { ...props, ref: ref, id: contentId, role: "dialog", "aria-modal": true, "aria-labelledby": labelledBy, "aria-describedby": describedBy, className: cn("
|
|
96
|
+
const content = (_jsx("div", { ...props, ref: ref, id: contentId, role: "dialog", "aria-modal": true, "aria-labelledby": labelledBy, "aria-describedby": describedBy, className: cn("zvk-ui-dialog__content", className), "data-state": open ? "open" : "closed", hidden: open ? undefined : true, children: children }));
|
|
97
97
|
if (!open) {
|
|
98
98
|
return (_jsxs(DialogPortal, { container: container, children: [_jsx(DialogOverlay, { "aria-hidden": true, hidden: true }), content] }));
|
|
99
99
|
}
|
|
100
100
|
return (_jsxs(DialogPortal, { container: container, children: [_jsx(DialogOverlay, { "aria-hidden": true }), _jsx(DismissableLayer, { open: open, disableEscapeKeyDown: disableEscapeKeyDown, disableOutsidePointerDown: disableOutsidePointerDown, onDismiss: close, children: _jsx(FocusScope, { trapped: true, active: open, children: content }) })] }));
|
|
101
101
|
}
|
|
102
102
|
function DialogHeader({ className, ref, ...props }) {
|
|
103
|
-
return _jsx("div", { ...props, ref: ref, className: cn("
|
|
103
|
+
return _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-dialog__header", className) });
|
|
104
104
|
}
|
|
105
105
|
function DialogTitle({ className, ref, ...props }) {
|
|
106
106
|
const { registerTitle, titleId } = useDialogContext("Dialog.Title");
|
|
107
107
|
const resolvedId = props.id ?? titleId;
|
|
108
108
|
React.useLayoutEffect(() => registerTitle(resolvedId), [registerTitle, resolvedId]);
|
|
109
|
-
return _jsx("h2", { ...props, ref: ref, id: resolvedId, className: cn("
|
|
109
|
+
return _jsx("h2", { ...props, ref: ref, id: resolvedId, className: cn("zvk-ui-dialog__title", className) });
|
|
110
110
|
}
|
|
111
111
|
function DialogDescription({ className, ref, ...props }) {
|
|
112
112
|
const { descriptionId, registerDescription } = useDialogContext("Dialog.Description");
|
|
113
113
|
const resolvedId = props.id ?? descriptionId;
|
|
114
114
|
React.useLayoutEffect(() => registerDescription(resolvedId), [registerDescription, resolvedId]);
|
|
115
|
-
return (_jsx("p", { ...props, ref: ref, id: resolvedId, className: cn("
|
|
115
|
+
return (_jsx("p", { ...props, ref: ref, id: resolvedId, className: cn("zvk-ui-dialog__description", className) }));
|
|
116
116
|
}
|
|
117
117
|
function DialogFooter({ className, ref, ...props }) {
|
|
118
|
-
return _jsx("div", { ...props, ref: ref, className: cn("
|
|
118
|
+
return _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-dialog__footer", className) });
|
|
119
119
|
}
|
|
120
120
|
function DialogTrigger({ asChild = false, className, disabled, onClick, ref, type = "button", ...props }) {
|
|
121
121
|
const { open, setOpen, contentId, triggerRef } = useDialogContext("Dialog.Trigger");
|
|
@@ -126,9 +126,9 @@ function DialogTrigger({ asChild = false, className, disabled, onClick, ref, typ
|
|
|
126
126
|
setOpen(true);
|
|
127
127
|
};
|
|
128
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("
|
|
129
|
+
return (_jsx(Slot, { ...props, ref: composeRefs(ref, triggerRef), "aria-controls": contentId, "aria-disabled": disabled ? true : undefined, "aria-expanded": open ? "true" : "false", className: cn("zvk-ui-dialog__trigger", className), "data-disabled": disabled ? "true" : undefined, "data-state": open ? "open" : "closed", onClick: composeEventHandlers(onClick, handleClick), children: props.children }));
|
|
130
130
|
}
|
|
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("
|
|
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("zvk-ui-dialog__trigger", className), onClick: composeEventHandlers(onClick, handleClick) }));
|
|
132
132
|
}
|
|
133
133
|
function DialogClose({ asChild = false, className, disabled, onClick, ref, type = "button", ...props }) {
|
|
134
134
|
const { close } = useDialogContext("Dialog.Close");
|
|
@@ -138,9 +138,9 @@ function DialogClose({ asChild = false, className, disabled, onClick, ref, type
|
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
140
|
if (asChild) {
|
|
141
|
-
return (_jsx(Slot, { ...props, ref: ref, "aria-disabled": disabled ? true : undefined, className: cn("
|
|
141
|
+
return (_jsx(Slot, { ...props, ref: ref, "aria-disabled": disabled ? true : undefined, className: cn("zvk-ui-dialog__close", className), "data-disabled": disabled ? "true" : undefined, onClick: composeEventHandlers(onClick, handleClick), children: props.children }));
|
|
142
142
|
}
|
|
143
|
-
return (_jsx("button", { ...props, ref: ref, type: type, disabled: disabled, className: cn("
|
|
143
|
+
return (_jsx("button", { ...props, ref: ref, type: type, disabled: disabled, className: cn("zvk-ui-dialog__close", className), onClick: composeEventHandlers(onClick, handleClick) }));
|
|
144
144
|
}
|
|
145
145
|
export const Dialog = Object.assign(DialogRoot, {
|
|
146
146
|
Close: DialogClose,
|
|
@@ -58,7 +58,7 @@ export interface DropdownMenuSubProps extends React.HTMLAttributes<HTMLDivElemen
|
|
|
58
58
|
}
|
|
59
59
|
declare function DropdownMenuRoot({ children, className, container, defaultOpen, onOpenChange, open: openProp, placement, sideOffset, collisionPadding, matchTriggerWidth, ...props }: DropdownMenuProps): React.JSX.Element;
|
|
60
60
|
declare function DropdownMenuTrigger({ asChild, className, disabled, onClick, ref, type, ...props }: DropdownMenuTriggerProps): React.JSX.Element;
|
|
61
|
-
declare function DropdownMenuContent({ align, alignOffset
|
|
61
|
+
declare function DropdownMenuContent({ align, alignOffset, children, className, forceMount, side, sideOffset, collisionPadding, matchTriggerWidth, ref, onKeyDown, ...props }: DropdownMenuContentProps): React.JSX.Element | null;
|
|
62
62
|
declare function DropdownMenuItem({ asChild, children, className, disabled, onClick, onSelect, onKeyDown, ref, ...props }: DropdownMenuItemProps): React.JSX.Element;
|
|
63
63
|
declare function DropdownMenuSeparator({ className, ref, ...props }: DropdownMenuSeparatorProps): React.JSX.Element;
|
|
64
64
|
declare function DropdownMenuLabel({ className, ref, ...props }: DropdownMenuLabelProps): React.JSX.Element;
|