@zvk/ui 0.1.3 → 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.d.ts +8 -5
- package/dist/components/alert-dialog/alert-dialog.js +26 -13
- 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.d.ts +3 -2
- package/dist/components/button/button.js +50 -2
- package/dist/components/calendar/calendar.d.ts +40 -5
- package/dist/components/calendar/calendar.js +17 -5
- package/dist/components/calendar/index.d.ts +1 -1
- 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.d.ts +3 -2
- package/dist/components/collapsible/collapsible.js +8 -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.d.ts +11 -4
- package/dist/components/command/command.js +28 -17
- package/dist/components/command/index.d.ts +1 -1
- package/dist/components/context-menu/context-menu.d.ts +17 -6
- package/dist/components/context-menu/context-menu.js +142 -39
- 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.d.ts +6 -4
- package/dist/components/dialog/dialog.js +22 -12
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +13 -7
- package/dist/components/dropdown-menu/dropdown-menu.js +137 -78
- 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 +8 -2
- package/dist/components/hover-card/hover-card.js +13 -7
- package/dist/components/icon-button/icon-button.js +19 -1
- package/dist/components/index.d.ts +10 -10
- package/dist/components/index.js +1 -1
- package/dist/components/input/input.js +1 -1
- package/dist/components/label/label.js +1 -1
- package/dist/components/menubar/menubar.d.ts +24 -5
- package/dist/components/menubar/menubar.js +186 -37
- package/dist/components/pagination/pagination.js +12 -12
- package/dist/components/popover/popover.d.ts +8 -3
- package/dist/components/popover/popover.js +40 -8
- 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.d.ts +6 -4
- package/dist/components/sheet/sheet.js +29 -16
- 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/index.d.ts +2 -2
- package/dist/components/toast/index.js +1 -1
- package/dist/components/toast/toast.d.ts +16 -2
- package/dist/components/toast/toast.js +49 -7
- 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 +8 -2
- package/dist/components/tooltip/tooltip.js +12 -6
- 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/placement-aliases.d.ts +7 -0
- package/dist/internal/floating/placement-aliases.js +13 -0
- package/dist/internal/floating/use-floating-position.js +6 -4
- package/dist/internal/overlay-stack/overlay-stack.js +4 -1
- package/dist/internal/slot/index.d.ts +2 -0
- package/dist/internal/slot/index.js +1 -0
- package/dist/internal/slot/slot.d.ts +6 -0
- package/dist/internal/slot/slot.js +53 -0
- package/dist/styles.css +2079 -2015
- 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 +13 -12
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.1.6](https://github.com/brandon-schabel/zvk/compare/v0.1.5...v0.1.6) (2026-06-12)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* improve consumer migration support ([10b9e8a](https://github.com/brandon-schabel/zvk/commit/10b9e8ac106774eeba0be19db8522abbda02a422))
|
|
9
|
+
|
|
10
|
+
## [0.1.5](https://github.com/brandon-schabel/zvk-ui/compare/v0.1.4...v0.1.5) (2026-06-04)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* add promptliano adoption primitives ([9a33d57](https://github.com/brandon-schabel/zvk-ui/commit/9a33d57d6a70c73a28810226d72b5e9afc5be203))
|
|
16
|
+
* add promptliano migration component APIs ([43844a4](https://github.com/brandon-schabel/zvk-ui/commit/43844a4bb4dd9b5ab6b30bca83a26da268f5f7a1))
|
|
17
|
+
* harmonize overlay api edges ([be2ab74](https://github.com/brandon-schabel/zvk-ui/commit/be2ab7450c47f5e56802b15b4e350776ea7cf2f6))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **ci:** release please 0.1.4 ([47bc3c5](https://github.com/brandon-schabel/zvk-ui/commit/47bc3c5cb6c7acab9bed45ef7c286de6f9320364))
|
|
23
|
+
|
|
24
|
+
## [0.1.3](https://github.com/brandon-schabel/zvk-ui/compare/v0.1.2...v0.1.3) (2026-06-03)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Features
|
|
28
|
+
|
|
29
|
+
* add ZvkUi adoption primitives ([9a33d57](https://github.com/brandon-schabel/zvk-ui/commit/9a33d57d6a70c73a28810226d72b5e9afc5be203))
|
|
30
|
+
|
|
31
|
+
## [0.1.2](https://github.com/brandon-schabel/zvk-ui/compare/v0.1.1...v0.1.2) (2026-06-03)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Features
|
|
35
|
+
|
|
36
|
+
* add ZvkUi migration component APIs ([43844a4](https://github.com/brandon-schabel/zvk-ui/commit/43844a4bb4dd9b5ab6b30bca83a26da268f5f7a1))
|
|
37
|
+
* harmonize overlay api edges ([be2ab74](https://github.com/brandon-schabel/zvk-ui/commit/be2ab7450c47f5e56802b15b4e350776ea7cf2f6))
|
|
38
|
+
|
|
39
|
+
## 0.1.0
|
|
40
|
+
|
|
41
|
+
- 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";
|
|
@@ -6,7 +6,8 @@ export interface AlertDialogProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
6
6
|
ref?: React.Ref<HTMLDivElement>;
|
|
7
7
|
}
|
|
8
8
|
export interface AlertDialogTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
9
|
-
|
|
9
|
+
asChild?: boolean;
|
|
10
|
+
ref?: React.Ref<HTMLButtonElement | HTMLElement>;
|
|
10
11
|
}
|
|
11
12
|
export interface AlertDialogContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
12
13
|
ref?: React.Ref<HTMLDivElement>;
|
|
@@ -21,18 +22,20 @@ export interface AlertDialogFooterProps extends React.HTMLAttributes<HTMLDivElem
|
|
|
21
22
|
ref?: React.Ref<HTMLDivElement>;
|
|
22
23
|
}
|
|
23
24
|
export interface AlertDialogActionProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
24
|
-
|
|
25
|
+
asChild?: boolean;
|
|
26
|
+
ref?: React.Ref<HTMLButtonElement | HTMLElement>;
|
|
25
27
|
}
|
|
26
28
|
export interface AlertDialogCancelProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
27
|
-
|
|
29
|
+
asChild?: boolean;
|
|
30
|
+
ref?: React.Ref<HTMLButtonElement | HTMLElement>;
|
|
28
31
|
}
|
|
29
32
|
declare function AlertDialogRoot({ children, className, defaultOpen, onOpenChange, open: openProp, ref, ...props }: AlertDialogProps): React.JSX.Element;
|
|
30
|
-
declare function AlertDialogTrigger({ className, disabled, onClick, ref, type, ...props }: AlertDialogTriggerProps): React.JSX.Element;
|
|
33
|
+
declare function AlertDialogTrigger({ asChild, className, disabled, onClick, ref, type, ...props }: AlertDialogTriggerProps): React.JSX.Element;
|
|
31
34
|
declare function AlertDialogContent({ children, className, ref, ...props }: AlertDialogContentProps): React.JSX.Element | null;
|
|
32
35
|
declare function AlertDialogTitle({ className, ref, ...props }: AlertDialogTitleProps): React.JSX.Element;
|
|
33
36
|
declare function AlertDialogDescription({ className, ref, ...props }: AlertDialogDescriptionProps): React.JSX.Element;
|
|
34
37
|
declare function AlertDialogFooter({ className, ref, ...props }: AlertDialogFooterProps): React.JSX.Element;
|
|
35
|
-
declare function AlertDialogCloseButton({ className, onClick, ref, type, ...props }: AlertDialogActionProps | AlertDialogCancelProps): React.JSX.Element;
|
|
38
|
+
declare function AlertDialogCloseButton({ asChild, className, disabled, onClick, ref, type, ...props }: AlertDialogActionProps | AlertDialogCancelProps): React.JSX.Element;
|
|
36
39
|
type AlertDialogComponent = typeof AlertDialogRoot & {
|
|
37
40
|
Action: typeof AlertDialogCloseButton;
|
|
38
41
|
Cancel: typeof AlertDialogCloseButton;
|
|
@@ -8,6 +8,7 @@ import { DismissableLayer } from "../../internal/dismissable-layer/index.js";
|
|
|
8
8
|
import { FocusScope } from "../../internal/focus/index.js";
|
|
9
9
|
import { Portal } from "../../internal/portal/index.js";
|
|
10
10
|
import { lockScroll, unlockScroll } from "../../internal/scroll-lock/index.js";
|
|
11
|
+
import { Slot } from "../../internal/slot/index.js";
|
|
11
12
|
const AlertDialogContext = React.createContext(null);
|
|
12
13
|
function useAlertDialogContext(calledBy) {
|
|
13
14
|
const context = React.useContext(AlertDialogContext);
|
|
@@ -65,41 +66,53 @@ function AlertDialogRoot({ children, className, defaultOpen = false, onOpenChang
|
|
|
65
66
|
setOpen,
|
|
66
67
|
titleId: `${instanceId}-title`,
|
|
67
68
|
triggerRef
|
|
68
|
-
}, 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 }) }));
|
|
69
70
|
}
|
|
70
|
-
function AlertDialogTrigger({ className, disabled, onClick, ref, type = "button", ...props }) {
|
|
71
|
+
function AlertDialogTrigger({ asChild = false, className, disabled, onClick, ref, type = "button", ...props }) {
|
|
71
72
|
const { contentId, open, setOpen, triggerRef } = useAlertDialogContext("AlertDialog.Trigger");
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
const handleClick = () => {
|
|
74
|
+
if (!disabled) {
|
|
75
|
+
setOpen(true);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
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("zvk-ui-alert-dialog__trigger", className), "data-disabled": disabled ? "true" : undefined, "data-state": open ? "open" : "closed", onClick: composeEventHandlers(onClick, handleClick), children: props.children }));
|
|
80
|
+
}
|
|
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) }));
|
|
77
82
|
}
|
|
78
83
|
function AlertDialogContent({ children, className, ref, ...props }) {
|
|
79
84
|
const { close, contentId, describedBy, labelledBy, open } = useAlertDialogContext("AlertDialog.Content");
|
|
80
85
|
if (!open) {
|
|
81
86
|
return null;
|
|
82
87
|
}
|
|
83
|
-
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 }) }) })] }));
|
|
84
89
|
}
|
|
85
90
|
function AlertDialogTitle({ className, ref, ...props }) {
|
|
86
91
|
const { registerTitle, titleId } = useAlertDialogContext("AlertDialog.Title");
|
|
87
92
|
const id = props.id ?? titleId;
|
|
88
93
|
React.useLayoutEffect(() => registerTitle(id), [id, registerTitle]);
|
|
89
|
-
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) });
|
|
90
95
|
}
|
|
91
96
|
function AlertDialogDescription({ className, ref, ...props }) {
|
|
92
97
|
const { descriptionId, registerDescription } = useAlertDialogContext("AlertDialog.Description");
|
|
93
98
|
const id = props.id ?? descriptionId;
|
|
94
99
|
React.useLayoutEffect(() => registerDescription(id), [id, registerDescription]);
|
|
95
|
-
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) });
|
|
96
101
|
}
|
|
97
102
|
function AlertDialogFooter({ className, ref, ...props }) {
|
|
98
|
-
return _jsx("div", { ...props, ref: ref, className: cn("
|
|
103
|
+
return _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-alert-dialog__footer", className) });
|
|
99
104
|
}
|
|
100
|
-
function AlertDialogCloseButton({ className, onClick, ref, type = "button", ...props }) {
|
|
105
|
+
function AlertDialogCloseButton({ asChild = false, className, disabled, onClick, ref, type = "button", ...props }) {
|
|
101
106
|
const { close } = useAlertDialogContext("AlertDialog.Action");
|
|
102
|
-
|
|
107
|
+
const handleClick = () => {
|
|
108
|
+
if (!disabled) {
|
|
109
|
+
close();
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
if (asChild) {
|
|
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
|
+
}
|
|
115
|
+
return (_jsx("button", { ...props, ref: ref, type: type, disabled: disabled, className: cn("zvk-ui-alert-dialog__button", className), onClick: composeEventHandlers(onClick, handleClick) }));
|
|
103
116
|
}
|
|
104
117
|
export const AlertDialog = Object.assign(AlertDialogRoot, {
|
|
105
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 });
|
|
@@ -2,12 +2,13 @@ import * as React from "react";
|
|
|
2
2
|
export type ButtonVariant = "primary" | "secondary" | "outline" | "ghost" | "destructive";
|
|
3
3
|
export type ButtonSize = "sm" | "md" | "lg" | "icon";
|
|
4
4
|
export interface ButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "disabled"> {
|
|
5
|
+
asChild?: boolean;
|
|
5
6
|
variant?: ButtonVariant;
|
|
6
7
|
size?: ButtonSize;
|
|
7
8
|
loading?: boolean;
|
|
8
9
|
disabled?: boolean;
|
|
9
10
|
leadingIcon?: React.ReactNode;
|
|
10
11
|
trailingIcon?: React.ReactNode;
|
|
11
|
-
ref?: React.Ref<HTMLButtonElement>;
|
|
12
|
+
ref?: React.Ref<HTMLButtonElement | HTMLElement>;
|
|
12
13
|
}
|
|
13
|
-
export declare function Button({ children, className, disabled, leadingIcon, loading, ref, size, trailingIcon, type, variant, ...props }: ButtonProps): React.JSX.Element;
|
|
14
|
+
export declare function Button({ asChild, children, className, disabled, leadingIcon, loading, ref, size, trailingIcon, type, variant, ...props }: ButtonProps): React.JSX.Element;
|
|
@@ -1,8 +1,56 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { Spinner } from "../spinner/spinner.js";
|
|
4
|
+
import { Slot } from "../../internal/slot/index.js";
|
|
4
5
|
import { cn } from "../../utils/cn.js";
|
|
5
|
-
|
|
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
|
+
}
|
|
18
|
+
export function Button({ asChild = false, children, className, disabled, leadingIcon, loading = false, ref, size = "md", trailingIcon, type = "button", variant = "primary", ...props }) {
|
|
6
19
|
const isDisabled = disabled || loading;
|
|
7
|
-
|
|
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
|
+
}
|
|
52
|
+
if (asChild) {
|
|
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 }));
|
|
54
|
+
}
|
|
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] }));
|
|
8
56
|
}
|
|
@@ -1,16 +1,51 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
export type CalendarMode = "single";
|
|
3
|
+
export type CalendarClassNames = Partial<{
|
|
4
|
+
months: string;
|
|
5
|
+
month: string;
|
|
6
|
+
caption: string;
|
|
7
|
+
caption_label: string;
|
|
8
|
+
nav: string;
|
|
9
|
+
nav_button: string;
|
|
10
|
+
nav_button_previous: string;
|
|
11
|
+
nav_button_next: string;
|
|
12
|
+
table: string;
|
|
13
|
+
head_row: string;
|
|
14
|
+
head_cell: string;
|
|
15
|
+
row: string;
|
|
16
|
+
cell: string;
|
|
17
|
+
day: string;
|
|
18
|
+
day_selected: string;
|
|
19
|
+
day_today: string;
|
|
20
|
+
day_outside: string;
|
|
21
|
+
day_disabled: string;
|
|
22
|
+
}>;
|
|
23
|
+
interface CalendarBaseProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onSelect"> {
|
|
6
24
|
month?: Date;
|
|
7
25
|
defaultMonth?: Date;
|
|
8
26
|
onMonthChange?: (month: Date) => void;
|
|
9
27
|
minDate?: Date;
|
|
10
28
|
maxDate?: Date;
|
|
29
|
+
disabled?: (date: Date) => boolean;
|
|
11
30
|
disabledDate?: (date: Date) => boolean;
|
|
31
|
+
showOutsideDays?: boolean;
|
|
32
|
+
classNames?: CalendarClassNames;
|
|
12
33
|
weekStartsOn?: 0 | 1;
|
|
13
34
|
locale?: string;
|
|
14
35
|
ref?: React.Ref<HTMLDivElement>;
|
|
15
36
|
}
|
|
16
|
-
export
|
|
37
|
+
export interface CalendarNativeProps extends CalendarBaseProps {
|
|
38
|
+
mode?: undefined;
|
|
39
|
+
selected?: Date | null;
|
|
40
|
+
defaultSelected?: Date | null;
|
|
41
|
+
onSelect?: (date: Date | null) => void;
|
|
42
|
+
}
|
|
43
|
+
export interface CalendarSingleProps extends CalendarBaseProps {
|
|
44
|
+
mode: CalendarMode;
|
|
45
|
+
selected?: Date | null | undefined;
|
|
46
|
+
defaultSelected?: Date | null;
|
|
47
|
+
onSelect?: (date: Date | undefined) => void;
|
|
48
|
+
}
|
|
49
|
+
export type CalendarProps = CalendarNativeProps | CalendarSingleProps;
|
|
50
|
+
export declare function Calendar({ classNames, className, defaultMonth, defaultSelected, disabled, disabledDate, locale, maxDate, minDate, mode, month, onKeyDown, onMonthChange, onSelect, ref, selected, showOutsideDays, weekStartsOn, ...props }: CalendarProps): React.JSX.Element;
|
|
51
|
+
export {};
|
|
@@ -52,7 +52,11 @@ function isDisabled(date, props) {
|
|
|
52
52
|
if (props.maxDate && isAfterDay(date, props.maxDate)) {
|
|
53
53
|
return true;
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
const normalizedDate = startOfDay(date);
|
|
56
|
+
if (props.disabled?.(normalizedDate)) {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
return props.disabledDate ? props.disabledDate(normalizedDate) : false;
|
|
56
60
|
}
|
|
57
61
|
function getMonthLabel(date, locale) {
|
|
58
62
|
return new Intl.DateTimeFormat(locale, { month: "long", year: "numeric" }).format(date);
|
|
@@ -74,7 +78,7 @@ function getNearestEnabledDate(date, visibleMonth, props) {
|
|
|
74
78
|
const days = getCalendarDays(visibleMonth, 0);
|
|
75
79
|
return days.find((day) => !isDisabled(day, props)) ?? date;
|
|
76
80
|
}
|
|
77
|
-
export function Calendar({ className, defaultMonth, defaultSelected = null, disabledDate, locale, maxDate, minDate, month, onKeyDown, onMonthChange, onSelect, ref, selected, weekStartsOn = 0, ...props }) {
|
|
81
|
+
export function Calendar({ classNames, className, defaultMonth, defaultSelected = null, disabled, disabledDate, locale, maxDate, minDate, mode, month, onKeyDown, onMonthChange, onSelect, ref, selected, showOutsideDays = true, weekStartsOn = 0, ...props }) {
|
|
78
82
|
const isSelectedControlled = selected !== undefined;
|
|
79
83
|
const selectedDate = isSelectedControlled ? selected : defaultSelected;
|
|
80
84
|
const [uncontrolledSelected, setUncontrolledSelected] = React.useState(defaultSelected);
|
|
@@ -84,7 +88,7 @@ export function Calendar({ className, defaultMonth, defaultSelected = null, disa
|
|
|
84
88
|
const [focusedDate, setFocusedDate] = React.useState(() => startOfDay(currentSelected ?? visibleMonth));
|
|
85
89
|
const headingId = React.useId();
|
|
86
90
|
const dayButtonRefs = React.useRef(new Map());
|
|
87
|
-
const disabledProps = React.useMemo(() => ({ disabledDate, maxDate, minDate }), [disabledDate, maxDate, minDate]);
|
|
91
|
+
const disabledProps = React.useMemo(() => ({ disabled, disabledDate, maxDate, minDate }), [disabled, disabledDate, maxDate, minDate]);
|
|
88
92
|
const days = React.useMemo(() => getCalendarDays(visibleMonth, weekStartsOn), [visibleMonth, weekStartsOn]);
|
|
89
93
|
const weekdays = React.useMemo(() => getWeekdayLabels(weekStartsOn, locale), [locale, weekStartsOn]);
|
|
90
94
|
const monthLabel = getMonthLabel(visibleMonth, locale);
|
|
@@ -119,6 +123,10 @@ export function Calendar({ className, defaultMonth, defaultSelected = null, disa
|
|
|
119
123
|
if (!isSelectedControlled) {
|
|
120
124
|
setUncontrolledSelected(nextSelected);
|
|
121
125
|
}
|
|
126
|
+
if (mode === "single") {
|
|
127
|
+
onSelect?.(nextSelected ?? undefined);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
122
130
|
onSelect?.(nextSelected);
|
|
123
131
|
};
|
|
124
132
|
const handleKeyDown = (event) => {
|
|
@@ -159,14 +167,18 @@ export function Calendar({ className, defaultMonth, defaultSelected = null, disa
|
|
|
159
167
|
}
|
|
160
168
|
moveFocus(addDays(focusedDate, offset));
|
|
161
169
|
};
|
|
162
|
-
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) => {
|
|
163
171
|
const normalizedDate = startOfDay(date);
|
|
164
172
|
const dateKey = normalizedDate.getTime();
|
|
165
173
|
const outsideMonth = date.getMonth() !== visibleMonth.getMonth();
|
|
174
|
+
const hideOutsideDay = outsideMonth && !showOutsideDays;
|
|
166
175
|
const disabled = isDisabled(date, disabledProps);
|
|
167
176
|
const selectedDay = isSameDay(currentSelected, date);
|
|
168
177
|
const focusedDay = isSameDay(focusedDate, date);
|
|
169
|
-
|
|
178
|
+
if (hideOutsideDay) {
|
|
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
|
+
}
|
|
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) => {
|
|
170
182
|
if (node) {
|
|
171
183
|
dayButtonRefs.current.set(dateKey, node);
|
|
172
184
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Calendar } from "./calendar.js";
|
|
2
|
-
export type { CalendarProps } from "./calendar.js";
|
|
2
|
+
export type { CalendarClassNames, CalendarMode, CalendarNativeProps, CalendarProps, CalendarSingleProps } from "./calendar.js";
|
|
@@ -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";
|