atlas-react-kit 0.9.0 → 0.9.1
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/DESIGN_RULES.md +9 -3
- package/README.md +2 -2
- package/dist/toast.js +23 -11
- package/package.json +1 -1
package/DESIGN_RULES.md
CHANGED
|
@@ -82,9 +82,15 @@ still read normal words.
|
|
|
82
82
|
|
|
83
83
|
## Shape and composition
|
|
84
84
|
|
|
85
|
-
Primitives have square corners. Reserve `rounded-full` for dots, avatars,
|
|
86
|
-
other circles. Card and dialog titles already use
|
|
87
|
-
`font-heading` styling.
|
|
85
|
+
Primitives have square corners. Reserve `rounded-full` for dots, avatars,
|
|
86
|
+
other circles, and the toast close badge. Card and dialog titles already use
|
|
87
|
+
uppercase, tracked `font-heading` styling. Toasts are overlay popovers with
|
|
88
|
+
the same square corners and Alert padding (`px-4 py-3`). The close control is
|
|
89
|
+
a circular badge centred on the top-right corner (half outside the border),
|
|
90
|
+
not a control in the text row. A plain `toast()` has no icon — status icons
|
|
91
|
+
belong to `success`, `info`, `warning`, `error`, and `loading`. Tone colors
|
|
92
|
+
the icon, title, and border, not the body. Width is the content up to 356px,
|
|
93
|
+
or the viewport minus gutters on small screens.
|
|
88
94
|
|
|
89
95
|
Use `EmptyPanel` for empty states, `TableBodySkeleton` for loading table bodies,
|
|
90
96
|
and `<Card flush>` for an edge-to-edge list or table. `Table` scrolls wide
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ keeping locally (`InfoTip`, `ColorLegend`, `SearchPicker`, `Markdown`,
|
|
|
7
7
|
React 19 and Tailwind 4 are required.
|
|
8
8
|
|
|
9
9
|
```sh
|
|
10
|
-
npm install --save-exact atlas-react-kit@0.9.
|
|
10
|
+
npm install --save-exact atlas-react-kit@0.9.1
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
Import components by subpath:
|
|
@@ -129,7 +129,7 @@ artifact with the package owner's npm login:
|
|
|
129
129
|
```sh
|
|
130
130
|
mkdir -p release-artifacts
|
|
131
131
|
npm pack --pack-destination release-artifacts
|
|
132
|
-
npm publish ./release-artifacts/atlas-react-kit-0.9.
|
|
132
|
+
npm publish ./release-artifacts/atlas-react-kit-0.9.1.tgz --access public
|
|
133
133
|
```
|
|
134
134
|
|
|
135
135
|
See [CONTRIBUTING.md](./CONTRIBUTING.md) for adding components, the browser
|
package/dist/toast.js
CHANGED
|
@@ -37,23 +37,35 @@ const toast = Object.assign(show(sonnerToast), {
|
|
|
37
37
|
/**
|
|
38
38
|
* Toasts drawn entirely with kit classes. Sonner's own styles are unlayered
|
|
39
39
|
* CSS that Tailwind utilities cannot override, so the toaster runs Sonner
|
|
40
|
-
* `unstyled` and styles every part here
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
40
|
+
* `unstyled` and styles every part here.
|
|
41
|
+
*
|
|
42
|
+
* Icon policy: a plain `toast()` has no icon. `success`, `info`, `warning`,
|
|
43
|
+
* `error`, and `loading` each show a status icon. Tone colors the icon, title,
|
|
44
|
+
* and border (same approach as Alert), not the body text.
|
|
45
|
+
*
|
|
46
|
+
* Close button: a circular badge centred on the top-right corner (`-top-2
|
|
47
|
+
* -right-2`, half outside the border). Ghost / icon-xs still supplies the
|
|
48
|
+
* shared focus ring, but Sonner's unlayered `[data-button]` default
|
|
49
|
+
* (`background: var(--normal-text)`) and the dark `[data-close-button]` rule
|
|
50
|
+
* (not gated on `data-styled`) would paint a foreground square. Important
|
|
51
|
+
* popover fill, border, and muted text beat those fills. The 24px hit area
|
|
52
|
+
* is the badge itself; the X is 12px. `overflow-visible` on the toast and
|
|
53
|
+
* toaster keeps stacked badges from being clipped.
|
|
44
54
|
*/
|
|
45
55
|
const classNames = {
|
|
46
|
-
toast: "flex w-(
|
|
56
|
+
toast: "relative flex w-max max-w-[min(356px,calc(100vw-2rem))] flex-wrap items-center justify-end gap-x-3 gap-y-2 overflow-visible rounded-none border border-border bg-popover px-4 py-3 text-sm text-popover-foreground shadow-md",
|
|
47
57
|
// Fills the row beside the icon, so action buttons wrap to their own row
|
|
48
|
-
// (aligned right by the toast's justify-end).
|
|
49
|
-
|
|
58
|
+
// (aligned right by the toast's justify-end). Without an icon the basis
|
|
59
|
+
// falls back to the title's width, so a one-word toast stays compact.
|
|
60
|
+
content: "flex min-w-0 flex-1 basis-full flex-col gap-1 [[data-icon]+&]:basis-[calc(100%-1.75rem)]",
|
|
50
61
|
title: "font-medium leading-5",
|
|
51
62
|
description: "leading-5 text-muted-foreground",
|
|
52
|
-
icon: "
|
|
63
|
+
icon: "flex size-4 shrink-0 items-center justify-center [&_svg]:size-4",
|
|
53
64
|
actionButton: cn(buttonVariants({ size: "xs" }), "shrink-0"),
|
|
54
65
|
cancelButton: cn(buttonVariants({ variant: "outline", size: "xs" }), "shrink-0"),
|
|
55
|
-
closeButton: cn(buttonVariants({ variant: "ghost", size: "icon-xs" }), "absolute top-2 right-2 text-muted-foreground"),
|
|
66
|
+
closeButton: cn(buttonVariants({ variant: "ghost", size: "icon-xs" }), "!absolute !-top-2 !-right-2 !left-auto !z-10 !size-6 !rounded-full !border !border-border !bg-popover !p-0 !text-muted-foreground !shadow-xs !translate-x-0 !translate-y-0 hover:!border-border hover:!bg-popover hover:!text-foreground focus-visible:!text-foreground active:!translate-y-0 [&_svg]:!size-3"),
|
|
56
67
|
success: "border-success/40 [&_[data-title]]:text-success",
|
|
68
|
+
info: "[&_[data-title]]:text-foreground",
|
|
57
69
|
warning: "border-warning/40 [&_[data-title]]:text-warning",
|
|
58
70
|
error: "border-destructive/40 [&_[data-title]]:text-destructive",
|
|
59
71
|
};
|
|
@@ -63,7 +75,7 @@ const icons = {
|
|
|
63
75
|
warning: _jsx(CircleAlertIcon, { "aria-hidden": true, className: "text-warning" }),
|
|
64
76
|
error: _jsx(CircleAlertIcon, { "aria-hidden": true, className: "text-destructive" }),
|
|
65
77
|
loading: (_jsx(LoaderCircleIcon, { "aria-hidden": true, className: "animate-spin text-muted-foreground" })),
|
|
66
|
-
close: _jsx(XIcon, { "aria-hidden": true }),
|
|
78
|
+
close: _jsx(XIcon, { "aria-hidden": true, className: "size-3" }),
|
|
67
79
|
};
|
|
68
80
|
/**
|
|
69
81
|
* Mount one near the app root, and show toasts with `toast()` from this
|
|
@@ -71,6 +83,6 @@ const icons = {
|
|
|
71
83
|
*/
|
|
72
84
|
const Toaster = ({ position, closeButton = true, expand, visibleToasts, duration, }) => {
|
|
73
85
|
const { theme = "system" } = useTheme();
|
|
74
|
-
return (_jsx(Sonner, { theme: theme, className: "toaster group", position: position, closeButton: closeButton, expand: expand, visibleToasts: visibleToasts, duration: duration, icons: icons, toastOptions: { unstyled: true, classNames } }));
|
|
86
|
+
return (_jsx(Sonner, { theme: theme, className: "toaster group overflow-visible", position: position, closeButton: closeButton, expand: expand, visibleToasts: visibleToasts, duration: duration, icons: icons, toastOptions: { unstyled: true, classNames } }));
|
|
75
87
|
};
|
|
76
88
|
export { Toaster, toast };
|