@carbonid1/design-system 6.0.1 → 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.
package/dist/Dialog/Dialog.d.ts
CHANGED
|
@@ -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: (
|
|
36
|
+
Close: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AlertDialogCloseProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
38
37
|
};
|
|
39
38
|
export {};
|
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -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
|
@@ -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
|