@carbonid1/design-system 5.10.3 → 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.
- package/dist/ContextMenu/ContextMenu.d.ts +7 -7
- package/dist/Dialog/Dialog.d.ts +39 -0
- package/dist/Dialog/Dialog.js +35 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
- package/themes/dashboard.css +5 -0
- package/themes/reader.css +5 -0
|
@@ -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
|
|
40
|
-
Portal: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react
|
|
41
|
-
Backdrop: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react
|
|
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
|
|
45
|
-
Group: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react
|
|
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
|
|
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
|
|
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
package/themes/dashboard.css
CHANGED
|
@@ -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);
|