@xenide-io/the-old-ui-theme 0.7.0 → 0.7.1
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/{chunk-VXISSXTB.mjs → chunk-YB4TBWHV.mjs} +1423 -375
- package/dist/index.mjs +43 -45
- package/dist/suite.d.mts +24 -1
- package/dist/suite.d.ts +24 -1
- package/dist/suite.js +1500 -285
- package/dist/suite.mjs +80 -1
- package/dist/ui.mjs +10 -12
- package/package.json +1 -1
- package/src/suite/components/suite-integration-picker.tsx +68 -0
- package/src/suite/index.ts +5 -0
- package/dist/chunk-KDR6HI6F.mjs +0 -1075
package/dist/suite.mjs
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
+
Button,
|
|
2
3
|
DropdownItem,
|
|
3
4
|
DropdownMenu,
|
|
5
|
+
Input,
|
|
6
|
+
Modal,
|
|
4
7
|
Tooltip
|
|
5
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-YB4TBWHV.mjs";
|
|
6
9
|
import {
|
|
7
10
|
SuiteThemeProvider,
|
|
8
11
|
useSuiteTheme
|
|
@@ -3625,6 +3628,81 @@ function SuiteAppLayout({
|
|
|
3625
3628
|
}
|
|
3626
3629
|
);
|
|
3627
3630
|
}
|
|
3631
|
+
|
|
3632
|
+
// src/suite/components/suite-integration-picker.tsx
|
|
3633
|
+
import { useMemo, useState as useState10 } from "react";
|
|
3634
|
+
import { NavArrowDown as NavArrowDown2, NavArrowUp, Server as Plug, Xmark } from "iconoir-react";
|
|
3635
|
+
import { jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3636
|
+
var DESCRIPTION_LIMIT = 90;
|
|
3637
|
+
function SuiteIntegrationPicker({
|
|
3638
|
+
open,
|
|
3639
|
+
items,
|
|
3640
|
+
connectedItems = [],
|
|
3641
|
+
loading = false,
|
|
3642
|
+
onClose,
|
|
3643
|
+
onConnect,
|
|
3644
|
+
onDisconnect,
|
|
3645
|
+
title = "Integrate an app",
|
|
3646
|
+
description = "Connect an app to this workspace securely.",
|
|
3647
|
+
dataTest = "suite-integration-picker"
|
|
3648
|
+
}) {
|
|
3649
|
+
const [query, setQuery] = useState10("");
|
|
3650
|
+
const [category, setCategory] = useState10("all");
|
|
3651
|
+
const [expanded, setExpanded] = useState10(null);
|
|
3652
|
+
const categories = useMemo(
|
|
3653
|
+
() => Array.from(new Set(items.flatMap((item) => {
|
|
3654
|
+
var _a;
|
|
3655
|
+
return (_a = item.categories) != null ? _a : [];
|
|
3656
|
+
}))).sort(),
|
|
3657
|
+
[items]
|
|
3658
|
+
);
|
|
3659
|
+
const filtered = items.filter((item) => {
|
|
3660
|
+
var _a;
|
|
3661
|
+
const haystack = `${item.label} ${item.description}`.toLowerCase();
|
|
3662
|
+
return haystack.includes(query.trim().toLowerCase()) && (category === "all" || ((_a = item.categories) != null ? _a : []).includes(category));
|
|
3663
|
+
});
|
|
3664
|
+
return /* @__PURE__ */ jsx24(Modal, { open, onClose, title, description, size: "xl", dataTest, children: /* @__PURE__ */ jsxs21("div", { className: "space-y-4", children: [
|
|
3665
|
+
/* @__PURE__ */ jsx24(Input, { value: query, onChange: (event) => setQuery(event.target.value), placeholder: "Search apps...", "aria-label": "Search apps" }),
|
|
3666
|
+
/* @__PURE__ */ jsx24("div", { className: "flex flex-wrap gap-2", role: "group", "aria-label": "Integration categories", children: ["all", ...categories].map((value) => /* @__PURE__ */ jsx24("button", { type: "button", onClick: () => setCategory(value), className: category === value ? "rounded-full bg-ph-brand px-3 py-1.5 text-xs font-semibold text-white" : "rounded-full border border-ph-border px-3 py-1.5 text-xs text-ph-subtle hover:bg-ph-muted", children: value === "all" ? "All apps" : value }, value)) }),
|
|
3667
|
+
loading ? /* @__PURE__ */ jsx24("p", { className: "text-sm text-ph-subtle", children: "Loading apps..." }) : /* @__PURE__ */ jsx24("div", { className: "grid max-h-[60vh] gap-3 overflow-y-auto sm:grid-cols-2 lg:grid-cols-3", children: filtered.map((item) => {
|
|
3668
|
+
var _a, _b;
|
|
3669
|
+
const isExpanded = expanded === item.id;
|
|
3670
|
+
const longDescription = item.description.length > DESCRIPTION_LIMIT;
|
|
3671
|
+
const text = isExpanded || !longDescription ? item.description : `${item.description.slice(0, DESCRIPTION_LIMIT).trimEnd()}...`;
|
|
3672
|
+
return /* @__PURE__ */ jsxs21("div", { className: "flex min-h-36 flex-col justify-between rounded-xl border border-ph-border bg-ph-surface p-4", children: [
|
|
3673
|
+
/* @__PURE__ */ jsx24("button", { type: "button", className: "text-left", onClick: () => longDescription && setExpanded(isExpanded ? null : item.id), "aria-expanded": isExpanded, children: /* @__PURE__ */ jsxs21("span", { className: "flex items-start gap-3", children: [
|
|
3674
|
+
/* @__PURE__ */ jsx24("span", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-ph-muted text-ph-ink", children: (_a = item.icon) != null ? _a : /* @__PURE__ */ jsx24(Plug, { className: "h-5 w-5", "aria-hidden": true }) }),
|
|
3675
|
+
/* @__PURE__ */ jsxs21("span", { className: "min-w-0", children: [
|
|
3676
|
+
/* @__PURE__ */ jsx24("span", { className: "block font-medium text-ph-ink", children: item.label }),
|
|
3677
|
+
/* @__PURE__ */ jsx24("span", { className: "mt-1 block text-xs text-ph-subtle", children: text }),
|
|
3678
|
+
longDescription ? /* @__PURE__ */ jsxs21("span", { className: "mt-1 block text-xs font-medium text-ph-brand", children: [
|
|
3679
|
+
isExpanded ? "See less" : "See more",
|
|
3680
|
+
" ",
|
|
3681
|
+
isExpanded ? /* @__PURE__ */ jsx24(NavArrowUp, { className: "inline h-3 w-3" }) : /* @__PURE__ */ jsx24(NavArrowDown2, { className: "inline h-3 w-3" })
|
|
3682
|
+
] }) : null
|
|
3683
|
+
] })
|
|
3684
|
+
] }) }),
|
|
3685
|
+
/* @__PURE__ */ jsx24(Button, { type: "button", variant: "primary", className: "mt-3 self-start", disabled: Boolean(item.unavailableReason) || item.connecting, onClick: () => onConnect(item), children: /* @__PURE__ */ jsxs21("span", { className: "flex items-center gap-1.5", children: [
|
|
3686
|
+
/* @__PURE__ */ jsx24(Plug, { className: "h-3.5 w-3.5", "aria-hidden": true }),
|
|
3687
|
+
item.connecting ? "Connecting..." : (_b = item.unavailableReason) != null ? _b : "Connect"
|
|
3688
|
+
] }) })
|
|
3689
|
+
] }, item.id);
|
|
3690
|
+
}) }),
|
|
3691
|
+
connectedItems.length > 0 && onDisconnect ? /* @__PURE__ */ jsxs21("div", { className: "space-y-2 border-t border-ph-border pt-4", children: [
|
|
3692
|
+
/* @__PURE__ */ jsx24("h3", { className: "font-medium text-ph-ink", children: "Connected apps" }),
|
|
3693
|
+
connectedItems.map((item) => /* @__PURE__ */ jsxs21("div", { className: "flex items-center justify-between gap-3 rounded-lg border border-ph-border bg-ph-muted p-3", children: [
|
|
3694
|
+
/* @__PURE__ */ jsxs21("span", { className: "flex min-w-0 items-center gap-2 text-sm text-ph-ink", children: [
|
|
3695
|
+
item.icon,
|
|
3696
|
+
/* @__PURE__ */ jsx24("span", { className: "truncate", children: item.label })
|
|
3697
|
+
] }),
|
|
3698
|
+
/* @__PURE__ */ jsx24(Button, { type: "button", variant: "danger", onClick: () => onDisconnect(item), children: /* @__PURE__ */ jsxs21("span", { className: "flex items-center gap-1.5", children: [
|
|
3699
|
+
/* @__PURE__ */ jsx24(Xmark, { className: "h-4 w-4", "aria-hidden": true }),
|
|
3700
|
+
"Disconnect"
|
|
3701
|
+
] }) })
|
|
3702
|
+
] }, item.id))
|
|
3703
|
+
] }) : null
|
|
3704
|
+
] }) });
|
|
3705
|
+
}
|
|
3628
3706
|
export {
|
|
3629
3707
|
APP_ACCENTS,
|
|
3630
3708
|
APP_GLYPHS,
|
|
@@ -3660,6 +3738,7 @@ export {
|
|
|
3660
3738
|
SuiteBreadcrumbs,
|
|
3661
3739
|
SuiteEmptyState,
|
|
3662
3740
|
SuiteIcon,
|
|
3741
|
+
SuiteIntegrationPicker,
|
|
3663
3742
|
SuiteMobileDrawer,
|
|
3664
3743
|
SuiteMobileHeader,
|
|
3665
3744
|
SuiteMotionProvider,
|
package/dist/ui.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
AvatarGroup,
|
|
10
10
|
Badge,
|
|
11
11
|
Button,
|
|
12
|
+
ButtonChrome,
|
|
12
13
|
Calendar,
|
|
13
14
|
Caption,
|
|
14
15
|
Card,
|
|
@@ -20,6 +21,11 @@ import {
|
|
|
20
21
|
ComponentDocs,
|
|
21
22
|
Display,
|
|
22
23
|
Dot,
|
|
24
|
+
DropdownButton,
|
|
25
|
+
DropdownItem,
|
|
26
|
+
DropdownMenu,
|
|
27
|
+
DropdownRadioGroup,
|
|
28
|
+
DropdownRadioItem,
|
|
23
29
|
EmptyState,
|
|
24
30
|
FileUpload,
|
|
25
31
|
FilterBar,
|
|
@@ -32,6 +38,8 @@ import {
|
|
|
32
38
|
H3,
|
|
33
39
|
H4,
|
|
34
40
|
H5,
|
|
41
|
+
IconBase,
|
|
42
|
+
IconByName,
|
|
35
43
|
Input,
|
|
36
44
|
Kbd,
|
|
37
45
|
Label,
|
|
@@ -64,20 +72,10 @@ import {
|
|
|
64
72
|
Textarea,
|
|
65
73
|
ThemeDomSync,
|
|
66
74
|
ThemeSwitcher,
|
|
67
|
-
Toggle
|
|
68
|
-
} from "./chunk-VXISSXTB.mjs";
|
|
69
|
-
import {
|
|
70
|
-
ButtonChrome,
|
|
71
|
-
DropdownButton,
|
|
72
|
-
DropdownItem,
|
|
73
|
-
DropdownMenu,
|
|
74
|
-
DropdownRadioGroup,
|
|
75
|
-
DropdownRadioItem,
|
|
76
|
-
IconBase,
|
|
77
|
-
IconByName,
|
|
75
|
+
Toggle,
|
|
78
76
|
Tooltip,
|
|
79
77
|
TooltipProvider
|
|
80
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-YB4TBWHV.mjs";
|
|
81
79
|
import "./chunk-FWCSY2DS.mjs";
|
|
82
80
|
export {
|
|
83
81
|
Accordion,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xenide-io/the-old-ui-theme",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Props-driven React components and theme tokens inspired by classic interface design \u2014 optimized for Next.js apps and internal tools.",
|
|
5
5
|
"author": "Xenide",
|
|
6
6
|
"license": "MIT",
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useMemo, useState, type ReactNode } from "react";
|
|
4
|
+
import { NavArrowDown, NavArrowUp, Server as Plug, Xmark } from "iconoir-react";
|
|
5
|
+
import { Button, Input, Modal } from "@/components/ui";
|
|
6
|
+
|
|
7
|
+
export interface SuiteIntegrationPickerItem {
|
|
8
|
+
id: string;
|
|
9
|
+
label: string;
|
|
10
|
+
description: string;
|
|
11
|
+
icon?: ReactNode;
|
|
12
|
+
categories?: string[];
|
|
13
|
+
connecting?: boolean;
|
|
14
|
+
unavailableReason?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface SuiteIntegrationPickerProps {
|
|
18
|
+
open: boolean;
|
|
19
|
+
items: SuiteIntegrationPickerItem[];
|
|
20
|
+
connectedItems?: SuiteIntegrationPickerItem[];
|
|
21
|
+
loading?: boolean;
|
|
22
|
+
onClose: () => void;
|
|
23
|
+
onConnect: (item: SuiteIntegrationPickerItem) => void;
|
|
24
|
+
onDisconnect?: (item: SuiteIntegrationPickerItem) => void;
|
|
25
|
+
title?: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
dataTest?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const DESCRIPTION_LIMIT = 90;
|
|
31
|
+
|
|
32
|
+
export function SuiteIntegrationPicker({
|
|
33
|
+
open,
|
|
34
|
+
items,
|
|
35
|
+
connectedItems = [],
|
|
36
|
+
loading = false,
|
|
37
|
+
onClose,
|
|
38
|
+
onConnect,
|
|
39
|
+
onDisconnect,
|
|
40
|
+
title = "Integrate an app",
|
|
41
|
+
description = "Connect an app to this workspace securely.",
|
|
42
|
+
dataTest = "suite-integration-picker",
|
|
43
|
+
}: SuiteIntegrationPickerProps) {
|
|
44
|
+
const [query, setQuery] = useState("");
|
|
45
|
+
const [category, setCategory] = useState("all");
|
|
46
|
+
const [expanded, setExpanded] = useState<string | null>(null);
|
|
47
|
+
const categories = useMemo(
|
|
48
|
+
() => Array.from(new Set(items.flatMap((item) => item.categories ?? []))).sort(),
|
|
49
|
+
[items],
|
|
50
|
+
);
|
|
51
|
+
const filtered = items.filter((item) => {
|
|
52
|
+
const haystack = `${item.label} ${item.description}`.toLowerCase();
|
|
53
|
+
return haystack.includes(query.trim().toLowerCase()) && (category === "all" || (item.categories ?? []).includes(category));
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<Modal open={open} onClose={onClose} title={title} description={description} size="xl" dataTest={dataTest}>
|
|
58
|
+
<div className="space-y-4">
|
|
59
|
+
<Input value={query} onChange={(event) => setQuery(event.target.value)} placeholder="Search apps..." aria-label="Search apps" />
|
|
60
|
+
<div className="flex flex-wrap gap-2" role="group" aria-label="Integration categories">
|
|
61
|
+
{["all", ...categories].map((value) => <button key={value} type="button" onClick={() => setCategory(value)} className={category === value ? "rounded-full bg-ph-brand px-3 py-1.5 text-xs font-semibold text-white" : "rounded-full border border-ph-border px-3 py-1.5 text-xs text-ph-subtle hover:bg-ph-muted"}>{value === "all" ? "All apps" : value}</button>)}
|
|
62
|
+
</div>
|
|
63
|
+
{loading ? <p className="text-sm text-ph-subtle">Loading apps...</p> : <div className="grid max-h-[60vh] gap-3 overflow-y-auto sm:grid-cols-2 lg:grid-cols-3">{filtered.map((item) => { const isExpanded = expanded === item.id; const longDescription = item.description.length > DESCRIPTION_LIMIT; const text = isExpanded || !longDescription ? item.description : `${item.description.slice(0, DESCRIPTION_LIMIT).trimEnd()}...`; return <div key={item.id} className="flex min-h-36 flex-col justify-between rounded-xl border border-ph-border bg-ph-surface p-4"><button type="button" className="text-left" onClick={() => longDescription && setExpanded(isExpanded ? null : item.id)} aria-expanded={isExpanded}><span className="flex items-start gap-3"><span className="flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-ph-muted text-ph-ink">{item.icon ?? <Plug className="h-5 w-5" aria-hidden />}</span><span className="min-w-0"><span className="block font-medium text-ph-ink">{item.label}</span><span className="mt-1 block text-xs text-ph-subtle">{text}</span>{longDescription ? <span className="mt-1 block text-xs font-medium text-ph-brand">{isExpanded ? "See less" : "See more"} {isExpanded ? <NavArrowUp className="inline h-3 w-3" /> : <NavArrowDown className="inline h-3 w-3" />}</span> : null}</span></span></button><Button type="button" variant="primary" className="mt-3 self-start" disabled={Boolean(item.unavailableReason) || item.connecting} onClick={() => onConnect(item)}><span className="flex items-center gap-1.5"><Plug className="h-3.5 w-3.5" aria-hidden />{item.connecting ? "Connecting..." : item.unavailableReason ?? "Connect"}</span></Button></div>; })}</div>}
|
|
64
|
+
{connectedItems.length > 0 && onDisconnect ? <div className="space-y-2 border-t border-ph-border pt-4"><h3 className="font-medium text-ph-ink">Connected apps</h3>{connectedItems.map((item) => <div key={item.id} className="flex items-center justify-between gap-3 rounded-lg border border-ph-border bg-ph-muted p-3"><span className="flex min-w-0 items-center gap-2 text-sm text-ph-ink">{item.icon}<span className="truncate">{item.label}</span></span><Button type="button" variant="danger" onClick={() => onDisconnect(item)}><span className="flex items-center gap-1.5"><Xmark className="h-4 w-4" aria-hidden />Disconnect</span></Button></div>)}</div> : null}
|
|
65
|
+
</div>
|
|
66
|
+
</Modal>
|
|
67
|
+
);
|
|
68
|
+
}
|
package/src/suite/index.ts
CHANGED
|
@@ -147,3 +147,8 @@ export {
|
|
|
147
147
|
SuiteAppLayout,
|
|
148
148
|
type SuiteAppLayoutProps,
|
|
149
149
|
} from "./components/suite-app-layout";
|
|
150
|
+
export {
|
|
151
|
+
SuiteIntegrationPicker,
|
|
152
|
+
type SuiteIntegrationPickerItem,
|
|
153
|
+
type SuiteIntegrationPickerProps,
|
|
154
|
+
} from "./components/suite-integration-picker";
|