@carbonid1/design-system 5.11.0 → 5.12.0

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.
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { ContextMenu as BaseContextMenu } from '@base-ui/react/context-menu';
4
4
  import { ChevronRight } from 'lucide-react';
5
5
  import { cn } from '../helpers/cn/cn';
6
- const popupClasses = 'bg-popover text-popover-foreground border-border z-50 min-w-45 origin-[var(--transform-origin)] rounded-lg border py-1 shadow-lg outline-hidden transition-[transform,opacity] data-[ending-style]:scale-95 data-[ending-style]:opacity-0 data-[starting-style]:scale-95 data-[starting-style]:opacity-0';
6
+ const popupClasses = 'bg-popover text-popover-foreground border-border shadow-popover z-50 min-w-45 origin-[var(--transform-origin)] rounded-lg border py-1 outline-hidden transition-[transform,opacity] data-[ending-style]:scale-95 data-[ending-style]:opacity-0 data-[starting-style]:scale-95 data-[starting-style]:opacity-0';
7
7
  const itemBaseClasses = 'relative flex h-7 cursor-default items-center gap-1.5 px-2.5 text-[0.8rem] outline-hidden select-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4 data-[disabled]:pointer-events-none data-[disabled]:opacity-50';
8
8
  const itemVariantClasses = {
9
9
  default: 'data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground',
@@ -0,0 +1,56 @@
1
+ import { Menu as BaseMenu } from '@base-ui/react/menu';
2
+ import type { ComponentPropsWithoutRef, Ref } from 'react';
3
+ type BasePopupProps = ComponentPropsWithoutRef<typeof BaseMenu.Popup>;
4
+ type BasePositionerProps = ComponentPropsWithoutRef<typeof BaseMenu.Positioner>;
5
+ type BaseItemProps = ComponentPropsWithoutRef<typeof BaseMenu.Item>;
6
+ type BaseSeparatorProps = ComponentPropsWithoutRef<typeof BaseMenu.Separator>;
7
+ type BaseGroupLabelProps = ComponentPropsWithoutRef<typeof BaseMenu.GroupLabel>;
8
+ type BaseSubmenuTriggerProps = ComponentPropsWithoutRef<typeof BaseMenu.SubmenuTrigger>;
9
+ type BaseCheckboxItemProps = ComponentPropsWithoutRef<typeof BaseMenu.CheckboxItem>;
10
+ type BaseRadioItemProps = ComponentPropsWithoutRef<typeof BaseMenu.RadioItem>;
11
+ type ItemVariant = 'default' | 'destructive';
12
+ type PositionerProps = BasePositionerProps & {
13
+ ref?: Ref<HTMLDivElement>;
14
+ };
15
+ type PopupProps = BasePopupProps & {
16
+ ref?: Ref<HTMLDivElement>;
17
+ };
18
+ type SeparatorProps = BaseSeparatorProps & {
19
+ ref?: Ref<HTMLHRElement>;
20
+ };
21
+ type GroupLabelProps = BaseGroupLabelProps & {
22
+ ref?: Ref<HTMLDivElement>;
23
+ };
24
+ type ItemProps = BaseItemProps & {
25
+ ref?: Ref<HTMLDivElement>;
26
+ variant?: ItemVariant;
27
+ };
28
+ type CheckboxItemProps = BaseCheckboxItemProps & {
29
+ ref?: Ref<HTMLDivElement>;
30
+ };
31
+ type RadioItemProps = BaseRadioItemProps & {
32
+ ref?: Ref<HTMLDivElement>;
33
+ };
34
+ type SubmenuTriggerProps = BaseSubmenuTriggerProps & {
35
+ ref?: Ref<HTMLDivElement>;
36
+ };
37
+ export declare const Menu: {
38
+ Root: <Payload>(props: BaseMenu.Root.Props<Payload>) => import("react/jsx-runtime").JSX.Element;
39
+ Trigger: BaseMenu.Trigger;
40
+ Portal: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").ContextMenuPortalProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
41
+ Backdrop: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").ContextMenuBackdropProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
42
+ Positioner: ({ className, sideOffset, ...props }: PositionerProps) => import("react/jsx-runtime").JSX.Element;
43
+ Popup: ({ className, ...props }: PopupProps) => import("react/jsx-runtime").JSX.Element;
44
+ Arrow: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").ContextMenuArrowProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
45
+ Group: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").ContextMenuGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
46
+ GroupLabel: ({ className, ...props }: GroupLabelProps) => import("react/jsx-runtime").JSX.Element;
47
+ Separator: ({ className, ...props }: SeparatorProps) => import("react/jsx-runtime").JSX.Element;
48
+ Item: ({ className, variant, ...props }: ItemProps) => import("react/jsx-runtime").JSX.Element;
49
+ LinkItem: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").ContextMenuLinkItemProps, "ref"> & import("react").RefAttributes<Element>>;
50
+ CheckboxItem: ({ className, children, ...props }: CheckboxItemProps) => import("react/jsx-runtime").JSX.Element;
51
+ RadioGroup: import("react").NamedExoticComponent<Omit<import("@base-ui/react").ContextMenuRadioGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
52
+ RadioItem: ({ className, children, ...props }: RadioItemProps) => import("react/jsx-runtime").JSX.Element;
53
+ SubmenuRoot: typeof BaseMenu.SubmenuRoot;
54
+ SubmenuTrigger: ({ className, children, ...props }: SubmenuTriggerProps) => import("react/jsx-runtime").JSX.Element;
55
+ };
56
+ export {};
@@ -0,0 +1,40 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Menu as BaseMenu } from '@base-ui/react/menu';
4
+ import { ChevronRight } from 'lucide-react';
5
+ import { cn } from '../helpers/cn/cn';
6
+ const popupClasses = 'bg-popover text-popover-foreground border-border shadow-popover z-50 min-w-36 origin-[var(--transform-origin)] rounded-lg border py-1 outline-hidden transition-[transform,opacity] data-[ending-style]:scale-95 data-[ending-style]:opacity-0 data-[starting-style]:scale-95 data-[starting-style]:opacity-0';
7
+ const itemBaseClasses = 'relative flex h-7 cursor-default items-center gap-1.5 px-2.5 text-[0.8rem] outline-hidden select-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4 data-[disabled]:pointer-events-none data-[disabled]:opacity-50';
8
+ const itemVariantClasses = {
9
+ default: 'data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground',
10
+ destructive: 'text-destructive data-[highlighted]:bg-destructive/10 data-[highlighted]:text-destructive',
11
+ };
12
+ const Positioner = ({ className, sideOffset = 4, ...props }) => (_jsx(BaseMenu.Positioner, { sideOffset: sideOffset, className: cn('z-50 outline-hidden', className), ...props }));
13
+ const Popup = ({ className, ...props }) => (_jsx(BaseMenu.Popup, { className: cn(popupClasses, className), ...props }));
14
+ const Item = ({ className, variant = 'default', ...props }) => (_jsx(BaseMenu.Item, { className: cn(itemBaseClasses, itemVariantClasses[variant], className), ...props }));
15
+ const Separator = ({ className, ...props }) => (_jsx(BaseMenu.Separator, { className: cn('bg-border my-1 h-px', className), ...props }));
16
+ const GroupLabel = ({ className, ...props }) => (_jsx(BaseMenu.GroupLabel, { className: cn('text-muted-foreground px-2.5 py-1 text-xs', className), ...props }));
17
+ const CheckboxItem = ({ className, children, ...props }) => (_jsxs(BaseMenu.CheckboxItem, { className: cn(itemBaseClasses, itemVariantClasses.default, 'pl-7', className), ...props, children: [_jsx("span", { "aria-hidden": true, className: "absolute left-2 flex size-3.5 items-center justify-center", children: _jsx(BaseMenu.CheckboxItemIndicator, { className: "size-3.5", children: _jsx(CheckIcon, {}) }) }), children] }));
18
+ const RadioItem = ({ className, children, ...props }) => (_jsxs(BaseMenu.RadioItem, { className: cn(itemBaseClasses, itemVariantClasses.default, 'pl-7', className), ...props, children: [_jsx("span", { "aria-hidden": true, className: "absolute left-2 flex size-3.5 items-center justify-center", children: _jsx(BaseMenu.RadioItemIndicator, { className: "size-3.5", children: _jsx(DotIcon, {}) }) }), children] }));
19
+ const SubmenuTrigger = ({ className, children, ...props }) => (_jsxs(BaseMenu.SubmenuTrigger, { className: cn(itemBaseClasses, itemVariantClasses.default, 'data-popup-open:bg-accent data-popup-open:text-accent-foreground pr-2', className), ...props, children: [children, _jsx(ChevronRight, { className: "ml-auto size-4 opacity-60", "aria-hidden": true })] }));
20
+ const CheckIcon = () => (_jsx("svg", { viewBox: "0 0 14 14", fill: "none", className: "size-3.5", children: _jsx("path", { d: "M3 7.5 6 10.5 11 4.5", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }) }));
21
+ const DotIcon = () => (_jsx("svg", { viewBox: "0 0 14 14", className: "size-3.5", children: _jsx("circle", { cx: "7", cy: "7", r: "3", fill: "currentColor" }) }));
22
+ export const Menu = {
23
+ Root: BaseMenu.Root,
24
+ Trigger: BaseMenu.Trigger,
25
+ Portal: BaseMenu.Portal,
26
+ Backdrop: BaseMenu.Backdrop,
27
+ Positioner,
28
+ Popup,
29
+ Arrow: BaseMenu.Arrow,
30
+ Group: BaseMenu.Group,
31
+ GroupLabel,
32
+ Separator,
33
+ Item,
34
+ LinkItem: BaseMenu.LinkItem,
35
+ CheckboxItem,
36
+ RadioGroup: BaseMenu.RadioGroup,
37
+ RadioItem,
38
+ SubmenuRoot: BaseMenu.SubmenuRoot,
39
+ SubmenuTrigger,
40
+ };
package/dist/index.d.ts CHANGED
@@ -12,6 +12,7 @@ export { Slider } from './Slider/Slider';
12
12
  export { SegmentedControl } from './SegmentedControl/SegmentedControl';
13
13
  export type { SegmentedControlItemProps, SegmentedControlRootProps, SegmentedControlSize, } from './SegmentedControl/SegmentedControl.types';
14
14
  export { ContextMenu } from './ContextMenu/ContextMenu';
15
+ export { Menu } from './Menu/Menu';
15
16
  export { Dialog } from './Dialog/Dialog';
16
17
  export { Select } from './Select/Select';
17
18
  export type { SelectOption, SelectGroup, SelectOptionState, SelectProps, } from './Select/Select.types';
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ export { ProgressRing } from './ProgressRing/ProgressRing';
7
7
  export { Slider } from './Slider/Slider';
8
8
  export { SegmentedControl } from './SegmentedControl/SegmentedControl';
9
9
  export { ContextMenu } from './ContextMenu/ContextMenu';
10
+ export { Menu } from './Menu/Menu';
10
11
  export { Dialog } from './Dialog/Dialog';
11
12
  export { Select } from './Select/Select';
12
13
  export { Table } from './Table/Table';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carbonid1/design-system",
3
- "version": "5.11.0",
3
+ "version": "5.12.0",
4
4
  "description": "Shared React UI primitives + design tokens (themes, postcss config)",
5
5
  "repository": {
6
6
  "type": "git",