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.
Files changed (72) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/MIGRATING.md +2 -0
  3. package/README.md +55 -17
  4. package/dist/MagicPill/MagicPill.d.mts +9 -1
  5. package/dist/MagicPill/MagicPill.d.ts +9 -1
  6. package/dist/MagicPill/MagicPill.js +208 -107
  7. package/dist/MagicPill/MagicPill.mjs +211 -110
  8. package/dist/MagicPill/flag.js +93 -0
  9. package/dist/MagicPill/flag.mjs +91 -0
  10. package/dist/MagicPill/useChoreography.js +66 -0
  11. package/dist/MagicPill/useChoreography.mjs +66 -0
  12. package/dist/Pill/Pill.js +20 -9
  13. package/dist/Pill/Pill.mjs +21 -10
  14. package/dist/Pill/modal.js +2 -1
  15. package/dist/Pill/modal.mjs +3 -2
  16. package/dist/Pill/morph.js +178 -26
  17. package/dist/Pill/morph.mjs +178 -28
  18. package/dist/Pill/travel.js +77 -0
  19. package/dist/Pill/travel.mjs +76 -0
  20. package/dist/Pill/types.d.mts +8 -0
  21. package/dist/Pill/types.d.ts +8 -0
  22. package/dist/Pill/zone.js +3 -2
  23. package/dist/Pill/zone.mjs +4 -3
  24. package/dist/PillForm/PillField.js +16 -1
  25. package/dist/PillForm/PillField.mjs +17 -2
  26. package/dist/PillForm/PillSubmit.js +1 -1
  27. package/dist/PillForm/PillSubmit.mjs +3 -3
  28. package/dist/PillForm/popover.js +2 -1
  29. package/dist/PillForm/popover.mjs +3 -2
  30. package/dist/PillNavbar/PillNavbar.js +2 -1
  31. package/dist/PillNavbar/PillNavbar.mjs +2 -1
  32. package/dist/PillNotification/PillNotification.d.mts +16 -1
  33. package/dist/PillNotification/PillNotification.d.ts +16 -1
  34. package/dist/PillNotification/PillNotification.js +41 -30
  35. package/dist/PillNotification/PillNotification.mjs +41 -30
  36. package/dist/PillOptics/PillOptics.js +2 -1
  37. package/dist/PillOptics/PillOptics.mjs +3 -2
  38. package/dist/forms.css +40 -27
  39. package/dist/index.d.mts +29 -15
  40. package/dist/index.d.ts +29 -15
  41. package/dist/index.js +38 -12
  42. package/dist/index.mjs +38 -12
  43. package/dist/store/store.d.mts +9 -1
  44. package/dist/store/store.d.ts +9 -1
  45. package/dist/styles.css +91 -3
  46. package/dist/utils/react.js +8 -1
  47. package/dist/utils/react.mjs +8 -2
  48. package/package.json +2 -2
  49. package/dist/icons/ArrowIcon.d.mts +0 -4
  50. package/dist/icons/ArrowIcon.d.ts +0 -4
  51. package/dist/icons/BoxIcon.d.mts +0 -4
  52. package/dist/icons/BoxIcon.d.ts +0 -4
  53. package/dist/icons/CheckIcon.d.mts +0 -4
  54. package/dist/icons/CheckIcon.d.ts +0 -4
  55. package/dist/icons/CloseIcon.d.mts +0 -4
  56. package/dist/icons/CloseIcon.d.ts +0 -4
  57. package/dist/icons/CouponIcon.d.mts +0 -4
  58. package/dist/icons/CouponIcon.d.ts +0 -4
  59. package/dist/icons/DocumentIcon.d.mts +0 -4
  60. package/dist/icons/DocumentIcon.d.ts +0 -4
  61. package/dist/icons/HelpIcon.d.mts +0 -4
  62. package/dist/icons/HelpIcon.d.ts +0 -4
  63. package/dist/icons/InfoIcon.d.mts +0 -4
  64. package/dist/icons/InfoIcon.d.ts +0 -4
  65. package/dist/icons/MailIcon.d.mts +0 -4
  66. package/dist/icons/MailIcon.d.ts +0 -4
  67. package/dist/icons/PhoneIcon.d.mts +0 -4
  68. package/dist/icons/PhoneIcon.d.ts +0 -4
  69. package/dist/icons/PlusIcon.d.mts +0 -4
  70. package/dist/icons/PlusIcon.d.ts +0 -4
  71. package/dist/icons/UndoIcon.d.mts +0 -4
  72. package/dist/icons/UndoIcon.d.ts +0 -4
