@unisim/sdk 0.2.0 → 0.3.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/dist/KnowledgeBaseMenu.d.ts +28 -0
- package/dist/KnowledgeBaseMenu.d.ts.map +1 -0
- package/dist/KnowledgeBaseMenu.js +160 -0
- package/dist/KnowledgeBaseMenu.js.map +1 -0
- package/dist/SettingsMenu.d.ts +26 -0
- package/dist/SettingsMenu.d.ts.map +1 -0
- package/dist/SettingsMenu.js +130 -0
- package/dist/SettingsMenu.js.map +1 -0
- package/dist/UniversalNavBar.d.ts +53 -0
- package/dist/UniversalNavBar.d.ts.map +1 -0
- package/dist/UniversalNavBar.js +87 -0
- package/dist/UniversalNavBar.js.map +1 -0
- package/dist/UserProfile.d.ts +21 -0
- package/dist/UserProfile.d.ts.map +1 -0
- package/dist/UserProfile.js +165 -0
- package/dist/UserProfile.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/package.json +61 -61
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type CSSProperties } from 'react';
|
|
2
|
+
export interface KnowledgeBaseItem {
|
|
3
|
+
id: string;
|
|
4
|
+
/** Short identifier shown as a coloured chip, e.g. "REBA" or "FW". */
|
|
5
|
+
name: string;
|
|
6
|
+
/** Full descriptive name shown alongside the chip. */
|
|
7
|
+
fullName?: string;
|
|
8
|
+
/** Where the item links to (relative to the current product's basePath). */
|
|
9
|
+
href: string;
|
|
10
|
+
/** Optional Tailwind-style colour name for the chip (blue, indigo, teal, …). */
|
|
11
|
+
color?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface KnowledgeBaseMenuProps {
|
|
14
|
+
/** Items in the "Product Knowledge" section. Empty array shows an empty state. */
|
|
15
|
+
productItems?: KnowledgeBaseItem[];
|
|
16
|
+
/** "View all" link for the product KB landing page. */
|
|
17
|
+
productKBHref?: string;
|
|
18
|
+
/** Label for the product knowledge section header. Defaults to "Product Knowledge". */
|
|
19
|
+
productLabel?: string;
|
|
20
|
+
/** Items in the "Company Knowledge" section. Empty / undefined shows "Coming soon" state. */
|
|
21
|
+
companyItems?: KnowledgeBaseItem[];
|
|
22
|
+
/** Trigger className — typically Tailwind classes from the host nav. */
|
|
23
|
+
triggerClassName?: string;
|
|
24
|
+
style?: CSSProperties;
|
|
25
|
+
className?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function KnowledgeBaseMenu({ productItems, productKBHref, productLabel, companyItems, triggerClassName, style, className, }: KnowledgeBaseMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
//# sourceMappingURL=KnowledgeBaseMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KnowledgeBaseMenu.d.ts","sourceRoot":"","sources":["../src/KnowledgeBaseMenu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,aAAa,EAEnB,MAAM,OAAO,CAAA;AAMd,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAS,MAAM,CAAA;IACjB,sEAAsE;IACtE,IAAI,EAAO,MAAM,CAAA;IACjB,sDAAsD;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,4EAA4E;IAC5E,IAAI,EAAO,MAAM,CAAA;IACjB,gFAAgF;IAChF,KAAK,CAAC,EAAK,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,sBAAsB;IACrC,kFAAkF;IAClF,YAAY,CAAC,EAAK,iBAAiB,EAAE,CAAA;IACrC,uDAAuD;IACvD,aAAa,CAAC,EAAI,MAAM,CAAA;IACxB,uFAAuF;IACvF,YAAY,CAAC,EAAK,MAAM,CAAA;IACxB,6FAA6F;IAC7F,YAAY,CAAC,EAAK,iBAAiB,EAAE,CAAA;IACrC,wEAAwE;IACxE,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,KAAK,CAAC,EAAY,aAAa,CAAA;IAC/B,SAAS,CAAC,EAAQ,MAAM,CAAA;CACzB;AA2BD,wBAAgB,iBAAiB,CAAC,EAChC,YAAY,EACZ,aAAa,EACb,YAAqC,EACrC,YAAY,EACZ,gBAAgB,EAChB,KAAK,EACL,SAAS,GACV,EAAE,sBAAsB,2CAqFxB"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useRef, useEffect, } from 'react';
|
|
4
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
5
|
+
// Chip colour map — mirrors the per-method colouring used in Ergo's KB.
|
|
6
|
+
// Resolved as flat hex so the component has no Tailwind dependency.
|
|
7
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
8
|
+
const COLOUR_HEX = {
|
|
9
|
+
blue: '#2563eb',
|
|
10
|
+
indigo: '#4f46e5',
|
|
11
|
+
teal: '#0d9488',
|
|
12
|
+
orange: '#c2410c',
|
|
13
|
+
yellow: '#ca8a04',
|
|
14
|
+
cyan: '#0891b2',
|
|
15
|
+
pink: '#db2777',
|
|
16
|
+
violet: '#7c3aed',
|
|
17
|
+
red: '#dc2626',
|
|
18
|
+
amber: '#d97706',
|
|
19
|
+
green: '#16a34a',
|
|
20
|
+
rose: '#e11d48',
|
|
21
|
+
slate: '#475569',
|
|
22
|
+
};
|
|
23
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
24
|
+
// Component
|
|
25
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
26
|
+
export function KnowledgeBaseMenu({ productItems, productKBHref, productLabel = 'Product Knowledge', companyItems, triggerClassName, style, className, }) {
|
|
27
|
+
const [open, setOpen] = useState(false);
|
|
28
|
+
const wrapRef = useRef(null);
|
|
29
|
+
const closeTimer = useRef(null);
|
|
30
|
+
function openNow() {
|
|
31
|
+
if (closeTimer.current)
|
|
32
|
+
clearTimeout(closeTimer.current);
|
|
33
|
+
setOpen(true);
|
|
34
|
+
}
|
|
35
|
+
function closeSoon() {
|
|
36
|
+
if (closeTimer.current)
|
|
37
|
+
clearTimeout(closeTimer.current);
|
|
38
|
+
closeTimer.current = setTimeout(() => setOpen(false), 220);
|
|
39
|
+
}
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
function onDown(e) {
|
|
42
|
+
if (wrapRef.current && !wrapRef.current.contains(e.target))
|
|
43
|
+
setOpen(false);
|
|
44
|
+
}
|
|
45
|
+
function onKey(e) {
|
|
46
|
+
if (e.key === 'Escape')
|
|
47
|
+
setOpen(false);
|
|
48
|
+
}
|
|
49
|
+
document.addEventListener('mousedown', onDown);
|
|
50
|
+
document.addEventListener('keydown', onKey);
|
|
51
|
+
return () => {
|
|
52
|
+
document.removeEventListener('mousedown', onDown);
|
|
53
|
+
document.removeEventListener('keydown', onKey);
|
|
54
|
+
};
|
|
55
|
+
}, []);
|
|
56
|
+
const hasProductItems = productItems && productItems.length > 0;
|
|
57
|
+
const hasCompanyItems = companyItems && companyItems.length > 0;
|
|
58
|
+
return (_jsxs("div", { ref: wrapRef, className: className, style: { position: 'relative', display: 'inline-block', ...style }, onMouseEnter: openNow, onMouseLeave: closeSoon, children: [_jsxs("button", { type: "button", "aria-label": "Knowledge Base", "aria-expanded": open, "aria-haspopup": "true", onClick: () => setOpen((v) => !v), onFocus: openNow, className: triggerClassName, style: triggerClassName ? undefined : defaultTriggerStyle, children: ["Knowledge Base", _jsx(IconChevron, {})] }), _jsxs("div", { role: "menu", style: menuStyle(open), children: [_jsx(SectionHeader, { label: productLabel }), hasProductItems ? (_jsxs(_Fragment, { children: [_jsx("div", { style: listStyle, children: productItems.map((item) => (_jsx(KBLink, { item: item }, item.id))) }), productKBHref && _jsx(SeeAllRow, { href: productKBHref })] })) : (_jsx(EmptyState, { text: "No articles yet." })), _jsx(Divider, {}), _jsx(SectionHeader, { label: "Company Knowledge" }), hasCompanyItems ? (_jsx("div", { style: listStyle, children: companyItems.map((item) => (_jsx(KBLink, { item: item }, item.id))) })) : (_jsx(EmptyState, { text: "Company Knowledge \u2014 coming soon." }))] })] }));
|
|
59
|
+
}
|
|
60
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
61
|
+
// Subcomponents
|
|
62
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
63
|
+
function KBLink({ item }) {
|
|
64
|
+
const chipColour = item.color ? COLOUR_HEX[item.color] : COLOUR_HEX.slate;
|
|
65
|
+
return (_jsxs("a", { role: "menuitem", href: item.href, style: kbLinkStyle, onMouseEnter: (e) => { e.currentTarget.style.background = '#f8fafc'; }, onMouseLeave: (e) => { e.currentTarget.style.background = 'transparent'; }, children: [_jsx("span", { style: {
|
|
66
|
+
flexShrink: 0,
|
|
67
|
+
fontSize: 10,
|
|
68
|
+
fontWeight: 700,
|
|
69
|
+
color: chipColour ?? '#475569',
|
|
70
|
+
width: 50,
|
|
71
|
+
letterSpacing: '0.02em',
|
|
72
|
+
}, children: item.name }), _jsx("span", { style: { fontSize: 12, color: '#475569', flex: 1, minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }, children: item.fullName ?? item.name })] }));
|
|
73
|
+
}
|
|
74
|
+
function SectionHeader({ label }) {
|
|
75
|
+
return (_jsx("div", { style: sectionHeaderStyle, children: label }));
|
|
76
|
+
}
|
|
77
|
+
function EmptyState({ text }) {
|
|
78
|
+
return (_jsx("div", { style: emptyStateStyle, children: text }));
|
|
79
|
+
}
|
|
80
|
+
function SeeAllRow({ href }) {
|
|
81
|
+
return (_jsx("div", { style: seeAllRowStyle, children: _jsxs("a", { href: href, style: { fontSize: 11, color: '#c2410c', fontWeight: 600, textDecoration: 'none', display: 'inline-flex', alignItems: 'center', gap: 4 }, children: ["View all", _jsx("span", { "aria-hidden": true, children: "\u2192" })] }) }));
|
|
82
|
+
}
|
|
83
|
+
function Divider() {
|
|
84
|
+
return _jsx("div", { style: { height: 1, background: '#e5e7eb', margin: '4px 0' }, "aria-hidden": true });
|
|
85
|
+
}
|
|
86
|
+
function IconChevron() {
|
|
87
|
+
return (_jsx("svg", { width: "10", height: "10", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", style: { marginTop: 1 }, "aria-hidden": true, children: _jsx("path", { d: "M6 9l6 6 6-6" }) }));
|
|
88
|
+
}
|
|
89
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
90
|
+
// Styles
|
|
91
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
92
|
+
const defaultTriggerStyle = {
|
|
93
|
+
display: 'inline-flex',
|
|
94
|
+
alignItems: 'center',
|
|
95
|
+
gap: 4,
|
|
96
|
+
fontSize: 14,
|
|
97
|
+
color: 'inherit',
|
|
98
|
+
background: 'transparent',
|
|
99
|
+
border: 0,
|
|
100
|
+
padding: 0,
|
|
101
|
+
cursor: 'pointer',
|
|
102
|
+
fontFamily: 'inherit',
|
|
103
|
+
};
|
|
104
|
+
function menuStyle(open) {
|
|
105
|
+
return {
|
|
106
|
+
position: 'absolute',
|
|
107
|
+
left: 0,
|
|
108
|
+
top: 'calc(100% + 8px)',
|
|
109
|
+
minWidth: 280,
|
|
110
|
+
background: '#ffffff',
|
|
111
|
+
border: '1px solid #e5e7eb',
|
|
112
|
+
borderRadius: 12,
|
|
113
|
+
boxShadow: '0 16px 32px -8px rgba(15,23,42,0.16), 0 4px 8px -2px rgba(15,23,42,0.08)',
|
|
114
|
+
padding: '6px 0',
|
|
115
|
+
opacity: open ? 1 : 0,
|
|
116
|
+
visibility: open ? 'visible' : 'hidden',
|
|
117
|
+
transform: open ? 'translateY(0)' : 'translateY(-4px)',
|
|
118
|
+
transition: 'opacity 150ms cubic-bezier(0.16,1,0.3,1), transform 150ms cubic-bezier(0.16,1,0.3,1), visibility 150ms',
|
|
119
|
+
zIndex: 50,
|
|
120
|
+
color: '#111827',
|
|
121
|
+
maxHeight: '70vh',
|
|
122
|
+
overflowY: 'auto',
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
const sectionHeaderStyle = {
|
|
126
|
+
padding: '8px 14px 4px',
|
|
127
|
+
fontSize: 10,
|
|
128
|
+
fontWeight: 700,
|
|
129
|
+
letterSpacing: '0.08em',
|
|
130
|
+
textTransform: 'uppercase',
|
|
131
|
+
color: '#64748b',
|
|
132
|
+
};
|
|
133
|
+
const listStyle = {
|
|
134
|
+
display: 'flex',
|
|
135
|
+
flexDirection: 'column',
|
|
136
|
+
};
|
|
137
|
+
const kbLinkStyle = {
|
|
138
|
+
display: 'flex',
|
|
139
|
+
alignItems: 'center',
|
|
140
|
+
gap: 10,
|
|
141
|
+
padding: '6px 14px',
|
|
142
|
+
fontSize: 12,
|
|
143
|
+
color: '#374151',
|
|
144
|
+
background: 'transparent',
|
|
145
|
+
textDecoration: 'none',
|
|
146
|
+
fontFamily: 'inherit',
|
|
147
|
+
transition: 'background 120ms',
|
|
148
|
+
};
|
|
149
|
+
const emptyStateStyle = {
|
|
150
|
+
padding: '6px 14px 10px',
|
|
151
|
+
fontSize: 12,
|
|
152
|
+
color: '#94a3b8',
|
|
153
|
+
fontStyle: 'italic',
|
|
154
|
+
};
|
|
155
|
+
const seeAllRowStyle = {
|
|
156
|
+
padding: '8px 14px 6px',
|
|
157
|
+
borderTop: '1px solid #f1f5f9',
|
|
158
|
+
marginTop: 4,
|
|
159
|
+
};
|
|
160
|
+
//# sourceMappingURL=KnowledgeBaseMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KnowledgeBaseMenu.js","sourceRoot":"","sources":["../src/KnowledgeBaseMenu.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EACL,QAAQ,EACR,MAAM,EACN,SAAS,GAGV,MAAM,OAAO,CAAA;AAiCd,iFAAiF;AACjF,wEAAwE;AACxE,oEAAoE;AACpE,iFAAiF;AAEjF,MAAM,UAAU,GAA2B;IACzC,IAAI,EAAI,SAAS;IACjB,MAAM,EAAE,SAAS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,CAAC,CAAC,CAAC,kBAAkB;QACvD,UAAU,EAAE,wGAAwG;QACpH,MAAM,EAAM,EAAE;QACd,KAAK,EAAO,SAAS;QACrB,SAAS,EAAG,MAAM;QAClB,SAAS,EAAG,MAAM;KACnB,CAAA;AACH,CAAC;AAED,MAAM,kBAAkB,GAAkB;IACxC,OAAO,EAAQ,cAAc;IAC7B,QAAQ,EAAO,EAAE;IACjB,UAAU,EAAK,GAAG;IAClB,aAAa,EAAE,QAAQ;IACvB,aAAa,EAAE,WAAW;IAC1B,KAAK,EAAU,SAAS;CACzB,CAAA;AAED,MAAM,SAAS,GAAkB;IAC/B,OAAO,EAAQ,MAAM;IACrB,aAAa,EAAE,QAAQ;CACxB,CAAA;AAED,MAAM,WAAW,GAAkB;IACjC,OAAO,EAAS,MAAM;IACtB,UAAU,EAAM,QAAQ;IACxB,GAAG,EAAa,EAAE;IAClB,OAAO,EAAS,UAAU;IAC1B,QAAQ,EAAQ,EAAE;IAClB,KAAK,EAAW,SAAS;IACzB,UAAU,EAAM,aAAa;IAC7B,cAAc,EAAE,MAAM;IACtB,UAAU,EAAM,SAAS;IACzB,UAAU,EAAM,kBAAkB;CACnC,CAAA;AAED,MAAM,eAAe,GAAkB;IACrC,OAAO,EAAK,eAAe;IAC3B,QAAQ,EAAI,EAAE;IACd,KAAK,EAAO,SAAS;IACrB,SAAS,EAAG,QAAQ;CACrB,CAAA;AAED,MAAM,cAAc,GAAkB;IACpC,OAAO,EAAK,cAAc;IAC1B,SAAS,EAAG,mBAAmB;IAC/B,SAAS,EAAG,CAAC;CACd,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type CSSProperties, type MouseEvent, type ReactNode } from 'react';
|
|
2
|
+
export interface SettingsItem {
|
|
3
|
+
/** Display label, e.g. "Default analysis methods". */
|
|
4
|
+
label: string;
|
|
5
|
+
/** Either provide href (renders as link) or onClick (renders as button). */
|
|
6
|
+
href?: string;
|
|
7
|
+
onClick?: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
8
|
+
/** Optional small icon shown left of the label. */
|
|
9
|
+
icon?: ReactNode;
|
|
10
|
+
/** Render in red — for destructive actions like "Sign out". */
|
|
11
|
+
danger?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface SettingsMenuProps {
|
|
14
|
+
/** Items in the product-specific settings section. */
|
|
15
|
+
productItems?: SettingsItem[];
|
|
16
|
+
/** Items in the global / cross-product settings section (e.g. Theme, Language). */
|
|
17
|
+
globalItems?: SettingsItem[];
|
|
18
|
+
/** Trigger className — typically Tailwind classes from the host nav. */
|
|
19
|
+
triggerClassName?: string;
|
|
20
|
+
/** aria-label for the trigger. Defaults to "Settings". */
|
|
21
|
+
ariaLabel?: string;
|
|
22
|
+
style?: CSSProperties;
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare function SettingsMenu({ productItems, globalItems, triggerClassName, ariaLabel, style, className, }: SettingsMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
//# sourceMappingURL=SettingsMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SettingsMenu.d.ts","sourceRoot":"","sources":["../src/SettingsMenu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AAMd,MAAM,WAAW,YAAY;IAC3B,sDAAsD;IACtD,KAAK,EAAK,MAAM,CAAA;IAChB,4EAA4E;IAC5E,IAAI,CAAC,EAAK,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IACpD,mDAAmD;IACnD,IAAI,CAAC,EAAK,SAAS,CAAA;IACnB,+DAA+D;IAC/D,MAAM,CAAC,EAAG,OAAO,CAAA;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,sDAAsD;IACtD,YAAY,CAAC,EAAK,YAAY,EAAE,CAAA;IAChC,mFAAmF;IACnF,WAAW,CAAC,EAAM,YAAY,EAAE,CAAA;IAChC,wEAAwE;IACxE,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,0DAA0D;IAC1D,SAAS,CAAC,EAAQ,MAAM,CAAA;IACxB,KAAK,CAAC,EAAY,aAAa,CAAA;IAC/B,SAAS,CAAC,EAAQ,MAAM,CAAA;CACzB;AAMD,wBAAgB,YAAY,CAAC,EAC3B,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,SAAsB,EACtB,KAAK,EACL,SAAS,GACV,EAAE,iBAAiB,2CAkFnB"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useRef, useEffect, } from 'react';
|
|
4
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
5
|
+
// Component
|
|
6
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
7
|
+
export function SettingsMenu({ productItems, globalItems, triggerClassName, ariaLabel = 'Settings', style, className, }) {
|
|
8
|
+
const [open, setOpen] = useState(false);
|
|
9
|
+
const wrapRef = useRef(null);
|
|
10
|
+
const closeTimer = useRef(null);
|
|
11
|
+
function openNow() {
|
|
12
|
+
if (closeTimer.current)
|
|
13
|
+
clearTimeout(closeTimer.current);
|
|
14
|
+
setOpen(true);
|
|
15
|
+
}
|
|
16
|
+
function closeSoon() {
|
|
17
|
+
if (closeTimer.current)
|
|
18
|
+
clearTimeout(closeTimer.current);
|
|
19
|
+
closeTimer.current = setTimeout(() => setOpen(false), 220);
|
|
20
|
+
}
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
function onDown(e) {
|
|
23
|
+
if (wrapRef.current && !wrapRef.current.contains(e.target))
|
|
24
|
+
setOpen(false);
|
|
25
|
+
}
|
|
26
|
+
function onKey(e) {
|
|
27
|
+
if (e.key === 'Escape')
|
|
28
|
+
setOpen(false);
|
|
29
|
+
}
|
|
30
|
+
document.addEventListener('mousedown', onDown);
|
|
31
|
+
document.addEventListener('keydown', onKey);
|
|
32
|
+
return () => {
|
|
33
|
+
document.removeEventListener('mousedown', onDown);
|
|
34
|
+
document.removeEventListener('keydown', onKey);
|
|
35
|
+
};
|
|
36
|
+
}, []);
|
|
37
|
+
const hasProduct = productItems && productItems.length > 0;
|
|
38
|
+
const hasGlobal = globalItems && globalItems.length > 0;
|
|
39
|
+
return (_jsxs("div", { ref: wrapRef, className: className, style: { position: 'relative', display: 'inline-block', ...style }, onMouseEnter: openNow, onMouseLeave: closeSoon, children: [_jsx("button", { type: "button", "aria-label": ariaLabel, "aria-expanded": open, "aria-haspopup": "true", onClick: () => setOpen((v) => !v), onFocus: openNow, className: triggerClassName, style: triggerClassName ? undefined : defaultTriggerStyle, children: _jsx(IconGear, {}) }), _jsxs("div", { role: "menu", style: menuStyle(open), children: [hasProduct && (_jsxs(_Fragment, { children: [_jsx(SectionHeader, { label: "Product Settings" }), productItems.map((item, i) => (_jsx(Item, { item: item }, `p${i}`)))] })), hasProduct && hasGlobal && _jsx(Divider, {}), hasGlobal && (_jsxs(_Fragment, { children: [_jsx(SectionHeader, { label: "Global Settings" }), globalItems.map((item, i) => (_jsx(Item, { item: item }, `g${i}`)))] })), !hasProduct && !hasGlobal && (_jsx("div", { style: { padding: '12px 14px', fontSize: 12, color: '#94a3b8', fontStyle: 'italic' }, children: "No settings yet." }))] })] }));
|
|
40
|
+
}
|
|
41
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
42
|
+
// Subcomponents
|
|
43
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
44
|
+
function Item({ item }) {
|
|
45
|
+
const restingColor = item.danger ? '#dc2626' : '#374151';
|
|
46
|
+
const hoverColor = item.danger ? '#b91c1c' : '#111827';
|
|
47
|
+
const hoverBg = item.danger ? '#fef2f2' : '#f3f4f6';
|
|
48
|
+
const baseStyle = {
|
|
49
|
+
display: 'flex',
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
gap: 10,
|
|
52
|
+
padding: '8px 14px',
|
|
53
|
+
fontSize: 13,
|
|
54
|
+
color: restingColor,
|
|
55
|
+
background: 'transparent',
|
|
56
|
+
border: 0,
|
|
57
|
+
cursor: 'pointer',
|
|
58
|
+
width: '100%',
|
|
59
|
+
textAlign: 'left',
|
|
60
|
+
textDecoration: 'none',
|
|
61
|
+
fontFamily: 'inherit',
|
|
62
|
+
transition: 'background 120ms, color 120ms',
|
|
63
|
+
};
|
|
64
|
+
const onEnter = (e) => {
|
|
65
|
+
e.currentTarget.style.background = hoverBg;
|
|
66
|
+
e.currentTarget.style.color = hoverColor;
|
|
67
|
+
};
|
|
68
|
+
const onLeave = (e) => {
|
|
69
|
+
e.currentTarget.style.background = 'transparent';
|
|
70
|
+
e.currentTarget.style.color = restingColor;
|
|
71
|
+
};
|
|
72
|
+
if (item.onClick) {
|
|
73
|
+
return (_jsxs("button", { type: "button", role: "menuitem", onClick: item.onClick, onMouseEnter: onEnter, onMouseLeave: onLeave, style: baseStyle, children: [item.icon, item.label] }));
|
|
74
|
+
}
|
|
75
|
+
return (_jsxs("a", { role: "menuitem", href: item.href, onMouseEnter: onEnter, onMouseLeave: onLeave, style: baseStyle, children: [item.icon, item.label] }));
|
|
76
|
+
}
|
|
77
|
+
function SectionHeader({ label }) {
|
|
78
|
+
return _jsx("div", { style: sectionHeaderStyle, children: label });
|
|
79
|
+
}
|
|
80
|
+
function Divider() {
|
|
81
|
+
return _jsx("div", { style: { height: 1, background: '#e5e7eb', margin: '4px 0' }, "aria-hidden": true });
|
|
82
|
+
}
|
|
83
|
+
function IconGear() {
|
|
84
|
+
return (_jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [_jsx("circle", { cx: "12", cy: "12", r: "3" }), _jsx("path", { d: "M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 010 2.83 2 2 0 01-2.83 0l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 01-4 0v-.09A1.65 1.65 0 009 19.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 01-2.83-2.83l.06-.06A1.65 1.65 0 004.68 15a1.65 1.65 0 00-1.51-1H3a2 2 0 010-4h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 012.83-2.83l.06.06A1.65 1.65 0 009 4.68a1.65 1.65 0 001-1.51V3a2 2 0 014 0v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 012.83 2.83l-.06.06A1.65 1.65 0 0019.4 9a1.65 1.65 0 001.51 1H21a2 2 0 010 4h-.09a1.65 1.65 0 00-1.51 1z" })] }));
|
|
85
|
+
}
|
|
86
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
87
|
+
// Styles
|
|
88
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
89
|
+
const defaultTriggerStyle = {
|
|
90
|
+
display: 'inline-flex',
|
|
91
|
+
alignItems: 'center',
|
|
92
|
+
justifyContent: 'center',
|
|
93
|
+
width: 32,
|
|
94
|
+
height: 32,
|
|
95
|
+
borderRadius: 8,
|
|
96
|
+
border: 0,
|
|
97
|
+
background: 'transparent',
|
|
98
|
+
color: '#64748b',
|
|
99
|
+
cursor: 'pointer',
|
|
100
|
+
padding: 0,
|
|
101
|
+
transition: 'background 120ms, color 120ms',
|
|
102
|
+
};
|
|
103
|
+
function menuStyle(open) {
|
|
104
|
+
return {
|
|
105
|
+
position: 'absolute',
|
|
106
|
+
right: 0,
|
|
107
|
+
top: 'calc(100% + 8px)',
|
|
108
|
+
minWidth: 220,
|
|
109
|
+
background: '#ffffff',
|
|
110
|
+
border: '1px solid #e5e7eb',
|
|
111
|
+
borderRadius: 12,
|
|
112
|
+
boxShadow: '0 16px 32px -8px rgba(15,23,42,0.16), 0 4px 8px -2px rgba(15,23,42,0.08)',
|
|
113
|
+
padding: '6px 0',
|
|
114
|
+
opacity: open ? 1 : 0,
|
|
115
|
+
visibility: open ? 'visible' : 'hidden',
|
|
116
|
+
transform: open ? 'translateY(0)' : 'translateY(-4px)',
|
|
117
|
+
transition: 'opacity 150ms cubic-bezier(0.16,1,0.3,1), transform 150ms cubic-bezier(0.16,1,0.3,1), visibility 150ms',
|
|
118
|
+
zIndex: 50,
|
|
119
|
+
color: '#111827',
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
const sectionHeaderStyle = {
|
|
123
|
+
padding: '8px 14px 4px',
|
|
124
|
+
fontSize: 10,
|
|
125
|
+
fontWeight: 700,
|
|
126
|
+
letterSpacing: '0.08em',
|
|
127
|
+
textTransform: 'uppercase',
|
|
128
|
+
color: '#64748b',
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=SettingsMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SettingsMenu.js","sourceRoot":"","sources":["../src/SettingsMenu.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EACL,QAAQ,EACR,MAAM,EACN,SAAS,GAIV,MAAM,OAAO,CAAA;AA+Bd,iFAAiF;AACjF,YAAY;AACZ,iFAAiF;AAEjF,MAAM,UAAU,YAAY,CAAC,EAC3B,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,SAAS,GAAG,UAAU,EACtB,KAAK,EACL,SAAS,GACS;IAClB,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IACvC,MAAM,OAAO,GAAM,MAAM,CAAiB,IAAI,CAAC,CAAA;IAC/C,MAAM,UAAU,GAAG,MAAM,CAAuC,IAAI,CAAC,CAAA;IAErE,SAAS,OAAO;QACd,IAAI,UAAU,CAAC,OAAO;YAAE,YAAY,CAAC,UAAU,CAAC,OAAO,CA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;IAClB,MAAM,EAAU,EAAE;IAClB,YAAY,EAAI,CAAC;IACjB,MAAM,EAAU,CAAC;IACjB,UAAU,EAAM,aAAa;IAC7B,KAAK,EAAW,SAAS;IACzB,MAAM,EAAU,SAAS;IACzB,OAAO,EAAS,CAAC;IACjB,UAAU,EAAM,+BAA+B;CAChD,CAAA;AAED,SAAS,SAAS,CAAC,IAAa;IAC9B,OAAO;QACL,QAAQ,EAAI,UAAU;QACtB,KAAK,EAAO,CAAC;QACb,GAAG,EAAS,kBAAkB;QAC9B,QAAQ,EAAI,GAAG;QACf,UAAU,EAAE,SAAS;QACrB,MAAM,EAAM,mBAAmB;QAC/B,YAAY,EAAE,EAAE;QAChB,SAAS,EAAG,0EAA0E;QACtF,OAAO,EAAK,OAAO;QACnB,OAAO,EAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxB,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;QACvC,SAAS,EAAG,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,kBAAkB;QACvD,UAAU,EAAE,wGAAwG;QACpH,MAAM,EAAM,EAAE;QACd,KAAK,EAAO,SAAS;KACtB,CAAA;AACH,CAAC;AAED,MAAM,kBAAkB,GAAkB;IACxC,OAAO,EAAQ,cAAc;IAC7B,QAAQ,EAAO,EAAE;IACjB,UAAU,EAAK,GAAG;IAClB,aAAa,EAAE,QAAQ;IACvB,aAAa,EAAE,WAAW;IAC1B,KAAK,EAAU,SAAS;CACzB,CAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
|
+
import { type SuiteProductId } from './SuiteSwitcher.js';
|
|
3
|
+
import { type KnowledgeBaseItem } from './KnowledgeBaseMenu.js';
|
|
4
|
+
import { type SettingsItem } from './SettingsMenu.js';
|
|
5
|
+
import { type UserProfileProps } from './UserProfile.js';
|
|
6
|
+
export interface UniversalNavBarProps {
|
|
7
|
+
/** Which product is currently mounting this nav. Used by SuiteSwitcher. */
|
|
8
|
+
product: SuiteProductId;
|
|
9
|
+
/** Element shown on the far left — typically the product wordmark/logo. */
|
|
10
|
+
productLogo: ReactNode;
|
|
11
|
+
/** Override the dynamic org-name label. When unset, reads from useOrg(). */
|
|
12
|
+
companyLabel?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Href for "New Assessment". Standardised to "/new" across the suite.
|
|
15
|
+
* Pass null/undefined to hide the link on a product that doesn't support it yet.
|
|
16
|
+
*/
|
|
17
|
+
newAssessmentHref?: string | null;
|
|
18
|
+
/** Knowledge base content (per-product items + future company-knowledge slot). */
|
|
19
|
+
knowledgeBase?: {
|
|
20
|
+
productItems?: KnowledgeBaseItem[];
|
|
21
|
+
productKBHref?: string;
|
|
22
|
+
productLabel?: string;
|
|
23
|
+
companyItems?: KnowledgeBaseItem[];
|
|
24
|
+
};
|
|
25
|
+
/** Product-specific items for the gear-icon dropdown. */
|
|
26
|
+
productSettings?: SettingsItem[];
|
|
27
|
+
/** Global / cross-product items (Theme, Language, etc.). */
|
|
28
|
+
globalSettings?: SettingsItem[];
|
|
29
|
+
/** User profile data for the avatar dropdown. */
|
|
30
|
+
user?: UserProfileProps;
|
|
31
|
+
/** A small chip rendered inside the SuiteSwitcher — typically <VersionChip />. */
|
|
32
|
+
versionChip?: ReactNode;
|
|
33
|
+
/** Trigger icon for the SuiteSwitcher. Defaults to the inline UNISIM monogram. */
|
|
34
|
+
suiteSwitcherIconSrc?: string;
|
|
35
|
+
/** Top brand strip — pass false to hide. Default: shown. */
|
|
36
|
+
showBrandStrip?: boolean;
|
|
37
|
+
className?: string;
|
|
38
|
+
style?: CSSProperties;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The Universal Suite navigation bar — single source of truth for the header
|
|
42
|
+
* layout across every Assess product. Each product mounts this once and the
|
|
43
|
+
* suite-wide visual identity (gradient strip, suite switcher, my-company menu,
|
|
44
|
+
* brand-coloured profile avatar) propagates automatically on the next SDK bump.
|
|
45
|
+
*
|
|
46
|
+
* Layout (left → right):
|
|
47
|
+
* [Brand strip]
|
|
48
|
+
* ┌──────────────────────────────────────────────────────────────────────┐
|
|
49
|
+
* │ [Logo] for [Org] New Assessment · KB · My Company · ⚙ · 👤 · ⊞ │
|
|
50
|
+
* └──────────────────────────────────────────────────────────────────────┘
|
|
51
|
+
*/
|
|
52
|
+
export declare function UniversalNavBar({ product, productLogo, companyLabel, newAssessmentHref, knowledgeBase, productSettings, globalSettings, user, versionChip, suiteSwitcherIconSrc, showBrandStrip, className, style, }: UniversalNavBarProps): import("react/jsx-runtime").JSX.Element;
|
|
53
|
+
//# sourceMappingURL=UniversalNavBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UniversalNavBar.d.ts","sourceRoot":"","sources":["../src/UniversalNavBar.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAE1D,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEvE,OAAO,EAAqB,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAClF,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACnE,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAOrE,MAAM,WAAW,oBAAoB;IAEnC,2EAA2E;IAC3E,OAAO,EAAE,cAAc,CAAA;IACvB,2EAA2E;IAC3E,WAAW,EAAE,SAAS,CAAA;IAGtB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,CAAA;IAGrB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAEjC,kFAAkF;IAClF,aAAa,CAAC,EAAE;QACd,YAAY,CAAC,EAAG,iBAAiB,EAAE,CAAA;QACnC,aAAa,CAAC,EAAE,MAAM,CAAA;QACtB,YAAY,CAAC,EAAG,MAAM,CAAA;QACtB,YAAY,CAAC,EAAG,iBAAiB,EAAE,CAAA;KACpC,CAAA;IAGD,yDAAyD;IACzD,eAAe,CAAC,EAAE,YAAY,EAAE,CAAA;IAChC,4DAA4D;IAC5D,cAAc,CAAC,EAAG,YAAY,EAAE,CAAA;IAEhC,iDAAiD;IACjD,IAAI,CAAC,EAAE,gBAAgB,CAAA;IAEvB,kFAAkF;IAClF,WAAW,CAAC,EAAE,SAAS,CAAA;IAEvB,kFAAkF;IAClF,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAE7B,4DAA4D;IAC5D,cAAc,CAAC,EAAE,OAAO,CAAA;IAGxB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAM,aAAa,CAAA;CAC1B;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,EAC9B,OAAO,EACP,WAAW,EACX,YAAY,EACZ,iBAA0B,EAC1B,aAAa,EACb,eAAe,EACf,cAAc,EACd,IAAI,EACJ,WAAW,EACX,oBAAoB,EACpB,cAAqB,EACrB,SAAS,EACT,KAAK,GACN,EAAE,oBAAoB,2CAiDtB"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { CompanyMenu } from './CompanyMenu.js';
|
|
4
|
+
import { SuiteSwitcher } from './SuiteSwitcher.js';
|
|
5
|
+
import { UniversalBar } from './UniversalBar.js';
|
|
6
|
+
import { KnowledgeBaseMenu } from './KnowledgeBaseMenu.js';
|
|
7
|
+
import { SettingsMenu } from './SettingsMenu.js';
|
|
8
|
+
import { UserProfile } from './UserProfile.js';
|
|
9
|
+
import { useOrg } from './auth.js';
|
|
10
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
11
|
+
// Component
|
|
12
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
13
|
+
/**
|
|
14
|
+
* The Universal Suite navigation bar — single source of truth for the header
|
|
15
|
+
* layout across every Assess product. Each product mounts this once and the
|
|
16
|
+
* suite-wide visual identity (gradient strip, suite switcher, my-company menu,
|
|
17
|
+
* brand-coloured profile avatar) propagates automatically on the next SDK bump.
|
|
18
|
+
*
|
|
19
|
+
* Layout (left → right):
|
|
20
|
+
* [Brand strip]
|
|
21
|
+
* ┌──────────────────────────────────────────────────────────────────────┐
|
|
22
|
+
* │ [Logo] for [Org] New Assessment · KB · My Company · ⚙ · 👤 · ⊞ │
|
|
23
|
+
* └──────────────────────────────────────────────────────────────────────┘
|
|
24
|
+
*/
|
|
25
|
+
export function UniversalNavBar({ product, productLogo, companyLabel, newAssessmentHref = '/new', knowledgeBase, productSettings, globalSettings, user, versionChip, suiteSwitcherIconSrc, showBrandStrip = true, className, style, }) {
|
|
26
|
+
// Resolve the company-name label. Explicit prop > useOrg() > placeholder.
|
|
27
|
+
const { org } = useOrg();
|
|
28
|
+
const resolvedCompany = companyLabel ?? org?.name ?? 'Your Company';
|
|
29
|
+
return (_jsxs("div", { className: className, style: style, children: [showBrandStrip && _jsx(UniversalBar, {}), _jsxs("header", { style: headerStyle, children: [_jsxs("div", { style: leftStyle, children: [_jsx("div", { style: { display: 'inline-flex', alignItems: 'center' }, children: productLogo }), _jsx("span", { style: separatorStyle, "aria-hidden": true, children: "\u00B7" }), _jsxs("span", { style: companyLabelStyle, children: [_jsx("span", { style: { color: '#94a3b8', marginRight: 4 }, children: "for" }), _jsx("span", { style: { color: org?.name ? '#0f172a' : '#94a3b8' }, children: resolvedCompany })] })] }), _jsxs("nav", { style: centreStyle, "aria-label": "Primary", children: [newAssessmentHref && (_jsx("a", { href: newAssessmentHref, style: linkStyle, children: "New Assessment" })), knowledgeBase && (_jsx(KnowledgeBaseMenu, { productItems: knowledgeBase.productItems, productKBHref: knowledgeBase.productKBHref, productLabel: knowledgeBase.productLabel, companyItems: knowledgeBase.companyItems })), _jsx(CompanyMenu, {})] }), _jsxs("div", { style: rightStyle, children: [_jsx(SettingsMenu, { productItems: productSettings, globalItems: globalSettings }), user && _jsx(UserProfile, { ...user }), _jsx(SuiteSwitcher, { current: product, iconSrc: suiteSwitcherIconSrc, chip: versionChip })] })] })] }));
|
|
30
|
+
}
|
|
31
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
32
|
+
// Styles
|
|
33
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
34
|
+
const headerStyle = {
|
|
35
|
+
display: 'flex',
|
|
36
|
+
alignItems: 'center',
|
|
37
|
+
justifyContent: 'space-between',
|
|
38
|
+
gap: 16,
|
|
39
|
+
padding: '10px 20px',
|
|
40
|
+
background: '#ffffff',
|
|
41
|
+
borderBottom: '1px solid #e2e8f0',
|
|
42
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif",
|
|
43
|
+
color: '#0f172a',
|
|
44
|
+
minHeight: 56,
|
|
45
|
+
boxSizing: 'border-box',
|
|
46
|
+
};
|
|
47
|
+
const leftStyle = {
|
|
48
|
+
display: 'inline-flex',
|
|
49
|
+
alignItems: 'center',
|
|
50
|
+
gap: 10,
|
|
51
|
+
minWidth: 0,
|
|
52
|
+
flexShrink: 0,
|
|
53
|
+
};
|
|
54
|
+
const separatorStyle = {
|
|
55
|
+
color: '#cbd5e1',
|
|
56
|
+
fontSize: 12,
|
|
57
|
+
};
|
|
58
|
+
const companyLabelStyle = {
|
|
59
|
+
fontSize: 13,
|
|
60
|
+
fontWeight: 500,
|
|
61
|
+
whiteSpace: 'nowrap',
|
|
62
|
+
overflow: 'hidden',
|
|
63
|
+
textOverflow: 'ellipsis',
|
|
64
|
+
maxWidth: 240,
|
|
65
|
+
};
|
|
66
|
+
const centreStyle = {
|
|
67
|
+
display: 'inline-flex',
|
|
68
|
+
alignItems: 'center',
|
|
69
|
+
gap: 20,
|
|
70
|
+
flex: 1,
|
|
71
|
+
marginLeft: 24,
|
|
72
|
+
minWidth: 0,
|
|
73
|
+
};
|
|
74
|
+
const linkStyle = {
|
|
75
|
+
fontSize: 14,
|
|
76
|
+
color: '#374151',
|
|
77
|
+
textDecoration: 'none',
|
|
78
|
+
fontWeight: 500,
|
|
79
|
+
transition: 'color 120ms',
|
|
80
|
+
};
|
|
81
|
+
const rightStyle = {
|
|
82
|
+
display: 'inline-flex',
|
|
83
|
+
alignItems: 'center',
|
|
84
|
+
gap: 8,
|
|
85
|
+
flexShrink: 0,
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=UniversalNavBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UniversalNavBar.js","sourceRoot":"","sources":["../src/UniversalNavBar.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAGZ,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAuB,MAAM,oBAAoB,CAAA;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,iBAAiB,EAA0B,MAAM,wBAAwB,CAAA;AAClF,OAAO,EAAE,YAAY,EAAqB,MAAM,mBAAmB,CAAA;AACnE,OAAO,EAAE,WAAW,EAAyB,MAAM,kBAAkB,CAAA;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAuDlC,iFAAiF;AACjF,YAAY;AACZ,iFAAiF;AAEjF;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,eAAe,CAAC,EAC9B,OAAO,EACP,WAAW,EACX,YAAY,EACZ,iBAAiB,GAAG,MAAM,EAC1B,aAAa,EACb,eAAe,EACf,cAAc,EACd,IAAI,EACJ,WAAW,EACX,oBAAoB,EACpB,cAAc,GAAG,IAAI,EACrB,SAAS,EACT,KAAK,GACgB;IACrB,0EAA0E;IAC1E,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,EAAE,CAAA;IACxB,MAAM,eAAe,GAAG,Y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,EAAS,CAAC;IACb,UAAU,EAAE,CAAC;CACd,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type CSSProperties, type MouseEvent } from 'react';
|
|
2
|
+
export interface UserProfileProps {
|
|
3
|
+
/** Display name. Used to derive initials if none provided. */
|
|
4
|
+
name?: string;
|
|
5
|
+
/** Email address, shown beneath the name in the dropdown. */
|
|
6
|
+
email?: string;
|
|
7
|
+
/** Profile photo URL. When present, renders as an <img>. */
|
|
8
|
+
photoUrl?: string | null;
|
|
9
|
+
/** Override the initials shown in the avatar fallback. */
|
|
10
|
+
initials?: string;
|
|
11
|
+
/** Link to the profile page. Defaults to "/profile". */
|
|
12
|
+
profileHref?: string;
|
|
13
|
+
/** Click handler for sign-out. If omitted, the sign-out item is hidden. */
|
|
14
|
+
onSignOut?: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
15
|
+
/** aria-label for the trigger. Defaults to "Profile". */
|
|
16
|
+
ariaLabel?: string;
|
|
17
|
+
style?: CSSProperties;
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function UserProfile({ name, email, photoUrl, initials, profileHref, onSignOut, ariaLabel, style, className, }: UserProfileProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
//# sourceMappingURL=UserProfile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserProfile.d.ts","sourceRoot":"","sources":["../src/UserProfile.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,UAAU,EAEhB,MAAM,OAAO,CAAA;AAMd,MAAM,WAAW,gBAAgB;IAC/B,8DAA8D;IAC9D,IAAI,CAAC,EAAM,MAAM,CAAA;IACjB,6DAA6D;IAC7D,KAAK,CAAC,EAAK,MAAM,CAAA;IACjB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,wDAAwD;IACxD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,2EAA2E;IAC3E,SAAS,CAAC,EAAI,CAAC,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IACxD,yDAAyD;IACzD,SAAS,CAAC,EAAI,MAAM,CAAA;IACpB,KAAK,CAAC,EAAQ,aAAa,CAAA;IAC3B,SAAS,CAAC,EAAI,MAAM,CAAA;CACrB;AAMD,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,WAAwB,EACxB,SAAS,EACT,SAAqB,EACrB,KAAK,EACL,SAAS,GACV,EAAE,gBAAgB,2CAsFlB"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useRef, useEffect, } from 'react';
|
|
4
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
5
|
+
// Component
|
|
6
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
7
|
+
export function UserProfile({ name, email, photoUrl, initials, profileHref = '/profile', onSignOut, ariaLabel = 'Profile', style, className, }) {
|
|
8
|
+
const [open, setOpen] = useState(false);
|
|
9
|
+
const wrapRef = useRef(null);
|
|
10
|
+
const closeTimer = useRef(null);
|
|
11
|
+
function openNow() {
|
|
12
|
+
if (closeTimer.current)
|
|
13
|
+
clearTimeout(closeTimer.current);
|
|
14
|
+
setOpen(true);
|
|
15
|
+
}
|
|
16
|
+
function closeSoon() {
|
|
17
|
+
if (closeTimer.current)
|
|
18
|
+
clearTimeout(closeTimer.current);
|
|
19
|
+
closeTimer.current = setTimeout(() => setOpen(false), 220);
|
|
20
|
+
}
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
function onDown(e) {
|
|
23
|
+
if (wrapRef.current && !wrapRef.current.contains(e.target))
|
|
24
|
+
setOpen(false);
|
|
25
|
+
}
|
|
26
|
+
function onKey(e) {
|
|
27
|
+
if (e.key === 'Escape')
|
|
28
|
+
setOpen(false);
|
|
29
|
+
}
|
|
30
|
+
document.addEventListener('mousedown', onDown);
|
|
31
|
+
document.addEventListener('keydown', onKey);
|
|
32
|
+
return () => {
|
|
33
|
+
document.removeEventListener('mousedown', onDown);
|
|
34
|
+
document.removeEventListener('keydown', onKey);
|
|
35
|
+
};
|
|
36
|
+
}, []);
|
|
37
|
+
// Derive initials when not explicitly passed in.
|
|
38
|
+
const derivedInitials = initials ?? deriveInitials(name) ?? '?';
|
|
39
|
+
return (_jsxs("div", { ref: wrapRef, className: className, style: { position: 'relative', display: 'inline-block', ...style }, onMouseEnter: openNow, onMouseLeave: closeSoon, children: [_jsx("button", { type: "button", "aria-label": ariaLabel, "aria-expanded": open, "aria-haspopup": "true", onClick: () => setOpen((v) => !v), onFocus: openNow, style: triggerStyle, children: photoUrl ? (_jsx("img", { src: photoUrl, alt: "", "aria-hidden": true, style: avatarImgStyle })) : (_jsx("span", { style: avatarFallbackStyle, children: derivedInitials })) }), _jsxs("div", { role: "menu", style: menuStyle(open), children: [(name || email) && (_jsxs("div", { style: headerStyle, children: [name && _jsx("div", { style: nameStyle, children: name }), email && _jsx("div", { style: emailStyle, children: email })] })), _jsxs("a", { role: "menuitem", href: profileHref, style: itemStyle, onMouseEnter: hoverIn, onMouseLeave: hoverOut, children: [_jsx(IconUser, {}), " View profile"] }), onSignOut && (_jsxs(_Fragment, { children: [_jsx(Divider, {}), _jsxs("button", { type: "button", role: "menuitem", onClick: onSignOut, style: dangerItemStyle, onMouseEnter: dangerHoverIn, onMouseLeave: dangerHoverOut, children: [_jsx(IconLogout, {}), " Sign out"] })] }))] })] }));
|
|
40
|
+
}
|
|
41
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
42
|
+
// Helpers
|
|
43
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
44
|
+
function deriveInitials(name) {
|
|
45
|
+
if (!name)
|
|
46
|
+
return undefined;
|
|
47
|
+
const parts = name.trim().split(/\s+/);
|
|
48
|
+
if (parts.length === 0)
|
|
49
|
+
return undefined;
|
|
50
|
+
if (parts.length === 1)
|
|
51
|
+
return parts[0].slice(0, 2).toUpperCase();
|
|
52
|
+
return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
|
|
53
|
+
}
|
|
54
|
+
function hoverIn(e) { e.currentTarget.style.background = '#f3f4f6'; e.currentTarget.style.color = '#111827'; }
|
|
55
|
+
function hoverOut(e) { e.currentTarget.style.background = 'transparent'; e.currentTarget.style.color = '#374151'; }
|
|
56
|
+
function dangerHoverIn(e) { e.currentTarget.style.background = '#fef2f2'; e.currentTarget.style.color = '#b91c1c'; }
|
|
57
|
+
function dangerHoverOut(e) { e.currentTarget.style.background = 'transparent'; e.currentTarget.style.color = '#dc2626'; }
|
|
58
|
+
function Divider() {
|
|
59
|
+
return _jsx("div", { style: { height: 1, background: '#e5e7eb', margin: '4px 0' }, "aria-hidden": true });
|
|
60
|
+
}
|
|
61
|
+
function IconUser() {
|
|
62
|
+
return (_jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [_jsx("path", { d: "M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2" }), _jsx("circle", { cx: "12", cy: "7", r: "4" })] }));
|
|
63
|
+
}
|
|
64
|
+
function IconLogout() {
|
|
65
|
+
return (_jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [_jsx("path", { d: "M9 21H5a2 2 0 01-2-2V5a2 2 0 012-2h4" }), _jsx("polyline", { points: "16 17 21 12 16 7" }), _jsx("line", { x1: "21", y1: "12", x2: "9", y2: "12" })] }));
|
|
66
|
+
}
|
|
67
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
68
|
+
// Styles
|
|
69
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
70
|
+
const triggerStyle = {
|
|
71
|
+
display: 'inline-flex',
|
|
72
|
+
alignItems: 'center',
|
|
73
|
+
justifyContent: 'center',
|
|
74
|
+
width: 32,
|
|
75
|
+
height: 32,
|
|
76
|
+
borderRadius: '50%',
|
|
77
|
+
border: 0,
|
|
78
|
+
background: 'transparent',
|
|
79
|
+
cursor: 'pointer',
|
|
80
|
+
padding: 0,
|
|
81
|
+
overflow: 'hidden',
|
|
82
|
+
};
|
|
83
|
+
const avatarImgStyle = {
|
|
84
|
+
width: 32,
|
|
85
|
+
height: 32,
|
|
86
|
+
objectFit: 'cover',
|
|
87
|
+
borderRadius: '50%',
|
|
88
|
+
display: 'block',
|
|
89
|
+
};
|
|
90
|
+
const avatarFallbackStyle = {
|
|
91
|
+
width: 32,
|
|
92
|
+
height: 32,
|
|
93
|
+
borderRadius: '50%',
|
|
94
|
+
background: '#fff7ed',
|
|
95
|
+
border: '1px solid #fed7aa',
|
|
96
|
+
color: '#c2410c',
|
|
97
|
+
fontSize: 11,
|
|
98
|
+
fontWeight: 700,
|
|
99
|
+
display: 'inline-flex',
|
|
100
|
+
alignItems: 'center',
|
|
101
|
+
justifyContent: 'center',
|
|
102
|
+
letterSpacing: '0.04em',
|
|
103
|
+
};
|
|
104
|
+
function menuStyle(open) {
|
|
105
|
+
return {
|
|
106
|
+
position: 'absolute',
|
|
107
|
+
right: 0,
|
|
108
|
+
top: 'calc(100% + 8px)',
|
|
109
|
+
minWidth: 220,
|
|
110
|
+
background: '#ffffff',
|
|
111
|
+
border: '1px solid #e5e7eb',
|
|
112
|
+
borderRadius: 12,
|
|
113
|
+
boxShadow: '0 16px 32px -8px rgba(15,23,42,0.16), 0 4px 8px -2px rgba(15,23,42,0.08)',
|
|
114
|
+
padding: '6px 0',
|
|
115
|
+
opacity: open ? 1 : 0,
|
|
116
|
+
visibility: open ? 'visible' : 'hidden',
|
|
117
|
+
transform: open ? 'translateY(0)' : 'translateY(-4px)',
|
|
118
|
+
transition: 'opacity 150ms cubic-bezier(0.16,1,0.3,1), transform 150ms cubic-bezier(0.16,1,0.3,1), visibility 150ms',
|
|
119
|
+
zIndex: 50,
|
|
120
|
+
color: '#111827',
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
const headerStyle = {
|
|
124
|
+
padding: '8px 14px 10px',
|
|
125
|
+
borderBottom: '1px solid #e5e7eb',
|
|
126
|
+
marginBottom: 4,
|
|
127
|
+
minWidth: 0,
|
|
128
|
+
};
|
|
129
|
+
const nameStyle = {
|
|
130
|
+
fontSize: 13,
|
|
131
|
+
fontWeight: 600,
|
|
132
|
+
color: '#0f172a',
|
|
133
|
+
overflow: 'hidden',
|
|
134
|
+
textOverflow: 'ellipsis',
|
|
135
|
+
whiteSpace: 'nowrap',
|
|
136
|
+
};
|
|
137
|
+
const emailStyle = {
|
|
138
|
+
fontSize: 11,
|
|
139
|
+
color: '#64748b',
|
|
140
|
+
marginTop: 2,
|
|
141
|
+
overflow: 'hidden',
|
|
142
|
+
textOverflow: 'ellipsis',
|
|
143
|
+
whiteSpace: 'nowrap',
|
|
144
|
+
};
|
|
145
|
+
const itemStyle = {
|
|
146
|
+
display: 'flex',
|
|
147
|
+
alignItems: 'center',
|
|
148
|
+
gap: 10,
|
|
149
|
+
padding: '8px 14px',
|
|
150
|
+
fontSize: 13,
|
|
151
|
+
color: '#374151',
|
|
152
|
+
background: 'transparent',
|
|
153
|
+
border: 0,
|
|
154
|
+
cursor: 'pointer',
|
|
155
|
+
width: '100%',
|
|
156
|
+
textAlign: 'left',
|
|
157
|
+
textDecoration: 'none',
|
|
158
|
+
fontFamily: 'inherit',
|
|
159
|
+
transition: 'background 120ms, color 120ms',
|
|
160
|
+
};
|
|
161
|
+
const dangerItemStyle = {
|
|
162
|
+
...itemStyle,
|
|
163
|
+
color: '#dc2626',
|
|
164
|
+
};
|
|
165
|
+
//# sourceMapping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,EAAE;IAClB,KAAK,EAAW,SAAS;IACzB,UAAU,EAAM,aAAa;IAC7B,MAAM,EAAU,CAAC;IACjB,MAAM,EAAU,SAAS;IACzB,KAAK,EAAW,MAAM;IACtB,SAAS,EAAO,MAAM;IACtB,cAAc,EAAE,MAAM;IACtB,UAAU,EAAM,SAAS;IACzB,UAAU,EAAM,+BAA+B;CAChD,CAAA;AAED,MAAM,eAAe,GAAkB;IACrC,GAAG,SAAS;IACZ,KAAK,EAAE,SAAS;CACjB,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -26,6 +26,14 @@ export { SuiteSwitcher, DEFAULT_SUITE_PRODUCTS, UKFlag } from './SuiteSwitcher.j
|
|
|
26
26
|
export type { SuiteSwitcherProps, SuiteProduct, SuiteProductId } from './SuiteSwitcher.js';
|
|
27
27
|
export { CompanyMenu, DEFAULT_COMPANY_URLS } from './CompanyMenu.js';
|
|
28
28
|
export type { CompanyMenuProps } from './CompanyMenu.js';
|
|
29
|
+
export { KnowledgeBaseMenu } from './KnowledgeBaseMenu.js';
|
|
30
|
+
export type { KnowledgeBaseMenuProps, KnowledgeBaseItem } from './KnowledgeBaseMenu.js';
|
|
31
|
+
export { SettingsMenu } from './SettingsMenu.js';
|
|
32
|
+
export type { SettingsMenuProps, SettingsItem } from './SettingsMenu.js';
|
|
33
|
+
export { UserProfile } from './UserProfile.js';
|
|
34
|
+
export type { UserProfileProps } from './UserProfile.js';
|
|
35
|
+
export { UniversalNavBar } from './UniversalNavBar.js';
|
|
36
|
+
export type { UniversalNavBarProps } from './UniversalNavBar.js';
|
|
29
37
|
export { useOrgMembers, useOrgSeats, useAuditLog, assignSeat, revokeSeat, reassignSeat, } from './admin.js';
|
|
30
38
|
export type { UseOrgMembersResult, UseOrgSeatsResult, UseAuditLogOptions, } from './admin.js';
|
|
31
39
|
export type { ProductCode, SubTier, OrgRole, SeatStatus, AccessSource, Profile, Organisation, OrgBranding, OrgMember, Subscription, Seat, SeatPool, ChangelogEntry, ChangelogRelease, ChangelogFeed, AuditLogEntry, Person, PersonRole, Team, TeamMembership, Place, PlaceType, Project, ProjectStatus, } from './types.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC/D,YAAY,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAE5E,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACxE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAE5D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAClE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAE7E,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9C,OAAO,EACL,SAAS,EACT,QAAQ,EACR,kBAAkB,EAClB,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,aAAa,CAAA;AACpB,YAAY,EACV,eAAe,EACf,cAAc,EACd,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACjE,YAAY,EAAE,eAAe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AAgB,EAAE,MAAM,kBAAkB,CAAA;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,YAAY,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAEhE,OAAO,EACL,aAAa,EACb,WAAW,EACX,WAAW,EACX,UAAU,EACV,UAAU,EACV,YAAY,GACb,MAAM,YAAY,CAAA;AACnB,YAAY,EACV,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,YAAY,CAAA;AAEnB,YAAY,EACV,WAAW,EACX,OAAO,EACP,OAAO,EACP,UAAU,EACV,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,WAAW,EACX,SAAS,EACT,YAAY,EACZ,IAAI,EACJ,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,MAAM,EACN,UAAU,EACV,IAAI,EACJ,cAAc,EACd,KAAK,EACL,SAAS,EACT,OAAO,EACP,aAAa,GACd,MAAM,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
// @unisim/sdk — public API.
|
|
2
3
|
// Every product depends on this; no product should import @supabase/supabase-js directly.
|
|
4
|
+
//
|
|
5
|
+
// The 'use client' directive above is essential: Next 14 App Router needs the
|
|
6
|
+
// entry point of a re-exporting module to be client-marked so the consumer
|
|
7
|
+
// and provider end up in the *same* React context instance. Without it
|
|
8
|
+
// useUniversal() throws "must be called inside <UniversalProvider>" even
|
|
9
|
+
// when the provider is in the tree.
|
|
3
10
|
export { UniversalProvider, useUniversal } from './provider.js';
|
|
4
11
|
export { useUser, useOrg, signInWithPassword, signOut } from './auth.js';
|
|
5
12
|
export { useHasAccess, useHasFeature, useSeat } from './access.js';
|
|
@@ -15,5 +22,9 @@ export { TrialBadge, UpgradeWall } from './TrialUi.js';
|
|
|
15
22
|
export { UniversalBar } from './UniversalBar.js';
|
|
16
23
|
export { SuiteSwitcher, DEFAULT_SUITE_PRODUCTS, UKFlag } from './SuiteSwitcher.js';
|
|
17
24
|
export { CompanyMenu, DEFAULT_COMPANY_URLS } from './CompanyMenu.js';
|
|
25
|
+
export { KnowledgeBaseMenu } from './KnowledgeBaseMenu.js';
|
|
26
|
+
export { SettingsMenu } from './SettingsMenu.js';
|
|
27
|
+
export { UserProfile } from './UserProfile.js';
|
|
28
|
+
export { UniversalNavBar } from './UniversalNavBar.js';
|
|
18
29
|
export { useOrgMembers, useOrgSeats, useAuditLog, assignSeat, revokeSeat, reassignSeat, } from './admin.js';
|
|
19
30
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,0FAA0F;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AACZ,4BAA4B;AAC5B,0FAA0F;AAC1F,EAAE;AACF,8EAA8E;AAC9E,2EAA2E;AAC3E,uEAAuE;AACvE,yEAAyE;AACzE,oCAAoC;AAEpC,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAG/D,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAGxE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAGlE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAG7C,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9C,OAAO,EACL,SAAS,EACT,QAAQ,EACR,kBAAkB,EAClB,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,aAAa,CAAA;AAQpB,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAGjE,OAAO,EACL,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,aAAa,GACd,MAAM,eAAe,CAAA;AAOtB,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAGzC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAG/D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAGtD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAGhD,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAGlF,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAGpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAG1D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAGhD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAG9C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAGtD,OAAO,EACL,aAAa,EACb,WAAW,EACX,WAAW,EACX,UAAU,EACV,UAAU,EACV,YAAY,GACb,MAAM,YAAY,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@unisim/sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Shared React SDK for the Universal Suite — auth, entitlements, usage telemetry, changelog, org admin.",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"author": "Universal Simulation Ltd",
|
|
7
|
-
"keywords": [
|
|
8
|
-
"supabase",
|
|
9
|
-
"react",
|
|
10
|
-
"hooks",
|
|
11
|
-
"saas",
|
|
12
|
-
"multi-tenant",
|
|
13
|
-
"auth",
|
|
14
|
-
"rbac",
|
|
15
|
-
"universal-simulation"
|
|
16
|
-
],
|
|
17
|
-
"homepage": "https://github.com/universal-simulation-ltd/universal-platform/tree/main/packages/sdk#readme",
|
|
18
|
-
"repository": {
|
|
19
|
-
"type": "git",
|
|
20
|
-
"url": "git+https://github.com/universal-simulation-ltd/universal-platform.git",
|
|
21
|
-
"directory": "packages/sdk"
|
|
22
|
-
},
|
|
23
|
-
"bugs": {
|
|
24
|
-
"url": "https://github.com/universal-simulation-ltd/universal-platform/issues"
|
|
25
|
-
},
|
|
26
|
-
"type": "module",
|
|
27
|
-
"main": "./dist/index.js",
|
|
28
|
-
"module": "./dist/index.js",
|
|
29
|
-
"types": "./dist/index.d.ts",
|
|
30
|
-
"sideEffects": false,
|
|
31
|
-
"exports": {
|
|
32
|
-
".": {
|
|
33
|
-
"types": "./dist/index.d.ts",
|
|
34
|
-
"import": "./dist/index.js"
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
"files": [
|
|
38
|
-
"dist",
|
|
39
|
-
"README.md"
|
|
40
|
-
],
|
|
41
|
-
"scripts": {
|
|
42
|
-
"build": "tsc -p tsconfig.build.json",
|
|
43
|
-
"dev": "tsc -p tsconfig.build.json --watch",
|
|
44
|
-
"typecheck": "tsc --noEmit",
|
|
45
|
-
"prepublishOnly": "npm run typecheck && npm run build"
|
|
46
|
-
},
|
|
47
|
-
"peerDependencies": {
|
|
48
|
-
"react": "^18.0.0 || ^19.0.0"
|
|
49
|
-
},
|
|
50
|
-
"dependencies": {
|
|
51
|
-
"@supabase/supabase-js": "^2.45.0"
|
|
52
|
-
},
|
|
53
|
-
"devDependencies": {
|
|
54
|
-
"@types/react": "^18.3.0",
|
|
55
|
-
"react": "^18.3.0",
|
|
56
|
-
"typescript": "^5.7.2"
|
|
57
|
-
},
|
|
58
|
-
"publishConfig": {
|
|
59
|
-
"access": "public"
|
|
60
|
-
}
|
|
61
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@unisim/sdk",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Shared React SDK for the Universal Suite — auth, entitlements, usage telemetry, changelog, org admin.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Universal Simulation Ltd",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"supabase",
|
|
9
|
+
"react",
|
|
10
|
+
"hooks",
|
|
11
|
+
"saas",
|
|
12
|
+
"multi-tenant",
|
|
13
|
+
"auth",
|
|
14
|
+
"rbac",
|
|
15
|
+
"universal-simulation"
|
|
16
|
+
],
|
|
17
|
+
"homepage": "https://github.com/universal-simulation-ltd/universal-platform/tree/main/packages/sdk#readme",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/universal-simulation-ltd/universal-platform.git",
|
|
21
|
+
"directory": "packages/sdk"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/universal-simulation-ltd/universal-platform/issues"
|
|
25
|
+
},
|
|
26
|
+
"type": "module",
|
|
27
|
+
"main": "./dist/index.js",
|
|
28
|
+
"module": "./dist/index.js",
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"sideEffects": false,
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"import": "./dist/index.js"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist",
|
|
39
|
+
"README.md"
|
|
40
|
+
],
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsc -p tsconfig.build.json",
|
|
43
|
+
"dev": "tsc -p tsconfig.build.json --watch",
|
|
44
|
+
"typecheck": "tsc --noEmit",
|
|
45
|
+
"prepublishOnly": "npm run typecheck && npm run build"
|
|
46
|
+
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@supabase/supabase-js": "^2.45.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@types/react": "^18.3.0",
|
|
55
|
+
"react": "^18.3.0",
|
|
56
|
+
"typescript": "^5.7.2"
|
|
57
|
+
},
|
|
58
|
+
"publishConfig": {
|
|
59
|
+
"access": "public"
|
|
60
|
+
}
|
|
61
|
+
}
|