@olwiba/cn 0.1.51 → 0.1.52
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.d.ts +1 -1
- package/dist/index.js +50 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1000,7 +1000,7 @@ declare const Slider: React$1.ForwardRefExoticComponent<SliderProps & React$1.Re
|
|
|
1000
1000
|
|
|
1001
1001
|
type ToasterProps = React$1.ComponentProps<typeof Toaster$1>;
|
|
1002
1002
|
type ToasterMode = "playful" | "smooth";
|
|
1003
|
-
declare const Toaster: ({ mode: modeProp, className, style, duration, ...props }: ToasterProps & {
|
|
1003
|
+
declare const Toaster: ({ mode: modeProp, className, style, duration, closeButton, ...props }: ToasterProps & {
|
|
1004
1004
|
mode?: ToasterMode;
|
|
1005
1005
|
}) => React$1.JSX.Element;
|
|
1006
1006
|
|
package/dist/index.js
CHANGED
|
@@ -5188,6 +5188,12 @@ var Toaster = ({
|
|
|
5188
5188
|
className,
|
|
5189
5189
|
style,
|
|
5190
5190
|
duration = DEFAULT_TOAST_DURATION,
|
|
5191
|
+
// On by default, because the alternative was every consumer deciding
|
|
5192
|
+
// separately: the apps passed `closeButton`, the docs site did not, and the
|
|
5193
|
+
// same component then looked like two different components depending on where
|
|
5194
|
+
// you met it. A toast carrying an action is also one you may want to dismiss
|
|
5195
|
+
// without taking it, and waiting out the timer is not a dismissal.
|
|
5196
|
+
closeButton = true,
|
|
5191
5197
|
...props
|
|
5192
5198
|
}) => {
|
|
5193
5199
|
const theme = useDocumentTheme();
|
|
@@ -5212,13 +5218,18 @@ var Toaster = ({
|
|
|
5212
5218
|
so setting the properties directly is both simpler and no longer
|
|
5213
5219
|
dependent on variables whose declaration site we do not control. */
|
|
5214
5220
|
left: unset;
|
|
5215
|
-
right: 0.
|
|
5216
|
-
top: 0.
|
|
5221
|
+
right: 0.375rem;
|
|
5222
|
+
top: 0.375rem;
|
|
5217
5223
|
height: 1.25rem;
|
|
5218
5224
|
width: 1.25rem;
|
|
5219
5225
|
padding: 0;
|
|
5220
5226
|
border: none;
|
|
5227
|
+
/* The top-right corner is rounded harder than the other three so the
|
|
5228
|
+
hover fill nests inside the toast's own curve. Tucked this close to
|
|
5229
|
+
the corner, a uniformly square-ish button reads as overhanging the
|
|
5230
|
+
card the moment it gains a background. */
|
|
5221
5231
|
border-radius: var(--radius-sm);
|
|
5232
|
+
border-top-right-radius: 0.375rem;
|
|
5222
5233
|
background: transparent;
|
|
5223
5234
|
/* Inherited rather than a fixed token: on a richColors toast the
|
|
5224
5235
|
text is already the only colour guaranteed to read against that
|
|
@@ -5255,6 +5266,24 @@ var Toaster = ({
|
|
|
5255
5266
|
line-height: 1.45;
|
|
5256
5267
|
opacity: 0.75;
|
|
5257
5268
|
}
|
|
5269
|
+
/* Top-aligned rather than centred on the whole card.
|
|
5270
|
+
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
|
+
action, the icon drifts to the middle of a three-line block and
|
|
5273
|
+
stops reading as the marker for the line it belongs to. Toasts have
|
|
5274
|
+
no height limit, so this only gets worse the taller they are. */
|
|
5275
|
+
[data-sonner-toaster] [data-sonner-toast][data-styled='true'] {
|
|
5276
|
+
align-items: flex-start;
|
|
5277
|
+
flex-wrap: wrap;
|
|
5278
|
+
}
|
|
5279
|
+
[data-sonner-toaster] [data-sonner-toast][data-styled='true'] [data-icon] {
|
|
5280
|
+
/* Optical centring against the title's first line, not its box. */
|
|
5281
|
+
margin-top: 0.0625rem;
|
|
5282
|
+
}
|
|
5283
|
+
[data-sonner-toaster] [data-sonner-toast][data-styled='true'] [data-content] {
|
|
5284
|
+
flex: 1 1 auto;
|
|
5285
|
+
min-width: 0;
|
|
5286
|
+
}
|
|
5258
5287
|
/* Buttons inherit the toast's own colour rather than the global
|
|
5259
5288
|
primary, so an action on a richColors error still reads against red
|
|
5260
5289
|
instead of disappearing into it. */
|
|
@@ -5264,6 +5293,25 @@ var Toaster = ({
|
|
|
5264
5293
|
font-size: 0.75rem;
|
|
5265
5294
|
font-weight: 500;
|
|
5266
5295
|
}
|
|
5296
|
+
/* The action gets its own row under the text.
|
|
5297
|
+
sonner puts it inline at the end of the flex row, which on a toast
|
|
5298
|
+
with a description squeezes it against the right edge next to the
|
|
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. */
|
|
5303
|
+
[data-sonner-toaster] [data-sonner-toast][data-styled='true'] [data-action] {
|
|
5304
|
+
flex: 0 0 100%;
|
|
5305
|
+
max-width: max-content;
|
|
5306
|
+
margin-left: 0;
|
|
5307
|
+
margin-top: 0.5rem;
|
|
5308
|
+
}
|
|
5309
|
+
/* Line the action up with the title rather than the icon. The offset is
|
|
5310
|
+
the icon's own box plus the toast's column gap, so the three left
|
|
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);
|
|
5314
|
+
}
|
|
5267
5315
|
[data-sonner-toaster] [data-sonner-toast][data-styled='true'] [data-action] {
|
|
5268
5316
|
background: color-mix(in oklab, currentColor 90%, transparent);
|
|
5269
5317
|
color: var(--normal-bg);
|