@carbonid1/design-system 6.0.0 → 7.0.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.
@@ -2,7 +2,6 @@ import { Dialog as BaseDialog } from '@base-ui/react/dialog';
2
2
  import type { ComponentPropsWithoutRef, Ref } from 'react';
3
3
  type BaseBackdropProps = ComponentPropsWithoutRef<typeof BaseDialog.Backdrop>;
4
4
  type BasePopupProps = ComponentPropsWithoutRef<typeof BaseDialog.Popup>;
5
- type BaseCloseProps = ComponentPropsWithoutRef<typeof BaseDialog.Close>;
6
5
  type BackdropProps = BaseBackdropProps & {
7
6
  ref?: Ref<HTMLDivElement>;
8
7
  };
@@ -12,9 +11,6 @@ type PopupProps = BasePopupProps & {
12
11
  * Set false for bare, transparent content such as a full-bleed media preview. Default true. */
13
12
  surface?: boolean;
14
13
  };
15
- type CloseProps = BaseCloseProps & {
16
- ref?: Ref<HTMLButtonElement>;
17
- };
18
14
  /** Modal/overlay primitive over Base UI Dialog, exposing its compound parts with design-system
19
15
  * styling. Compose `Dialog.Root` → `Dialog.Trigger` + `Dialog.Portal` (holding `Backdrop` + `Popup`).
20
16
  *
@@ -24,7 +20,10 @@ type CloseProps = BaseCloseProps & {
24
20
  *
25
21
  * Placement and size are the caller's job — Base UI's `Popup` isn't self-positioning. Position it
26
22
  * with `fixed` + a translate, and bound a surface panel's width (e.g. `w-[calc(100%-2rem)] max-w-md`)
27
- * so it can't overflow narrow viewports. */
23
+ * so it can't overflow narrow viewports.
24
+ *
25
+ * `Trigger` and `Close` supply behavior without appearance. Compose them through `render` with a
26
+ * `Button` or another appropriate interactive element. */
28
27
  export declare const Dialog: {
29
28
  Root: typeof BaseDialog.Root;
30
29
  Trigger: BaseDialog.Trigger;
@@ -34,6 +33,6 @@ export declare const Dialog: {
34
33
  Viewport: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AlertDialogViewportProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
35
34
  Title: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AlertDialogTitleProps, "ref"> & import("react").RefAttributes<HTMLHeadingElement>>;
36
35
  Description: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AlertDialogDescriptionProps, "ref"> & import("react").RefAttributes<HTMLParagraphElement>>;
37
- Close: ({ className, ...props }: CloseProps) => import("react/jsx-runtime").JSX.Element;
36
+ Close: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AlertDialogCloseProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
38
37
  };
39
38
  export {};
@@ -1,7 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { Dialog as BaseDialog } from '@base-ui/react/dialog';
4
- import { buttonVariants } from '../Button/Button';
5
4
  import { cn } from '../helpers/cn/cn';
6
5
  import { mergeStatefulClassName } from '../helpers/mergeStatefulClassName/mergeStatefulClassName';
7
6
  // Backdrop and popup fade share one duration so the scrim and the modal resolve together. Placement
@@ -12,7 +11,6 @@ const popupBaseClasses = 'outline-hidden z-50 transition-opacity duration-200 da
12
11
  const popupSurfaceClasses = 'bg-popover text-popover-foreground shadow-popover border-border rounded-xl border';
13
12
  const Backdrop = ({ className, ...props }) => (_jsx(BaseDialog.Backdrop, { className: mergeStatefulClassName(backdropClasses, className), ...props }));
14
13
  const Popup = ({ className, surface = true, ...props }) => (_jsx(BaseDialog.Popup, { className: mergeStatefulClassName(cn(popupBaseClasses, surface && popupSurfaceClasses), className), ...props }));
15
- const Close = ({ className, ...props }) => (_jsx(BaseDialog.Close, { className: mergeStatefulClassName(buttonVariants({ variant: 'ghost', size: 'icon' }), className), ...props }));
16
14
  /** Modal/overlay primitive over Base UI Dialog, exposing its compound parts with design-system
17
15
  * styling. Compose `Dialog.Root` → `Dialog.Trigger` + `Dialog.Portal` (holding `Backdrop` + `Popup`).
18
16
  *
@@ -22,7 +20,10 @@ const Close = ({ className, ...props }) => (_jsx(BaseDialog.Close, { className:
22
20
  *
23
21
  * Placement and size are the caller's job — Base UI's `Popup` isn't self-positioning. Position it
24
22
  * with `fixed` + a translate, and bound a surface panel's width (e.g. `w-[calc(100%-2rem)] max-w-md`)
25
- * so it can't overflow narrow viewports. */
23
+ * so it can't overflow narrow viewports.
24
+ *
25
+ * `Trigger` and `Close` supply behavior without appearance. Compose them through `render` with a
26
+ * `Button` or another appropriate interactive element. */
26
27
  export const Dialog = {
27
28
  Root: BaseDialog.Root,
28
29
  Trigger: BaseDialog.Trigger,
@@ -32,5 +33,5 @@ export const Dialog = {
32
33
  Viewport: BaseDialog.Viewport,
33
34
  Title: BaseDialog.Title,
34
35
  Description: BaseDialog.Description,
35
- Close,
36
+ Close: BaseDialog.Close,
36
37
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carbonid1/design-system",
3
- "version": "6.0.0",
3
+ "version": "7.0.0",
4
4
  "description": "Shared React UI primitives + design tokens (themes, postcss config)",
5
5
  "repository": {
6
6
  "type": "git",
@@ -59,6 +59,16 @@ application components that must retain their own design-system styling.
59
59
  ## Buttons & links
60
60
 
61
61
  - **Active/selected state** — pass `selected` (toolbar toggles, segmented controls, filter chips, tabs, nav links). It applies the selection tokens (`bg-primary/10` + `ring-1 ring-primary/20`, tint held on hover); never hand-layer those classes. `selected` is visual only — set the matching ARIA yourself: `aria-pressed` on toggle buttons, `aria-current` on nav links. It rides both `Button` and `buttonVariants(...)`.
62
+ - **Dialog actions** — `Dialog.Trigger` and `Dialog.Close` supply behavior, not button appearance. Compose a `Button` through `render` so one component owns the complete visual contract; don't attach `buttonVariants(...)` to the behavior primitive.
63
+ ```tsx
64
+ <Dialog.Close
65
+ render={
66
+ <Button variant="ghost" size="small">
67
+ Cancel
68
+ </Button>
69
+ }
70
+ />
71
+ ```
62
72
  - **A link that looks like a button** — apply `buttonVariants({ variant, size, selected })` to the `Link`, not `<Button render={<Link/>}>`. Base UI's `Button` is button-semantic: rendering an `<a>` through it either warns or forces `role="button"`, which breaks navigation for screen readers. Keep the element a real link and style it:
63
73
  ```tsx
64
74
  <Link
@@ -76,7 +86,11 @@ application components that must retain their own design-system styling.
76
86
  - **Discrete elements** — rows/cards use `rounded-lg` with `space-y-1` gaps, never flat lists with hairline dividers
77
87
  - **Selection** — `bg-primary/10` tint + `ring-1 ring-primary/20`, never border-left accents
78
88
  - **Hover reveal** — action buttons use `opacity-0 group-hover:opacity-100 group-focus-within:opacity-100` with outer row `hover:bg-accent`. The `group-focus-within` is required — without it, keyboard users tab to an invisible button.
79
- - **Metadata** — badge/chip components, never comma-separated text
89
+ - **Metadata** — use the quietest representation that preserves scanning. Reserve
90
+ badges/chips for concise categorical states, filters, or individually
91
+ interactive values; prefer secondary text, alignment, grouping, icons, or
92
+ restrained surface tone for routine facts. Do not expose an internal category
93
+ or repeat information merely because a `Badge` primitive exists.
80
94
  - **Touch targets** — icon buttons `p-1.5` minimum, icons `w-4 h-4` minimum
81
95
  - **Avatars** — only with real images, no letter/initial placeholders
82
96