@vibes.diy/base 14.3.379 → 14.3.380
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/components/vibe-menu/cards/AccountCard.d.ts +2 -1
- package/components/vibe-menu/cards/AccountCard.js +40 -2
- package/components/vibe-menu/parts/ActionPill.d.ts +1 -0
- package/components/vibe-menu/parts/ActionPill.js +1 -1
- package/components/vibe-menu/slices.d.ts +6 -0
- package/package.json +5 -5
|
@@ -19,6 +19,7 @@ export declare const ACCOUNT_COPY: Readonly<{
|
|
|
19
19
|
planAndCredits: "Plan & credits";
|
|
20
20
|
plusDetails: "See what's in Plus";
|
|
21
21
|
moreCreditWays: "More ways to add credits";
|
|
22
|
+
notNow: "Not now";
|
|
22
23
|
settings: "Settings";
|
|
23
24
|
logOut: "Log out";
|
|
24
25
|
addHandle: "Add a handle";
|
|
@@ -35,7 +36,7 @@ export declare const ACCOUNT_COPY: Readonly<{
|
|
|
35
36
|
switchTo: "Switch handle";
|
|
36
37
|
allHandles: (n: number) => string;
|
|
37
38
|
}>;
|
|
38
|
-
export declare const ACCOUNT_CARD_CSS = "\n[data-vibe-menu] .vm-hero { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 4px 0 14px; }\n[data-vibe-menu] .vm-big { font: 700 42px/0.8 var(--font-display); letter-spacing: -0.04em; white-space: nowrap; }\n[data-vibe-menu] .vm-caption { flex: 1; white-space: nowrap; font-size: 12px; line-height: 14px; color: var(--muted); }\n[data-vibe-menu] .vm-who { display: flex; align-items: center; gap: 10px; padding: 0 0 14px; }\n[data-vibe-menu] .vm-avatar { position: relative; overflow: hidden; width: 28px; height: 28px; border-radius: 50%; border: var(--stroke-rule) solid var(--line-card); background: var(--section-account); color: var(--on-account); display: grid; place-items: center; font: 700 12px/1 var(--font-tab); }\n[data-vibe-menu] .vm-handle { font: 700 16px/1 var(--font-display); }\n[data-vibe-menu] .vm-who + [data-guest-handle-note] { margin: -8px 0 14px 38px; }\n[data-vibe-menu] .vm-no-handle { font: 400 16px/1 var(--font-display); color: var(--muted); }\n[data-vibe-menu] .vm-meter { height: var(--size-meter); margin-bottom: var(--space-16); border: var(--stroke-rule) solid var(--line-card); border-radius: var(--radius-meter); overflow: hidden; }\n[data-vibe-menu] .vm-meter span { display: block; height: 100%; background: var(--section-account); border-right: var(--stroke-rule) solid var(--line-card); }\n[data-vibe-menu] .vm-account .vm-group + .vm-group { margin-top: var(--space-14); }\n[data-vibe-menu] .vm-drill .vm-input + .vm-drill-sec { margin-top: 14px; }\n[data-vibe-menu] .vm-handle-add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 6px; }\n[data-vibe-menu] .vm-handle-add .vm-input { flex: 1 1 180px; height: 40px; margin: 0; }\n[data-vibe-menu] .vm-acting-head { margin-top: 16px; padding-bottom: 2px; }\n[data-vibe-menu] .vm-acting-line { margin: 0 0 6px; font-size: 13px; color: var(--muted); }\n[data-vibe-menu] .vm-handle-row { display: flex; align-items: center; gap: 12px; width: 100%; height: 42px; }\n[data-vibe-menu] .vm-handle-row + .vm-handle-row { border-top: var(--stroke-hairline) solid var(--line-hairline); }\n[data-vibe-menu] .vm-handle-row .vm-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; }\n[data-vibe-menu] .vm-handle-row.is-active .vm-label { font-weight: 700; }\n[data-vibe-menu] .vm-handle-row.is-active .vm-initial { background: var(--accent); color: var(--on-accent); }\n[data-vibe-menu] .vm-initial { position: relative; overflow: hidden; }\n[data-vibe-menu] .vm-avatar img, [data-vibe-menu] .vm-initial img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }\n[data-vibe-menu] .vm-check { display: grid; color: var(--ink); }\n[data-vibe-menu] .vm-check .vm-glyph { width: 18px; height: 18px; stroke-width: 3; }\n[data-vibe-menu] .vm-handle-switch { margin: -6px 0 14px; }\n[data-vibe-menu] .vm-handle-switch-toggle { display: inline-flex; align-items: center; gap: 4px; margin: 0; padding: 4px 0; border: 0; background: none; color: var(--muted); font: 700 11px/1 var(--font-tab); letter-spacing: 0.12em; text-transform: uppercase; cursor: pointer; }\n[data-vibe-menu] .vm-handle-switch-toggle .vm-glyph { width: 14px; height: 14px; transition: transform 120ms ease; }\n[data-vibe-menu] .vm-handle-switch-toggle[aria-expanded=\"true\"] .vm-glyph { transform: rotate(90deg); }\n@media (prefers-reduced-motion: reduce) { [data-vibe-menu] .vm-handle-switch-toggle .vm-glyph { transition: none; } }\n[data-vibe-menu] .vm-handle-switch .vm-handle-row { height: 40px; padding: 0; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }\n[data-vibe-menu] .vm-handle-switch .vm-handle-row:disabled { cursor: default; opacity: 0.6; }\n[data-vibe-menu] .vm-handle-switch .vm-avatar { flex: none; }\n[data-vibe-menu] .vm-picture { display: flex; padding: 2px 0 8px 40px; }\n[data-vibe-menu] .vm-form-note { margin: 8px 0 0; font-size: 13px; color: var(--ink); }\n/* #8641: Handles, type yours first. A question in the display face, the ideas quiet under the field. */\n[data-vibe-menu] .vm-account .vm-handle-question { margin: 0 0 4px; font: 700 18px/1.2 var(--font-display); color: var(--ink); }\n[data-vibe-menu] .vm-account .vm-handle-question-sub { margin: 0 0 12px; }\n[data-vibe-menu] .vm-account .vm-handle-idea-line { margin: 14px 0 6px; }\n[data-vibe-menu] .vm-handle-for-now { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin-top: 12px; }\n[data-vibe-menu] .vm-handle-for-now .vm-sub { margin: 0; }\n[data-vibe-menu] .vm-handle-add-main { margin-top: 12px; }\n@container (max-width: 480px) {\n [data-vibe-menu] .vm-big { font-size: 36px; }\n [data-vibe-menu] .vm-handle-add .vm-input { flex-basis: 100%; }\n}\n";
|
|
39
|
+
export declare const ACCOUNT_CARD_CSS = "\n[data-vibe-menu] .vm-hero { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 4px 0 14px; }\n[data-vibe-menu] .vm-big { font: 700 42px/0.8 var(--font-display); letter-spacing: -0.04em; white-space: nowrap; }\n[data-vibe-menu] .vm-caption { flex: 1; white-space: nowrap; font-size: 12px; line-height: 14px; color: var(--muted); }\n[data-vibe-menu] .vm-who { display: flex; align-items: center; gap: 10px; padding: 0 0 14px; }\n[data-vibe-menu] .vm-avatar { position: relative; overflow: hidden; width: 28px; height: 28px; border-radius: 50%; border: var(--stroke-rule) solid var(--line-card); background: var(--section-account); color: var(--on-account); display: grid; place-items: center; font: 700 12px/1 var(--font-tab); }\n[data-vibe-menu] .vm-handle { font: 700 16px/1 var(--font-display); }\n[data-vibe-menu] .vm-who + [data-guest-handle-note] { margin: -8px 0 14px 38px; }\n[data-vibe-menu] .vm-no-handle { font: 400 16px/1 var(--font-display); color: var(--muted); }\n[data-vibe-menu] .vm-meter { height: var(--size-meter); margin-bottom: var(--space-16); border: var(--stroke-rule) solid var(--line-card); border-radius: var(--radius-meter); overflow: hidden; }\n[data-vibe-menu] .vm-meter span { display: block; height: 100%; background: var(--section-account); border-right: var(--stroke-rule) solid var(--line-card); }\n[data-vibe-menu] .vm-account .vm-group + .vm-group { margin-top: var(--space-14); }\n[data-vibe-menu] .vm-drill .vm-input + .vm-drill-sec { margin-top: 14px; }\n[data-vibe-menu] .vm-handle-add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 6px; }\n[data-vibe-menu] .vm-handle-add .vm-input { flex: 1 1 180px; height: 40px; margin: 0; }\n[data-vibe-menu] .vm-acting-head { margin-top: 16px; padding-bottom: 2px; }\n[data-vibe-menu] .vm-acting-line { margin: 0 0 6px; font-size: 13px; color: var(--muted); }\n[data-vibe-menu] .vm-handle-row { display: flex; align-items: center; gap: 12px; width: 100%; height: 42px; }\n[data-vibe-menu] .vm-handle-row + .vm-handle-row { border-top: var(--stroke-hairline) solid var(--line-hairline); }\n[data-vibe-menu] .vm-handle-row .vm-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; }\n[data-vibe-menu] .vm-handle-row.is-active .vm-label { font-weight: 700; }\n[data-vibe-menu] .vm-handle-row.is-active .vm-initial { background: var(--accent); color: var(--on-accent); }\n[data-vibe-menu] .vm-initial { position: relative; overflow: hidden; }\n[data-vibe-menu] .vm-avatar img, [data-vibe-menu] .vm-initial img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }\n[data-vibe-menu] .vm-check { display: grid; color: var(--ink); }\n[data-vibe-menu] .vm-check .vm-glyph { width: 18px; height: 18px; stroke-width: 3; }\n[data-vibe-menu] .vm-handle-switch { margin: -6px 0 14px; }\n[data-vibe-menu] .vm-handle-switch-toggle { display: inline-flex; align-items: center; gap: 4px; margin: 0; padding: 4px 0; border: 0; background: none; color: var(--muted); font: 700 11px/1 var(--font-tab); letter-spacing: 0.12em; text-transform: uppercase; cursor: pointer; }\n[data-vibe-menu] .vm-handle-switch-toggle .vm-glyph { width: 14px; height: 14px; transition: transform 120ms ease; }\n[data-vibe-menu] .vm-handle-switch-toggle[aria-expanded=\"true\"] .vm-glyph { transform: rotate(90deg); }\n@media (prefers-reduced-motion: reduce) { [data-vibe-menu] .vm-handle-switch-toggle .vm-glyph { transition: none; } }\n[data-vibe-menu] .vm-handle-switch .vm-handle-row { height: 40px; padding: 0; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }\n[data-vibe-menu] .vm-handle-switch .vm-handle-row:disabled { cursor: default; opacity: 0.6; }\n[data-vibe-menu] .vm-handle-switch .vm-avatar { flex: none; }\n[data-vibe-menu] .vm-picture { display: flex; padding: 2px 0 8px 40px; }\n[data-vibe-menu] .vm-form-note { margin: 8px 0 0; font-size: 13px; color: var(--ink); }\n/* #8641: Handles, type yours first. A question in the display face, the ideas quiet under the field. */\n[data-vibe-menu] .vm-account .vm-handle-question { margin: 0 0 4px; font: 700 18px/1.2 var(--font-display); color: var(--ink); }\n[data-vibe-menu] .vm-account .vm-handle-question-sub { margin: 0 0 12px; }\n[data-vibe-menu] .vm-account .vm-handle-idea-line { margin: 14px 0 6px; }\n[data-vibe-menu] .vm-handle-for-now { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin-top: 12px; }\n[data-vibe-menu] .vm-handle-for-now .vm-sub { margin: 0; }\n[data-vibe-menu] .vm-handle-add-main { margin-top: 12px; }\n/* #9460: the saved-card top-up's confirm sits in the pill's place: its line, then Pay, then Not now. */\n[data-vibe-menu] .vm-topup-confirm .vm-topup-line { margin: 0 0 var(--space-12); }\n@container (max-width: 480px) {\n [data-vibe-menu] .vm-big { font-size: 36px; }\n [data-vibe-menu] .vm-handle-add .vm-input { flex-basis: 100%; }\n}\n";
|
|
39
40
|
export interface AccountCardProps {
|
|
40
41
|
readonly viewer: ViewerSlice;
|
|
41
42
|
readonly account: AccountSlice;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { useEffect, useId, useRef, useState } from "react";
|
|
3
3
|
import { toRFC2822_32ByteLength } from "@vibes.diy/vibe-types";
|
|
4
4
|
import { SECTION_TITLES } from "../menu-state.js";
|
|
5
5
|
import { CREATE_ACCOUNT_TO_KEEP_APPS, GUEST_APPS_HERE, GUEST_SIGN_IN_BONUS, HANDLE_TYPE_FIRST, JOIN_OR_SIGN_IN } from "../copy.js";
|
|
@@ -29,6 +29,7 @@ export const ACCOUNT_COPY = Object.freeze({
|
|
|
29
29
|
planAndCredits: "Plan & credits",
|
|
30
30
|
plusDetails: "See what's in Plus",
|
|
31
31
|
moreCreditWays: "More ways to add credits",
|
|
32
|
+
notNow: "Not now",
|
|
32
33
|
settings: "Settings",
|
|
33
34
|
logOut: "Log out",
|
|
34
35
|
addHandle: "Add a handle",
|
|
@@ -88,6 +89,8 @@ export const ACCOUNT_CARD_CSS = `
|
|
|
88
89
|
[data-vibe-menu] .vm-handle-for-now { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin-top: 12px; }
|
|
89
90
|
[data-vibe-menu] .vm-handle-for-now .vm-sub { margin: 0; }
|
|
90
91
|
[data-vibe-menu] .vm-handle-add-main { margin-top: 12px; }
|
|
92
|
+
/* #9460: the saved-card top-up's confirm sits in the pill's place: its line, then Pay, then Not now. */
|
|
93
|
+
[data-vibe-menu] .vm-topup-confirm .vm-topup-line { margin: 0 0 var(--space-12); }
|
|
91
94
|
@container (max-width: 480px) {
|
|
92
95
|
[data-vibe-menu] .vm-big { font-size: 36px; }
|
|
93
96
|
[data-vibe-menu] .vm-handle-add .vm-input { flex-basis: 100%; }
|
|
@@ -415,14 +418,49 @@ function AccountBody(props) {
|
|
|
415
418
|
guestAsk === null ? React.createElement(CreditsPill, { account: account, nav: nav }) : null,
|
|
416
419
|
React.createElement(AccountRows, { account: account, lead: guestAsk === null ? (React.createElement(Row, { lead: "at-sign", label: ACCOUNT_COPY.handles, tail: { kind: "drill", value: `@${active}`, handle: true }, onClick: () => nav.onDrill({ drill: "handles" }) })) : null })));
|
|
417
420
|
}
|
|
421
|
+
function TopUpConfirm(props) {
|
|
422
|
+
const { confirm, busy } = props;
|
|
423
|
+
const lineId = useId();
|
|
424
|
+
const paid = useRef(false);
|
|
425
|
+
return (React.createElement("div", { role: "group", "aria-labelledby": lineId, className: "vm-topup-confirm", "data-topup-confirm": "" },
|
|
426
|
+
React.createElement("p", { id: lineId, className: "vm-label is-plain vm-topup-line" }, confirm.line),
|
|
427
|
+
React.createElement(ActionPill, { label: busy ? confirm.working : confirm.pay, glyph: "check", busy: busy, disabled: busy, autoFocus: true, solo: confirm.note === undefined, caption: confirm.note, onClick: () => {
|
|
428
|
+
if (paid.current)
|
|
429
|
+
return;
|
|
430
|
+
paid.current = true;
|
|
431
|
+
props.onPay();
|
|
432
|
+
} }),
|
|
433
|
+
busy ? null : React.createElement(TextButton, { label: ACCOUNT_COPY.notNow, onClick: props.onDismiss })));
|
|
434
|
+
}
|
|
418
435
|
function CreditsPill({ account, nav }) {
|
|
419
436
|
const action = account.creditsAction;
|
|
420
437
|
const checkout = action.checkout;
|
|
438
|
+
const [confirming, setConfirming] = useState(false);
|
|
439
|
+
const pill = useRef(null);
|
|
440
|
+
const backToPill = useRef(false);
|
|
441
|
+
const notice = checkout?.notice;
|
|
442
|
+
useEffect(() => {
|
|
443
|
+
if (notice !== undefined)
|
|
444
|
+
setConfirming(false);
|
|
445
|
+
}, [notice]);
|
|
446
|
+
useEffect(() => {
|
|
447
|
+
if (confirming || backToPill.current === false)
|
|
448
|
+
return;
|
|
449
|
+
backToPill.current = false;
|
|
450
|
+
pill.current?.focus();
|
|
451
|
+
}, [confirming]);
|
|
421
452
|
if (checkout !== undefined) {
|
|
422
453
|
const busy = checkout.busy === true;
|
|
423
454
|
const member = account.credits.plan !== null && account.credits.plan !== "free";
|
|
455
|
+
const confirm = checkout.confirm;
|
|
456
|
+
if (confirm !== undefined && confirming) {
|
|
457
|
+
return (React.createElement(TopUpConfirm, { confirm: confirm, busy: busy, onPay: checkout.start, onDismiss: () => {
|
|
458
|
+
backToPill.current = true;
|
|
459
|
+
setConfirming(false);
|
|
460
|
+
} }));
|
|
461
|
+
}
|
|
424
462
|
return (React.createElement(React.Fragment, null,
|
|
425
|
-
React.createElement(ActionPill, { label: busy ? (checkout.working ?? checkout.label) : checkout.label, busy: busy, disabled: busy, onClick: checkout.start, solo: checkout.notice === undefined, caption: checkout.notice }),
|
|
463
|
+
React.createElement(ActionPill, { buttonRef: pill, label: busy ? (checkout.working ?? checkout.label) : checkout.label, busy: busy, disabled: busy, onClick: confirm === undefined ? checkout.start : () => setConfirming(true), solo: checkout.notice === undefined, caption: checkout.notice }),
|
|
426
464
|
(account.plus ?? null) === null || busy ? null : (React.createElement(TextButton, { label: member ? ACCOUNT_COPY.moreCreditWays : ACCOUNT_COPY.plusDetails, onClick: () => nav.onDrill({ drill: "plus" }) }))));
|
|
427
465
|
}
|
|
428
466
|
if ((account.plus ?? null) === null)
|
|
@@ -10,6 +10,7 @@ export interface ActionPillProps {
|
|
|
10
10
|
readonly disabled?: boolean;
|
|
11
11
|
readonly busy?: boolean;
|
|
12
12
|
readonly autoFocus?: boolean;
|
|
13
|
+
readonly buttonRef?: React.Ref<HTMLButtonElement>;
|
|
13
14
|
readonly onClick?: () => void;
|
|
14
15
|
}
|
|
15
16
|
export declare function ActionPill(props: ActionPillProps): React.ReactElement;
|
|
@@ -6,7 +6,7 @@ export function ActionPill(props) {
|
|
|
6
6
|
const content = (React.createElement(React.Fragment, null,
|
|
7
7
|
React.createElement("span", null, props.label),
|
|
8
8
|
React.createElement(Glyph, { name: props.glyph ?? "arrow-right" })));
|
|
9
|
-
const pill = props.href !== undefined && disabled === false ? (React.createElement("a", { className: className, href: props.href, "aria-label": props.ariaLabel, autoFocus: props.autoFocus, onClick: props.onClick }, content)) : (React.createElement("button", { className: className, type: "button", "aria-label": props.ariaLabel, "aria-disabled": disabled ? "true" : undefined, "aria-busy": props.busy === true ? "true" : undefined, autoFocus: props.autoFocus, onClick: () => {
|
|
9
|
+
const pill = props.href !== undefined && disabled === false ? (React.createElement("a", { className: className, href: props.href, "aria-label": props.ariaLabel, autoFocus: props.autoFocus, onClick: props.onClick }, content)) : (React.createElement("button", { ref: props.buttonRef, className: className, type: "button", "aria-label": props.ariaLabel, "aria-disabled": disabled ? "true" : undefined, "aria-busy": props.busy === true ? "true" : undefined, autoFocus: props.autoFocus, onClick: () => {
|
|
10
10
|
if (disabled)
|
|
11
11
|
return;
|
|
12
12
|
props.onClick?.();
|
|
@@ -61,6 +61,12 @@ export interface AccountSlice {
|
|
|
61
61
|
readonly busy?: boolean;
|
|
62
62
|
readonly working?: string;
|
|
63
63
|
readonly notice?: string;
|
|
64
|
+
readonly confirm?: {
|
|
65
|
+
readonly line: string;
|
|
66
|
+
readonly pay: string;
|
|
67
|
+
readonly working: string;
|
|
68
|
+
readonly note?: string;
|
|
69
|
+
};
|
|
64
70
|
readonly start: () => void;
|
|
65
71
|
};
|
|
66
72
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibes.diy/base",
|
|
3
|
-
"version": "14.3.
|
|
3
|
+
"version": "14.3.380",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@adviser/cement": "~0.5.37",
|
|
12
12
|
"@emotion/css": "~11.13.5",
|
|
13
|
-
"@vibes.diy/api-types": "14.3.
|
|
14
|
-
"@vibes.diy/use-vibes-types": "14.3.
|
|
15
|
-
"@vibes.diy/vibe-runtime": "14.3.
|
|
16
|
-
"@vibes.diy/vibe-types": "14.3.
|
|
13
|
+
"@vibes.diy/api-types": "14.3.380",
|
|
14
|
+
"@vibes.diy/use-vibes-types": "14.3.380",
|
|
15
|
+
"@vibes.diy/vibe-runtime": "14.3.380",
|
|
16
|
+
"@vibes.diy/vibe-types": "14.3.380",
|
|
17
17
|
"arktype": "~2.2.9",
|
|
18
18
|
"officeparser": "~8.7.1",
|
|
19
19
|
"qrcode-generator": "~2.0.4",
|