@atom63/inform 0.2.0-beta.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/LICENSE +27 -0
- package/README.md +25 -0
- package/dist/chunk-KT6PQL7E.js +554 -0
- package/dist/chunk-KT6PQL7E.js.map +1 -0
- package/dist/chunk-OGT26DRQ.js +222 -0
- package/dist/chunk-OGT26DRQ.js.map +1 -0
- package/dist/flyout-stack-BvsgCm0f.d.ts +26 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/persistence-DkSUn_qI.d.ts +18 -0
- package/dist/react/index.d.ts +42 -0
- package/dist/react/index.js +128 -0
- package/dist/react/index.js.map +1 -0
- package/dist/surfaces/index.d.ts +160 -0
- package/dist/surfaces/index.js +3 -0
- package/dist/surfaces/index.js.map +1 -0
- package/dist/types-7x7Ygbcz.d.ts +75 -0
- package/package.json +92 -0
- package/src/styles.css +17 -0
- package/src/surfaces/inform-banner.css +28 -0
- package/src/surfaces/inform-corner-flyout.css +73 -0
- package/src/surfaces/inform-dialog.css +24 -0
- package/src/surfaces/inform-parts.css +176 -0
- package/src/surfaces/inform-spotlight.css +55 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { createInformStore, createWebDismissalStore, INFORM_SURFACES, resolveContent } from '../chunk-OGT26DRQ.js';
|
|
2
|
+
import { InformBanner, InformDialog, InformFlyoutStack, InformCornerFlyout, InformSpotlight } from '../chunk-KT6PQL7E.js';
|
|
3
|
+
import { createContext, useRef, useMemo, useEffect, useContext, useSyncExternalStore, useCallback } from 'react';
|
|
4
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var InformStoreContext = createContext(null);
|
|
7
|
+
var InformContextValue = createContext(null);
|
|
8
|
+
function defaultIsAnchorAvailable(anchor) {
|
|
9
|
+
if (typeof document === "undefined") return false;
|
|
10
|
+
return document.querySelector(anchor) !== null;
|
|
11
|
+
}
|
|
12
|
+
function InformProvider({
|
|
13
|
+
children,
|
|
14
|
+
context,
|
|
15
|
+
dismissals,
|
|
16
|
+
isAnchorAvailable = defaultIsAnchorAvailable,
|
|
17
|
+
registry
|
|
18
|
+
}) {
|
|
19
|
+
const latest = useRef({ context, dismissals, isAnchorAvailable });
|
|
20
|
+
latest.current = { context, dismissals, isAnchorAvailable };
|
|
21
|
+
const store = useMemo(
|
|
22
|
+
() => createInformStore({
|
|
23
|
+
registry,
|
|
24
|
+
context: latest.current.context,
|
|
25
|
+
dismissals: latest.current.dismissals ?? createWebDismissalStore(),
|
|
26
|
+
isAnchorAvailable: (anchor) => latest.current.isAnchorAvailable(anchor)
|
|
27
|
+
}),
|
|
28
|
+
[registry]
|
|
29
|
+
);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
store.hydrate();
|
|
32
|
+
}, [store]);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
store.setContext(context);
|
|
35
|
+
}, [store, context]);
|
|
36
|
+
return /* @__PURE__ */ jsx(InformStoreContext.Provider, { value: store, children: /* @__PURE__ */ jsx(InformContextValue.Provider, { value: context, children }) });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// src/react/use-inform.ts
|
|
40
|
+
function useInform() {
|
|
41
|
+
const store = useContext(InformStoreContext);
|
|
42
|
+
if (store === null) {
|
|
43
|
+
throw new Error("useInform must be used inside an <InformProvider>.");
|
|
44
|
+
}
|
|
45
|
+
const resolution = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);
|
|
46
|
+
const dismiss = useCallback(
|
|
47
|
+
(id) => {
|
|
48
|
+
store.dismiss(id);
|
|
49
|
+
},
|
|
50
|
+
[store]
|
|
51
|
+
);
|
|
52
|
+
return { resolution, ready: store.isReady(), dismiss };
|
|
53
|
+
}
|
|
54
|
+
function useInformContext() {
|
|
55
|
+
const context = useContext(InformContextValue);
|
|
56
|
+
if (context === null) {
|
|
57
|
+
throw new Error("useInformContext must be used inside an <InformProvider>.");
|
|
58
|
+
}
|
|
59
|
+
return context;
|
|
60
|
+
}
|
|
61
|
+
function InformOutlet({
|
|
62
|
+
flyoutOffset,
|
|
63
|
+
flyoutPlacement,
|
|
64
|
+
surfaces = INFORM_SURFACES
|
|
65
|
+
}) {
|
|
66
|
+
const { dismiss, resolution } = useInform();
|
|
67
|
+
const context = useInformContext();
|
|
68
|
+
const contentOf = (message) => resolveContent(message, context);
|
|
69
|
+
const pick = (surface) => surfaces.includes(surface) ? resolution[surface] : null;
|
|
70
|
+
const banner = pick("banner");
|
|
71
|
+
const dialog = pick("dialog");
|
|
72
|
+
const spotlight = pick("spotlight");
|
|
73
|
+
const flyouts = surfaces.includes("corner-flyout") ? resolution["corner-flyout"] : [];
|
|
74
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
75
|
+
banner === null ? null : /* @__PURE__ */ jsx(
|
|
76
|
+
InformBanner,
|
|
77
|
+
{
|
|
78
|
+
...contentOf(banner),
|
|
79
|
+
dismissable: banner.dismiss !== "none",
|
|
80
|
+
onDismiss: () => {
|
|
81
|
+
dismiss(banner.id);
|
|
82
|
+
},
|
|
83
|
+
severity: banner.severity
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
dialog === null ? null : /* @__PURE__ */ jsx(
|
|
87
|
+
InformDialog,
|
|
88
|
+
{
|
|
89
|
+
...contentOf(dialog),
|
|
90
|
+
dismissable: dialog.dismiss !== "none",
|
|
91
|
+
onDismiss: () => {
|
|
92
|
+
dismiss(dialog.id);
|
|
93
|
+
},
|
|
94
|
+
open: true,
|
|
95
|
+
severity: dialog.severity
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
flyouts.length === 0 ? null : /* @__PURE__ */ jsx(InformFlyoutStack, { offset: flyoutOffset, placement: flyoutPlacement, children: flyouts.map((message) => /* @__PURE__ */ jsx(
|
|
99
|
+
InformCornerFlyout,
|
|
100
|
+
{
|
|
101
|
+
...contentOf(message),
|
|
102
|
+
dismissable: message.dismiss !== "none",
|
|
103
|
+
onDismiss: () => {
|
|
104
|
+
dismiss(message.id);
|
|
105
|
+
},
|
|
106
|
+
open: true,
|
|
107
|
+
severity: message.severity
|
|
108
|
+
},
|
|
109
|
+
message.id
|
|
110
|
+
)) }),
|
|
111
|
+
spotlight === null || spotlight.anchor === void 0 ? null : /* @__PURE__ */ jsx(
|
|
112
|
+
InformSpotlight,
|
|
113
|
+
{
|
|
114
|
+
...contentOf(spotlight),
|
|
115
|
+
anchor: spotlight.anchor,
|
|
116
|
+
onDismiss: () => {
|
|
117
|
+
dismiss(spotlight.id);
|
|
118
|
+
},
|
|
119
|
+
open: true,
|
|
120
|
+
severity: spotlight.severity
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
] });
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export { InformOutlet, InformProvider, useInform, useInformContext };
|
|
127
|
+
//# sourceMappingURL=index.js.map
|
|
128
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/react/inform-provider.tsx","../../src/react/use-inform.ts","../../src/react/inform-outlet.tsx"],"names":["jsx"],"mappings":";;;;;AASO,IAAM,kBAAA,GAAqB,cAAkC,IAAI,CAAA;AAOjE,IAAM,kBAAA,GAAqB,cAAoC,IAAI,CAAA;AAU1E,SAAS,yBAAyB,MAAA,EAAyB;AACzD,EAAA,IAAI,OAAO,QAAA,KAAa,WAAA,EAAa,OAAO,KAAA;AAC5C,EAAA,OAAO,QAAA,CAAS,aAAA,CAAc,MAAM,CAAA,KAAM,IAAA;AAC5C;AAEO,SAAS,cAAA,CAAe;AAAA,EAC7B,QAAA;AAAA,EACA,OAAA;AAAA,EACA,UAAA;AAAA,EACA,iBAAA,GAAoB,wBAAA;AAAA,EACpB;AACF,CAAA,EAAsC;AAGpC,EAAA,MAAM,SAAS,MAAA,CAAO,EAAE,OAAA,EAAS,UAAA,EAAY,mBAAmB,CAAA;AAChE,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,UAAU,EAAE,CAAA;AAAA,QACtB,CAAA;AAAA,QACA,IAAA,EAAI,IAAA;AAAA,QACJ,UAAU,SAAA,CAAU;AAAA;AAAA;AACtB,GAAA,EAEJ,CAAA;AAEJ","file":"index.js","sourcesContent":["import { createContext, useEffect, useMemo, useRef } from 'react'\nimport type { ReactElement, ReactNode } from 'react'\n\nimport { createWebDismissalStore } from '../core/persistence'\nimport type { DismissalStore } from '../core/persistence'\nimport { createInformStore } from '../core/store'\nimport type { InformStore } from '../core/store'\nimport type { InformContext, InformRegistry } from '../core/types'\n\nexport const InformStoreContext = createContext<InformStore | null>(null)\n\n/**\n * The context the provider was given. Published separately from the store so\n * outlets can resolve function-valued content without reading the store's\n * mutable context during render.\n */\nexport const InformContextValue = createContext<InformContext | null>(null)\n\nexport type InformProviderProps = {\n registry: InformRegistry\n context: InformContext\n dismissals?: DismissalStore\n isAnchorAvailable?: (anchor: string) => boolean\n children: ReactNode\n}\n\nfunction defaultIsAnchorAvailable(anchor: string): boolean {\n if (typeof document === 'undefined') return false\n return document.querySelector(anchor) !== null\n}\n\nexport function InformProvider({\n children,\n context,\n dismissals,\n isAnchorAvailable = defaultIsAnchorAvailable,\n registry,\n}: InformProviderProps): ReactElement {\n // The store is long-lived: rebuilding it on a context change would discard\n // hydration state, so the current context is pushed in through setContext.\n const latest = useRef({ context, dismissals, isAnchorAvailable })\n latest.current = { context, dismissals, isAnchorAvailable }\n\n const store = useMemo(\n () =>\n createInformStore({\n registry,\n context: latest.current.context,\n dismissals: latest.current.dismissals ?? createWebDismissalStore(),\n isAnchorAvailable: anchor => latest.current.isAnchorAvailable(anchor),\n }),\n [registry]\n )\n\n // Storage is read after mount, never during render: reading it inline would\n // paint a message for one frame and then yank it away.\n useEffect(() => {\n store.hydrate()\n }, [store])\n\n useEffect(() => {\n store.setContext(context)\n }, [store, context])\n\n return (\n <InformStoreContext.Provider value={store}>\n <InformContextValue.Provider value={context}>{children}</InformContextValue.Provider>\n </InformStoreContext.Provider>\n )\n}\n","import { useCallback, useContext, useSyncExternalStore } from 'react'\n\nimport type { InformContext, InformResolution } from '../core/types'\nimport { InformContextValue, InformStoreContext } from './inform-provider'\n\nexport type UseInformResult = {\n resolution: InformResolution\n ready: boolean\n dismiss: (id: string) => void\n}\n\nexport function useInform(): UseInformResult {\n const store = useContext(InformStoreContext)\n if (store === null) {\n throw new Error('useInform must be used inside an <InformProvider>.')\n }\n\n const resolution = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot)\n const dismiss = useCallback(\n (id: string) => {\n store.dismiss(id)\n },\n [store]\n )\n\n return { resolution, ready: store.isReady(), dismiss }\n}\n\n/**\n * The context the nearest provider was given. Safe to read during render: it is\n * a plain React context value, not the store's mutable internal context.\n */\nexport function useInformContext(): InformContext {\n const context = useContext(InformContextValue)\n if (context === null) {\n throw new Error('useInformContext must be used inside an <InformProvider>.')\n }\n return context\n}\n","import type { ReactElement } from 'react'\n\nimport { INFORM_SURFACES, resolveContent } from '../core/types'\nimport type { InformContent, InformMessage, InformSurface } from '../core/types'\nimport { InformBanner } from '../surfaces/inform-banner'\nimport { InformFlyoutStack } from '../surfaces/flyout-stack'\nimport type { InformFlyoutPlacement } from '../surfaces/flyout-stack'\nimport { InformCornerFlyout } from '../surfaces/inform-corner-flyout'\nimport { InformDialog } from '../surfaces/inform-dialog'\nimport { InformSpotlight } from '../surfaces/inform-spotlight'\nimport { useInform, useInformContext } from './use-inform'\n\nexport type InformOutletProps = {\n /**\n * Which surfaces this outlet is responsible for. Defaults to all four. Split\n * them across outlets when surfaces belong in different parts of the tree —\n * an in-flow banner sits in a layout slot, while the overlay surfaces belong\n * at the layout root.\n */\n surfaces?: readonly InformSurface[]\n /** CSS length for the flyout stack's inset on its anchored edge. */\n flyoutOffset?: string\n /** Which corner the flyout stack is anchored to. */\n flyoutPlacement?: InformFlyoutPlacement\n}\n\nexport function InformOutlet({\n flyoutOffset,\n flyoutPlacement,\n surfaces = INFORM_SURFACES,\n}: InformOutletProps): ReactElement {\n const { dismiss, resolution } = useInform()\n const context = useInformContext()\n\n const contentOf = (message: InformMessage): InformContent => resolveContent(message, context)\n\n const pick = (surface: InformSurface): InformMessage | null =>\n surfaces.includes(surface) ? (resolution[surface] as InformMessage | null) : null\n\n const banner = pick('banner')\n const dialog = pick('dialog')\n const spotlight = pick('spotlight')\n const flyouts = surfaces.includes('corner-flyout') ? resolution['corner-flyout'] : []\n\n return (\n <>\n {banner === null ? null : (\n <InformBanner\n {...contentOf(banner)}\n dismissable={banner.dismiss !== 'none'}\n onDismiss={() => {\n dismiss(banner.id)\n }}\n severity={banner.severity}\n />\n )}\n {dialog === null ? null : (\n <InformDialog\n {...contentOf(dialog)}\n dismissable={dialog.dismiss !== 'none'}\n onDismiss={() => {\n dismiss(dialog.id)\n }}\n open\n severity={dialog.severity}\n />\n )}\n {flyouts.length === 0 ? null : (\n <InformFlyoutStack offset={flyoutOffset} placement={flyoutPlacement}>\n {flyouts.map(message => (\n <InformCornerFlyout\n key={message.id}\n {...contentOf(message)}\n dismissable={message.dismiss !== 'none'}\n onDismiss={() => {\n dismiss(message.id)\n }}\n open\n severity={message.severity}\n />\n ))}\n </InformFlyoutStack>\n )}\n {spotlight === null || spotlight.anchor === undefined ? null : (\n <InformSpotlight\n {...contentOf(spotlight)}\n anchor={spotlight.anchor}\n onDismiss={() => {\n dismiss(spotlight.id)\n }}\n open\n severity={spotlight.severity}\n />\n )}\n </>\n )\n}\n"]}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { g as InformAction, j as InformSeverity } from '../types-7x7Ygbcz.js';
|
|
3
|
+
export { I as InformFlyoutPlacement, a as InformFlyoutStack, b as InformFlyoutStackProps } from '../flyout-stack-BvsgCm0f.js';
|
|
4
|
+
|
|
5
|
+
/** One line box. Matches the first line of text the slot sits beside. */
|
|
6
|
+
declare const SLOT_SIZE_CLASS = "a63-Inform-slot";
|
|
7
|
+
|
|
8
|
+
type InformDismissButtonProps = {
|
|
9
|
+
label?: string;
|
|
10
|
+
onDismiss?: () => void;
|
|
11
|
+
className?: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Dismiss control for a message row's trailing gutter.
|
|
15
|
+
*
|
|
16
|
+
* Its layout box is one line tall so it aligns with the first line of text the
|
|
17
|
+
* same way the leading icon does; the 24px WCAG target is an invisible
|
|
18
|
+
* expansion that costs no layout. Sizing the box itself to the target is what
|
|
19
|
+
* previously pushed the icon below the text and needed a per-surface offset to
|
|
20
|
+
* undo.
|
|
21
|
+
*/
|
|
22
|
+
declare function InformDismissButton({ className, label, onDismiss, }: InformDismissButtonProps): ReactElement;
|
|
23
|
+
|
|
24
|
+
type InformIconSlotProps = {
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
className?: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Fixed-footprint holder for a leading icon.
|
|
30
|
+
*
|
|
31
|
+
* The box is one line tall regardless of what is passed, so a 14px glyph and a
|
|
32
|
+
* 20px glyph produce the same layout and the glyph lands on the optical centre
|
|
33
|
+
* of the first line beside it. Being decorative, it owes no touch target.
|
|
34
|
+
*
|
|
35
|
+
* Severity must be carried by the message text, not the glyph, so anything
|
|
36
|
+
* passed here should be `aria-hidden`.
|
|
37
|
+
*/
|
|
38
|
+
declare function InformIconSlot({ children, className }: InformIconSlotProps): ReactElement;
|
|
39
|
+
|
|
40
|
+
type InformThumbnailProps = {
|
|
41
|
+
children: ReactNode;
|
|
42
|
+
className?: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Bounded leading thumbnail, for surfaces whose height is load-bearing.
|
|
46
|
+
*
|
|
47
|
+
* A flyout's height feeds the stack's offsets, and three cards have to fit a
|
|
48
|
+
* phone: full-width 16:9 media would add ~198px per card at this width, so
|
|
49
|
+
* three would overflow a laptop viewport, never mind a phone. A fixed square
|
|
50
|
+
* keeps the card's height within a few pixels of its text.
|
|
51
|
+
*/
|
|
52
|
+
declare function InformThumbnail({ children, className }: InformThumbnailProps): ReactElement;
|
|
53
|
+
type InformMediaProps = {
|
|
54
|
+
children: ReactNode;
|
|
55
|
+
className?: string;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Full-width media, for surfaces that can afford the height.
|
|
59
|
+
*
|
|
60
|
+
* The aspect ratio is fixed so the surface does not resize when the image
|
|
61
|
+
* finally decodes — in a dialog that would shift the text under the pointer.
|
|
62
|
+
*/
|
|
63
|
+
declare function InformMedia({ children, className }: InformMediaProps): ReactElement;
|
|
64
|
+
|
|
65
|
+
type InformActionsProps = {
|
|
66
|
+
actions: readonly InformAction[];
|
|
67
|
+
className?: string;
|
|
68
|
+
};
|
|
69
|
+
declare function InformActions({ actions, className }: InformActionsProps): ReactElement | null;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Every surface is controlled: it renders what it is given and reports intent
|
|
73
|
+
* upward. The runtime is one consumer of these components, not their owner.
|
|
74
|
+
*/
|
|
75
|
+
type InformSurfaceProps = {
|
|
76
|
+
severity?: InformSeverity;
|
|
77
|
+
/**
|
|
78
|
+
* Decorative leading glyph, rendered in a fixed-size slot so the message
|
|
79
|
+
* block does not shift with the icon's intrinsic size.
|
|
80
|
+
*
|
|
81
|
+
* Omit it for the severity's default glyph; pass `null` for no icon at all.
|
|
82
|
+
* Anything you pass should be `aria-hidden`: severity must be carried by the
|
|
83
|
+
* message text, not the glyph.
|
|
84
|
+
*/
|
|
85
|
+
icon?: ReactNode;
|
|
86
|
+
/**
|
|
87
|
+
* Optional media. Supported by the flyout, which renders it as a bounded
|
|
88
|
+
* leading thumbnail, and the dialog, which renders it full width above the
|
|
89
|
+
* text. The banner is a single-line bar and the spotlight is a coach mark
|
|
90
|
+
* pinned to a control; neither has room for it, and both ignore it.
|
|
91
|
+
*/
|
|
92
|
+
media?: ReactNode;
|
|
93
|
+
title?: ReactNode;
|
|
94
|
+
body: ReactNode;
|
|
95
|
+
actions?: readonly InformAction[];
|
|
96
|
+
dismissable?: boolean;
|
|
97
|
+
onDismiss?: () => void;
|
|
98
|
+
dismissLabel?: string;
|
|
99
|
+
className?: string;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* In-flow, non-interrupting notice. Stays in document flow so it scrolls away
|
|
104
|
+
* with the page rather than competing with the sticky header.
|
|
105
|
+
*
|
|
106
|
+
* Text is start aligned. Both gutter slots are exactly one line tall, so laying
|
|
107
|
+
* the row out from the top puts them on the first line's optical centre — which
|
|
108
|
+
* is the same thing as the banner's centre when the message is a single line,
|
|
109
|
+
* and stays anchored to the title when it is not.
|
|
110
|
+
*
|
|
111
|
+
* Padding is equal on both axes: the row's height now follows the text rather
|
|
112
|
+
* than a 24px touch target, so equal padding reads as an equal well.
|
|
113
|
+
*/
|
|
114
|
+
declare function InformBanner({ actions, body, icon, className, dismissLabel, dismissable, onDismiss, severity, title, }: InformSurfaceProps): ReactElement;
|
|
115
|
+
|
|
116
|
+
declare const SEVERITY_BORDER_CLASS: Record<InformSeverity, string>;
|
|
117
|
+
declare const SEVERITY_TEXT_CLASS: Record<InformSeverity, string>;
|
|
118
|
+
|
|
119
|
+
type InformCornerFlyoutProps = InformSurfaceProps & {
|
|
120
|
+
open: boolean;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Persistent, non-blocking card. Unlike a toast it has a registry identity,
|
|
124
|
+
* holds rich content, and waits to be dismissed instead of expiring on a timer.
|
|
125
|
+
*
|
|
126
|
+
* Placement belongs to `InformFlyoutStack`, not here: several cards share one
|
|
127
|
+
* anchor point and have to reflow together as they are dismissed.
|
|
128
|
+
*/
|
|
129
|
+
declare function InformCornerFlyout({ actions, body, className, dismissLabel, dismissable, icon, media, onDismiss, open, severity, title, }: InformCornerFlyoutProps): ReactElement | null;
|
|
130
|
+
|
|
131
|
+
type InformDialogProps = InformSurfaceProps & {
|
|
132
|
+
open: boolean;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Blocking notice. Focus trapping, Escape, scroll locking, and background
|
|
136
|
+
* inerting come from the Base UI dialog underneath — do not reimplement them.
|
|
137
|
+
* `DialogPopup` already renders its own portal, backdrop, and close button.
|
|
138
|
+
*/
|
|
139
|
+
declare function InformDialog({ actions, body, className, dismissable, icon, media, onDismiss, open, severity, title, }: InformDialogProps): ReactElement;
|
|
140
|
+
|
|
141
|
+
type InformSpotlightProps = InformSurfaceProps & {
|
|
142
|
+
open: boolean;
|
|
143
|
+
/** CSS selector for the element to highlight. */
|
|
144
|
+
anchor: string;
|
|
145
|
+
};
|
|
146
|
+
declare function InformSpotlight({ actions, anchor, body, className, icon, onDismiss, open, severity, title, }: InformSpotlightProps): ReactElement | null;
|
|
147
|
+
|
|
148
|
+
type AnchorRect = {
|
|
149
|
+
top: number;
|
|
150
|
+
left: number;
|
|
151
|
+
width: number;
|
|
152
|
+
height: number;
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Tracks an anchor's viewport rect while `active`. Returns null when the anchor
|
|
156
|
+
* is absent or has no area — callers must render nothing in that case.
|
|
157
|
+
*/
|
|
158
|
+
declare function useAnchorRect(anchor: string, active: boolean): AnchorRect | null;
|
|
159
|
+
|
|
160
|
+
export { type AnchorRect, InformActions, type InformActionsProps, InformBanner, InformCornerFlyout, type InformCornerFlyoutProps, InformDialog, type InformDialogProps, InformDismissButton, type InformDismissButtonProps, InformIconSlot, type InformIconSlotProps, InformMedia, type InformMediaProps, InformSpotlight, type InformSpotlightProps, type InformSurfaceProps, InformThumbnail, type InformThumbnailProps, SEVERITY_BORDER_CLASS, SEVERITY_TEXT_CLASS, SLOT_SIZE_CLASS, useAnchorRect };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { InformActions, InformBanner, InformCornerFlyout, InformDialog, InformDismissButton, InformFlyoutStack, InformIconSlot, InformMedia, InformSpotlight, InformThumbnail, SEVERITY_BORDER_CLASS, SEVERITY_TEXT_CLASS, SLOT_SIZE_CLASS, useAnchorRect } from '../chunk-KT6PQL7E.js';
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/** Where a message is shown. One at a time, except the corner flyout, which stacks. */
|
|
4
|
+
type InformSurface = 'banner' | 'dialog' | 'corner-flyout' | 'spotlight';
|
|
5
|
+
type InformSeverity = 'info' | 'success' | 'warning' | 'danger';
|
|
6
|
+
/**
|
|
7
|
+
* `none` renders no dismiss affordance and never persists — for standing notices.
|
|
8
|
+
* `session` clears when the tab closes; `persistent` survives it.
|
|
9
|
+
*/
|
|
10
|
+
type InformDismissMode = 'none' | 'session' | 'persistent';
|
|
11
|
+
type InformAction = {
|
|
12
|
+
id: string;
|
|
13
|
+
label: ReactNode;
|
|
14
|
+
onSelect: () => void;
|
|
15
|
+
variant?: 'primary' | 'secondary';
|
|
16
|
+
};
|
|
17
|
+
type InformContent = {
|
|
18
|
+
/** Decorative leading glyph. Severity must still be carried by the text. */
|
|
19
|
+
icon?: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Optional media. Only the flyout and the dialog render it, and they render
|
|
22
|
+
* it differently — see the surface docs.
|
|
23
|
+
*/
|
|
24
|
+
media?: ReactNode;
|
|
25
|
+
title?: ReactNode;
|
|
26
|
+
body: ReactNode;
|
|
27
|
+
actions?: readonly InformAction[];
|
|
28
|
+
};
|
|
29
|
+
/** Everything the arbiter is allowed to know about the visitor's situation. */
|
|
30
|
+
type InformContext = {
|
|
31
|
+
pathname: string;
|
|
32
|
+
locale: string;
|
|
33
|
+
now: Date;
|
|
34
|
+
};
|
|
35
|
+
type InformMessage = {
|
|
36
|
+
/** Stable identity and persistence key. */
|
|
37
|
+
id: string;
|
|
38
|
+
surface: InformSurface;
|
|
39
|
+
severity: InformSeverity;
|
|
40
|
+
/** Higher wins. Ties break by declaration order in the registry. */
|
|
41
|
+
priority: number;
|
|
42
|
+
content: InformContent | ((ctx: InformContext) => InformContent);
|
|
43
|
+
dismiss: InformDismissMode;
|
|
44
|
+
/** Bump to re-show a message to visitors who dismissed the previous revision. Defaults to 1. */
|
|
45
|
+
version?: number;
|
|
46
|
+
/** ISO 8601. */
|
|
47
|
+
startsAt?: string;
|
|
48
|
+
/** ISO 8601. */
|
|
49
|
+
endsAt?: string;
|
|
50
|
+
when?: (ctx: InformContext) => boolean;
|
|
51
|
+
/** CSS selector. Required on `spotlight`, forbidden elsewhere. */
|
|
52
|
+
anchor?: string;
|
|
53
|
+
};
|
|
54
|
+
type InformRegistry = {
|
|
55
|
+
messages: readonly InformMessage[];
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* What each surface should show. The corner flyout is the one surface that
|
|
59
|
+
* stacks, so it resolves to an ordered list rather than a single message —
|
|
60
|
+
* highest priority first, which is both the visual and the reading order.
|
|
61
|
+
*/
|
|
62
|
+
type InformResolution = {
|
|
63
|
+
banner: InformMessage | null;
|
|
64
|
+
dialog: InformMessage | null;
|
|
65
|
+
spotlight: InformMessage | null;
|
|
66
|
+
'corner-flyout': readonly InformMessage[];
|
|
67
|
+
};
|
|
68
|
+
declare const INFORM_FLYOUT_STACK_LIMIT = 3;
|
|
69
|
+
declare const INFORM_SURFACES: readonly InformSurface[];
|
|
70
|
+
/** Surfaces that take over the visitor's attention. At most one may resolve. */
|
|
71
|
+
declare const INFORM_BLOCKING_SURFACES: readonly InformSurface[];
|
|
72
|
+
declare const EMPTY_INFORM_RESOLUTION: InformResolution;
|
|
73
|
+
declare function resolveContent(message: InformMessage, ctx: InformContext): InformContent;
|
|
74
|
+
|
|
75
|
+
export { EMPTY_INFORM_RESOLUTION as E, type InformMessage as I, type InformRegistry as a, type InformContext as b, type InformResolution as c, INFORM_BLOCKING_SURFACES as d, INFORM_FLYOUT_STACK_LIMIT as e, INFORM_SURFACES as f, type InformAction as g, type InformContent as h, type InformDismissMode as i, type InformSeverity as j, type InformSurface as k, resolveContent as r };
|
package/package.json
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atom63/inform",
|
|
3
|
+
"version": "0.2.0-beta.0",
|
|
4
|
+
"description": "The Atom63 inform pattern: one message model, one arbiter, and the banner, dialog, corner flyout and spotlight surfaces",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/atom63/atom63-design-system.git",
|
|
9
|
+
"directory": "packages/inform"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/atom63/atom63-design-system/tree/main/packages/inform#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/atom63/atom63-design-system/issues"
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"atom63",
|
|
20
|
+
"design-system",
|
|
21
|
+
"inform",
|
|
22
|
+
"onboarding",
|
|
23
|
+
"react"
|
|
24
|
+
],
|
|
25
|
+
"type": "module",
|
|
26
|
+
"sideEffects": [
|
|
27
|
+
"*.css",
|
|
28
|
+
"**/*.css"
|
|
29
|
+
],
|
|
30
|
+
"main": "./dist/index.js",
|
|
31
|
+
"module": "./dist/index.js",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"@atom63/source": "./src/index.ts",
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
37
|
+
"import": "./dist/index.js"
|
|
38
|
+
},
|
|
39
|
+
"./react": {
|
|
40
|
+
"@atom63/source": "./src/react/index.ts",
|
|
41
|
+
"types": "./dist/react/index.d.ts",
|
|
42
|
+
"import": "./dist/react/index.js"
|
|
43
|
+
},
|
|
44
|
+
"./surfaces": {
|
|
45
|
+
"@atom63/source": "./src/surfaces/index.ts",
|
|
46
|
+
"types": "./dist/surfaces/index.d.ts",
|
|
47
|
+
"import": "./dist/surfaces/index.js"
|
|
48
|
+
},
|
|
49
|
+
"./styles.css": "./src/styles.css"
|
|
50
|
+
},
|
|
51
|
+
"files": [
|
|
52
|
+
"dist",
|
|
53
|
+
"src/**/*.css"
|
|
54
|
+
],
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@atom63/ui-react": "0.2.0-beta.9"
|
|
57
|
+
},
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"react": "^19.1.0",
|
|
60
|
+
"react-dom": "^19.1.0"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@storybook/react-vite": "^10.6.0",
|
|
64
|
+
"@testing-library/jest-dom": "6.9.1",
|
|
65
|
+
"@testing-library/react": "16.3.2",
|
|
66
|
+
"@testing-library/user-event": "14.6.1",
|
|
67
|
+
"@types/node": "^26.3.0",
|
|
68
|
+
"@types/react": "^19.2.17",
|
|
69
|
+
"@types/react-dom": "^19.1.9",
|
|
70
|
+
"@vitejs/plugin-react": "^6.1.0",
|
|
71
|
+
"axe-core": "^4.12.1",
|
|
72
|
+
"eslint": "10.7.0",
|
|
73
|
+
"jsdom": "29.1.1",
|
|
74
|
+
"react": "^19.2.7",
|
|
75
|
+
"react-dom": "^19.2.7",
|
|
76
|
+
"storybook": "^10.6.0",
|
|
77
|
+
"tsup": "^8.3.5",
|
|
78
|
+
"typescript": "~5.8.3",
|
|
79
|
+
"vitest": "4.1.11",
|
|
80
|
+
"vitest-axe": "^0.1.0",
|
|
81
|
+
"@atom63/eslint-config": "0.1.0",
|
|
82
|
+
"@atom63/tsconfig": "0.1.0"
|
|
83
|
+
},
|
|
84
|
+
"scripts": {
|
|
85
|
+
"build": "tsup",
|
|
86
|
+
"dev": "tsup --watch",
|
|
87
|
+
"typecheck": "tsc --noEmit",
|
|
88
|
+
"lint": "eslint . --cache --max-warnings 0",
|
|
89
|
+
"test": "vitest run",
|
|
90
|
+
"test:watch": "vitest"
|
|
91
|
+
}
|
|
92
|
+
}
|
package/src/styles.css
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @atom63/inform styles: the `.a63-Inform*` classes the surfaces render.
|
|
3
|
+
*
|
|
4
|
+
* Load it after @atom63/styles and the @atom63/ui-react recipes (the dialog and
|
|
5
|
+
* the action buttons are ui-react components):
|
|
6
|
+
*
|
|
7
|
+
* @import '@atom63/styles';
|
|
8
|
+
* @import '@atom63/ui-react/recipes.css';
|
|
9
|
+
* @import '@atom63/inform/styles.css';
|
|
10
|
+
*
|
|
11
|
+
* It needs no Tailwind: every value reads an --a63-* token.
|
|
12
|
+
*/
|
|
13
|
+
@import './surfaces/inform-parts.css' layer(components);
|
|
14
|
+
@import './surfaces/inform-banner.css' layer(components);
|
|
15
|
+
@import './surfaces/inform-corner-flyout.css' layer(components);
|
|
16
|
+
@import './surfaces/inform-dialog.css' layer(components);
|
|
17
|
+
@import './surfaces/inform-spotlight.css' layer(components);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Inform banner — an in-flow, non-interrupting notice. A bordered transparent
|
|
3
|
+
* row: the severity picks the border color (see inform-parts.css), text is
|
|
4
|
+
* start-aligned, and the padding is equal on both axes because the row's
|
|
5
|
+
* height follows the text rather than a touch target.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
.a63-InformBanner {
|
|
9
|
+
display: flex;
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
inline-size: 100%;
|
|
12
|
+
align-items: flex-start;
|
|
13
|
+
gap: var(--a63-space-3);
|
|
14
|
+
padding: var(--a63-space-3);
|
|
15
|
+
border-width: var(--a63-surface-border-width);
|
|
16
|
+
border-style: var(--a63-surface-border-style);
|
|
17
|
+
border-radius: var(--a63-surface-radius, var(--radius-lg));
|
|
18
|
+
background-color: transparent;
|
|
19
|
+
color: var(--a63-text-secondary);
|
|
20
|
+
font-size: var(--typography-sm-font-size);
|
|
21
|
+
line-height: 1.375;
|
|
22
|
+
text-align: start;
|
|
23
|
+
text-wrap: pretty;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.a63-InformBanner .a63-InformActions {
|
|
27
|
+
margin-block-start: var(--a63-space-1);
|
|
28
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Inform corner flyout — a persistent, non-blocking card, and the stack that
|
|
3
|
+
* places several of them in one corner. The card is a raised overlay surface
|
|
4
|
+
* (the same overlay contract as Popover and Dialog), so it follows themes.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
.a63-InformCornerFlyout {
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
padding: var(--a63-space-4);
|
|
10
|
+
border: var(--a63-overlay-border-width) var(--a63-overlay-border-style) var(--a63-border-subtle);
|
|
11
|
+
border-radius: var(--a63-overlay-radius, var(--radius-2xl));
|
|
12
|
+
background-color: var(--a63-surface-overlay);
|
|
13
|
+
background-image: var(--a63-overlay-gloss), var(--a63-overlay-texture-image);
|
|
14
|
+
background-blend-mode: normal, var(--a63-overlay-texture-blend);
|
|
15
|
+
backdrop-filter: var(--a63-overlay-backdrop);
|
|
16
|
+
box-shadow: var(--a63-overlay-inner-shadow, none), var(--a63-overlay-shadow);
|
|
17
|
+
color: var(--a63-text-primary);
|
|
18
|
+
opacity: 0;
|
|
19
|
+
transform: translateY(var(--a63-space-2));
|
|
20
|
+
transition:
|
|
21
|
+
opacity var(--a63-control-feedback-duration) var(--a63-control-feedback-ease),
|
|
22
|
+
transform var(--a63-control-feedback-duration) var(--a63-control-feedback-ease);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* One frame after mounting, so the entrance has a start state to animate from. */
|
|
26
|
+
.a63-InformCornerFlyout[data-state='entered'] {
|
|
27
|
+
opacity: 1;
|
|
28
|
+
transform: translateY(0);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* The exit slides toward the edge; the card reports its dismissal once it lands. */
|
|
32
|
+
.a63-InformCornerFlyout[data-leaving] {
|
|
33
|
+
opacity: 0;
|
|
34
|
+
transform: translateX(var(--a63-space-4));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.a63-InformCornerFlyout .a63-InformActions {
|
|
38
|
+
margin-block-start: var(--a63-space-2);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* ── Stack ─────────────────────────────────────────────────────────────── */
|
|
42
|
+
|
|
43
|
+
/*
|
|
44
|
+
* The container ignores the pointer so the page stays clickable through its
|
|
45
|
+
* gaps; the cards take pointer events back. Offsets along the anchored edge are
|
|
46
|
+
* measured in script, because each card sits relative to the ones in front.
|
|
47
|
+
*/
|
|
48
|
+
.a63-InformFlyoutStack {
|
|
49
|
+
position: fixed;
|
|
50
|
+
z-index: var(--z-layer-flyout);
|
|
51
|
+
inline-size: min(22rem, calc(100vw - 2rem));
|
|
52
|
+
pointer-events: none;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* The placement names a physical corner, so it does not mirror. */
|
|
56
|
+
.a63-InformFlyoutStack[data-placement$='right'] {
|
|
57
|
+
right: var(--a63-space-4);
|
|
58
|
+
}
|
|
59
|
+
.a63-InformFlyoutStack[data-placement$='left'] {
|
|
60
|
+
left: var(--a63-space-4);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.a63-InformFlyoutStack-item {
|
|
64
|
+
pointer-events: auto;
|
|
65
|
+
transition: transform var(--a63-control-feedback-duration) var(--a63-control-feedback-ease);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@media (prefers-reduced-motion: reduce) {
|
|
69
|
+
.a63-InformCornerFlyout,
|
|
70
|
+
.a63-InformFlyoutStack-item {
|
|
71
|
+
transition: none;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Inform dialog — the blocking notice, composed from the ui-react Dialog. Only
|
|
3
|
+
* the width and the icon row are its own; padding, title and description keep
|
|
4
|
+
* the Dialog recipe so an inform dialog sits like every other dialog.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
.a63-Dialog-popup.a63-InformDialog {
|
|
8
|
+
max-width: 28rem;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* The icon is a sibling of the text block, so the body aligns with the title. */
|
|
12
|
+
.a63-InformDialog-row {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: flex-start;
|
|
15
|
+
gap: var(--a63-space-3);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.a63-InformDialog-text {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex: 1 1 0%;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
gap: var(--a63-space-2);
|
|
23
|
+
min-inline-size: 0;
|
|
24
|
+
}
|