@@ -53,7 +53,8 @@ const PillNavbar = (0, react.forwardRef)(function PillNavbar({ items, pathname,
53
53
  label,
54
54
  href: item.href,
55
55
  linkComponent,
56
- "aria-current": item === active ? "page" : void 0
56
+ "aria-current": item === active ? "page" : void 0,
57
+ "data-href": item.href
57
58
  }, item.href);
58
59
  };
59
60
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
@@ -53,7 +53,8 @@ const PillNavbar = forwardRef(function PillNavbar({ items, pathname, linkCompone
53
53
  label,
54
54
  href: item.href,
55
55
  linkComponent,
56
- "aria-current": item === active ? "page" : void 0
56
+ "aria-current": item === active ? "page" : void 0,
57
+ "data-href": item.href
57
58
  }, item.href);
58
59
  };
59
60
  return /* @__PURE__ */ jsx("nav", {
@@ -37,6 +37,15 @@ export interface NotificationPanel {
37
37
  /** Always show the close button's label, not only on hover and focus. */
38
38
  closeExpanded?: boolean;
39
39
  }
40
+ /**
41
+ * How a notification's parts are arranged: in one row (`pill`, the default),
42
+ * with the actions on a second row under the message when they need the
43
+ * room (`rows`: a wrapping message, or an action and a panel's trigger), or
44
+ * in a column, as a sidebar is (`card`), or in a flag out of a sidebar's
45
+ * edge (`flag`, which the template lays out in one row). Card and flag are
46
+ * a sidebar host's.
47
+ */
48
+ export type NotificationLayout = "pill" | "rows" | "card" | "flag";
40
49
  export interface PillNotificationClassNames {
41
50
  icon?: string;
42
51
  divider?: string;
@@ -51,11 +60,17 @@ export interface PillNotificationProps {
51
60
  message: ReactNode;
52
61
  action?: NotificationAction;
53
62
  panel?: NotificationPanel;
63
+ /**
64
+ * `rows` puts the actions under the message when they need the room;
65
+ * `card` stacks everything in a column, actions full width. Default `pill`.
66
+ */
67
+ layout?: NotificationLayout;
54
68
  linkComponent?: LinkComponent;
55
69
  classNames?: PillNotificationClassNames;
56
70
  }
57
71
  /**
58
- * Icon · divider · message · action, with an optional expandable panel.
72
+ * Icon · divider · message · action, with an optional expandable panel. With
73
+ * `layout="rows"`, the actions go under the message when they need the room.
59
74
  * Render it inside a <Pill>, or let <MagicPill> render it for pill().notify().
60
75
  */
61
76
  export declare const PillNotification: (props: PillNotificationProps) => ReactNode;
@@ -37,6 +37,15 @@ export interface NotificationPanel {
37
37
  /** Always show the close button's label, not only on hover and focus. */
38
38
  closeExpanded?: boolean;
39
39
  }
40
+ /**
41
+ * How a notification's parts are arranged: in one row (`pill`, the default),
42
+ * with the actions on a second row under the message when they need the
43
+ * room (`rows`: a wrapping message, or an action and a panel's trigger), or
44
+ * in a column, as a sidebar is (`card`), or in a flag out of a sidebar's
45
+ * edge (`flag`, which the template lays out in one row). Card and flag are
46
+ * a sidebar host's.
47
+ */
48
+ export type NotificationLayout = "pill" | "rows" | "card" | "flag";
40
49
  export interface PillNotificationClassNames {
41
50
  icon?: string;
42
51
  divider?: string;
@@ -51,11 +60,17 @@ export interface PillNotificationProps {
51
60
  message: ReactNode;
52
61
  action?: NotificationAction;
53
62
  panel?: NotificationPanel;
63
+ /**
64
+ * `rows` puts the actions under the message when they need the room;
65
+ * `card` stacks everything in a column, actions full width. Default `pill`.
66
+ */
67
+ layout?: NotificationLayout;
54
68
  linkComponent?: LinkComponent;
55
69
  classNames?: PillNotificationClassNames;
56
70
  }
57
71
  /**
58
- * Icon · divider · message · action, with an optional expandable panel.
72
+ * Icon · divider · message · action, with an optional expandable panel. With
73
+ * `layout="rows"`, the actions go under the message when they need the room.
59
74
  * Render it inside a <Pill>, or let <MagicPill> render it for pill().notify().
60
75
  */
61
76
  export declare const PillNotification: (props: PillNotificationProps) => ReactNode;
@@ -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
- hasIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_parts.PillIcon, {
36
- className: classNames.icon,
37
- children: icon
38
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_parts.PillDivider, { className: classNames.divider })] }),
39
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_parts.PillMessage, {
40
- className: classNames.message,
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
- hasIcon && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(PillIcon, {
36
- className: classNames.icon,
37
- children: icon
38
- }), /* @__PURE__ */ jsx(PillDivider, { className: classNames.divider })] }),
39
- /* @__PURE__ */ jsx(PillMessage, {
40
- className: classNames.message,
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;
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  let react = require("react");
4
+ const require_react = require("../utils/react.js");
4
5
  const require_themed = require("../Pill/themed.js");
5
6
  const require_adaptive = require("./adaptive.js");
6
7
  const require_lens = require("./lens.js");
@@ -119,7 +120,7 @@ function PillOptics() {
119
120
  else element.style.removeProperty(property);
120
121
  });
121
122
  };
