@unisim/sdk 0.1.4 → 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/README.md +107 -101
- package/dist/CompanyMenu.d.ts +42 -0
- package/dist/CompanyMenu.d.ts.map +1 -0
- package/dist/CompanyMenu.js +148 -0
- package/dist/CompanyMenu.js.map +1 -0
- 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/SuiteSwitcher.d.ts +49 -0
- package/dist/SuiteSwitcher.d.ts.map +1 -0
- package/dist/SuiteSwitcher.js +232 -0
- package/dist/SuiteSwitcher.js.map +1 -0
- package/dist/TrialUi.d.ts +16 -0
- package/dist/TrialUi.d.ts.map +1 -0
- package/dist/TrialUi.js +66 -0
- package/dist/TrialUi.js.map +1 -0
- package/dist/UniversalBar.d.ts.map +1 -1
- package/dist/UniversalBar.js +1 -0
- package/dist/UniversalBar.js.map +1 -1
- 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/access.d.ts.map +1 -1
- package/dist/access.js +1 -0
- package/dist/access.js.map +1 -1
- package/dist/admin.d.ts.map +1 -1
- package/dist/admin.js +1 -0
- package/dist/admin.js.map +1 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +1 -0
- package/dist/auth.js.map +1 -1
- package/dist/branding.d.ts.map +1 -1
- package/dist/branding.js +1 -0
- package/dist/branding.js.map +1 -1
- package/dist/changelog.d.ts.map +1 -1
- package/dist/changelog.js +1 -0
- package/dist/changelog.js.map +1 -1
- package/dist/index.d.ts +25 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -1
- package/dist/people.d.ts +45 -0
- package/dist/people.d.ts.map +1 -0
- package/dist/people.js +190 -0
- package/dist/people.js.map +1 -0
- package/dist/places.d.ts +23 -0
- package/dist/places.d.ts.map +1 -0
- package/dist/places.js +66 -0
- package/dist/places.js.map +1 -0
- package/dist/projects.d.ts +32 -0
- package/dist/projects.d.ts.map +1 -0
- package/dist/projects.js +71 -0
- package/dist/projects.js.map +1 -0
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +1 -0
- package/dist/provider.js.map +1 -1
- package/dist/subscription.d.ts +25 -0
- package/dist/subscription.d.ts.map +1 -0
- package/dist/subscription.js +62 -0
- package/dist/subscription.js.map +1 -0
- package/dist/trial.d.ts +29 -0
- package/dist/trial.d.ts.map +1 -0
- package/dist/trial.js +29 -0
- package/dist/trial.js.map +1 -0
- package/dist/types.d.ts +54 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/usage.d.ts.map +1 -1
- package/dist/usage.js +1 -0
- package/dist/usage.js.map +1 -1
- package/package.json +15 -2
package/README.md
CHANGED
|
@@ -1,101 +1,107 @@
|
|
|
1
|
-
# @unisim/sdk
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
**No product should import `@supabase/supabase-js` directly** — go through the SDK so the underlying backend stays swappable.
|
|
6
|
-
|
|
7
|
-
## Install
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install @unisim/sdk
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
###
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
1
|
+
# @unisim/sdk
|
|
2
|
+
|
|
3
|
+
Shared React SDK for the **Universal Suite** — Ergo Assess UK, Cyber Assess UK, Workplace Assess, plus the central hub at `app.unisim.co.uk`. One package for auth, multi-tenant org data, branding, entitlements, changelog, and trial gating, so every product reads the same source of truth.
|
|
4
|
+
|
|
5
|
+
**No product should import `@supabase/supabase-js` directly** — go through the SDK so the underlying backend stays swappable.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @unisim/sdk @supabase/supabase-js react
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
React 18+ is a peer dependency.
|
|
14
|
+
|
|
15
|
+
## Quick start
|
|
16
|
+
|
|
17
|
+
Wrap your app in `<UniversalProvider>` once, then call hooks anywhere.
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import { UniversalProvider, useUser, useOrgBranding } from '@unisim/sdk'
|
|
21
|
+
|
|
22
|
+
const config = {
|
|
23
|
+
supabaseUrl: process.env.NEXT_PUBLIC_PLATFORM_SUPABASE_URL!,
|
|
24
|
+
supabaseAnonKey: process.env.NEXT_PUBLIC_PLATFORM_SUPABASE_ANON_KEY!,
|
|
25
|
+
product: 'ergo_assess',
|
|
26
|
+
cookieDomain: process.env.NODE_ENV === 'production' ? '.unisim.co.uk' : undefined,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function App() {
|
|
30
|
+
return (
|
|
31
|
+
<UniversalProvider config={config}>
|
|
32
|
+
<Header />
|
|
33
|
+
{/* … */}
|
|
34
|
+
</UniversalProvider>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function Header() {
|
|
39
|
+
const { user } = useUser()
|
|
40
|
+
const branding = useOrgBranding()
|
|
41
|
+
return (
|
|
42
|
+
<header>
|
|
43
|
+
{branding.logo_url && <img src={branding.logo_url} alt="" />}
|
|
44
|
+
<span>{user?.email ?? 'Guest'}</span>
|
|
45
|
+
</header>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## What you get
|
|
51
|
+
|
|
52
|
+
### Auth + session
|
|
53
|
+
- `useUniversal()` — raw `{ supabase, session, activeOrgId, … }`
|
|
54
|
+
- `useUser()` — `{ user, loading }`
|
|
55
|
+
- `useOrg()` — active org + list of orgs the user belongs to
|
|
56
|
+
- `signInWithPassword(supabase, email, password)`
|
|
57
|
+
- `signOut(supabase)`
|
|
58
|
+
|
|
59
|
+
### Trial mode (anonymous-auth users)
|
|
60
|
+
- `useTrialMode()` — `{ isTrial, hasSession, email }` for gating exports / multi-user
|
|
61
|
+
- `<TrialBadge />` — small "PRO" chip you append to gated buttons
|
|
62
|
+
- `<UpgradeWall feature="export PDFs" />` — full feature-replacement card
|
|
63
|
+
|
|
64
|
+
### Suite-wide entities (all org-scoped, RLS-gated)
|
|
65
|
+
- `usePeople()` + `createPerson` / `deletePerson`
|
|
66
|
+
- `useTeams()` + `useTeamMemberships()` + `createTeam` / `assignPersonToTeam` / …
|
|
67
|
+
- `usePlaces()` + `createPlace` / `deletePlace`
|
|
68
|
+
- `useProjects()` + `createProject` / `updateProjectStatus` / `deleteProject`
|
|
69
|
+
- `useOrgBranding()` — logo URL + brand colour
|
|
70
|
+
- `useOrgMembers()` — org membership list with profile data
|
|
71
|
+
|
|
72
|
+
### Subscriptions + entitlements
|
|
73
|
+
- `useSubscription()` — `{ tier, status, seat_count, current_period_end, credits }`
|
|
74
|
+
- `useCredits()` — convenience wrapper for the metered balance
|
|
75
|
+
- `useHasAccess(productCode)` — feature/product entitlement check
|
|
76
|
+
- `useHasFeature(productCode, feature)`
|
|
77
|
+
- `useSeat(productCode)`
|
|
78
|
+
|
|
79
|
+
### Org admin
|
|
80
|
+
- `useOrgMembers()` / `useOrgSeats()` / `useAuditLog()`
|
|
81
|
+
- `assignSeat` / `revokeSeat` / `reassignSeat`
|
|
82
|
+
|
|
83
|
+
### Suite navigation
|
|
84
|
+
- `<SuiteSwitcher current="ergo_assess" />` — top-right product switcher with the canonical product list
|
|
85
|
+
- `<CompanyMenu />` — "My Company" dropdown linking to the central hub
|
|
86
|
+
- `<UniversalBar />` — the 4 px gradient brand strip across every product header
|
|
87
|
+
- `<UKFlag />` — region indicator for UK products
|
|
88
|
+
|
|
89
|
+
### Changelog
|
|
90
|
+
- `useChangelog()` — fetches the suite-wide changelog feed (defaults to `https://changelog.unisim.co.uk/changelog.json`)
|
|
91
|
+
|
|
92
|
+
## Multi-tenant model
|
|
93
|
+
|
|
94
|
+
This SDK is the client side of a Supabase-backed multi-tenant schema (see `universal-platform/supabase/migrations`). Every read/write is scoped to the user's active org via the `is_org_member()` helper in RLS policies. Anonymous-auth users get the same hooks; trial caps (3 people / 1 team / 2 places / 1 project) are enforced server-side by the `enforce_anonymous_trial_caps()` trigger.
|
|
95
|
+
|
|
96
|
+
## Publishing
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
cd packages/sdk
|
|
100
|
+
./publish.sh patch # or minor / major
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
This runs `npm version`, builds, publishes, commits the version bump, and pushes — see `publish.sh` for the exact sequence. `prepublishOnly` runs `typecheck && build` as a safety net, and the `dist/` folder is the only thing shipped (per `files`).
|
|
104
|
+
|
|
105
|
+
## License
|
|
106
|
+
|
|
107
|
+
MIT © Universal Simulation Ltd
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type CSSProperties, type MouseEvent } from 'react';
|
|
2
|
+
export interface CompanyMenuProps {
|
|
3
|
+
/** Trigger label. Defaults to "My Company". */
|
|
4
|
+
label?: string;
|
|
5
|
+
/** URL for the "Projects" item. */
|
|
6
|
+
projectsHref?: string;
|
|
7
|
+
/** URL for the "People" item. */
|
|
8
|
+
peopleHref?: string;
|
|
9
|
+
/** URL for the "Places" item. */
|
|
10
|
+
placesHref?: string;
|
|
11
|
+
/** URL for the "Branding" item. */
|
|
12
|
+
brandingHref?: string;
|
|
13
|
+
/** URL for the "Log in" item — defaults to the Universal ID hub. */
|
|
14
|
+
loginHref?: string;
|
|
15
|
+
/**
|
|
16
|
+
* If provided, the Log in item becomes a button calling this instead of
|
|
17
|
+
* navigating. Useful when a product wants to handle auth inline (e.g.
|
|
18
|
+
* modal-based login) while still defaulting to the hub URL otherwise.
|
|
19
|
+
*/
|
|
20
|
+
onLogin?: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
21
|
+
/**
|
|
22
|
+
* When set, the Log in item is replaced by a "Sign out" item that calls
|
|
23
|
+
* this handler. Use this for authenticated users so the same menu does
|
|
24
|
+
* double duty across guest and signed-in states.
|
|
25
|
+
*/
|
|
26
|
+
onLogout?: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
27
|
+
/** Hide the Log in / Sign out item entirely. */
|
|
28
|
+
hideLogin?: boolean;
|
|
29
|
+
/** Trigger className — typically Tailwind classes from the host nav. */
|
|
30
|
+
triggerClassName?: string;
|
|
31
|
+
style?: CSSProperties;
|
|
32
|
+
className?: string;
|
|
33
|
+
}
|
|
34
|
+
export declare const DEFAULT_COMPANY_URLS: {
|
|
35
|
+
readonly projects: "https://app.unisim.co.uk/projects";
|
|
36
|
+
readonly people: "https://app.unisim.co.uk/people";
|
|
37
|
+
readonly places: "https://app.unisim.co.uk/places";
|
|
38
|
+
readonly branding: "https://app.unisim.co.uk/branding";
|
|
39
|
+
readonly login: "https://app.unisim.co.uk/login";
|
|
40
|
+
};
|
|
41
|
+
export declare function CompanyMenu({ label, projectsHref, peopleHref, placesHref, brandingHref, loginHref, onLogin, onLogout, hideLogin, triggerClassName, style, className, }: CompanyMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
//# sourceMappingURL=CompanyMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompanyMenu.d.ts","sourceRoot":"","sources":["../src/CompanyMenu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,UAAU,EAChB,MAAM,OAAO,CAAA;AAMd,MAAM,WAAW,gBAAgB;IAC/B,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mCAAmC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,iCAAiC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,iCAAiC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,mCAAmC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,oEAAoE;IACpE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IACpD;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IACrD,gDAAgD;IAChD,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,wEAAwE;IACxE,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,KAAK,CAAC,EAAE,aAAa,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AASD,eAAO,MAAM,oBAAoB;;;;;;CAMvB,CAAA;AAwEV,wBAAgB,WAAW,CAAC,EAC1B,KAAoB,EACpB,YAA4C,EAC5C,UAAwC,EACxC,UAAwC,EACxC,YAA4C,EAC5C,SAAsC,EACtC,OAAO,EACP,QAAQ,EACR,SAAiB,EACjB,gBAAgB,EAChB,KAAK,EACL,SAAS,GACV,EAAE,gBAAgB,2CAyFlB"}
|
|
@@ -0,0 +1,148 @@
|
|
|
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
|
+
// Defaults — single source of truth for the suite's "My Company" hub URLs.
|
|
6
|
+
// Updating these here propagates to every product on the next SDK release.
|
|
7
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
8
|
+
const UNIVERSAL_ID_BASE = 'https://app.unisim.co.uk';
|
|
9
|
+
export const DEFAULT_COMPANY_URLS = {
|
|
10
|
+
projects: `${UNIVERSAL_ID_BASE}/projects`,
|
|
11
|
+
people: `${UNIVERSAL_ID_BASE}/people`,
|
|
12
|
+
places: `${UNIVERSAL_ID_BASE}/places`,
|
|
13
|
+
branding: `${UNIVERSAL_ID_BASE}/branding`,
|
|
14
|
+
login: `${UNIVERSAL_ID_BASE}/login`,
|
|
15
|
+
};
|
|
16
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
17
|
+
// Icons (small, inline, no asset deps)
|
|
18
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
19
|
+
function IconProjects() {
|
|
20
|
+
return (_jsx("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: "M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z" }) }));
|
|
21
|
+
}
|
|
22
|
+
function IconPeople() {
|
|
23
|
+
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" })] }));
|
|
24
|
+
}
|
|
25
|
+
function IconPlaces() {
|
|
26
|
+
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: "M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0118 0z" }), _jsx("circle", { cx: "12", cy: "10", r: "3" })] }));
|
|
27
|
+
}
|
|
28
|
+
function IconBranding() {
|
|
29
|
+
// Palette — three paint swatches arc around a base shape. Reads as
|
|
30
|
+
// "colour/visual identity" without needing text.
|
|
31
|
+
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("circle", { cx: "13.5", cy: "6.5", r: "0.5", fill: "currentColor" }), _jsx("circle", { cx: "17.5", cy: "10.5", r: "0.5", fill: "currentColor" }), _jsx("circle", { cx: "8.5", cy: "7.5", r: "0.5", fill: "currentColor" }), _jsx("circle", { cx: "6.5", cy: "12.5", r: "0.5", fill: "currentColor" }), _jsx("path", { d: "M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z" })] }));
|
|
32
|
+
}
|
|
33
|
+
function IconLogin() {
|
|
34
|
+
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: "M15 3h4a2 2 0 012 2v14a2 2 0 01-2 2h-4" }), _jsx("polyline", { points: "10 17 15 12 10 7" }), _jsx("line", { x1: "15", y1: "12", x2: "3", y2: "12" })] }));
|
|
35
|
+
}
|
|
36
|
+
function IconLogout() {
|
|
37
|
+
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" })] }));
|
|
38
|
+
}
|
|
39
|
+
function IconChevron() {
|
|
40
|
+
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" }) }));
|
|
41
|
+
}
|
|
42
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
43
|
+
// Component
|
|
44
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
45
|
+
export function CompanyMenu({ label = 'My Company', projectsHref = DEFAULT_COMPANY_URLS.projects, peopleHref = DEFAULT_COMPANY_URLS.people, placesHref = DEFAULT_COMPANY_URLS.places, brandingHref = DEFAULT_COMPANY_URLS.branding, loginHref = DEFAULT_COMPANY_URLS.login, onLogin, onLogout, hideLogin = false, triggerClassName, style, className, }) {
|
|
46
|
+
const [open, setOpen] = useState(false);
|
|
47
|
+
const wrapRef = useRef(null);
|
|
48
|
+
const closeTimer = useRef(null);
|
|
49
|
+
function openNow() {
|
|
50
|
+
if (closeTimer.current)
|
|
51
|
+
clearTimeout(closeTimer.current);
|
|
52
|
+
setOpen(true);
|
|
53
|
+
}
|
|
54
|
+
function closeSoon() {
|
|
55
|
+
if (closeTimer.current)
|
|
56
|
+
clearTimeout(closeTimer.current);
|
|
57
|
+
closeTimer.current = setTimeout(() => setOpen(false), 220);
|
|
58
|
+
}
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
function onDown(e) {
|
|
61
|
+
if (wrapRef.current && !wrapRef.current.contains(e.target))
|
|
62
|
+
setOpen(false);
|
|
63
|
+
}
|
|
64
|
+
function onKey(e) {
|
|
65
|
+
if (e.key === 'Escape')
|
|
66
|
+
setOpen(false);
|
|
67
|
+
}
|
|
68
|
+
document.addEventListener('mousedown', onDown);
|
|
69
|
+
document.addEventListener('keydown', onKey);
|
|
70
|
+
return () => {
|
|
71
|
+
document.removeEventListener('mousedown', onDown);
|
|
72
|
+
document.removeEventListener('keydown', onKey);
|
|
73
|
+
};
|
|
74
|
+
}, []);
|
|
75
|
+
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": label, "aria-expanded": open, "aria-haspopup": "true", onClick: () => setOpen((v) => !v), onFocus: openNow, className: triggerClassName, style: triggerClassName
|
|
76
|
+
? undefined
|
|
77
|
+
: {
|
|
78
|
+
display: 'inline-flex',
|
|
79
|
+
alignItems: 'center',
|
|
80
|
+
gap: 4,
|
|
81
|
+
fontSize: 14,
|
|
82
|
+
color: 'inherit',
|
|
83
|
+
background: 'transparent',
|
|
84
|
+
border: 0,
|
|
85
|
+
padding: 0,
|
|
86
|
+
cursor: 'pointer',
|
|
87
|
+
fontFamily: 'inherit',
|
|
88
|
+
}, children: [label, _jsx(IconChevron, {})] }), _jsxs("div", { role: "menu", style: menuStyle(open), children: [_jsx(Item, { href: projectsHref, icon: _jsx(IconProjects, {}), label: "Projects" }), _jsx(Item, { href: peopleHref, icon: _jsx(IconPeople, {}), label: "People" }), _jsx(Item, { href: placesHref, icon: _jsx(IconPlaces, {}), label: "Places" }), _jsx(Item, { href: brandingHref, icon: _jsx(IconBranding, {}), label: "Branding" }), !hideLogin && (_jsxs(_Fragment, { children: [_jsx(Divider, {}), onLogout ? (_jsx(Item, { onClick: onLogout, icon: _jsx(IconLogout, {}), label: "Sign out", danger: true })) : (_jsx(Item, { href: onLogin ? undefined : loginHref, onClick: onLogin, icon: _jsx(IconLogin, {}), label: "Log in" }))] }))] })] }));
|
|
89
|
+
}
|
|
90
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
91
|
+
// Subcomponents + styles
|
|
92
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
93
|
+
function Item({ href, onClick, icon, label, danger, }) {
|
|
94
|
+
const restingColor = danger ? '#dc2626' : '#374151';
|
|
95
|
+
const hoverColor = danger ? '#b91c1c' : '#111827';
|
|
96
|
+
const hoverBg = danger ? '#fef2f2' : '#f3f4f6';
|
|
97
|
+
const baseStyle = {
|
|
98
|
+
display: 'flex',
|
|
99
|
+
alignItems: 'center',
|
|
100
|
+
gap: 10,
|
|
101
|
+
padding: '10px 14px',
|
|
102
|
+
fontSize: 14,
|
|
103
|
+
color: restingColor,
|
|
104
|
+
background: 'transparent',
|
|
105
|
+
border: 0,
|
|
106
|
+
cursor: 'pointer',
|
|
107
|
+
width: '100%',
|
|
108
|
+
textAlign: 'left',
|
|
109
|
+
textDecoration: 'none',
|
|
110
|
+
fontFamily: 'inherit',
|
|
111
|
+
transition: 'background 120ms, color 120ms',
|
|
112
|
+
};
|
|
113
|
+
const onEnter = (e) => {
|
|
114
|
+
e.currentTarget.style.background = hoverBg;
|
|
115
|
+
e.currentTarget.style.color = hoverColor;
|
|
116
|
+
};
|
|
117
|
+
const onLeave = (e) => {
|
|
118
|
+
e.currentTarget.style.background = 'transparent';
|
|
119
|
+
e.currentTarget.style.color = restingColor;
|
|
120
|
+
};
|
|
121
|
+
if (onClick) {
|
|
122
|
+
return (_jsxs("button", { type: "button", role: "menuitem", onClick: onClick, onMouseEnter: onEnter, onMouseLeave: onLeave, style: baseStyle, children: [icon, label] }));
|
|
123
|
+
}
|
|
124
|
+
return (_jsxs("a", { role: "menuitem", href: href, onMouseEnter: onEnter, onMouseLeave: onLeave, style: baseStyle, children: [icon, label] }));
|
|
125
|
+
}
|
|
126
|
+
function Divider() {
|
|
127
|
+
return _jsx("div", { style: { height: 1, background: '#e5e7eb', margin: '4px 0' }, "aria-hidden": true });
|
|
128
|
+
}
|
|
129
|
+
function menuStyle(open) {
|
|
130
|
+
return {
|
|
131
|
+
position: 'absolute',
|
|
132
|
+
left: 0,
|
|
133
|
+
top: 'calc(100% + 8px)',
|
|
134
|
+
minWidth: 200,
|
|
135
|
+
background: '#ffffff',
|
|
136
|
+
border: '1px solid #e5e7eb',
|
|
137
|
+
borderRadius: 12,
|
|
138
|
+
boxShadow: '0 16px 32px -8px rgba(15,23,42,0.16), 0 4px 8px -2px rgba(15,23,42,0.08)',
|
|
139
|
+
padding: '6px 0',
|
|
140
|
+
opacity: open ? 1 : 0,
|
|
141
|
+
visibility: open ? 'visible' : 'hidden',
|
|
142
|
+
transform: open ? 'translateY(0)' : 'translateY(-4px)',
|
|
143
|
+
transition: 'opacity 150ms cubic-bezier(0.16,1,0.3,1), transform 150ms cubic-bezier(0.16,1,0.3,1), visibility 150ms',
|
|
144
|
+
zIndex: 50,
|
|
145
|
+
color: '#111827',
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=CompanyMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompanyMenu.js","sourceRoot":"","sources":["../src/CompanyMenu.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EACL,QAAQ,EACR,MAAM,EACN,SAAS,GAGV,MAAM,OAAO,CAAA;AAuCd,iFAAiF;AACjF,2EAA2E;AAC3E,2EAA2E;AAC3E,iFAAiF;AAEjF,MAAM,iBAAiB,GAAG,0BAA0B,CAAA;AAEpD,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,QAAQ,EAAE,GAAG,iBAAiB,WAAW;IACzC,MAAM,EAAE,GAAG,iBAAiB,SAAS;IACrC,MAAM,EAAE,GAAG,iBAAiB,SAAS;IACrC,QAAQ,EAAE,GAAG,iBAAiB,WAAW;IACzC,KAAK,EAAE,GAAG,iBAAiB,QAAQ;CAC3B,CAAA;AAEV,iFAAiF;AACjF,uCAAuC;AACvC,iFAAiF;AAEjF,SAAS,YAAY;IACnB,OAAO,CACL,cAAK,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,EAAC,MAAM,EAAC,cAAc,EAAC,WAAW,EAAC,GAAG,EAAC,aAAa,EAAC,OAAO,EAAC,cAAc,EAAC,OAAO,iCAC5I,eAAM,CAAC,EAAC,uEAAuE,GAAG,GAC9E,CACP,CAAA;AACH,CAAC;AACD,SAAS,UAAU;IACjB,OAAO,CACL,eAAK,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,EAAC,MAA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AE,IAAI,EACV,YAAY,EAAE,OAAO,EACrB,YAAY,EAAE,OAAO,EACrB,KAAK,EAAE,SAAS,aAEf,IAAI,EACJ,KAAK,IACJ,CACL,CAAA;AACH,CAAC;AAED,SAAS,OAAO;IACd,OAAO,cAAK,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,wBAAgB,CAAA;AAC1F,CAAC;AAED,SAAS,SAAS,CAAC,IAAa;IAC9B,OAAO;QACL,QAAQ,EAAE,UAAU;QACpB,IAAI,EAAE,CAAC;QACP,GAAG,EAAE,kBAAkB;QACvB,QAAQ,EAAE,GAAG;QACb,UAAU,EAAE,SAAS;QACrB,MAAM,EAAE,mBAAmB;QAC3B,YAAY,EAAE,EAAE;QAChB,SAAS,EACP,0EAA0E;QAC5E,OAAO,EAAE,OAAO;QAChB,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACrB,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;QACvC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,kBAAkB;QACtD,UAAU,EACR,wGAAwG;QAC1G,MAAM,EAAE,EAAE;QACV,KAAK,EAAE,SAAS;KACjB,CAAA;AACH,CAAC"}
|
|
@@ -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,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