@carbonid1/design-system 5.11.0 → 5.13.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
+ };
@@ -0,0 +1,9 @@
1
+ import type { ScrollAreaContentProps, ScrollAreaCornerProps, ScrollAreaRootProps, ScrollAreaScrollbarProps, ScrollAreaThumbProps, ScrollAreaViewportProps } from './ScrollArea.types';
2
+ export declare const ScrollArea: {
3
+ Root: ({ className, ...props }: ScrollAreaRootProps) => import("react/jsx-runtime").JSX.Element;
4
+ Viewport: ({ className, ...props }: ScrollAreaViewportProps) => import("react/jsx-runtime").JSX.Element;
5
+ Content: ({ className, ...props }: ScrollAreaContentProps) => import("react/jsx-runtime").JSX.Element;
6
+ Scrollbar: ({ className, orientation, ...props }: ScrollAreaScrollbarProps) => import("react/jsx-runtime").JSX.Element;
7
+ Thumb: ({ className, ...props }: ScrollAreaThumbProps) => import("react/jsx-runtime").JSX.Element;
8
+ Corner: ({ className, ...props }: ScrollAreaCornerProps) => import("react/jsx-runtime").JSX.Element;
9
+ };
@@ -0,0 +1,19 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { ScrollArea as BaseScrollArea } from '@base-ui/react/scroll-area';
4
+ import { cn } from '../helpers/cn/cn';
5
+ const scrollbarClasses = 'm-1 flex touch-none select-none justify-center rounded-full opacity-0 transition-opacity delay-100 duration-150 data-[hovering]:delay-0 data-[hovering]:opacity-100 data-[scrolling]:opacity-100 motion-reduce:transition-none';
6
+ const Root = ({ className, ...props }) => (_jsx(BaseScrollArea.Root, { className: cn('relative overflow-hidden', className), ...props }));
7
+ const Viewport = ({ className, ...props }) => (_jsx(BaseScrollArea.Viewport, { className: cn('focus-visible:ring-ring/50 h-full w-full overscroll-contain rounded-[inherit] outline-hidden focus-visible:ring-2', className), ...props }));
8
+ const Content = ({ className, ...props }) => (_jsx(BaseScrollArea.Content, { className: cn(className), ...props }));
9
+ const Scrollbar = ({ className, orientation = 'vertical', ...props }) => (_jsx(BaseScrollArea.Scrollbar, { orientation: orientation, className: cn(scrollbarClasses, orientation === 'vertical' && 'w-1.5', orientation === 'horizontal' && 'h-1.5 flex-col', className), ...props }));
10
+ const Thumb = ({ className, ...props }) => (_jsx(BaseScrollArea.Thumb, { className: cn('bg-muted-foreground/30 rounded-full data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full', className), ...props }));
11
+ const Corner = ({ className, ...props }) => (_jsx(BaseScrollArea.Corner, { className: cn('bg-transparent', className), ...props }));
12
+ export const ScrollArea = {
13
+ Root,
14
+ Viewport,
15
+ Content,
16
+ Scrollbar,
17
+ Thumb,
18
+ Corner,
19
+ };
@@ -0,0 +1,20 @@
1
+ import type { ScrollAreaContentProps as BaseContentProps, ScrollAreaCornerProps as BaseCornerProps, ScrollAreaRootProps as BaseRootProps, ScrollAreaScrollbarProps as BaseScrollbarProps, ScrollAreaThumbProps as BaseThumbProps, ScrollAreaViewportProps as BaseViewportProps } from '@base-ui/react/scroll-area';
2
+ import type { Ref } from 'react';
3
+ export type ScrollAreaRootProps = BaseRootProps & {
4
+ ref?: Ref<HTMLDivElement>;
5
+ };
6
+ export type ScrollAreaViewportProps = BaseViewportProps & {
7
+ ref?: Ref<HTMLDivElement>;
8
+ };
9
+ export type ScrollAreaContentProps = BaseContentProps & {
10
+ ref?: Ref<HTMLDivElement>;
11
+ };
12
+ export type ScrollAreaScrollbarProps = BaseScrollbarProps & {
13
+ ref?: Ref<HTMLDivElement>;
14
+ };
15
+ export type ScrollAreaThumbProps = BaseThumbProps & {
16
+ ref?: Ref<HTMLDivElement>;
17
+ };
18
+ export type ScrollAreaCornerProps = BaseCornerProps & {
19
+ ref?: Ref<HTMLDivElement>;
20
+ };
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.d.ts CHANGED
@@ -11,7 +11,10 @@ export { ProgressRing } from './ProgressRing/ProgressRing';
11
11
  export { Slider } from './Slider/Slider';
12
12
  export { SegmentedControl } from './SegmentedControl/SegmentedControl';
13
13
  export type { SegmentedControlItemProps, SegmentedControlRootProps, SegmentedControlSize, } from './SegmentedControl/SegmentedControl.types';
14
+ export { ScrollArea } from './ScrollArea/ScrollArea';
15
+ export type { ScrollAreaContentProps, ScrollAreaCornerProps, ScrollAreaRootProps, ScrollAreaScrollbarProps, ScrollAreaThumbProps, ScrollAreaViewportProps, } from './ScrollArea/ScrollArea.types';
14
16
  export { ContextMenu } from './ContextMenu/ContextMenu';
17
+ export { Menu } from './Menu/Menu';
15
18
  export { Dialog } from './Dialog/Dialog';
16
19
  export { Select } from './Select/Select';
17
20
  export type { SelectOption, SelectGroup, SelectOptionState, SelectProps, } from './Select/Select.types';
package/dist/index.js CHANGED
@@ -6,7 +6,9 @@ export { Text, textVariants } from './Text/Text';
6
6
  export { ProgressRing } from './ProgressRing/ProgressRing';
7
7
  export { Slider } from './Slider/Slider';
8
8
  export { SegmentedControl } from './SegmentedControl/SegmentedControl';
9
+ export { ScrollArea } from './ScrollArea/ScrollArea';
9
10
  export { ContextMenu } from './ContextMenu/ContextMenu';
11
+ export { Menu } from './Menu/Menu';
10
12
  export { Dialog } from './Dialog/Dialog';
11
13
  export { Select } from './Select/Select';
12
14
  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.13.0",
4
4
  "description": "Shared React UI primitives + design tokens (themes, postcss config)",
5
5
  "repository": {
6
6
  "type": "git",