@efolusi/meridian 1.9.2 → 1.10.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/ai/Confirmation.d.ts +8 -1
- package/ai/Confirmation.js +9 -5
- package/ai/GeneratedImage.d.ts +3 -0
- package/ai/GeneratedImage.js +11 -8
- package/ai/Sandbox.d.ts +3 -0
- package/ai/Sandbox.js +9 -6
- package/data/StatusDot.d.ts +5 -1
- package/data/StatusDot.js +8 -4
- package/feedback/Banner.d.ts +3 -2
- package/feedback/Banner.js +1 -1
- package/feedback/Toast.d.ts +9 -1
- package/feedback/Toast.js +3 -2
- package/package.json +1 -1
package/ai/Confirmation.d.ts
CHANGED
|
@@ -3,10 +3,17 @@ export interface ConfirmationProps {
|
|
|
3
3
|
description?: React.ReactNode;
|
|
4
4
|
/** 'danger' for destructive approvals @default 'default' */
|
|
5
5
|
tone?: 'default' | 'danger';
|
|
6
|
-
/** Controlled
|
|
6
|
+
/** Controlled status */
|
|
7
|
+
status?: 'pending' | 'approved' | 'rejected';
|
|
8
|
+
/** @deprecated use `status` */
|
|
7
9
|
state?: 'pending' | 'approved' | 'rejected';
|
|
8
10
|
/** @default 'pending' */
|
|
11
|
+
/** @default 'pending' */
|
|
12
|
+
defaultStatus?: 'pending' | 'approved' | 'rejected';
|
|
13
|
+
/** @deprecated use `defaultStatus` */
|
|
9
14
|
defaultState?: 'pending' | 'approved' | 'rejected';
|
|
15
|
+
onStatusChange?: (status: 'pending' | 'approved' | 'rejected') => void;
|
|
16
|
+
/** @deprecated use `onStatusChange` */
|
|
10
17
|
onStateChange?: (state: 'pending' | 'approved' | 'rejected') => void;
|
|
11
18
|
/** Lucide icon; defaults by tone */
|
|
12
19
|
icon?: string;
|
package/ai/Confirmation.js
CHANGED
|
@@ -6,8 +6,11 @@ export function Confirmation({
|
|
|
6
6
|
title,
|
|
7
7
|
description,
|
|
8
8
|
tone = 'default',
|
|
9
|
+
status,
|
|
9
10
|
state,
|
|
10
|
-
|
|
11
|
+
defaultStatus,
|
|
12
|
+
defaultState,
|
|
13
|
+
onStatusChange,
|
|
11
14
|
onStateChange,
|
|
12
15
|
icon,
|
|
13
16
|
approveLabel = 'Approve',
|
|
@@ -19,11 +22,12 @@ export function Confirmation({
|
|
|
19
22
|
className,
|
|
20
23
|
...rest
|
|
21
24
|
}) {
|
|
22
|
-
const [un, setUn] = React.useState(defaultState);
|
|
23
|
-
const
|
|
25
|
+
const [un, setUn] = React.useState(defaultStatus ?? defaultState ?? 'pending'); // `defaultState`/`state`/`onStateChange` are deprecated aliases
|
|
26
|
+
const controlled = status ?? state;
|
|
27
|
+
const cur = controlled !== undefined ? controlled : un;
|
|
24
28
|
const set = next => {
|
|
25
|
-
if (
|
|
26
|
-
if (onStateChange) onStateChange(next);
|
|
29
|
+
if (controlled === undefined) setUn(next);
|
|
30
|
+
if (onStatusChange) onStatusChange(next);else if (onStateChange) onStateChange(next);
|
|
27
31
|
};
|
|
28
32
|
const settled = cur !== 'pending';
|
|
29
33
|
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
package/ai/GeneratedImage.d.ts
CHANGED
|
@@ -5,6 +5,9 @@ export interface GeneratedImageAction {
|
|
|
5
5
|
}
|
|
6
6
|
export interface GeneratedImageProps {
|
|
7
7
|
/** 'queued' | 'generating' | 'complete' | 'error' */
|
|
8
|
+
/** @default 'complete' */
|
|
9
|
+
status?: 'queued' | 'generating' | 'complete' | 'error';
|
|
10
|
+
/** @deprecated use `status` */
|
|
8
11
|
state?: 'queued' | 'generating' | 'complete' | 'error';
|
|
9
12
|
src?: string;
|
|
10
13
|
alt?: string;
|
package/ai/GeneratedImage.js
CHANGED
|
@@ -3,7 +3,8 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { Icon } from "../icons/Icon.js";
|
|
5
5
|
export function GeneratedImage({
|
|
6
|
-
|
|
6
|
+
status,
|
|
7
|
+
state,
|
|
7
8
|
src,
|
|
8
9
|
alt,
|
|
9
10
|
prompt,
|
|
@@ -15,31 +16,33 @@ export function GeneratedImage({
|
|
|
15
16
|
className,
|
|
16
17
|
...rest
|
|
17
18
|
}) {
|
|
19
|
+
const s = status ?? state ?? 'complete'; // `state` is a deprecated alias for `status`
|
|
20
|
+
|
|
18
21
|
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
19
|
-
className: `ef-genimg ef-genimg--${aspect} ef-genimg--${
|
|
22
|
+
className: `ef-genimg ef-genimg--${aspect} ef-genimg--${s}${className ? ' ' + className : ''}`,
|
|
20
23
|
style: style,
|
|
21
|
-
"data-state":
|
|
22
|
-
}), src && (
|
|
24
|
+
"data-state": s
|
|
25
|
+
}), src && (s === 'complete' || s === 'error') ? /*#__PURE__*/React.createElement("img", {
|
|
23
26
|
className: "ef-genimg__img",
|
|
24
27
|
src: src,
|
|
25
28
|
alt: alt || prompt || ''
|
|
26
29
|
}) : null, /*#__PURE__*/React.createElement("div", {
|
|
27
30
|
className: "ef-genimg__dark"
|
|
28
|
-
},
|
|
31
|
+
}, s === 'generating' ? /*#__PURE__*/React.createElement("div", {
|
|
29
32
|
className: "ef-genimg__dots"
|
|
30
33
|
}) : null), /*#__PURE__*/React.createElement("div", {
|
|
31
34
|
className: "ef-genimg__scrim ef-genimg__scrim--top",
|
|
32
35
|
"aria-hidden": "true"
|
|
33
36
|
}), prompt ? /*#__PURE__*/React.createElement("div", {
|
|
34
37
|
className: "ef-genimg__prompt"
|
|
35
|
-
}, prompt) : null,
|
|
38
|
+
}, prompt) : null, s === 'queued' ? /*#__PURE__*/React.createElement("div", {
|
|
36
39
|
className: "ef-genimg__center"
|
|
37
40
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
38
41
|
name: "image",
|
|
39
42
|
size: 20
|
|
40
|
-
}), /*#__PURE__*/React.createElement("span", null, "Queued\u2026")) : null,
|
|
43
|
+
}), /*#__PURE__*/React.createElement("span", null, "Queued\u2026")) : null, s === 'generating' ? /*#__PURE__*/React.createElement("div", {
|
|
41
44
|
className: "ef-genimg__status"
|
|
42
|
-
}, "Generating\u2026") : null,
|
|
45
|
+
}, "Generating\u2026") : null, s === 'error' ? /*#__PURE__*/React.createElement("div", {
|
|
43
46
|
className: "ef-genimg__center"
|
|
44
47
|
}, /*#__PURE__*/React.createElement("span", {
|
|
45
48
|
className: "ef-genimg__err"
|
package/ai/Sandbox.d.ts
CHANGED
|
@@ -8,6 +8,9 @@ export interface SandboxProps {
|
|
|
8
8
|
/** Command or filename, mono */
|
|
9
9
|
title: React.ReactNode;
|
|
10
10
|
/** 'running' | 'success' | 'error' */
|
|
11
|
+
/** @default 'success' */
|
|
12
|
+
status?: 'running' | 'success' | 'error';
|
|
13
|
+
/** @deprecated use `status` */
|
|
11
14
|
state?: 'running' | 'success' | 'error';
|
|
12
15
|
/** Right-side meta, e.g. duration */
|
|
13
16
|
meta?: React.ReactNode;
|
package/ai/Sandbox.js
CHANGED
|
@@ -9,7 +9,8 @@ const STATES = {
|
|
|
9
9
|
};
|
|
10
10
|
export function Sandbox({
|
|
11
11
|
title,
|
|
12
|
-
|
|
12
|
+
status,
|
|
13
|
+
state,
|
|
13
14
|
meta,
|
|
14
15
|
tabs = [],
|
|
15
16
|
defaultOpen,
|
|
@@ -18,13 +19,15 @@ export function Sandbox({
|
|
|
18
19
|
className,
|
|
19
20
|
...rest
|
|
20
21
|
}) {
|
|
21
|
-
const
|
|
22
|
+
const s = status ?? state ?? 'success'; // `state` is a deprecated alias for `status`
|
|
23
|
+
|
|
24
|
+
const [open, setOpen] = React.useState(defaultOpen !== undefined ? !!defaultOpen : s === 'error');
|
|
22
25
|
const [tab, setTab] = React.useState(defaultTab || tabs[0] && tabs[0].id);
|
|
23
26
|
const active = tabs.find(t => t.id === tab) || tabs[0];
|
|
24
27
|
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
|
25
|
-
className: `ef-sandbox ef-sandbox--${
|
|
28
|
+
className: `ef-sandbox ef-sandbox--${s}${open ? ' ef-sandbox--open' : ''}${className ? ' ' + className : ''}`,
|
|
26
29
|
style: style,
|
|
27
|
-
"data-state":
|
|
30
|
+
"data-state": s
|
|
28
31
|
}), /*#__PURE__*/React.createElement("button", {
|
|
29
32
|
type: "button",
|
|
30
33
|
className: "ef-sandbox__head",
|
|
@@ -39,12 +42,12 @@ export function Sandbox({
|
|
|
39
42
|
className: "ef-sandbox__title"
|
|
40
43
|
}, title), /*#__PURE__*/React.createElement("span", {
|
|
41
44
|
className: "ef-sandbox__meta"
|
|
42
|
-
},
|
|
45
|
+
}, s === 'running' ? /*#__PURE__*/React.createElement("span", {
|
|
43
46
|
className: "ef-sandbox__spin"
|
|
44
47
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
45
48
|
name: "loader-circle",
|
|
46
49
|
size: 13
|
|
47
|
-
})) : null, meta || STATES[
|
|
50
|
+
})) : null, meta || STATES[s])), /*#__PURE__*/React.createElement("div", {
|
|
48
51
|
className: "ef-sandbox__body"
|
|
49
52
|
}, /*#__PURE__*/React.createElement("div", {
|
|
50
53
|
className: "ef-sandbox__clip"
|
package/data/StatusDot.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
export interface StatusDotProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'> {
|
|
2
2
|
/** @default 'ok' */
|
|
3
|
+
status?: 'ok' | 'warn' | 'err' | 'busy' | 'off';
|
|
4
|
+
/** @deprecated use `status` */
|
|
3
5
|
state?: 'ok' | 'warn' | 'err' | 'busy' | 'off';
|
|
4
6
|
label?: React.ReactNode;
|
|
5
|
-
/** Text announced for the
|
|
7
|
+
/** Text announced for the status; defaults to OK / Warning / Error / Busy / Offline */
|
|
8
|
+
statusLabel?: string;
|
|
9
|
+
/** @deprecated use `statusLabel` */
|
|
6
10
|
stateLabel?: string;
|
|
7
11
|
/** Radiating pulse for live states */
|
|
8
12
|
pulse?: boolean;
|
package/data/StatusDot.js
CHANGED
|
@@ -9,20 +9,24 @@ const STATE_TEXT = {
|
|
|
9
9
|
off: 'Offline'
|
|
10
10
|
};
|
|
11
11
|
export function StatusDot({
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
status,
|
|
13
|
+
state,
|
|
14
|
+
statusLabel,
|
|
14
15
|
stateLabel,
|
|
16
|
+
label,
|
|
15
17
|
pulse,
|
|
16
18
|
style,
|
|
17
19
|
className,
|
|
18
20
|
...rest
|
|
19
21
|
}) {
|
|
22
|
+
const s = status ?? state ?? 'ok'; // `state` is a deprecated alias for `status`
|
|
23
|
+
|
|
20
24
|
// The dot itself is colour-only, so the state must also exist as text. With a
|
|
21
25
|
// visible label the state rides along visually hidden ("Error: API"); without
|
|
22
26
|
// one the whole span becomes an image whose accessible name is the state.
|
|
23
|
-
const stateText = stateLabel || STATE_TEXT[
|
|
27
|
+
const stateText = (statusLabel ?? stateLabel) || STATE_TEXT[s] || s;
|
|
24
28
|
return /*#__PURE__*/React.createElement("span", _extends({}, rest, {
|
|
25
|
-
className: `ef-status ef-status--${
|
|
29
|
+
className: `ef-status ef-status--${s}${pulse ? ' ef-status--pulse' : ''}${className ? ' ' + className : ''}`,
|
|
26
30
|
style: style,
|
|
27
31
|
role: label ? undefined : 'img',
|
|
28
32
|
"aria-label": label ? undefined : stateText
|
package/feedback/Banner.d.ts
CHANGED
|
@@ -3,8 +3,9 @@ export interface BannerProps {
|
|
|
3
3
|
tone?: 'neutral' | 'brand' | 'warning' | 'danger';
|
|
4
4
|
/** Lucide icon name */
|
|
5
5
|
icon?: string;
|
|
6
|
-
/**
|
|
7
|
-
action?:
|
|
6
|
+
/** Action slot: a node (rendered as-is) or, deprecated, a string label used with `onAction`. */
|
|
7
|
+
action?: React.ReactNode;
|
|
8
|
+
/** @deprecated pass a node to `action` instead */
|
|
8
9
|
onAction?: () => void;
|
|
9
10
|
/** Shows a dismiss ✕ */
|
|
10
11
|
onDismiss?: () => void;
|
package/feedback/Banner.js
CHANGED
|
@@ -25,7 +25,7 @@ export function Banner({
|
|
|
25
25
|
size: 15
|
|
26
26
|
})) : null, /*#__PURE__*/React.createElement("span", {
|
|
27
27
|
className: "ef-banner__text"
|
|
28
|
-
}, children), action ? /*#__PURE__*/React.createElement("button", {
|
|
28
|
+
}, children), action ? /*#__PURE__*/React.isValidElement(action) ? action : /*#__PURE__*/React.createElement("button", {
|
|
29
29
|
className: "ef-banner__action",
|
|
30
30
|
onClick: onAction
|
|
31
31
|
}, action) : null, onDismiss ? /*#__PURE__*/React.createElement(IconButton, {
|
package/feedback/Toast.d.ts
CHANGED
|
@@ -3,7 +3,11 @@ export interface ToastProps {
|
|
|
3
3
|
tone?: 'info' | 'success' | 'warning' | 'danger';
|
|
4
4
|
title: React.ReactNode;
|
|
5
5
|
description?: React.ReactNode;
|
|
6
|
+
/** Action slot, a node rendered as-is (prevents auto-dismiss per WCAG 2.2.1). */
|
|
7
|
+
action?: React.ReactNode;
|
|
8
|
+
/** @deprecated pass a node to `action` instead */
|
|
6
9
|
actionLabel?: string;
|
|
10
|
+
/** @deprecated pass a node to `action` instead */
|
|
7
11
|
onAction?: () => void;
|
|
8
12
|
/** Shows a dismiss ✕ */
|
|
9
13
|
onClose?: () => void;
|
|
@@ -31,11 +35,15 @@ export interface ToastOptions {
|
|
|
31
35
|
description?: React.ReactNode;
|
|
32
36
|
/** @default 'info' */
|
|
33
37
|
tone?: 'info' | 'success' | 'warning' | 'danger';
|
|
38
|
+
/** Action slot, a node rendered as-is (prevents auto-dismiss per WCAG 2.2.1). */
|
|
39
|
+
action?: React.ReactNode;
|
|
40
|
+
/** @deprecated pass a node to `action` instead */
|
|
34
41
|
actionLabel?: string;
|
|
42
|
+
/** @deprecated pass a node to `action` instead */
|
|
35
43
|
onAction?: () => void;
|
|
36
44
|
/**
|
|
37
45
|
* ms before auto-dismiss; 0 never dismisses.
|
|
38
|
-
* @default the Toaster's `duration`, or 0 when `actionLabel` is set — a
|
|
46
|
+
* @default the Toaster's `duration`, or 0 when `action`/`actionLabel` is set — a
|
|
39
47
|
* control must not vanish on a timer the user cannot adjust (WCAG 2.2.1).
|
|
40
48
|
*/
|
|
41
49
|
duration?: number;
|
package/feedback/Toast.js
CHANGED
|
@@ -14,6 +14,7 @@ export function Toast({
|
|
|
14
14
|
tone = 'info',
|
|
15
15
|
title,
|
|
16
16
|
description,
|
|
17
|
+
action,
|
|
17
18
|
actionLabel,
|
|
18
19
|
onAction,
|
|
19
20
|
onClose,
|
|
@@ -39,7 +40,7 @@ export function Toast({
|
|
|
39
40
|
className: "ef-toast__title"
|
|
40
41
|
}, title), description ? /*#__PURE__*/React.createElement("div", {
|
|
41
42
|
className: "ef-toast__desc"
|
|
42
|
-
}, description) : null, actionLabel ? /*#__PURE__*/React.createElement("button", {
|
|
43
|
+
}, description) : null, action ? action : actionLabel ? /*#__PURE__*/React.createElement("button", {
|
|
43
44
|
className: "ef-toast__action",
|
|
44
45
|
onClick: onAction
|
|
45
46
|
}, actionLabel) : null), onClose ? /*#__PURE__*/React.createElement(IconButton, {
|
|
@@ -118,7 +119,7 @@ export function Toaster({
|
|
|
118
119
|
} = options || {};
|
|
119
120
|
// A toast carrying an action must not time out: WCAG 2.2.1 does not allow a
|
|
120
121
|
// control to disappear on a timer the user cannot adjust.
|
|
121
|
-
const ms = own != null ? own : props.actionLabel ? 0 : duration;
|
|
122
|
+
const ms = own != null ? own : props.action || props.actionLabel ? 0 : duration;
|
|
122
123
|
setToasts(list => [...list, {
|
|
123
124
|
id,
|
|
124
125
|
props
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@efolusi/meridian",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "A general-purpose open-source design system by Efolusi: accessible React components, design tokens, blocks and example apps.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://meridian.efolusi.com",
|