@haatlabs-core/ui 0.29.0 → 0.29.2
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/dist/admin/AdminShell.d.ts +59 -0
- package/dist/admin/AdminShell.js +110 -0
- package/dist/admin/AdminShell.js.map +1 -0
- package/dist/admin/admin-css.d.ts +2 -0
- package/dist/admin/admin-css.js +38 -0
- package/dist/admin/admin-css.js.map +1 -0
- package/dist/admin/index.d.ts +2 -0
- package/dist/admin/index.js +1 -0
- package/dist/admin/index.js.map +1 -1
- package/dist/theme/ThemeStyles.js +3 -1
- package/dist/theme/ThemeStyles.js.map +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import type { NavItem } from '../shell/nav.js';
|
|
3
|
+
import type { AnnouncementsAdminClient } from './announcements-client.js';
|
|
4
|
+
/** Which copy of an app an admin is for: shown on every admin page so nobody mixes them up. */
|
|
5
|
+
export type AdminEnvironment = 'production' | 'staging' | 'dev' | 'local';
|
|
6
|
+
/**
|
|
7
|
+
* The environment, from the API address the admin was built for: `api-dev…` and
|
|
8
|
+
* `api-dev-<app>…` are dev, `api-staging…` staging, an empty or localhost address local, and
|
|
9
|
+
* any other production.
|
|
10
|
+
*/
|
|
11
|
+
export declare function environmentOf(apiBaseUrl: string): AdminEnvironment;
|
|
12
|
+
/** The environment as a badge: amber for production, the accent's soft tint otherwise. */
|
|
13
|
+
export declare function EnvironmentBadge({ environment }: {
|
|
14
|
+
environment: AdminEnvironment;
|
|
15
|
+
}): ReactElement;
|
|
16
|
+
/**
|
|
17
|
+
* Every app's admin sign-in: the app's mark, name and environment beside a plain email and
|
|
18
|
+
* password form. `onSignIn` signs in (and keeps the administrator); a 401 is said plainly,
|
|
19
|
+
* anything else in the server's words.
|
|
20
|
+
*/
|
|
21
|
+
export declare function AdminSignIn(props: {
|
|
22
|
+
appName: string;
|
|
23
|
+
environment: AdminEnvironment;
|
|
24
|
+
onSignIn: (input: {
|
|
25
|
+
email: string;
|
|
26
|
+
password: string;
|
|
27
|
+
}) => Promise<unknown>;
|
|
28
|
+
mark?: ReactNode;
|
|
29
|
+
/** What this admin is for, one line; a general one by default. */
|
|
30
|
+
pitch?: string;
|
|
31
|
+
/** The admin's sections, shown as chips beside the form. */
|
|
32
|
+
sections?: string[];
|
|
33
|
+
}): ReactElement;
|
|
34
|
+
/** Where the platform's own admin pages are, in every app's admin. */
|
|
35
|
+
export declare const PLATFORM_ADMIN_PATHS: {
|
|
36
|
+
announcements: string;
|
|
37
|
+
maintenance: string;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Every app's admin shell: the platform's sidebar shell with the app's mark and name, the
|
|
41
|
+
* environment badge, the app's own pages above the platform's (announcements and maintenance),
|
|
42
|
+
* the signed-in administrator with sign-out, and "Maintenance is ON" across every page while
|
|
43
|
+
* a window is open.
|
|
44
|
+
*/
|
|
45
|
+
export declare function AdminShell(props: {
|
|
46
|
+
appName: string;
|
|
47
|
+
environment: AdminEnvironment;
|
|
48
|
+
/** The app's own admin pages. */
|
|
49
|
+
nav: NavItem[];
|
|
50
|
+
announcements: AnnouncementsAdminClient;
|
|
51
|
+
account: {
|
|
52
|
+
email: string;
|
|
53
|
+
onSignOut: () => void;
|
|
54
|
+
signingOut?: boolean;
|
|
55
|
+
};
|
|
56
|
+
mark?: ReactNode;
|
|
57
|
+
busy?: boolean;
|
|
58
|
+
children: ReactNode;
|
|
59
|
+
}): ReactElement;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { ApiError } from '../client/index.js';
|
|
4
|
+
import { AppShell } from '../shell/AppShell.js';
|
|
5
|
+
import { NavIcon } from '../shell/icons.js';
|
|
6
|
+
import { MaintenanceOnBanner } from './MaintenancePage.js';
|
|
7
|
+
const ENV_LABEL = {
|
|
8
|
+
production: 'Production',
|
|
9
|
+
staging: 'Staging',
|
|
10
|
+
dev: 'Dev',
|
|
11
|
+
local: 'Local',
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The environment, from the API address the admin was built for: `api-dev…` and
|
|
15
|
+
* `api-dev-<app>…` are dev, `api-staging…` staging, an empty or localhost address local, and
|
|
16
|
+
* any other production.
|
|
17
|
+
*/
|
|
18
|
+
export function environmentOf(apiBaseUrl) {
|
|
19
|
+
if (!apiBaseUrl)
|
|
20
|
+
return 'local';
|
|
21
|
+
let host;
|
|
22
|
+
try {
|
|
23
|
+
host = new URL(apiBaseUrl).hostname;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return 'local';
|
|
27
|
+
}
|
|
28
|
+
if (host === 'localhost' || host === '127.0.0.1' || host.endsWith('.localhost'))
|
|
29
|
+
return 'local';
|
|
30
|
+
const first = host.split('.')[0] ?? '';
|
|
31
|
+
if (/(^|-)dev(-|$)/.test(first))
|
|
32
|
+
return 'dev';
|
|
33
|
+
if (/(^|-)staging(-|$)/.test(first))
|
|
34
|
+
return 'staging';
|
|
35
|
+
return 'production';
|
|
36
|
+
}
|
|
37
|
+
function Mark({ appName, mark }) {
|
|
38
|
+
return (_jsx("span", { className: "hl-admin-mark", "aria-hidden": "true", children: mark ?? appName.charAt(0).toUpperCase() }));
|
|
39
|
+
}
|
|
40
|
+
function Brand(props) {
|
|
41
|
+
return (_jsxs("span", { className: "hl-admin-brand", children: [_jsx(Mark, { appName: props.appName, mark: props.mark }), _jsxs("span", { className: "hl-admin-brand__name", children: [_jsx("strong", { children: props.appName }), _jsx("span", { children: props.detail })] })] }));
|
|
42
|
+
}
|
|
43
|
+
/** The environment as a badge: amber for production, the accent's soft tint otherwise. */
|
|
44
|
+
export function EnvironmentBadge({ environment }) {
|
|
45
|
+
return (_jsx("span", { className: "hl-admin-env", "data-env": environment, children: ENV_LABEL[environment] }));
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Every app's admin sign-in: the app's mark, name and environment beside a plain email and
|
|
49
|
+
* password form. `onSignIn` signs in (and keeps the administrator); a 401 is said plainly,
|
|
50
|
+
* anything else in the server's words.
|
|
51
|
+
*/
|
|
52
|
+
export function AdminSignIn(props) {
|
|
53
|
+
const [email, setEmail] = useState('');
|
|
54
|
+
const [password, setPassword] = useState('');
|
|
55
|
+
const [pending, setPending] = useState(false);
|
|
56
|
+
const [error, setError] = useState(null);
|
|
57
|
+
const submit = async (event) => {
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
setPending(true);
|
|
60
|
+
setError(null);
|
|
61
|
+
try {
|
|
62
|
+
await props.onSignIn({ email, password });
|
|
63
|
+
}
|
|
64
|
+
catch (failure) {
|
|
65
|
+
setError(failure instanceof ApiError && failure.status === 401
|
|
66
|
+
? 'That email and password do not match an administrator.'
|
|
67
|
+
: failure instanceof Error
|
|
68
|
+
? failure.message
|
|
69
|
+
: 'Signing in failed. Try again.');
|
|
70
|
+
}
|
|
71
|
+
finally {
|
|
72
|
+
setPending(false);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const sections = props.sections ?? ['Organizations', 'Announcements', 'Maintenance'];
|
|
76
|
+
return (_jsxs("div", { className: "hl-admin-signin", children: [_jsxs("aside", { className: "hl-admin-signin__side", children: [_jsx(Brand, { appName: props.appName, mark: props.mark, detail: `Admin · ${ENV_LABEL[props.environment]}` }), _jsxs("div", { className: "hl-admin-signin__pitch", children: [_jsxs("h1", { children: ["Run ", props.appName, " from one place."] }), _jsx("p", { children: props.pitch ??
|
|
77
|
+
'Customers and plans, announcements to merchants and maintenance windows. For the people who run the platform: a store’s own account does not sign in here.' }), _jsx("ul", { className: "hl-admin-signin__chips", "aria-label": "Sections", children: sections.map((section) => (_jsx("li", { children: section }, section))) })] }), _jsx("span", { className: "hl-admin-signin__foot", children: "A Haatlabs app" })] }), _jsx("main", { className: "hl-admin-signin__main", children: _jsxs("form", { className: "hl-admin-signin__form", onSubmit: (event) => void submit(event), children: [_jsx("h2", { children: "Sign in" }), _jsx("p", { children: "With your platform administrator email and password." }), error && _jsx("p", { role: "alert", children: error }), _jsxs("label", { children: ["Email", _jsx("input", { type: "email", autoComplete: "username", required: true, value: email, onChange: (event) => setEmail(event.target.value) })] }), _jsxs("label", { children: ["Password", _jsx("input", { type: "password", autoComplete: "current-password", required: true, value: password, onChange: (event) => setPassword(event.target.value) })] }), _jsx("button", { type: "submit", disabled: pending, children: pending ? 'Signing in…' : 'Sign in' }), _jsx("p", { className: "hl-admin-signin__note", children: "Repeated wrong tries lock the address for a while." })] }) })] }));
|
|
78
|
+
}
|
|
79
|
+
/** Where the platform's own admin pages are, in every app's admin. */
|
|
80
|
+
export const PLATFORM_ADMIN_PATHS = {
|
|
81
|
+
announcements: '/announcements',
|
|
82
|
+
maintenance: '/maintenance',
|
|
83
|
+
};
|
|
84
|
+
const PLATFORM_NAV = [
|
|
85
|
+
{
|
|
86
|
+
label: 'Announcements',
|
|
87
|
+
to: PLATFORM_ADMIN_PATHS.announcements,
|
|
88
|
+
icon: _jsx(NavIcon, { name: "notifications" }),
|
|
89
|
+
},
|
|
90
|
+
{ label: 'Maintenance', to: PLATFORM_ADMIN_PATHS.maintenance, icon: _jsx(NavIcon, { name: "settings" }) },
|
|
91
|
+
];
|
|
92
|
+
/**
|
|
93
|
+
* Every app's admin shell: the platform's sidebar shell with the app's mark and name, the
|
|
94
|
+
* environment badge, the app's own pages above the platform's (announcements and maintenance),
|
|
95
|
+
* the signed-in administrator with sign-out, and "Maintenance is ON" across every page while
|
|
96
|
+
* a window is open.
|
|
97
|
+
*/
|
|
98
|
+
export function AdminShell(props) {
|
|
99
|
+
const groups = [
|
|
100
|
+
...(props.nav.length > 0 ? [{ label: props.appName, items: props.nav }] : []),
|
|
101
|
+
{ label: 'Platform', items: PLATFORM_NAV },
|
|
102
|
+
];
|
|
103
|
+
return (_jsx(AppShell, { brand: _jsx(Brand, { appName: props.appName, mark: props.mark, detail: "Admin" }), brandMark: _jsx(Mark, { appName: props.appName, mark: props.mark }), nav: groups, statusChip: _jsx(EnvironmentBadge, { environment: props.environment }), banner: _jsx(MaintenanceOnBanner, { client: props.announcements }), account: {
|
|
104
|
+
name: props.account.email,
|
|
105
|
+
detail: 'Platform administrator',
|
|
106
|
+
onSignOut: props.account.onSignOut,
|
|
107
|
+
signingOut: props.account.signingOut,
|
|
108
|
+
}, busy: props.busy, children: props.children }));
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=AdminShell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AdminShell.js","sourceRoot":"","sources":["../../src/admin/AdminShell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAM3D,MAAM,SAAS,GAAqC;IAClD,UAAU,EAAE,YAAY;IACxB,OAAO,EAAE,SAAS;IAClB,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;CACf,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,UAAkB;IAC9C,IAAI,CAAC,UAAU;QAAE,OAAO,OAAO,CAAC;IAChC,IAAI,IAAY,CAAC;IACjB,IAAI,CAAC;QACH,IAAI,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,IAAI,IAAI,KAAK,WAAW,IAAI,IAAI,KAAK,WAAW,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC;QAAE,OAAO,OAAO,CAAC;IACh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,IAAI,YAEf,KAAK,CAAC,QAAQ,GACN,CACZ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/** The admin's sign-in and brand, on the theme's tokens (rendered by ThemeStyles). */
|
|
2
|
+
export declare const ADMIN_CSS = "\n.hl-admin-mark { width: 34px; height: 34px; flex: none; border-radius: 9px; background: var(--hl-accent); color: var(--hl-on-accent); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; }\n.hl-admin-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }\n.hl-admin-brand__name { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }\n.hl-admin-brand__name strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.hl-admin-brand__name span { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.7; }\n.hl-admin-env { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 4px 9px; border-radius: 999px; }\n.hl-admin-env[data-env=\"production\"] { background: var(--hl-amber-bg); color: var(--hl-amber-text); border: 1px solid var(--hl-amber-border); }\n.hl-admin-env[data-env=\"dev\"], .hl-admin-env[data-env=\"staging\"], .hl-admin-env[data-env=\"local\"] { background: var(--hl-accent-soft); color: var(--hl-accent-text); }\n.hl-admin-signin { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 520px) 1fr; background: var(--hl-ground); color: var(--hl-text); font-family: var(--hl-font); }\n.hl-admin-signin__side { background: var(--hl-panel); color: var(--hl-panel-text); padding: 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }\n.hl-admin-signin__side .hl-admin-brand__name span { color: var(--hl-panel-muted); opacity: 1; }\n.hl-admin-signin__pitch h1 { margin: 0 0 16px; font-size: 38px; line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; }\n.hl-admin-signin__pitch p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--hl-panel-soft); max-width: 380px; }\n.hl-admin-signin__chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; padding: 0; list-style: none; }\n.hl-admin-signin__chips li { font-size: 12px; padding: 6px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); color: var(--hl-panel-soft); }\n.hl-admin-signin__foot { font-size: 12px; color: var(--hl-panel-muted); }\n.hl-admin-signin__main { display: flex; align-items: center; justify-content: center; padding: 56px 24px; }\n.hl-admin-signin__form { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 18px; }\n.hl-admin-signin__form h2 { margin: 0; font-size: 26px; font-weight: 700; }\n.hl-admin-signin__form > p { margin: -10px 0 0; color: var(--hl-muted); font-size: 14px; }\n.hl-admin-signin__form label { display: flex; flex-direction: column; gap: 8px; font-size: 13px; font-weight: 600; }\n.hl-admin-signin__form input { height: 46px; box-sizing: border-box; padding: 0 14px; border-radius: var(--hl-radius-control); border: 1px solid var(--hl-border); background: var(--hl-surface); color: var(--hl-text); font: inherit; font-size: 15px; }\n.hl-admin-signin__form input:focus { outline: none; border-color: var(--hl-accent); box-shadow: 0 0 0 3px var(--hl-accent-soft); }\n.hl-admin-signin__form button { height: 48px; border: 0; border-radius: var(--hl-radius-control); background: var(--hl-accent); color: var(--hl-on-accent); font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; }\n.hl-admin-signin__form button:hover { background: var(--hl-accent-hover); }\n.hl-admin-signin__form button:disabled { opacity: 0.6; cursor: default; }\n.hl-admin-signin__form [role=\"alert\"] { margin: 0; padding: 10px 12px; border-radius: var(--hl-radius-control); background: var(--hl-amber-bg); color: var(--hl-amber-text); border: 1px solid var(--hl-amber-border); font-size: 14px; }\n.hl-admin-signin__note { margin: 0; font-size: 12px; color: var(--hl-faint); }\n@media (max-width: 860px) {\n .hl-admin-signin { grid-template-columns: 1fr; }\n .hl-admin-signin__side { padding: 28px 24px; gap: 20px; }\n .hl-admin-signin__pitch h1 { font-size: 26px; }\n .hl-admin-signin__chips, .hl-admin-signin__foot { display: none; }\n}\n";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** The admin's sign-in and brand, on the theme's tokens (rendered by ThemeStyles). */
|
|
2
|
+
export const ADMIN_CSS = `
|
|
3
|
+
.hl-admin-mark { width: 34px; height: 34px; flex: none; border-radius: 9px; background: var(--hl-accent); color: var(--hl-on-accent); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; }
|
|
4
|
+
.hl-admin-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
|
|
5
|
+
.hl-admin-brand__name { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
|
|
6
|
+
.hl-admin-brand__name strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
7
|
+
.hl-admin-brand__name span { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.7; }
|
|
8
|
+
.hl-admin-env { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 4px 9px; border-radius: 999px; }
|
|
9
|
+
.hl-admin-env[data-env="production"] { background: var(--hl-amber-bg); color: var(--hl-amber-text); border: 1px solid var(--hl-amber-border); }
|
|
10
|
+
.hl-admin-env[data-env="dev"], .hl-admin-env[data-env="staging"], .hl-admin-env[data-env="local"] { background: var(--hl-accent-soft); color: var(--hl-accent-text); }
|
|
11
|
+
.hl-admin-signin { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 520px) 1fr; background: var(--hl-ground); color: var(--hl-text); font-family: var(--hl-font); }
|
|
12
|
+
.hl-admin-signin__side { background: var(--hl-panel); color: var(--hl-panel-text); padding: 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
|
|
13
|
+
.hl-admin-signin__side .hl-admin-brand__name span { color: var(--hl-panel-muted); opacity: 1; }
|
|
14
|
+
.hl-admin-signin__pitch h1 { margin: 0 0 16px; font-size: 38px; line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; }
|
|
15
|
+
.hl-admin-signin__pitch p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--hl-panel-soft); max-width: 380px; }
|
|
16
|
+
.hl-admin-signin__chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; padding: 0; list-style: none; }
|
|
17
|
+
.hl-admin-signin__chips li { font-size: 12px; padding: 6px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); color: var(--hl-panel-soft); }
|
|
18
|
+
.hl-admin-signin__foot { font-size: 12px; color: var(--hl-panel-muted); }
|
|
19
|
+
.hl-admin-signin__main { display: flex; align-items: center; justify-content: center; padding: 56px 24px; }
|
|
20
|
+
.hl-admin-signin__form { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 18px; }
|
|
21
|
+
.hl-admin-signin__form h2 { margin: 0; font-size: 26px; font-weight: 700; }
|
|
22
|
+
.hl-admin-signin__form > p { margin: -10px 0 0; color: var(--hl-muted); font-size: 14px; }
|
|
23
|
+
.hl-admin-signin__form label { display: flex; flex-direction: column; gap: 8px; font-size: 13px; font-weight: 600; }
|
|
24
|
+
.hl-admin-signin__form input { height: 46px; box-sizing: border-box; padding: 0 14px; border-radius: var(--hl-radius-control); border: 1px solid var(--hl-border); background: var(--hl-surface); color: var(--hl-text); font: inherit; font-size: 15px; }
|
|
25
|
+
.hl-admin-signin__form input:focus { outline: none; border-color: var(--hl-accent); box-shadow: 0 0 0 3px var(--hl-accent-soft); }
|
|
26
|
+
.hl-admin-signin__form button { height: 48px; border: 0; border-radius: var(--hl-radius-control); background: var(--hl-accent); color: var(--hl-on-accent); font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; }
|
|
27
|
+
.hl-admin-signin__form button:hover { background: var(--hl-accent-hover); }
|
|
28
|
+
.hl-admin-signin__form button:disabled { opacity: 0.6; cursor: default; }
|
|
29
|
+
.hl-admin-signin__form [role="alert"] { margin: 0; padding: 10px 12px; border-radius: var(--hl-radius-control); background: var(--hl-amber-bg); color: var(--hl-amber-text); border: 1px solid var(--hl-amber-border); font-size: 14px; }
|
|
30
|
+
.hl-admin-signin__note { margin: 0; font-size: 12px; color: var(--hl-faint); }
|
|
31
|
+
@media (max-width: 860px) {
|
|
32
|
+
.hl-admin-signin { grid-template-columns: 1fr; }
|
|
33
|
+
.hl-admin-signin__side { padding: 28px 24px; gap: 20px; }
|
|
34
|
+
.hl-admin-signin__pitch h1 { font-size: 26px; }
|
|
35
|
+
.hl-admin-signin__chips, .hl-admin-signin__foot { display: none; }
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
//# sourceMappingURL=admin-css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-css.js","sourceRoot":"","sources":["../../src/admin/admin-css.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,MAAM,CAAC,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCxB,CAAC"}
|
package/dist/admin/index.d.ts
CHANGED
|
@@ -4,3 +4,5 @@ export { AnnouncementsPage } from './AnnouncementsPage.js';
|
|
|
4
4
|
export { MaintenanceOnBanner, MaintenancePage } from './MaintenancePage.js';
|
|
5
5
|
export { announcementsAdminClient, openWindowOf, refusalOf } from './announcements-client.js';
|
|
6
6
|
export type { AnnouncementsAdminClient } from './announcements-client.js';
|
|
7
|
+
export { AdminShell, AdminSignIn, EnvironmentBadge, PLATFORM_ADMIN_PATHS, environmentOf, } from './AdminShell.js';
|
|
8
|
+
export type { AdminEnvironment } from './AdminShell.js';
|
package/dist/admin/index.js
CHANGED
|
@@ -2,4 +2,5 @@ export { PlanControls } from './PlanControls.js';
|
|
|
2
2
|
export { AnnouncementsPage } from './AnnouncementsPage.js';
|
|
3
3
|
export { MaintenanceOnBanner, MaintenancePage } from './MaintenancePage.js';
|
|
4
4
|
export { announcementsAdminClient, openWindowOf, refusalOf } from './announcements-client.js';
|
|
5
|
+
export { AdminShell, AdminSignIn, EnvironmentBadge, PLATFORM_ADMIN_PATHS, environmentOf, } from './AdminShell.js';
|
|
5
6
|
//# sourceMappingURL=index.js.map
|
package/dist/admin/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAE9F,OAAO,EACL,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,GACd,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ADMIN_CSS } from '../admin/admin-css.js';
|
|
2
3
|
import { USAGE_CSS } from '../client/usage-css.js';
|
|
3
4
|
import { LAYOUT_CSS } from '../layout/layout-css.js';
|
|
4
5
|
import { LOADING_CSS } from '../loading/loading-css.js';
|
|
@@ -14,6 +15,7 @@ export function ThemeStyles({ accent }) {
|
|
|
14
15
|
USAGE_CSS +
|
|
15
16
|
NOTIFICATIONS_CSS +
|
|
16
17
|
LOADING_CSS +
|
|
17
|
-
STATUS_CSS
|
|
18
|
+
STATUS_CSS +
|
|
19
|
+
ADMIN_CSS }));
|
|
18
20
|
}
|
|
19
21
|
//# sourceMappingURL=ThemeStyles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeStyles.js","sourceRoot":"","sources":["../../src/theme/ThemeStyles.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,kFAAkF;AAClF,MAAM,UAAU,WAAW,CAAC,EAAE,MAAM,EAA2C;IAC7E,OAAO,CACL,0BACG,QAAQ,CAAC,MAAM,CAAC;YACf,SAAS;YACT,UAAU;YACV,SAAS;YACT,iBAAiB;YACjB,WAAW;YACX,UAAU,
|
|
1
|
+
{"version":3,"file":"ThemeStyles.js","sourceRoot":"","sources":["../../src/theme/ThemeStyles.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,kFAAkF;AAClF,MAAM,UAAU,WAAW,CAAC,EAAE,MAAM,EAA2C;IAC7E,OAAO,CACL,0BACG,QAAQ,CAAC,MAAM,CAAC;YACf,SAAS;YACT,UAAU;YACV,SAAS;YACT,iBAAiB;YACjB,WAAW;YACX,UAAU;YACV,SAAS,GACL,CACT,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haatlabs-core/ui",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.2",
|
|
4
4
|
"description": "React components for an app's dashboard, styled by the app.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"haatlabs",
|
|
@@ -67,12 +67,12 @@
|
|
|
67
67
|
"react-router-dom": "^7.18.4",
|
|
68
68
|
"@tanstack/react-query": "^5.104.1",
|
|
69
69
|
"zod": "^4.6.5",
|
|
70
|
-
"@haatlabs-core/
|
|
71
|
-
"@haatlabs-core/
|
|
70
|
+
"@haatlabs-core/vitest-config": "0.29.2",
|
|
71
|
+
"@haatlabs-core/tsconfig": "0.29.2"
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@haatlabs-core/
|
|
75
|
-
"@haatlabs-core/
|
|
74
|
+
"@haatlabs-core/auth-contracts": "0.29.2",
|
|
75
|
+
"@haatlabs-core/announcements-contracts": "0.29.2"
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|
|
78
78
|
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|