@zvk/ui 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/README.md +5 -5
- package/dist/components/accordion/accordion.js +4 -4
- package/dist/components/alert/alert.d.ts +5 -0
- package/dist/components/alert/alert.js +8 -4
- package/dist/components/alert/index.d.ts +1 -1
- package/dist/components/alert-dialog/alert-dialog.js +9 -9
- package/dist/components/avatar/avatar.js +1 -1
- package/dist/components/badge/badge.js +1 -1
- package/dist/components/breadcrumbs/breadcrumbs.js +3 -3
- package/dist/components/button/button.js +46 -2
- package/dist/components/calendar/calendar.js +3 -3
- package/dist/components/card/card.d.ts +5 -0
- package/dist/components/card/card.js +11 -7
- package/dist/components/card/index.d.ts +1 -1
- package/dist/components/carousel/carousel.js +7 -7
- package/dist/components/checkbox/checkbox.js +4 -4
- package/dist/components/code-block/code-block.js +2 -2
- package/dist/components/collapsible/collapsible.js +4 -4
- package/dist/components/combobox/combobox.js +6 -5
- package/dist/components/command/command-filter.d.ts +0 -1
- package/dist/components/command/command-filter.js +0 -3
- package/dist/components/command/command.js +9 -9
- package/dist/components/context-menu/context-menu.js +10 -10
- package/dist/components/conversation/conversation.js +11 -11
- package/dist/components/copy-button/copy-button.js +2 -2
- package/dist/components/date-picker/date-picker.js +1 -1
- package/dist/components/dialog/dialog.js +11 -11
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +1 -1
- package/dist/components/dropdown-menu/dropdown-menu.js +20 -16
- package/dist/components/empty-state/empty-state.js +1 -1
- package/dist/components/error-boundary/error-boundary.js +1 -1
- package/dist/components/field/field.js +4 -4
- package/dist/components/file-upload-input/file-upload-input.js +2 -2
- package/dist/components/form/form.js +6 -6
- package/dist/components/hover-card/hover-card.d.ts +1 -1
- package/dist/components/hover-card/hover-card.js +7 -4
- package/dist/components/icon-button/icon-button.js +19 -1
- package/dist/components/index.d.ts +3 -3
- package/dist/components/input/input.js +1 -1
- package/dist/components/label/label.js +1 -1
- package/dist/components/menubar/menubar.js +12 -12
- package/dist/components/pagination/pagination.js +12 -12
- package/dist/components/popover/popover.d.ts +1 -1
- package/dist/components/popover/popover.js +30 -7
- package/dist/components/progress/progress.js +3 -3
- package/dist/components/radio-group/radio-group.js +3 -3
- package/dist/components/responsive-container/responsive-container.js +1 -1
- package/dist/components/scroll-area/scroll-area.js +4 -4
- package/dist/components/sectioned-sidebar-nav/sectioned-sidebar-nav.js +7 -7
- package/dist/components/select/select.js +66 -13
- package/dist/components/separator/separator.js +1 -1
- package/dist/components/sheet/sheet.js +12 -12
- package/dist/components/sidebar-shell/sidebar-shell.js +6 -6
- package/dist/components/skeleton/skeleton.js +1 -1
- package/dist/components/slider/slider.js +1 -1
- package/dist/components/spinner/spinner.js +1 -1
- package/dist/components/stat/stat.js +1 -1
- package/dist/components/switch/switch.js +3 -3
- package/dist/components/table/index.d.ts +1 -1
- package/dist/components/table/table.d.ts +5 -0
- package/dist/components/table/table.js +12 -8
- package/dist/components/tabs/tabs.js +4 -4
- package/dist/components/tabs-with-sidebar/tabs-with-sidebar.js +3 -3
- package/dist/components/textarea/textarea.js +1 -1
- package/dist/components/toast/toast.js +8 -8
- package/dist/components/toggle/toggle.js +1 -1
- package/dist/components/toggle-group/toggle-group.js +1 -1
- package/dist/components/tooltip/tooltip.d.ts +1 -1
- package/dist/components/tooltip/tooltip.js +6 -3
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/use-composed-refs.d.ts +2 -2
- package/dist/hooks/use-controllable-state.d.ts +2 -2
- package/dist/internal/floating/compute-position.js +13 -8
- package/dist/internal/floating/floating-types.d.ts +1 -0
- package/dist/internal/floating/index.d.ts +1 -0
- package/dist/internal/floating/use-floating-position.js +6 -4
- package/dist/internal/overlay-stack/overlay-stack.js +4 -1
- package/dist/styles.css +2066 -2022
- package/dist/tokens/index.d.ts +2 -2
- package/dist/tokens/index.js +1 -1
- package/dist/tokens/token-types.d.ts +5 -5
- package/dist/tokens/tokens.d.ts +16 -10
- package/dist/tokens/tokens.js +16 -10
- package/dist/utils/cn.d.ts +2 -2
- package/dist/utils/index.d.ts +1 -1
- package/package.json +12 -11
|
@@ -15,7 +15,7 @@ function joinIds(ids) {
|
|
|
15
15
|
return value.length > 0 ? value : undefined;
|
|
16
16
|
}
|
|
17
17
|
export function Form({ className, ref, ...props }) {
|
|
18
|
-
return _jsx("form", { ...props, ref: ref, className: cn("
|
|
18
|
+
return _jsx("form", { ...props, ref: ref, className: cn("zvk-ui-form", className) });
|
|
19
19
|
}
|
|
20
20
|
export function FormField({ children, className, disabled, id, invalid, required, ...props }) {
|
|
21
21
|
const generatedId = React.useId();
|
|
@@ -36,14 +36,14 @@ export function FormField({ children, className, disabled, id, invalid, required
|
|
|
36
36
|
registerDescription,
|
|
37
37
|
unregisterDescription
|
|
38
38
|
}), [controlId, descriptionIds, disabled, invalid, registerDescription, required, unregisterDescription]);
|
|
39
|
-
return (_jsx(FormFieldContext.Provider, { value: context, children: _jsx("div", { ...props, className: cn("
|
|
39
|
+
return (_jsx(FormFieldContext.Provider, { value: context, children: _jsx("div", { ...props, className: cn("zvk-ui-form-field", className), "data-disabled": disabled ? "true" : undefined, "data-invalid": invalid ? "true" : undefined, "data-required": required ? "true" : undefined, children: children }) }));
|
|
40
40
|
}
|
|
41
41
|
export function FormItem({ className, ref, ...props }) {
|
|
42
|
-
return _jsx("div", { ...props, ref: ref, className: cn("
|
|
42
|
+
return _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-form-item", className) });
|
|
43
43
|
}
|
|
44
44
|
export function FormLabel({ className, htmlFor, ref, ...props }) {
|
|
45
45
|
const context = useFormFieldContext("FormLabel");
|
|
46
|
-
return _jsx("label", { ...props, ref: ref, className: cn("
|
|
46
|
+
return _jsx("label", { ...props, ref: ref, className: cn("zvk-ui-form-label", className), htmlFor: htmlFor ?? context.controlId });
|
|
47
47
|
}
|
|
48
48
|
export function FormControl({ children }) {
|
|
49
49
|
const context = useFormFieldContext("FormControl");
|
|
@@ -81,8 +81,8 @@ function FormText({ className, id, ref, role, textRole, ...props }) {
|
|
|
81
81
|
return _jsx("p", { ...props, ref: ref, id: textId, role: role, className: className });
|
|
82
82
|
}
|
|
83
83
|
export function FormDescription({ className, ...props }) {
|
|
84
|
-
return _jsx(FormText, { ...props, className: cn("
|
|
84
|
+
return _jsx(FormText, { ...props, className: cn("zvk-ui-form-description", className), textRole: "FormDescription" });
|
|
85
85
|
}
|
|
86
86
|
export function FormMessage({ className, role = "alert", ...props }) {
|
|
87
|
-
return _jsx(FormText, { ...props, className: cn("
|
|
87
|
+
return _jsx(FormText, { ...props, className: cn("zvk-ui-form-message", className), role: role, textRole: "FormMessage" });
|
|
88
88
|
}
|
|
@@ -29,7 +29,7 @@ export interface HoverCardContentProps extends React.HTMLAttributes<HTMLDivEleme
|
|
|
29
29
|
}
|
|
30
30
|
declare function HoverCardRoot({ children, closeDelay, defaultOpen, disabled, onOpenChange, open: openProp, openDelay, placement }: HoverCardProps): React.JSX.Element;
|
|
31
31
|
declare function HoverCardTrigger({ children, asChild: _asChild }: HoverCardTriggerProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
32
|
-
declare function HoverCardContent({ align, alignOffset
|
|
32
|
+
declare function HoverCardContent({ align, alignOffset, children, className, collisionPadding, container, forceMount, id, onBlur, onFocus, onMouseEnter, onMouseLeave, onPointerEnter, onPointerLeave, placement, ref, side, sideOffset, style, ...props }: HoverCardContentProps): React.JSX.Element | null;
|
|
33
33
|
export declare const HoverCard: typeof HoverCardRoot & {
|
|
34
34
|
Trigger: typeof HoverCardTrigger;
|
|
35
35
|
Content: typeof HoverCardContent;
|
|
@@ -10,6 +10,7 @@ import { cn } from "../../utils/cn.js";
|
|
|
10
10
|
import { composeEventHandlers } from "../../utils/compose-event-handlers.js";
|
|
11
11
|
const defaultContentPositioning = {
|
|
12
12
|
sideOffset: 8,
|
|
13
|
+
alignOffset: 0,
|
|
13
14
|
collisionPadding: 0
|
|
14
15
|
};
|
|
15
16
|
const HoverCardContext = React.createContext(null);
|
|
@@ -58,6 +59,7 @@ function HoverCardRoot({ children, closeDelay = 300, defaultOpen = false, disabl
|
|
|
58
59
|
open,
|
|
59
60
|
placement: contentPositioning.placement ?? placement,
|
|
60
61
|
offset: contentPositioning.sideOffset,
|
|
62
|
+
alignmentOffset: contentPositioning.alignOffset,
|
|
61
63
|
collisionPadding: contentPositioning.collisionPadding,
|
|
62
64
|
flip: true,
|
|
63
65
|
shift: true
|
|
@@ -222,7 +224,7 @@ function HoverCardTrigger({ children, asChild: _asChild = false }) {
|
|
|
222
224
|
"aria-describedby": joinIds(typeof childAriaDescribedBy === "string" ? childAriaDescribedBy : undefined, context.open ? context.contentId : undefined),
|
|
223
225
|
"aria-expanded": context.open,
|
|
224
226
|
"aria-haspopup": "dialog",
|
|
225
|
-
className: cn("
|
|
227
|
+
className: cn("zvk-ui-hover-card__trigger", childClassName),
|
|
226
228
|
"data-state": context.open ? "open" : "closed",
|
|
227
229
|
onBlur: composeEventHandlers(childProps.onBlur, (event) => {
|
|
228
230
|
context.closeAfterFocusLeaves(event.relatedTarget);
|
|
@@ -234,7 +236,7 @@ function HoverCardTrigger({ children, asChild: _asChild = false }) {
|
|
|
234
236
|
onPointerLeave: composeEventHandlers(childProps.onPointerLeave, context.closeWithDelay)
|
|
235
237
|
});
|
|
236
238
|
}
|
|
237
|
-
function HoverCardContent({ align, alignOffset
|
|
239
|
+
function HoverCardContent({ align, alignOffset = defaultContentPositioning.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
240
|
const context = useHoverCardContext("HoverCard.Content");
|
|
239
241
|
const contentId = id ?? context.contentId;
|
|
240
242
|
const placementParts = getPlacementParts(context.resolvedPlacement);
|
|
@@ -244,14 +246,15 @@ function HoverCardContent({ align, alignOffset: _alignOffset, children, classNam
|
|
|
244
246
|
setContentPositioning({
|
|
245
247
|
...(resolvedPlacement === undefined ? {} : { placement: resolvedPlacement }),
|
|
246
248
|
sideOffset,
|
|
249
|
+
alignOffset,
|
|
247
250
|
collisionPadding
|
|
248
251
|
});
|
|
249
252
|
return () => setContentPositioning(defaultContentPositioning);
|
|
250
|
-
}, [align, collisionPadding, placement, setContentPositioning, side, sideOffset]);
|
|
253
|
+
}, [align, alignOffset, collisionPadding, placement, setContentPositioning, side, sideOffset]);
|
|
251
254
|
if (!context.open && !forceMount) {
|
|
252
255
|
return null;
|
|
253
256
|
}
|
|
254
|
-
const content = (_jsx("div", { ...props, ref: composeRefs(ref, context.floatingRef), id: contentId, role: "dialog", className: cn("
|
|
257
|
+
const content = (_jsx("div", { ...props, ref: composeRefs(ref, context.floatingRef), id: contentId, role: "dialog", className: cn("zvk-ui-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
258
|
context.closeAfterFocusLeaves(event.relatedTarget);
|
|
256
259
|
}), 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
260
|
if (!context.open) {
|
|
@@ -2,7 +2,25 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { Spinner } from "../spinner/spinner.js";
|
|
4
4
|
import { cn } from "../../utils/cn.js";
|
|
5
|
+
function isDevelopmentEnvironment() {
|
|
6
|
+
const runtimeProcess = globalThis.process;
|
|
7
|
+
if (runtimeProcess?.env?.NODE_ENV) {
|
|
8
|
+
return runtimeProcess.env.NODE_ENV !== "production";
|
|
9
|
+
}
|
|
10
|
+
const metaEnv = import.meta.env;
|
|
11
|
+
if (typeof metaEnv?.DEV === "boolean") {
|
|
12
|
+
return metaEnv.DEV;
|
|
13
|
+
}
|
|
14
|
+
if (typeof metaEnv?.PROD === "boolean") {
|
|
15
|
+
return !metaEnv.PROD;
|
|
16
|
+
}
|
|
17
|
+
return typeof metaEnv?.MODE === "string" && metaEnv.MODE !== "production";
|
|
18
|
+
}
|
|
5
19
|
export function IconButton({ children, className, disabled, loading = false, ref, size = "md", type = "button", variant = "secondary", ...props }) {
|
|
6
20
|
const isDisabled = disabled || loading;
|
|
7
|
-
|
|
21
|
+
const hasAccessibleName = props["aria-label"] !== undefined || props["aria-labelledby"] !== undefined;
|
|
22
|
+
if (!hasAccessibleName && isDevelopmentEnvironment()) {
|
|
23
|
+
console.warn("IconButton requires an accessible name. Provide aria-label or aria-labelledby.");
|
|
24
|
+
}
|
|
25
|
+
return (_jsx("button", { ...props, ref: ref, "aria-busy": loading ? true : undefined, className: cn("zvk-ui-icon-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(Spinner, { size: "sm" }) : children }));
|
|
8
26
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { Accordion } from "./accordion/index.js";
|
|
2
2
|
export type { AccordionContentProps, AccordionItemProps, AccordionProps, AccordionTriggerProps, AccordionType, AccordionValue } from "./accordion/index.js";
|
|
3
3
|
export { Alert } from "./alert/index.js";
|
|
4
|
-
export type { AlertDescriptionProps, AlertProps, AlertRoot, AlertTitleProps, AlertTone } from "./alert/index.js";
|
|
4
|
+
export type { AlertActionProps, AlertDescriptionProps, AlertProps, AlertRoot, AlertTitleProps, AlertTone } from "./alert/index.js";
|
|
5
5
|
export { Avatar } from "./avatar/index.js";
|
|
6
6
|
export type { AvatarProps, AvatarShape, AvatarSize } from "./avatar/index.js";
|
|
7
7
|
export { Badge } from "./badge/index.js";
|
|
@@ -11,7 +11,7 @@ export type { BreadcrumbsItemProps, BreadcrumbsProps } from "./breadcrumbs/index
|
|
|
11
11
|
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
|
-
export type { CardDescriptionProps, CardPadding, CardProps, CardSlotProps, CardTitleProps, CardVariant } from "./card/index.js";
|
|
14
|
+
export type { CardActionProps, CardDescriptionProps, CardPadding, CardProps, CardSlotProps, CardTitleProps, CardVariant } from "./card/index.js";
|
|
15
15
|
export { Calendar } from "./calendar/index.js";
|
|
16
16
|
export type { CalendarClassNames, CalendarMode, CalendarNativeProps, CalendarProps, CalendarSingleProps } from "./calendar/index.js";
|
|
17
17
|
export { Carousel } from "./carousel/index.js";
|
|
@@ -91,7 +91,7 @@ export type { StatProps, StatSize, StatTone } from "./stat/index.js";
|
|
|
91
91
|
export { Switch } from "./switch/index.js";
|
|
92
92
|
export type { SwitchProps, SwitchSize } from "./switch/index.js";
|
|
93
93
|
export { Table } from "./table/index.js";
|
|
94
|
-
export type { TableBodyProps, TableCaptionProps, TableCellProps, TableFooterProps, TableHeadProps, TableHeaderProps, TableProps, TableRowProps } from "./table/index.js";
|
|
94
|
+
export type { TableBodyProps, TableCaptionProps, TableCellProps, TableContainerProps, TableFooterProps, TableHeadProps, TableHeaderProps, TableProps, TableRowProps } from "./table/index.js";
|
|
95
95
|
export { Tabs } from "./tabs/index.js";
|
|
96
96
|
export type { TabsActivationMode, TabsContentProps, TabsListProps, TabsOrientation, TabsProps, TabsTriggerProps } from "./tabs/index.js";
|
|
97
97
|
export { TabsWithSidebar } from "./tabs-with-sidebar/index.js";
|
|
@@ -19,7 +19,7 @@ export function Input({ "aria-describedby": ariaDescribedBy, className, descript
|
|
|
19
19
|
const descriptionId = hasDescription ? `${inputId}-description` : undefined;
|
|
20
20
|
const errorId = hasError ? `${inputId}-error` : undefined;
|
|
21
21
|
const describedBy = joinIds(ariaDescribedBy, descriptionId, errorId);
|
|
22
|
-
const input = (_jsx("input", { ...props, ref: ref, "aria-describedby": describedBy, "aria-invalid": invalidState ? true : undefined, className: cn("
|
|
22
|
+
const input = (_jsx("input", { ...props, ref: ref, "aria-describedby": describedBy, "aria-invalid": invalidState ? true : undefined, className: cn("zvk-ui-input", className), "data-disabled": disabled ? "true" : undefined, "data-invalid": invalidState ? "true" : undefined, "data-required": required ? "true" : undefined, "data-size": size, disabled: disabled, id: inputId, required: required }));
|
|
23
23
|
if (!hasLabel && !hasDescription && !hasError) {
|
|
24
24
|
return input;
|
|
25
25
|
}
|
|
@@ -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 Label({ children, className, disabled, ref, required, size = "md", ...props }) {
|
|
5
|
-
return (_jsx("label", { ...props, ref: ref, className: cn("
|
|
5
|
+
return (_jsx("label", { ...props, ref: ref, className: cn("zvk-ui-label", className), "data-disabled": disabled ? "true" : undefined, "data-required": required ? "true" : undefined, "data-size": size, children: children }));
|
|
6
6
|
}
|
|
@@ -79,7 +79,7 @@ function MenubarRoot({ children, className, defaultValue, onKeyDown, onValueChan
|
|
|
79
79
|
setOpenValue,
|
|
80
80
|
unregisterTrigger
|
|
81
81
|
}), [getTriggers, openValue, registerTrigger, setOpenValue, unregisterTrigger]);
|
|
82
|
-
return (_jsx(MenubarContext.Provider, { value: contextValue, children: _jsx("div", { ...props, ref: ref, role: "menubar", className: cn("
|
|
82
|
+
return (_jsx(MenubarContext.Provider, { value: contextValue, children: _jsx("div", { ...props, ref: ref, role: "menubar", className: cn("zvk-ui-menubar", className), onKeyDown: composeEventHandlers(onKeyDown, (event) => {
|
|
83
83
|
const triggers = getTriggers();
|
|
84
84
|
const index = activeIndex(triggers);
|
|
85
85
|
if (event.key === "ArrowRight") {
|
|
@@ -159,7 +159,7 @@ function MenubarTrigger({ asChild = false, children, className, disabled, onClic
|
|
|
159
159
|
"aria-disabled": disabled ? true : undefined,
|
|
160
160
|
"aria-expanded": menu.open,
|
|
161
161
|
"aria-haspopup": "menu",
|
|
162
|
-
className: cn("
|
|
162
|
+
className: cn("zvk-ui-menubar__trigger", className),
|
|
163
163
|
"data-disabled": disabled ? "true" : undefined,
|
|
164
164
|
"data-state": menu.open ? "open" : "closed",
|
|
165
165
|
onClick: composeEventHandlers(onClick, handleClick),
|
|
@@ -170,7 +170,7 @@ function MenubarTrigger({ asChild = false, children, className, disabled, onClic
|
|
|
170
170
|
}
|
|
171
171
|
return (_jsx("button", { ...props, ref: (node) => {
|
|
172
172
|
setComposedRef(triggerRef, ref, node);
|
|
173
|
-
}, id: menu.triggerId, type: type, role: "menuitem", disabled: disabled, "aria-controls": menu.contentId, "aria-expanded": menu.open ? "true" : "false", "aria-haspopup": "menu", className: cn("
|
|
173
|
+
}, id: menu.triggerId, type: type, role: "menuitem", disabled: disabled, "aria-controls": menu.contentId, "aria-expanded": menu.open ? "true" : "false", "aria-haspopup": "menu", className: cn("zvk-ui-menubar__trigger", className), "data-disabled": disabled ? "true" : undefined, "data-state": menu.open ? "open" : "closed", onClick: triggerProps.onClick, onKeyDown: triggerProps.onKeyDown, children: children }));
|
|
174
174
|
}
|
|
175
175
|
function MenubarContent({ align, alignOffset: _alignOffset, children, className, onKeyDown, ref, side, sideOffset: _sideOffset, ...props }) {
|
|
176
176
|
const menubar = useMenubarContext("Menubar.Content");
|
|
@@ -180,7 +180,7 @@ function MenubarContent({ align, alignOffset: _alignOffset, children, className,
|
|
|
180
180
|
if (!menu.open) {
|
|
181
181
|
return null;
|
|
182
182
|
}
|
|
183
|
-
return (_jsx(Portal, { children: _jsx(DismissableLayer, { open: menu.open, onDismiss: () => menubar.setOpenValue(undefined), children: _jsx("div", { ...props, ref: ref, id: menu.contentId, role: "menu", "aria-label": menu.label, "aria-labelledby": menu.triggerId, className: cn("
|
|
183
|
+
return (_jsx(Portal, { children: _jsx(DismissableLayer, { open: menu.open, onDismiss: () => menubar.setOpenValue(undefined), children: _jsx("div", { ...props, ref: ref, id: menu.contentId, role: "menu", "aria-label": menu.label, "aria-labelledby": menu.triggerId, className: cn("zvk-ui-menubar__content", className), "data-align": contentPlacementParts.align, "data-side": contentPlacementParts.side, onKeyDown: composeEventHandlers(onKeyDown, (event) => {
|
|
184
184
|
const items = menu.getItems();
|
|
185
185
|
const index = activeIndex(items);
|
|
186
186
|
if (event.key === "ArrowDown") {
|
|
@@ -228,7 +228,7 @@ function MenubarItem({ asChild = false, children, className, disabled, onClick,
|
|
|
228
228
|
},
|
|
229
229
|
role: "menuitem",
|
|
230
230
|
"aria-disabled": disabled ? true : undefined,
|
|
231
|
-
className: cn("
|
|
231
|
+
className: cn("zvk-ui-menubar__item", className),
|
|
232
232
|
"data-disabled": disabled ? "true" : undefined,
|
|
233
233
|
onClick: composeEventHandlers(onClick, select),
|
|
234
234
|
onKeyDown: composeEventHandlers(onKeyDown, (event) => {
|
|
@@ -282,7 +282,7 @@ function MenubarCheckboxItem({ asChild = false, checked, children, className, de
|
|
|
282
282
|
role: "menuitemcheckbox",
|
|
283
283
|
"aria-checked": currentChecked,
|
|
284
284
|
"aria-disabled": disabled ? true : undefined,
|
|
285
|
-
className: cn("
|
|
285
|
+
className: cn("zvk-ui-menubar__item", "zvk-ui-menubar__checkbox-item", className),
|
|
286
286
|
"data-checked": currentChecked ? "true" : undefined,
|
|
287
287
|
"data-disabled": disabled ? "true" : undefined,
|
|
288
288
|
onClick: composeEventHandlers(onClick, select),
|
|
@@ -298,7 +298,7 @@ function MenubarCheckboxItem({ asChild = false, checked, children, className, de
|
|
|
298
298
|
}
|
|
299
299
|
return (_jsxs("button", { ...props, ref: (node) => {
|
|
300
300
|
setComposedRef(itemRef, ref, node);
|
|
301
|
-
}, 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"], onClick: itemProps.onClick, onKeyDown: itemProps.onKeyDown, children: [_jsx("span", { className: "
|
|
301
|
+
}, 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"], onClick: itemProps.onClick, onKeyDown: itemProps.onKeyDown, children: [_jsx("span", { className: "zvk-ui-menubar__item-indicator", "aria-hidden": "true", children: currentChecked ? "✓" : "" }), _jsx("span", { className: "zvk-ui-menubar__item-label", children: children })] }));
|
|
302
302
|
}
|
|
303
303
|
function MenubarRadioItem({ asChild = false, checked = false, children, className, disabled, onClick, onKeyDown, onSelect, ref, type = "button", ...props }) {
|
|
304
304
|
const menubar = useMenubarContext("Menubar.RadioItem");
|
|
@@ -331,7 +331,7 @@ function MenubarRadioItem({ asChild = false, checked = false, children, classNam
|
|
|
331
331
|
role: "menuitemradio",
|
|
332
332
|
"aria-checked": checked,
|
|
333
333
|
"aria-disabled": disabled ? true : undefined,
|
|
334
|
-
className: cn("
|
|
334
|
+
className: cn("zvk-ui-menubar__item", "zvk-ui-menubar__radio-item", className),
|
|
335
335
|
"data-checked": checked ? "true" : undefined,
|
|
336
336
|
"data-disabled": disabled ? "true" : undefined,
|
|
337
337
|
onClick: composeEventHandlers(onClick, select),
|
|
@@ -347,16 +347,16 @@ function MenubarRadioItem({ asChild = false, checked = false, children, classNam
|
|
|
347
347
|
}
|
|
348
348
|
return (_jsxs("button", { ...props, ref: (node) => {
|
|
349
349
|
setComposedRef(itemRef, ref, node);
|
|
350
|
-
}, 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"], onClick: itemProps.onClick, onKeyDown: itemProps.onKeyDown, children: [_jsx("span", { className: "
|
|
350
|
+
}, 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"], onClick: itemProps.onClick, onKeyDown: itemProps.onKeyDown, children: [_jsx("span", { className: "zvk-ui-menubar__item-indicator", "aria-hidden": "true", children: checked ? "●" : "" }), _jsx("span", { className: "zvk-ui-menubar__item-label", children: children })] }));
|
|
351
351
|
}
|
|
352
352
|
function MenubarSeparator({ className, ref, ...props }) {
|
|
353
|
-
return _jsx("div", { ...props, ref: ref, role: "separator", "aria-hidden": "true", className: cn("
|
|
353
|
+
return _jsx("div", { ...props, ref: ref, role: "separator", "aria-hidden": "true", className: cn("zvk-ui-menubar__separator", className) });
|
|
354
354
|
}
|
|
355
355
|
function MenubarLabel({ className, ref, ...props }) {
|
|
356
|
-
return _jsx("div", { ...props, ref: ref, className: cn("
|
|
356
|
+
return _jsx("div", { ...props, ref: ref, className: cn("zvk-ui-menubar__label", className) });
|
|
357
357
|
}
|
|
358
358
|
function MenubarShortcut({ className, ref, ...props }) {
|
|
359
|
-
return _jsx("span", { ...props, ref: ref, className: cn("
|
|
359
|
+
return _jsx("span", { ...props, ref: ref, className: cn("zvk-ui-menubar__shortcut", className) });
|
|
360
360
|
}
|
|
361
361
|
export const Menubar = Object.assign(MenubarRoot, {
|
|
362
362
|
CheckboxItem: MenubarCheckboxItem,
|
|
@@ -48,45 +48,45 @@ export function getPaginationRange({ page, pageCount, siblingCount = 1, boundary
|
|
|
48
48
|
function renderPrevious({ hasHrefMode, page, label, pageCount, onPageChange, getPageHref }) {
|
|
49
49
|
const targetPage = page - 1;
|
|
50
50
|
if (hasHrefMode && targetPage >= 1) {
|
|
51
|
-
return (_jsx("a", { className: "
|
|
51
|
+
return (_jsx("a", { className: "zvk-ui-pagination__item", href: getPageHref?.(targetPage), children: label }));
|
|
52
52
|
}
|
|
53
53
|
if (hasHrefMode && targetPage < 1) {
|
|
54
|
-
return (_jsx("span", { className: "
|
|
54
|
+
return (_jsx("span", { className: "zvk-ui-pagination__item zvk-ui-pagination__item--disabled", "aria-hidden": "true", children: label }));
|
|
55
55
|
}
|
|
56
|
-
return (_jsx("button", { className: "
|
|
56
|
+
return (_jsx("button", { className: "zvk-ui-pagination__item", disabled: targetPage < 1, onClick: () => onPageChange?.(Math.max(1, targetPage)), type: "button", children: label }));
|
|
57
57
|
}
|
|
58
58
|
function renderNext({ hasHrefMode, page, label, pageCount, onPageChange, getPageHref }) {
|
|
59
59
|
const targetPage = page + 1;
|
|
60
60
|
if (hasHrefMode && targetPage <= pageCount) {
|
|
61
|
-
return (_jsx("a", { className: "
|
|
61
|
+
return (_jsx("a", { className: "zvk-ui-pagination__item", href: getPageHref?.(targetPage), children: label }));
|
|
62
62
|
}
|
|
63
63
|
if (hasHrefMode && targetPage > pageCount) {
|
|
64
|
-
return (_jsx("span", { className: "
|
|
64
|
+
return (_jsx("span", { className: "zvk-ui-pagination__item zvk-ui-pagination__item--disabled", "aria-hidden": "true", children: label }));
|
|
65
65
|
}
|
|
66
|
-
return (_jsx("button", { className: "
|
|
66
|
+
return (_jsx("button", { className: "zvk-ui-pagination__item", disabled: targetPage > pageCount, onClick: () => onPageChange?.(Math.min(pageCount, targetPage)), type: "button", children: label }));
|
|
67
67
|
}
|
|
68
68
|
function renderPageItem({ hasHrefMode, item, page, onPageChange, getPageHref }) {
|
|
69
69
|
if (item === page) {
|
|
70
70
|
if (hasHrefMode) {
|
|
71
|
-
return (_jsx("a", { "aria-current": "page", className: "
|
|
71
|
+
return (_jsx("a", { "aria-current": "page", className: "zvk-ui-pagination__item zvk-ui-pagination__item--current", href: getPageHref?.(item), children: item }));
|
|
72
72
|
}
|
|
73
|
-
return (_jsx("button", { "aria-current": "page", className: "
|
|
73
|
+
return (_jsx("button", { "aria-current": "page", className: "zvk-ui-pagination__item zvk-ui-pagination__item--current", disabled: true, type: "button", children: item }));
|
|
74
74
|
}
|
|
75
75
|
if (hasHrefMode) {
|
|
76
|
-
return (_jsx("a", { className: "
|
|
76
|
+
return (_jsx("a", { className: "zvk-ui-pagination__item", href: getPageHref?.(item), children: item }));
|
|
77
77
|
}
|
|
78
|
-
return (_jsx("button", { className: "
|
|
78
|
+
return (_jsx("button", { className: "zvk-ui-pagination__item", onClick: () => onPageChange?.(item), type: "button", children: item }));
|
|
79
79
|
}
|
|
80
80
|
export function Pagination({ className, label = "Pagination", onPageChange, getPageHref, page, pageCount, siblingCount = 1, boundaryCount = 1, previousLabel = "Previous", nextLabel = "Next", ref, ...props }) {
|
|
81
81
|
const safePageCount = Math.max(normalizeCount(pageCount, 1), 0);
|
|
82
82
|
const safePage = Math.max(1, Math.min(clamp(page), safePageCount || 1));
|
|
83
83
|
const range = getPaginationRange({ page, pageCount, siblingCount, boundaryCount });
|
|
84
84
|
const isLinkMode = typeof getPageHref === "function";
|
|
85
|
-
return (_jsx("nav", { ...props, ref: ref, "aria-label": props["aria-label"] ?? label, className: cn("
|
|
85
|
+
return (_jsx("nav", { ...props, ref: ref, "aria-label": props["aria-label"] ?? label, className: cn("zvk-ui-pagination", className), children: _jsxs("ol", { className: "zvk-ui-pagination__list", children: [_jsx("li", { children: renderPrevious({ hasHrefMode: isLinkMode, label: previousLabel, onPageChange, page: safePage, pageCount: safePageCount, getPageHref }) }), range.map((item) => (_jsx("li", { children: typeof item === "number" ? (renderPageItem({
|
|
86
86
|
getPageHref,
|
|
87
87
|
hasHrefMode: isLinkMode,
|
|
88
88
|
item,
|
|
89
89
|
onPageChange,
|
|
90
90
|
page: safePage
|
|
91
|
-
})) : (_jsx("span", { "aria-hidden": "true", className: "
|
|
91
|
+
})) : (_jsx("span", { "aria-hidden": "true", className: "zvk-ui-pagination__ellipsis", children: "\u2026" })) }, `${item}-${typeof item === "number" ? item : item}`))), _jsx("li", { children: renderNext({ hasHrefMode: isLinkMode, label: nextLabel, onPageChange, page: safePage, pageCount: safePageCount, getPageHref }) })] }) }));
|
|
92
92
|
}
|
|
@@ -30,7 +30,7 @@ export interface PopoverContentProps extends React.HTMLAttributes<HTMLDivElement
|
|
|
30
30
|
}
|
|
31
31
|
declare function PopoverRoot({ children, className, defaultOpen, modal, onOpenChange, open, placement, ref, ...props }: PopoverProps): React.JSX.Element;
|
|
32
32
|
declare function PopoverTrigger({ asChild, className, disabled, onClick, ref, type, ...props }: PopoverTriggerProps): React.JSX.Element;
|
|
33
|
-
declare function PopoverContent({ align, alignOffset
|
|
33
|
+
declare function PopoverContent({ align, alignOffset, className, container, forceMount, id, disableEscapeKeyDown, disableOutsidePointerDown, ref, placement, side, sideOffset, collisionPadding, matchTriggerWidth, style, ...props }: PopoverContentProps): React.JSX.Element | null;
|
|
34
34
|
export declare const Popover: typeof PopoverRoot & {
|
|
35
35
|
Trigger: typeof PopoverTrigger;
|
|
36
36
|
Content: typeof PopoverContent;
|
|
@@ -11,6 +11,7 @@ import { placementFromSideAlign } from "../../internal/floating/placement-aliase
|
|
|
11
11
|
import { Slot } from "../../internal/slot/index.js";
|
|
12
12
|
const defaultPositioning = {
|
|
13
13
|
sideOffset: 0,
|
|
14
|
+
alignOffset: 0,
|
|
14
15
|
collisionPadding: 0,
|
|
15
16
|
matchTriggerWidth: false
|
|
16
17
|
};
|
|
@@ -55,6 +56,20 @@ function getPlacementParts(placement) {
|
|
|
55
56
|
const [side, align = "center"] = placement.split("-");
|
|
56
57
|
return { side, align };
|
|
57
58
|
}
|
|
59
|
+
function isDevelopmentEnvironment() {
|
|
60
|
+
const runtimeProcess = globalThis.process;
|
|
61
|
+
if (runtimeProcess?.env?.NODE_ENV) {
|
|
62
|
+
return runtimeProcess.env.NODE_ENV !== "production";
|
|
63
|
+
}
|
|
64
|
+
const metaEnv = import.meta.env;
|
|
65
|
+
if (typeof metaEnv?.DEV === "boolean") {
|
|
66
|
+
return metaEnv.DEV;
|
|
67
|
+
}
|
|
68
|
+
if (typeof metaEnv?.PROD === "boolean") {
|
|
69
|
+
return !metaEnv.PROD;
|
|
70
|
+
}
|
|
71
|
+
return typeof metaEnv?.MODE === "string" && metaEnv.MODE !== "production";
|
|
72
|
+
}
|
|
58
73
|
function PopoverRoot({ children, className, defaultOpen = false, modal = false, onOpenChange, open, placement = "bottom", ref, ...props }) {
|
|
59
74
|
const defaultContentId = `${React.useId()}-content`;
|
|
60
75
|
const [contentId, setContentId] = React.useState(defaultContentId);
|
|
@@ -72,6 +87,7 @@ function PopoverRoot({ children, className, defaultOpen = false, modal = false,
|
|
|
72
87
|
open: isOpen,
|
|
73
88
|
placement: contentPositioning.placement ?? placement,
|
|
74
89
|
offset: contentPositioning.sideOffset,
|
|
90
|
+
alignmentOffset: contentPositioning.alignOffset,
|
|
75
91
|
collisionPadding: contentPositioning.collisionPadding,
|
|
76
92
|
matchReferenceWidth: contentPositioning.matchTriggerWidth
|
|
77
93
|
});
|
|
@@ -97,7 +113,7 @@ function PopoverRoot({ children, className, defaultOpen = false, modal = false,
|
|
|
97
113
|
floatingPlacement: resolvedPlacement,
|
|
98
114
|
updatePosition,
|
|
99
115
|
updateContentPositioning
|
|
100
|
-
}, children: _jsx("div", { ...props, ref: handleRef, className: cn("
|
|
116
|
+
}, children: _jsx("div", { ...props, ref: handleRef, className: cn("zvk-ui-popover", className), "data-state": isOpen ? "open" : "closed", children: children }) }));
|
|
101
117
|
}
|
|
102
118
|
function PopoverTrigger({ asChild = false, className, disabled, onClick, ref, type = "button", ...props }) {
|
|
103
119
|
const context = usePopoverContext("Popover.Trigger");
|
|
@@ -112,11 +128,11 @@ function PopoverTrigger({ asChild = false, className, disabled, onClick, ref, ty
|
|
|
112
128
|
mergeRef(ref, node);
|
|
113
129
|
}, [context.referenceRef, ref]);
|
|
114
130
|
if (asChild) {
|
|
115
|
-
return (_jsx(Slot, { ...props, ref: handleRef, "aria-controls": context.contentId, "aria-disabled": disabled ? true : undefined, "aria-expanded": context.open, "aria-haspopup": "dialog", className: cn("
|
|
131
|
+
return (_jsx(Slot, { ...props, ref: handleRef, "aria-controls": context.contentId, "aria-disabled": disabled ? true : undefined, "aria-expanded": context.open, "aria-haspopup": "dialog", className: cn("zvk-ui-popover__trigger", className), "data-disabled": disabled ? "true" : undefined, "data-state": context.open ? "open" : "closed", onClick: composeEventHandlers(onClick, handleClick), children: props.children }));
|
|
116
132
|
}
|
|
117
|
-
return (_jsx("button", { ...props, ref: handleRef, type: type, disabled: disabled, className: cn("
|
|
133
|
+
return (_jsx("button", { ...props, ref: handleRef, type: type, disabled: disabled, className: cn("zvk-ui-popover__trigger", className), "aria-expanded": context.open, "aria-controls": context.contentId, "aria-haspopup": "dialog", "data-state": context.open ? "open" : "closed", onClick: composeEventHandlers(onClick, handleClick) }));
|
|
118
134
|
}
|
|
119
|
-
function PopoverContent({ align, alignOffset
|
|
135
|
+
function PopoverContent({ align, alignOffset = defaultPositioning.alignOffset, className, container, forceMount = false, id, disableEscapeKeyDown = false, disableOutsidePointerDown = false, ref, placement, side, sideOffset = 0, collisionPadding = 0, matchTriggerWidth = false, style, ...props }) {
|
|
120
136
|
const context = usePopoverContext("Popover.Content");
|
|
121
137
|
const { defaultContentId, setContentId } = context;
|
|
122
138
|
const transformOrigin = getTransformOrigin(context.floatingPlacement);
|
|
@@ -129,7 +145,7 @@ function PopoverContent({ align, alignOffset: _alignOffset, className, container
|
|
|
129
145
|
const contentStyle = React.useMemo(() => ({
|
|
130
146
|
...context.floatingStyle,
|
|
131
147
|
...style,
|
|
132
|
-
"--
|
|
148
|
+
"--zvk-ui-popover-transform-origin": transformOrigin
|
|
133
149
|
}), [context.floatingStyle, style, transformOrigin]);
|
|
134
150
|
React.useLayoutEffect(() => {
|
|
135
151
|
setContentId(contentId);
|
|
@@ -152,17 +168,24 @@ function PopoverContent({ align, alignOffset: _alignOffset, className, container
|
|
|
152
168
|
context.updateContentPositioning({
|
|
153
169
|
...(resolvedPlacement === undefined ? {} : { placement: resolvedPlacement }),
|
|
154
170
|
sideOffset,
|
|
171
|
+
alignOffset,
|
|
155
172
|
collisionPadding,
|
|
156
173
|
matchTriggerWidth
|
|
157
174
|
});
|
|
158
175
|
return () => {
|
|
159
176
|
context.updateContentPositioning(defaultPositioning);
|
|
160
177
|
};
|
|
161
|
-
}, [align, context.updateContentPositioning, collisionPadding, matchTriggerWidth, placement, side, sideOffset]);
|
|
178
|
+
}, [align, alignOffset, context.updateContentPositioning, collisionPadding, matchTriggerWidth, placement, side, sideOffset]);
|
|
162
179
|
if (!forceMount && !context.open) {
|
|
163
180
|
return null;
|
|
164
181
|
}
|
|
165
|
-
const content = (_jsx("div", { ...props, ref: handleRef, id: contentId, role: "dialog", className: cn("
|
|
182
|
+
const content = (_jsx("div", { ...props, ref: handleRef, id: contentId, role: "dialog", className: cn("zvk-ui-popover__content", className), "data-align": placementParts.align, "data-side": placementParts.side, "data-state": context.open ? "open" : "closed", hidden: context.open ? undefined : true, style: contentStyle }));
|
|
183
|
+
if (context.open &&
|
|
184
|
+
props["aria-label"] === undefined &&
|
|
185
|
+
props["aria-labelledby"] === undefined &&
|
|
186
|
+
isDevelopmentEnvironment()) {
|
|
187
|
+
console.warn("Popover.Content renders role=\"dialog\" and requires an accessible name. Provide aria-label or aria-labelledby.");
|
|
188
|
+
}
|
|
166
189
|
if (!context.open) {
|
|
167
190
|
return _jsx(Portal, { ...(container === undefined ? {} : { container }), children: content });
|
|
168
191
|
}
|
|
@@ -22,8 +22,8 @@ export function getProgressState({ max = 100, value }) {
|
|
|
22
22
|
export function Progress({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, className, label, max, ref, showValue, size = "md", tone = "primary", value, ...props }) {
|
|
23
23
|
const state = getProgressState({ max, value });
|
|
24
24
|
const valueText = state.percentage === undefined ? undefined : `${Math.round(state.percentage)}%`;
|
|
25
|
-
return (_jsxs("div", { className: "
|
|
25
|
+
return (_jsxs("div", { className: "zvk-ui-progress-group", children: [label ? _jsx("span", { className: "zvk-ui-progress__label", children: label }) : null, _jsx("div", { ...props, ref: ref, "aria-label": ariaLabel ?? (typeof label === "string" ? label : undefined), "aria-labelledby": ariaLabelledBy, "aria-valuemax": state.indeterminate ? undefined : state.max, "aria-valuemin": state.indeterminate ? undefined : 0, "aria-valuenow": state.value, className: cn("zvk-ui-progress", className), "data-indeterminate": state.indeterminate ? "true" : undefined, "data-size": size, "data-tone": tone, role: "progressbar", style: {
|
|
26
26
|
...props.style,
|
|
27
|
-
"--
|
|
28
|
-
}, children: _jsx("span", { className: "
|
|
27
|
+
"--zvk-ui-progress-value": state.percentage === undefined ? undefined : `${state.percentage}%`
|
|
28
|
+
}, children: _jsx("span", { className: "zvk-ui-progress__track", children: _jsx("span", { className: "zvk-ui-progress__indicator" }) }) }), showValue && valueText ? _jsx("span", { className: "zvk-ui-progress__value", children: valueText }) : null] }));
|
|
29
29
|
}
|
|
@@ -28,8 +28,8 @@ function NativeRadioItem({ "aria-describedby": ariaDescribedBy, checked, classNa
|
|
|
28
28
|
const inputId = id ?? generatedId;
|
|
29
29
|
const descriptionId = hasRenderableNode(description) ? `${inputId}-description` : undefined;
|
|
30
30
|
const describedBy = joinIds(ariaDescribedBy, descriptionId);
|
|
31
|
-
const input = (_jsx("input", { ...props, ref: ref, "aria-describedby": describedBy, "aria-invalid": invalid ? true : undefined, checked: checked, className: "
|
|
32
|
-
return (_jsxs("div", { className: cn("
|
|
31
|
+
const input = (_jsx("input", { ...props, ref: ref, "aria-describedby": describedBy, "aria-invalid": invalid ? true : undefined, checked: checked, className: "zvk-ui-radio-group__input", defaultChecked: defaultChecked, disabled: disabled, id: inputId, name: name, onChange: onChange, required: required, type: "radio", value: value }));
|
|
32
|
+
return (_jsxs("div", { className: cn("zvk-ui-radio-group__item", className), children: [_jsxs("label", { className: "zvk-ui-radio-group__option", children: [input, _jsx("span", { className: "zvk-ui-radio-group__control", "aria-hidden": "true" }), hasRenderableNode(label) ? _jsx("span", { className: "zvk-ui-radio-group__label", children: label }) : null] }), hasRenderableNode(description) ? (_jsx("p", { className: "zvk-ui-radio-group__option-description", id: descriptionId, children: description })) : null] }));
|
|
33
33
|
}
|
|
34
34
|
export function RadioGroupItem({ disabled, value, ...props }) {
|
|
35
35
|
const context = useRadioGroupContext("RadioGroup.Item");
|
|
@@ -62,7 +62,7 @@ function RadioGroupRoot({ "aria-describedby": ariaDescribedBy, children, classNa
|
|
|
62
62
|
...(required !== undefined ? { required } : {}),
|
|
63
63
|
...(value !== undefined ? { value } : {})
|
|
64
64
|
}), [baseId, defaultValue, disabled, invalidState, name, onValueChange, required, value]);
|
|
65
|
-
return (_jsx(RadioGroupContext.Provider, { value: context, children: _jsxs("fieldset", { ...props, ref: ref, "aria-describedby": describedBy, className: cn("
|
|
65
|
+
return (_jsx(RadioGroupContext.Provider, { value: context, children: _jsxs("fieldset", { ...props, ref: ref, "aria-describedby": describedBy, className: cn("zvk-ui-radio-group", className), "data-disabled": disabled ? "true" : undefined, "data-invalid": invalidState ? "true" : undefined, "data-orientation": orientation, "data-required": required ? "true" : undefined, "data-size": size, id: id, disabled: disabled, children: [_jsx("legend", { className: "zvk-ui-radio-group__legend", children: label }), _jsxs("div", { className: "zvk-ui-radio-group__items", children: [optionItems, children] }), hasRenderableNode(description) ? _jsx("p", { className: "zvk-ui-radio-group__description", id: descriptionId, children: description }) : null, hasRenderableNode(error) ? _jsx("p", { className: "zvk-ui-radio-group__error", id: errorId, children: error }) : null] }) }));
|
|
66
66
|
}
|
|
67
67
|
export const RadioGroup = Object.assign(RadioGroupRoot, {
|
|
68
68
|
Item: RadioGroupItem
|
|
@@ -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 ResponsiveContainer({ center = true, className, gutter = "md", ref, size = "lg", ...props }) {
|
|
5
|
-
return (_jsx("div", { ...props, ref: ref, className: cn("
|
|
5
|
+
return (_jsx("div", { ...props, ref: ref, className: cn("zvk-ui-responsive-container", className), "data-center": center ? "true" : "false", "data-gutter": gutter, "data-size": size }));
|
|
6
6
|
}
|
|
@@ -10,13 +10,13 @@ function sizeValue(value) {
|
|
|
10
10
|
function ScrollAreaRoot({ className, maxHeight, maxWidth, orientation = "vertical", ref, style, tabIndex = 0, type = "auto", ...props }) {
|
|
11
11
|
const resolvedStyle = {
|
|
12
12
|
...style,
|
|
13
|
-
...(maxHeight !== undefined ? { "--
|
|
14
|
-
...(maxWidth !== undefined ? { "--
|
|
13
|
+
...(maxHeight !== undefined ? { "--zvk-ui-scroll-area-max-height": sizeValue(maxHeight) } : {}),
|
|
14
|
+
...(maxWidth !== undefined ? { "--zvk-ui-scroll-area-max-width": sizeValue(maxWidth) } : {})
|
|
15
15
|
};
|
|
16
|
-
return (_jsx("div", { ...props, ref: ref, className: cn("
|
|
16
|
+
return (_jsx("div", { ...props, ref: ref, className: cn("zvk-ui-scroll-area", className), "data-orientation": orientation, "data-type": type, style: resolvedStyle, tabIndex: tabIndex }));
|
|
17
17
|
}
|
|
18
18
|
function ScrollBar({ className, orientation = "vertical", ref, ...props }) {
|
|
19
|
-
return (_jsx("div", { ...props, ref: ref, "aria-hidden": "true", className: cn("
|
|
19
|
+
return (_jsx("div", { ...props, ref: ref, "aria-hidden": "true", className: cn("zvk-ui-scroll-area__scrollbar", className), "data-orientation": orientation }));
|
|
20
20
|
}
|
|
21
21
|
export const ScrollArea = Object.assign(ScrollAreaRoot, {
|
|
22
22
|
ScrollBar
|
|
@@ -2,23 +2,23 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { cn } from "../../utils/cn.js";
|
|
4
4
|
function SectionedSidebarNavRoot({ className, label = "Sidebar navigation", ref, ...props }) {
|
|
5
|
-
return (_jsx("nav", { ...props, ref: ref, "aria-label": props["aria-label"] ?? label, className: cn("
|
|
5
|
+
return (_jsx("nav", { ...props, ref: ref, "aria-label": props["aria-label"] ?? label, className: cn("zvk-ui-sectioned-sidebar-nav", className) }));
|
|
6
6
|
}
|
|
7
7
|
function SectionedSidebarNavSection({ className, ref, ...props }) {
|
|
8
|
-
return _jsx("section", { ...props, ref: ref, className: cn("
|
|
8
|
+
return _jsx("section", { ...props, ref: ref, className: cn("zvk-ui-sectioned-sidebar-nav__section", className) });
|
|
9
9
|
}
|
|
10
10
|
function SectionedSidebarNavSectionTitle({ className, ref, ...props }) {
|
|
11
|
-
return _jsx("h2", { ...props, ref: ref, className: cn("
|
|
11
|
+
return _jsx("h2", { ...props, ref: ref, className: cn("zvk-ui-sectioned-sidebar-nav__section-title", className) });
|
|
12
12
|
}
|
|
13
13
|
function SectionedSidebarNavList({ className, ref, ...props }) {
|
|
14
|
-
return _jsx("ul", { ...props, ref: ref, className: cn("
|
|
14
|
+
return _jsx("ul", { ...props, ref: ref, className: cn("zvk-ui-sectioned-sidebar-nav__list", className) });
|
|
15
15
|
}
|
|
16
16
|
function SectionedSidebarNavItem(props) {
|
|
17
17
|
const { active = false, badge, className, disabled = false, icon, ...itemProps } = props;
|
|
18
|
-
const content = (_jsxs(_Fragment, { children: [icon ? (_jsx("span", { "aria-hidden": "true", className: "
|
|
18
|
+
const content = (_jsxs(_Fragment, { children: [icon ? (_jsx("span", { "aria-hidden": "true", className: "zvk-ui-sectioned-sidebar-nav__item-icon", children: icon })) : null, _jsx("span", { className: "zvk-ui-sectioned-sidebar-nav__item-label", children: props.children }), badge ? _jsx("span", { className: "zvk-ui-sectioned-sidebar-nav__item-badge", children: badge }) : null] }));
|
|
19
19
|
if ("href" in itemProps && typeof itemProps.href === "string") {
|
|
20
20
|
const { onClick, ref, ...anchorProps } = itemProps;
|
|
21
|
-
return (_jsx("li", { className: "
|
|
21
|
+
return (_jsx("li", { className: "zvk-ui-sectioned-sidebar-nav__item", children: _jsx("a", { ...anchorProps, ref: ref, "aria-current": active ? "page" : undefined, "aria-disabled": disabled ? true : undefined, className: cn("zvk-ui-sectioned-sidebar-nav__item-control", className), "data-disabled": disabled ? "true" : undefined, "data-state": active ? "active" : "inactive", onClick: (event) => {
|
|
22
22
|
if (disabled) {
|
|
23
23
|
event.preventDefault();
|
|
24
24
|
return;
|
|
@@ -27,7 +27,7 @@ function SectionedSidebarNavItem(props) {
|
|
|
27
27
|
}, tabIndex: disabled ? -1 : anchorProps.tabIndex, children: content }) }));
|
|
28
28
|
}
|
|
29
29
|
const { ref, type = "button", ...buttonProps } = itemProps;
|
|
30
|
-
return (_jsx("li", { className: "
|
|
30
|
+
return (_jsx("li", { className: "zvk-ui-sectioned-sidebar-nav__item", children: _jsx("button", { ...buttonProps, ref: ref, className: cn("zvk-ui-sectioned-sidebar-nav__item-control", className), "data-disabled": disabled ? "true" : undefined, "data-state": active ? "active" : "inactive", disabled: disabled, type: type, children: content }) }));
|
|
31
31
|
}
|
|
32
32
|
export const SectionedSidebarNav = Object.assign(SectionedSidebarNavRoot, {
|
|
33
33
|
Section: SectionedSidebarNavSection,
|