@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
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.1.7](https://github.com/brandon-schabel/zvk/compare/v0.1.6...v0.1.7) (2026-06-15)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* harden popup positioning ([efb8c8a](https://github.com/brandon-schabel/zvk/commit/efb8c8a98c2b759f4e84a60f5ae292b1e8900907))
|
|
9
|
+
|
|
10
|
+
## [0.1.6](https://github.com/brandon-schabel/zvk/compare/v0.1.5...v0.1.6) (2026-06-12)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* improve consumer migration support ([10b9e8a](https://github.com/brandon-schabel/zvk/commit/10b9e8ac106774eeba0be19db8522abbda02a422))
|
|
16
|
+
|
|
17
|
+
## [0.1.5](https://github.com/brandon-schabel/zvk-ui/compare/v0.1.4...v0.1.5) (2026-06-04)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* add promptliano adoption primitives ([9a33d57](https://github.com/brandon-schabel/zvk-ui/commit/9a33d57d6a70c73a28810226d72b5e9afc5be203))
|
|
23
|
+
* add promptliano migration component APIs ([43844a4](https://github.com/brandon-schabel/zvk-ui/commit/43844a4bb4dd9b5ab6b30bca83a26da268f5f7a1))
|
|
24
|
+
* harmonize overlay api edges ([be2ab74](https://github.com/brandon-schabel/zvk-ui/commit/be2ab7450c47f5e56802b15b4e350776ea7cf2f6))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
* **ci:** release please 0.1.4 ([47bc3c5](https://github.com/brandon-schabel/zvk-ui/commit/47bc3c5cb6c7acab9bed45ef7c286de6f9320364))
|
|
30
|
+
|
|
31
|
+
## [0.1.3](https://github.com/brandon-schabel/zvk-ui/compare/v0.1.2...v0.1.3) (2026-06-03)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Features
|
|
35
|
+
|
|
36
|
+
* add ZvkUi adoption primitives ([9a33d57](https://github.com/brandon-schabel/zvk-ui/commit/9a33d57d6a70c73a28810226d72b5e9afc5be203))
|
|
37
|
+
|
|
38
|
+
## [0.1.2](https://github.com/brandon-schabel/zvk-ui/compare/v0.1.1...v0.1.2) (2026-06-03)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Features
|
|
42
|
+
|
|
43
|
+
* add ZvkUi migration component APIs ([43844a4](https://github.com/brandon-schabel/zvk-ui/commit/43844a4bb4dd9b5ab6b30bca83a26da268f5f7a1))
|
|
44
|
+
* harmonize overlay api edges ([be2ab74](https://github.com/brandon-schabel/zvk-ui/commit/be2ab7450c47f5e56802b15b4e350776ea7cf2f6))
|
|
45
|
+
|
|
46
|
+
## 0.1.0
|
|
47
|
+
|
|
48
|
+
- Planned initial package scaffold and first component slice.
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @zvk/ui
|
|
2
2
|
|
|
3
3
|
@zvk/ui is an internal React 19 component library for polished application interfaces. It is styled by default, TypeScript-first, dependency-conscious, and built around explicit subpath imports.
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
`ZVK` is short for **Zero Vendor Kit**.
|
|
6
6
|
|
|
7
7
|
```tsx
|
|
@@ -16,18 +16,18 @@ import "@zvk/ui/styles.css";
|
|
|
16
16
|
- Peer dependencies are limited to `react` and `react-dom` with React 19 compatibility.
|
|
17
17
|
- Styling ships through one public stylesheet: `@zvk/ui/styles.css`.
|
|
18
18
|
- Components use plain CSS classes, CSS variables, and data attributes.
|
|
19
|
-
-
|
|
19
|
+
- Runtime package imports remain SSR-safe; browser-only behavior runs after hydration.
|
|
20
20
|
|
|
21
21
|
## Release Status
|
|
22
22
|
|
|
23
|
-
GitHub Actions runs `
|
|
23
|
+
GitHub Actions runs `bun run preflight` before release publishing. Release Please opens
|
|
24
24
|
reviewable version-bump PRs from conventional commits; merging a release PR creates the
|
|
25
25
|
GitHub release and publishes `@zvk/ui` to npm through trusted publishing in the protected
|
|
26
26
|
`npm-publish` environment.
|
|
27
27
|
|
|
28
|
-
##
|
|
28
|
+
## Component Surface
|
|
29
29
|
|
|
30
|
-
The
|
|
30
|
+
The package ships dependency-free form controls, layout and display primitives, popup foundation internals, Dialog, Sheet, AlertDialog, Popover, HoverCard, Tooltip, Select, Combobox, DropdownMenu, ContextMenu, Menubar, Calendar, DatePicker, Carousel, Toast, and Conversation primitives.
|
|
31
31
|
|
|
32
32
|
## License
|
|
33
33
|
|
|
@@ -105,7 +105,7 @@ function AccordionRoot({ children, className, collapsible = false, defaultValue,
|
|
|
105
105
|
registerTrigger,
|
|
106
106
|
unregisterTrigger,
|
|
107
107
|
getOrderedTriggers
|
|
108
|
-
}, children: _jsx("div", { ...props, ref: ref, className: cn("
|
|
108
|
+
}, children: _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-accordion", className), "data-state": type, "data-disabled": disabled ? "true" : undefined, children: children }) }));
|
|
109
109
|
}
|
|
110
110
|
function AccordionItem({ className, children, disabled = false, ref, value, ...props }) {
|
|
111
111
|
const generatedId = React.useId();
|
|
@@ -120,7 +120,7 @@ function AccordionItem({ className, children, disabled = false, ref, value, ...p
|
|
|
120
120
|
contentId,
|
|
121
121
|
defaultContentId,
|
|
122
122
|
setContentId
|
|
123
|
-
}, children: _jsx("div", { ...props, ref: ref, className: cn("
|
|
123
|
+
}, children: _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-accordion__item", className), "data-state": getValueIsOpen(rootContext.type, rootContext.value, value) ? "open" : "closed", "data-disabled": disabled || rootContext.disabled ? "true" : undefined, children: children }) }));
|
|
124
124
|
}
|
|
125
125
|
function AccordionTrigger({ className, onClick, onKeyDown, ref, type = "button", ...props }) {
|
|
126
126
|
const rootContext = useAccordionRootContext("Accordion.Trigger");
|
|
@@ -172,7 +172,7 @@ function AccordionTrigger({ className, onClick, onKeyDown, ref, type = "button",
|
|
|
172
172
|
else if (ref) {
|
|
173
173
|
ref.current = node;
|
|
174
174
|
}
|
|
175
|
-
}, id: itemContext.triggerId, "aria-controls": itemContext.contentId, "aria-expanded": isItemOpen, className: cn("
|
|
175
|
+
}, id: itemContext.triggerId, "aria-controls": itemContext.contentId, "aria-expanded": isItemOpen, className: cn("zvk-ui-accordion__trigger", className), "data-state": isItemOpen ? "open" : "closed", "data-disabled": isDisabled ? "true" : undefined, disabled: isDisabled, onClick: composeEventHandlers(onClick, () => {
|
|
176
176
|
if (!isDisabled && !rootContext.disabled) {
|
|
177
177
|
rootContext.setValue(toggleValue({
|
|
178
178
|
type: rootContext.type,
|
|
@@ -198,7 +198,7 @@ function AccordionContent({ className, forceMount = false, ref, ...props }) {
|
|
|
198
198
|
if (!forceMount && !isItemOpen) {
|
|
199
199
|
return null;
|
|
200
200
|
}
|
|
201
|
-
return (_jsx("div", { ...props, id: resolvedId, ref: ref, "aria-labelledby": itemContext.triggerId, className: cn("
|
|
201
|
+
return (_jsx("div", { ...props, id: resolvedId, ref: ref, "aria-labelledby": itemContext.triggerId, className: cn("zvk-ui-accordion__content", className), "data-state": isItemOpen ? "open" : "closed", hidden: isItemOpen ? undefined : true }));
|
|
202
202
|
}
|
|
203
203
|
export const Accordion = Object.assign(AccordionRoot, {
|
|
204
204
|
Item: AccordionItem,
|
|
@@ -13,12 +13,17 @@ export interface AlertTitleProps extends React.HTMLAttributes<HTMLHeadingElement
|
|
|
13
13
|
export interface AlertDescriptionProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
14
14
|
ref?: React.Ref<HTMLDivElement>;
|
|
15
15
|
}
|
|
16
|
+
export interface AlertActionProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
17
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
18
|
+
}
|
|
16
19
|
export type AlertRoot = (props: AlertProps) => React.ReactElement;
|
|
17
20
|
declare function AlertRoot({ children, className, icon, ref, role, title, tone, ...props }: AlertProps): React.JSX.Element;
|
|
18
21
|
declare function AlertTitle({ className, ref, ...props }: AlertTitleProps): React.JSX.Element;
|
|
19
22
|
declare function AlertDescription({ className, ref, ...props }: AlertDescriptionProps): React.JSX.Element;
|
|
23
|
+
declare function AlertAction({ className, ref, ...props }: AlertActionProps): React.JSX.Element;
|
|
20
24
|
export declare const Alert: typeof AlertRoot & {
|
|
21
25
|
Title: typeof AlertTitle;
|
|
22
26
|
Description: typeof AlertDescription;
|
|
27
|
+
Action: typeof AlertAction;
|
|
23
28
|
};
|
|
24
29
|
export {};
|
|
@@ -3,15 +3,19 @@ import * as React from "react";
|
|
|
3
3
|
import { cn } from "../../utils/cn.js";
|
|
4
4
|
function AlertRoot({ children, className, icon, ref, role, title, tone = "info", ...props }) {
|
|
5
5
|
const resolvedRole = role ?? (tone === "destructive" ? "alert" : "status");
|
|
6
|
-
return (_jsxs("div", { ...props, ref: ref, className: cn("
|
|
6
|
+
return (_jsxs("div", { ...props, ref: ref, className: cn("zvk-ui-alert", className), "data-tone": tone, role: resolvedRole, children: [icon ? (_jsx("span", { "aria-hidden": "true", className: "zvk-ui-alert__icon", children: icon })) : null, _jsxs("div", { className: "zvk-ui-alert__content", children: [title ? _jsx(AlertTitle, { children: title }) : null, children] })] }));
|
|
7
7
|
}
|
|
8
8
|
function AlertTitle({ className, ref, ...props }) {
|
|
9
|
-
return _jsx("h3", { ...props, ref: ref, className: cn("
|
|
9
|
+
return _jsx("h3", { ...props, ref: ref, className: cn("zvk-ui-alert__title", className) });
|
|
10
10
|
}
|
|
11
11
|
function AlertDescription({ className, ref, ...props }) {
|
|
12
|
-
return _jsx("div", { ...props, ref: ref, className: cn("
|
|
12
|
+
return _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-alert__description", className) });
|
|
13
|
+
}
|
|
14
|
+
function AlertAction({ className, ref, ...props }) {
|
|
15
|
+
return _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-alert__action", className) });
|
|
13
16
|
}
|
|
14
17
|
export const Alert = Object.assign(AlertRoot, {
|
|
15
18
|
Title: AlertTitle,
|
|
16
|
-
Description: AlertDescription
|
|
19
|
+
Description: AlertDescription,
|
|
20
|
+
Action: AlertAction
|
|
17
21
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Alert } from "./alert.js";
|
|
2
|
-
export type { AlertDescriptionProps, AlertProps, AlertRoot, AlertTitleProps, AlertTone } from "./alert.js";
|
|
2
|
+
export type { AlertActionProps, AlertDescriptionProps, AlertProps, AlertRoot, AlertTitleProps, AlertTone } from "./alert.js";
|
|
@@ -66,7 +66,7 @@ function AlertDialogRoot({ children, className, defaultOpen = false, onOpenChang
|
|
|
66
66
|
setOpen,
|
|
67
67
|
titleId: `${instanceId}-title`,
|
|
68
68
|
triggerRef
|
|
69
|
-
}, children: _jsx("div", { ...props, ref: ref, className: cn("
|
|
69
|
+
}, children: _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-alert-dialog", className), "data-state": open ? "open" : "closed", children: children }) }));
|
|
70
70
|
}
|
|
71
71
|
function AlertDialogTrigger({ asChild = false, className, disabled, onClick, ref, type = "button", ...props }) {
|
|
72
72
|
const { contentId, open, setOpen, triggerRef } = useAlertDialogContext("AlertDialog.Trigger");
|
|
@@ -76,31 +76,31 @@ function AlertDialogTrigger({ asChild = false, className, disabled, onClick, ref
|
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
78
|
if (asChild) {
|
|
79
|
-
return (_jsx(Slot, { ...props, ref: composeRefs(ref, triggerRef), "aria-controls": contentId, "aria-disabled": disabled ? true : undefined, "aria-expanded": open ? "true" : "false", className: cn("
|
|
79
|
+
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-alert-dialog__trigger", className), "data-disabled": disabled ? "true" : undefined, "data-state": open ? "open" : "closed", onClick: composeEventHandlers(onClick, handleClick), children: props.children }));
|
|
80
80
|
}
|
|
81
|
-
return (_jsx("button", { ...props, ref: composeRefs(ref, triggerRef), type: type, disabled: disabled, "aria-controls": contentId, "aria-expanded": open ? "true" : "false", className: cn("
|
|
81
|
+
return (_jsx("button", { ...props, ref: composeRefs(ref, triggerRef), type: type, disabled: disabled, "aria-controls": contentId, "aria-expanded": open ? "true" : "false", className: cn("zvk-ui-alert-dialog__trigger", className), "data-state": open ? "open" : "closed", onClick: composeEventHandlers(onClick, handleClick) }));
|
|
82
82
|
}
|
|
83
83
|
function AlertDialogContent({ children, className, ref, ...props }) {
|
|
84
84
|
const { close, contentId, describedBy, labelledBy, open } = useAlertDialogContext("AlertDialog.Content");
|
|
85
85
|
if (!open) {
|
|
86
86
|
return null;
|
|
87
87
|
}
|
|
88
|
-
return (_jsxs(Portal, { children: [_jsx("div", { "aria-hidden": "true", className: "
|
|
88
|
+
return (_jsxs(Portal, { children: [_jsx("div", { "aria-hidden": "true", className: "zvk-ui-alert-dialog__overlay" }), _jsx(DismissableLayer, { open: open, onDismiss: close, disableEscapeKeyDown: true, disableOutsidePointerDown: true, children: _jsx(FocusScope, { active: open, trapped: true, children: _jsx("div", { ...props, ref: ref, id: contentId, role: "alertdialog", "aria-modal": "true", "aria-describedby": describedBy, "aria-labelledby": labelledBy, className: cn("zvk-ui-alert-dialog__content", className), "data-state": open ? "open" : "closed", children: children }) }) })] }));
|
|
89
89
|
}
|
|
90
90
|
function AlertDialogTitle({ className, ref, ...props }) {
|
|
91
91
|
const { registerTitle, titleId } = useAlertDialogContext("AlertDialog.Title");
|
|
92
92
|
const id = props.id ?? titleId;
|
|
93
93
|
React.useLayoutEffect(() => registerTitle(id), [id, registerTitle]);
|
|
94
|
-
return _jsx("h2", { ...props, ref: ref, id: id, className: cn("
|
|
94
|
+
return _jsx("h2", { ...props, ref: ref, id: id, className: cn("zvk-ui-alert-dialog__title", className) });
|
|
95
95
|
}
|
|
96
96
|
function AlertDialogDescription({ className, ref, ...props }) {
|
|
97
97
|
const { descriptionId, registerDescription } = useAlertDialogContext("AlertDialog.Description");
|
|
98
98
|
const id = props.id ?? descriptionId;
|
|
99
99
|
React.useLayoutEffect(() => registerDescription(id), [id, registerDescription]);
|
|
100
|
-
return _jsx("p", { ...props, ref: ref, id: id, className: cn("
|
|
100
|
+
return _jsx("p", { ...props, ref: ref, id: id, className: cn("zvk-ui-alert-dialog__description", className) });
|
|
101
101
|
}
|
|
102
102
|
function AlertDialogFooter({ className, ref, ...props }) {
|
|
103
|
-
return _jsx("div", { ...props, ref: ref, className: cn("
|
|
103
|
+
return _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-alert-dialog__footer", className) });
|
|
104
104
|
}
|
|
105
105
|
function AlertDialogCloseButton({ asChild = false, className, disabled, onClick, ref, type = "button", ...props }) {
|
|
106
106
|
const { close } = useAlertDialogContext("AlertDialog.Action");
|
|
@@ -110,9 +110,9 @@ function AlertDialogCloseButton({ asChild = false, className, disabled, onClick,
|
|
|
110
110
|
}
|
|
111
111
|
};
|
|
112
112
|
if (asChild) {
|
|
113
|
-
return (_jsx(Slot, { ...props, ref: ref, "aria-disabled": disabled ? true : undefined, className: cn("
|
|
113
|
+
return (_jsx(Slot, { ...props, ref: ref, "aria-disabled": disabled ? true : undefined, className: cn("zvk-ui-alert-dialog__button", className), "data-disabled": disabled ? "true" : undefined, onClick: composeEventHandlers(onClick, handleClick), children: props.children }));
|
|
114
114
|
}
|
|
115
|
-
return (_jsx("button", { ...props, ref: ref, type: type, disabled: disabled, className: cn("
|
|
115
|
+
return (_jsx("button", { ...props, ref: ref, type: type, disabled: disabled, className: cn("zvk-ui-alert-dialog__button", className), onClick: composeEventHandlers(onClick, handleClick) }));
|
|
116
116
|
}
|
|
117
117
|
export const AlertDialog = Object.assign(AlertDialogRoot, {
|
|
118
118
|
Action: AlertDialogCloseButton,
|
|
@@ -18,5 +18,5 @@ export function Avatar({ alt, className, fallback, name, ref, shape = "circle",
|
|
|
18
18
|
React.useEffect(() => {
|
|
19
19
|
setImageFailed(false);
|
|
20
20
|
}, [src]);
|
|
21
|
-
return (_jsx("span", { ...props, ref: ref, className: cn("
|
|
21
|
+
return (_jsx("span", { ...props, ref: ref, className: cn("zvk-ui-avatar", className), "data-shape": shape, "data-size": size, children: showImage ? (_jsx("img", { alt: alt ?? name ?? "", className: "zvk-ui-avatar__image", onError: () => setImageFailed(true), src: src })) : (_jsx("span", { "aria-hidden": fallbackContent ? undefined : "true", className: "zvk-ui-avatar__fallback", children: fallbackContent })) }));
|
|
22
22
|
}
|
|
@@ -2,5 +2,5 @@ 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
|
export function Badge({ className, ref, size = "sm", tone = "neutral", variant = "soft", ...props }) {
|
|
5
|
-
return (_jsx("span", { ...props, ref: ref, className: cn("
|
|
5
|
+
return (_jsx("span", { ...props, ref: ref, className: cn("zvk-ui-badge", className), "data-size": size, "data-tone": tone, "data-variant": variant }));
|
|
6
6
|
}
|
|
@@ -3,7 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
import { cn } from "../../utils/cn.js";
|
|
4
4
|
function BreadcrumbsRoot({ className, children, label = "Breadcrumb", separator = "/", ref, ...props }) {
|
|
5
5
|
const items = React.Children.toArray(children).filter(React.isValidElement);
|
|
6
|
-
return (_jsx("nav", { ...props, ref: ref, "aria-label": props["aria-label"] ?? label, className: cn("
|
|
6
|
+
return (_jsx("nav", { ...props, ref: ref, "aria-label": props["aria-label"] ?? label, className: cn("zvk-ui-breadcrumbs", className), children: _jsx("ol", { className: "zvk-ui-breadcrumbs__list", children: items.map((item, index) => (_jsx(Breadcrumbs.Item, { ...item.props, hasSeparator: index < items.length - 1, separator: separator }, item.key))) }) }));
|
|
7
7
|
}
|
|
8
8
|
function BreadcrumbsItem({ children, className, current, href, hasSeparator = false, linkProps = {}, ref, separator = "/", ...props }) {
|
|
9
9
|
const renderedSeparator = React.isValidElement(separator)
|
|
@@ -12,7 +12,7 @@ function BreadcrumbsItem({ children, className, current, href, hasSeparator = fa
|
|
|
12
12
|
"aria-hidden": true
|
|
13
13
|
})
|
|
14
14
|
: React.createElement("span", null, separator);
|
|
15
|
-
const content = current || !href ? (_jsx("span", { className: "
|
|
16
|
-
return (_jsxs("li", { ...props, ref: ref, "aria-current": current ? "page" : undefined, className: cn("
|
|
15
|
+
const content = current || !href ? (_jsx("span", { className: "zvk-ui-breadcrumbs__text", children: children })) : (_jsx("a", { href: href, ...linkProps, className: cn("zvk-ui-breadcrumbs__link", linkProps.className), children: children }));
|
|
16
|
+
return (_jsxs("li", { ...props, ref: ref, "aria-current": current ? "page" : undefined, className: cn("zvk-ui-breadcrumbs__item", className), children: [content, hasSeparator ? (_jsx("span", { "aria-hidden": "true", className: "zvk-ui-breadcrumbs__separator", children: renderedSeparator })) : null] }));
|
|
17
17
|
}
|
|
18
18
|
export const Breadcrumbs = Object.assign(BreadcrumbsRoot, { Item: BreadcrumbsItem });
|
|
@@ -3,10 +3,54 @@ import * as React from "react";
|
|
|
3
3
|
import { Spinner } from "../spinner/spinner.js";
|
|
4
4
|
import { Slot } from "../../internal/slot/index.js";
|
|
5
5
|
import { cn } from "../../utils/cn.js";
|
|
6
|
+
function composeRefs(...refs) {
|
|
7
|
+
return (node) => {
|
|
8
|
+
for (const ref of refs) {
|
|
9
|
+
if (typeof ref === "function") {
|
|
10
|
+
ref(node);
|
|
11
|
+
}
|
|
12
|
+
else if (ref !== undefined && ref !== null) {
|
|
13
|
+
ref.current = node;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
6
18
|
export function Button({ asChild = false, children, className, disabled, leadingIcon, loading = false, ref, size = "md", trailingIcon, type = "button", variant = "primary", ...props }) {
|
|
7
19
|
const isDisabled = disabled || loading;
|
|
20
|
+
const suppressDisabledActivation = React.useCallback((event) => {
|
|
21
|
+
if (!isDisabled) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
event.preventDefault();
|
|
25
|
+
event.stopPropagation();
|
|
26
|
+
}, [isDisabled]);
|
|
27
|
+
if (asChild && isDisabled) {
|
|
28
|
+
if (!React.isValidElement(children)) {
|
|
29
|
+
throw new Error("Button asChild requires a single valid React element child.");
|
|
30
|
+
}
|
|
31
|
+
const child = children;
|
|
32
|
+
const childProps = child.props;
|
|
33
|
+
const disabledChildProps = {
|
|
34
|
+
...childProps,
|
|
35
|
+
...props,
|
|
36
|
+
ref: composeRefs(childProps.ref, ref),
|
|
37
|
+
"aria-busy": loading ? true : undefined,
|
|
38
|
+
"aria-disabled": true,
|
|
39
|
+
className: cn("zvk-ui-button", className, childProps.className),
|
|
40
|
+
"data-disabled": "true",
|
|
41
|
+
"data-loading": loading ? "true" : undefined,
|
|
42
|
+
"data-size": size,
|
|
43
|
+
"data-variant": variant,
|
|
44
|
+
onClick: suppressDisabledActivation,
|
|
45
|
+
onClickCapture: suppressDisabledActivation,
|
|
46
|
+
onKeyDown: suppressDisabledActivation,
|
|
47
|
+
onKeyDownCapture: suppressDisabledActivation,
|
|
48
|
+
tabIndex: -1
|
|
49
|
+
};
|
|
50
|
+
return React.cloneElement(child, disabledChildProps);
|
|
51
|
+
}
|
|
8
52
|
if (asChild) {
|
|
9
|
-
return (_jsx(Slot, { ...props, ref: ref, "aria-busy": loading ? true : undefined, "aria-disabled": isDisabled ? true : undefined, className: cn("
|
|
53
|
+
return (_jsx(Slot, { ...props, ref: ref, "aria-busy": loading ? true : undefined, "aria-disabled": isDisabled ? true : undefined, className: cn("zvk-ui-button", className), "data-disabled": isDisabled ? "true" : undefined, "data-loading": loading ? "true" : undefined, "data-size": size, "data-variant": variant, onClickCapture: suppressDisabledActivation, onKeyDownCapture: suppressDisabledActivation, tabIndex: isDisabled ? -1 : undefined, children: children }));
|
|
10
54
|
}
|
|
11
|
-
return (_jsxs("button", { ...props, ref: ref, "aria-busy": loading ? true : undefined, className: cn("
|
|
55
|
+
return (_jsxs("button", { ...props, ref: ref, "aria-busy": loading ? true : undefined, className: cn("zvk-ui-button", className), "data-disabled": isDisabled ? "true" : undefined, "data-loading": loading ? "true" : undefined, "data-size": size, "data-variant": variant, disabled: isDisabled, type: type, children: [loading ? (_jsx("span", { "aria-hidden": "true", className: "zvk-ui-button__spinner", children: _jsx(Spinner, { size: "sm" }) })) : null, leadingIcon ? (_jsx("span", { "aria-hidden": "true", className: "zvk-ui-button__icon", children: leadingIcon })) : null, _jsx("span", { className: "zvk-ui-button__content", children: children }), trailingIcon ? (_jsx("span", { "aria-hidden": "true", className: "zvk-ui-button__icon", children: trailingIcon })) : null] }));
|
|
12
56
|
}
|
|
@@ -167,7 +167,7 @@ export function Calendar({ classNames, className, defaultMonth, defaultSelected
|
|
|
167
167
|
}
|
|
168
168
|
moveFocus(addDays(focusedDate, offset));
|
|
169
169
|
};
|
|
170
|
-
return (_jsxs("div", { ...props, ref: ref, className: cn("
|
|
170
|
+
return (_jsxs("div", { ...props, ref: ref, className: cn("zvk-ui-calendar", classNames?.months, classNames?.month, className), onKeyDown: handleKeyDown, children: [_jsxs("div", { className: cn("zvk-ui-calendar__header", classNames?.caption, classNames?.nav), children: [_jsx("button", { "aria-label": "Previous month", className: cn("zvk-ui-calendar__nav", classNames?.nav_button, classNames?.nav_button_previous), type: "button", onClick: () => setVisibleMonth(addMonths(visibleMonth, -1)), children: _jsx("span", { "aria-hidden": "true", children: "\u2039" }) }), _jsx("h2", { className: cn("zvk-ui-calendar__heading", classNames?.caption_label), id: headingId, children: monthLabel }), _jsx("button", { "aria-label": "Next month", className: cn("zvk-ui-calendar__nav", classNames?.nav_button, classNames?.nav_button_next), type: "button", onClick: () => setVisibleMonth(addMonths(visibleMonth, 1)), children: _jsx("span", { "aria-hidden": "true", children: "\u203A" }) })] }), _jsxs("div", { "aria-labelledby": headingId, className: cn("zvk-ui-calendar__grid", classNames?.table), role: "grid", children: [_jsx("div", { className: cn("zvk-ui-calendar__weekdays", classNames?.head_row), role: "row", children: weekdays.map((weekday) => (_jsx("span", { className: cn("zvk-ui-calendar__weekday", classNames?.head_cell), role: "columnheader", children: weekday }, weekday))) }), Array.from({ length: 6 }, (_, rowIndex) => (_jsx("div", { className: cn("zvk-ui-calendar__week", classNames?.row), role: "row", children: days.slice(rowIndex * 7, rowIndex * 7 + 7).map((date) => {
|
|
171
171
|
const normalizedDate = startOfDay(date);
|
|
172
172
|
const dateKey = normalizedDate.getTime();
|
|
173
173
|
const outsideMonth = date.getMonth() !== visibleMonth.getMonth();
|
|
@@ -176,9 +176,9 @@ export function Calendar({ classNames, className, defaultMonth, defaultSelected
|
|
|
176
176
|
const selectedDay = isSameDay(currentSelected, date);
|
|
177
177
|
const focusedDay = isSameDay(focusedDate, date);
|
|
178
178
|
if (hideOutsideDay) {
|
|
179
|
-
return (_jsx("span", { className: cn("
|
|
179
|
+
return (_jsx("span", { className: cn("zvk-ui-calendar__cell", classNames?.cell), role: "gridcell", children: _jsx("span", { "aria-hidden": "true", className: cn("zvk-ui-calendar__day", classNames?.day, classNames?.day_outside), "data-outside-month": "true" }) }, dateKey));
|
|
180
180
|
}
|
|
181
|
-
return (_jsx("span", { className: cn("
|
|
181
|
+
return (_jsx("span", { className: cn("zvk-ui-calendar__cell", classNames?.cell), role: "gridcell", children: _jsx("button", { "aria-label": getDayLabel(date, locale), "aria-pressed": selectedDay, className: cn("zvk-ui-calendar__day", classNames?.day, selectedDay ? classNames?.day_selected : undefined, outsideMonth ? classNames?.day_outside : undefined, disabled ? classNames?.day_disabled : undefined, isSameDay(today, date) ? classNames?.day_today : undefined), "data-disabled": disabled ? "true" : undefined, "data-outside-month": outsideMonth ? "true" : undefined, "data-selected": selectedDay ? "true" : undefined, "data-today": isSameDay(today, date) ? "true" : undefined, disabled: disabled, ref: (node) => {
|
|
182
182
|
if (node) {
|
|
183
183
|
dayButtonRefs.current.set(dateKey, node);
|
|
184
184
|
}
|
|
@@ -15,17 +15,22 @@ export interface CardTitleProps extends React.HTMLAttributes<HTMLHeadingElement>
|
|
|
15
15
|
export interface CardDescriptionProps extends React.HTMLAttributes<HTMLParagraphElement> {
|
|
16
16
|
ref?: React.Ref<HTMLParagraphElement>;
|
|
17
17
|
}
|
|
18
|
+
export interface CardActionProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
19
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
20
|
+
}
|
|
18
21
|
declare function CardRoot({ className, padding, ref, variant, ...props }: CardProps): React.JSX.Element;
|
|
19
22
|
declare function CardHeader({ className, ref, ...props }: CardSlotProps): React.JSX.Element;
|
|
20
23
|
declare function CardTitle({ className, ref, ...props }: CardTitleProps): React.JSX.Element;
|
|
21
24
|
declare function CardDescription({ className, ref, ...props }: CardDescriptionProps): React.JSX.Element;
|
|
22
25
|
declare function CardContent({ className, ref, ...props }: CardSlotProps): React.JSX.Element;
|
|
23
26
|
declare function CardFooter({ className, ref, ...props }: CardSlotProps): React.JSX.Element;
|
|
27
|
+
declare function CardAction({ className, ref, ...props }: CardActionProps): React.JSX.Element;
|
|
24
28
|
export declare const Card: typeof CardRoot & {
|
|
25
29
|
Header: typeof CardHeader;
|
|
26
30
|
Title: typeof CardTitle;
|
|
27
31
|
Description: typeof CardDescription;
|
|
28
32
|
Content: typeof CardContent;
|
|
29
33
|
Footer: typeof CardFooter;
|
|
34
|
+
Action: typeof CardAction;
|
|
30
35
|
};
|
|
31
36
|
export {};
|
|
@@ -2,27 +2,31 @@ 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 CardRoot({ className, padding = "md", ref, variant = "elevated", ...props }) {
|
|
5
|
-
return _jsx("div", { ...props, ref: ref, className: cn("
|
|
5
|
+
return _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-card", className), "data-padding": padding, "data-variant": variant });
|
|
6
6
|
}
|
|
7
7
|
function CardHeader({ className, ref, ...props }) {
|
|
8
|
-
return _jsx("div", { ...props, ref: ref, className: cn("
|
|
8
|
+
return _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-card__header", className) });
|
|
9
9
|
}
|
|
10
10
|
function CardTitle({ className, ref, ...props }) {
|
|
11
|
-
return _jsx("h3", { ...props, ref: ref, className: cn("
|
|
11
|
+
return _jsx("h3", { ...props, ref: ref, className: cn("zvk-ui-card__title", className) });
|
|
12
12
|
}
|
|
13
13
|
function CardDescription({ className, ref, ...props }) {
|
|
14
|
-
return _jsx("p", { ...props, ref: ref, className: cn("
|
|
14
|
+
return _jsx("p", { ...props, ref: ref, className: cn("zvk-ui-card__description", className) });
|
|
15
15
|
}
|
|
16
16
|
function CardContent({ className, ref, ...props }) {
|
|
17
|
-
return _jsx("div", { ...props, ref: ref, className: cn("
|
|
17
|
+
return _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-card__content", className) });
|
|
18
18
|
}
|
|
19
19
|
function CardFooter({ className, ref, ...props }) {
|
|
20
|
-
return _jsx("div", { ...props, ref: ref, className: cn("
|
|
20
|
+
return _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-card__footer", className) });
|
|
21
|
+
}
|
|
22
|
+
function CardAction({ className, ref, ...props }) {
|
|
23
|
+
return _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-card__action", className) });
|
|
21
24
|
}
|
|
22
25
|
export const Card = Object.assign(CardRoot, {
|
|
23
26
|
Header: CardHeader,
|
|
24
27
|
Title: CardTitle,
|
|
25
28
|
Description: CardDescription,
|
|
26
29
|
Content: CardContent,
|
|
27
|
-
Footer: CardFooter
|
|
30
|
+
Footer: CardFooter,
|
|
31
|
+
Action: CardAction
|
|
28
32
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Card } from "./card.js";
|
|
2
|
-
export type { CardDescriptionProps, CardPadding, CardProps, CardSlotProps, CardTitleProps, CardVariant } from "./card.js";
|
|
2
|
+
export type { CardActionProps, CardDescriptionProps, CardPadding, CardProps, CardSlotProps, CardTitleProps, CardVariant } from "./card.js";
|
|
@@ -157,15 +157,15 @@ function CarouselRoot({ children, className, defaultIndex = 0, index, onApiChang
|
|
|
157
157
|
slideCount,
|
|
158
158
|
unregisterSlide
|
|
159
159
|
]);
|
|
160
|
-
return (_jsx(CarouselContext.Provider, { value: context, children: _jsx("div", { ...props, ref: ref, "aria-roledescription": "carousel", className: cn("
|
|
160
|
+
return (_jsx(CarouselContext.Provider, { value: context, children: _jsx("div", { ...props, ref: ref, "aria-roledescription": "carousel", className: cn("zvk-ui-carousel", className), "data-orientation": orientation, onKeyDown: composeEventHandlers(onKeyDown, handleKeyDown), role: props.role ?? "region", tabIndex: tabIndex ?? 0, children: children }) }));
|
|
161
161
|
}
|
|
162
162
|
function CarouselViewport({ className, ref, ...props }) {
|
|
163
163
|
const context = useCarouselContext("Carousel.Viewport");
|
|
164
|
-
return (_jsx("div", { ...props, ref: ref, className: cn("
|
|
164
|
+
return (_jsx("div", { ...props, ref: ref, className: cn("zvk-ui-carousel__viewport", className), "data-orientation": context.orientation }));
|
|
165
165
|
}
|
|
166
166
|
function CarouselTrack({ className, ref, ...props }) {
|
|
167
167
|
const context = useCarouselContext("Carousel.Track");
|
|
168
|
-
return (_jsx("div", { ...props, ref: ref, className: cn("
|
|
168
|
+
return (_jsx("div", { ...props, ref: ref, className: cn("zvk-ui-carousel__track", className), "data-orientation": context.orientation }));
|
|
169
169
|
}
|
|
170
170
|
function CarouselSlide({ className, ref, ...props }) {
|
|
171
171
|
const context = useCarouselContext("Carousel.Slide");
|
|
@@ -183,22 +183,22 @@ function CarouselSlide({ className, ref, ...props }) {
|
|
|
183
183
|
return (_jsx("div", { ...props, ref: (node) => {
|
|
184
184
|
slideRef.current = node;
|
|
185
185
|
setRef(ref, node);
|
|
186
|
-
}, "aria-label": props["aria-label"] ?? `${safeIndex + 1} of ${context.slideCount}`, "aria-roledescription": "slide", className: cn("
|
|
186
|
+
}, "aria-label": props["aria-label"] ?? `${safeIndex + 1} of ${context.slideCount}`, "aria-roledescription": "slide", className: cn("zvk-ui-carousel__slide", className), "data-orientation": context.orientation, "data-selected": isSelected ? "true" : undefined, role: props.role ?? "group" }));
|
|
187
187
|
}
|
|
188
188
|
function CarouselPrevious({ className, disabled, onClick, ref, type = "button", ...props }) {
|
|
189
189
|
const context = useCarouselContext("Carousel.Previous");
|
|
190
190
|
const isDisabled = disabled === true || !context.canScrollPrev;
|
|
191
|
-
return (_jsx("button", { ...props, ref: ref, "aria-label": props["aria-label"] ?? "Previous slide", className: cn("
|
|
191
|
+
return (_jsx("button", { ...props, ref: ref, "aria-label": props["aria-label"] ?? "Previous slide", className: cn("zvk-ui-carousel__button zvk-ui-carousel__button--previous", className), "data-disabled": isDisabled ? "true" : undefined, disabled: isDisabled, onClick: composeEventHandlers(onClick, () => context.scrollPrev()), type: type }));
|
|
192
192
|
}
|
|
193
193
|
function CarouselNext({ className, disabled, onClick, ref, type = "button", ...props }) {
|
|
194
194
|
const context = useCarouselContext("Carousel.Next");
|
|
195
195
|
const isDisabled = disabled === true || !context.canScrollNext;
|
|
196
|
-
return (_jsx("button", { ...props, ref: ref, "aria-label": props["aria-label"] ?? "Next slide", className: cn("
|
|
196
|
+
return (_jsx("button", { ...props, ref: ref, "aria-label": props["aria-label"] ?? "Next slide", className: cn("zvk-ui-carousel__button zvk-ui-carousel__button--next", className), "data-disabled": isDisabled ? "true" : undefined, disabled: isDisabled, onClick: composeEventHandlers(onClick, () => context.scrollNext()), type: type }));
|
|
197
197
|
}
|
|
198
198
|
function CarouselPage({ children, className, ref, ...props }) {
|
|
199
199
|
const context = useCarouselContext("Carousel.Page");
|
|
200
200
|
const label = context.slideCount === 0 ? "0 / 0" : `${context.selectedIndex + 1} / ${context.slideCount}`;
|
|
201
|
-
return (_jsx("output", { ...props, ref: ref, "aria-live": props["aria-live"] ?? "polite", className: cn("
|
|
201
|
+
return (_jsx("output", { ...props, ref: ref, "aria-live": props["aria-live"] ?? "polite", className: cn("zvk-ui-carousel__page", className), children: children ?? label }));
|
|
202
202
|
}
|
|
203
203
|
export const Carousel = Object.assign(CarouselRoot, {
|
|
204
204
|
Next: CarouselNext,
|
|
@@ -21,10 +21,10 @@ export function Checkbox({ "aria-describedby": ariaDescribedBy, className, descr
|
|
|
21
21
|
const descriptionId = hasDescription ? `${checkboxId}-description` : undefined;
|
|
22
22
|
const errorId = hasError ? `${checkboxId}-error` : undefined;
|
|
23
23
|
const describedBy = joinIds(ariaDescribedBy, descriptionId, errorId);
|
|
24
|
-
const input = (_jsx("input", { ...props, ref: ref, "aria-describedby": describedBy, "aria-invalid": invalidState ? true : undefined, className: "
|
|
25
|
-
const content = (_jsxs(_Fragment, { children: [input, _jsx("span", { className: "
|
|
24
|
+
const input = (_jsx("input", { ...props, ref: ref, "aria-describedby": describedBy, "aria-invalid": invalidState ? true : undefined, className: "zvk-ui-checkbox__input", "data-disabled": disabled ? "true" : undefined, "data-invalid": invalidState ? "true" : undefined, "data-required": required ? "true" : undefined, disabled: disabled, id: checkboxId, required: required, type: "checkbox" }));
|
|
25
|
+
const content = (_jsxs(_Fragment, { children: [input, _jsx("span", { className: "zvk-ui-checkbox__control", "aria-hidden": "true", children: _jsx("span", { className: "zvk-ui-checkbox__indicator" }) }), hasLabel ? _jsx("span", { className: "zvk-ui-checkbox__label", children: label }) : null] }));
|
|
26
26
|
if (!hasLabel && !hasDescription && !hasError) {
|
|
27
|
-
return (_jsx("span", { className: cn("
|
|
27
|
+
return (_jsx("span", { className: cn("zvk-ui-checkbox", className), "data-size": size, "data-disabled": disabled ? "true" : undefined, "data-invalid": invalidState ? "true" : undefined, "data-required": required ? "true" : undefined, children: content }));
|
|
28
28
|
}
|
|
29
|
-
return (_jsxs(Field, { disabled: Boolean(disabled), invalid: invalidState, required: Boolean(required), children: [_jsx("label", { className: cn("
|
|
29
|
+
return (_jsxs(Field, { disabled: Boolean(disabled), invalid: invalidState, required: Boolean(required), children: [_jsx("label", { className: cn("zvk-ui-checkbox", className), "data-size": size, "data-disabled": disabled ? "true" : undefined, "data-invalid": invalidState ? "true" : undefined, "data-required": required ? "true" : undefined, children: content }), hasDescription ? _jsx(Field.Description, { id: descriptionId, children: description }) : null, hasError ? _jsx(Field.Error, { id: errorId, children: error }) : null] }));
|
|
30
30
|
}
|
|
@@ -11,6 +11,6 @@ function toLanguageClass(value) {
|
|
|
11
11
|
export function CodeBlock({ className, code, filename, language, ref, size = "md", ...props }) {
|
|
12
12
|
const hasMetadata = (filename !== undefined && filename !== null) ||
|
|
13
13
|
(language !== undefined && language !== null && language.trim().length > 0);
|
|
14
|
-
const codeClassName = cn("
|
|
15
|
-
return (_jsxs("pre", { ...props, ref: ref, className: cn("
|
|
14
|
+
const codeClassName = cn("zvk-ui-code-block__code", toLanguageClass(language));
|
|
15
|
+
return (_jsxs("pre", { ...props, ref: ref, className: cn("zvk-ui-code-block", className), "data-size": size, children: [hasMetadata ? (_jsxs("span", { className: "zvk-ui-code-block__header", children: [filename !== undefined && filename !== null ? _jsx("span", { className: "zvk-ui-code-block__filename", children: filename }) : null, language ? _jsx("span", { className: "zvk-ui-code-block__language", children: language }) : null] })) : null, _jsx("code", { className: codeClassName, children: code })] }));
|
|
16
16
|
}
|
|
@@ -22,7 +22,7 @@ function CollapsibleRoot({ children, className, defaultOpen = false, disabled =
|
|
|
22
22
|
defaultOpen,
|
|
23
23
|
...(onOpenChange ? { onOpenChange } : {})
|
|
24
24
|
});
|
|
25
|
-
return (_jsx(CollapsibleContext.Provider, { value: { open: isOpen, setOpen, disabled, contentId, defaultContentId, setContentId }, children: _jsx("div", { ...props, ref: ref, className: cn("
|
|
25
|
+
return (_jsx(CollapsibleContext.Provider, { value: { open: isOpen, setOpen, disabled, contentId, defaultContentId, setContentId }, children: _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-collapsible", className), "data-state": isOpen ? "open" : "closed", "data-disabled": disabled ? "true" : undefined, children: children }) }));
|
|
26
26
|
}
|
|
27
27
|
function CollapsibleTrigger({ asChild = false, className, disabled, onClick, ref, type = "button", ...props }) {
|
|
28
28
|
const context = useCollapsibleContext("Collapsible.Trigger");
|
|
@@ -31,9 +31,9 @@ function CollapsibleTrigger({ asChild = false, className, disabled, onClick, ref
|
|
|
31
31
|
context.setOpen((previous) => !previous);
|
|
32
32
|
};
|
|
33
33
|
if (asChild) {
|
|
34
|
-
return (_jsx(Slot, { ...props, ref: ref, "aria-controls": context.contentId, "aria-disabled": isDisabled ? true : undefined, "aria-expanded": context.open, className: cn("
|
|
34
|
+
return (_jsx(Slot, { ...props, ref: ref, "aria-controls": context.contentId, "aria-disabled": isDisabled ? true : undefined, "aria-expanded": context.open, className: cn("zvk-ui-collapsible__trigger", className), "data-disabled": isDisabled ? "true" : undefined, "data-state": context.open ? "open" : "closed", onClick: composeEventHandlers(onClick, isDisabled ? undefined : handleClick), children: props.children }));
|
|
35
35
|
}
|
|
36
|
-
return (_jsx("button", { ...props, ref: ref, className: cn("
|
|
36
|
+
return (_jsx("button", { ...props, ref: ref, className: cn("zvk-ui-collapsible__trigger", className), "aria-controls": context.contentId, "aria-expanded": context.open, "data-state": context.open ? "open" : "closed", "data-disabled": isDisabled ? "true" : undefined, disabled: isDisabled, onClick: composeEventHandlers(onClick, isDisabled ? undefined : handleClick), type: type }));
|
|
37
37
|
}
|
|
38
38
|
function CollapsibleContent({ className, forceMount = false, ref, ...props }) {
|
|
39
39
|
const context = useCollapsibleContext("Collapsible.Content");
|
|
@@ -48,7 +48,7 @@ function CollapsibleContent({ className, forceMount = false, ref, ...props }) {
|
|
|
48
48
|
if (!forceMount && !open) {
|
|
49
49
|
return null;
|
|
50
50
|
}
|
|
51
|
-
return (_jsx("div", { ...props, id: resolvedId, ref: ref, className: cn("
|
|
51
|
+
return (_jsx("div", { ...props, id: resolvedId, ref: ref, className: cn("zvk-ui-collapsible__content", className), "data-state": open ? "open" : "closed", hidden: open ? undefined : true }));
|
|
52
52
|
}
|
|
53
53
|
export const Collapsible = Object.assign(CollapsibleRoot, {
|
|
54
54
|
Trigger: CollapsibleTrigger,
|