122
- (0, react.useLayoutEffect)(apply, [lenses]);
123
+ require_react.useIsomorphicLayoutEffect(apply, [lenses]);
123
124
  (0, react.useEffect)(() => {
124
125
  let stopped = false;
125
126
  let pending = false;
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
 
3
- import { Fragment, useEffect, useLayoutEffect, useRef, useState } from "react";
3
+ import { Fragment, useEffect, useRef, useState } from "react";
4
+ import { useIsomorphicLayoutEffect } from "../utils/react.mjs";
4
5
  import { onThemedPills, themedPills } from "../Pill/themed.mjs";
5
6
  import { adapt } from "./adaptive.mjs";
6
7
  import { canRefract, lensId, lensMap, makeLens } from "./lens.mjs";
@@ -119,7 +120,7 @@ function PillOptics() {
119
120
  else element.style.removeProperty(property);
120
121
  });
121
122
  };
122
- useLayoutEffect(apply, [lenses]);
123
+ useIsomorphicLayoutEffect(apply, [lenses]);
123
124
  useEffect(() => {
124
125
  let stopped = false;
125
126
  let pending = false;
package/dist/forms.css CHANGED
@@ -412,7 +412,11 @@
412
412
  padding: 0;
413
413
  border: 0;
414
414
  border-radius: 0;
415
- outline: 0;
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;
@@ -514,9 +518,10 @@
514
518
  font-size: 1.15rem;
515
519
  pointer-events: none;
516
520
 
517
- & > svg {
521
+ & > :is(svg, img) {
518
522
  inline-size: 1em;
519
523
  block-size: 1em;
524
+ object-fit: contain;
520
525
  }
521
526
  }
522
527
 
@@ -669,7 +674,8 @@
669
674
  gap: 0.5rem;
670
675
  padding: 0.6rem 0.8rem;
671
676
  border-radius: 1.1rem;
672
- outline: 0;
677
+ /* Its focus is its background (below), whatever an app's :focus-visible says */
678
+ outline: 0 !important;
673
679
  background: transparent;
674
680
  color: inherit;
675
681
  font-weight: 400;
@@ -1097,7 +1103,8 @@
1097
1103
  margin: 0;
1098
1104
  padding: 0.35rem 0;
1099
1105
  border: 0;
1100
- outline: 0;
1106
+ /* Its focus is drawn around the value, as for the text fields' box */
1107
+ outline: 0 !important;
1101
1108
  background: none;
1102
1109
  color: inherit;
1103
1110
  font: inherit;
@@ -1305,35 +1312,41 @@
1305
1312
 
1306
1313
  /* ─── States ───────────────────────────────────────────────────────────── */
1307
1314
 
1308
- & [data-mp="field-box"]:has(> :is(input, textarea, select):focus-visible) {
1309
- outline: 2px solid var(--_mp-on-surface);
1310
- outline-offset: 2px;
1311
- }
1312
-
1313
- & [data-mp="field-control"]:is([data-type="switch"], [data-type="checkbox"]) > input:focus-visible + span,
1314
- & input:focus-visible ~ [data-mp="slider-thumb"],
1315
- & [data-mp="choice"] > input:focus-visible + span,
1316
- & [data-mp="stepper-value"]:focus-within {
1317
- outline: 2px solid var(--_mp-on-surface);
1318
- outline-offset: 2px;
1319
- }
1315
+ /* Focus rings are for the keyboard: browsers match :focus-visible on a
1316
+ text field even after a click or a tap, so a field focused with a
1317
+ pointer (data-pointer-focus, written by the field) draws none. The
1318
+ caret shows where typing goes */
1319
+ & [data-mp="field"]:not([data-pointer-focus]) {
1320
+ & [data-mp="field-box"]:has(> :is(input, textarea, select):focus-visible) {
1321
+ outline: 2px solid var(--_mp-on-surface);
1322
+ outline-offset: 2px;
1323
+ }
1320
1324
 
1321
- & input:focus-visible ~ [data-mp="code-slot"][data-next],
1322
- & input:focus-visible ~ [data-mp="color-swatch"] {
1323
- outline: 2px solid var(--_mp-on-surface);
1324
- outline-offset: 2px;
1325
- }
1325
+ & [data-mp="field-control"]:is([data-type="switch"], [data-type="checkbox"]) > input:focus-visible + span,
1326
+ & input:focus-visible ~ [data-mp="slider-thumb"],
1327
+ & [data-mp="choice"] > input:focus-visible + span,
1328
+ & [data-mp="stepper-value"]:focus-within {
1329
+ outline: 2px solid var(--_mp-on-surface);
1330
+ outline-offset: 2px;
1331
+ }
1326
1332
 
1327
- & [data-mp="field-control"][data-type="file"]:focus-within {
1328
- outline: 2px solid var(--_mp-on-surface);
1329
- outline-offset: 2px;
1330
- }
1333
+ & input:focus-visible ~ [data-mp="code-slot"][data-next],
1334
+ & input:focus-visible ~ [data-mp="color-swatch"] {
1335
+ outline: 2px solid var(--_mp-on-surface);
1336
+ outline-offset: 2px;
1337
+ }
1331
1338
 
1332
- @supports not selector(:has(*)) {
1333
- & [data-mp="field-box"]:focus-within {
1339
+ & [data-mp="field-control"][data-type="file"]:focus-within {
1334
1340
  outline: 2px solid var(--_mp-on-surface);
1335
1341
  outline-offset: 2px;
1336
1342
  }
1343
+
1344
+ @supports not selector(:has(*)) {
1345
+ & [data-mp="field-box"]:focus-within {
1346
+ outline: 2px solid var(--_mp-on-surface);
1347
+ outline-offset: 2px;
1348
+ }
1349
+ }
1337
1350
  }
1338
1351
 
1339
1352
  & [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";
@@ -30,17 +30,31 @@ import { PillColor, PillColorProps } from "./PillForm/PillColor.mjs";
30
30
  import MagicPill, { MagicPillProps } from "./MagicPill/MagicPill.mjs";
31
31
  import { DismissReason, NotifyInput, NotifyOptions, NotifyRenderOptions, PillController, PillQueueState, QueuedNotification, pill } from "./store/store.mjs";
32
32
  import { usePillQueue } from "./store/usePillQueue.mjs";
33
- import ArrowIcon from "./icons/ArrowIcon.mjs";
34
- import BoxIcon from "./icons/BoxIcon.mjs";
35
- import CheckIcon from "./icons/CheckIcon.mjs";
36
- import CloseIcon from "./icons/CloseIcon.mjs";
37
- import CouponIcon from "./icons/CouponIcon.mjs";
38
- import DocumentIcon from "./icons/DocumentIcon.mjs";
39
- import HelpIcon from "./icons/HelpIcon.mjs";
40
- import InfoIcon from "./icons/InfoIcon.mjs";
41
- import MailIcon from "./icons/MailIcon.mjs";
42
- import PhoneIcon from "./icons/PhoneIcon.mjs";
43
- import PlusIcon from "./icons/PlusIcon.mjs";
44
- import UndoIcon from "./icons/UndoIcon.mjs";
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 };
33
+ import { IconProps as IconProps$1 } from "./icons/types.mjs";
34
+ /** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
35
+ export declare const ArrowIcon: (props: IconProps$1) => import("react").JSX.Element;
36
+ /** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
37
+ export declare const BoxIcon: (props: IconProps$1) => import("react").JSX.Element;
38
+ /** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
39
+ export declare const CheckIcon: (props: IconProps$1) => import("react").JSX.Element;
40
+ /** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
41
+ export declare const CloseIcon: (props: IconProps$1) => import("react").JSX.Element;
42
+ /** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
43
+ export declare const CouponIcon: (props: IconProps$1) => import("react").JSX.Element;
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
+ export declare const DocumentIcon: (props: IconProps$1) => import("react").JSX.Element;
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
+ export declare const HelpIcon: (props: IconProps$1) => import("react").JSX.Element;
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
+ export declare const InfoIcon: (props: IconProps$1) => import("react").JSX.Element;
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
+ export declare const MailIcon: (props: IconProps$1) => import("react").JSX.Element;
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
+ export declare const PhoneIcon: (props: IconProps$1) => import("react").JSX.Element;
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
+ export declare const PlusIcon: (props: IconProps$1) => import("react").JSX.Element;
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
+ export declare const UndoIcon: (props: IconProps$1) => import("react").JSX.Element;
58
+ /** @deprecated The props of the built-in icons, which are deprecated: any `<svg>` attribute, `ComponentPropsWithoutRef<"svg">`. */
59
+ export type IconProps = IconProps$1;
60
+ export { type CalendarLabels, type DateType, type DismissReason, type FieldControlProps, type FieldProps, type LinkComponent, MagicPill, type MagicPillProps, type NavActionItem, type NavItem, type NavLinkItem, type NavPanelItem, type NotificationAction, type NotificationLayout, type NotificationPanel, type NotifyInput, type NotifyOptions, type NotifyRenderOptions, 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, type QueuedNotification, type SceneChange, type SendHandler, 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";
@@ -30,17 +30,31 @@ import { PillColor, PillColorProps } from "./PillForm/PillColor.js";
30
30
  import MagicPill, { MagicPillProps } from "./MagicPill/MagicPill.js";
31
31
  import { DismissReason, NotifyInput, NotifyOptions, NotifyRenderOptions, PillController, PillQueueState, QueuedNotification, pill } from "./store/store.js";
32
32
  import { usePillQueue } from "./store/usePillQueue.js";
33
- import ArrowIcon from "./icons/ArrowIcon.js";
34
- import BoxIcon from "./icons/BoxIcon.js";
35
- import CheckIcon from "./icons/CheckIcon.js";
36
- import CloseIcon from "./icons/CloseIcon.js";
37
- import CouponIcon from "./icons/CouponIcon.js";
38
- import DocumentIcon from "./icons/DocumentIcon.js";
39
- import HelpIcon from "./icons/HelpIcon.js";
40
- import InfoIcon from "./icons/InfoIcon.js";
41
- import MailIcon from "./icons/MailIcon.js";
42
- import PhoneIcon from "./icons/PhoneIcon.js";
43
- import PlusIcon from "./icons/PlusIcon.js";
44
- import UndoIcon from "./icons/UndoIcon.js";
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 };
33
+ import { IconProps as IconProps$1 } from "./icons/types.js";
34
+ /** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
35
+ export declare const ArrowIcon: (props: IconProps$1) => import("react").JSX.Element;
36
+ /** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
37
+ export declare const BoxIcon: (props: IconProps$1) => import("react").JSX.Element;
38
+ /** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
39
+ export declare const CheckIcon: (props: IconProps$1) => import("react").JSX.Element;
40
+ /** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
41
+ export declare const CloseIcon: (props: IconProps$1) => import("react").JSX.Element;
42
+ /** @deprecated Bring your own icons: any svg, image or icon component works (README, "Icons"). The built-in ones go in the next major version. */
43
+ export declare const CouponIcon: (props: IconProps$1) => import("react").JSX.Element;
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
+ export declare const DocumentIcon: (props: IconProps$1) => import("react").JSX.Element;
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
+ export declare const HelpIcon: (props: IconProps$1) => import("react").JSX.Element;
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
+ export declare const InfoIcon: (props: IconProps$1) => import("react").JSX.Element;
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
+ export declare const MailIcon: (props: IconProps$1) => import("react").JSX.Element;
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
+ export declare const PhoneIcon: (props: IconProps$1) => import("react").JSX.Element;
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
+ export declare const PlusIcon: (props: IconProps$1) => import("react").JSX.Element;
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
+ export declare const UndoIcon: (props: IconProps$1) => import("react").JSX.Element;
58
+ /** @deprecated The props of the built-in icons, which are deprecated: any `<svg>` attribute, `ComponentPropsWithoutRef<"svg">`. */
59
+ export type IconProps = IconProps$1;
60
+ export { type CalendarLabels, type DateType, type DismissReason, type FieldControlProps, type FieldProps, type LinkComponent, MagicPill, type MagicPillProps, type NavActionItem, type NavItem, type NavLinkItem, type NavPanelItem, type NotificationAction, type NotificationLayout, type NotificationPanel, type NotifyInput, type NotifyOptions, type NotifyRenderOptions, 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, type QueuedNotification, type SceneChange, type SendHandler, pill, usePill, usePillQueue };