@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
|
@@ -7,14 +7,15 @@ export interface CollapsibleProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
7
7
|
ref?: React.Ref<HTMLDivElement>;
|
|
8
8
|
}
|
|
9
9
|
export interface CollapsibleTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
10
|
-
|
|
10
|
+
asChild?: boolean;
|
|
11
|
+
ref?: React.Ref<HTMLButtonElement | HTMLElement>;
|
|
11
12
|
}
|
|
12
13
|
export interface CollapsibleContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
13
14
|
forceMount?: boolean;
|
|
14
15
|
ref?: React.Ref<HTMLDivElement>;
|
|
15
16
|
}
|
|
16
17
|
declare function CollapsibleRoot({ children, className, defaultOpen, disabled, onOpenChange, open, ref, ...props }: CollapsibleProps): React.JSX.Element;
|
|
17
|
-
declare function CollapsibleTrigger({ className, disabled, onClick, ref, type, ...props }: CollapsibleTriggerProps): React.JSX.Element;
|
|
18
|
+
declare function CollapsibleTrigger({ asChild, className, disabled, onClick, ref, type, ...props }: CollapsibleTriggerProps): React.JSX.Element;
|
|
18
19
|
declare function CollapsibleContent({ className, forceMount, ref, ...props }: CollapsibleContentProps): React.JSX.Element | null;
|
|
19
20
|
export declare const Collapsible: typeof CollapsibleRoot & {
|
|
20
21
|
Trigger: typeof CollapsibleTrigger;
|
|
@@ -4,6 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
import { composeEventHandlers } from "../../utils/compose-event-handlers.js";
|
|
5
5
|
import { useDisclosure } from "../../hooks/use-disclosure.js";
|
|
6
6
|
import { cn } from "../../utils/cn.js";
|
|
7
|
+
import { Slot } from "../../internal/slot/index.js";
|
|
7
8
|
const CollapsibleContext = React.createContext(null);
|
|
8
9
|
function useCollapsibleContext(calledBy) {
|
|
9
10
|
const context = React.useContext(CollapsibleContext);
|
|
@@ -23,12 +24,15 @@ function CollapsibleRoot({ children, className, defaultOpen = false, disabled =
|
|
|
23
24
|
});
|
|
24
25
|
return (_jsx(CollapsibleContext.Provider, { value: { open: isOpen, setOpen, disabled, contentId, defaultContentId, setContentId }, children: _jsx("div", { ...props, ref: ref, className: cn("liano-collapsible", className), "data-state": isOpen ? "open" : "closed", "data-disabled": disabled ? "true" : undefined, children: children }) }));
|
|
25
26
|
}
|
|
26
|
-
function CollapsibleTrigger({ className, disabled, onClick, ref, type = "button", ...props }) {
|
|
27
|
+
function CollapsibleTrigger({ asChild = false, className, disabled, onClick, ref, type = "button", ...props }) {
|
|
27
28
|
const context = useCollapsibleContext("Collapsible.Trigger");
|
|
28
29
|
const isDisabled = disabled || context.disabled;
|
|
29
30
|
const handleClick = () => {
|
|
30
31
|
context.setOpen((previous) => !previous);
|
|
31
32
|
};
|
|
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("liano-collapsible__trigger", className), "data-disabled": isDisabled ? "true" : undefined, "data-state": context.open ? "open" : "closed", onClick: composeEventHandlers(onClick, isDisabled ? undefined : handleClick), children: props.children }));
|
|
35
|
+
}
|
|
32
36
|
return (_jsx("button", { ...props, ref: ref, className: cn("liano-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 }));
|
|
33
37
|
}
|
|
34
38
|
function CollapsibleContent({ className, forceMount = false, ref, ...props }) {
|
|
@@ -5,9 +5,11 @@ export interface CommandProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
5
5
|
defaultValue?: string;
|
|
6
6
|
onValueChange?: (value: string) => void;
|
|
7
7
|
onItemSelect?: (value: string) => void;
|
|
8
|
+
shouldFilter?: boolean;
|
|
8
9
|
ref?: React.Ref<HTMLDivElement>;
|
|
9
10
|
}
|
|
10
|
-
export interface CommandInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
11
|
+
export interface CommandInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "defaultValue" | "onChange"> {
|
|
12
|
+
onValueChange?: (value: string) => void;
|
|
11
13
|
ref?: React.Ref<HTMLInputElement>;
|
|
12
14
|
}
|
|
13
15
|
export interface CommandListProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
@@ -24,23 +26,27 @@ export interface CommandItemProps extends Omit<React.HTMLAttributes<HTMLDivEleme
|
|
|
24
26
|
disabled?: boolean;
|
|
25
27
|
keywords?: readonly string[];
|
|
26
28
|
onSelect?: (value: string) => void;
|
|
27
|
-
value
|
|
29
|
+
value?: string;
|
|
28
30
|
ref?: React.Ref<HTMLDivElement>;
|
|
29
31
|
}
|
|
30
32
|
export interface CommandSeparatorProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
31
33
|
ref?: React.Ref<HTMLDivElement>;
|
|
32
34
|
}
|
|
35
|
+
export interface CommandShortcutProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
36
|
+
ref?: React.Ref<HTMLSpanElement>;
|
|
37
|
+
}
|
|
33
38
|
export interface CommandDialogProps extends Omit<React.ComponentProps<typeof Dialog>, "defaultValue" | "onChange"> {
|
|
34
39
|
closeOnSelect?: boolean;
|
|
35
40
|
commandLabel?: string;
|
|
36
41
|
}
|
|
37
|
-
declare function CommandRoot({ children, className, defaultValue, onItemSelect, onValueChange, ref, value, ...props }: CommandProps): React.JSX.Element;
|
|
38
|
-
declare function CommandInput({ className, onKeyDown, placeholder, ref, ...props }: CommandInputProps): React.JSX.Element;
|
|
42
|
+
declare function CommandRoot({ children, className, defaultValue, onItemSelect, onValueChange, ref, shouldFilter, value, ...props }: CommandProps): React.JSX.Element;
|
|
43
|
+
declare function CommandInput({ className, onKeyDown, onValueChange, placeholder, ref, value, ...props }: CommandInputProps): React.JSX.Element;
|
|
39
44
|
declare function CommandList({ className, ref, ...props }: CommandListProps): React.JSX.Element;
|
|
40
45
|
declare function CommandEmpty({ className, ref, ...props }: CommandEmptyProps): React.JSX.Element | null;
|
|
41
46
|
declare function CommandGroup({ children, className, heading, ref, ...props }: CommandGroupProps): React.JSX.Element;
|
|
42
47
|
declare function CommandItem({ children, className, disabled, keywords, onClick, onSelect, ref, value, ...props }: CommandItemProps): React.JSX.Element | null;
|
|
43
48
|
declare function CommandSeparator({ className, ref, ...props }: CommandSeparatorProps): React.JSX.Element;
|
|
49
|
+
declare function CommandShortcut({ className, ref, ...props }: CommandShortcutProps): React.JSX.Element;
|
|
44
50
|
export declare function CommandDialog({ children, className, closeOnSelect, commandLabel, onOpenChange, ...props }: CommandDialogProps): React.JSX.Element;
|
|
45
51
|
type CommandComponent = typeof CommandRoot & {
|
|
46
52
|
Dialog: typeof CommandDialog;
|
|
@@ -50,6 +56,7 @@ type CommandComponent = typeof CommandRoot & {
|
|
|
50
56
|
Item: typeof CommandItem;
|
|
51
57
|
List: typeof CommandList;
|
|
52
58
|
Separator: typeof CommandSeparator;
|
|
59
|
+
Shortcut: typeof CommandShortcut;
|
|
53
60
|
};
|
|
54
61
|
export declare const Command: CommandComponent;
|
|
55
62
|
export {};
|
|
@@ -24,7 +24,7 @@ function textFromNode(node) {
|
|
|
24
24
|
}
|
|
25
25
|
return "";
|
|
26
26
|
}
|
|
27
|
-
function CommandRoot({ children, className, defaultValue = "", onItemSelect, onValueChange, ref, value, ...props }) {
|
|
27
|
+
function CommandRoot({ children, className, defaultValue = "", onItemSelect, onValueChange, ref, shouldFilter = true, value, ...props }) {
|
|
28
28
|
const [query, setQuery] = useControllableState({
|
|
29
29
|
...(value !== undefined ? { value } : {}),
|
|
30
30
|
defaultValue,
|
|
@@ -103,12 +103,18 @@ function CommandRoot({ children, className, defaultValue = "", onItemSelect, onV
|
|
|
103
103
|
selectActive,
|
|
104
104
|
selectItem,
|
|
105
105
|
setQuery,
|
|
106
|
+
shouldFilter,
|
|
106
107
|
unregisterItem
|
|
107
|
-
}, children: _jsx("div", { ...props, ref: ref, className: cn("liano-command", className), children: children }) }));
|
|
108
|
+
}, children: _jsx("div", { ...props, ref: ref, className: cn("liano-command", className), "cmdk-root": "", children: children }) }));
|
|
108
109
|
}
|
|
109
|
-
function CommandInput({ className, onKeyDown, placeholder, ref, ...props }) {
|
|
110
|
+
function CommandInput({ className, onKeyDown, onValueChange, placeholder, ref, value, ...props }) {
|
|
110
111
|
const { activeId, inputId, listId, moveActive, query, selectActive, setQuery } = useCommandContext("Command.Input");
|
|
111
|
-
|
|
112
|
+
const inputValue = value ?? query;
|
|
113
|
+
return (_jsx("input", { ...props, ref: ref, id: props.id ?? inputId, role: "searchbox", "aria-activedescendant": activeId, "aria-controls": listId, "aria-autocomplete": "list", className: cn("liano-command__input", className), "cmdk-input": "", onChange: (event) => {
|
|
114
|
+
const nextValue = event.currentTarget.value;
|
|
115
|
+
onValueChange?.(nextValue);
|
|
116
|
+
setQuery(nextValue);
|
|
117
|
+
}, onKeyDown: composeEventHandlers(onKeyDown, (event) => {
|
|
112
118
|
if (event.key === "ArrowDown") {
|
|
113
119
|
event.preventDefault();
|
|
114
120
|
moveActive("next");
|
|
@@ -133,30 +139,31 @@ function CommandInput({ className, onKeyDown, placeholder, ref, ...props }) {
|
|
|
133
139
|
event.preventDefault();
|
|
134
140
|
selectActive();
|
|
135
141
|
}
|
|
136
|
-
}), placeholder: placeholder, value:
|
|
142
|
+
}), placeholder: placeholder, value: inputValue }));
|
|
137
143
|
}
|
|
138
144
|
function CommandList({ className, ref, ...props }) {
|
|
139
145
|
const { listId } = useCommandContext("Command.List");
|
|
140
|
-
return _jsx("div", { ...props, ref: ref, id: props.id ?? listId, role: "listbox", className: cn("liano-command__list", className) });
|
|
146
|
+
return (_jsx("div", { ...props, ref: ref, id: props.id ?? listId, role: "listbox", className: cn("liano-command__list", className), "cmdk-list": "" }));
|
|
141
147
|
}
|
|
142
148
|
function CommandEmpty({ className, ref, ...props }) {
|
|
143
149
|
const { empty } = useCommandContext("Command.Empty");
|
|
144
150
|
if (!empty) {
|
|
145
151
|
return null;
|
|
146
152
|
}
|
|
147
|
-
return _jsx("div", { ...props, ref: ref, className: cn("liano-command__empty", className) });
|
|
153
|
+
return _jsx("div", { ...props, ref: ref, className: cn("liano-command__empty", className), "cmdk-empty": "" });
|
|
148
154
|
}
|
|
149
155
|
function CommandGroup({ children, className, heading, ref, ...props }) {
|
|
150
156
|
const headingId = React.useId();
|
|
151
|
-
return (_jsxs("div", { ...props, ref: ref, role: "group", "aria-labelledby": heading ? headingId : undefined, className: cn("liano-command__group", className), children: [heading ? _jsx("div", { id: headingId, className: "liano-command__group-heading", children: heading }) : null, children] }));
|
|
157
|
+
return (_jsxs("div", { ...props, ref: ref, role: "group", "aria-labelledby": heading ? headingId : undefined, className: cn("liano-command__group", className), "cmdk-group": "", children: [heading ? _jsx("div", { id: headingId, className: "liano-command__group-heading", "cmdk-group-heading": "", children: heading }) : null, children] }));
|
|
152
158
|
}
|
|
153
159
|
function CommandItem({ children, className, disabled, keywords, onClick, onSelect, ref, value, ...props }) {
|
|
154
160
|
const context = useCommandContext("Command.Item");
|
|
155
|
-
const { activeId, query, registerItem, selectItem, unregisterItem } = context;
|
|
161
|
+
const { activeId, query, registerItem, selectItem, shouldFilter, unregisterItem } = context;
|
|
156
162
|
const generatedId = React.useId();
|
|
157
163
|
const id = props.id ?? generatedId;
|
|
158
|
-
const label = textFromNode(children) || value;
|
|
159
|
-
const
|
|
164
|
+
const label = textFromNode(children) || (value ?? "");
|
|
165
|
+
const itemValue = value ?? label;
|
|
166
|
+
const visible = shouldFilter ? commandItemMatches({ label, value: itemValue, keywords }, query) : true;
|
|
160
167
|
const isActive = activeId === id;
|
|
161
168
|
React.useLayoutEffect(() => {
|
|
162
169
|
registerItem(id, {
|
|
@@ -164,22 +171,25 @@ function CommandItem({ children, className, disabled, keywords, onClick, onSelec
|
|
|
164
171
|
keywords,
|
|
165
172
|
label,
|
|
166
173
|
onSelect,
|
|
167
|
-
value,
|
|
174
|
+
value: itemValue,
|
|
168
175
|
visible
|
|
169
176
|
});
|
|
170
177
|
return () => unregisterItem(id);
|
|
171
|
-
}, [disabled, id, keywords, label, onSelect, registerItem, unregisterItem,
|
|
178
|
+
}, [disabled, id, itemValue, keywords, label, onSelect, registerItem, unregisterItem, visible]);
|
|
172
179
|
if (!visible) {
|
|
173
180
|
return null;
|
|
174
181
|
}
|
|
175
|
-
return (_jsx("div", { ...props, ref: ref, id: id, role: "option", "aria-disabled": disabled ? "true" : undefined, "aria-selected": isActive ? "true" : "false", className: cn("liano-command__item", className), "data-disabled": disabled ? "true" : undefined, "data-highlighted": isActive ? "true" : undefined, onClick: composeEventHandlers(onClick, () => {
|
|
182
|
+
return (_jsx("div", { ...props, ref: ref, id: id, role: "option", "aria-disabled": disabled ? "true" : undefined, "aria-selected": isActive ? "true" : "false", className: cn("liano-command__item", className), "cmdk-item": "", "data-disabled": disabled ? "true" : undefined, "data-highlighted": isActive ? "true" : undefined, onClick: composeEventHandlers(onClick, () => {
|
|
176
183
|
if (!disabled) {
|
|
177
184
|
selectItem(id);
|
|
178
185
|
}
|
|
179
186
|
}), children: children }));
|
|
180
187
|
}
|
|
181
188
|
function CommandSeparator({ className, ref, ...props }) {
|
|
182
|
-
return _jsx("div", { ...props, ref: ref, role: "separator", "aria-hidden": "true", className: cn("liano-command__separator", className) });
|
|
189
|
+
return (_jsx("div", { ...props, ref: ref, role: "separator", "aria-hidden": "true", className: cn("liano-command__separator", className), "cmdk-separator": "" }));
|
|
190
|
+
}
|
|
191
|
+
function CommandShortcut({ className, ref, ...props }) {
|
|
192
|
+
return _jsx("span", { ...props, ref: ref, className: cn("liano-command__shortcut", className) });
|
|
183
193
|
}
|
|
184
194
|
export function CommandDialog({ children, className, closeOnSelect = false, commandLabel = "Command menu", onOpenChange, ...props }) {
|
|
185
195
|
const handleItemSelect = React.useCallback(() => {
|
|
@@ -196,5 +206,6 @@ export const Command = Object.assign(CommandRoot, {
|
|
|
196
206
|
Input: CommandInput,
|
|
197
207
|
Item: CommandItem,
|
|
198
208
|
List: CommandList,
|
|
199
|
-
Separator: CommandSeparator
|
|
209
|
+
Separator: CommandSeparator,
|
|
210
|
+
Shortcut: CommandShortcut
|
|
200
211
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Command, CommandDialog } from "./command.js";
|
|
2
|
-
export type { CommandDialogProps, CommandEmptyProps, CommandGroupProps, CommandInputProps, CommandItemProps, CommandListProps, CommandProps, CommandSeparatorProps } from "./command.js";
|
|
2
|
+
export type { CommandDialogProps, CommandEmptyProps, CommandGroupProps, CommandInputProps, CommandItemProps, CommandListProps, CommandProps, CommandSeparatorProps, CommandShortcutProps } from "./command.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 ContextMenuProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
4
|
defaultOpen?: boolean;
|
|
4
5
|
onOpenChange?: (open: boolean) => void;
|
|
@@ -6,15 +7,20 @@ export interface ContextMenuProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
6
7
|
ref?: React.Ref<HTMLDivElement>;
|
|
7
8
|
}
|
|
8
9
|
export interface ContextMenuTriggerProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
9
|
-
|
|
10
|
+
asChild?: boolean;
|
|
11
|
+
ref?: React.Ref<HTMLSpanElement | HTMLElement>;
|
|
10
12
|
}
|
|
11
13
|
export interface ContextMenuContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
14
|
+
side?: FloatingSide;
|
|
15
|
+
align?: FloatingAlign;
|
|
16
|
+
alignOffset?: number;
|
|
12
17
|
ref?: React.Ref<HTMLDivElement>;
|
|
13
18
|
}
|
|
14
19
|
export interface ContextMenuItemProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
20
|
+
asChild?: boolean;
|
|
15
21
|
onSelect?: (event: React.SyntheticEvent<HTMLElement>) => void;
|
|
16
22
|
tone?: "default" | "danger";
|
|
17
|
-
ref?: React.Ref<HTMLButtonElement>;
|
|
23
|
+
ref?: React.Ref<HTMLButtonElement | HTMLElement>;
|
|
18
24
|
}
|
|
19
25
|
export interface ContextMenuSeparatorProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
20
26
|
ref?: React.Ref<HTMLDivElement>;
|
|
@@ -27,18 +33,23 @@ export interface ContextMenuCheckboxItemProps extends ContextMenuItemProps {
|
|
|
27
33
|
defaultChecked?: boolean;
|
|
28
34
|
onCheckedChange?: (checked: boolean) => void;
|
|
29
35
|
}
|
|
36
|
+
export interface ContextMenuRadioItemProps extends ContextMenuItemProps {
|
|
37
|
+
checked?: boolean;
|
|
38
|
+
}
|
|
30
39
|
declare function ContextMenuRoot({ children, className, defaultOpen, onOpenChange, open: openProp, ref, ...props }: ContextMenuProps): React.JSX.Element;
|
|
31
|
-
declare function ContextMenuTrigger({ children, className, onContextMenu, onKeyDown, ref, ...props }: ContextMenuTriggerProps): React.JSX.Element;
|
|
32
|
-
declare function ContextMenuContent({ children, className, onKeyDown, ref, style, ...props }: ContextMenuContentProps): React.JSX.Element | null;
|
|
33
|
-
declare function ContextMenuItem({ children, className, disabled, onClick, onKeyDown, onSelect, ref, tone, type, ...props }: ContextMenuItemProps): React.JSX.Element;
|
|
40
|
+
declare function ContextMenuTrigger({ asChild, children, className, onContextMenu, onKeyDown, ref, ...props }: ContextMenuTriggerProps): React.JSX.Element;
|
|
41
|
+
declare function ContextMenuContent({ align, alignOffset: _alignOffset, children, className, onKeyDown, ref, side, style, ...props }: ContextMenuContentProps): React.JSX.Element | null;
|
|
42
|
+
declare function ContextMenuItem({ asChild, children, className, disabled, onClick, onKeyDown, onSelect, ref, tone, type, ...props }: ContextMenuItemProps): React.JSX.Element;
|
|
34
43
|
declare function ContextMenuLabel({ className, ref, ...props }: ContextMenuLabelProps): React.JSX.Element;
|
|
35
|
-
declare function ContextMenuCheckboxItem({ checked, children, className, defaultChecked, disabled, onCheckedChange, onClick, onKeyDown, onSelect, ref, tone, type, ...props }: ContextMenuCheckboxItemProps): React.JSX.Element;
|
|
44
|
+
declare function ContextMenuCheckboxItem({ asChild, checked, children, className, defaultChecked, disabled, onCheckedChange, onClick, onKeyDown, onSelect, ref, tone, type, ...props }: ContextMenuCheckboxItemProps): React.JSX.Element;
|
|
45
|
+
declare function ContextMenuRadioItem({ asChild, checked, children, className, disabled, onClick, onKeyDown, onSelect, ref, tone, type, ...props }: ContextMenuRadioItemProps): React.JSX.Element;
|
|
36
46
|
declare function ContextMenuSeparator({ className, ref, ...props }: ContextMenuSeparatorProps): React.JSX.Element;
|
|
37
47
|
type ContextMenuComponent = typeof ContextMenuRoot & {
|
|
38
48
|
CheckboxItem: typeof ContextMenuCheckboxItem;
|
|
39
49
|
Content: typeof ContextMenuContent;
|
|
40
50
|
Item: typeof ContextMenuItem;
|
|
41
51
|
Label: typeof ContextMenuLabel;
|
|
52
|
+
RadioItem: typeof ContextMenuRadioItem;
|
|
42
53
|
Separator: typeof ContextMenuSeparator;
|
|
43
54
|
Trigger: typeof ContextMenuTrigger;
|
|
44
55
|
};
|
|
@@ -6,7 +6,9 @@ import { cn } from "../../utils/cn.js";
|
|
|
6
6
|
import { useControllableState } from "../../hooks/use-controllable-state.js";
|
|
7
7
|
import { createCollection } from "../../internal/collection/index.js";
|
|
8
8
|
import { DismissableLayer } from "../../internal/dismissable-layer/index.js";
|
|
9
|
+
import { placementFromSideAlign, placementParts } from "../../internal/floating/placement-aliases.js";
|
|
9
10
|
import { Portal } from "../../internal/portal/index.js";
|
|
11
|
+
import { Slot } from "../../internal/slot/index.js";
|
|
10
12
|
const ContextMenuContext = React.createContext(null);
|
|
11
13
|
function useContextMenuContext(calledBy) {
|
|
12
14
|
const context = React.useContext(ContextMenuContext);
|
|
@@ -15,6 +17,18 @@ function useContextMenuContext(calledBy) {
|
|
|
15
17
|
}
|
|
16
18
|
return context;
|
|
17
19
|
}
|
|
20
|
+
function setComposedRef(internalRef, externalRef, node) {
|
|
21
|
+
internalRef.current = node;
|
|
22
|
+
if (typeof externalRef === "function") {
|
|
23
|
+
externalRef(node);
|
|
24
|
+
}
|
|
25
|
+
else if (externalRef !== undefined && externalRef !== null) {
|
|
26
|
+
externalRef.current = node;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function isActivationKey(key) {
|
|
30
|
+
return key === "Enter" || key === " " || key === "Space" || key === "Spacebar";
|
|
31
|
+
}
|
|
18
32
|
function ContextMenuRoot({ children, className, defaultOpen = false, onOpenChange, open: openProp, ref, ...props }) {
|
|
19
33
|
const [open, setOpen] = useControllableState({
|
|
20
34
|
...(openProp !== undefined ? { value: openProp } : {}),
|
|
@@ -58,19 +72,35 @@ function ContextMenuRoot({ children, className, defaultOpen = false, onOpenChang
|
|
|
58
72
|
}), [close, contentId, getItems, open, openAt, point, registerItem, unregisterItem]);
|
|
59
73
|
return (_jsx(ContextMenuContext.Provider, { value: contextValue, children: _jsx("div", { ...props, ref: ref, className: cn("liano-context-menu", className), "data-state": open ? "open" : "closed", children: children }) }));
|
|
60
74
|
}
|
|
61
|
-
function ContextMenuTrigger({ children, className, onContextMenu, onKeyDown, ref, ...props }) {
|
|
75
|
+
function ContextMenuTrigger({ asChild = false, children, className, onContextMenu, onKeyDown, ref, ...props }) {
|
|
62
76
|
const { contentId, open, openAt } = useContextMenuContext("ContextMenu.Trigger");
|
|
63
|
-
|
|
77
|
+
const openFromPoint = (point, restoreFocusTo) => {
|
|
78
|
+
openAt(point, restoreFocusTo);
|
|
79
|
+
};
|
|
80
|
+
const triggerProps = {
|
|
81
|
+
...props,
|
|
82
|
+
ref: ref,
|
|
83
|
+
"aria-controls": contentId,
|
|
84
|
+
"aria-expanded": open,
|
|
85
|
+
className: cn("liano-context-menu__trigger", className),
|
|
86
|
+
"data-state": open ? "open" : "closed",
|
|
87
|
+
onContextMenu: composeEventHandlers(onContextMenu, (event) => {
|
|
64
88
|
event.preventDefault();
|
|
65
|
-
|
|
66
|
-
}),
|
|
89
|
+
openFromPoint({ x: event.clientX, y: event.clientY }, document.activeElement instanceof HTMLElement ? document.activeElement : event.currentTarget);
|
|
90
|
+
}),
|
|
91
|
+
onKeyDown: composeEventHandlers(onKeyDown, (event) => {
|
|
67
92
|
if ((event.shiftKey && event.key === "F10") || event.key === "ContextMenu") {
|
|
68
93
|
event.preventDefault();
|
|
69
94
|
const target = document.activeElement instanceof HTMLElement ? document.activeElement : event.currentTarget;
|
|
70
95
|
const rect = target.getBoundingClientRect();
|
|
71
|
-
|
|
96
|
+
openFromPoint({ x: rect.left, y: rect.bottom }, target);
|
|
72
97
|
}
|
|
73
|
-
})
|
|
98
|
+
})
|
|
99
|
+
};
|
|
100
|
+
if (asChild) {
|
|
101
|
+
return _jsx(Slot, { ...triggerProps, children: children });
|
|
102
|
+
}
|
|
103
|
+
return (_jsx("span", { ...props, ref: ref, "aria-controls": triggerProps["aria-controls"], "aria-expanded": triggerProps["aria-expanded"], className: triggerProps.className, "data-state": triggerProps["data-state"], onContextMenu: triggerProps.onContextMenu, onKeyDown: triggerProps.onKeyDown, children: children }));
|
|
74
104
|
}
|
|
75
105
|
function focusItem(items, index) {
|
|
76
106
|
const enabled = items.filter((item) => item.data.disabled !== true && item.data.ref !== null);
|
|
@@ -84,8 +114,10 @@ function currentIndex(items) {
|
|
|
84
114
|
const enabled = items.filter((item) => item.data.disabled !== true && item.data.ref !== null);
|
|
85
115
|
return enabled.findIndex((item) => item.data.ref === document.activeElement);
|
|
86
116
|
}
|
|
87
|
-
function ContextMenuContent({ children, className, onKeyDown, ref, style, ...props }) {
|
|
117
|
+
function ContextMenuContent({ align, alignOffset: _alignOffset, children, className, onKeyDown, ref, side, style, ...props }) {
|
|
88
118
|
const { close, contentId, getItems, open, point } = useContextMenuContext("ContextMenu.Content");
|
|
119
|
+
const contentPlacement = placementFromSideAlign(side, align, "bottom-start");
|
|
120
|
+
const contentPlacementParts = placementParts(contentPlacement);
|
|
89
121
|
React.useLayoutEffect(() => {
|
|
90
122
|
if (!open) {
|
|
91
123
|
return;
|
|
@@ -95,7 +127,7 @@ function ContextMenuContent({ children, className, onKeyDown, ref, style, ...pro
|
|
|
95
127
|
if (!open) {
|
|
96
128
|
return null;
|
|
97
129
|
}
|
|
98
|
-
return (_jsx(Portal, { children: _jsx(DismissableLayer, { open: open, onDismiss: close, children: _jsx("div", { ...props, ref: ref, id: contentId, role: "menu", className: cn("liano-context-menu__content", className), style: { ...style, left: `${point.x}px`, top: `${point.y}px` }, onKeyDown: composeEventHandlers(onKeyDown, (event) => {
|
|
130
|
+
return (_jsx(Portal, { children: _jsx(DismissableLayer, { open: open, onDismiss: close, children: _jsx("div", { ...props, ref: ref, id: contentId, role: "menu", className: cn("liano-context-menu__content", className), "data-align": contentPlacementParts.align, "data-side": contentPlacementParts.side, style: { ...style, left: `${point.x}px`, top: `${point.y}px` }, onKeyDown: composeEventHandlers(onKeyDown, (event) => {
|
|
99
131
|
const items = getItems();
|
|
100
132
|
const index = currentIndex(items);
|
|
101
133
|
if (event.key === "ArrowDown") {
|
|
@@ -113,7 +145,7 @@ function ContextMenuContent({ children, className, onKeyDown, ref, style, ...pro
|
|
|
113
145
|
}
|
|
114
146
|
}), children: children }) }) }));
|
|
115
147
|
}
|
|
116
|
-
function ContextMenuItem({ children, className, disabled, onClick, onKeyDown, onSelect, ref, tone = "default", type = "button", ...props }) {
|
|
148
|
+
function ContextMenuItem({ asChild = false, children, className, disabled, onClick, onKeyDown, onSelect, ref, tone = "default", type = "button", ...props }) {
|
|
117
149
|
const { close, registerItem, unregisterItem } = useContextMenuContext("ContextMenu.Item");
|
|
118
150
|
const itemId = React.useId();
|
|
119
151
|
const itemRef = React.useRef(null);
|
|
@@ -126,27 +158,39 @@ function ContextMenuItem({ children, className, disabled, onClick, onKeyDown, on
|
|
|
126
158
|
return;
|
|
127
159
|
}
|
|
128
160
|
onSelect?.(event);
|
|
129
|
-
|
|
161
|
+
if (!event.defaultPrevented) {
|
|
162
|
+
close();
|
|
163
|
+
}
|
|
130
164
|
};
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
165
|
+
const itemProps = {
|
|
166
|
+
...props,
|
|
167
|
+
ref: (node) => {
|
|
168
|
+
setComposedRef(itemRef, ref, node);
|
|
169
|
+
},
|
|
170
|
+
role: "menuitem",
|
|
171
|
+
"aria-disabled": disabled ? true : undefined,
|
|
172
|
+
className: cn("liano-context-menu__item", className),
|
|
173
|
+
"data-disabled": disabled ? "true" : undefined,
|
|
174
|
+
"data-tone": tone,
|
|
175
|
+
onClick: composeEventHandlers(onClick, select),
|
|
176
|
+
onKeyDown: composeEventHandlers(onKeyDown, (event) => {
|
|
177
|
+
if (isActivationKey(event.key)) {
|
|
142
178
|
select(event);
|
|
179
|
+
event.preventDefault();
|
|
143
180
|
}
|
|
144
|
-
})
|
|
181
|
+
})
|
|
182
|
+
};
|
|
183
|
+
if (asChild) {
|
|
184
|
+
return _jsx(Slot, { ...itemProps, children: children });
|
|
185
|
+
}
|
|
186
|
+
return (_jsx("button", { ...props, ref: (node) => {
|
|
187
|
+
setComposedRef(itemRef, ref, node);
|
|
188
|
+
}, type: type, role: "menuitem", disabled: disabled, "aria-disabled": itemProps["aria-disabled"], className: itemProps.className, "data-disabled": itemProps["data-disabled"], "data-tone": itemProps["data-tone"], onClick: itemProps.onClick, onKeyDown: itemProps.onKeyDown, children: children }));
|
|
145
189
|
}
|
|
146
190
|
function ContextMenuLabel({ className, ref, ...props }) {
|
|
147
191
|
return _jsx("div", { ...props, ref: ref, className: cn("liano-context-menu__label", className) });
|
|
148
192
|
}
|
|
149
|
-
function ContextMenuCheckboxItem({ checked, children, className, defaultChecked = false, disabled, onCheckedChange, onClick, onKeyDown, onSelect, ref, tone = "default", type = "button", ...props }) {
|
|
193
|
+
function ContextMenuCheckboxItem({ asChild = false, checked, children, className, defaultChecked = false, disabled, onCheckedChange, onClick, onKeyDown, onSelect, ref, tone = "default", type = "button", ...props }) {
|
|
150
194
|
const { close, registerItem, unregisterItem } = useContextMenuContext("ContextMenu.CheckboxItem");
|
|
151
195
|
const itemId = React.useId();
|
|
152
196
|
const itemRef = React.useRef(null);
|
|
@@ -163,24 +207,82 @@ function ContextMenuCheckboxItem({ checked, children, className, defaultChecked
|
|
|
163
207
|
if (disabled) {
|
|
164
208
|
return;
|
|
165
209
|
}
|
|
166
|
-
setCurrentChecked((value) => !value);
|
|
167
210
|
onSelect?.(event);
|
|
168
|
-
|
|
211
|
+
if (!event.defaultPrevented) {
|
|
212
|
+
setCurrentChecked((value) => !value);
|
|
213
|
+
close();
|
|
214
|
+
}
|
|
169
215
|
};
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
216
|
+
const itemProps = {
|
|
217
|
+
...props,
|
|
218
|
+
ref: (node) => {
|
|
219
|
+
setComposedRef(itemRef, ref, node);
|
|
220
|
+
},
|
|
221
|
+
role: "menuitemcheckbox",
|
|
222
|
+
"aria-checked": currentChecked,
|
|
223
|
+
"aria-disabled": disabled ? true : undefined,
|
|
224
|
+
className: cn("liano-context-menu__item", "liano-context-menu__checkbox-item", className),
|
|
225
|
+
"data-checked": currentChecked ? "true" : undefined,
|
|
226
|
+
"data-disabled": disabled ? "true" : undefined,
|
|
227
|
+
"data-tone": tone,
|
|
228
|
+
onClick: composeEventHandlers(onClick, select),
|
|
229
|
+
onKeyDown: composeEventHandlers(onKeyDown, (event) => {
|
|
230
|
+
if (isActivationKey(event.key)) {
|
|
231
|
+
select(event);
|
|
180
232
|
event.preventDefault();
|
|
233
|
+
}
|
|
234
|
+
})
|
|
235
|
+
};
|
|
236
|
+
if (asChild) {
|
|
237
|
+
return _jsx(Slot, { ...itemProps, children: children });
|
|
238
|
+
}
|
|
239
|
+
return (_jsxs("button", { ...props, ref: (node) => {
|
|
240
|
+
setComposedRef(itemRef, ref, node);
|
|
241
|
+
}, type: type, role: "menuitemcheckbox", disabled: disabled, "aria-checked": itemProps["aria-checked"], "aria-disabled": itemProps["aria-disabled"], className: itemProps.className, "data-checked": itemProps["data-checked"], "data-disabled": itemProps["data-disabled"], "data-tone": itemProps["data-tone"], onClick: itemProps.onClick, onKeyDown: itemProps.onKeyDown, children: [_jsx("span", { className: "liano-context-menu__item-indicator", "aria-hidden": "true", children: currentChecked ? "✓" : "" }), _jsx("span", { className: "liano-context-menu__item-label", children: children })] }));
|
|
242
|
+
}
|
|
243
|
+
function ContextMenuRadioItem({ asChild = false, checked = false, children, className, disabled, onClick, onKeyDown, onSelect, ref, tone = "default", type = "button", ...props }) {
|
|
244
|
+
const { close, registerItem, unregisterItem } = useContextMenuContext("ContextMenu.RadioItem");
|
|
245
|
+
const itemId = React.useId();
|
|
246
|
+
const itemRef = React.useRef(null);
|
|
247
|
+
React.useLayoutEffect(() => {
|
|
248
|
+
registerItem(itemId, { disabled, ref: itemRef.current });
|
|
249
|
+
return () => unregisterItem(itemId);
|
|
250
|
+
}, [disabled, itemId, registerItem, unregisterItem]);
|
|
251
|
+
const select = (event) => {
|
|
252
|
+
if (disabled) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
onSelect?.(event);
|
|
256
|
+
if (!event.defaultPrevented) {
|
|
257
|
+
close();
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
const itemProps = {
|
|
261
|
+
...props,
|
|
262
|
+
ref: (node) => {
|
|
263
|
+
setComposedRef(itemRef, ref, node);
|
|
264
|
+
},
|
|
265
|
+
role: "menuitemradio",
|
|
266
|
+
"aria-checked": checked,
|
|
267
|
+
"aria-disabled": disabled ? true : undefined,
|
|
268
|
+
className: cn("liano-context-menu__item", "liano-context-menu__radio-item", className),
|
|
269
|
+
"data-checked": checked ? "true" : undefined,
|
|
270
|
+
"data-disabled": disabled ? "true" : undefined,
|
|
271
|
+
"data-tone": tone,
|
|
272
|
+
onClick: composeEventHandlers(onClick, select),
|
|
273
|
+
onKeyDown: composeEventHandlers(onKeyDown, (event) => {
|
|
274
|
+
if (isActivationKey(event.key)) {
|
|
181
275
|
select(event);
|
|
276
|
+
event.preventDefault();
|
|
182
277
|
}
|
|
183
|
-
})
|
|
278
|
+
})
|
|
279
|
+
};
|
|
280
|
+
if (asChild) {
|
|
281
|
+
return _jsx(Slot, { ...itemProps, children: children });
|
|
282
|
+
}
|
|
283
|
+
return (_jsxs("button", { ...props, ref: (node) => {
|
|
284
|
+
setComposedRef(itemRef, ref, node);
|
|
285
|
+
}, type: type, role: "menuitemradio", disabled: disabled, "aria-checked": itemProps["aria-checked"], "aria-disabled": itemProps["aria-disabled"], className: itemProps.className, "data-checked": itemProps["data-checked"], "data-disabled": itemProps["data-disabled"], "data-tone": itemProps["data-tone"], onClick: itemProps.onClick, onKeyDown: itemProps.onKeyDown, children: [_jsx("span", { className: "liano-context-menu__item-indicator", "aria-hidden": "true", children: checked ? "●" : "" }), _jsx("span", { className: "liano-context-menu__item-label", children: children })] }));
|
|
184
286
|
}
|
|
185
287
|
function ContextMenuSeparator({ className, ref, ...props }) {
|
|
186
288
|
return _jsx("div", { ...props, ref: ref, role: "separator", "aria-hidden": "true", className: cn("liano-context-menu__separator", className) });
|
|
@@ -190,6 +292,7 @@ export const ContextMenu = Object.assign(ContextMenuRoot, {
|
|
|
190
292
|
Content: ContextMenuContent,
|
|
191
293
|
Item: ContextMenuItem,
|
|
192
294
|
Label: ContextMenuLabel,
|
|
295
|
+
RadioItem: ContextMenuRadioItem,
|
|
193
296
|
Separator: ContextMenuSeparator,
|
|
194
297
|
Trigger: ContextMenuTrigger
|
|
195
298
|
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface DatePickerProps {
|
|
3
|
+
label?: React.ReactNode;
|
|
4
|
+
description?: React.ReactNode;
|
|
5
|
+
error?: React.ReactNode;
|
|
6
|
+
value?: Date | null;
|
|
7
|
+
defaultValue?: Date | null;
|
|
8
|
+
onValueChange?: (date: Date | null) => void;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
formatDate?: (date: Date) => string;
|
|
11
|
+
minDate?: Date;
|
|
12
|
+
maxDate?: Date;
|
|
13
|
+
disabledDate?: (date: Date) => boolean;
|
|
14
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
15
|
+
}
|
|
16
|
+
export declare function DatePicker({ defaultValue, description, disabledDate, error, formatDate, label, maxDate, minDate, onValueChange, placeholder, ref, value }: DatePickerProps): React.JSX.Element;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Calendar } from "../calendar/calendar.js";
|
|
5
|
+
import { Field } from "../field/field.js";
|
|
6
|
+
import { Popover } from "../popover/popover.js";
|
|
7
|
+
import { cn } from "../../utils/cn.js";
|
|
8
|
+
function hasRenderableNode(value) {
|
|
9
|
+
return value !== undefined && value !== null && value !== false;
|
|
10
|
+
}
|
|
11
|
+
function joinIds(...ids) {
|
|
12
|
+
const value = ids.filter(Boolean).join(" ");
|
|
13
|
+
return value.length > 0 ? value : undefined;
|
|
14
|
+
}
|
|
15
|
+
function defaultFormatDate(date) {
|
|
16
|
+
return new Intl.DateTimeFormat(undefined, {
|
|
17
|
+
day: "numeric",
|
|
18
|
+
month: "short",
|
|
19
|
+
year: "numeric"
|
|
20
|
+
}).format(date);
|
|
21
|
+
}
|
|
22
|
+
export function DatePicker({ defaultValue = null, description, disabledDate, error, formatDate = defaultFormatDate, label, maxDate, minDate, onValueChange, placeholder = "Select date", ref, value }) {
|
|
23
|
+
const generatedId = React.useId();
|
|
24
|
+
const triggerId = `${generatedId}-trigger`;
|
|
25
|
+
const descriptionId = hasRenderableNode(description) ? `${generatedId}-description` : undefined;
|
|
26
|
+
const errorId = hasRenderableNode(error) ? `${generatedId}-error` : undefined;
|
|
27
|
+
const hasLabel = hasRenderableNode(label);
|
|
28
|
+
const hasError = hasRenderableNode(error);
|
|
29
|
+
const isControlled = value !== undefined;
|
|
30
|
+
const [uncontrolledValue, setUncontrolledValue] = React.useState(defaultValue);
|
|
31
|
+
const [open, setOpen] = React.useState(false);
|
|
32
|
+
const currentValue = isControlled ? value : uncontrolledValue;
|
|
33
|
+
const describedBy = joinIds(descriptionId, errorId);
|
|
34
|
+
const calendarMonth = currentValue ?? minDate ?? undefined;
|
|
35
|
+
const fieldRefProps = ref !== undefined ? { ref } : {};
|
|
36
|
+
const calendarProps = {
|
|
37
|
+
...(calendarMonth !== undefined ? { defaultMonth: calendarMonth } : {}),
|
|
38
|
+
...(disabledDate !== undefined ? { disabledDate } : {}),
|
|
39
|
+
...(maxDate !== undefined ? { maxDate } : {}),
|
|
40
|
+
...(minDate !== undefined ? { minDate } : {})
|
|
41
|
+
};
|
|
42
|
+
const handleSelect = (date) => {
|
|
43
|
+
if (!isControlled) {
|
|
44
|
+
setUncontrolledValue(date);
|
|
45
|
+
}
|
|
46
|
+
onValueChange?.(date);
|
|
47
|
+
setOpen(false);
|
|
48
|
+
};
|
|
49
|
+
return (_jsxs(Field, { className: "liano-date-picker", invalid: hasError, ...fieldRefProps, children: [hasLabel ? _jsx(Field.Label, { htmlFor: triggerId, children: label }) : null, _jsxs(Popover, { open: open, onOpenChange: setOpen, placement: "bottom-start", children: [_jsx(Popover.Trigger, { "aria-describedby": describedBy, "aria-invalid": hasError ? true : undefined, "aria-label": hasLabel ? undefined : "Selected date", className: cn("liano-date-picker__trigger", !currentValue && "liano-date-picker__trigger--placeholder"), id: triggerId, children: _jsx("span", { className: "liano-date-picker__value", children: currentValue ? formatDate(currentValue) : placeholder }) }), _jsx(Popover.Content, { className: "liano-date-picker__content", matchTriggerWidth: false, sideOffset: 4, children: _jsx(Calendar, { ...calendarProps, selected: currentValue, onSelect: handleSelect }) })] }), hasRenderableNode(description) ? _jsx(Field.Description, { id: descriptionId, children: description }) : null, hasError ? _jsx(Field.Error, { id: errorId, children: error }) : null] }));
|
|
50
|
+
}
|