@hanzo/ui 8.0.54 → 8.0.56
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 +5 -1
- package/dist/chat/Code.cjs +2 -36
- package/dist/chat/Code.d.ts +0 -13
- package/dist/chat/Code.d.ts.map +1 -1
- package/dist/chat/Code.js +2 -35
- package/dist/chat/Code.js.map +1 -1
- package/dist/chat/index.cjs +7 -2
- package/dist/chat/index.d.ts +7 -1
- package/dist/chat/index.d.ts.map +1 -1
- package/dist/chat/index.js +7 -1
- package/dist/chat/index.js.map +1 -1
- package/dist/gui-config.cjs +37 -12
- package/dist/gui-config.d.ts +1 -582
- package/dist/gui-config.d.ts.map +1 -1
- package/dist/gui-config.js +37 -12
- package/dist/gui-config.js.map +1 -1
- package/dist/product/AppHeader.cjs +8 -6
- package/dist/product/AppHeader.d.ts.map +1 -1
- package/dist/product/AppHeader.js +11 -9
- package/dist/product/AppHeader.js.map +1 -1
- package/dist/product/CopyButton.cjs +54 -0
- package/dist/product/CopyButton.d.ts +12 -0
- package/dist/product/CopyButton.d.ts.map +1 -0
- package/dist/product/CopyButton.js +52 -0
- package/dist/product/CopyButton.js.map +1 -0
- package/dist/product/Field.cjs +2 -1
- package/dist/product/Field.d.ts.map +1 -1
- package/dist/product/Field.js +2 -1
- package/dist/product/Field.js.map +1 -1
- package/dist/product/Fieldset.cjs +13 -0
- package/dist/product/Fieldset.d.ts +35 -0
- package/dist/product/Fieldset.d.ts.map +1 -0
- package/dist/product/Fieldset.js +11 -0
- package/dist/product/Fieldset.js.map +1 -0
- package/dist/product/OrgMark.cjs +39 -3
- package/dist/product/OrgMark.d.ts +9 -0
- package/dist/product/OrgMark.d.ts.map +1 -1
- package/dist/product/OrgMark.js +38 -3
- package/dist/product/OrgMark.js.map +1 -1
- package/dist/product/OrgSwitcher.cjs +3 -3
- package/dist/product/OrgSwitcher.d.ts +29 -1
- package/dist/product/OrgSwitcher.d.ts.map +1 -1
- package/dist/product/OrgSwitcher.js +3 -3
- package/dist/product/OrgSwitcher.js.map +1 -1
- package/dist/product/Pagination.cjs +72 -0
- package/dist/product/Pagination.d.ts +21 -0
- package/dist/product/Pagination.d.ts.map +1 -0
- package/dist/product/Pagination.js +68 -0
- package/dist/product/Pagination.js.map +1 -0
- package/dist/product/SecretInput.cjs +59 -0
- package/dist/product/SecretInput.d.ts +24 -0
- package/dist/product/SecretInput.d.ts.map +1 -0
- package/dist/product/SecretInput.js +55 -0
- package/dist/product/SecretInput.js.map +1 -0
- package/dist/product/UserMenu.cjs +63 -0
- package/dist/product/UserMenu.d.ts +56 -0
- package/dist/product/UserMenu.d.ts.map +1 -0
- package/dist/product/UserMenu.js +60 -0
- package/dist/product/UserMenu.js.map +1 -0
- package/dist/product/index.cjs +21 -2
- package/dist/product/index.d.ts +5 -0
- package/dist/product/index.d.ts.map +1 -1
- package/dist/product/index.js +21 -2
- package/dist/product/index.js.map +1 -1
- package/dist/styles.css +247 -247
- package/package.json +1 -1
|
@@ -24,7 +24,7 @@ const instrument_1 = require("./instrument.cjs");
|
|
|
24
24
|
const OrgMark_1 = require("./OrgMark.cjs");
|
|
25
25
|
const scope_1 = require("./scope.cjs");
|
|
26
26
|
const titleCase = (s) => (s ? s[0].toUpperCase() + s.slice(1) : s);
|
|
27
|
-
function OrgSwitcher({ scope, orgs, pageSize = 20, current: given, create, picker = false }) {
|
|
27
|
+
function OrgSwitcher({ scope, orgs, pageSize = 20, current: given, create, picker = false, direction = 'down', footer, }) {
|
|
28
28
|
const currentId = scope.currentOrg();
|
|
29
29
|
const [open, setOpen] = (0, react_1.useState)(false);
|
|
30
30
|
const [query, setQuery] = (0, react_1.useState)('');
|
|
@@ -126,11 +126,11 @@ function OrgSwitcher({ scope, orgs, pageSize = 20, current: given, create, picke
|
|
|
126
126
|
setBusy(false);
|
|
127
127
|
}
|
|
128
128
|
};
|
|
129
|
-
return ((0, jsx_runtime_1.jsxs)(gui_1.Popover, { open: open, onOpenChange: setOpen, placement:
|
|
129
|
+
return ((0, jsx_runtime_1.jsxs)(gui_1.Popover, { open: open, onOpenChange: setOpen, placement: direction === 'up' ? 'top-start' : 'bottom-start', children: [(0, jsx_runtime_1.jsx)(gui_1.Popover.Trigger, { asChild: true, children: (0, jsx_runtime_1.jsx)(gui_1.Button, { chromeless: true, height: 44, px: "$2", justify: "flex-start", "aria-label": `${currentLabel} · switch organization`, children: (0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", gap: "$2.5", flex: 1, minW: 0, children: [(0, jsx_runtime_1.jsx)(OrgMark_1.OrgMark, { org: current, size: 30 }), (0, jsx_runtime_1.jsx)(gui_1.Text, { flex: 1, minW: 0, fontSize: "$4", fontWeight: "800", color: "$color12", numberOfLines: 1, children: currentLabel }), (0, jsx_runtime_1.jsx)(lucide_icons_2_1.ChevronsUpDown, { size: 15, color: "$color9" })] }) }) }), (0, jsx_runtime_1.jsx)(gui_1.Popover.Content, { bordered: true, elevate: true, p: "$2", width: 300, bg: "$color2", borderColor: "$borderColor", children: creating ? ((0, jsx_runtime_1.jsxs)(gui_1.YStack, { gap: "$2", children: [(0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$2", color: "$color12", fontWeight: "700", children: "Create organization" }), (0, jsx_runtime_1.jsx)(gui_1.Input, { size: "$3", placeholder: "Organization name", value: newName, onChangeText: setNewName, autoCapitalize: "words", onSubmitEditing: () => void submitCreate() }), err ? ((0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$1", color: "$red10", children: err })) : null, (0, jsx_runtime_1.jsxs)(gui_1.XStack, { gap: "$2", justify: "flex-end", children: [(0, jsx_runtime_1.jsx)(gui_1.Button, { size: "$2", chromeless: true, onPress: () => setCreating(false), disabled: busy, children: "Cancel" }), (0, jsx_runtime_1.jsx)(gui_1.Button, { size: "$2", onPress: () => void submitCreate(), disabled: busy || !newName.trim(), icon: busy ? (0, jsx_runtime_1.jsx)(gui_1.Spinner, { size: "small" }) : (0, jsx_runtime_1.jsx)(lucide_icons_2_1.Plus, { size: 14 }), children: "Create" })] })] })) : ((0, jsx_runtime_1.jsxs)(gui_1.YStack, { gap: "$1", children: [orgs ? ((0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", gap: "$2", px: "$2", py: "$1", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", children: [(0, jsx_runtime_1.jsx)(lucide_icons_2_1.Search, { size: 13, opacity: 0.6 }), (0, jsx_runtime_1.jsx)(gui_1.Input, { flex: 1, size: "$2", borderWidth: 0, bg: "transparent", placeholder: "Find organization\u2026", value: query, onChangeText: setQuery, autoCapitalize: "none", autoCorrect: false })] })) : null, (0, jsx_runtime_1.jsxs)("div", { style: { maxHeight: 300, overflowY: 'auto', display: 'flex', flexDirection: 'column' }, onScroll: (e) => {
|
|
130
130
|
const el = e.currentTarget;
|
|
131
131
|
if (el.scrollHeight - el.scrollTop - el.clientHeight < 48)
|
|
132
132
|
loadMore();
|
|
133
|
-
}, children: [loading ? ((0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", gap: "$2", px: "$2", py: "$3", children: [(0, jsx_runtime_1.jsx)(gui_1.Spinner, { size: "small", color: "$color11" }), (0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$2", color: "$color10", children: "Loading organizations\u2026" })] })) : visible.length === 0 ? ((0, jsx_runtime_1.jsx)(gui_1.Text, { px: "$2", py: "$2", fontSize: "$2", color: "$color10", children: query.trim() ? `No organizations match “${query.trim()}”.` : 'No organizations yet.' })) : (visible.map((org) => ((0, jsx_runtime_1.jsxs)(gui_1.XStack, { onPress: () => select(org.name), cursor: "pointer", items: "center", gap: "$2.5", px: "$2", py: "$2", rounded: "$3", bg: org.name === currentId ? '$color4' : 'transparent', hoverStyle: { bg: '$color5' }, children: [(0, jsx_runtime_1.jsx)(OrgMark_1.OrgMark, { org: org }), (0, jsx_runtime_1.jsx)(gui_1.Text, { flex: 1, fontSize: "$2", color: "$color12", numberOfLines: 1, children: org.displayName || org.name }), org.name === currentId ? (0, jsx_runtime_1.jsx)(lucide_icons_2_1.Check, { size: 15 }) : null] }, org.name)))), loadingMore ? ((0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", gap: "$2", px: "$2", py: "$2", children: [(0, jsx_runtime_1.jsx)(gui_1.Spinner, { size: "small", color: "$color11" }), (0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$1", color: "$color10", children: "Loading more\u2026" })] })) : hasMore ? ((0, jsx_runtime_1.jsx)(gui_1.XStack, { onPress: loadMore, cursor: "pointer", items: "center", justify: "center", px: "$2", py: "$1.5", rounded: "$3", hoverStyle: { bg: '$color4' }, children: (0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$1", color: "$color11", fontWeight: "600", children: "Load more" }) })) : null] }), create ? ((0, jsx_runtime_1.jsxs)(gui_1.XStack, { onPress: () => {
|
|
133
|
+
}, children: [loading ? ((0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", gap: "$2", px: "$2", py: "$3", children: [(0, jsx_runtime_1.jsx)(gui_1.Spinner, { size: "small", color: "$color11" }), (0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$2", color: "$color10", children: "Loading organizations\u2026" })] })) : visible.length === 0 ? ((0, jsx_runtime_1.jsx)(gui_1.Text, { px: "$2", py: "$2", fontSize: "$2", color: "$color10", children: query.trim() ? `No organizations match “${query.trim()}”.` : 'No organizations yet.' })) : (visible.map((org) => ((0, jsx_runtime_1.jsxs)(gui_1.XStack, { onPress: () => select(org.name), cursor: "pointer", items: "center", gap: "$2.5", px: "$2", py: "$2", rounded: "$3", bg: org.name === currentId ? '$color4' : 'transparent', hoverStyle: { bg: '$color5' }, children: [(0, jsx_runtime_1.jsx)(OrgMark_1.OrgMark, { org: org }), (0, jsx_runtime_1.jsx)(gui_1.Text, { flex: 1, fontSize: "$2", color: "$color12", numberOfLines: 1, children: org.displayName || org.name }), org.name === currentId ? (0, jsx_runtime_1.jsx)(lucide_icons_2_1.Check, { size: 15 }) : null] }, org.name)))), loadingMore ? ((0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", gap: "$2", px: "$2", py: "$2", children: [(0, jsx_runtime_1.jsx)(gui_1.Spinner, { size: "small", color: "$color11" }), (0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$1", color: "$color10", children: "Loading more\u2026" })] })) : hasMore ? ((0, jsx_runtime_1.jsx)(gui_1.XStack, { onPress: loadMore, cursor: "pointer", items: "center", justify: "center", px: "$2", py: "$1.5", rounded: "$3", hoverStyle: { bg: '$color4' }, children: (0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$1", color: "$color11", fontWeight: "600", children: "Load more" }) })) : null] }), footer, create ? ((0, jsx_runtime_1.jsxs)(gui_1.XStack, { onPress: () => {
|
|
134
134
|
setCreating(true);
|
|
135
135
|
setErr(null);
|
|
136
136
|
}, cursor: "pointer", items: "center", gap: "$2.5", px: "$2", py: "$2", mt: "$1", rounded: "$3", borderTopWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: '$color5' }, children: [(0, jsx_runtime_1.jsx)(gui_1.YStack, { width: 22, height: 22, rounded: "$3", bg: "$color3", items: "center", justify: "center", children: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.Plus, { size: 14 }) }), (0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$2", color: "$color12", children: "Create organization" })] })) : null, picker ? ((0, jsx_runtime_1.jsxs)(gui_1.XStack, { onPress: () => {
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OrgSwitcher — the Vercel-style org/team switcher, hoisted from the console
|
|
3
|
+
* (hanzoai/ui#36) onto @hanzo/gui primitives. Shows the org the surface is
|
|
4
|
+
* scoped to, switches between the orgs the caller can see, and creates one.
|
|
5
|
+
*
|
|
6
|
+
* Host-agnostic: the LIST is a lazy, paged loader the host injects (IAM
|
|
7
|
+
* `get-organizations` behind its own proxy) — one page at a time, the search
|
|
8
|
+
* term pushed to the server, more on demand (scroll + "Load more"), so it
|
|
9
|
+
* scales to thousands of orgs. No loader → the current org alone, synthesized
|
|
10
|
+
* from the scope (never fabricated). Selecting re-scopes IN PLACE via
|
|
11
|
+
* `scope.switchOrg` (persist + reload → every module refetches under the new
|
|
12
|
+
* `X-Org-Id`). Create posts through the injected hook, then scopes into the
|
|
13
|
+
* new org.
|
|
14
|
+
*/
|
|
15
|
+
import { type ReactNode } from 'react';
|
|
1
16
|
import { type Org, type OrgScope } from './scope.js';
|
|
2
17
|
export type OrgSwitcherProps = {
|
|
3
18
|
/** The active-org contract (see `orgScope`). */
|
|
@@ -21,6 +36,19 @@ export type OrgSwitcherProps = {
|
|
|
21
36
|
create?: (name: string) => Promise<string>;
|
|
22
37
|
/** Show the "All organizations" de-scope row (`scope.leaveOrg`). */
|
|
23
38
|
picker?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Which way the panel opens. `up` for a switcher sitting in a bottom identity
|
|
41
|
+
* bar, where a downward panel would open off the bottom of the viewport —
|
|
42
|
+
* hanzo.app kept a whole local copy of this component for want of this one
|
|
43
|
+
* prop.
|
|
44
|
+
*/
|
|
45
|
+
direction?: 'down' | 'up';
|
|
46
|
+
/**
|
|
47
|
+
* Rows below the list, above the create/de-scope affordances — the surface's
|
|
48
|
+
* own additions (a personal-workspace badge, a link into org settings). The
|
|
49
|
+
* other half of what hanzo.app's local copy existed for.
|
|
50
|
+
*/
|
|
51
|
+
footer?: ReactNode;
|
|
24
52
|
};
|
|
25
|
-
export declare function OrgSwitcher({ scope, orgs, pageSize, current: given, create, picker }: OrgSwitcherProps): import("react/jsx-runtime").JSX.Element;
|
|
53
|
+
export declare function OrgSwitcher({ scope, orgs, pageSize, current: given, create, picker, direction, footer, }: OrgSwitcherProps): import("react/jsx-runtime").JSX.Element;
|
|
26
54
|
//# sourceMappingURL=OrgSwitcher.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrgSwitcher.d.ts","sourceRoot":"","sources":["../../src/product/OrgSwitcher.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OrgSwitcher.d.ts","sourceRoot":"","sources":["../../src/product/OrgSwitcher.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAqD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAMzF,OAAO,EAAc,KAAK,GAAG,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAA;AAI7D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,gDAAgD;IAChD,KAAK,EAAE,QAAQ,CAAA;IACf;;;;OAIG;IACH,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;IACtD,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,GAAG,CAAA;IACb,2EAA2E;IAC3E,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;IAC1C,oEAAoE;IACpE,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB;;;;OAIG;IACH,MAAM,CAAC,EAAE,SAAS,CAAA;CACnB,CAAA;AAED,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,IAAI,EACJ,QAAa,EACb,OAAO,EAAE,KAAK,EACd,MAAM,EACN,MAAc,EACd,SAAkB,EAClB,MAAM,GACP,EAAE,gBAAgB,2CA6RlB"}
|
|
@@ -21,7 +21,7 @@ import { useEmit } from './instrument.js';
|
|
|
21
21
|
import { OrgMark } from './OrgMark.js';
|
|
22
22
|
import { filterOrgs } from './scope.js';
|
|
23
23
|
const titleCase = (s) => (s ? s[0].toUpperCase() + s.slice(1) : s);
|
|
24
|
-
export function OrgSwitcher({ scope, orgs, pageSize = 20, current: given, create, picker = false }) {
|
|
24
|
+
export function OrgSwitcher({ scope, orgs, pageSize = 20, current: given, create, picker = false, direction = 'down', footer, }) {
|
|
25
25
|
const currentId = scope.currentOrg();
|
|
26
26
|
const [open, setOpen] = useState(false);
|
|
27
27
|
const [query, setQuery] = useState('');
|
|
@@ -123,11 +123,11 @@ export function OrgSwitcher({ scope, orgs, pageSize = 20, current: given, create
|
|
|
123
123
|
setBusy(false);
|
|
124
124
|
}
|
|
125
125
|
};
|
|
126
|
-
return (_jsxs(Popover, { open: open, onOpenChange: setOpen, placement:
|
|
126
|
+
return (_jsxs(Popover, { open: open, onOpenChange: setOpen, placement: direction === 'up' ? 'top-start' : 'bottom-start', children: [_jsx(Popover.Trigger, { asChild: true, children: _jsx(Button, { chromeless: true, height: 44, px: "$2", justify: "flex-start", "aria-label": `${currentLabel} · switch organization`, children: _jsxs(XStack, { items: "center", gap: "$2.5", flex: 1, minW: 0, children: [_jsx(OrgMark, { org: current, size: 30 }), _jsx(Text, { flex: 1, minW: 0, fontSize: "$4", fontWeight: "800", color: "$color12", numberOfLines: 1, children: currentLabel }), _jsx(ChevronsUpDown, { size: 15, color: "$color9" })] }) }) }), _jsx(Popover.Content, { bordered: true, elevate: true, p: "$2", width: 300, bg: "$color2", borderColor: "$borderColor", children: creating ? (_jsxs(YStack, { gap: "$2", children: [_jsx(Text, { fontSize: "$2", color: "$color12", fontWeight: "700", children: "Create organization" }), _jsx(Input, { size: "$3", placeholder: "Organization name", value: newName, onChangeText: setNewName, autoCapitalize: "words", onSubmitEditing: () => void submitCreate() }), err ? (_jsx(Text, { fontSize: "$1", color: "$red10", children: err })) : null, _jsxs(XStack, { gap: "$2", justify: "flex-end", children: [_jsx(Button, { size: "$2", chromeless: true, onPress: () => setCreating(false), disabled: busy, children: "Cancel" }), _jsx(Button, { size: "$2", onPress: () => void submitCreate(), disabled: busy || !newName.trim(), icon: busy ? _jsx(Spinner, { size: "small" }) : _jsx(Plus, { size: 14 }), children: "Create" })] })] })) : (_jsxs(YStack, { gap: "$1", children: [orgs ? (_jsxs(XStack, { items: "center", gap: "$2", px: "$2", py: "$1", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(Search, { size: 13, opacity: 0.6 }), _jsx(Input, { flex: 1, size: "$2", borderWidth: 0, bg: "transparent", placeholder: "Find organization\u2026", value: query, onChangeText: setQuery, autoCapitalize: "none", autoCorrect: false })] })) : null, _jsxs("div", { style: { maxHeight: 300, overflowY: 'auto', display: 'flex', flexDirection: 'column' }, onScroll: (e) => {
|
|
127
127
|
const el = e.currentTarget;
|
|
128
128
|
if (el.scrollHeight - el.scrollTop - el.clientHeight < 48)
|
|
129
129
|
loadMore();
|
|
130
|
-
}, children: [loading ? (_jsxs(XStack, { items: "center", gap: "$2", px: "$2", py: "$3", children: [_jsx(Spinner, { size: "small", color: "$color11" }), _jsx(Text, { fontSize: "$2", color: "$color10", children: "Loading organizations\u2026" })] })) : visible.length === 0 ? (_jsx(Text, { px: "$2", py: "$2", fontSize: "$2", color: "$color10", children: query.trim() ? `No organizations match “${query.trim()}”.` : 'No organizations yet.' })) : (visible.map((org) => (_jsxs(XStack, { onPress: () => select(org.name), cursor: "pointer", items: "center", gap: "$2.5", px: "$2", py: "$2", rounded: "$3", bg: org.name === currentId ? '$color4' : 'transparent', hoverStyle: { bg: '$color5' }, children: [_jsx(OrgMark, { org: org }), _jsx(Text, { flex: 1, fontSize: "$2", color: "$color12", numberOfLines: 1, children: org.displayName || org.name }), org.name === currentId ? _jsx(Check, { size: 15 }) : null] }, org.name)))), loadingMore ? (_jsxs(XStack, { items: "center", gap: "$2", px: "$2", py: "$2", children: [_jsx(Spinner, { size: "small", color: "$color11" }), _jsx(Text, { fontSize: "$1", color: "$color10", children: "Loading more\u2026" })] })) : hasMore ? (_jsx(XStack, { onPress: loadMore, cursor: "pointer", items: "center", justify: "center", px: "$2", py: "$1.5", rounded: "$3", hoverStyle: { bg: '$color4' }, children: _jsx(Text, { fontSize: "$1", color: "$color11", fontWeight: "600", children: "Load more" }) })) : null] }), create ? (_jsxs(XStack, { onPress: () => {
|
|
130
|
+
}, children: [loading ? (_jsxs(XStack, { items: "center", gap: "$2", px: "$2", py: "$3", children: [_jsx(Spinner, { size: "small", color: "$color11" }), _jsx(Text, { fontSize: "$2", color: "$color10", children: "Loading organizations\u2026" })] })) : visible.length === 0 ? (_jsx(Text, { px: "$2", py: "$2", fontSize: "$2", color: "$color10", children: query.trim() ? `No organizations match “${query.trim()}”.` : 'No organizations yet.' })) : (visible.map((org) => (_jsxs(XStack, { onPress: () => select(org.name), cursor: "pointer", items: "center", gap: "$2.5", px: "$2", py: "$2", rounded: "$3", bg: org.name === currentId ? '$color4' : 'transparent', hoverStyle: { bg: '$color5' }, children: [_jsx(OrgMark, { org: org }), _jsx(Text, { flex: 1, fontSize: "$2", color: "$color12", numberOfLines: 1, children: org.displayName || org.name }), org.name === currentId ? _jsx(Check, { size: 15 }) : null] }, org.name)))), loadingMore ? (_jsxs(XStack, { items: "center", gap: "$2", px: "$2", py: "$2", children: [_jsx(Spinner, { size: "small", color: "$color11" }), _jsx(Text, { fontSize: "$1", color: "$color10", children: "Loading more\u2026" })] })) : hasMore ? (_jsx(XStack, { onPress: loadMore, cursor: "pointer", items: "center", justify: "center", px: "$2", py: "$1.5", rounded: "$3", hoverStyle: { bg: '$color4' }, children: _jsx(Text, { fontSize: "$1", color: "$color11", fontWeight: "600", children: "Load more" }) })) : null] }), footer, create ? (_jsxs(XStack, { onPress: () => {
|
|
131
131
|
setCreating(true);
|
|
132
132
|
setErr(null);
|
|
133
133
|
}, cursor: "pointer", items: "center", gap: "$2.5", px: "$2", py: "$2", mt: "$1", rounded: "$3", borderTopWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: '$color5' }, children: [_jsx(YStack, { width: 22, height: 22, rounded: "$3", bg: "$color3", items: "center", justify: "center", children: _jsx(Plus, { size: 14 }) }), _jsx(Text, { fontSize: "$2", color: "$color12", children: "Create organization" })] })) :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EP,MAAM,CAAC,CAAC,CAAC,CACR,MAAC,MAAM,IACL,OAAO,EAAE,GAAG,EAAE;gCACZ,OAAO,CAAC,KAAK,CAAC,CAAA;gCACd,KAAK,CAAC,QAAQ,EAAE,CAAA;4BAClB,CAAC,EACD,MAAM,EAAC,SAAS,EAChB,KAAK,EAAC,QAAQ,EACd,GAAG,EAAC,MAAM,EACV,EAAE,EAAC,IAAI,EACP,EAAE,EAAC,IAAI,EACP,OAAO,EAAC,IAAI,EACZ,UAAU,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,aAE7B,KAAC,MAAM,IAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAC,IAAI,EAAC,EAAE,EAAC,SAAS,EAAC,KAAK,EAAC,QAAQ,EAAC,OAAO,EAAC,QAAQ,YACtF,KAAC,UAAU,IAAC,IAAI,EAAE,EAAE,GAAI,GACjB,EACT,KAAC,IAAI,IAAC,QAAQ,EAAC,IAAI,EAAC,KAAK,EAAC,UAAU,kCAE7B,IACA,CACV,CAAC,CAAC,CAAC,IAAI,IACD,CACV,GACe,IACV,CACX,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.GAP = void 0;
|
|
5
|
+
exports.pages = pages;
|
|
6
|
+
exports.Pagination = Pagination;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
/**
|
|
9
|
+
* Pagination — page N of M, and the way to the others.
|
|
10
|
+
*
|
|
11
|
+
* Four implementations across the fleet (chat, the console's observability
|
|
12
|
+
* pager, and billing twice — in two spellings, in one repo), each with its own
|
|
13
|
+
* rule for what happens when there are eighty pages. `pages` is that rule,
|
|
14
|
+
* written once and testable without a browser: a fixed-width run of page numbers
|
|
15
|
+
* around the current one, with ellipses standing in for what was skipped and the
|
|
16
|
+
* first and last page always reachable.
|
|
17
|
+
*
|
|
18
|
+
* Fixed width is the requirement. A control that grows with the page count
|
|
19
|
+
* reflows the row it sits in every time you page, which is how a "next" button
|
|
20
|
+
* ends up under the cursor that was pressing "previous".
|
|
21
|
+
*/
|
|
22
|
+
const gui_1 = require("@hanzo/gui");
|
|
23
|
+
const lucide_icons_2_1 = require("@hanzogui/lucide-icons-2");
|
|
24
|
+
const instrument_1 = require("./instrument.cjs");
|
|
25
|
+
/** A gap in the run. Rendered as an ellipsis; never selectable. */
|
|
26
|
+
exports.GAP = '…';
|
|
27
|
+
/**
|
|
28
|
+
* The page numbers to show for `page` of `count`, 1-based.
|
|
29
|
+
*
|
|
30
|
+
* `around` is how many neighbours flank the current page (default 1 → at most
|
|
31
|
+
* 7 slots: first, gap, p-1, p, p+1, gap, last). Returns every page when they
|
|
32
|
+
* all fit, so a short list never grows an ellipsis it does not need.
|
|
33
|
+
*/
|
|
34
|
+
function pages(page, count, around = 1) {
|
|
35
|
+
if (count <= 0)
|
|
36
|
+
return [];
|
|
37
|
+
const width = around * 2 + 5; // first + gap + run + gap + last
|
|
38
|
+
if (count <= width)
|
|
39
|
+
return Array.from({ length: count }, (_, i) => i + 1);
|
|
40
|
+
const current = Math.min(Math.max(page, 1), count);
|
|
41
|
+
// First and last are always present, so the middle carries `width - 2` slots
|
|
42
|
+
// and each end that needs no ellipsis spends that slot on another page
|
|
43
|
+
// instead. Solving for the run that way is what keeps the total constant;
|
|
44
|
+
// clamping the run with Math.max/min alone lets it shrink near the edges, and
|
|
45
|
+
// then the control changes width as you page.
|
|
46
|
+
const middle = width - 2;
|
|
47
|
+
const nearStart = current <= around + 2;
|
|
48
|
+
const nearEnd = current >= count - around - 1;
|
|
49
|
+
const start = nearStart ? 2 : nearEnd ? count - middle + 1 : current - around;
|
|
50
|
+
const end = nearStart ? middle : nearEnd ? count - 1 : current + around;
|
|
51
|
+
const out = [1];
|
|
52
|
+
if (!nearStart)
|
|
53
|
+
out.push(exports.GAP);
|
|
54
|
+
for (let p = start; p <= end; p++)
|
|
55
|
+
out.push(p);
|
|
56
|
+
if (!nearEnd)
|
|
57
|
+
out.push(exports.GAP);
|
|
58
|
+
out.push(count);
|
|
59
|
+
return out;
|
|
60
|
+
}
|
|
61
|
+
function Pagination({ page, count, onChange, around = 1 }) {
|
|
62
|
+
const track = (0, instrument_1.useEmit)();
|
|
63
|
+
if (count <= 1)
|
|
64
|
+
return null;
|
|
65
|
+
const go = (to) => {
|
|
66
|
+
if (to === page || to < 1 || to > count)
|
|
67
|
+
return;
|
|
68
|
+
track({ component: 'Pagination', action: 'select', value: to });
|
|
69
|
+
onChange(to);
|
|
70
|
+
};
|
|
71
|
+
return ((0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", justify: "center", gap: "$1", flexWrap: "wrap", children: [(0, jsx_runtime_1.jsx)(gui_1.Button, { size: "$2", chromeless: true, icon: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.ChevronLeft, { size: 15 }), onPress: () => go(page - 1), disabled: page <= 1, "aria-label": "Previous page" }), pages(page, count, around).map((slot, i) => slot === exports.GAP ? ((0, jsx_runtime_1.jsx)(gui_1.Text, { px: "$1.5", fontSize: "$2", color: "$color10", "aria-hidden": true, children: exports.GAP }, `gap-${i}`)) : ((0, jsx_runtime_1.jsx)(gui_1.Button, { size: "$2", chromeless: slot !== page, onPress: () => go(slot), "aria-label": `Page ${slot}`, "aria-current": slot === page ? 'page' : undefined, bg: slot === page ? '$color4' : undefined, children: String(slot) }, slot))), (0, jsx_runtime_1.jsx)(gui_1.Button, { size: "$2", chromeless: true, icon: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.ChevronRight, { size: 15 }), onPress: () => go(page + 1), disabled: page >= count, "aria-label": "Next page" })] }));
|
|
72
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** A gap in the run. Rendered as an ellipsis; never selectable. */
|
|
2
|
+
export declare const GAP: "\u2026";
|
|
3
|
+
/**
|
|
4
|
+
* The page numbers to show for `page` of `count`, 1-based.
|
|
5
|
+
*
|
|
6
|
+
* `around` is how many neighbours flank the current page (default 1 → at most
|
|
7
|
+
* 7 slots: first, gap, p-1, p, p+1, gap, last). Returns every page when they
|
|
8
|
+
* all fit, so a short list never grows an ellipsis it does not need.
|
|
9
|
+
*/
|
|
10
|
+
export declare function pages(page: number, count: number, around?: number): (number | typeof GAP)[];
|
|
11
|
+
export type PaginationProps = {
|
|
12
|
+
/** Current page, 1-based. */
|
|
13
|
+
page: number;
|
|
14
|
+
/** Total pages. 1 or 0 renders nothing — there is nowhere to go. */
|
|
15
|
+
count: number;
|
|
16
|
+
onChange: (page: number) => void;
|
|
17
|
+
/** Neighbours flanking the current page. Default 1. */
|
|
18
|
+
around?: number;
|
|
19
|
+
};
|
|
20
|
+
export declare function Pagination({ page, count, onChange, around }: PaginationProps): import("react/jsx-runtime").JSX.Element | null;
|
|
21
|
+
//# sourceMappingURL=Pagination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../src/product/Pagination.tsx"],"names":[],"mappings":"AAqBA,mEAAmE;AACnE,eAAO,MAAM,GAAG,EAAG,QAAY,CAAA;AAE/B;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,SAAI,GAAG,CAAC,MAAM,GAAG,OAAO,GAAG,CAAC,EAAE,CAwBtF;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAU,EAAE,EAAE,eAAe,kDAiDhF"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Pagination — page N of M, and the way to the others.
|
|
5
|
+
*
|
|
6
|
+
* Four implementations across the fleet (chat, the console's observability
|
|
7
|
+
* pager, and billing twice — in two spellings, in one repo), each with its own
|
|
8
|
+
* rule for what happens when there are eighty pages. `pages` is that rule,
|
|
9
|
+
* written once and testable without a browser: a fixed-width run of page numbers
|
|
10
|
+
* around the current one, with ellipses standing in for what was skipped and the
|
|
11
|
+
* first and last page always reachable.
|
|
12
|
+
*
|
|
13
|
+
* Fixed width is the requirement. A control that grows with the page count
|
|
14
|
+
* reflows the row it sits in every time you page, which is how a "next" button
|
|
15
|
+
* ends up under the cursor that was pressing "previous".
|
|
16
|
+
*/
|
|
17
|
+
import { Button, Text, XStack } from '@hanzo/gui';
|
|
18
|
+
import { ChevronLeft, ChevronRight } from '@hanzogui/lucide-icons-2';
|
|
19
|
+
import { useEmit } from './instrument.js';
|
|
20
|
+
/** A gap in the run. Rendered as an ellipsis; never selectable. */
|
|
21
|
+
export const GAP = '…';
|
|
22
|
+
/**
|
|
23
|
+
* The page numbers to show for `page` of `count`, 1-based.
|
|
24
|
+
*
|
|
25
|
+
* `around` is how many neighbours flank the current page (default 1 → at most
|
|
26
|
+
* 7 slots: first, gap, p-1, p, p+1, gap, last). Returns every page when they
|
|
27
|
+
* all fit, so a short list never grows an ellipsis it does not need.
|
|
28
|
+
*/
|
|
29
|
+
export function pages(page, count, around = 1) {
|
|
30
|
+
if (count <= 0)
|
|
31
|
+
return [];
|
|
32
|
+
const width = around * 2 + 5; // first + gap + run + gap + last
|
|
33
|
+
if (count <= width)
|
|
34
|
+
return Array.from({ length: count }, (_, i) => i + 1);
|
|
35
|
+
const current = Math.min(Math.max(page, 1), count);
|
|
36
|
+
// First and last are always present, so the middle carries `width - 2` slots
|
|
37
|
+
// and each end that needs no ellipsis spends that slot on another page
|
|
38
|
+
// instead. Solving for the run that way is what keeps the total constant;
|
|
39
|
+
// clamping the run with Math.max/min alone lets it shrink near the edges, and
|
|
40
|
+
// then the control changes width as you page.
|
|
41
|
+
const middle = width - 2;
|
|
42
|
+
const nearStart = current <= around + 2;
|
|
43
|
+
const nearEnd = current >= count - around - 1;
|
|
44
|
+
const start = nearStart ? 2 : nearEnd ? count - middle + 1 : current - around;
|
|
45
|
+
const end = nearStart ? middle : nearEnd ? count - 1 : current + around;
|
|
46
|
+
const out = [1];
|
|
47
|
+
if (!nearStart)
|
|
48
|
+
out.push(GAP);
|
|
49
|
+
for (let p = start; p <= end; p++)
|
|
50
|
+
out.push(p);
|
|
51
|
+
if (!nearEnd)
|
|
52
|
+
out.push(GAP);
|
|
53
|
+
out.push(count);
|
|
54
|
+
return out;
|
|
55
|
+
}
|
|
56
|
+
export function Pagination({ page, count, onChange, around = 1 }) {
|
|
57
|
+
const track = useEmit();
|
|
58
|
+
if (count <= 1)
|
|
59
|
+
return null;
|
|
60
|
+
const go = (to) => {
|
|
61
|
+
if (to === page || to < 1 || to > count)
|
|
62
|
+
return;
|
|
63
|
+
track({ component: 'Pagination', action: 'select', value: to });
|
|
64
|
+
onChange(to);
|
|
65
|
+
};
|
|
66
|
+
return (_jsxs(XStack, { items: "center", justify: "center", gap: "$1", flexWrap: "wrap", children: [_jsx(Button, { size: "$2", chromeless: true, icon: _jsx(ChevronLeft, { size: 15 }), onPress: () => go(page - 1), disabled: page <= 1, "aria-label": "Previous page" }), pages(page, count, around).map((slot, i) => slot === GAP ? (_jsx(Text, { px: "$1.5", fontSize: "$2", color: "$color10", "aria-hidden": true, children: GAP }, `gap-${i}`)) : (_jsx(Button, { size: "$2", chromeless: slot !== page, onPress: () => go(slot), "aria-label": `Page ${slot}`, "aria-current": slot === page ? 'page' : undefined, bg: slot === page ? '$color4' : undefined, children: String(slot) }, slot))), _jsx(Button, { size: "$2", chromeless: true, icon: _jsx(ChevronRight, { size: 15 }), onPress: () => go(page + 1), disabled: page >= count, "aria-label": "Next page" })] }));
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=Pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pagination.js","sourceRoot":"","sources":["../../src/product/Pagination.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEpE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,mEAAmE;AACnE,MAAM,CAAC,MAAM,GAAG,GAAG,GAAY,CAAA;AAE/B;;;;;;GAMG;AACH,MAAM,UAAU,KAAK,CAAC,IAAY,EAAE,KAAa,EAAE,MAAM,GAAG,CAAC;IAC3D,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,EAAE,CAAA;IACzB,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,CAAA,CAAC,iCAAiC;IAC9D,IAAI,KAAK,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;IAEzE,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;IAClD,6EAA6E;IAC7E,uEAAuE;IACvE,0EAA0E;IAC1E,8EAA8E;IAC9E,8CAA8C;IAC9C,MAAM,MAAM,GAAG,KAAK,GAAG,CAAC,CAAA;IACxB,MAAM,SAAS,GAAG,OAAO,IAAI,MAAM,GAAG,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,EAAE,EAAE,GAAI,EAChC,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,EAC3B,QAAQ,EAAE,IAAI,IAAI,KAAK,gBACZ,WAAW,GACtB,IACK,CACV,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.masked = void 0;
|
|
5
|
+
exports.SecretInput = SecretInput;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
/**
|
|
8
|
+
* SecretInput — a secret you can check, copy, and not leak over someone's
|
|
9
|
+
* shoulder.
|
|
10
|
+
*
|
|
11
|
+
* An API key, a token, a webhook signing secret. Masked by default, revealed
|
|
12
|
+
* deliberately, and copyable without ever being revealed — which is the point:
|
|
13
|
+
* the usual reason a person unmasks a key is to select it by hand, so a copy
|
|
14
|
+
* control that works while masked removes the reason to show it at all.
|
|
15
|
+
*
|
|
16
|
+
* Copying is `CopyButton`, not a second implementation. This component owns
|
|
17
|
+
* exactly one thing the others do not: the reveal.
|
|
18
|
+
*
|
|
19
|
+
* Nothing here reports the secret. The analytics event carries the LENGTH and
|
|
20
|
+
* whether it was revealed — never a character of the value, and it is never
|
|
21
|
+
* written to the console, which is where the previous implementation sent its
|
|
22
|
+
* clipboard failures.
|
|
23
|
+
*/
|
|
24
|
+
const react_1 = require("react");
|
|
25
|
+
const gui_1 = require("@hanzo/gui");
|
|
26
|
+
const lucide_icons_2_1 = require("@hanzogui/lucide-icons-2");
|
|
27
|
+
const slot_1 = require("../backends/gui/slot.cjs");
|
|
28
|
+
const CopyButton_1 = require("./CopyButton.cjs");
|
|
29
|
+
const instrument_1 = require("./instrument.cjs");
|
|
30
|
+
/**
|
|
31
|
+
* Masking, on both platforms.
|
|
32
|
+
*
|
|
33
|
+
* `secureTextEntry` is React Native's spelling and gui DROPS it on web — an
|
|
34
|
+
* input carrying only that prop renders the secret in plain text, which is the
|
|
35
|
+
* exact opposite of what the caller asked for. `type="password"` is the web
|
|
36
|
+
* spelling and gui forwards it, being an unrecognised prop. Native ignores
|
|
37
|
+
* `type` for the same reason. So masking needs BOTH names, and neither alone is
|
|
38
|
+
* safe. `readOnly` is the same story: `editable={false}` is dropped on web.
|
|
39
|
+
*/
|
|
40
|
+
const masked = (on) => (on ? { secureTextEntry: true, type: 'password' } : { secureTextEntry: false, type: 'text' });
|
|
41
|
+
exports.masked = masked;
|
|
42
|
+
function SecretInput({ value, onChange, placeholder, disabled, copy = true, id, }) {
|
|
43
|
+
const [shown, setShown] = (0, react_1.useState)(false);
|
|
44
|
+
const track = (0, instrument_1.useEmit)();
|
|
45
|
+
const toggle = () => {
|
|
46
|
+
track({ component: 'SecretInput', action: shown ? 'close' : 'open', id });
|
|
47
|
+
setShown((s) => !s);
|
|
48
|
+
};
|
|
49
|
+
return ((0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", gap: "$1", px: "$2", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", bg: "$background", opacity: disabled ? 0.5 : 1, children: [(0, jsx_runtime_1.jsx)(gui_1.Input, { flex: 1, minW: 0, borderWidth: 0, bg: "transparent", value: value, onChangeText: onChange
|
|
50
|
+
? (v) => {
|
|
51
|
+
track({ component: 'SecretInput', action: 'change', id, value: v.length });
|
|
52
|
+
onChange(v);
|
|
53
|
+
}
|
|
54
|
+
: undefined,
|
|
55
|
+
// No handler means the caller is displaying a minted secret, not
|
|
56
|
+
// collecting one; a field that accepts keystrokes it then discards
|
|
57
|
+
// reads as broken. `readOnly`, not `editable` — see `masked`.
|
|
58
|
+
readOnly: !onChange, disabled: disabled, ...(0, exports.masked)(!shown), placeholder: placeholder, autoCapitalize: "none", autoCorrect: false, spellCheck: false }), copy && value ? (0, jsx_runtime_1.jsx)(CopyButton_1.CopyButton, { value: value, label: "Copy secret", id: id }) : null, (0, jsx_runtime_1.jsx)(gui_1.XStack, { width: 24, height: 24, items: "center", justify: "center", rounded: "$2", cursor: disabled ? 'not-allowed' : 'pointer', opacity: 0.7, onPress: disabled ? undefined : toggle, role: "button", tabIndex: 0, "aria-label": shown ? 'Hide secret' : 'Show secret', ...(0, slot_1.tip)(shown ? 'Hide' : 'Show'), hoverStyle: disabled ? undefined : { bg: '$color4', opacity: 1 }, pressStyle: disabled ? undefined : { bg: '$color5' }, children: shown ? (0, jsx_runtime_1.jsx)(lucide_icons_2_1.EyeOff, { size: 14 }) : (0, jsx_runtime_1.jsx)(lucide_icons_2_1.Eye, { size: 14 }) })] }));
|
|
59
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Masking, on both platforms.
|
|
3
|
+
*
|
|
4
|
+
* `secureTextEntry` is React Native's spelling and gui DROPS it on web — an
|
|
5
|
+
* input carrying only that prop renders the secret in plain text, which is the
|
|
6
|
+
* exact opposite of what the caller asked for. `type="password"` is the web
|
|
7
|
+
* spelling and gui forwards it, being an unrecognised prop. Native ignores
|
|
8
|
+
* `type` for the same reason. So masking needs BOTH names, and neither alone is
|
|
9
|
+
* safe. `readOnly` is the same story: `editable={false}` is dropped on web.
|
|
10
|
+
*/
|
|
11
|
+
export declare const masked: (on: boolean) => object;
|
|
12
|
+
export type SecretInputProps = {
|
|
13
|
+
value: string;
|
|
14
|
+
/** Omit to render read-only — the common case for a key the server minted. */
|
|
15
|
+
onChange?: (v: string) => void;
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/** Show the copy control. Default true — copying is why the field exists. */
|
|
19
|
+
copy?: boolean;
|
|
20
|
+
/** Names the secret in analytics ("openai-key"). Never the value. */
|
|
21
|
+
id?: string;
|
|
22
|
+
};
|
|
23
|
+
export declare function SecretInput({ value, onChange, placeholder, disabled, copy, id, }: SecretInputProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
//# sourceMappingURL=SecretInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SecretInput.d.ts","sourceRoot":"","sources":["../../src/product/SecretInput.tsx"],"names":[],"mappings":"AA2BA;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM,GAAI,IAAI,OAAO,KACiE,MAAM,CAAA;AAEzG,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,6EAA6E;IAC7E,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,qEAAqE;IACrE,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,IAAW,EACX,EAAE,GACH,EAAE,gBAAgB,2CAkElB"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* SecretInput — a secret you can check, copy, and not leak over someone's
|
|
5
|
+
* shoulder.
|
|
6
|
+
*
|
|
7
|
+
* An API key, a token, a webhook signing secret. Masked by default, revealed
|
|
8
|
+
* deliberately, and copyable without ever being revealed — which is the point:
|
|
9
|
+
* the usual reason a person unmasks a key is to select it by hand, so a copy
|
|
10
|
+
* control that works while masked removes the reason to show it at all.
|
|
11
|
+
*
|
|
12
|
+
* Copying is `CopyButton`, not a second implementation. This component owns
|
|
13
|
+
* exactly one thing the others do not: the reveal.
|
|
14
|
+
*
|
|
15
|
+
* Nothing here reports the secret. The analytics event carries the LENGTH and
|
|
16
|
+
* whether it was revealed — never a character of the value, and it is never
|
|
17
|
+
* written to the console, which is where the previous implementation sent its
|
|
18
|
+
* clipboard failures.
|
|
19
|
+
*/
|
|
20
|
+
import { useState } from 'react';
|
|
21
|
+
import { Input, XStack } from '@hanzo/gui';
|
|
22
|
+
import { Eye, EyeOff } from '@hanzogui/lucide-icons-2';
|
|
23
|
+
import { tip } from '../backends/gui/slot.js';
|
|
24
|
+
import { CopyButton } from './CopyButton.js';
|
|
25
|
+
import { useEmit } from './instrument.js';
|
|
26
|
+
/**
|
|
27
|
+
* Masking, on both platforms.
|
|
28
|
+
*
|
|
29
|
+
* `secureTextEntry` is React Native's spelling and gui DROPS it on web — an
|
|
30
|
+
* input carrying only that prop renders the secret in plain text, which is the
|
|
31
|
+
* exact opposite of what the caller asked for. `type="password"` is the web
|
|
32
|
+
* spelling and gui forwards it, being an unrecognised prop. Native ignores
|
|
33
|
+
* `type` for the same reason. So masking needs BOTH names, and neither alone is
|
|
34
|
+
* safe. `readOnly` is the same story: `editable={false}` is dropped on web.
|
|
35
|
+
*/
|
|
36
|
+
export const masked = (on) => (on ? { secureTextEntry: true, type: 'password' } : { secureTextEntry: false, type: 'text' });
|
|
37
|
+
export function SecretInput({ value, onChange, placeholder, disabled, copy = true, id, }) {
|
|
38
|
+
const [shown, setShown] = useState(false);
|
|
39
|
+
const track = useEmit();
|
|
40
|
+
const toggle = () => {
|
|
41
|
+
track({ component: 'SecretInput', action: shown ? 'close' : 'open', id });
|
|
42
|
+
setShown((s) => !s);
|
|
43
|
+
};
|
|
44
|
+
return (_jsxs(XStack, { items: "center", gap: "$1", px: "$2", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", bg: "$background", opacity: disabled ? 0.5 : 1, children: [_jsx(Input, { flex: 1, minW: 0, borderWidth: 0, bg: "transparent", value: value, onChangeText: onChange
|
|
45
|
+
? (v) => {
|
|
46
|
+
track({ component: 'SecretInput', action: 'change', id, value: v.length });
|
|
47
|
+
onChange(v);
|
|
48
|
+
}
|
|
49
|
+
: undefined,
|
|
50
|
+
// No handler means the caller is displaying a minted secret, not
|
|
51
|
+
// collecting one; a field that accepts keystrokes it then discards
|
|
52
|
+
// reads as broken. `readOnly`, not `editable` — see `masked`.
|
|
53
|
+
readOnly: !onChange, disabled: disabled, ...masked(!shown), placeholder: placeholder, autoCapitalize: "none", autoCorrect: false, spellCheck: false }), copy && value ? _jsx(CopyButton, { value: value, label: "Copy secret", id: id }) : null, _jsx(XStack, { width: 24, height: 24, items: "center", justify: "center", rounded: "$2", cursor: disabled ? 'not-allowed' : 'pointer', opacity: 0.7, onPress: disabled ? undefined : toggle, role: "button", tabIndex: 0, "aria-label": shown ? 'Hide secret' : 'Show secret', ...tip(shown ? 'Hide' : 'Show'), hoverStyle: disabled ? undefined : { bg: '$color4', opacity: 1 }, pressStyle: disabled ? undefined : { bg: '$color5' }, children: shown ? _jsx(EyeOff, { size: 14 }) : _jsx(Eye, { size: 14 }) })] }));
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=SecretInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SecretInput.js","sourceRoot":"","sources":["../../src/product/SecretInput.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AAEtD,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,EAAW,EAAE,EAAE,CACpC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC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C,CAAC,CAAC,KAAC,GAAG,IAAC,IAAI,EAAE,EAAE,GAAI,GAC1C,IACF,CACV,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.displayName = displayName;
|
|
5
|
+
exports.UserMenu = UserMenu;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
/**
|
|
8
|
+
* UserMenu — the account control: who I am, and the things I do to my account.
|
|
9
|
+
*
|
|
10
|
+
* It was written inside `AppHeader` and could not be reached from anywhere else,
|
|
11
|
+
* so every surface that wanted an account menu without adopting the whole header
|
|
12
|
+
* wrote one: hanzo.app twice, chat, console, billing. Five implementations of one
|
|
13
|
+
* menu, disagreeing on the trigger, the row order and the sign-out copy. This is
|
|
14
|
+
* that menu, extracted whole — `AppHeader` now renders it instead of owning it,
|
|
15
|
+
* so the header and a standalone account control cannot drift apart.
|
|
16
|
+
*
|
|
17
|
+
* Host-agnostic: identity is a value, every row is an injected handler, and a row
|
|
18
|
+
* renders only when its handler is provided — an honest menu, never a dead item.
|
|
19
|
+
* The surface keeps its own `useUser`/router in a thin wrapper; that wrapper is
|
|
20
|
+
* the seam the charter asks for, not a duplicate.
|
|
21
|
+
*
|
|
22
|
+
* The trigger is sized as the PEER of `OrgSwitcher` — same height, same mark,
|
|
23
|
+
* same type — so "which workspace" and "who I am" read as two halves of one
|
|
24
|
+
* identity rather than a caption over a control.
|
|
25
|
+
*/
|
|
26
|
+
const react_1 = require("react");
|
|
27
|
+
const gui_1 = require("@hanzo/gui");
|
|
28
|
+
const lucide_icons_2_1 = require("@hanzogui/lucide-icons-2");
|
|
29
|
+
const instrument_1 = require("./instrument.cjs");
|
|
30
|
+
const OrgMark_1 = require("./OrgMark.cjs");
|
|
31
|
+
const ThemeToggle_1 = require("./ThemeToggle.cjs");
|
|
32
|
+
function Row({ item, onDone }) {
|
|
33
|
+
const track = (0, instrument_1.useEmit)();
|
|
34
|
+
return ((0, jsx_runtime_1.jsxs)(gui_1.XStack, { onPress: () => {
|
|
35
|
+
track({ component: 'UserMenu', action: 'select', id: item.id });
|
|
36
|
+
onDone();
|
|
37
|
+
item.onPress();
|
|
38
|
+
}, cursor: "pointer", items: "center", gap: "$2.5", px: "$2", py: "$2", rounded: "$3", hoverStyle: { bg: '$color5' }, children: [item.icon, (0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$2", color: item.danger ? '$red10' : '$color12', children: item.label })] }));
|
|
39
|
+
}
|
|
40
|
+
/** The name to show: the given one, else the email's local part, else nothing
|
|
41
|
+
* fabricated — "User" is not a name and reads as a bug to the person it names. */
|
|
42
|
+
function displayName(name, email) {
|
|
43
|
+
if (name?.trim())
|
|
44
|
+
return name.trim();
|
|
45
|
+
const local = email?.split('@')[0];
|
|
46
|
+
return local?.trim() || '';
|
|
47
|
+
}
|
|
48
|
+
function UserMenu({ name, email, avatar, groups = [], theme, onSignOut, signOutLabel = 'Sign out', children, label = true, height = 44, }) {
|
|
49
|
+
const [open, setOpen] = (0, react_1.useState)(false);
|
|
50
|
+
const track = (0, instrument_1.useEmit)();
|
|
51
|
+
const shown = displayName(name, email);
|
|
52
|
+
const filled = groups.filter((g) => g.length > 0);
|
|
53
|
+
const close = () => setOpen(false);
|
|
54
|
+
return ((0, jsx_runtime_1.jsxs)(gui_1.Popover, { open: open, onOpenChange: (next) => {
|
|
55
|
+
track({ component: 'UserMenu', action: next ? 'open' : 'close' });
|
|
56
|
+
setOpen(next);
|
|
57
|
+
}, placement: "bottom-end", children: [(0, jsx_runtime_1.jsx)(gui_1.Popover.Trigger, { asChild: true, children: (0, jsx_runtime_1.jsxs)(gui_1.XStack, { cursor: "pointer", items: "center", gap: "$2.5", height: height, px: "$2", rounded: "$3", minW: 0, hoverStyle: { bg: '$color4' }, role: "button", tabIndex: 0, "aria-label": shown ? `${shown} · account` : 'Account', children: [avatar || shown ? ((0, jsx_runtime_1.jsx)(OrgMark_1.OrgMark, { org: { name: shown || 'Account', logo: avatar }, size: 30 })) : ((0, jsx_runtime_1.jsx)(lucide_icons_2_1.UserRound, { size: 18 })), label && shown ? ((0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$3", fontWeight: "600", color: "$color12", numberOfLines: 1, maxW: 160, children: shown })) : null] }) }), (0, jsx_runtime_1.jsx)(gui_1.Popover.Content, { bordered: true, elevate: true, p: "$2", width: 240, bg: "$color2", borderColor: "$borderColor", children: children ?? ((0, jsx_runtime_1.jsxs)(gui_1.YStack, { gap: "$1", children: [shown || email ? ((0, jsx_runtime_1.jsxs)(gui_1.YStack, { gap: "$0.5", px: "$2", py: "$1.5", children: [shown ? ((0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$2", fontWeight: "700", color: "$color12", numberOfLines: 1, children: shown })) : null, email && email !== shown ? ((0, jsx_runtime_1.jsx)(gui_1.Text, { fontSize: "$1", color: "$color10", numberOfLines: 1, children: email })) : null] })) : null, filled.map((group, i) => ((0, jsx_runtime_1.jsxs)(gui_1.YStack, { gap: "$1", children: [(i > 0 || shown || email) ? (0, jsx_runtime_1.jsx)(gui_1.Separator, { borderColor: "$borderColor", my: "$1" }) : null, group.map((item) => ((0, jsx_runtime_1.jsx)(Row, { item: item, onDone: close }, item.id)))] }, i))), theme !== null ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(gui_1.Separator, { borderColor: "$borderColor", my: "$1" }), (0, jsx_runtime_1.jsxs)(gui_1.XStack, { items: "center", gap: "$2.5", px: "$2", py: "$1", rounded: "$3", children: [(0, jsx_runtime_1.jsx)(gui_1.Text, { flex: 1, fontSize: "$2", color: "$color12", children: "Theme" }), theme ?? (0, jsx_runtime_1.jsx)(ThemeToggle_1.ThemeToggle, {})] })] })) : null, onSignOut ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(gui_1.Separator, { borderColor: "$borderColor", my: "$1" }), (0, jsx_runtime_1.jsx)(Row, { item: {
|
|
58
|
+
id: 'sign-out',
|
|
59
|
+
label: signOutLabel,
|
|
60
|
+
icon: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.LogOut, { size: 15 }),
|
|
61
|
+
onPress: onSignOut,
|
|
62
|
+
}, onDone: close })] })) : null] })) })] }));
|
|
63
|
+
}
|