magic-pill 9.1.0 → 9.2.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 +25 -0
- package/README.md +10 -2
- package/dist/MagicPill/MagicPill.d.mts +9 -1
- package/dist/MagicPill/MagicPill.d.ts +9 -1
- package/dist/MagicPill/MagicPill.js +207 -106
- package/dist/MagicPill/MagicPill.mjs +208 -107
- package/dist/MagicPill/flag.js +93 -0
- package/dist/MagicPill/flag.mjs +91 -0
- package/dist/MagicPill/useChoreography.js +65 -0
- package/dist/MagicPill/useChoreography.mjs +65 -0
- package/dist/Pill/Pill.js +20 -9
- package/dist/Pill/Pill.mjs +21 -10
- package/dist/Pill/morph.js +175 -24
- package/dist/Pill/morph.mjs +174 -25
- package/dist/Pill/travel.js +76 -0
- package/dist/Pill/travel.mjs +75 -0
- package/dist/Pill/types.d.mts +8 -0
- package/dist/Pill/types.d.ts +8 -0
- package/dist/PillForm/PillField.js +16 -1
- package/dist/PillForm/PillField.mjs +17 -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/forms.css +41 -27
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/store/store.d.mts +9 -1
- package/dist/store/store.d.ts +9 -1
- package/dist/styles.css +85 -0
- package/package.json +1 -1
|
@@ -6,14 +6,15 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
6
6
|
|
|
7
7
|
// src/PillNotification/PillNotification.tsx
|
|
8
8
|
/** The implementation, with the host-only `onAction` hook. */
|
|
9
|
-
function NotificationContent({ icon, message, action, panel, linkComponent, classNames = {}, onAction }) {
|
|
9
|
+
function NotificationContent({ icon, message, action, panel, layout = "pill", linkComponent, classNames = {}, onAction }) {
|
|
10
10
|
const hasIcon = icon !== void 0 && icon !== null;
|
|
11
|
+
const inCard = layout === "card" ? true : void 0;
|
|
11
12
|
const renderAction = (notificationAction) => {
|
|
12
13
|
const { icon: actionIcon, label, expanded } = notificationAction;
|
|
13
14
|
if (notificationAction.href !== void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PillAction, {
|
|
14
15
|
icon: actionIcon,
|
|
15
16
|
label,
|
|
16
|
-
expanded,
|
|
17
|
+
expanded: expanded ?? inCard,
|
|
17
18
|
href: notificationAction.href,
|
|
18
19
|
linkComponent,
|
|
19
20
|
className: classNames.action,
|
|
@@ -23,7 +24,7 @@ function NotificationContent({ icon, message, action, panel, linkComponent, clas
|
|
|
23
24
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PillAction, {
|
|
24
25
|
icon: actionIcon,
|
|
25
26
|
label,
|
|
26
|
-
expanded,
|
|
27
|
+
expanded: expanded ?? inCard,
|
|
27
28
|
className: classNames.action,
|
|
28
29
|
onClick: (event) => {
|
|
29
30
|
onClick(event);
|
|
@@ -31,37 +32,47 @@ function NotificationContent({ icon, message, action, panel, linkComponent, clas
|
|
|
31
32
|
}
|
|
32
33
|
});
|
|
33
34
|
};
|
|
35
|
+
const messageAndActions = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_parts.PillMessage, {
|
|
36
|
+
className: classNames.message,
|
|
37
|
+
children: message
|
|
38
|
+
}), (action || panel) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_parts.PillActions, {
|
|
39
|
+
className: classNames.actions,
|
|
40
|
+
children: [action && renderAction(action), panel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PillPanel.PillPanelTrigger, {
|
|
41
|
+
icon: panel.trigger ? panel.trigger.icon : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PlusIcon, {}),
|
|
42
|
+
label: panel.trigger?.label ?? "Learn more",
|
|
43
|
+
expanded: panel.trigger?.expanded ?? inCard,
|
|
44
|
+
className: classNames.action
|
|
45
|
+
})]
|
|
46
|
+
})] });
|
|
47
|
+
const iconAndDivider = hasIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_parts.PillIcon, {
|
|
48
|
+
className: classNames.icon,
|
|
49
|
+
children: icon
|
|
50
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_parts.PillDivider, { className: classNames.divider })] });
|
|
51
|
+
const notificationPanel = panel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PillPanel.PillPanel, {
|
|
52
|
+
title: panel.title,
|
|
53
|
+
titleAction: panel.titleAction,
|
|
54
|
+
footer: panel.footer,
|
|
55
|
+
closeLabel: panel.closeLabel,
|
|
56
|
+
closeExpanded: panel.closeExpanded,
|
|
57
|
+
className: classNames.panel,
|
|
58
|
+
children: panel.content
|
|
59
|
+
});
|
|
60
|
+
if (layout === "card") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
61
|
+
"data-mp": "card",
|
|
62
|
+
children: [iconAndDivider, messageAndActions]
|
|
63
|
+
}), notificationPanel] });
|
|
34
64
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
children: message
|
|
42
|
-
}),
|
|
43
|
-
(action || panel) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_parts.PillActions, {
|
|
44
|
-
className: classNames.actions,
|
|
45
|
-
children: [action && renderAction(action), panel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PillPanel.PillPanelTrigger, {
|
|
46
|
-
icon: panel.trigger ? panel.trigger.icon : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PlusIcon, {}),
|
|
47
|
-
label: panel.trigger?.label ?? "Learn more",
|
|
48
|
-
expanded: panel.trigger?.expanded,
|
|
49
|
-
className: classNames.action
|
|
50
|
-
})]
|
|
51
|
-
}),
|
|
52
|
-
panel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PillPanel.PillPanel, {
|
|
53
|
-
title: panel.title,
|
|
54
|
-
titleAction: panel.titleAction,
|
|
55
|
-
footer: panel.footer,
|
|
56
|
-
closeLabel: panel.closeLabel,
|
|
57
|
-
closeExpanded: panel.closeExpanded,
|
|
58
|
-
className: classNames.panel,
|
|
59
|
-
children: panel.content
|
|
60
|
-
})
|
|
65
|
+
iconAndDivider,
|
|
66
|
+
layout === "rows" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
67
|
+
"data-mp": "body",
|
|
68
|
+
children: messageAndActions
|
|
69
|
+
}) : messageAndActions,
|
|
70
|
+
notificationPanel
|
|
61
71
|
] });
|
|
62
72
|
}
|
|
63
73
|
/**
|
|
64
|
-
* Icon · divider · message · action, with an optional expandable panel.
|
|
74
|
+
* Icon · divider · message · action, with an optional expandable panel. With
|
|
75
|
+
* `layout="rows"`, the actions go under the message when they need the room.
|
|
65
76
|
* Render it inside a <Pill>, or let <MagicPill> render it for pill().notify().
|
|
66
77
|
*/
|
|
67
78
|
const PillNotification = NotificationContent;
|
|
@@ -6,14 +6,15 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
|
|
7
7
|
// src/PillNotification/PillNotification.tsx
|
|
8
8
|
/** The implementation, with the host-only `onAction` hook. */
|
|
9
|
-
function NotificationContent({ icon, message, action, panel, linkComponent, classNames = {}, onAction }) {
|
|
9
|
+
function NotificationContent({ icon, message, action, panel, layout = "pill", linkComponent, classNames = {}, onAction }) {
|
|
10
10
|
const hasIcon = icon !== void 0 && icon !== null;
|
|
11
|
+
const inCard = layout === "card" ? true : void 0;
|
|
11
12
|
const renderAction = (notificationAction) => {
|
|
12
13
|
const { icon: actionIcon, label, expanded } = notificationAction;
|
|
13
14
|
if (notificationAction.href !== void 0) return /* @__PURE__ */ jsx(PillAction, {
|
|
14
15
|
icon: actionIcon,
|
|
15
16
|
label,
|
|
16
|
-
expanded,
|
|
17
|
+
expanded: expanded ?? inCard,
|
|
17
18
|
href: notificationAction.href,
|
|
18
19
|
linkComponent,
|
|
19
20
|
className: classNames.action,
|
|
@@ -23,7 +24,7 @@ function NotificationContent({ icon, message, action, panel, linkComponent, clas
|
|
|
23
24
|
return /* @__PURE__ */ jsx(PillAction, {
|
|
24
25
|
icon: actionIcon,
|
|
25
26
|
label,
|
|
26
|
-
expanded,
|
|
27
|
+
expanded: expanded ?? inCard,
|
|
27
28
|
className: classNames.action,
|
|
28
29
|
onClick: (event) => {
|
|
29
30
|
onClick(event);
|
|
@@ -31,37 +32,47 @@ function NotificationContent({ icon, message, action, panel, linkComponent, clas
|
|
|
31
32
|
}
|
|
32
33
|
});
|
|
33
34
|
};
|
|
35
|
+
const messageAndActions = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(PillMessage, {
|
|
36
|
+
className: classNames.message,
|
|
37
|
+
children: message
|
|
38
|
+
}), (action || panel) && /* @__PURE__ */ jsxs(PillActions, {
|
|
39
|
+
className: classNames.actions,
|
|
40
|
+
children: [action && renderAction(action), panel && /* @__PURE__ */ jsx(PillPanelTrigger, {
|
|
41
|
+
icon: panel.trigger ? panel.trigger.icon : /* @__PURE__ */ jsx(PlusIcon, {}),
|
|
42
|
+
label: panel.trigger?.label ?? "Learn more",
|
|
43
|
+
expanded: panel.trigger?.expanded ?? inCard,
|
|
44
|
+
className: classNames.action
|
|
45
|
+
})]
|
|
46
|
+
})] });
|
|
47
|
+
const iconAndDivider = hasIcon && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(PillIcon, {
|
|
48
|
+
className: classNames.icon,
|
|
49
|
+
children: icon
|
|
50
|
+
}), /* @__PURE__ */ jsx(PillDivider, { className: classNames.divider })] });
|
|
51
|
+
const notificationPanel = panel && /* @__PURE__ */ jsx(PillPanel, {
|
|
52
|
+
title: panel.title,
|
|
53
|
+
titleAction: panel.titleAction,
|
|
54
|
+
footer: panel.footer,
|
|
55
|
+
closeLabel: panel.closeLabel,
|
|
56
|
+
closeExpanded: panel.closeExpanded,
|
|
57
|
+
className: classNames.panel,
|
|
58
|
+
children: panel.content
|
|
59
|
+
});
|
|
60
|
+
if (layout === "card") return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
|
|
61
|
+
"data-mp": "card",
|
|
62
|
+
children: [iconAndDivider, messageAndActions]
|
|
63
|
+
}), notificationPanel] });
|
|
34
64
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
children: message
|
|
42
|
-
}),
|
|
43
|
-
(action || panel) && /* @__PURE__ */ jsxs(PillActions, {
|
|
44
|
-
className: classNames.actions,
|
|
45
|
-
children: [action && renderAction(action), panel && /* @__PURE__ */ jsx(PillPanelTrigger, {
|
|
46
|
-
icon: panel.trigger ? panel.trigger.icon : /* @__PURE__ */ jsx(PlusIcon, {}),
|
|
47
|
-
label: panel.trigger?.label ?? "Learn more",
|
|
48
|
-
expanded: panel.trigger?.expanded,
|
|
49
|
-
className: classNames.action
|
|
50
|
-
})]
|
|
51
|
-
}),
|
|
52
|
-
panel && /* @__PURE__ */ jsx(PillPanel, {
|
|
53
|
-
title: panel.title,
|
|
54
|
-
titleAction: panel.titleAction,
|
|
55
|
-
footer: panel.footer,
|
|
56
|
-
closeLabel: panel.closeLabel,
|
|
57
|
-
closeExpanded: panel.closeExpanded,
|
|
58
|
-
className: classNames.panel,
|
|
59
|
-
children: panel.content
|
|
60
|
-
})
|
|
65
|
+
iconAndDivider,
|
|
66
|
+
layout === "rows" ? /* @__PURE__ */ jsx("div", {
|
|
67
|
+
"data-mp": "body",
|
|
68
|
+
children: messageAndActions
|
|
69
|
+
}) : messageAndActions,
|
|
70
|
+
notificationPanel
|
|
61
71
|
] });
|
|
62
72
|
}
|
|
63
73
|
/**
|
|
64
|
-
* Icon · divider · message · action, with an optional expandable panel.
|
|
74
|
+
* Icon · divider · message · action, with an optional expandable panel. With
|
|
75
|
+
* `layout="rows"`, the actions go under the message when they need the room.
|
|
65
76
|
* Render it inside a <Pill>, or let <MagicPill> render it for pill().notify().
|
|
66
77
|
*/
|
|
67
78
|
const PillNotification = NotificationContent;
|
package/dist/forms.css
CHANGED
|
@@ -412,7 +412,11 @@
|
|
|
412
412
|
padding: 0;
|
|
413
413
|
border: 0;
|
|
414
414
|
border-radius: 0;
|
|
415
|
-
|
|
415
|
+
/* Its focus is drawn on the box, for the keyboard only. Important, so
|
|
416
|
+
an app's own global :focus-visible rule (unlayered, so it would win)
|
|
417
|
+
doesn't draw one on the control too: browsers match it after a click
|
|
418
|
+
on a text field, and with the keyboard it doubled the ring */
|
|
419
|
+
outline: 0 !important;
|
|
416
420
|
background: transparent;
|
|
417
421
|
box-shadow: none;
|
|
418
422
|
color: inherit;
|
|
@@ -651,7 +655,9 @@
|
|
|
651
655
|
display 150ms allow-discrete;
|
|
652
656
|
}
|
|
653
657
|
|
|
654
|
-
|
|
658
|
+
/* :open on the select, not :popover-open on the picker: Lightning CSS
|
|
659
|
+
(Next.js's Turbopack) refuses a pseudo-class after a pseudo-element */
|
|
660
|
+
& select:open::picker(select) {
|
|
655
661
|
opacity: 1;
|
|
656
662
|
scale: 1;
|
|
657
663
|
|
|
@@ -667,7 +673,8 @@
|
|
|
667
673
|
gap: 0.5rem;
|
|
668
674
|
padding: 0.6rem 0.8rem;
|
|
669
675
|
border-radius: 1.1rem;
|
|
670
|
-
|
|
676
|
+
/* Its focus is its background (below), whatever an app's :focus-visible says */
|
|
677
|
+
outline: 0 !important;
|
|
671
678
|
background: transparent;
|
|
672
679
|
color: inherit;
|
|
673
680
|
font-weight: 400;
|
|
@@ -1095,7 +1102,8 @@
|
|
|
1095
1102
|
margin: 0;
|
|
1096
1103
|
padding: 0.35rem 0;
|
|
1097
1104
|
border: 0;
|
|
1098
|
-
|
|
1105
|
+
/* Its focus is drawn around the value, as for the text fields' box */
|
|
1106
|
+
outline: 0 !important;
|
|
1099
1107
|
background: none;
|
|
1100
1108
|
color: inherit;
|
|
1101
1109
|
font: inherit;
|
|
@@ -1303,35 +1311,41 @@
|
|
|
1303
1311
|
|
|
1304
1312
|
/* ─── States ───────────────────────────────────────────────────────────── */
|
|
1305
1313
|
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
outline: 2px solid var(--_mp-on-surface);
|
|
1316
|
-
outline-offset: 2px;
|
|
1317
|
-
}
|
|
1314
|
+
/* Focus rings are for the keyboard: browsers match :focus-visible on a
|
|
1315
|
+
text field even after a click or a tap, so a field focused with a
|
|
1316
|
+
pointer (data-pointer-focus, written by the field) draws none. The
|
|
1317
|
+
caret shows where typing goes */
|
|
1318
|
+
& [data-mp="field"]:not([data-pointer-focus]) {
|
|
1319
|
+
& [data-mp="field-box"]:has(> :is(input, textarea, select):focus-visible) {
|
|
1320
|
+
outline: 2px solid var(--_mp-on-surface);
|
|
1321
|
+
outline-offset: 2px;
|
|
1322
|
+
}
|
|
1318
1323
|
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
+
& [data-mp="field-control"]:is([data-type="switch"], [data-type="checkbox"]) > input:focus-visible + span,
|
|
1325
|
+
& input:focus-visible ~ [data-mp="slider-thumb"],
|
|
1326
|
+
& [data-mp="choice"] > input:focus-visible + span,
|
|
1327
|
+
& [data-mp="stepper-value"]:focus-within {
|
|
1328
|
+
outline: 2px solid var(--_mp-on-surface);
|
|
1329
|
+
outline-offset: 2px;
|
|
1330
|
+
}
|
|
1324
1331
|
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1332
|
+
& input:focus-visible ~ [data-mp="code-slot"][data-next],
|
|
1333
|
+
& input:focus-visible ~ [data-mp="color-swatch"] {
|
|
1334
|
+
outline: 2px solid var(--_mp-on-surface);
|
|
1335
|
+
outline-offset: 2px;
|
|
1336
|
+
}
|
|
1329
1337
|
|
|
1330
|
-
|
|
1331
|
-
& [data-mp="field-box"]:focus-within {
|
|
1338
|
+
& [data-mp="field-control"][data-type="file"]:focus-within {
|
|
1332
1339
|
outline: 2px solid var(--_mp-on-surface);
|
|
1333
1340
|
outline-offset: 2px;
|
|
1334
1341
|
}
|
|
1342
|
+
|
|
1343
|
+
@supports not selector(:has(*)) {
|
|
1344
|
+
& [data-mp="field-box"]:focus-within {
|
|
1345
|
+
outline: 2px solid var(--_mp-on-surface);
|
|
1346
|
+
outline-offset: 2px;
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1335
1349
|
}
|
|
1336
1350
|
|
|
1337
1351
|
& [data-mp="field-button"]:focus-visible {
|
package/dist/index.d.mts
CHANGED
|
@@ -5,7 +5,7 @@ import { PillPanel, PillPanelTrigger } from "./Pill/PillPanel.mjs";
|
|
|
5
5
|
import { usePill } from "./Pill/PillContext.mjs";
|
|
6
6
|
import { LinkComponent, PillActionProps, PillButtonActionProps, PillContextValue, PillLinkActionProps, PillOrientation, PillPanelProps, PillPanelTriggerProps, PillPlacement, PillPresence, PillProps, PillTheme, PillVariant, SceneChange } from "./Pill/types.mjs";
|
|
7
7
|
import { PillOptics } from "./PillOptics/PillOptics.mjs";
|
|
8
|
-
import { NotificationAction, NotificationPanel, PillNotification, PillNotificationClassNames, PillNotificationProps } from "./PillNotification/PillNotification.mjs";
|
|
8
|
+
import { NotificationAction, NotificationLayout, NotificationPanel, PillNotification, PillNotificationClassNames, PillNotificationProps } from "./PillNotification/PillNotification.mjs";
|
|
9
9
|
import { NavActionItem, NavItem, NavLinkItem, NavPanelItem, PillNavbar, PillNavbarProps } from "./PillNavbar/PillNavbar.mjs";
|
|
10
10
|
import { PillForm, PillFormProps } from "./PillForm/PillForm.mjs";
|
|
11
11
|
import { SendHandler } from "./PillForm/send.mjs";
|
|
@@ -43,4 +43,4 @@ import PhoneIcon from "./icons/PhoneIcon.mjs";
|
|
|
43
43
|
import PlusIcon from "./icons/PlusIcon.mjs";
|
|
44
44
|
import UndoIcon from "./icons/UndoIcon.mjs";
|
|
45
45
|
import { IconProps } from "./icons/types.mjs";
|
|
46
|
-
export { ArrowIcon, BoxIcon, type CalendarLabels, CheckIcon, CloseIcon, CouponIcon, type DateType, type DismissReason, DocumentIcon, type FieldControlProps, type FieldProps, HelpIcon, type IconProps, InfoIcon, type LinkComponent, MagicPill, type MagicPillProps, MailIcon, type NavActionItem, type NavItem, type NavLinkItem, type NavPanelItem, type NotificationAction, type NotificationPanel, type NotifyInput, type NotifyOptions, type NotifyRenderOptions, PhoneIcon, Pill, PillAction, type PillActionProps, PillActions, type PillButtonActionProps, PillCheckbox, type PillCheckboxProps, type PillChoice, PillChoices, type PillChoicesProps, PillCode, type PillCodeProps, PillColor, type PillColorProps, type PillContextValue, type PillController, PillDate, type PillDateProps, PillDivider, PillField, type PillFieldProps, PillFields, type PillFieldsProps, PillFile, type PillFileProps, PillForm, PillFormPanel, type PillFormPanelProps, type PillFormProps, PillIcon, PillInput, type PillInputProps, type PillInputType, type PillLinkActionProps, PillMessage, type PillMultipleChoiceProps, PillNavbar, type PillNavbarProps, PillNotification, type PillNotificationClassNames, type PillNotificationProps, PillOptics, type PillOption, type PillOptionGroup, type PillOrientation, PillPanel, type PillPanelProps, PillPanelTrigger, type PillPanelTriggerProps, type PillPlacement, type PillPresence, type PillProps, type PillQueueState, PillSelect, type PillSelectProps, type PillSingleChoiceProps, PillSlider, type PillSliderProps, PillStepper, type PillStepperProps, PillSubmit, type PillSubmitProps, PillSwitch, type PillSwitchProps, PillTextarea, type PillTextareaProps, type PillTheme, type PillVariant, PlusIcon, type QueuedNotification, type SceneChange, type SendHandler, UndoIcon, pill, usePill, usePillQueue };
|
|
46
|
+
export { ArrowIcon, BoxIcon, type CalendarLabels, CheckIcon, CloseIcon, CouponIcon, type DateType, type DismissReason, DocumentIcon, type FieldControlProps, type FieldProps, HelpIcon, type IconProps, InfoIcon, type LinkComponent, MagicPill, type MagicPillProps, MailIcon, type NavActionItem, type NavItem, type NavLinkItem, type NavPanelItem, type NotificationAction, type NotificationLayout, type NotificationPanel, type NotifyInput, type NotifyOptions, type NotifyRenderOptions, PhoneIcon, Pill, PillAction, type PillActionProps, PillActions, type PillButtonActionProps, PillCheckbox, type PillCheckboxProps, type PillChoice, PillChoices, type PillChoicesProps, PillCode, type PillCodeProps, PillColor, type PillColorProps, type PillContextValue, type PillController, PillDate, type PillDateProps, PillDivider, PillField, type PillFieldProps, PillFields, type PillFieldsProps, PillFile, type PillFileProps, PillForm, PillFormPanel, type PillFormPanelProps, type PillFormProps, PillIcon, PillInput, type PillInputProps, type PillInputType, type PillLinkActionProps, PillMessage, type PillMultipleChoiceProps, PillNavbar, type PillNavbarProps, PillNotification, type PillNotificationClassNames, type PillNotificationProps, PillOptics, type PillOption, type PillOptionGroup, type PillOrientation, PillPanel, type PillPanelProps, PillPanelTrigger, type PillPanelTriggerProps, type PillPlacement, type PillPresence, type PillProps, type PillQueueState, PillSelect, type PillSelectProps, type PillSingleChoiceProps, PillSlider, type PillSliderProps, PillStepper, type PillStepperProps, PillSubmit, type PillSubmitProps, PillSwitch, type PillSwitchProps, PillTextarea, type PillTextareaProps, type PillTheme, type PillVariant, PlusIcon, type QueuedNotification, type SceneChange, type SendHandler, UndoIcon, pill, usePill, usePillQueue };
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { PillPanel, PillPanelTrigger } from "./Pill/PillPanel.js";
|
|
|
5
5
|
import { usePill } from "./Pill/PillContext.js";
|
|
6
6
|
import { LinkComponent, PillActionProps, PillButtonActionProps, PillContextValue, PillLinkActionProps, PillOrientation, PillPanelProps, PillPanelTriggerProps, PillPlacement, PillPresence, PillProps, PillTheme, PillVariant, SceneChange } from "./Pill/types.js";
|
|
7
7
|
import { PillOptics } from "./PillOptics/PillOptics.js";
|
|
8
|
-
import { NotificationAction, NotificationPanel, PillNotification, PillNotificationClassNames, PillNotificationProps } from "./PillNotification/PillNotification.js";
|
|
8
|
+
import { NotificationAction, NotificationLayout, NotificationPanel, PillNotification, PillNotificationClassNames, PillNotificationProps } from "./PillNotification/PillNotification.js";
|
|
9
9
|
import { NavActionItem, NavItem, NavLinkItem, NavPanelItem, PillNavbar, PillNavbarProps } from "./PillNavbar/PillNavbar.js";
|
|
10
10
|
import { PillForm, PillFormProps } from "./PillForm/PillForm.js";
|
|
11
11
|
import { SendHandler } from "./PillForm/send.js";
|
|
@@ -43,4 +43,4 @@ import PhoneIcon from "./icons/PhoneIcon.js";
|
|
|
43
43
|
import PlusIcon from "./icons/PlusIcon.js";
|
|
44
44
|
import UndoIcon from "./icons/UndoIcon.js";
|
|
45
45
|
import { IconProps } from "./icons/types.js";
|
|
46
|
-
export { ArrowIcon, BoxIcon, type CalendarLabels, CheckIcon, CloseIcon, CouponIcon, type DateType, type DismissReason, DocumentIcon, type FieldControlProps, type FieldProps, HelpIcon, type IconProps, InfoIcon, type LinkComponent, MagicPill, type MagicPillProps, MailIcon, type NavActionItem, type NavItem, type NavLinkItem, type NavPanelItem, type NotificationAction, type NotificationPanel, type NotifyInput, type NotifyOptions, type NotifyRenderOptions, PhoneIcon, Pill, PillAction, type PillActionProps, PillActions, type PillButtonActionProps, PillCheckbox, type PillCheckboxProps, type PillChoice, PillChoices, type PillChoicesProps, PillCode, type PillCodeProps, PillColor, type PillColorProps, type PillContextValue, type PillController, PillDate, type PillDateProps, PillDivider, PillField, type PillFieldProps, PillFields, type PillFieldsProps, PillFile, type PillFileProps, PillForm, PillFormPanel, type PillFormPanelProps, type PillFormProps, PillIcon, PillInput, type PillInputProps, type PillInputType, type PillLinkActionProps, PillMessage, type PillMultipleChoiceProps, PillNavbar, type PillNavbarProps, PillNotification, type PillNotificationClassNames, type PillNotificationProps, PillOptics, type PillOption, type PillOptionGroup, type PillOrientation, PillPanel, type PillPanelProps, PillPanelTrigger, type PillPanelTriggerProps, type PillPlacement, type PillPresence, type PillProps, type PillQueueState, PillSelect, type PillSelectProps, type PillSingleChoiceProps, PillSlider, type PillSliderProps, PillStepper, type PillStepperProps, PillSubmit, type PillSubmitProps, PillSwitch, type PillSwitchProps, PillTextarea, type PillTextareaProps, type PillTheme, type PillVariant, PlusIcon, type QueuedNotification, type SceneChange, type SendHandler, UndoIcon, pill, usePill, usePillQueue };
|
|
46
|
+
export { ArrowIcon, BoxIcon, type CalendarLabels, CheckIcon, CloseIcon, CouponIcon, type DateType, type DismissReason, DocumentIcon, type FieldControlProps, type FieldProps, HelpIcon, type IconProps, InfoIcon, type LinkComponent, MagicPill, type MagicPillProps, MailIcon, type NavActionItem, type NavItem, type NavLinkItem, type NavPanelItem, type NotificationAction, type NotificationLayout, type NotificationPanel, type NotifyInput, type NotifyOptions, type NotifyRenderOptions, PhoneIcon, Pill, PillAction, type PillActionProps, PillActions, type PillButtonActionProps, PillCheckbox, type PillCheckboxProps, type PillChoice, PillChoices, type PillChoicesProps, PillCode, type PillCodeProps, PillColor, type PillColorProps, type PillContextValue, type PillController, PillDate, type PillDateProps, PillDivider, PillField, type PillFieldProps, PillFields, type PillFieldsProps, PillFile, type PillFileProps, PillForm, PillFormPanel, type PillFormPanelProps, type PillFormProps, PillIcon, PillInput, type PillInputProps, type PillInputType, type PillLinkActionProps, PillMessage, type PillMultipleChoiceProps, PillNavbar, type PillNavbarProps, PillNotification, type PillNotificationClassNames, type PillNotificationProps, PillOptics, type PillOption, type PillOptionGroup, type PillOrientation, PillPanel, type PillPanelProps, PillPanelTrigger, type PillPanelTriggerProps, type PillPlacement, type PillPresence, type PillProps, type PillQueueState, PillSelect, type PillSelectProps, type PillSingleChoiceProps, PillSlider, type PillSliderProps, PillStepper, type PillStepperProps, PillSubmit, type PillSubmitProps, PillSwitch, type PillSwitchProps, PillTextarea, type PillTextareaProps, type PillTheme, type PillVariant, PlusIcon, type QueuedNotification, type SceneChange, type SendHandler, 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
|
@@ -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
|
|
@@ -531,6 +577,45 @@
|
|
|
531
577
|
}
|
|
532
578
|
}
|
|
533
579
|
|
|
580
|
+
/* A notification as a card (layout="card", a sidebar's): a column of
|
|
581
|
+
the sidebar's width, at least --mp-card-width. The icon on top, the
|
|
582
|
+
divider across, the message centred, the actions full width, one per
|
|
583
|
+
line, with their labels. After the vertical pill's rules, which it
|
|
584
|
+
adjusts */
|
|
585
|
+
& > [data-mp="card"] {
|
|
586
|
+
display: flex;
|
|
587
|
+
flex-direction: column;
|
|
588
|
+
align-items: center;
|
|
589
|
+
gap: calc(var(--_mp-gap) * 0.75);
|
|
590
|
+
inline-size: max(var(--mp-card-width, 12.5rem), var(--_mp-sidebar-width, 0px) - 2 * var(--_mp-padding));
|
|
591
|
+
max-inline-size: 100%;
|
|
592
|
+
text-align: center;
|
|
593
|
+
|
|
594
|
+
& > [data-mp="divider"] {
|
|
595
|
+
align-self: stretch;
|
|
596
|
+
inline-size: auto;
|
|
597
|
+
block-size: 1px;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
& > [data-mp="message"] {
|
|
601
|
+
inline-size: auto;
|
|
602
|
+
max-inline-size: 100%;
|
|
603
|
+
padding-inline: 0.25rem;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
& > [data-mp="actions"] {
|
|
607
|
+
flex-direction: column;
|
|
608
|
+
align-self: stretch;
|
|
609
|
+
align-items: stretch;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
& [data-mp="action"],
|
|
613
|
+
& [data-mp="action-body"] {
|
|
614
|
+
justify-content: center;
|
|
615
|
+
inline-size: 100%;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
|
|
534
619
|
/* A navbar stays in its pill: where it's too narrow, the open label is
|
|
535
620
|
cut short, rather than the last items */
|
|
536
621
|
&[data-orientation="horizontal"] [data-mp="navbar"] {
|