magic-pill 9.1.1 → 9.3.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/CHANGELOG.md +32 -0
- package/MIGRATING.md +2 -0
- package/README.md +55 -17
- package/dist/MagicPill/MagicPill.d.mts +9 -1
- package/dist/MagicPill/MagicPill.d.ts +9 -1
- package/dist/MagicPill/MagicPill.js +208 -107
- package/dist/MagicPill/MagicPill.mjs +211 -110
- package/dist/MagicPill/flag.js +93 -0
- package/dist/MagicPill/flag.mjs +91 -0
- package/dist/MagicPill/useChoreography.js +66 -0
- package/dist/MagicPill/useChoreography.mjs +66 -0
- package/dist/Pill/Pill.js +20 -9
- package/dist/Pill/Pill.mjs +21 -10
- package/dist/Pill/modal.js +2 -1
- package/dist/Pill/modal.mjs +3 -2
- package/dist/Pill/morph.js +178 -26
- package/dist/Pill/morph.mjs +178 -28
- package/dist/Pill/travel.js +77 -0
- package/dist/Pill/travel.mjs +76 -0
- package/dist/Pill/types.d.mts +8 -0
- package/dist/Pill/types.d.ts +8 -0
- package/dist/Pill/zone.js +3 -2
- package/dist/Pill/zone.mjs +4 -3
- package/dist/PillForm/PillField.js +16 -1
- package/dist/PillForm/PillField.mjs +17 -2
- package/dist/PillForm/PillSubmit.js +1 -1
- package/dist/PillForm/PillSubmit.mjs +3 -3
- package/dist/PillForm/popover.js +2 -1
- package/dist/PillForm/popover.mjs +3 -2
- package/dist/PillNavbar/PillNavbar.js +2 -1
- package/dist/PillNavbar/PillNavbar.mjs +2 -1
- package/dist/PillNotification/PillNotification.d.mts +16 -1
- package/dist/PillNotification/PillNotification.d.ts +16 -1
- package/dist/PillNotification/PillNotification.js +41 -30
- package/dist/PillNotification/PillNotification.mjs +41 -30
- package/dist/PillOptics/PillOptics.js +2 -1
- package/dist/PillOptics/PillOptics.mjs +3 -2
- package/dist/forms.css +40 -27
- package/dist/index.d.mts +29 -15
- package/dist/index.d.ts +29 -15
- package/dist/index.js +38 -12
- package/dist/index.mjs +38 -12
- package/dist/store/store.d.mts +9 -1
- package/dist/store/store.d.ts +9 -1
- package/dist/styles.css +91 -3
- package/dist/utils/react.js +8 -1
- package/dist/utils/react.mjs +8 -2
- package/package.json +2 -2
- package/dist/icons/ArrowIcon.d.mts +0 -4
- package/dist/icons/ArrowIcon.d.ts +0 -4
- package/dist/icons/BoxIcon.d.mts +0 -4
- package/dist/icons/BoxIcon.d.ts +0 -4
- package/dist/icons/CheckIcon.d.mts +0 -4
- package/dist/icons/CheckIcon.d.ts +0 -4
- package/dist/icons/CloseIcon.d.mts +0 -4
- package/dist/icons/CloseIcon.d.ts +0 -4
- package/dist/icons/CouponIcon.d.mts +0 -4
- package/dist/icons/CouponIcon.d.ts +0 -4
- package/dist/icons/DocumentIcon.d.mts +0 -4
- package/dist/icons/DocumentIcon.d.ts +0 -4
- package/dist/icons/HelpIcon.d.mts +0 -4
- package/dist/icons/HelpIcon.d.ts +0 -4
- package/dist/icons/InfoIcon.d.mts +0 -4
- package/dist/icons/InfoIcon.d.ts +0 -4
- package/dist/icons/MailIcon.d.mts +0 -4
- package/dist/icons/MailIcon.d.ts +0 -4
- package/dist/icons/PhoneIcon.d.mts +0 -4
- package/dist/icons/PhoneIcon.d.ts +0 -4
- package/dist/icons/PlusIcon.d.mts +0 -4
- package/dist/icons/PlusIcon.d.ts +0 -4
- package/dist/icons/UndoIcon.d.mts +0 -4
- package/dist/icons/UndoIcon.d.ts +0 -4
package/dist/index.js
CHANGED
|
@@ -40,17 +40,43 @@ const require_PhoneIcon = require("./icons/PhoneIcon.js");
|
|
|
40
40
|
const require_PlusIcon = require("./icons/PlusIcon.js");
|
|
41
41
|
const require_UndoIcon = require("./icons/UndoIcon.js");
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
43
|
+
// src/index.ts
|
|
44
|
+
/** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
|
|
45
|
+
const ArrowIcon = require_ArrowIcon;
|
|
46
|
+
/** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
|
|
47
|
+
const BoxIcon = require_BoxIcon;
|
|
48
|
+
/** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
|
|
49
|
+
const CheckIcon = require_CheckIcon;
|
|
50
|
+
/** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
|
|
51
|
+
const CloseIcon = require_CloseIcon;
|
|
52
|
+
/** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
|
|
53
|
+
const CouponIcon = require_CouponIcon;
|
|
54
|
+
/** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
|
|
55
|
+
const DocumentIcon = require_DocumentIcon;
|
|
56
|
+
/** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
|
|
57
|
+
const HelpIcon = require_HelpIcon;
|
|
58
|
+
/** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
|
|
59
|
+
const InfoIcon = require_InfoIcon;
|
|
60
|
+
/** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
|
|
61
|
+
const MailIcon = require_MailIcon;
|
|
62
|
+
/** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
|
|
63
|
+
const PhoneIcon = require_PhoneIcon;
|
|
64
|
+
/** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
|
|
65
|
+
const PlusIcon = require_PlusIcon;
|
|
66
|
+
/** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
|
|
67
|
+
const UndoIcon = require_UndoIcon;
|
|
68
|
+
|
|
69
|
+
exports.ArrowIcon = ArrowIcon;
|
|
70
|
+
exports.BoxIcon = BoxIcon;
|
|
71
|
+
exports.CheckIcon = CheckIcon;
|
|
72
|
+
exports.CloseIcon = CloseIcon;
|
|
73
|
+
exports.CouponIcon = CouponIcon;
|
|
74
|
+
exports.DocumentIcon = DocumentIcon;
|
|
75
|
+
exports.HelpIcon = HelpIcon;
|
|
76
|
+
exports.InfoIcon = InfoIcon;
|
|
51
77
|
exports.MagicPill = require_MagicPill;
|
|
52
|
-
exports.MailIcon =
|
|
53
|
-
exports.PhoneIcon =
|
|
78
|
+
exports.MailIcon = MailIcon;
|
|
79
|
+
exports.PhoneIcon = PhoneIcon;
|
|
54
80
|
exports.Pill = require_Pill;
|
|
55
81
|
exports.PillAction = require_PillAction;
|
|
56
82
|
exports.PillActions = require_parts.PillActions;
|
|
@@ -79,8 +105,8 @@ exports.PillStepper = require_PillStepper.PillStepper;
|
|
|
79
105
|
exports.PillSubmit = require_PillSubmit.PillSubmit;
|
|
80
106
|
exports.PillSwitch = require_PillSwitch.PillSwitch;
|
|
81
107
|
exports.PillTextarea = require_PillTextarea.PillTextarea;
|
|
82
|
-
exports.PlusIcon =
|
|
83
|
-
exports.UndoIcon =
|
|
108
|
+
exports.PlusIcon = PlusIcon;
|
|
109
|
+
exports.UndoIcon = UndoIcon;
|
|
84
110
|
exports.pill = require_store.pill;
|
|
85
111
|
exports.usePill = require_PillContext.usePill;
|
|
86
112
|
exports.usePillQueue = require_usePillQueue.usePillQueue;
|
package/dist/index.mjs
CHANGED
|
@@ -26,17 +26,43 @@ import { PillColor } from "./PillForm/PillColor.mjs";
|
|
|
26
26
|
import MagicPill from "./MagicPill/MagicPill.mjs";
|
|
27
27
|
import { pill } from "./store/store.mjs";
|
|
28
28
|
import { usePillQueue } from "./store/usePillQueue.mjs";
|
|
29
|
-
import ArrowIcon from "./icons/ArrowIcon.mjs";
|
|
30
|
-
import BoxIcon from "./icons/BoxIcon.mjs";
|
|
31
|
-
import CheckIcon from "./icons/CheckIcon.mjs";
|
|
32
|
-
import CloseIcon from "./icons/CloseIcon.mjs";
|
|
33
|
-
import CouponIcon from "./icons/CouponIcon.mjs";
|
|
34
|
-
import DocumentIcon from "./icons/DocumentIcon.mjs";
|
|
35
|
-
import HelpIcon from "./icons/HelpIcon.mjs";
|
|
36
|
-
import InfoIcon from "./icons/InfoIcon.mjs";
|
|
37
|
-
import MailIcon from "./icons/MailIcon.mjs";
|
|
38
|
-
import PhoneIcon from "./icons/PhoneIcon.mjs";
|
|
39
|
-
import PlusIcon from "./icons/PlusIcon.mjs";
|
|
40
|
-
import UndoIcon from "./icons/UndoIcon.mjs";
|
|
29
|
+
import ArrowIcon$1 from "./icons/ArrowIcon.mjs";
|
|
30
|
+
import BoxIcon$1 from "./icons/BoxIcon.mjs";
|
|
31
|
+
import CheckIcon$1 from "./icons/CheckIcon.mjs";
|
|
32
|
+
import CloseIcon$1 from "./icons/CloseIcon.mjs";
|
|
33
|
+
import CouponIcon$1 from "./icons/CouponIcon.mjs";
|
|
34
|
+
import DocumentIcon$1 from "./icons/DocumentIcon.mjs";
|
|
35
|
+
import HelpIcon$1 from "./icons/HelpIcon.mjs";
|
|
36
|
+
import InfoIcon$1 from "./icons/InfoIcon.mjs";
|
|
37
|
+
import MailIcon$1 from "./icons/MailIcon.mjs";
|
|
38
|
+
import PhoneIcon$1 from "./icons/PhoneIcon.mjs";
|
|
39
|
+
import PlusIcon$1 from "./icons/PlusIcon.mjs";
|
|
40
|
+
import UndoIcon$1 from "./icons/UndoIcon.mjs";
|
|
41
|
+
|
|
42
|
+
// src/index.ts
|
|
43
|
+
/** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
|
|
44
|
+
const ArrowIcon = ArrowIcon$1;
|
|
45
|
+
/** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
|
|
46
|
+
const BoxIcon = BoxIcon$1;
|
|
47
|
+
/** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
|
|
48
|
+
const CheckIcon = CheckIcon$1;
|
|
49
|
+
/** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
|
|
50
|
+
const CloseIcon = CloseIcon$1;
|
|
51
|
+
/** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
|
|
52
|
+
const CouponIcon = CouponIcon$1;
|
|
53
|
+
/** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
|
|
54
|
+
const DocumentIcon = DocumentIcon$1;
|
|
55
|
+
/** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
|
|
56
|
+
const HelpIcon = HelpIcon$1;
|
|
57
|
+
/** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
|
|
58
|
+
const InfoIcon = InfoIcon$1;
|
|
59
|
+
/** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
|
|
60
|
+
const MailIcon = MailIcon$1;
|
|
61
|
+
/** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
|
|
62
|
+
const PhoneIcon = PhoneIcon$1;
|
|
63
|
+
/** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
|
|
64
|
+
const PlusIcon = PlusIcon$1;
|
|
65
|
+
/** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
|
|
66
|
+
const UndoIcon = UndoIcon$1;
|
|
41
67
|
|
|
42
68
|
export { ArrowIcon, BoxIcon, CheckIcon, CloseIcon, CouponIcon, DocumentIcon, HelpIcon, InfoIcon, MagicPill, MailIcon, PhoneIcon, Pill, PillAction, PillActions, PillCheckbox, PillChoices, PillCode, PillColor, PillDate, PillDivider, PillField, PillFields, PillFile, PillForm, PillFormPanel, PillIcon, PillInput, PillMessage, PillNavbar, PillNotification, PillOptics, PillPanel, PillPanelTrigger, PillSelect, PillSlider, PillStepper, PillSubmit, PillSwitch, PillTextarea, PlusIcon, UndoIcon, pill, usePill, usePillQueue };
|
package/dist/store/store.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { PillVariant } from "../Pill/types.mjs";
|
|
3
|
-
import { PillNotificationProps } from "../PillNotification/PillNotification.mjs";
|
|
3
|
+
import { NotificationLayout, PillNotificationProps } from "../PillNotification/PillNotification.mjs";
|
|
4
4
|
export type DismissReason = "timeout" | "action" | "dismissed" | "cleared";
|
|
5
5
|
interface NotifyCommon {
|
|
6
6
|
/**
|
|
@@ -21,6 +21,14 @@ interface NotifyCommon {
|
|
|
21
21
|
* whole pill for a `render` notification). `false` announces nothing.
|
|
22
22
|
*/
|
|
23
23
|
announce?: string | false;
|
|
24
|
+
/** This notification's layout, instead of the host's `notificationLayout`. */
|
|
25
|
+
layout?: NotificationLayout;
|
|
26
|
+
/**
|
|
27
|
+
* `flag` only: the navbar item it's about (its `href`), to come out next to
|
|
28
|
+
* it, matched as the navbar matches the current page. Default: the middle
|
|
29
|
+
* of the sidebar.
|
|
30
|
+
*/
|
|
31
|
+
at?: string;
|
|
24
32
|
onDismiss?: (id: string, reason: DismissReason) => void;
|
|
25
33
|
}
|
|
26
34
|
/** The built-in notification template, as data. */
|
package/dist/store/store.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { PillVariant } from "../Pill/types.js";
|
|
3
|
-
import { PillNotificationProps } from "../PillNotification/PillNotification.js";
|
|
3
|
+
import { NotificationLayout, PillNotificationProps } from "../PillNotification/PillNotification.js";
|
|
4
4
|
export type DismissReason = "timeout" | "action" | "dismissed" | "cleared";
|
|
5
5
|
interface NotifyCommon {
|
|
6
6
|
/**
|
|
@@ -21,6 +21,14 @@ interface NotifyCommon {
|
|
|
21
21
|
* whole pill for a `render` notification). `false` announces nothing.
|
|
22
22
|
*/
|
|
23
23
|
announce?: string | false;
|
|
24
|
+
/** This notification's layout, instead of the host's `notificationLayout`. */
|
|
25
|
+
layout?: NotificationLayout;
|
|
26
|
+
/**
|
|
27
|
+
* `flag` only: the navbar item it's about (its `href`), to come out next to
|
|
28
|
+
* it, matched as the navbar matches the current page. Default: the middle
|
|
29
|
+
* of the sidebar.
|
|
30
|
+
*/
|
|
31
|
+
at?: string;
|
|
24
32
|
onDismiss?: (id: string, reason: DismissReason) => void;
|
|
25
33
|
}
|
|
26
34
|
/** The built-in notification template, as data. */
|
package/dist/styles.css
CHANGED
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
--_mp-exit: var(--mp-duration-exit, 300ms);
|
|
77
77
|
--_mp-change: var(--mp-duration-change, 250ms);
|
|
78
78
|
/* The content fades out before the pill shrinks, and in once it has grown */
|
|
79
|
-
--_mp-fade: 150ms;
|
|
79
|
+
--_mp-fade: var(--mp-duration-fade, 150ms);
|
|
80
80
|
/* A panel stays above the other pills until it has closed back */
|
|
81
81
|
--_mp-lower: calc(var(--_mp-fade) + var(--_mp-change));
|
|
82
82
|
/* The entry overshoot from the mockups' "pop" */
|
|
@@ -262,6 +262,15 @@
|
|
|
262
262
|
right: calc(var(--_mp-offset) + env(safe-area-inset-right, 0px) + var(--_mp-shift-x, 0px));
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
+
/* A sidebar's flag pops out of the sidebar's side, and scales back into it */
|
|
266
|
+
&[data-layout="flag"][data-placement="left"] {
|
|
267
|
+
transform-origin: var(--mp-scale-origin, left center);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
&[data-layout="flag"][data-placement="right"] {
|
|
271
|
+
transform-origin: var(--mp-scale-origin, right center);
|
|
272
|
+
}
|
|
273
|
+
|
|
265
274
|
&[data-placement="overlay"] {
|
|
266
275
|
inset: 0;
|
|
267
276
|
margin: auto;
|
|
@@ -308,7 +317,11 @@
|
|
|
308
317
|
max-inline-size: var(--_mp-max-size);
|
|
309
318
|
}
|
|
310
319
|
|
|
320
|
+
/* A circle too: both axes clamped, as for a horizontal pill (the
|
|
321
|
+
vertical rule above lets its width follow the content) */
|
|
311
322
|
&[data-orientation="vertical"]:is([data-presence="rest"], [data-presence="hidden"]) {
|
|
323
|
+
inline-size: var(--_mp-rest-size);
|
|
324
|
+
max-inline-size: var(--_mp-rest-size);
|
|
312
325
|
block-size: var(--_mp-rest-size);
|
|
313
326
|
}
|
|
314
327
|
|
|
@@ -392,6 +405,39 @@
|
|
|
392
405
|
align-items: var(--_mp-align);
|
|
393
406
|
}
|
|
394
407
|
|
|
408
|
+
/* A notification in rows (layout="rows"): the message and the actions
|
|
409
|
+
wrap in a body beside the icon. The actions stay on the message's
|
|
410
|
+
line while they fit, go under it when it wraps (the body is as wide
|
|
411
|
+
as a message can be), and always with two of them; under it, they
|
|
412
|
+
line up with the message. The icon and the divider stay with the
|
|
413
|
+
first line */
|
|
414
|
+
&:has(> [data-mp="body"]) {
|
|
415
|
+
align-items: flex-start;
|
|
416
|
+
|
|
417
|
+
& > [data-mp="divider"] {
|
|
418
|
+
align-self: flex-start;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
& > [data-mp="body"] {
|
|
423
|
+
display: flex;
|
|
424
|
+
flex-wrap: wrap;
|
|
425
|
+
align-items: center;
|
|
426
|
+
column-gap: var(--_mp-gap);
|
|
427
|
+
row-gap: calc(var(--_mp-gap) * 0.75);
|
|
428
|
+
min-inline-size: 0;
|
|
429
|
+
max-inline-size: var(--mp-message-width, 24rem);
|
|
430
|
+
|
|
431
|
+
/* One line is as tall as an action, so it sits level with the icon */
|
|
432
|
+
& > [data-mp="message"] {
|
|
433
|
+
padding-block: max(0px, (var(--_mp-action-size) - 1lh) / 2);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
& > [data-mp="actions"]:has(> :nth-child(2)) {
|
|
437
|
+
flex-basis: 100%;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
395
441
|
/* The <a>/<button> stays neutral and the look lives on its inner body:
|
|
396
442
|
an app's global resets (a { color: inherit }, button { background:
|
|
397
443
|
none; padding: 0 }…) are unlayered, so they'd beat this layer on
|
|
@@ -463,10 +509,13 @@
|
|
|
463
509
|
font-size: 1.25rem;
|
|
464
510
|
}
|
|
465
511
|
|
|
466
|
-
|
|
467
|
-
|
|
512
|
+
/* Any icon fits the slot: an svg or an image is 1em square, a font
|
|
513
|
+
icon (Font Awesome's <i>, an emoji) takes the font size */
|
|
514
|
+
& [data-mp="icon"] > :is(svg, img),
|
|
515
|
+
& [data-mp="action-icon"] > :is(svg, img) {
|
|
468
516
|
inline-size: 1em;
|
|
469
517
|
block-size: 1em;
|
|
518
|
+
object-fit: contain;
|
|
470
519
|
}
|
|
471
520
|
|
|
472
521
|
/* Labels: folded away (but still the accessible name) until expanded.
|
|
@@ -531,6 +580,45 @@
|
|
|
531
580
|
}
|
|
532
581
|
}
|
|
533
582
|
|
|
583
|
+
/* A notification as a card (layout="card", a sidebar's): a column of
|
|
584
|
+
the sidebar's width, at least --mp-card-width. The icon on top, the
|
|
585
|
+
divider across, the message centred, the actions full width, one per
|
|
586
|
+
line, with their labels. After the vertical pill's rules, which it
|
|
587
|
+
adjusts */
|
|
588
|
+
& > [data-mp="card"] {
|
|
589
|
+
display: flex;
|
|
590
|
+
flex-direction: column;
|
|
591
|
+
align-items: center;
|
|
592
|
+
gap: calc(var(--_mp-gap) * 0.75);
|
|
593
|
+
inline-size: max(var(--mp-card-width, 12.5rem), var(--_mp-sidebar-width, 0px) - 2 * var(--_mp-padding));
|
|
594
|
+
max-inline-size: 100%;
|
|
595
|
+
text-align: center;
|
|
596
|
+
|
|
597
|
+
& > [data-mp="divider"] {
|
|
598
|
+
align-self: stretch;
|
|
599
|
+
inline-size: auto;
|
|
600
|
+
block-size: 1px;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
& > [data-mp="message"] {
|
|
604
|
+
inline-size: auto;
|
|
605
|
+
max-inline-size: 100%;
|
|
606
|
+
padding-inline: 0.25rem;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
& > [data-mp="actions"] {
|
|
610
|
+
flex-direction: column;
|
|
611
|
+
align-self: stretch;
|
|
612
|
+
align-items: stretch;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
& [data-mp="action"],
|
|
616
|
+
& [data-mp="action-body"] {
|
|
617
|
+
justify-content: center;
|
|
618
|
+
inline-size: 100%;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
|
|
534
622
|
/* A navbar stays in its pill: where it's too narrow, the open label is
|
|
535
623
|
cut short, rather than the last items */
|
|
536
624
|
&[data-orientation="horizontal"] [data-mp="navbar"] {
|
package/dist/utils/react.js
CHANGED
|
@@ -10,6 +10,12 @@ const INERT_VALUE = Number.parseInt(react.version, 10) >= 19 ? true : "";
|
|
|
10
10
|
function inertProps(inert) {
|
|
11
11
|
return inert ? { inert: INERT_VALUE } : {};
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* `useLayoutEffect` in the browser, `useEffect` on the server (L31). Layout
|
|
15
|
+
* effects never run on the server anyway, but React 18 warns about each one
|
|
16
|
+
* it meets while rendering there. Every hook of the library uses this one.
|
|
17
|
+
*/
|
|
18
|
+
const useIsomorphicLayoutEffect = typeof window === "undefined" ? react.useEffect : react.useLayoutEffect;
|
|
13
19
|
/** Combine refs (React 18 compatible: no ref cleanup functions). */
|
|
14
20
|
function mergeRefs(...refs) {
|
|
15
21
|
return (node) => {
|
|
@@ -20,4 +26,5 @@ function mergeRefs(...refs) {
|
|
|
20
26
|
|
|
21
27
|
exports.devWarn = devWarn;
|
|
22
28
|
exports.inertProps = inertProps;
|
|
23
|
-
exports.mergeRefs = mergeRefs;
|
|
29
|
+
exports.mergeRefs = mergeRefs;
|
|
30
|
+
exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect;
|
package/dist/utils/react.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { version } from "react";
|
|
1
|
+
import { useEffect, useLayoutEffect, version } from "react";
|
|
2
2
|
|
|
3
3
|
// src/utils/react.ts
|
|
4
4
|
/** Warn in development builds only. */
|
|
@@ -10,6 +10,12 @@ const INERT_VALUE = Number.parseInt(version, 10) >= 19 ? true : "";
|
|
|
10
10
|
function inertProps(inert) {
|
|
11
11
|
return inert ? { inert: INERT_VALUE } : {};
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* `useLayoutEffect` in the browser, `useEffect` on the server (L31). Layout
|
|
15
|
+
* effects never run on the server anyway, but React 18 warns about each one
|
|
16
|
+
* it meets while rendering there. Every hook of the library uses this one.
|
|
17
|
+
*/
|
|
18
|
+
const useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
13
19
|
/** Combine refs (React 18 compatible: no ref cleanup functions). */
|
|
14
20
|
function mergeRefs(...refs) {
|
|
15
21
|
return (node) => {
|
|
@@ -18,4 +24,4 @@ function mergeRefs(...refs) {
|
|
|
18
24
|
};
|
|
19
25
|
}
|
|
20
26
|
|
|
21
|
-
export { devWarn, inertProps, mergeRefs };
|
|
27
|
+
export { devWarn, inertProps, mergeRefs, useIsomorphicLayoutEffect };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "magic-pill",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.3.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"sideEffects": [
|
|
28
28
|
"*.css"
|
|
29
29
|
],
|
|
30
|
-
"description": "A
|
|
30
|
+
"description": "A design primitive for React: one pill that becomes notifications, a navbar, panels, forms and modals, and morphs between them",
|
|
31
31
|
"repository": {
|
|
32
32
|
"type": "git",
|
|
33
33
|
"url": "git+https://github.com/CedricTheveneau/Magic-Pill.git"
|
package/dist/icons/BoxIcon.d.mts
DELETED
package/dist/icons/BoxIcon.d.ts
DELETED
package/dist/icons/HelpIcon.d.ts
DELETED
package/dist/icons/InfoIcon.d.ts
DELETED
package/dist/icons/MailIcon.d.ts
DELETED
package/dist/icons/PlusIcon.d.ts
DELETED
package/dist/icons/UndoIcon.d.ts
DELETED