@treasuryspatial/viewer-ui-kit 0.1.33 → 0.1.35
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/ComposerRightRail.d.ts.map +1 -1
- package/dist/ComposerRightRail.js +2 -1
- package/dist/CustomModeSurface.d.ts +7 -1
- package/dist/CustomModeSurface.d.ts.map +1 -1
- package/dist/CustomModeSurface.js +47 -5
- package/dist/LandingShell.d.ts +11 -0
- package/dist/LandingShell.d.ts.map +1 -0
- package/dist/LandingShell.js +231 -0
- package/dist/LoginShell.d.ts +13 -0
- package/dist/LoginShell.d.ts.map +1 -0
- package/dist/LoginShell.js +114 -0
- package/dist/ManifestTopBar.d.ts +15 -0
- package/dist/ManifestTopBar.d.ts.map +1 -0
- package/dist/ManifestTopBar.js +198 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -1
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useShellPanelToggle } from '@treasuryspatial/viewer-react';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import TopBar from './TopBar.js';
|
|
6
|
+
const Brand = styled.div `
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
gap: ${(props) => (props.$variant === 'landing' ? '12px' : '8px')};
|
|
10
|
+
`;
|
|
11
|
+
const BrandCopy = styled.div `
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
min-width: 0;
|
|
15
|
+
gap: 2px;
|
|
16
|
+
`;
|
|
17
|
+
const BrandLogo = styled.img `
|
|
18
|
+
width: ${(props) => (props.$variant === 'landing' ? 'clamp(32px, 3.5vw + 12px, 64px)' : '32px')};
|
|
19
|
+
height: ${(props) => (props.$variant === 'landing' ? 'clamp(32px, 3.5vw + 12px, 64px)' : '32px')};
|
|
20
|
+
object-fit: contain;
|
|
21
|
+
`;
|
|
22
|
+
const BrandTitle = styled.div `
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: baseline;
|
|
25
|
+
flex-wrap: wrap;
|
|
26
|
+
gap: ${(props) => (props.$variant === 'landing' ? '8px' : '6px')};
|
|
27
|
+
font-size: ${(props) => (props.$variant === 'landing' ? '18px' : '18px')};
|
|
28
|
+
font-weight: 400;
|
|
29
|
+
|
|
30
|
+
@media (min-width: 640px) {
|
|
31
|
+
font-size: ${(props) => (props.$variant === 'landing' ? '20px' : '18px')};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@media (min-width: 768px) {
|
|
35
|
+
font-size: ${(props) => (props.$variant === 'landing' ? '24px' : '20px')};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@media (min-width: 1024px) {
|
|
39
|
+
font-size: ${(props) => (props.$variant === 'landing' ? '30px' : '22px')};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@media (min-width: 1280px) {
|
|
43
|
+
font-size: ${(props) => (props.$variant === 'landing' ? '36px' : '24px')};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@media (min-width: 1536px) {
|
|
47
|
+
font-size: ${(props) => (props.$variant === 'landing' ? '48px' : '28px')};
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
const BrandTenant = styled.span `
|
|
51
|
+
font-weight: 400;
|
|
52
|
+
color: var(--brand-primary);
|
|
53
|
+
white-space: nowrap;
|
|
54
|
+
`;
|
|
55
|
+
const BrandProduct = styled.span `
|
|
56
|
+
font-weight: 400;
|
|
57
|
+
color: var(--brand-text-primary);
|
|
58
|
+
white-space: nowrap;
|
|
59
|
+
`;
|
|
60
|
+
const BrandSubtitle = styled.div `
|
|
61
|
+
font-size: 11px;
|
|
62
|
+
color: var(--brand-text-secondary);
|
|
63
|
+
line-height: 1.2;
|
|
64
|
+
white-space: nowrap;
|
|
65
|
+
overflow: hidden;
|
|
66
|
+
text-overflow: ellipsis;
|
|
67
|
+
`;
|
|
68
|
+
const BrandPartnerLogos = styled.div `
|
|
69
|
+
display: flex;
|
|
70
|
+
align-items: center;
|
|
71
|
+
gap: 8px;
|
|
72
|
+
`;
|
|
73
|
+
const PartnerLogo = styled.img `
|
|
74
|
+
width: 28px;
|
|
75
|
+
height: 28px;
|
|
76
|
+
object-fit: contain;
|
|
77
|
+
`;
|
|
78
|
+
const Links = styled.nav `
|
|
79
|
+
display: flex;
|
|
80
|
+
gap: 18px;
|
|
81
|
+
align-items: center;
|
|
82
|
+
font-size: 13px;
|
|
83
|
+
`;
|
|
84
|
+
const LinkItem = styled.a `
|
|
85
|
+
color: var(--brand-text-secondary);
|
|
86
|
+
text-decoration: none;
|
|
87
|
+
font-weight: 400;
|
|
88
|
+
|
|
89
|
+
&:hover {
|
|
90
|
+
color: var(--brand-text-primary);
|
|
91
|
+
}
|
|
92
|
+
`;
|
|
93
|
+
const LogoutButton = styled.button `
|
|
94
|
+
border: none;
|
|
95
|
+
background: transparent;
|
|
96
|
+
color: var(--brand-text-secondary);
|
|
97
|
+
font-weight: 400;
|
|
98
|
+
font-size: 13px;
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
padding: 0;
|
|
101
|
+
|
|
102
|
+
&:hover {
|
|
103
|
+
color: var(--brand-text-primary);
|
|
104
|
+
}
|
|
105
|
+
`;
|
|
106
|
+
const PoweredBy = styled.a `
|
|
107
|
+
display: none;
|
|
108
|
+
align-items: center;
|
|
109
|
+
gap: 8px;
|
|
110
|
+
padding: 6px 10px;
|
|
111
|
+
border-radius: 999px;
|
|
112
|
+
border: 1px solid var(--brand-panel-border);
|
|
113
|
+
background: color-mix(in srgb, var(--brand-panel) 90%, transparent);
|
|
114
|
+
box-shadow: 0 1px 6px rgba(15, 23, 42, 0.08);
|
|
115
|
+
opacity: 0.6;
|
|
116
|
+
transition: opacity 0.2s ease;
|
|
117
|
+
color: inherit;
|
|
118
|
+
text-decoration: none;
|
|
119
|
+
|
|
120
|
+
&:hover {
|
|
121
|
+
opacity: 1;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
@media (min-width: 1024px) {
|
|
125
|
+
display: flex;
|
|
126
|
+
}
|
|
127
|
+
`;
|
|
128
|
+
const PoweredByLogo = styled.img `
|
|
129
|
+
width: 16px;
|
|
130
|
+
height: 16px;
|
|
131
|
+
object-fit: contain;
|
|
132
|
+
`;
|
|
133
|
+
const PoweredByLabel = styled.div `
|
|
134
|
+
font-size: 9px;
|
|
135
|
+
text-transform: uppercase;
|
|
136
|
+
letter-spacing: 0.12em;
|
|
137
|
+
color: var(--brand-text-secondary);
|
|
138
|
+
line-height: 1;
|
|
139
|
+
`;
|
|
140
|
+
const PoweredByTitle = styled.div `
|
|
141
|
+
font-size: 11px;
|
|
142
|
+
color: var(--brand-text-primary);
|
|
143
|
+
line-height: 1.2;
|
|
144
|
+
`;
|
|
145
|
+
const PoweredByAccent = styled.span `
|
|
146
|
+
font-weight: 600;
|
|
147
|
+
color: var(--brand-text-primary);
|
|
148
|
+
`;
|
|
149
|
+
const PanelToggleCluster = styled.div `
|
|
150
|
+
display: flex;
|
|
151
|
+
align-items: center;
|
|
152
|
+
gap: 10px;
|
|
153
|
+
`;
|
|
154
|
+
const PanelToggleText = styled.button `
|
|
155
|
+
border: none;
|
|
156
|
+
background: transparent;
|
|
157
|
+
color: var(--brand-text-secondary);
|
|
158
|
+
font-weight: 400;
|
|
159
|
+
font-size: 11px;
|
|
160
|
+
text-transform: uppercase;
|
|
161
|
+
letter-spacing: 0.12em;
|
|
162
|
+
cursor: pointer;
|
|
163
|
+
padding: 0;
|
|
164
|
+
|
|
165
|
+
&:hover {
|
|
166
|
+
color: var(--brand-text-primary);
|
|
167
|
+
}
|
|
168
|
+
`;
|
|
169
|
+
const resolvePoweredByConfig = (manifest) => {
|
|
170
|
+
const poweredBy = manifest.branding?.poweredBy;
|
|
171
|
+
return {
|
|
172
|
+
enabled: poweredBy?.enabled ??
|
|
173
|
+
(manifest.branding?.profile ? manifest.branding.profile !== 'treasury-native' : true),
|
|
174
|
+
href: poweredBy?.href ?? 'https://treasury.space',
|
|
175
|
+
logo: poweredBy?.logo ?? null,
|
|
176
|
+
kicker: poweredBy?.kicker ?? 'Powered by',
|
|
177
|
+
labelPrefix: poweredBy?.labelPrefix ?? 'Treasury',
|
|
178
|
+
labelAccent: poweredBy?.labelAccent ?? manifest.topbar.productLabel ?? 'Composer',
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
const clearCookie = (name) => {
|
|
182
|
+
document.cookie = `${name}=; max-age=0; path=/; samesite=strict`;
|
|
183
|
+
};
|
|
184
|
+
export default function ManifestTopBar({ manifest, variant = 'canvas', showPoweredBy = true, showLogout = false, showPanelToggle = false, showSubtitle = false, logoutCookieNames = ['treasury_auth_token'], logoutEndpoint = '/api/auth/logout', logoutHref = '/login', }) {
|
|
185
|
+
const { collapsed, toggle } = useShellPanelToggle();
|
|
186
|
+
const poweredBy = resolvePoweredByConfig(manifest);
|
|
187
|
+
const brandLogo = manifest.topbar.logo ?? null;
|
|
188
|
+
const brand = (_jsxs(Brand, { "$variant": variant, children: [brandLogo ? (_jsx(BrandLogo, { "$variant": variant, src: brandLogo.src, alt: brandLogo.alt })) : null, _jsxs(BrandCopy, { children: [_jsxs(BrandTitle, { "$variant": variant, children: [_jsx(BrandTenant, { children: manifest.topbar.title }), manifest.topbar.productLabel ? (_jsx(BrandProduct, { children: manifest.topbar.productLabel })) : null] }), showSubtitle && manifest.topbar.subtitle ? (_jsx(BrandSubtitle, { children: manifest.topbar.subtitle })) : null] }), manifest.topbar.subtenantLogo || manifest.topbar.secondaryLogo ? (_jsxs(BrandPartnerLogos, { children: [manifest.topbar.subtenantLogo ? (_jsx(PartnerLogo, { src: manifest.topbar.subtenantLogo.src, alt: manifest.topbar.subtenantLogo.alt })) : null, manifest.topbar.secondaryLogo ? (_jsx(PartnerLogo, { src: manifest.topbar.secondaryLogo.src, alt: manifest.topbar.secondaryLogo.alt })) : null] })) : null] }));
|
|
189
|
+
const center = showPoweredBy && poweredBy.enabled ? (_jsxs(PoweredBy, { href: poweredBy.href, target: "_blank", rel: "noreferrer", children: [poweredBy.logo ? (_jsx(PoweredByLogo, { src: poweredBy.logo.src, alt: poweredBy.logo.alt })) : null, _jsxs("div", { children: [_jsx(PoweredByLabel, { children: poweredBy.kicker }), _jsxs(PoweredByTitle, { children: [poweredBy.labelPrefix, " ", _jsx(PoweredByAccent, { children: poweredBy.labelAccent })] })] })] })) : null;
|
|
190
|
+
const actions = (_jsxs(Links, { children: [showPanelToggle ? (_jsxs(PanelToggleCluster, { children: [_jsx("button", { "aria-label": collapsed ? 'Show navigation' : 'Hide navigation', className: "collapse-toggle collapse-toggle--edge-top", onClick: toggle, type: "button", children: collapsed ? (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", children: _jsx("path", { fillRule: "evenodd", d: "M5.23 7.21a.75.75 0 011.06.02L10 10.94l3.71-3.71a.75.75 0 111.06 1.06l-4.24 4.24a.75.75 0 01-1.06 0L5.25 8.27a.75.75 0 01-.02-1.06z", clipRule: "evenodd" }) })) : (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", children: _jsx("path", { fillRule: "evenodd", d: "M5.23 12.79a.75.75 0 001.06-.02L10 9.06l3.71 3.71a.75.75 0 001.06-1.06L10.53 7.47a.75.75 0 00-1.06 0L4.23 11.75a.75.75 0 001 1.04z", clipRule: "evenodd" }) })) }), _jsx(PanelToggleText, { type: "button", onClick: toggle, "aria-label": collapsed ? 'Show panels' : 'Toggle panels', children: collapsed ? 'show panels' : 'toggle panels' })] })) : null, manifest.topbar.links.map((link) => (_jsx(LinkItem, { href: link.href, target: link.target ?? '_self', rel: link.target === '_blank' ? 'noreferrer' : undefined, children: link.label }, link.label))), showLogout ? (_jsx(LogoutButton, { type: "button", onClick: () => {
|
|
191
|
+
fetch(logoutEndpoint, { method: 'POST' }).catch(() => {
|
|
192
|
+
// ignore logout sync failures
|
|
193
|
+
});
|
|
194
|
+
logoutCookieNames.forEach(clearCookie);
|
|
195
|
+
window.location.href = logoutHref;
|
|
196
|
+
}, children: "logout" })) : null] }));
|
|
197
|
+
return _jsx(TopBar, { hidden: collapsed, brand: brand, center: center, actions: actions });
|
|
198
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,12 @@ export type { PromptPackChooserMode, PromptPackChooserCatalogEntry } from './Pro
|
|
|
19
19
|
export { default as KitPill } from './KitPill.js';
|
|
20
20
|
export { default as TopBar } from './TopBar.js';
|
|
21
21
|
export type { TopBarProps } from './TopBar.js';
|
|
22
|
+
export { default as ManifestTopBar } from './ManifestTopBar.js';
|
|
23
|
+
export type { ManifestTopBarProps } from './ManifestTopBar.js';
|
|
24
|
+
export { default as LoginShell } from './LoginShell.js';
|
|
25
|
+
export type { LoginShellProps } from './LoginShell.js';
|
|
26
|
+
export { default as LandingShell } from './LandingShell.js';
|
|
27
|
+
export type { LandingShellProps } from './LandingShell.js';
|
|
22
28
|
export { default as CustomModeSurface } from './CustomModeSurface.js';
|
|
23
29
|
export { default as ModeBar, MODE_BAR_HEIGHT_PX } from './ModeBar.js';
|
|
24
30
|
export type { ModeBarProps, ModeTab } from './ModeBar.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACtD,YAAY,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;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,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,YAAY,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACxD,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC5D,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACtE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -12,5 +12,8 @@ export { default as ModuleSelectorPanel } from './ModuleSelectorPanel.js';
|
|
|
12
12
|
export { default as PromptPackChooserPanel } from './PromptPackChooserPanel.js';
|
|
13
13
|
export { default as KitPill } from './KitPill.js';
|
|
14
14
|
export { default as TopBar } from './TopBar.js';
|
|
15
|
+
export { default as ManifestTopBar } from './ManifestTopBar.js';
|
|
16
|
+
export { default as LoginShell } from './LoginShell.js';
|
|
17
|
+
export { default as LandingShell } from './LandingShell.js';
|
|
15
18
|
export { default as CustomModeSurface } from './CustomModeSurface.js';
|
|
16
19
|
export { default as ModeBar, MODE_BAR_HEIGHT_PX } from './ModeBar.js';
|