@olwiba/cn 0.1.52 → 0.1.53
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/index.js +52 -25
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5266,24 +5266,46 @@ var Toaster = ({
|
|
|
5266
5266
|
line-height: 1.45;
|
|
5267
5267
|
opacity: 0.75;
|
|
5268
5268
|
}
|
|
5269
|
-
/*
|
|
5269
|
+
/* Grid rather than sonner's flex row.
|
|
5270
|
+
Three things have to hold at once: the icon keeps its own column to
|
|
5271
|
+
the left of the text, it sits at the top of that column rather than
|
|
5272
|
+
centred, and the action takes a second row beneath the text instead of
|
|
5273
|
+
running inline at the end of the first.
|
|
5274
|
+
|
|
5270
5275
|
sonner centres every child, which is right for a one-line toast and
|
|
5271
|
-
steadily worse as it grows: with a title, a description and an
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5276
|
+
steadily worse as it grows: with a title, a description and an action
|
|
5277
|
+
the icon drifts to the middle of a three-line block and stops reading
|
|
5278
|
+
as the marker for the line it belongs to. Toasts have no height limit,
|
|
5279
|
+
so that only gets worse the taller they are.
|
|
5280
|
+
|
|
5281
|
+
Flex could not express the third without disturbing the first.
|
|
5282
|
+
Forcing a wrap with flex-basis: 100% and then clamping the width back
|
|
5283
|
+
with max-content does nothing, because flex line-breaking measures the
|
|
5284
|
+
item *after* max-width is applied: the button stayed narrow and stayed
|
|
5285
|
+
inline. Stating the placement is shorter than coaxing it. */
|
|
5275
5286
|
[data-sonner-toaster] [data-sonner-toast][data-styled='true'] {
|
|
5276
|
-
|
|
5277
|
-
|
|
5287
|
+
display: grid;
|
|
5288
|
+
grid-template-columns: auto minmax(0, 1fr);
|
|
5289
|
+
align-items: start;
|
|
5290
|
+
column-gap: 6px;
|
|
5291
|
+
row-gap: 0.5rem;
|
|
5278
5292
|
}
|
|
5279
5293
|
[data-sonner-toaster] [data-sonner-toast][data-styled='true'] [data-icon] {
|
|
5294
|
+
grid-column: 1;
|
|
5295
|
+
grid-row: 1;
|
|
5280
5296
|
/* Optical centring against the title's first line, not its box. */
|
|
5281
5297
|
margin-top: 0.0625rem;
|
|
5282
5298
|
}
|
|
5283
5299
|
[data-sonner-toaster] [data-sonner-toast][data-styled='true'] [data-content] {
|
|
5284
|
-
|
|
5300
|
+
grid-column: 2;
|
|
5301
|
+
grid-row: 1;
|
|
5285
5302
|
min-width: 0;
|
|
5286
5303
|
}
|
|
5304
|
+
/* A toast with no icon has nothing in column one, which collapses to
|
|
5305
|
+
zero width, so the text still starts at the padding edge. */
|
|
5306
|
+
[data-sonner-toaster] [data-sonner-toast][data-styled='true']:not(:has([data-icon])) [data-content] {
|
|
5307
|
+
grid-column: 1 / -1;
|
|
5308
|
+
}
|
|
5287
5309
|
/* Buttons inherit the toast's own colour rather than the global
|
|
5288
5310
|
primary, so an action on a richColors error still reads against red
|
|
5289
5311
|
instead of disappearing into it. */
|
|
@@ -5293,29 +5315,33 @@ var Toaster = ({
|
|
|
5293
5315
|
font-size: 0.75rem;
|
|
5294
5316
|
font-weight: 500;
|
|
5295
5317
|
}
|
|
5296
|
-
/*
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
close button and leaves it competing with the cross for the same
|
|
5300
|
-
corner. A flex-basis of 100% forces the wrap; max-width: max-content
|
|
5301
|
-
then pulls it back to its label width so it does not become a
|
|
5302
|
-
full-width bar. */
|
|
5318
|
+
/* Second row, under the text and sharing its left edge.
|
|
5319
|
+
justify-self: start keeps it at its label width instead of
|
|
5320
|
+
stretching across the column, which a grid item otherwise does. */
|
|
5303
5321
|
[data-sonner-toaster] [data-sonner-toast][data-styled='true'] [data-action] {
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
margin
|
|
5322
|
+
grid-column: 2;
|
|
5323
|
+
grid-row: 2;
|
|
5324
|
+
justify-self: start;
|
|
5325
|
+
margin: 0;
|
|
5308
5326
|
}
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
edges of title, description and action agree. */
|
|
5312
|
-
[data-sonner-toaster] [data-sonner-toast][data-styled='true']:has([data-icon]) [data-action] {
|
|
5313
|
-
margin-left: calc(1rem + var(--toast-icon-margin-start) + var(--toast-icon-margin-end) + 6px);
|
|
5327
|
+
[data-sonner-toaster] [data-sonner-toast][data-styled='true']:not(:has([data-icon])) [data-action] {
|
|
5328
|
+
grid-column: 1 / -1;
|
|
5314
5329
|
}
|
|
5330
|
+
/* Inverted against the toast: its text colour becomes the fill.
|
|
5331
|
+
This used to read color-mix(in oklab, currentColor 90%, transparent)
|
|
5332
|
+
for the background while the same rule set color: var(--normal-bg).
|
|
5333
|
+
currentColor resolves to the element's own colour, so both ended up
|
|
5334
|
+
as the toast background: a dark button with dark text on a dark
|
|
5335
|
+
toast, invisible and impossible to aim at. Naming the token instead of
|
|
5336
|
+
reaching for currentColor keeps the contrast pair explicit, and still
|
|
5337
|
+
tracks a richColors toast, since sonner sets both variables per type. */
|
|
5315
5338
|
[data-sonner-toaster] [data-sonner-toast][data-styled='true'] [data-action] {
|
|
5316
|
-
background:
|
|
5339
|
+
background: var(--normal-text);
|
|
5317
5340
|
color: var(--normal-bg);
|
|
5318
5341
|
}
|
|
5342
|
+
[data-sonner-toaster] [data-sonner-toast][data-styled='true'] [data-action]:hover {
|
|
5343
|
+
background: color-mix(in oklab, var(--normal-text) 88%, var(--normal-bg));
|
|
5344
|
+
}
|
|
5319
5345
|
[data-sonner-toaster] [data-sonner-toast][data-styled='true'] [data-cancel] {
|
|
5320
5346
|
background: color-mix(in oklab, currentColor 10%, transparent);
|
|
5321
5347
|
color: inherit;
|
|
@@ -5342,6 +5368,7 @@ var Toaster = ({
|
|
|
5342
5368
|
{
|
|
5343
5369
|
theme,
|
|
5344
5370
|
duration,
|
|
5371
|
+
closeButton,
|
|
5345
5372
|
className: cn("toaster group", mode && `toaster-${mode}`, className),
|
|
5346
5373
|
style: { zIndex: 9999999, ...style },
|
|
5347
5374
|
icons: {
|