@zvk/ui 0.1.5 → 0.1.6
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 +41 -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.js +10 -10
- 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 +3 -3
- package/dist/components/input/input.js +1 -1
- package/dist/components/label/label.js +1 -1
- package/dist/components/menubar/menubar.js +12 -12
- 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/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 +2066 -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 +12 -11
|
@@ -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,
|
|
@@ -70,7 +70,7 @@ function ContextMenuRoot({ children, className, defaultOpen = false, onOpenChang
|
|
|
70
70
|
registerItem,
|
|
71
71
|
unregisterItem
|
|
72
72
|
}), [close, contentId, getItems, open, openAt, point, registerItem, unregisterItem]);
|
|
73
|
-
return (_jsx(ContextMenuContext.Provider, { value: contextValue, children: _jsx("div", { ...props, ref: ref, className: cn("
|
|
73
|
+
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
74
|
}
|
|
75
75
|
function ContextMenuTrigger({ asChild = false, children, className, onContextMenu, onKeyDown, ref, ...props }) {
|
|
76
76
|
const { contentId, open, openAt } = useContextMenuContext("ContextMenu.Trigger");
|
|
@@ -82,7 +82,7 @@ function ContextMenuTrigger({ asChild = false, children, className, onContextMen
|
|
|
82
82
|
ref: ref,
|
|
83
83
|
"aria-controls": contentId,
|
|
84
84
|
"aria-expanded": open,
|
|
85
|
-
className: cn("
|
|
85
|
+
className: cn("zvk-ui-context-menu__trigger", className),
|
|
86
86
|
"data-state": open ? "open" : "closed",
|
|
87
87
|
onContextMenu: composeEventHandlers(onContextMenu, (event) => {
|
|
88
88
|
event.preventDefault();
|
|
@@ -127,7 +127,7 @@ function ContextMenuContent({ align, alignOffset: _alignOffset, children, classN
|
|
|
127
127
|
if (!open) {
|
|
128
128
|
return null;
|
|
129
129
|
}
|
|
130
|
-
return (_jsx(Portal, { children: _jsx(DismissableLayer, { open: open, onDismiss: close, children: _jsx("div", { ...props, ref: ref, id: contentId, role: "menu", className: cn("
|
|
130
|
+
return (_jsx(Portal, { children: _jsx(DismissableLayer, { open: open, onDismiss: close, children: _jsx("div", { ...props, ref: ref, id: contentId, role: "menu", className: cn("zvk-ui-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) => {
|
|
131
131
|
const items = getItems();
|
|
132
132
|
const index = currentIndex(items);
|
|
133
133
|
if (event.key === "ArrowDown") {
|
|
@@ -169,7 +169,7 @@ function ContextMenuItem({ asChild = false, children, className, disabled, onCli
|
|
|
169
169
|
},
|
|
170
170
|
role: "menuitem",
|
|
171
171
|
"aria-disabled": disabled ? true : undefined,
|
|
172
|
-
className: cn("
|
|
172
|
+
className: cn("zvk-ui-context-menu__item", className),
|
|
173
173
|
"data-disabled": disabled ? "true" : undefined,
|
|
174
174
|
"data-tone": tone,
|
|
175
175
|
onClick: composeEventHandlers(onClick, select),
|
|
@@ -188,7 +188,7 @@ function ContextMenuItem({ asChild = false, children, className, disabled, onCli
|
|
|
188
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 }));
|
|
189
189
|
}
|
|
190
190
|
function ContextMenuLabel({ className, ref, ...props }) {
|
|
191
|
-
return _jsx("div", { ...props, ref: ref, className: cn("
|
|
191
|
+
return _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-context-menu__label", className) });
|
|
192
192
|
}
|
|
193
193
|
function ContextMenuCheckboxItem({ asChild = false, checked, children, className, defaultChecked = false, disabled, onCheckedChange, onClick, onKeyDown, onSelect, ref, tone = "default", type = "button", ...props }) {
|
|
194
194
|
const { close, registerItem, unregisterItem } = useContextMenuContext("ContextMenu.CheckboxItem");
|
|
@@ -221,7 +221,7 @@ function ContextMenuCheckboxItem({ asChild = false, checked, children, className
|
|
|
221
221
|
role: "menuitemcheckbox",
|
|
222
222
|
"aria-checked": currentChecked,
|
|
223
223
|
"aria-disabled": disabled ? true : undefined,
|
|
224
|
-
className: cn("
|
|
224
|
+
className: cn("zvk-ui-context-menu__item", "zvk-ui-context-menu__checkbox-item", className),
|
|
225
225
|
"data-checked": currentChecked ? "true" : undefined,
|
|
226
226
|
"data-disabled": disabled ? "true" : undefined,
|
|
227
227
|
"data-tone": tone,
|
|
@@ -238,7 +238,7 @@ function ContextMenuCheckboxItem({ asChild = false, checked, children, className
|
|
|
238
238
|
}
|
|
239
239
|
return (_jsxs("button", { ...props, ref: (node) => {
|
|
240
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: "
|
|
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: "zvk-ui-context-menu__item-indicator", "aria-hidden": "true", children: currentChecked ? "✓" : "" }), _jsx("span", { className: "zvk-ui-context-menu__item-label", children: children })] }));
|
|
242
242
|
}
|
|
243
243
|
function ContextMenuRadioItem({ asChild = false, checked = false, children, className, disabled, onClick, onKeyDown, onSelect, ref, tone = "default", type = "button", ...props }) {
|
|
244
244
|
const { close, registerItem, unregisterItem } = useContextMenuContext("ContextMenu.RadioItem");
|
|
@@ -265,7 +265,7 @@ function ContextMenuRadioItem({ asChild = false, checked = false, children, clas
|
|
|
265
265
|
role: "menuitemradio",
|
|
266
266
|
"aria-checked": checked,
|
|
267
267
|
"aria-disabled": disabled ? true : undefined,
|
|
268
|
-
className: cn("
|
|
268
|
+
className: cn("zvk-ui-context-menu__item", "zvk-ui-context-menu__radio-item", className),
|
|
269
269
|
"data-checked": checked ? "true" : undefined,
|
|
270
270
|
"data-disabled": disabled ? "true" : undefined,
|
|
271
271
|
"data-tone": tone,
|
|
@@ -282,10 +282,10 @@ function ContextMenuRadioItem({ asChild = false, checked = false, children, clas
|
|
|
282
282
|
}
|
|
283
283
|
return (_jsxs("button", { ...props, ref: (node) => {
|
|
284
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: "
|
|
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: "zvk-ui-context-menu__item-indicator", "aria-hidden": "true", children: checked ? "●" : "" }), _jsx("span", { className: "zvk-ui-context-menu__item-label", children: children })] }));
|
|
286
286
|
}
|
|
287
287
|
function ContextMenuSeparator({ className, ref, ...props }) {
|
|
288
|
-
return _jsx("div", { ...props, ref: ref, role: "separator", "aria-hidden": "true", className: cn("
|
|
288
|
+
return _jsx("div", { ...props, ref: ref, role: "separator", "aria-hidden": "true", className: cn("zvk-ui-context-menu__separator", className) });
|
|
289
289
|
}
|
|
290
290
|
export const ContextMenu = Object.assign(ContextMenuRoot, {
|
|
291
291
|
CheckboxItem: ContextMenuCheckboxItem,
|
|
@@ -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;
|
|
@@ -11,6 +11,7 @@ import { placementFromSideAlign, placementParts } from "../../internal/floating/
|
|
|
11
11
|
import { Slot } from "../../internal/slot/index.js";
|
|
12
12
|
const defaultContentPositioning = {
|
|
13
13
|
sideOffset: 8,
|
|
14
|
+
alignOffset: 0,
|
|
14
15
|
collisionPadding: 0,
|
|
15
16
|
matchTriggerWidth: false
|
|
16
17
|
};
|
|
@@ -65,6 +66,7 @@ function DropdownMenuRoot({ children, className, container, defaultOpen = false,
|
|
|
65
66
|
const wasOpenRef = React.useRef(false);
|
|
66
67
|
const [contentPositioning, setContentPositioning] = React.useState({
|
|
67
68
|
sideOffset,
|
|
69
|
+
alignOffset: defaultContentPositioning.alignOffset,
|
|
68
70
|
collisionPadding,
|
|
69
71
|
matchTriggerWidth
|
|
70
72
|
});
|
|
@@ -73,6 +75,7 @@ function DropdownMenuRoot({ children, className, container, defaultOpen = false,
|
|
|
73
75
|
placement: contentPositioning.placement ?? placement,
|
|
74
76
|
strategy: "absolute",
|
|
75
77
|
offset: contentPositioning.sideOffset,
|
|
78
|
+
alignmentOffset: contentPositioning.alignOffset,
|
|
76
79
|
collisionPadding: contentPositioning.collisionPadding,
|
|
77
80
|
matchReferenceWidth: contentPositioning.matchTriggerWidth
|
|
78
81
|
});
|
|
@@ -136,7 +139,7 @@ function DropdownMenuRoot({ children, className, container, defaultOpen = false,
|
|
|
136
139
|
registerItem,
|
|
137
140
|
unregisterItem,
|
|
138
141
|
...(container === undefined ? {} : { container })
|
|
139
|
-
}, children: _jsx("div", { ...props, className: cn("
|
|
142
|
+
}, children: _jsx("div", { ...props, className: cn("zvk-ui-dropdown-menu", className), "data-state": open ? "open" : "closed", children: children }) }));
|
|
140
143
|
}
|
|
141
144
|
function DropdownMenuTrigger({ asChild = false, className, disabled, onClick, ref, type = "button", ...props }) {
|
|
142
145
|
const { contentId, open, setOpen, triggerRef, triggerId, referenceRef, getEnabledItems } = useDropdownMenuContext("DropdownMenu.Trigger");
|
|
@@ -155,11 +158,11 @@ function DropdownMenuTrigger({ asChild = false, className, disabled, onClick, re
|
|
|
155
158
|
});
|
|
156
159
|
};
|
|
157
160
|
if (asChild) {
|
|
158
|
-
return (_jsx(Slot, { ...props, ref: composeRefs(ref, triggerRef, referenceRef), id: triggerId, "aria-controls": contentId, "aria-disabled": disabled ? true : undefined, "aria-expanded": open ? "true" : "false", "aria-haspopup": "menu", className: cn("
|
|
161
|
+
return (_jsx(Slot, { ...props, ref: composeRefs(ref, triggerRef, referenceRef), id: triggerId, "aria-controls": contentId, "aria-disabled": disabled ? true : undefined, "aria-expanded": open ? "true" : "false", "aria-haspopup": "menu", className: cn("zvk-ui-dropdown-menu__trigger", className), "data-disabled": disabled ? "true" : undefined, "data-state": open ? "open" : "closed", onClick: composeEventHandlers(onClick, handleClick), children: props.children }));
|
|
159
162
|
}
|
|
160
|
-
return (_jsx("button", { ...props, ref: composeRefs(ref, triggerRef, referenceRef), type: type, disabled: disabled, id: triggerId, role: "button", "aria-haspopup": "menu", "aria-expanded": open ? "true" : "false", "aria-controls": contentId, className: cn("
|
|
163
|
+
return (_jsx("button", { ...props, ref: composeRefs(ref, triggerRef, referenceRef), type: type, disabled: disabled, id: triggerId, role: "button", "aria-haspopup": "menu", "aria-expanded": open ? "true" : "false", "aria-controls": contentId, className: cn("zvk-ui-dropdown-menu__trigger", className), "data-state": open ? "open" : "closed", onClick: composeEventHandlers(onClick, handleClick) }));
|
|
161
164
|
}
|
|
162
|
-
function DropdownMenuContent({ align, alignOffset
|
|
165
|
+
function DropdownMenuContent({ align, alignOffset = defaultContentPositioning.alignOffset, children, className, forceMount = false, side, sideOffset = defaultContentPositioning.sideOffset, collisionPadding = defaultContentPositioning.collisionPadding, matchTriggerWidth = defaultContentPositioning.matchTriggerWidth, ref, onKeyDown, ...props }) {
|
|
163
166
|
const { container, contentId, open, setOpen, updateContentPositioning, triggerId, floatingRef, floatingPlacement, floatingStyle, getEnabledItems } = useDropdownMenuContext("DropdownMenu.Content");
|
|
164
167
|
const focusItem = React.useCallback((index, items) => {
|
|
165
168
|
if (items.length === 0) {
|
|
@@ -202,13 +205,14 @@ function DropdownMenuContent({ align, alignOffset: _alignOffset, children, class
|
|
|
202
205
|
updateContentPositioning({
|
|
203
206
|
...(side === undefined ? {} : { placement: placementFromSideAlign(side, align, "bottom") }),
|
|
204
207
|
sideOffset,
|
|
208
|
+
alignOffset,
|
|
205
209
|
collisionPadding,
|
|
206
210
|
matchTriggerWidth
|
|
207
211
|
});
|
|
208
212
|
return () => {
|
|
209
213
|
updateContentPositioning(defaultContentPositioning);
|
|
210
214
|
};
|
|
211
|
-
}, [align, collisionPadding, matchTriggerWidth, side, sideOffset, updateContentPositioning]);
|
|
215
|
+
}, [align, alignOffset, collisionPadding, matchTriggerWidth, side, sideOffset, updateContentPositioning]);
|
|
212
216
|
if (!open && !forceMount) {
|
|
213
217
|
return null;
|
|
214
218
|
}
|
|
@@ -220,7 +224,7 @@ function DropdownMenuContent({ align, alignOffset: _alignOffset, children, class
|
|
|
220
224
|
else if (ref) {
|
|
221
225
|
ref.current = node;
|
|
222
226
|
}
|
|
223
|
-
}, id: contentId, role: "menu", "aria-labelledby": triggerId, className: cn("
|
|
227
|
+
}, id: contentId, role: "menu", "aria-labelledby": triggerId, className: cn("zvk-ui-dropdown-menu__content", className), style: floatingStyle, "data-align": placementParts(floatingPlacement).align, "data-side": placementParts(floatingPlacement).side, "data-state": open ? "open" : "closed", hidden: open ? undefined : true, onKeyDown: composeEventHandlers(onKeyDown, (event) => {
|
|
224
228
|
if (event.key === "ArrowDown") {
|
|
225
229
|
event.preventDefault();
|
|
226
230
|
moveFocus("next");
|
|
@@ -287,7 +291,7 @@ function DropdownMenuItem({ asChild = false, children, className, disabled, onCl
|
|
|
287
291
|
},
|
|
288
292
|
role: "menuitem",
|
|
289
293
|
"aria-disabled": isDisabled ? true : undefined,
|
|
290
|
-
className: cn("
|
|
294
|
+
className: cn("zvk-ui-dropdown-menu__item", className),
|
|
291
295
|
"data-disabled": isDisabled ? "true" : undefined,
|
|
292
296
|
"data-state": isDisabled ? "disabled" : "enabled",
|
|
293
297
|
onClick: composeEventHandlers(onClick, select),
|
|
@@ -306,13 +310,13 @@ function DropdownMenuItem({ asChild = false, children, className, disabled, onCl
|
|
|
306
310
|
}, type: "button", role: "menuitem", disabled: isDisabled, "aria-disabled": itemProps["aria-disabled"], className: itemProps.className, "data-disabled": itemProps["data-disabled"], "data-state": itemProps["data-state"], onClick: itemProps.onClick, onKeyDown: itemProps.onKeyDown, children: children }));
|
|
307
311
|
}
|
|
308
312
|
function DropdownMenuSeparator({ className, ref, ...props }) {
|
|
309
|
-
return (_jsx("div", { ...props, ref: ref, role: "separator", "aria-hidden": "true", className: cn("
|
|
313
|
+
return (_jsx("div", { ...props, ref: ref, role: "separator", "aria-hidden": "true", className: cn("zvk-ui-dropdown-menu__separator", className) }));
|
|
310
314
|
}
|
|
311
315
|
function DropdownMenuLabel({ className, ref, ...props }) {
|
|
312
|
-
return (_jsx("div", { ...props, ref: ref, className: cn("
|
|
316
|
+
return (_jsx("div", { ...props, ref: ref, className: cn("zvk-ui-dropdown-menu__label", className) }));
|
|
313
317
|
}
|
|
314
318
|
function DropdownMenuShortcut({ className, ref, ...props }) {
|
|
315
|
-
return (_jsx("span", { ...props, ref: ref, className: cn("
|
|
319
|
+
return (_jsx("span", { ...props, ref: ref, className: cn("zvk-ui-dropdown-menu__shortcut", className) }));
|
|
316
320
|
}
|
|
317
321
|
function DropdownMenuCheckboxItem({ asChild = false, checked, children, className, defaultChecked = false, disabled, onCheckedChange, onClick, onKeyDown, onSelect, ref, ...props }) {
|
|
318
322
|
const context = useDropdownMenuContext("DropdownMenu.CheckboxItem");
|
|
@@ -351,7 +355,7 @@ function DropdownMenuCheckboxItem({ asChild = false, checked, children, classNam
|
|
|
351
355
|
role: "menuitemcheckbox",
|
|
352
356
|
"aria-checked": currentChecked,
|
|
353
357
|
"aria-disabled": isDisabled ? true : undefined,
|
|
354
|
-
className: cn("
|
|
358
|
+
className: cn("zvk-ui-dropdown-menu__item", "zvk-ui-dropdown-menu__checkbox-item", className),
|
|
355
359
|
"data-checked": currentChecked ? "true" : undefined,
|
|
356
360
|
"data-disabled": isDisabled ? "true" : undefined,
|
|
357
361
|
onClick: composeEventHandlers(onClick, select),
|
|
@@ -367,14 +371,14 @@ function DropdownMenuCheckboxItem({ asChild = false, checked, children, classNam
|
|
|
367
371
|
}
|
|
368
372
|
return (_jsxs("button", { ...props, ref: (node) => {
|
|
369
373
|
setComposedRef(itemRef, ref, node);
|
|
370
|
-
}, type: "button", role: "menuitemcheckbox", disabled: isDisabled, "aria-checked": itemProps["aria-checked"], "aria-disabled": itemProps["aria-disabled"], className: itemProps.className, "data-checked": itemProps["data-checked"], "data-disabled": itemProps["data-disabled"], onClick: itemProps.onClick, onKeyDown: itemProps.onKeyDown, children: [_jsx("span", { className: "
|
|
374
|
+
}, type: "button", role: "menuitemcheckbox", disabled: isDisabled, "aria-checked": itemProps["aria-checked"], "aria-disabled": itemProps["aria-disabled"], className: itemProps.className, "data-checked": itemProps["data-checked"], "data-disabled": itemProps["data-disabled"], onClick: itemProps.onClick, onKeyDown: itemProps.onKeyDown, children: [_jsx("span", { className: "zvk-ui-dropdown-menu__item-indicator", "aria-hidden": "true", children: currentChecked ? "✓" : "" }), _jsx("span", { className: "zvk-ui-dropdown-menu__item-label", children: children })] }));
|
|
371
375
|
}
|
|
372
376
|
function DropdownMenuRadioGroup({ children, className, onValueChange, ref, value, ...props }) {
|
|
373
377
|
const contextValue = React.useMemo(() => ({
|
|
374
378
|
...(value !== undefined ? { value } : {}),
|
|
375
379
|
...(onValueChange ? { onValueChange } : {})
|
|
376
380
|
}), [onValueChange, value]);
|
|
377
|
-
return (_jsx(DropdownMenuRadioGroupContext.Provider, { value: contextValue, children: _jsx("div", { ...props, ref: ref, className: cn("
|
|
381
|
+
return (_jsx(DropdownMenuRadioGroupContext.Provider, { value: contextValue, children: _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-dropdown-menu__radio-group", className), role: "group", children: children }) }));
|
|
378
382
|
}
|
|
379
383
|
function DropdownMenuRadioItem({ asChild = false, children, className, disabled, onClick, onKeyDown, onSelect, ref, value, ...props }) {
|
|
380
384
|
const context = useDropdownMenuContext("DropdownMenu.RadioItem");
|
|
@@ -410,7 +414,7 @@ function DropdownMenuRadioItem({ asChild = false, children, className, disabled,
|
|
|
410
414
|
role: "menuitemradio",
|
|
411
415
|
"aria-checked": checked,
|
|
412
416
|
"aria-disabled": isDisabled ? true : undefined,
|
|
413
|
-
className: cn("
|
|
417
|
+
className: cn("zvk-ui-dropdown-menu__item", "zvk-ui-dropdown-menu__radio-item", className),
|
|
414
418
|
"data-checked": checked ? "true" : undefined,
|
|
415
419
|
"data-disabled": isDisabled ? "true" : undefined,
|
|
416
420
|
onClick: composeEventHandlers(onClick, select),
|
|
@@ -426,10 +430,10 @@ function DropdownMenuRadioItem({ asChild = false, children, className, disabled,
|
|
|
426
430
|
}
|
|
427
431
|
return (_jsxs("button", { ...props, ref: (node) => {
|
|
428
432
|
setComposedRef(itemRef, ref, node);
|
|
429
|
-
}, type: "button", role: "menuitemradio", disabled: isDisabled, "aria-checked": itemProps["aria-checked"], "aria-disabled": itemProps["aria-disabled"], className: itemProps.className, "data-checked": itemProps["data-checked"], "data-disabled": itemProps["data-disabled"], onClick: itemProps.onClick, onKeyDown: itemProps.onKeyDown, children: [_jsx("span", { className: "
|
|
433
|
+
}, type: "button", role: "menuitemradio", disabled: isDisabled, "aria-checked": itemProps["aria-checked"], "aria-disabled": itemProps["aria-disabled"], className: itemProps.className, "data-checked": itemProps["data-checked"], "data-disabled": itemProps["data-disabled"], onClick: itemProps.onClick, onKeyDown: itemProps.onKeyDown, children: [_jsx("span", { className: "zvk-ui-dropdown-menu__item-indicator", "aria-hidden": "true", children: checked ? "●" : "" }), _jsx("span", { className: "zvk-ui-dropdown-menu__item-label", children: children })] }));
|
|
430
434
|
}
|
|
431
435
|
function DropdownMenuSub({ children, className, ref, ...props }) {
|
|
432
|
-
return (_jsx("div", { ...props, ref: ref, className: cn("
|
|
436
|
+
return (_jsx("div", { ...props, ref: ref, className: cn("zvk-ui-dropdown-menu__sub", className), children: children }));
|
|
433
437
|
}
|
|
434
438
|
export const DropdownMenu = Object.assign(DropdownMenuRoot, {
|
|
435
439
|
CheckboxItem: DropdownMenuCheckboxItem,
|
|
@@ -30,5 +30,5 @@ export function EmptyState({ actions, align = "center", children: _children, cla
|
|
|
30
30
|
const hasIcon = hasRenderableNode(icon);
|
|
31
31
|
const showDescription = description !== null && description !== undefined;
|
|
32
32
|
const showActions = actions !== null && actions !== undefined;
|
|
33
|
-
return (_jsxs("div", { ...props, ref: ref, className: cn("
|
|
33
|
+
return (_jsxs("div", { ...props, ref: ref, className: cn("zvk-ui-empty-state", className), "data-align": align, "data-size": size, children: [icon ? _jsx("div", { "aria-hidden": hasIcon ? undefined : true, className: "zvk-ui-empty-state__icon", children: icon }) : null, _jsx("h3", { className: "zvk-ui-empty-state__title", children: title }), showDescription ? _jsx("p", { className: "zvk-ui-empty-state__description", children: description }) : null, showActions ? _jsx("div", { className: "zvk-ui-empty-state__actions", children: actions }) : null] }));
|
|
34
34
|
}
|
|
@@ -39,5 +39,5 @@ export class ErrorBoundary extends React.Component {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
export function ErrorFallback({ action, className, error, ref, title = "Something went wrong", ...props }) {
|
|
42
|
-
return (_jsxs("div", { ...props, ref: ref, "aria-label": typeof title === "string" ? title : undefined, className: cn("
|
|
42
|
+
return (_jsxs("div", { ...props, ref: ref, "aria-label": typeof title === "string" ? title : undefined, className: cn("zvk-ui-error-fallback", className), role: "alert", children: [_jsx("h3", { className: "zvk-ui-error-fallback__title", children: title }), error ? _jsx("p", { className: "zvk-ui-error-fallback__message", children: error.message }) : null, action ? _jsx("div", { className: "zvk-ui-error-fallback__action", children: action }) : null] }));
|
|
43
43
|
}
|
|
@@ -2,16 +2,16 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { cn } from "../../utils/cn.js";
|
|
4
4
|
function FieldRoot({ className, disabled, invalid, ref, required, ...props }) {
|
|
5
|
-
return (_jsx("div", { ...props, ref: ref, className: cn("
|
|
5
|
+
return (_jsx("div", { ...props, ref: ref, className: cn("zvk-ui-field", className), "data-disabled": disabled ? "true" : undefined, "data-invalid": invalid ? "true" : undefined, "data-required": required ? "true" : undefined }));
|
|
6
6
|
}
|
|
7
7
|
function FieldLabel({ className, ref, ...props }) {
|
|
8
|
-
return _jsx("label", { ...props, ref: ref, className: cn("
|
|
8
|
+
return _jsx("label", { ...props, ref: ref, className: cn("zvk-ui-field__label", className) });
|
|
9
9
|
}
|
|
10
10
|
function FieldDescription({ className, ref, ...props }) {
|
|
11
|
-
return _jsx("p", { ...props, ref: ref, className: cn("
|
|
11
|
+
return _jsx("p", { ...props, ref: ref, className: cn("zvk-ui-field__description", className) });
|
|
12
12
|
}
|
|
13
13
|
function FieldError({ className, ref, role = "alert", ...props }) {
|
|
14
|
-
return _jsx("p", { ...props, ref: ref, className: cn("
|
|
14
|
+
return _jsx("p", { ...props, ref: ref, className: cn("zvk-ui-field__error", className), role: role });
|
|
15
15
|
}
|
|
16
16
|
export const Field = Object.assign(FieldRoot, {
|
|
17
17
|
Label: FieldLabel,
|
|
@@ -28,12 +28,12 @@ export function FileUploadInput({ "aria-describedby": ariaDescribedBy, buttonLab
|
|
|
28
28
|
const descriptionId = hasDescription ? `${inputId}-description` : undefined;
|
|
29
29
|
const errorId = hasError ? `${inputId}-error` : undefined;
|
|
30
30
|
const summaryId = `${inputId}-summary`;
|
|
31
|
-
const describedBy = joinIds(ariaDescribedBy, descriptionId, errorId);
|
|
31
|
+
const describedBy = joinIds(ariaDescribedBy, descriptionId, errorId, summaryId);
|
|
32
32
|
function handleChange(event) {
|
|
33
33
|
setFiles(event.currentTarget.files);
|
|
34
34
|
onChange?.(event);
|
|
35
35
|
}
|
|
36
|
-
const input = (_jsxs("div", { className: "
|
|
36
|
+
const input = (_jsxs("div", { className: "zvk-ui-file-upload-input", children: [_jsx("span", { "aria-hidden": "true", className: "zvk-ui-file-upload-input__button", children: buttonLabel }), _jsx("input", { ...props, ref: ref, "aria-describedby": describedBy, "aria-invalid": invalidState ? true : undefined, className: cn("zvk-ui-file-upload-input__control", className), "data-disabled": disabled ? "true" : undefined, "data-invalid": invalidState ? "true" : undefined, "data-required": required ? "true" : undefined, "data-size": size, disabled: disabled, id: inputId, onChange: handleChange, required: required, type: "file" }), _jsx("span", { className: "zvk-ui-file-upload-input__summary", id: summaryId, children: getFileSummary(files, emptyLabel) })] }));
|
|
37
37
|
if (!hasRenderableNode(label) && !hasDescription && !hasError) {
|
|
38
38
|
return input;
|
|
39
39
|
}
|