@zvk/ui 0.1.2 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/alert-dialog/alert-dialog.d.ts +8 -5
- package/dist/components/alert-dialog/alert-dialog.js +21 -8
- package/dist/components/button/button.d.ts +3 -2
- package/dist/components/button/button.js +5 -1
- package/dist/components/calendar/calendar.d.ts +51 -0
- package/dist/components/calendar/calendar.js +190 -0
- package/dist/components/calendar/index.d.ts +2 -0
- package/dist/components/calendar/index.js +2 -0
- package/dist/components/carousel/carousel.d.ts +51 -0
- package/dist/components/carousel/carousel.js +210 -0
- package/dist/components/carousel/index.d.ts +2 -0
- package/dist/components/carousel/index.js +2 -0
- package/dist/components/collapsible/collapsible.d.ts +3 -2
- package/dist/components/collapsible/collapsible.js +5 -1
- package/dist/components/command/command.d.ts +11 -4
- package/dist/components/command/command.js +27 -16
- 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 +139 -36
- package/dist/components/date-picker/date-picker.d.ts +16 -0
- package/dist/components/date-picker/date-picker.js +50 -0
- package/dist/components/date-picker/index.d.ts +2 -0
- package/dist/components/date-picker/index.js +2 -0
- package/dist/components/dialog/dialog.d.ts +6 -4
- package/dist/components/dialog/dialog.js +14 -4
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +13 -7
- package/dist/components/dropdown-menu/dropdown-menu.js +127 -72
- package/dist/components/hover-card/hover-card.d.ts +37 -0
- package/dist/components/hover-card/hover-card.js +271 -0
- package/dist/components/hover-card/index.d.ts +2 -0
- package/dist/components/hover-card/index.js +2 -0
- package/dist/components/index.d.ts +14 -6
- package/dist/components/index.js +5 -1
- package/dist/components/menubar/menubar.d.ts +24 -5
- package/dist/components/menubar/menubar.js +182 -33
- package/dist/components/popover/popover.d.ts +9 -3
- package/dist/components/popover/popover.js +15 -5
- package/dist/components/sheet/sheet.d.ts +6 -4
- package/dist/components/sheet/sheet.js +21 -8
- package/dist/components/toast/index.d.ts +2 -2
- package/dist/components/toast/index.js +2 -1
- package/dist/components/toast/toast.d.ts +40 -0
- package/dist/components/toast/toast.js +144 -2
- package/dist/components/tooltip/tooltip.d.ts +8 -2
- package/dist/components/tooltip/tooltip.js +8 -5
- package/dist/internal/floating/placement-aliases.d.ts +7 -0
- package/dist/internal/floating/placement-aliases.js +13 -0
- 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 +356 -4
- package/package.json +18 -2
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { DismissableLayer } from "../../internal/dismissable-layer/index.js";
|
|
5
|
+
import { useFloatingPosition } from "../../internal/floating/index.js";
|
|
6
|
+
import { placementFromSideAlign } from "../../internal/floating/placement-aliases.js";
|
|
7
|
+
import { Portal } from "../../internal/portal/index.js";
|
|
8
|
+
import { useControllableState } from "../../hooks/use-controllable-state.js";
|
|
9
|
+
import { cn } from "../../utils/cn.js";
|
|
10
|
+
import { composeEventHandlers } from "../../utils/compose-event-handlers.js";
|
|
11
|
+
const defaultContentPositioning = {
|
|
12
|
+
sideOffset: 8,
|
|
13
|
+
collisionPadding: 0
|
|
14
|
+
};
|
|
15
|
+
const HoverCardContext = React.createContext(null);
|
|
16
|
+
function useHoverCardContext(calledBy) {
|
|
17
|
+
const context = React.useContext(HoverCardContext);
|
|
18
|
+
if (context === null) {
|
|
19
|
+
throw new Error(`"${calledBy}" must be used within a <HoverCard />`);
|
|
20
|
+
}
|
|
21
|
+
return context;
|
|
22
|
+
}
|
|
23
|
+
function composeRefs(...refs) {
|
|
24
|
+
return (node) => {
|
|
25
|
+
for (const ref of refs) {
|
|
26
|
+
if (typeof ref === "function") {
|
|
27
|
+
ref(node);
|
|
28
|
+
}
|
|
29
|
+
else if (ref !== undefined && ref !== null) {
|
|
30
|
+
ref.current = node;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function joinIds(...ids) {
|
|
36
|
+
const value = ids.filter((id) => id !== undefined && id !== "").join(" ");
|
|
37
|
+
return value.length > 0 ? value : undefined;
|
|
38
|
+
}
|
|
39
|
+
function getPlacementParts(placement) {
|
|
40
|
+
const [side, align = "center"] = placement.split("-");
|
|
41
|
+
return { side, align };
|
|
42
|
+
}
|
|
43
|
+
function HoverCardRoot({ children, closeDelay = 300, defaultOpen = false, disabled = false, onOpenChange, open: openProp, openDelay = 700, placement = "bottom" }) {
|
|
44
|
+
const generatedId = React.useId();
|
|
45
|
+
const contentId = `${generatedId}-content`;
|
|
46
|
+
const [open, setOpen] = useControllableState({
|
|
47
|
+
...(openProp !== undefined ? { value: openProp } : {}),
|
|
48
|
+
defaultValue: defaultOpen,
|
|
49
|
+
...(onOpenChange ? { onChange: onOpenChange } : {})
|
|
50
|
+
});
|
|
51
|
+
const [contentPositioning, setContentPositioning] = React.useState(defaultContentPositioning);
|
|
52
|
+
const openTimerRef = React.useRef(null);
|
|
53
|
+
const closeTimerRef = React.useRef(null);
|
|
54
|
+
const focusCloseTimerRef = React.useRef(null);
|
|
55
|
+
const referenceElement = React.useRef(null);
|
|
56
|
+
const contentElement = React.useRef(null);
|
|
57
|
+
const { floatingRef, floatingStyle, placement: resolvedPlacement, referenceRef, updatePosition } = useFloatingPosition({
|
|
58
|
+
open,
|
|
59
|
+
placement: contentPositioning.placement ?? placement,
|
|
60
|
+
offset: contentPositioning.sideOffset,
|
|
61
|
+
collisionPadding: contentPositioning.collisionPadding,
|
|
62
|
+
flip: true,
|
|
63
|
+
shift: true
|
|
64
|
+
});
|
|
65
|
+
const clearOpenTimer = React.useCallback(() => {
|
|
66
|
+
if (openTimerRef.current === null) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
window.clearTimeout(openTimerRef.current);
|
|
70
|
+
openTimerRef.current = null;
|
|
71
|
+
}, []);
|
|
72
|
+
const clearCloseTimer = React.useCallback(() => {
|
|
73
|
+
if (closeTimerRef.current === null) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
window.clearTimeout(closeTimerRef.current);
|
|
77
|
+
closeTimerRef.current = null;
|
|
78
|
+
}, []);
|
|
79
|
+
const clearFocusCloseTimer = React.useCallback(() => {
|
|
80
|
+
if (focusCloseTimerRef.current === null) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
window.clearTimeout(focusCloseTimerRef.current);
|
|
84
|
+
focusCloseTimerRef.current = null;
|
|
85
|
+
}, []);
|
|
86
|
+
const close = React.useCallback(() => {
|
|
87
|
+
clearOpenTimer();
|
|
88
|
+
clearCloseTimer();
|
|
89
|
+
clearFocusCloseTimer();
|
|
90
|
+
setOpen(false);
|
|
91
|
+
}, [clearCloseTimer, clearFocusCloseTimer, clearOpenTimer, setOpen]);
|
|
92
|
+
const openImmediately = React.useCallback(() => {
|
|
93
|
+
if (disabled) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
clearOpenTimer();
|
|
97
|
+
clearCloseTimer();
|
|
98
|
+
clearFocusCloseTimer();
|
|
99
|
+
setOpen(true);
|
|
100
|
+
}, [clearCloseTimer, clearFocusCloseTimer, clearOpenTimer, disabled, setOpen]);
|
|
101
|
+
const openWithDelay = React.useCallback(() => {
|
|
102
|
+
if (disabled) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
clearOpenTimer();
|
|
106
|
+
clearCloseTimer();
|
|
107
|
+
clearFocusCloseTimer();
|
|
108
|
+
if (openDelay > 0) {
|
|
109
|
+
openTimerRef.current = window.setTimeout(() => {
|
|
110
|
+
setOpen(true);
|
|
111
|
+
}, openDelay);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
setOpen(true);
|
|
115
|
+
}, [clearCloseTimer, clearFocusCloseTimer, clearOpenTimer, disabled, openDelay, setOpen]);
|
|
116
|
+
const closeWithDelay = React.useCallback(() => {
|
|
117
|
+
clearOpenTimer();
|
|
118
|
+
clearCloseTimer();
|
|
119
|
+
if (closeDelay > 0) {
|
|
120
|
+
closeTimerRef.current = window.setTimeout(() => {
|
|
121
|
+
setOpen(false);
|
|
122
|
+
}, closeDelay);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
setOpen(false);
|
|
126
|
+
}, [clearCloseTimer, clearOpenTimer, closeDelay, setOpen]);
|
|
127
|
+
const isInsideHoverCard = React.useCallback((node) => {
|
|
128
|
+
if (node === null) {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
return Boolean(referenceElement.current?.contains(node) || contentElement.current?.contains(node));
|
|
132
|
+
}, []);
|
|
133
|
+
const closeAfterFocusLeaves = React.useCallback((nextTarget) => {
|
|
134
|
+
clearFocusCloseTimer();
|
|
135
|
+
if (isInsideHoverCard(nextTarget)) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (nextTarget !== null) {
|
|
139
|
+
close();
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
focusCloseTimerRef.current = window.setTimeout(() => {
|
|
143
|
+
focusCloseTimerRef.current = null;
|
|
144
|
+
if (!isInsideHoverCard(document.activeElement)) {
|
|
145
|
+
close();
|
|
146
|
+
}
|
|
147
|
+
}, 0);
|
|
148
|
+
}, [clearFocusCloseTimer, close, isInsideHoverCard]);
|
|
149
|
+
const setReferenceRef = React.useCallback((node) => {
|
|
150
|
+
referenceElement.current = node;
|
|
151
|
+
referenceRef(node);
|
|
152
|
+
}, [referenceRef]);
|
|
153
|
+
const setFloatingRef = React.useCallback((node) => {
|
|
154
|
+
contentElement.current = node;
|
|
155
|
+
floatingRef(node);
|
|
156
|
+
}, [floatingRef]);
|
|
157
|
+
React.useEffect(() => {
|
|
158
|
+
if (open) {
|
|
159
|
+
updatePosition();
|
|
160
|
+
}
|
|
161
|
+
}, [open, updatePosition]);
|
|
162
|
+
React.useEffect(() => {
|
|
163
|
+
if (disabled) {
|
|
164
|
+
close();
|
|
165
|
+
}
|
|
166
|
+
}, [close, disabled]);
|
|
167
|
+
React.useEffect(() => () => {
|
|
168
|
+
clearOpenTimer();
|
|
169
|
+
clearCloseTimer();
|
|
170
|
+
clearFocusCloseTimer();
|
|
171
|
+
}, [clearCloseTimer, clearFocusCloseTimer, clearOpenTimer]);
|
|
172
|
+
const contextValue = React.useMemo(() => ({
|
|
173
|
+
cancelClose: clearCloseTimer,
|
|
174
|
+
close,
|
|
175
|
+
closeWithDelay,
|
|
176
|
+
closeAfterFocusLeaves,
|
|
177
|
+
contentElement,
|
|
178
|
+
contentId,
|
|
179
|
+
disabled,
|
|
180
|
+
floatingRef: setFloatingRef,
|
|
181
|
+
floatingStyle,
|
|
182
|
+
isInsideHoverCard,
|
|
183
|
+
open,
|
|
184
|
+
openImmediately,
|
|
185
|
+
openWithDelay,
|
|
186
|
+
referenceElement,
|
|
187
|
+
referenceRef: setReferenceRef,
|
|
188
|
+
resolvedPlacement,
|
|
189
|
+
setContentPositioning
|
|
190
|
+
}), [
|
|
191
|
+
clearCloseTimer,
|
|
192
|
+
close,
|
|
193
|
+
closeWithDelay,
|
|
194
|
+
closeAfterFocusLeaves,
|
|
195
|
+
contentId,
|
|
196
|
+
disabled,
|
|
197
|
+
floatingStyle,
|
|
198
|
+
isInsideHoverCard,
|
|
199
|
+
open,
|
|
200
|
+
openImmediately,
|
|
201
|
+
openWithDelay,
|
|
202
|
+
resolvedPlacement,
|
|
203
|
+
setFloatingRef,
|
|
204
|
+
setReferenceRef
|
|
205
|
+
]);
|
|
206
|
+
return (_jsx(HoverCardContext.Provider, { value: contextValue, children: children }));
|
|
207
|
+
}
|
|
208
|
+
function HoverCardTrigger({ children, asChild: _asChild = false }) {
|
|
209
|
+
const context = useHoverCardContext("HoverCard.Trigger");
|
|
210
|
+
if (!React.isValidElement(children) || context.disabled) {
|
|
211
|
+
return children;
|
|
212
|
+
}
|
|
213
|
+
const trigger = children;
|
|
214
|
+
const childProps = trigger.props;
|
|
215
|
+
const childClassName = typeof childProps.className === "string" ? childProps.className : undefined;
|
|
216
|
+
const childAriaControls = childProps["aria-controls"];
|
|
217
|
+
const childAriaDescribedBy = childProps["aria-describedby"];
|
|
218
|
+
return React.cloneElement(trigger, {
|
|
219
|
+
...childProps,
|
|
220
|
+
ref: composeRefs(childProps.ref, context.referenceRef),
|
|
221
|
+
"aria-controls": joinIds(typeof childAriaControls === "string" ? childAriaControls : undefined, context.contentId),
|
|
222
|
+
"aria-describedby": joinIds(typeof childAriaDescribedBy === "string" ? childAriaDescribedBy : undefined, context.open ? context.contentId : undefined),
|
|
223
|
+
"aria-expanded": context.open,
|
|
224
|
+
"aria-haspopup": "dialog",
|
|
225
|
+
className: cn("liano-hover-card__trigger", childClassName),
|
|
226
|
+
"data-state": context.open ? "open" : "closed",
|
|
227
|
+
onBlur: composeEventHandlers(childProps.onBlur, (event) => {
|
|
228
|
+
context.closeAfterFocusLeaves(event.relatedTarget);
|
|
229
|
+
}),
|
|
230
|
+
onFocus: composeEventHandlers(childProps.onFocus, context.openImmediately),
|
|
231
|
+
onMouseEnter: composeEventHandlers(childProps.onMouseEnter, context.openWithDelay),
|
|
232
|
+
onMouseLeave: composeEventHandlers(childProps.onMouseLeave, context.closeWithDelay),
|
|
233
|
+
onPointerEnter: composeEventHandlers(childProps.onPointerEnter, context.openWithDelay),
|
|
234
|
+
onPointerLeave: composeEventHandlers(childProps.onPointerLeave, context.closeWithDelay)
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
function HoverCardContent({ align, alignOffset: _alignOffset, children, className, collisionPadding = defaultContentPositioning.collisionPadding, container, forceMount = false, id, onBlur, onFocus, onMouseEnter, onMouseLeave, onPointerEnter, onPointerLeave, placement, ref, side, sideOffset = defaultContentPositioning.sideOffset, style, ...props }) {
|
|
238
|
+
const context = useHoverCardContext("HoverCard.Content");
|
|
239
|
+
const contentId = id ?? context.contentId;
|
|
240
|
+
const placementParts = getPlacementParts(context.resolvedPlacement);
|
|
241
|
+
const { setContentPositioning } = context;
|
|
242
|
+
React.useEffect(() => {
|
|
243
|
+
const resolvedPlacement = side === undefined ? placement : placementFromSideAlign(side, align, placement ?? "bottom");
|
|
244
|
+
setContentPositioning({
|
|
245
|
+
...(resolvedPlacement === undefined ? {} : { placement: resolvedPlacement }),
|
|
246
|
+
sideOffset,
|
|
247
|
+
collisionPadding
|
|
248
|
+
});
|
|
249
|
+
return () => setContentPositioning(defaultContentPositioning);
|
|
250
|
+
}, [align, collisionPadding, placement, setContentPositioning, side, sideOffset]);
|
|
251
|
+
if (!context.open && !forceMount) {
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
const content = (_jsx("div", { ...props, ref: composeRefs(ref, context.floatingRef), id: contentId, role: "dialog", className: cn("liano-hover-card__content", className), "data-align": placementParts.align, "data-side": placementParts.side, "data-state": context.open ? "open" : "closed", hidden: context.open ? undefined : true, onBlur: composeEventHandlers(onBlur, (event) => {
|
|
255
|
+
context.closeAfterFocusLeaves(event.relatedTarget);
|
|
256
|
+
}), onFocus: composeEventHandlers(onFocus, context.openImmediately), onMouseEnter: composeEventHandlers(onMouseEnter, context.cancelClose), onMouseLeave: composeEventHandlers(onMouseLeave, context.closeWithDelay), onPointerEnter: composeEventHandlers(onPointerEnter, context.cancelClose), onPointerLeave: composeEventHandlers(onPointerLeave, context.closeWithDelay), style: { ...context.floatingStyle, ...style }, children: children }));
|
|
257
|
+
if (!context.open) {
|
|
258
|
+
return _jsx(Portal, { ...(container === undefined ? {} : { container }), children: content });
|
|
259
|
+
}
|
|
260
|
+
return (_jsx(Portal, { ...(container === undefined ? {} : { container }), children: _jsx(DismissableLayer, { open: true, modal: false, onDismiss: context.close, onPointerDownOutside: (event) => {
|
|
261
|
+
const pointerEvent = event.detail;
|
|
262
|
+
const target = pointerEvent?.target;
|
|
263
|
+
if (context.referenceElement.current?.contains(target)) {
|
|
264
|
+
event.preventDefault();
|
|
265
|
+
}
|
|
266
|
+
}, children: content }) }));
|
|
267
|
+
}
|
|
268
|
+
export const HoverCard = Object.assign(HoverCardRoot, {
|
|
269
|
+
Trigger: HoverCardTrigger,
|
|
270
|
+
Content: HoverCardContent
|
|
271
|
+
});
|
|
@@ -12,6 +12,10 @@ export { Button } from "./button/index.js";
|
|
|
12
12
|
export type { ButtonProps, ButtonSize, ButtonVariant } from "./button/index.js";
|
|
13
13
|
export { Card } from "./card/index.js";
|
|
14
14
|
export type { CardDescriptionProps, CardPadding, CardProps, CardSlotProps, CardTitleProps, CardVariant } from "./card/index.js";
|
|
15
|
+
export { Calendar } from "./calendar/index.js";
|
|
16
|
+
export type { CalendarClassNames, CalendarMode, CalendarNativeProps, CalendarProps, CalendarSingleProps } from "./calendar/index.js";
|
|
17
|
+
export { Carousel } from "./carousel/index.js";
|
|
18
|
+
export type { CarouselApi, CarouselButtonProps, CarouselOrientation, CarouselPageProps, CarouselProps, CarouselSlideProps, CarouselTrackProps, CarouselViewportProps } from "./carousel/index.js";
|
|
15
19
|
export { Checkbox } from "./checkbox/index.js";
|
|
16
20
|
export type { CheckboxProps, CheckboxSize } from "./checkbox/index.js";
|
|
17
21
|
export { CodeBlock } from "./code-block/index.js";
|
|
@@ -20,10 +24,12 @@ export { Collapsible } from "./collapsible/index.js";
|
|
|
20
24
|
export type { CollapsibleContentProps, CollapsibleProps, CollapsibleTriggerProps } from "./collapsible/index.js";
|
|
21
25
|
export { CopyButton, CopyableText } from "./copy-button/index.js";
|
|
22
26
|
export type { CopyButtonProps, CopyButtonSize, CopyStatus, CopyableTextProps } from "./copy-button/index.js";
|
|
27
|
+
export { DatePicker } from "./date-picker/index.js";
|
|
28
|
+
export type { DatePickerProps } from "./date-picker/index.js";
|
|
23
29
|
export { Dialog } from "./dialog/index.js";
|
|
24
30
|
export type { DialogCloseProps, DialogContentProps, DialogDescriptionProps, DialogFooterProps, DialogHeaderProps, DialogOverlayProps, DialogProps, DialogTitleProps, DialogTriggerProps } from "./dialog/index.js";
|
|
25
31
|
export { DropdownMenu } from "./dropdown-menu/index.js";
|
|
26
|
-
export type { DropdownMenuContentProps, DropdownMenuItemProps, DropdownMenuProps, DropdownMenuSeparatorProps, DropdownMenuTriggerProps } from "./dropdown-menu/index.js";
|
|
32
|
+
export type { DropdownMenuCheckboxItemProps, DropdownMenuContentProps, DropdownMenuItemProps, DropdownMenuLabelProps, DropdownMenuProps, DropdownMenuRadioGroupProps, DropdownMenuRadioItemProps, DropdownMenuSeparatorProps, DropdownMenuShortcutProps, DropdownMenuSubProps, DropdownMenuTriggerProps } from "./dropdown-menu/index.js";
|
|
27
33
|
export { AlertDialog } from "./alert-dialog/index.js";
|
|
28
34
|
export type { AlertDialogActionProps, AlertDialogCancelProps, AlertDialogContentProps, AlertDialogDescriptionProps, AlertDialogFooterProps, AlertDialogProps, AlertDialogTitleProps, AlertDialogTriggerProps } from "./alert-dialog/index.js";
|
|
29
35
|
export { Sheet } from "./sheet/index.js";
|
|
@@ -31,13 +37,13 @@ export type { SheetCloseProps, SheetContentProps, SheetDescriptionProps, SheetFo
|
|
|
31
37
|
export { ScrollArea } from "./scroll-area/index.js";
|
|
32
38
|
export type { ScrollAreaOrientation, ScrollAreaProps, ScrollAreaType, ScrollBarProps } from "./scroll-area/index.js";
|
|
33
39
|
export { Command, CommandDialog } from "./command/index.js";
|
|
34
|
-
export type { CommandDialogProps, CommandEmptyProps, CommandGroupProps, CommandInputProps, CommandItemProps, CommandListProps, CommandProps, CommandSeparatorProps } from "./command/index.js";
|
|
40
|
+
export type { CommandDialogProps, CommandEmptyProps, CommandGroupProps, CommandInputProps, CommandItemProps, CommandListProps, CommandProps, CommandSeparatorProps, CommandShortcutProps } from "./command/index.js";
|
|
35
41
|
export { Combobox } from "./combobox/index.js";
|
|
36
42
|
export type { ComboboxOption, ComboboxProps } from "./combobox/index.js";
|
|
37
43
|
export { ContextMenu } from "./context-menu/index.js";
|
|
38
|
-
export type { ContextMenuContentProps, ContextMenuItemProps, ContextMenuProps, ContextMenuSeparatorProps, ContextMenuTriggerProps } from "./context-menu/index.js";
|
|
44
|
+
export type { ContextMenuCheckboxItemProps, ContextMenuContentProps, ContextMenuItemProps, ContextMenuLabelProps, ContextMenuProps, ContextMenuSeparatorProps, ContextMenuTriggerProps } from "./context-menu/index.js";
|
|
39
45
|
export { Menubar } from "./menubar/index.js";
|
|
40
|
-
export type { MenubarContentProps, MenubarItemProps, MenubarMenuProps, MenubarProps, MenubarSeparatorProps, MenubarTriggerProps } from "./menubar/index.js";
|
|
46
|
+
export type { MenubarContentProps, MenubarItemProps, MenubarLabelProps, MenubarMenuProps, MenubarProps, MenubarSeparatorProps, MenubarShortcutProps, MenubarTriggerProps } from "./menubar/index.js";
|
|
41
47
|
export { EmptyState } from "./empty-state/index.js";
|
|
42
48
|
export type { EmptyStateAlign, EmptyStateProps, EmptyStateSize } from "./empty-state/index.js";
|
|
43
49
|
export { ErrorBoundary, ErrorFallback } from "./error-boundary/index.js";
|
|
@@ -48,6 +54,8 @@ export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, For
|
|
|
48
54
|
export type { FormControlProps, FormFieldProps, FormItemProps, FormLabelProps, FormProps, FormTextProps } from "./form/index.js";
|
|
49
55
|
export { FileUploadInput } from "./file-upload-input/index.js";
|
|
50
56
|
export type { FileUploadInputProps, FileUploadInputSize } from "./file-upload-input/index.js";
|
|
57
|
+
export { HoverCard } from "./hover-card/index.js";
|
|
58
|
+
export type { HoverCardContentProps, HoverCardProps, HoverCardTriggerProps } from "./hover-card/index.js";
|
|
51
59
|
export { IconButton } from "./icon-button/index.js";
|
|
52
60
|
export type { IconButtonProps } from "./icon-button/index.js";
|
|
53
61
|
export { Input } from "./input/index.js";
|
|
@@ -90,8 +98,8 @@ export { TabsWithSidebar } from "./tabs-with-sidebar/index.js";
|
|
|
90
98
|
export type { TabsWithSidebarPanelProps, TabsWithSidebarProps, TabsWithSidebarSidebarProps, TabsWithSidebarWidth } from "./tabs-with-sidebar/index.js";
|
|
91
99
|
export { Textarea } from "./textarea/index.js";
|
|
92
100
|
export type { TextareaProps, TextareaSize } from "./textarea/index.js";
|
|
93
|
-
export { Toast, ToastViewport } from "./toast/index.js";
|
|
94
|
-
export type { ToastActionProps, ToastCloseProps, ToastPlacement, ToastProps, ToastTextProps, ToastTone, ToastViewportProps } from "./toast/index.js";
|
|
101
|
+
export { createToastController, toast, Toast, Toaster, ToastProvider, ToastViewport, useToast } from "./toast/index.js";
|
|
102
|
+
export type { ToasterPosition, ToasterProps, ToastActionInput, ToastActionProps, ToastCloseProps, ToastController, ToastInput, ToastOptions, ToastPlacement, ToastProviderProps, ToastProps, ToastTextProps, ToastTone, ToastViewportProps } from "./toast/index.js";
|
|
95
103
|
export { Tooltip } from "./tooltip/index.js";
|
|
96
104
|
export type { TooltipProps } from "./tooltip/index.js";
|
|
97
105
|
export { Toggle } from "./toggle/index.js";
|
package/dist/components/index.js
CHANGED
|
@@ -5,10 +5,13 @@ export { Badge } from "./badge/index.js";
|
|
|
5
5
|
export { Breadcrumbs } from "./breadcrumbs/index.js";
|
|
6
6
|
export { Button } from "./button/index.js";
|
|
7
7
|
export { Card } from "./card/index.js";
|
|
8
|
+
export { Calendar } from "./calendar/index.js";
|
|
9
|
+
export { Carousel } from "./carousel/index.js";
|
|
8
10
|
export { Checkbox } from "./checkbox/index.js";
|
|
9
11
|
export { CodeBlock } from "./code-block/index.js";
|
|
10
12
|
export { Collapsible } from "./collapsible/index.js";
|
|
11
13
|
export { CopyButton, CopyableText } from "./copy-button/index.js";
|
|
14
|
+
export { DatePicker } from "./date-picker/index.js";
|
|
12
15
|
export { Dialog } from "./dialog/index.js";
|
|
13
16
|
export { DropdownMenu } from "./dropdown-menu/index.js";
|
|
14
17
|
export { AlertDialog } from "./alert-dialog/index.js";
|
|
@@ -23,6 +26,7 @@ export { ErrorBoundary, ErrorFallback } from "./error-boundary/index.js";
|
|
|
23
26
|
export { Field } from "./field/index.js";
|
|
24
27
|
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from "./form/index.js";
|
|
25
28
|
export { FileUploadInput } from "./file-upload-input/index.js";
|
|
29
|
+
export { HoverCard } from "./hover-card/index.js";
|
|
26
30
|
export { IconButton } from "./icon-button/index.js";
|
|
27
31
|
export { Input } from "./input/index.js";
|
|
28
32
|
export { Label } from "./label/index.js";
|
|
@@ -44,7 +48,7 @@ export { Table } from "./table/index.js";
|
|
|
44
48
|
export { Tabs } from "./tabs/index.js";
|
|
45
49
|
export { TabsWithSidebar } from "./tabs-with-sidebar/index.js";
|
|
46
50
|
export { Textarea } from "./textarea/index.js";
|
|
47
|
-
export { Toast, ToastViewport } from "./toast/index.js";
|
|
51
|
+
export { createToastController, toast, Toast, Toaster, ToastProvider, ToastViewport, useToast } from "./toast/index.js";
|
|
48
52
|
export { Tooltip } from "./tooltip/index.js";
|
|
49
53
|
export { Toggle } from "./toggle/index.js";
|
|
50
54
|
export { ToggleGroup } from "./toggle-group/index.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import type { FloatingAlign, FloatingSide } from "../../internal/floating/placement-aliases.js";
|
|
2
3
|
export interface MenubarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
4
|
defaultValue?: string;
|
|
4
5
|
onValueChange?: (value: string | undefined) => void;
|
|
@@ -10,14 +11,28 @@ export interface MenubarMenuProps {
|
|
|
10
11
|
value: string;
|
|
11
12
|
}
|
|
12
13
|
export interface MenubarTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
13
|
-
|
|
14
|
+
asChild?: boolean;
|
|
15
|
+
ref?: React.Ref<HTMLButtonElement | HTMLElement>;
|
|
14
16
|
}
|
|
15
17
|
export interface MenubarContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
18
|
+
side?: FloatingSide;
|
|
19
|
+
align?: FloatingAlign;
|
|
20
|
+
alignOffset?: number;
|
|
21
|
+
sideOffset?: number;
|
|
16
22
|
ref?: React.Ref<HTMLDivElement>;
|
|
17
23
|
}
|
|
18
24
|
export interface MenubarItemProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
25
|
+
asChild?: boolean;
|
|
19
26
|
onSelect?: (event: React.SyntheticEvent<HTMLElement>) => void;
|
|
20
|
-
ref?: React.Ref<HTMLButtonElement>;
|
|
27
|
+
ref?: React.Ref<HTMLButtonElement | HTMLElement>;
|
|
28
|
+
}
|
|
29
|
+
export interface MenubarCheckboxItemProps extends MenubarItemProps {
|
|
30
|
+
checked?: boolean;
|
|
31
|
+
defaultChecked?: boolean;
|
|
32
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
33
|
+
}
|
|
34
|
+
export interface MenubarRadioItemProps extends MenubarItemProps {
|
|
35
|
+
checked?: boolean;
|
|
21
36
|
}
|
|
22
37
|
export interface MenubarSeparatorProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
23
38
|
ref?: React.Ref<HTMLDivElement>;
|
|
@@ -30,17 +45,21 @@ export interface MenubarShortcutProps extends React.HTMLAttributes<HTMLSpanEleme
|
|
|
30
45
|
}
|
|
31
46
|
declare function MenubarRoot({ children, className, defaultValue, onKeyDown, onValueChange, ref, value, ...props }: MenubarProps): React.JSX.Element;
|
|
32
47
|
declare function MenubarMenu({ children, value }: MenubarMenuProps): React.JSX.Element;
|
|
33
|
-
declare function MenubarTrigger({ children, className, disabled, onClick, onKeyDown, ref, type, ...props }: MenubarTriggerProps): React.JSX.Element;
|
|
34
|
-
declare function MenubarContent({ children, className, onKeyDown, ref, ...props }: MenubarContentProps): React.JSX.Element | null;
|
|
35
|
-
declare function MenubarItem({ children, className, disabled, onClick, onKeyDown, onSelect, ref, type, ...props }: MenubarItemProps): React.JSX.Element;
|
|
48
|
+
declare function MenubarTrigger({ asChild, children, className, disabled, onClick, onKeyDown, ref, type, ...props }: MenubarTriggerProps): React.JSX.Element;
|
|
49
|
+
declare function MenubarContent({ align, alignOffset: _alignOffset, children, className, onKeyDown, ref, side, sideOffset: _sideOffset, ...props }: MenubarContentProps): React.JSX.Element | null;
|
|
50
|
+
declare function MenubarItem({ asChild, children, className, disabled, onClick, onKeyDown, onSelect, ref, type, ...props }: MenubarItemProps): React.JSX.Element;
|
|
51
|
+
declare function MenubarCheckboxItem({ asChild, checked, children, className, defaultChecked, disabled, onCheckedChange, onClick, onKeyDown, onSelect, ref, type, ...props }: MenubarCheckboxItemProps): React.JSX.Element;
|
|
52
|
+
declare function MenubarRadioItem({ asChild, checked, children, className, disabled, onClick, onKeyDown, onSelect, ref, type, ...props }: MenubarRadioItemProps): React.JSX.Element;
|
|
36
53
|
declare function MenubarSeparator({ className, ref, ...props }: MenubarSeparatorProps): React.JSX.Element;
|
|
37
54
|
declare function MenubarLabel({ className, ref, ...props }: MenubarLabelProps): React.JSX.Element;
|
|
38
55
|
declare function MenubarShortcut({ className, ref, ...props }: MenubarShortcutProps): React.JSX.Element;
|
|
39
56
|
type MenubarComponent = typeof MenubarRoot & {
|
|
57
|
+
CheckboxItem: typeof MenubarCheckboxItem;
|
|
40
58
|
Content: typeof MenubarContent;
|
|
41
59
|
Item: typeof MenubarItem;
|
|
42
60
|
Label: typeof MenubarLabel;
|
|
43
61
|
Menu: typeof MenubarMenu;
|
|
62
|
+
RadioItem: typeof MenubarRadioItem;
|
|
44
63
|
Separator: typeof MenubarSeparator;
|
|
45
64
|
Shortcut: typeof MenubarShortcut;
|
|
46
65
|
Trigger: typeof MenubarTrigger;
|