@carbonid1/design-system 5.10.2 → 5.11.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.
@@ -36,19 +36,19 @@ type SubmenuTriggerProps = BaseSubmenuTriggerProps & {
36
36
  };
37
37
  export declare const ContextMenu: {
38
38
  Root: typeof BaseContextMenu.Root;
39
- Trigger: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react/context-menu").ContextMenuTriggerProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
40
- Portal: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react/menu").MenuPortalProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
41
- Backdrop: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react/menu").MenuBackdropProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
39
+ Trigger: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").ContextMenuTriggerProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
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
42
  Positioner: ({ className, sideOffset, ...props }: PositionerProps) => import("react/jsx-runtime").JSX.Element;
43
43
  Popup: ({ className, ...props }: PopupProps) => import("react/jsx-runtime").JSX.Element;
44
- Arrow: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react/menu").MenuArrowProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
45
- Group: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react/menu").MenuGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
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
46
  GroupLabel: ({ className, ...props }: GroupLabelProps) => import("react/jsx-runtime").JSX.Element;
47
47
  Separator: ({ className, ...props }: SeparatorProps) => import("react/jsx-runtime").JSX.Element;
48
48
  Item: ({ className, variant, ...props }: ItemProps) => import("react/jsx-runtime").JSX.Element;
49
- LinkItem: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react/menu").MenuLinkItemProps, "ref"> & import("react").RefAttributes<Element>>;
49
+ LinkItem: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").ContextMenuLinkItemProps, "ref"> & import("react").RefAttributes<Element>>;
50
50
  CheckboxItem: ({ className, children, ...props }: CheckboxItemProps) => import("react/jsx-runtime").JSX.Element;
51
- RadioGroup: import("react").NamedExoticComponent<Omit<import("@base-ui/react/menu").MenuRadioGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
51
+ RadioGroup: import("react").NamedExoticComponent<Omit<import("@base-ui/react").ContextMenuRadioGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
52
52
  RadioItem: ({ className, children, ...props }: RadioItemProps) => import("react/jsx-runtime").JSX.Element;
53
53
  SubmenuRoot: typeof BaseContextMenu.SubmenuRoot;
54
54
  SubmenuTrigger: ({ className, children, ...props }: SubmenuTriggerProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,39 @@
1
+ import { Dialog as BaseDialog } from '@base-ui/react/dialog';
2
+ import type { ComponentPropsWithoutRef, Ref } from 'react';
3
+ type BaseBackdropProps = ComponentPropsWithoutRef<typeof BaseDialog.Backdrop>;
4
+ type BasePopupProps = ComponentPropsWithoutRef<typeof BaseDialog.Popup>;
5
+ type BaseCloseProps = ComponentPropsWithoutRef<typeof BaseDialog.Close>;
6
+ type BackdropProps = BaseBackdropProps & {
7
+ ref?: Ref<HTMLDivElement>;
8
+ };
9
+ type PopupProps = BasePopupProps & {
10
+ ref?: Ref<HTMLDivElement>;
11
+ /** Render the popup as an elevated card surface (popover background, border, shadow, radius).
12
+ * Set false for bare, transparent content such as a full-bleed media preview. Default true. */
13
+ surface?: boolean;
14
+ };
15
+ type CloseProps = BaseCloseProps & {
16
+ ref?: Ref<HTMLButtonElement>;
17
+ };
18
+ /** Modal/overlay primitive over Base UI Dialog, exposing its compound parts with design-system
19
+ * styling. Compose `Dialog.Root` → `Dialog.Trigger` + `Dialog.Portal` (holding `Backdrop` + `Popup`).
20
+ *
21
+ * A11y: give every dialog an accessible name — render a `Dialog.Title` (Base UI wires
22
+ * `aria-labelledby` to it; wrap it in `sr-only` when the title shouldn't show, e.g. an image preview)
23
+ * or set `aria-label` on the `Popup`. Omitting both produces an unlabelled dialog.
24
+ *
25
+ * Placement and size are the caller's job — Base UI's `Popup` isn't self-positioning. Position it
26
+ * 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. */
28
+ export declare const Dialog: {
29
+ Root: typeof BaseDialog.Root;
30
+ Trigger: BaseDialog.Trigger;
31
+ Portal: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AlertDialogPortalProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
32
+ Backdrop: ({ className, ...props }: BackdropProps) => import("react/jsx-runtime").JSX.Element;
33
+ Popup: ({ className, surface, ...props }: PopupProps) => import("react/jsx-runtime").JSX.Element;
34
+ Viewport: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AlertDialogViewportProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
35
+ Title: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AlertDialogTitleProps, "ref"> & import("react").RefAttributes<HTMLHeadingElement>>;
36
+ 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;
38
+ };
39
+ export {};
@@ -0,0 +1,35 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Dialog as BaseDialog } from '@base-ui/react/dialog';
4
+ import { buttonVariants } from '../Button/Button';
5
+ import { cn } from '../helpers/cn/cn';
6
+ // Backdrop and popup fade share one duration so the scrim and the modal resolve together. Placement
7
+ // and size stay the caller's job — Base UI's Dialog.Popup isn't self-positioning, and consumers
8
+ // legitimately differ (a centred lightbox vs a command palette pinned near the top).
9
+ const backdropClasses = 'bg-overlay fixed inset-0 z-40 transition-opacity duration-200 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 motion-reduce:transition-none';
10
+ const popupBaseClasses = 'outline-hidden z-50 transition-opacity duration-200 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 motion-reduce:transition-none';
11
+ const popupSurfaceClasses = 'bg-popover text-popover-foreground shadow-popover border-border rounded-xl border';
12
+ const Backdrop = ({ className, ...props }) => (_jsx(BaseDialog.Backdrop, { className: cn(backdropClasses, className), ...props }));
13
+ const Popup = ({ className, surface = true, ...props }) => (_jsx(BaseDialog.Popup, { className: cn(popupBaseClasses, surface && popupSurfaceClasses, className), ...props }));
14
+ const Close = ({ className, ...props }) => (_jsx(BaseDialog.Close, { className: cn(buttonVariants({ variant: 'ghost', size: 'icon' }), className), ...props }));
15
+ /** Modal/overlay primitive over Base UI Dialog, exposing its compound parts with design-system
16
+ * styling. Compose `Dialog.Root` → `Dialog.Trigger` + `Dialog.Portal` (holding `Backdrop` + `Popup`).
17
+ *
18
+ * A11y: give every dialog an accessible name — render a `Dialog.Title` (Base UI wires
19
+ * `aria-labelledby` to it; wrap it in `sr-only` when the title shouldn't show, e.g. an image preview)
20
+ * or set `aria-label` on the `Popup`. Omitting both produces an unlabelled dialog.
21
+ *
22
+ * Placement and size are the caller's job — Base UI's `Popup` isn't self-positioning. Position it
23
+ * with `fixed` + a translate, and bound a surface panel's width (e.g. `w-[calc(100%-2rem)] max-w-md`)
24
+ * so it can't overflow narrow viewports. */
25
+ export const Dialog = {
26
+ Root: BaseDialog.Root,
27
+ Trigger: BaseDialog.Trigger,
28
+ Portal: BaseDialog.Portal,
29
+ Backdrop,
30
+ Popup,
31
+ Viewport: BaseDialog.Viewport,
32
+ Title: BaseDialog.Title,
33
+ Description: BaseDialog.Description,
34
+ Close,
35
+ };
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 { Dialog } from './Dialog/Dialog';
15
16
  export { Select } from './Select/Select';
16
17
  export type { SelectOption, SelectGroup, SelectOptionState, SelectProps, } from './Select/Select.types';
17
18
  export { Table } from './Table/Table';
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 { Dialog } from './Dialog/Dialog';
10
11
  export { Select } from './Select/Select';
11
12
  export { Table } from './Table/Table';
12
13
  export { TableScrollRegion } from './TableScrollRegion/TableScrollRegion';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carbonid1/design-system",
3
- "version": "5.10.2",
3
+ "version": "5.11.0",
4
4
  "description": "Shared React UI primitives + design tokens (themes, postcss config)",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,9 +29,9 @@ When a consumer needs something the system doesn't have — a token, a variant,
29
29
 
30
30
  ## Adding a semantic color token
31
31
 
32
- 1. Define the token in **both** `themes/reader.css` and `themes/dashboard.css`, in both `:root` and `.dark`. Use `oklch` for perceptual uniformity. Light and dark values may use different hue families if the role reads better that way.
32
+ 1. Define the token in **both** `themes/reader.css` and `themes/dashboard.css`, in both `:root` and `.dark`. Match the existing perceptual color format for uniformity. Light and dark values may use different hue families if the role reads better that way.
33
33
  2. Bridge it in the `@theme inline` block in each theme CSS so Tailwind generates utilities (`--color-my-token: var(--my-token);`).
34
- 3. Use it via Tailwind classes in components (`bg-my-token`, `text-my-token-foreground`). Opacity modifiers like `bg-my-token/10` work natively on oklch variables.
34
+ 3. Use it via Tailwind classes in components (`bg-my-token`, `text-my-token-foreground`). Opacity modifiers like `bg-my-token/10` work natively on those color variables.
35
35
 
36
36
  Use enough sub-variants for depth — don't squeeze a semantic color into just `base + foreground` when the role needs distinct text/background/border values. Opacity modifiers are a poor substitute for dedicated tokens tuned per role.
37
37
 
@@ -48,7 +48,8 @@ Use enough sub-variants for depth — don't squeeze a semantic color into just `
48
48
 
49
49
  - **Stories for everything visual** — `Component.stories.tsx`, one story per visual state, each rendering under both palettes × both modes (the `.storybook/preview.ts` toolbar switchers prove it in isolation before shipping). Story-level `.test()` methods for interaction behavior. **Vitest** for non-visual helpers in `src/helpers/`.
50
50
  - **Run the story tests** through the Storybook MCP (`run-story-tests`) in a self-healing loop until interaction + a11y pass.
51
- - **Prove it downstream.** The real proof a change works is at least one app or fixture outside the package rendering it; a primitive that typechecks can still look wrong under a palette you never opened.
51
+ - **UI/UX Pro Max accessibility review** — For any visual, interactive, or token change, invoke the UI/UX Pro Max plugin review lens when available (prefer `ui-ux-pro-max:design-system` for primitives and tokens, `ui-ux-pro-max:ui-styling` for component styling, and `ui-ux-pro-max:ui-ux-pro-max` when unsure) and let it choose the relevant checks for the diff. The review must still cover keyboard navigation, visible focus states, contrast, accessible names/ARIA, screen-reader semantics, responsive behavior, interaction states, and reduced-motion behavior where they apply. In the handoff, name the lens used and summarize findings; for non-visual package housekeeping, say it does not apply. Package rules stay authoritative over broad style suggestions.
52
+ - **Prove it downstream.** The real proof a change works is at least one app or fixture outside the package rendering it; a primitive that type-checks can still look wrong under a palette you never opened.
52
53
 
53
54
  ## Releasing — how a change reaches consumers
54
55
 
@@ -32,6 +32,7 @@
32
32
  --color-card-foreground: var(--card-foreground);
33
33
  --color-popover: var(--popover);
34
34
  --color-popover-foreground: var(--popover-foreground);
35
+ --color-overlay: var(--overlay);
35
36
  --color-surface-inset: var(--surface-inset);
36
37
  --shadow-card: var(--card-shadow);
37
38
  --shadow-popover: var(--popover-shadow);
@@ -106,6 +107,9 @@
106
107
  --card-foreground: oklch(0.145 0 0);
107
108
  --popover: oklch(1 0 0);
108
109
  --popover-foreground: oklch(0.145 0 0);
110
+ /* Modal scrim behind dialogs. A neutral black dim, not a palette surface, so it reads the same
111
+ * in reader and dashboard; heavier in dark mode to still separate the popup from an already-dark page. */
112
+ --overlay: oklch(0 0 0 / 0.6);
109
113
  --surface-inset: oklch(0.965 0 0);
110
114
  --card-shadow: 0 1px 2px 0 oklch(0.2 0 0 / 0.06);
111
115
  --popover-shadow: 0 8px 24px -4px oklch(0.2 0 0 / 0.1), 0 4px 8px -2px oklch(0.2 0 0 / 0.06);
@@ -150,6 +154,7 @@
150
154
  --card-foreground: oklch(0.967 0.003 265);
151
155
  --popover: oklch(0.278 0.03 257);
152
156
  --popover-foreground: oklch(0.967 0.003 265);
157
+ --overlay: oklch(0 0 0 / 0.7);
153
158
  --surface-inset: oklch(0.225 0.028 261);
154
159
  --card-shadow: 0 1px 2px 0 oklch(0 0 0 / 0.2);
155
160
  --popover-shadow: 0 12px 32px -4px oklch(0 0 0 / 0.4), 0 4px 8px -2px oklch(0 0 0 / 0.2);
package/themes/reader.css CHANGED
@@ -54,6 +54,7 @@
54
54
  --color-card-foreground: var(--card-foreground);
55
55
  --color-popover: var(--popover);
56
56
  --color-popover-foreground: var(--popover-foreground);
57
+ --color-overlay: var(--overlay);
57
58
  --color-surface-inset: var(--surface-inset);
58
59
  --shadow-card: var(--card-shadow);
59
60
  --shadow-popover: var(--popover-shadow);
@@ -128,6 +129,9 @@
128
129
  --card-foreground: oklch(0.145 0 0);
129
130
  --popover: oklch(0.995 0.003 75);
130
131
  --popover-foreground: oklch(0.145 0 0);
132
+ /* Modal scrim behind dialogs. A neutral black dim, not a palette surface, so it reads the same
133
+ * in reader and dashboard; heavier in dark mode to still separate the popup from an already-dark page. */
134
+ --overlay: oklch(0 0 0 / 0.6);
131
135
  --surface-inset: oklch(0.962 0.007 75);
132
136
  /* Shadows tinted with the warm hue so they read as ambient occlusion on
133
137
  * paper, not pure black smudges. */
@@ -175,6 +179,7 @@
175
179
  --card-foreground: oklch(0.967 0.003 265);
176
180
  --popover: oklch(0.278 0.03 257);
177
181
  --popover-foreground: oklch(0.967 0.003 265);
182
+ --overlay: oklch(0 0 0 / 0.7);
178
183
  /* Inset/card delta is wider than light mode — lightness differences read
179
184
  * as weaker in the dark range, so the recess needs more room to land. */
180
185
  --surface-inset: oklch(0.225 0.028 261);