magic-pill 8.1.0 → 9.0.0-next.1
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 +46 -0
- package/MIGRATING.md +224 -0
- package/README.md +312 -257
- package/dist/MagicPill/MagicPill.d.mts +27 -0
- package/dist/MagicPill/MagicPill.d.ts +27 -0
- package/dist/MagicPill/MagicPill.js +185 -0
- package/dist/MagicPill/MagicPill.mjs +185 -0
- package/dist/MagicPill/choreography.js +91 -0
- package/dist/MagicPill/choreography.mjs +85 -0
- package/dist/Pill/Pill.d.mts +7 -0
- package/dist/Pill/Pill.d.ts +7 -0
- package/dist/Pill/Pill.js +106 -0
- package/dist/Pill/Pill.mjs +106 -0
- package/dist/Pill/PillAction.d.mts +7 -0
- package/dist/Pill/PillAction.d.ts +7 -0
- package/dist/Pill/PillAction.js +67 -0
- package/dist/Pill/PillAction.mjs +67 -0
- package/dist/Pill/PillContext.d.mts +3 -0
- package/dist/Pill/PillContext.d.ts +3 -0
- package/dist/Pill/PillContext.js +26 -0
- package/dist/Pill/PillContext.mjs +24 -0
- package/dist/Pill/PillPanel.d.mts +9 -0
- package/dist/Pill/PillPanel.d.ts +9 -0
- package/dist/Pill/PillPanel.js +88 -0
- package/dist/Pill/PillPanel.mjs +87 -0
- package/dist/Pill/parts.d.mts +10 -0
- package/dist/Pill/parts.d.ts +10 -0
- package/dist/Pill/parts.js +46 -0
- package/dist/Pill/parts.mjs +43 -0
- package/dist/Pill/types.d.mts +88 -0
- package/dist/Pill/types.d.ts +88 -0
- package/dist/PillNavbar/PillNavbar.d.mts +31 -0
- package/dist/PillNavbar/PillNavbar.d.ts +31 -0
- package/dist/PillNavbar/PillNavbar.js +44 -0
- package/dist/PillNavbar/PillNavbar.mjs +44 -0
- package/dist/PillNavbar/matchPath.d.mts +2 -0
- package/dist/PillNavbar/matchPath.d.ts +2 -0
- package/dist/PillNavbar/matchPath.js +34 -0
- package/dist/PillNavbar/matchPath.mjs +34 -0
- package/dist/PillNotification/PillNotification.d.mts +51 -0
- package/dist/PillNotification/PillNotification.d.ts +51 -0
- package/dist/PillNotification/PillNotification.js +64 -0
- package/dist/PillNotification/PillNotification.mjs +63 -0
- package/dist/icons/ArrowIcon.d.mts +4 -0
- package/dist/icons/ArrowIcon.d.ts +4 -0
- package/dist/icons/ArrowIcon.js +21 -0
- package/dist/icons/ArrowIcon.mjs +21 -0
- package/dist/icons/BoxIcon.d.mts +4 -0
- package/dist/icons/BoxIcon.d.ts +4 -0
- package/dist/icons/BoxIcon.js +21 -0
- package/dist/icons/BoxIcon.mjs +21 -0
- package/dist/icons/CheckIcon.d.mts +4 -0
- package/dist/icons/CheckIcon.d.ts +4 -0
- package/dist/icons/CheckIcon.js +17 -0
- package/dist/icons/CheckIcon.mjs +17 -0
- package/dist/icons/CloseIcon.d.mts +4 -0
- package/dist/icons/CloseIcon.d.ts +4 -0
- package/dist/icons/CloseIcon.js +17 -0
- package/dist/icons/CloseIcon.mjs +17 -0
- package/dist/icons/CouponIcon.d.mts +4 -0
- package/dist/icons/CouponIcon.d.ts +4 -0
- package/dist/icons/CouponIcon.js +17 -0
- package/dist/icons/CouponIcon.mjs +17 -0
- package/dist/icons/DocumentIcon.d.mts +4 -0
- package/dist/icons/DocumentIcon.d.ts +4 -0
- package/dist/icons/DocumentIcon.js +17 -0
- package/dist/icons/DocumentIcon.mjs +17 -0
- package/dist/icons/HelpIcon.d.mts +4 -0
- package/dist/icons/HelpIcon.d.ts +4 -0
- package/dist/icons/HelpIcon.js +17 -0
- package/dist/icons/HelpIcon.mjs +17 -0
- package/dist/icons/InfoIcon.d.mts +4 -0
- package/dist/icons/InfoIcon.d.ts +4 -0
- package/dist/icons/InfoIcon.js +17 -0
- package/dist/icons/InfoIcon.mjs +17 -0
- package/dist/icons/MailIcon.d.mts +4 -0
- package/dist/icons/MailIcon.d.ts +4 -0
- package/dist/icons/MailIcon.js +17 -0
- package/dist/icons/MailIcon.mjs +17 -0
- package/dist/icons/PhoneIcon.d.mts +4 -0
- package/dist/icons/PhoneIcon.d.ts +4 -0
- package/dist/icons/PhoneIcon.js +21 -0
- package/dist/icons/PhoneIcon.mjs +21 -0
- package/dist/icons/PlusIcon.d.mts +4 -0
- package/dist/icons/PlusIcon.d.ts +4 -0
- package/dist/icons/PlusIcon.js +17 -0
- package/dist/icons/PlusIcon.mjs +17 -0
- package/dist/icons/UndoIcon.d.mts +4 -0
- package/dist/icons/UndoIcon.d.ts +4 -0
- package/dist/icons/UndoIcon.js +21 -0
- package/dist/icons/UndoIcon.mjs +21 -0
- package/dist/icons/types.d.mts +3 -0
- package/dist/icons/types.d.ts +3 -0
- package/dist/index.d.mts +25 -8
- package/dist/index.d.ts +25 -9
- package/dist/index.js +50 -1
- package/dist/index.mjs +24 -1
- package/dist/store/store.d.mts +63 -0
- package/dist/store/store.d.ts +63 -0
- package/dist/store/store.js +104 -0
- package/dist/store/store.mjs +102 -0
- package/dist/store/usePillQueue.d.mts +6 -0
- package/dist/store/usePillQueue.d.ts +6 -0
- package/dist/store/usePillQueue.js +17 -0
- package/dist/store/usePillQueue.mjs +17 -0
- package/dist/styles.css +456 -0
- package/dist/utils/react.js +23 -0
- package/dist/utils/react.mjs +21 -0
- package/dist/utils/url.js +22 -0
- package/dist/utils/url.mjs +22 -0
- package/package.json +7 -4
- package/dist/MagicPill.d.mts +0 -6
- package/dist/MagicPill.d.ts +0 -7
- package/dist/MagicPill.js +0 -2
- package/dist/MagicPill.js.map +0 -1
- package/dist/MagicPill.mjs +0 -2
- package/dist/MagicPill.mjs.map +0 -1
- package/dist/Navbar/Navbar.js +0 -2
- package/dist/Navbar/Navbar.js.map +0 -1
- package/dist/Navbar/Navbar.mjs +0 -2
- package/dist/Navbar/Navbar.mjs.map +0 -1
- package/dist/Notification/Notification.js +0 -2
- package/dist/Notification/Notification.js.map +0 -1
- package/dist/Notification/Notification.mjs +0 -2
- package/dist/Notification/Notification.mjs.map +0 -1
- package/dist/defaultPillData.d.mts +0 -2
- package/dist/defaultPillData.d.ts +0 -3
- package/dist/defaultPillData.js +0 -7
- package/dist/defaultPillData.js.map +0 -1
- package/dist/defaultPillData.mjs +0 -7
- package/dist/defaultPillData.mjs.map +0 -1
- package/dist/icons/arrow_label.js +0 -2
- package/dist/icons/arrow_label.js.map +0 -1
- package/dist/icons/arrow_label.mjs +0 -2
- package/dist/icons/arrow_label.mjs.map +0 -1
- package/dist/icons/box_label.js +0 -2
- package/dist/icons/box_label.js.map +0 -1
- package/dist/icons/box_label.mjs +0 -2
- package/dist/icons/box_label.mjs.map +0 -1
- package/dist/icons/checkmark.js +0 -2
- package/dist/icons/checkmark.js.map +0 -1
- package/dist/icons/checkmark.mjs +0 -2
- package/dist/icons/checkmark.mjs.map +0 -1
- package/dist/icons/checkmark_label.js +0 -2
- package/dist/icons/checkmark_label.js.map +0 -1
- package/dist/icons/checkmark_label.mjs +0 -2
- package/dist/icons/checkmark_label.mjs.map +0 -1
- package/dist/icons/coupon.js +0 -2
- package/dist/icons/coupon.js.map +0 -1
- package/dist/icons/coupon.mjs +0 -2
- package/dist/icons/coupon.mjs.map +0 -1
- package/dist/icons/cross_label.js +0 -2
- package/dist/icons/cross_label.js.map +0 -1
- package/dist/icons/cross_label.mjs +0 -2
- package/dist/icons/cross_label.mjs.map +0 -1
- package/dist/icons/info.js +0 -2
- package/dist/icons/info.js.map +0 -1
- package/dist/icons/info.mjs +0 -2
- package/dist/icons/info.mjs.map +0 -1
- package/dist/icons/info_label.js +0 -2
- package/dist/icons/info_label.js.map +0 -1
- package/dist/icons/info_label.mjs +0 -2
- package/dist/icons/info_label.mjs.map +0 -1
- package/dist/icons/mail_label.js +0 -2
- package/dist/icons/mail_label.js.map +0 -1
- package/dist/icons/mail_label.mjs +0 -2
- package/dist/icons/mail_label.mjs.map +0 -1
- package/dist/icons/plus_label.js +0 -2
- package/dist/icons/plus_label.js.map +0 -1
- package/dist/icons/plus_label.mjs +0 -2
- package/dist/icons/plus_label.mjs.map +0 -1
- package/dist/icons/questionmark.js +0 -2
- package/dist/icons/questionmark.js.map +0 -1
- package/dist/icons/questionmark.mjs +0 -2
- package/dist/icons/questionmark.mjs.map +0 -1
- package/dist/icons/quotation_label.js +0 -2
- package/dist/icons/quotation_label.js.map +0 -1
- package/dist/icons/quotation_label.mjs +0 -2
- package/dist/icons/quotation_label.mjs.map +0 -1
- package/dist/icons/tel_label.js +0 -2
- package/dist/icons/tel_label.js.map +0 -1
- package/dist/icons/tel_label.mjs +0 -2
- package/dist/icons/tel_label.mjs.map +0 -1
- package/dist/icons/undo_label.js +0 -2
- package/dist/icons/undo_label.js.map +0 -1
- package/dist/icons/undo_label.mjs +0 -2
- package/dist/icons/undo_label.mjs.map +0 -1
- package/dist/magicpill.css +0 -315
- package/dist/types/index.d.ts +0 -4
- package/dist/types/magicPill.d.mts +0 -50
- package/dist/types/magicPill.d.ts +0 -50
- package/dist/types/navbar.d.mts +0 -27
- package/dist/types/navbar.d.ts +0 -28
- package/dist/types/notification.d.mts +0 -140
- package/dist/types/notification.d.ts +0 -141
- package/dist/utils/handlers.d.mts +0 -20
- package/dist/utils/handlers.d.ts +0 -21
- package/dist/utils/handlers.js +0 -2
- package/dist/utils/handlers.js.map +0 -1
- package/dist/utils/handlers.mjs +0 -2
- package/dist/utils/handlers.mjs.map +0 -1
- package/dist/utils/icons.d.mts +0 -20
- package/dist/utils/icons.d.ts +0 -20
- package/dist/utils/icons.js +0 -2
- package/dist/utils/icons.js.map +0 -1
- package/dist/utils/icons.mjs +0 -2
- package/dist/utils/icons.mjs.map +0 -1
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
let react = require("react");
|
|
4
|
+
const require_PillContext = require("./PillContext.js");
|
|
5
|
+
const require_react = require("../utils/react.js");
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
|
|
8
|
+
// src/Pill/Pill.tsx
|
|
9
|
+
const defaultOrientation = (placement) => placement === "left" || placement === "right" ? "vertical" : "horizontal";
|
|
10
|
+
/**
|
|
11
|
+
* The pill: a container with the Magic Pill design language. Put any parts
|
|
12
|
+
* (or anything else) inside. Its look and animations follow its data attributes.
|
|
13
|
+
*/
|
|
14
|
+
const Pill = (0, react.forwardRef)(function Pill({ presence: presenceProp, defaultPresence = "compact", onPresenceChange, placement = "inline", orientation, variant = "neutral", unstyled = false, children, onKeyDown, ...rest }, forwardedRef) {
|
|
15
|
+
const [uncontrolledPresence, setUncontrolledPresence] = (0, react.useState)(defaultPresence);
|
|
16
|
+
const isControlled = presenceProp !== void 0;
|
|
17
|
+
const presence = isControlled ? presenceProp : uncontrolledPresence;
|
|
18
|
+
const resolvedOrientation = orientation ?? defaultOrientation(placement);
|
|
19
|
+
const isOverlay = placement === "overlay";
|
|
20
|
+
const isVisible = presence !== "hidden";
|
|
21
|
+
const rootRef = (0, react.useRef)(null);
|
|
22
|
+
const ref = (0, react.useMemo)(() => require_react.mergeRefs(rootRef, forwardedRef), [forwardedRef]);
|
|
23
|
+
const panelTriggerRef = (0, react.useRef)(null);
|
|
24
|
+
const panelId = (0, react.useId)();
|
|
25
|
+
const returnPresenceRef = (0, react.useRef)("compact");
|
|
26
|
+
(0, react.useEffect)(() => {
|
|
27
|
+
if (presence !== "panel" && presence !== "hidden") returnPresenceRef.current = presence;
|
|
28
|
+
}, [presence]);
|
|
29
|
+
const setPresence = (0, react.useCallback)((next) => {
|
|
30
|
+
if (next === presence) return;
|
|
31
|
+
if (!isControlled) setUncontrolledPresence(next);
|
|
32
|
+
onPresenceChange?.(next);
|
|
33
|
+
}, [
|
|
34
|
+
presence,
|
|
35
|
+
isControlled,
|
|
36
|
+
onPresenceChange
|
|
37
|
+
]);
|
|
38
|
+
const closePanel = (0, react.useCallback)(() => {
|
|
39
|
+
if (presence === "panel") setPresence(returnPresenceRef.current);
|
|
40
|
+
}, [presence, setPresence]);
|
|
41
|
+
(0, react.useEffect)(() => {
|
|
42
|
+
const dialog = rootRef.current;
|
|
43
|
+
if (!isOverlay || !dialog || typeof dialog.showModal !== "function") return;
|
|
44
|
+
if (isVisible && !dialog.open) dialog.showModal();
|
|
45
|
+
else if (!isVisible && dialog.open) dialog.close();
|
|
46
|
+
}, [isOverlay, isVisible]);
|
|
47
|
+
const handleKeyDown = (event) => {
|
|
48
|
+
onKeyDown?.(event);
|
|
49
|
+
if (event.defaultPrevented || isOverlay) return;
|
|
50
|
+
if (event.key === "Escape" && presence === "panel") {
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
event.stopPropagation();
|
|
53
|
+
closePanel();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const handleCancel = (event) => {
|
|
57
|
+
event.preventDefault();
|
|
58
|
+
if (presence === "panel") closePanel();
|
|
59
|
+
else setPresence("hidden");
|
|
60
|
+
};
|
|
61
|
+
const handleClose = () => {
|
|
62
|
+
if (presence !== "hidden") setPresence("hidden");
|
|
63
|
+
};
|
|
64
|
+
const context = (0, react.useMemo)(() => ({
|
|
65
|
+
presence,
|
|
66
|
+
setPresence,
|
|
67
|
+
closePanel,
|
|
68
|
+
placement,
|
|
69
|
+
orientation: resolvedOrientation,
|
|
70
|
+
variant,
|
|
71
|
+
panelId,
|
|
72
|
+
panelTriggerRef,
|
|
73
|
+
rootRef
|
|
74
|
+
}), [
|
|
75
|
+
presence,
|
|
76
|
+
setPresence,
|
|
77
|
+
closePanel,
|
|
78
|
+
placement,
|
|
79
|
+
resolvedOrientation,
|
|
80
|
+
variant,
|
|
81
|
+
panelId
|
|
82
|
+
]);
|
|
83
|
+
const Element = isOverlay ? "dialog" : "div";
|
|
84
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PillContext.PillContext.Provider, {
|
|
85
|
+
value: context,
|
|
86
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Element, {
|
|
87
|
+
...rest,
|
|
88
|
+
ref,
|
|
89
|
+
"data-mp": "pill",
|
|
90
|
+
"data-presence": presence,
|
|
91
|
+
"data-placement": placement,
|
|
92
|
+
"data-orientation": resolvedOrientation,
|
|
93
|
+
"data-variant": variant,
|
|
94
|
+
"data-unstyled": unstyled ? "" : void 0,
|
|
95
|
+
...require_react.inertProps(!isVisible && !isOverlay),
|
|
96
|
+
onKeyDown: handleKeyDown,
|
|
97
|
+
...isOverlay ? {
|
|
98
|
+
onCancel: handleCancel,
|
|
99
|
+
onClose: handleClose
|
|
100
|
+
} : {},
|
|
101
|
+
children
|
|
102
|
+
})
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
module.exports = Pill;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { forwardRef, useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { PillContext } from "./PillContext.mjs";
|
|
5
|
+
import { inertProps, mergeRefs } from "../utils/react.mjs";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
// src/Pill/Pill.tsx
|
|
9
|
+
const defaultOrientation = (placement) => placement === "left" || placement === "right" ? "vertical" : "horizontal";
|
|
10
|
+
/**
|
|
11
|
+
* The pill: a container with the Magic Pill design language. Put any parts
|
|
12
|
+
* (or anything else) inside. Its look and animations follow its data attributes.
|
|
13
|
+
*/
|
|
14
|
+
const Pill = forwardRef(function Pill({ presence: presenceProp, defaultPresence = "compact", onPresenceChange, placement = "inline", orientation, variant = "neutral", unstyled = false, children, onKeyDown, ...rest }, forwardedRef) {
|
|
15
|
+
const [uncontrolledPresence, setUncontrolledPresence] = useState(defaultPresence);
|
|
16
|
+
const isControlled = presenceProp !== void 0;
|
|
17
|
+
const presence = isControlled ? presenceProp : uncontrolledPresence;
|
|
18
|
+
const resolvedOrientation = orientation ?? defaultOrientation(placement);
|
|
19
|
+
const isOverlay = placement === "overlay";
|
|
20
|
+
const isVisible = presence !== "hidden";
|
|
21
|
+
const rootRef = useRef(null);
|
|
22
|
+
const ref = useMemo(() => mergeRefs(rootRef, forwardedRef), [forwardedRef]);
|
|
23
|
+
const panelTriggerRef = useRef(null);
|
|
24
|
+
const panelId = useId();
|
|
25
|
+
const returnPresenceRef = useRef("compact");
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (presence !== "panel" && presence !== "hidden") returnPresenceRef.current = presence;
|
|
28
|
+
}, [presence]);
|
|
29
|
+
const setPresence = useCallback((next) => {
|
|
30
|
+
if (next === presence) return;
|
|
31
|
+
if (!isControlled) setUncontrolledPresence(next);
|
|
32
|
+
onPresenceChange?.(next);
|
|
33
|
+
}, [
|
|
34
|
+
presence,
|
|
35
|
+
isControlled,
|
|
36
|
+
onPresenceChange
|
|
37
|
+
]);
|
|
38
|
+
const closePanel = useCallback(() => {
|
|
39
|
+
if (presence === "panel") setPresence(returnPresenceRef.current);
|
|
40
|
+
}, [presence, setPresence]);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
const dialog = rootRef.current;
|
|
43
|
+
if (!isOverlay || !dialog || typeof dialog.showModal !== "function") return;
|
|
44
|
+
if (isVisible && !dialog.open) dialog.showModal();
|
|
45
|
+
else if (!isVisible && dialog.open) dialog.close();
|
|
46
|
+
}, [isOverlay, isVisible]);
|
|
47
|
+
const handleKeyDown = (event) => {
|
|
48
|
+
onKeyDown?.(event);
|
|
49
|
+
if (event.defaultPrevented || isOverlay) return;
|
|
50
|
+
if (event.key === "Escape" && presence === "panel") {
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
event.stopPropagation();
|
|
53
|
+
closePanel();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const handleCancel = (event) => {
|
|
57
|
+
event.preventDefault();
|
|
58
|
+
if (presence === "panel") closePanel();
|
|
59
|
+
else setPresence("hidden");
|
|
60
|
+
};
|
|
61
|
+
const handleClose = () => {
|
|
62
|
+
if (presence !== "hidden") setPresence("hidden");
|
|
63
|
+
};
|
|
64
|
+
const context = useMemo(() => ({
|
|
65
|
+
presence,
|
|
66
|
+
setPresence,
|
|
67
|
+
closePanel,
|
|
68
|
+
placement,
|
|
69
|
+
orientation: resolvedOrientation,
|
|
70
|
+
variant,
|
|
71
|
+
panelId,
|
|
72
|
+
panelTriggerRef,
|
|
73
|
+
rootRef
|
|
74
|
+
}), [
|
|
75
|
+
presence,
|
|
76
|
+
setPresence,
|
|
77
|
+
closePanel,
|
|
78
|
+
placement,
|
|
79
|
+
resolvedOrientation,
|
|
80
|
+
variant,
|
|
81
|
+
panelId
|
|
82
|
+
]);
|
|
83
|
+
const Element = isOverlay ? "dialog" : "div";
|
|
84
|
+
return /* @__PURE__ */ jsx(PillContext.Provider, {
|
|
85
|
+
value: context,
|
|
86
|
+
children: /* @__PURE__ */ jsx(Element, {
|
|
87
|
+
...rest,
|
|
88
|
+
ref,
|
|
89
|
+
"data-mp": "pill",
|
|
90
|
+
"data-presence": presence,
|
|
91
|
+
"data-placement": placement,
|
|
92
|
+
"data-orientation": resolvedOrientation,
|
|
93
|
+
"data-variant": variant,
|
|
94
|
+
"data-unstyled": unstyled ? "" : void 0,
|
|
95
|
+
...inertProps(!isVisible && !isOverlay),
|
|
96
|
+
onKeyDown: handleKeyDown,
|
|
97
|
+
...isOverlay ? {
|
|
98
|
+
onCancel: handleCancel,
|
|
99
|
+
onClose: handleClose
|
|
100
|
+
} : {},
|
|
101
|
+
children
|
|
102
|
+
})
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
export { Pill as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PillActionProps } from "./types.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* The light round button: its icon at rest, icon + bold label when expanded.
|
|
4
|
+
* A <button> with `onClick`, a link with `href`.
|
|
5
|
+
*/
|
|
6
|
+
declare const PillAction: import("react").ForwardRefExoticComponent<PillActionProps & import("react").RefAttributes<HTMLElement>>;
|
|
7
|
+
export { PillAction as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PillActionProps } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* The light round button: its icon at rest, icon + bold label when expanded.
|
|
4
|
+
* A <button> with `onClick`, a link with `href`.
|
|
5
|
+
*/
|
|
6
|
+
declare const PillAction: import("react").ForwardRefExoticComponent<PillActionProps & import("react").RefAttributes<HTMLElement>>;
|
|
7
|
+
export = PillAction;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
let react = require("react");
|
|
2
|
+
const require_url = require("../utils/url.js");
|
|
3
|
+
const require_react = require("../utils/react.js");
|
|
4
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
+
|
|
6
|
+
// src/Pill/PillAction.tsx
|
|
7
|
+
/**
|
|
8
|
+
* The light round button: its icon at rest, icon + bold label when expanded.
|
|
9
|
+
* A <button> with `onClick`, a link with `href`.
|
|
10
|
+
*/
|
|
11
|
+
const PillAction = (0, react.forwardRef)(function PillAction(props, ref) {
|
|
12
|
+
const { icon, label, expanded } = props;
|
|
13
|
+
const hasIcon = icon !== void 0 && icon !== null;
|
|
14
|
+
const shared = {
|
|
15
|
+
"data-mp": "action",
|
|
16
|
+
"data-expanded": expanded || !hasIcon ? "" : void 0
|
|
17
|
+
};
|
|
18
|
+
const content = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
19
|
+
"data-mp": "action-body",
|
|
20
|
+
children: [hasIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
21
|
+
"data-mp": "action-icon",
|
|
22
|
+
"aria-hidden": "true",
|
|
23
|
+
children: icon
|
|
24
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
25
|
+
"data-mp": "label",
|
|
26
|
+
children: label
|
|
27
|
+
})]
|
|
28
|
+
});
|
|
29
|
+
if (props.href !== void 0) {
|
|
30
|
+
const { icon: _icon, label: _label, expanded: _expanded, href, linkComponent: Link, ...rest } = props;
|
|
31
|
+
const anchorRef = ref;
|
|
32
|
+
if (!require_url.isSafeHref(href)) {
|
|
33
|
+
require_react.devWarn(`<PillAction label="${label}"> got an unsafe href and renders without a link. Only relative, http(s):, mailto: and tel: URLs are allowed.`);
|
|
34
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
35
|
+
...rest,
|
|
36
|
+
...shared,
|
|
37
|
+
ref: anchorRef,
|
|
38
|
+
"aria-disabled": "true",
|
|
39
|
+
children: content
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
if (Link) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Link, {
|
|
43
|
+
...rest,
|
|
44
|
+
...shared,
|
|
45
|
+
ref: anchorRef,
|
|
46
|
+
href,
|
|
47
|
+
children: content
|
|
48
|
+
});
|
|
49
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
50
|
+
...rest,
|
|
51
|
+
...shared,
|
|
52
|
+
ref: anchorRef,
|
|
53
|
+
href,
|
|
54
|
+
children: content
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
const { icon: _icon, label: _label, expanded: _expanded, href: _href, ...rest } = props;
|
|
58
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
59
|
+
type: "button",
|
|
60
|
+
...rest,
|
|
61
|
+
...shared,
|
|
62
|
+
ref,
|
|
63
|
+
children: content
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
module.exports = PillAction;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
import { isSafeHref } from "../utils/url.mjs";
|
|
3
|
+
import { devWarn } from "../utils/react.mjs";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
// src/Pill/PillAction.tsx
|
|
7
|
+
/**
|
|
8
|
+
* The light round button: its icon at rest, icon + bold label when expanded.
|
|
9
|
+
* A <button> with `onClick`, a link with `href`.
|
|
10
|
+
*/
|
|
11
|
+
const PillAction = forwardRef(function PillAction(props, ref) {
|
|
12
|
+
const { icon, label, expanded } = props;
|
|
13
|
+
const hasIcon = icon !== void 0 && icon !== null;
|
|
14
|
+
const shared = {
|
|
15
|
+
"data-mp": "action",
|
|
16
|
+
"data-expanded": expanded || !hasIcon ? "" : void 0
|
|
17
|
+
};
|
|
18
|
+
const content = /* @__PURE__ */ jsxs("span", {
|
|
19
|
+
"data-mp": "action-body",
|
|
20
|
+
children: [hasIcon && /* @__PURE__ */ jsx("span", {
|
|
21
|
+
"data-mp": "action-icon",
|
|
22
|
+
"aria-hidden": "true",
|
|
23
|
+
children: icon
|
|
24
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
25
|
+
"data-mp": "label",
|
|
26
|
+
children: label
|
|
27
|
+
})]
|
|
28
|
+
});
|
|
29
|
+
if (props.href !== void 0) {
|
|
30
|
+
const { icon: _icon, label: _label, expanded: _expanded, href, linkComponent: Link, ...rest } = props;
|
|
31
|
+
const anchorRef = ref;
|
|
32
|
+
if (!isSafeHref(href)) {
|
|
33
|
+
devWarn(`<PillAction label="${label}"> got an unsafe href and renders without a link. Only relative, http(s):, mailto: and tel: URLs are allowed.`);
|
|
34
|
+
return /* @__PURE__ */ jsx("a", {
|
|
35
|
+
...rest,
|
|
36
|
+
...shared,
|
|
37
|
+
ref: anchorRef,
|
|
38
|
+
"aria-disabled": "true",
|
|
39
|
+
children: content
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
if (Link) return /* @__PURE__ */ jsx(Link, {
|
|
43
|
+
...rest,
|
|
44
|
+
...shared,
|
|
45
|
+
ref: anchorRef,
|
|
46
|
+
href,
|
|
47
|
+
children: content
|
|
48
|
+
});
|
|
49
|
+
return /* @__PURE__ */ jsx("a", {
|
|
50
|
+
...rest,
|
|
51
|
+
...shared,
|
|
52
|
+
ref: anchorRef,
|
|
53
|
+
href,
|
|
54
|
+
children: content
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
const { icon: _icon, label: _label, expanded: _expanded, href: _href, ...rest } = props;
|
|
58
|
+
return /* @__PURE__ */ jsx("button", {
|
|
59
|
+
type: "button",
|
|
60
|
+
...rest,
|
|
61
|
+
...shared,
|
|
62
|
+
ref,
|
|
63
|
+
children: content
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
export { PillAction as default };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
let react = require("react");
|
|
4
|
+
|
|
5
|
+
// src/Pill/PillContext.ts
|
|
6
|
+
const PillContext = (0, react.createContext)(null);
|
|
7
|
+
function useInternalPill(component) {
|
|
8
|
+
const context = (0, react.useContext)(PillContext);
|
|
9
|
+
if (!context) throw new Error(`[magic-pill] ${component} must be rendered inside a <Pill>.`);
|
|
10
|
+
return context;
|
|
11
|
+
}
|
|
12
|
+
/** Read and drive the enclosing <Pill>: what you need to write your own template. */
|
|
13
|
+
function usePill() {
|
|
14
|
+
const { presence, setPresence, placement, orientation, variant } = useInternalPill("usePill()");
|
|
15
|
+
return {
|
|
16
|
+
presence,
|
|
17
|
+
setPresence,
|
|
18
|
+
placement,
|
|
19
|
+
orientation,
|
|
20
|
+
variant
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
exports.PillContext = PillContext;
|
|
25
|
+
exports.useInternalPill = useInternalPill;
|
|
26
|
+
exports.usePill = usePill;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
|
|
5
|
+
// src/Pill/PillContext.ts
|
|
6
|
+
const PillContext = createContext(null);
|
|
7
|
+
function useInternalPill(component) {
|
|
8
|
+
const context = useContext(PillContext);
|
|
9
|
+
if (!context) throw new Error(`[magic-pill] ${component} must be rendered inside a <Pill>.`);
|
|
10
|
+
return context;
|
|
11
|
+
}
|
|
12
|
+
/** Read and drive the enclosing <Pill>: what you need to write your own template. */
|
|
13
|
+
function usePill() {
|
|
14
|
+
const { presence, setPresence, placement, orientation, variant } = useInternalPill("usePill()");
|
|
15
|
+
return {
|
|
16
|
+
presence,
|
|
17
|
+
setPresence,
|
|
18
|
+
placement,
|
|
19
|
+
orientation,
|
|
20
|
+
variant
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { PillContext, useInternalPill, usePill };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PillButtonActionProps, PillPanelProps } from "./types.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Content shown when the pill's presence is `panel` (one panel per pill).
|
|
4
|
+
* Labelled by its title, focused when it opens, gives focus back to its
|
|
5
|
+
* trigger when it closes.
|
|
6
|
+
*/
|
|
7
|
+
export declare const PillPanel: import("react").ForwardRefExoticComponent<PillPanelProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
8
|
+
/** An action that opens (and closes) the pill's panel. */
|
|
9
|
+
export declare const PillPanelTrigger: import("react").ForwardRefExoticComponent<Omit<PillButtonActionProps, "onClick"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PillButtonActionProps, PillPanelProps } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Content shown when the pill's presence is `panel` (one panel per pill).
|
|
4
|
+
* Labelled by its title, focused when it opens, gives focus back to its
|
|
5
|
+
* trigger when it closes.
|
|
6
|
+
*/
|
|
7
|
+
export declare const PillPanel: import("react").ForwardRefExoticComponent<PillPanelProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
8
|
+
/** An action that opens (and closes) the pill's panel. */
|
|
9
|
+
export declare const PillPanelTrigger: import("react").ForwardRefExoticComponent<Omit<PillButtonActionProps, "onClick"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
let react = require("react");
|
|
4
|
+
const require_PillAction = require("./PillAction.js");
|
|
5
|
+
const require_PillContext = require("./PillContext.js");
|
|
6
|
+
const require_CloseIcon = require("../icons/CloseIcon.js");
|
|
7
|
+
const require_react = require("../utils/react.js");
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
|
|
10
|
+
// src/Pill/PillPanel.tsx
|
|
11
|
+
/**
|
|
12
|
+
* Content shown when the pill's presence is `panel` (one panel per pill).
|
|
13
|
+
* Labelled by its title, focused when it opens, gives focus back to its
|
|
14
|
+
* trigger when it closes.
|
|
15
|
+
*/
|
|
16
|
+
const PillPanel = (0, react.forwardRef)(function PillPanel({ title, closeLabel = "Close", closeIcon, children, ...rest }, forwardedRef) {
|
|
17
|
+
const { presence, closePanel, panelId, panelTriggerRef, rootRef } = require_PillContext.useInternalPill("<PillPanel>");
|
|
18
|
+
const isOpen = presence === "panel";
|
|
19
|
+
const titleId = (0, react.useId)();
|
|
20
|
+
const panelRef = (0, react.useRef)(null);
|
|
21
|
+
const ref = (0, react.useMemo)(() => require_react.mergeRefs(panelRef, forwardedRef), [forwardedRef]);
|
|
22
|
+
const wasOpenRef = (0, react.useRef)(isOpen);
|
|
23
|
+
(0, react.useEffect)(() => {
|
|
24
|
+
const wasOpen = wasOpenRef.current;
|
|
25
|
+
wasOpenRef.current = isOpen;
|
|
26
|
+
if (isOpen && !wasOpen) panelRef.current?.focus({ preventScroll: true });
|
|
27
|
+
else if (!isOpen && wasOpen) {
|
|
28
|
+
const active = document.activeElement;
|
|
29
|
+
if (!active || active === document.body || rootRef.current?.contains(active)) panelTriggerRef.current?.focus();
|
|
30
|
+
}
|
|
31
|
+
}, [
|
|
32
|
+
isOpen,
|
|
33
|
+
panelTriggerRef,
|
|
34
|
+
rootRef
|
|
35
|
+
]);
|
|
36
|
+
const hasTitle = title !== void 0 && title !== null;
|
|
37
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
38
|
+
...rest,
|
|
39
|
+
ref,
|
|
40
|
+
id: panelId,
|
|
41
|
+
"data-mp": "panel",
|
|
42
|
+
"data-open": isOpen ? "" : void 0,
|
|
43
|
+
role: "region",
|
|
44
|
+
"aria-labelledby": hasTitle ? titleId : void 0,
|
|
45
|
+
tabIndex: -1,
|
|
46
|
+
children: [
|
|
47
|
+
hasTitle && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
48
|
+
id: titleId,
|
|
49
|
+
"data-mp": "panel-title",
|
|
50
|
+
children: title
|
|
51
|
+
}),
|
|
52
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
53
|
+
"data-mp": "panel-body",
|
|
54
|
+
children
|
|
55
|
+
}),
|
|
56
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
57
|
+
"data-mp": "panel-footer",
|
|
58
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PillAction, {
|
|
59
|
+
icon: closeIcon ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_CloseIcon, {}),
|
|
60
|
+
label: closeLabel,
|
|
61
|
+
onClick: closePanel
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
/** An action that opens (and closes) the pill's panel. */
|
|
68
|
+
const PillPanelTrigger = (0, react.forwardRef)(function PillPanelTrigger(props, forwardedRef) {
|
|
69
|
+
const { presence, setPresence, closePanel, panelId, panelTriggerRef } = require_PillContext.useInternalPill("<PillPanelTrigger>");
|
|
70
|
+
const isOpen = presence === "panel";
|
|
71
|
+
const triggerRef = (0, react.useRef)(null);
|
|
72
|
+
const ref = (0, react.useMemo)(() => require_react.mergeRefs(triggerRef, forwardedRef), [forwardedRef]);
|
|
73
|
+
const toggle = () => {
|
|
74
|
+
panelTriggerRef.current = triggerRef.current;
|
|
75
|
+
if (isOpen) closePanel();
|
|
76
|
+
else setPresence("panel");
|
|
77
|
+
};
|
|
78
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PillAction, {
|
|
79
|
+
...props,
|
|
80
|
+
ref,
|
|
81
|
+
"aria-expanded": isOpen,
|
|
82
|
+
"aria-controls": panelId,
|
|
83
|
+
onClick: toggle
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
exports.PillPanel = PillPanel;
|
|
88
|
+
exports.PillPanelTrigger = PillPanelTrigger;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { forwardRef, useEffect, useId, useMemo, useRef } from "react";
|
|
4
|
+
import PillAction from "./PillAction.mjs";
|
|
5
|
+
import { useInternalPill } from "./PillContext.mjs";
|
|
6
|
+
import CloseIcon from "../icons/CloseIcon.mjs";
|
|
7
|
+
import { mergeRefs } from "../utils/react.mjs";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
|
|
10
|
+
// src/Pill/PillPanel.tsx
|
|
11
|
+
/**
|
|
12
|
+
* Content shown when the pill's presence is `panel` (one panel per pill).
|
|
13
|
+
* Labelled by its title, focused when it opens, gives focus back to its
|
|
14
|
+
* trigger when it closes.
|
|
15
|
+
*/
|
|
16
|
+
const PillPanel = forwardRef(function PillPanel({ title, closeLabel = "Close", closeIcon, children, ...rest }, forwardedRef) {
|
|
17
|
+
const { presence, closePanel, panelId, panelTriggerRef, rootRef } = useInternalPill("<PillPanel>");
|
|
18
|
+
const isOpen = presence === "panel";
|
|
19
|
+
const titleId = useId();
|
|
20
|
+
const panelRef = useRef(null);
|
|
21
|
+
const ref = useMemo(() => mergeRefs(panelRef, forwardedRef), [forwardedRef]);
|
|
22
|
+
const wasOpenRef = useRef(isOpen);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const wasOpen = wasOpenRef.current;
|
|
25
|
+
wasOpenRef.current = isOpen;
|
|
26
|
+
if (isOpen && !wasOpen) panelRef.current?.focus({ preventScroll: true });
|
|
27
|
+
else if (!isOpen && wasOpen) {
|
|
28
|
+
const active = document.activeElement;
|
|
29
|
+
if (!active || active === document.body || rootRef.current?.contains(active)) panelTriggerRef.current?.focus();
|
|
30
|
+
}
|
|
31
|
+
}, [
|
|
32
|
+
isOpen,
|
|
33
|
+
panelTriggerRef,
|
|
34
|
+
rootRef
|
|
35
|
+
]);
|
|
36
|
+
const hasTitle = title !== void 0 && title !== null;
|
|
37
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
38
|
+
...rest,
|
|
39
|
+
ref,
|
|
40
|
+
id: panelId,
|
|
41
|
+
"data-mp": "panel",
|
|
42
|
+
"data-open": isOpen ? "" : void 0,
|
|
43
|
+
role: "region",
|
|
44
|
+
"aria-labelledby": hasTitle ? titleId : void 0,
|
|
45
|
+
tabIndex: -1,
|
|
46
|
+
children: [
|
|
47
|
+
hasTitle && /* @__PURE__ */ jsx("div", {
|
|
48
|
+
id: titleId,
|
|
49
|
+
"data-mp": "panel-title",
|
|
50
|
+
children: title
|
|
51
|
+
}),
|
|
52
|
+
/* @__PURE__ */ jsx("div", {
|
|
53
|
+
"data-mp": "panel-body",
|
|
54
|
+
children
|
|
55
|
+
}),
|
|
56
|
+
/* @__PURE__ */ jsx("div", {
|
|
57
|
+
"data-mp": "panel-footer",
|
|
58
|
+
children: /* @__PURE__ */ jsx(PillAction, {
|
|
59
|
+
icon: closeIcon ?? /* @__PURE__ */ jsx(CloseIcon, {}),
|
|
60
|
+
label: closeLabel,
|
|
61
|
+
onClick: closePanel
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
/** An action that opens (and closes) the pill's panel. */
|
|
68
|
+
const PillPanelTrigger = forwardRef(function PillPanelTrigger(props, forwardedRef) {
|
|
69
|
+
const { presence, setPresence, closePanel, panelId, panelTriggerRef } = useInternalPill("<PillPanelTrigger>");
|
|
70
|
+
const isOpen = presence === "panel";
|
|
71
|
+
const triggerRef = useRef(null);
|
|
72
|
+
const ref = useMemo(() => mergeRefs(triggerRef, forwardedRef), [forwardedRef]);
|
|
73
|
+
const toggle = () => {
|
|
74
|
+
panelTriggerRef.current = triggerRef.current;
|
|
75
|
+
if (isOpen) closePanel();
|
|
76
|
+
else setPresence("panel");
|
|
77
|
+
};
|
|
78
|
+
return /* @__PURE__ */ jsx(PillAction, {
|
|
79
|
+
...props,
|
|
80
|
+
ref,
|
|
81
|
+
"aria-expanded": isOpen,
|
|
82
|
+
"aria-controls": panelId,
|
|
83
|
+
onClick: toggle
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
export { PillPanel, PillPanelTrigger };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** The leading icon. Decorative (`aria-hidden`) unless you give it a `label`. */
|
|
2
|
+
export declare const PillIcon: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
3
|
+
label?: string;
|
|
4
|
+
} & import("react").RefAttributes<HTMLSpanElement>>;
|
|
5
|
+
/** The thin line between the icon and the message. */
|
|
6
|
+
export declare const PillDivider: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
7
|
+
/** The message, in the italic serif. Accepts any content. */
|
|
8
|
+
export declare const PillMessage: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
|
+
/** A row (or a column, in a vertical pill) of actions. */
|
|
10
|
+
export declare const PillActions: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** The leading icon. Decorative (`aria-hidden`) unless you give it a `label`. */
|
|
2
|
+
export declare const PillIcon: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
3
|
+
label?: string;
|
|
4
|
+
} & import("react").RefAttributes<HTMLSpanElement>>;
|
|
5
|
+
/** The thin line between the icon and the message. */
|
|
6
|
+
export declare const PillDivider: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
|
|
7
|
+
/** The message, in the italic serif. Accepts any content. */
|
|
8
|
+
export declare const PillMessage: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
|
+
/** A row (or a column, in a vertical pill) of actions. */
|
|
10
|
+
export declare const PillActions: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|