@okjt/dashboard 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AccountMenu.js +1 -1
- package/dist/ActivityPanel.js +3 -3
- package/dist/AdminPageHero.js +2 -2
- package/dist/AdminSidePanel.js +4 -4
- package/dist/AdminSummaryCards.js +1 -1
- package/dist/AdminToolbarFilters.js +4 -4
- package/dist/AdminTutorial.js +1 -1
- package/dist/BoldToolbar.js +2 -2
- package/dist/CollaboratorAvatars.js +2 -2
- package/dist/DashboardProvider.js +1 -1
- package/dist/DashboardSidebar.js +1 -1
- package/dist/ShareModal.js +1 -1
- package/dist/TwoPaneDialog.js +1 -1
- package/dist/VersionHistoryDrawer.js +3 -3
- package/dist/useAdminAction.js +12 -9
- package/package.json +2 -2
package/dist/AccountMenu.js
CHANGED
|
@@ -48,7 +48,7 @@ function AccountMenu({ compactLinks = [], links = [], roleText, extra, fallbackN
|
|
|
48
48
|
/* @__PURE__ */ jsxs("div", { className: "px-4 py-2 border-b border-tone-100 mb-1", children: [
|
|
49
49
|
/* @__PURE__ */ jsx("p", { className: "text-sm font-semibold text-tone-800 truncate", children: user?.name || fallbackName }),
|
|
50
50
|
user?.email && /* @__PURE__ */ jsx("p", { className: "text-xs text-tone-500 truncate", children: user.email }),
|
|
51
|
-
roleText && /* @__PURE__ */ jsx("p", { className: "text-[11px] text-accent font-medium mt-0.5", children: roleText })
|
|
51
|
+
roleText && /* @__PURE__ */ jsx("p", { className: "text-[length:max(11px,var(--okjt-min-text,0px))] text-accent font-medium mt-0.5", children: roleText })
|
|
52
52
|
] }),
|
|
53
53
|
extra?.({ itemClass, close }),
|
|
54
54
|
compactLinks.length > 0 && /* @__PURE__ */ jsx("div", { className: "md:hidden border-b border-tone-100 pb-1 mb-1", children: compactLinks.map((link) => /* @__PURE__ */ jsxs(Link, { to: link.path, role: "menuitem", onClick: close, className: itemClass, children: [
|
package/dist/ActivityPanel.js
CHANGED
|
@@ -18,7 +18,7 @@ function ActivityPanel() {
|
|
|
18
18
|
});
|
|
19
19
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-5", children: [
|
|
20
20
|
/* @__PURE__ */ jsxs("section", { className: "space-y-2", children: [
|
|
21
|
-
/* @__PURE__ */ jsx("h3", { className: "text-[11px] font-bold uppercase tracking-wider text-tone-500", children: "On this page" }),
|
|
21
|
+
/* @__PURE__ */ jsx("h3", { className: "text-[length:max(11px,var(--okjt-min-text,0px))] font-bold uppercase tracking-wider text-tone-500", children: "On this page" }),
|
|
22
22
|
othersHere.length ? /* @__PURE__ */ jsxs("ul", { className: "space-y-1.5", children: [
|
|
23
23
|
othersHere.map((person) => /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-2 text-sm text-tone-700", children: [
|
|
24
24
|
/* @__PURE__ */ jsx(CollaboratorAvatar, { person, size: "xs" }),
|
|
@@ -29,14 +29,14 @@ function ActivityPanel() {
|
|
|
29
29
|
] }) : /* @__PURE__ */ jsx("p", { className: "text-xs text-tone-500", children: "Only you right now." })
|
|
30
30
|
] }),
|
|
31
31
|
/* @__PURE__ */ jsxs("section", { className: "space-y-2", children: [
|
|
32
|
-
/* @__PURE__ */ jsx("h3", { className: "text-[11px] font-bold uppercase tracking-wider text-tone-500", children: "Recent changes" }),
|
|
32
|
+
/* @__PURE__ */ jsx("h3", { className: "text-[length:max(11px,var(--okjt-min-text,0px))] font-bold uppercase tracking-wider text-tone-500", children: "Recent changes" }),
|
|
33
33
|
isLoading ? /* @__PURE__ */ jsx("p", { className: "text-xs text-tone-400", children: "Loading\u2026" }) : recent.length ? /* @__PURE__ */ jsx("ul", { className: "space-y-2", children: recent.map((r) => /* @__PURE__ */ jsxs("li", { className: "text-xs text-tone-600 leading-snug", children: [
|
|
34
34
|
/* @__PURE__ */ jsx("span", { className: "font-medium text-tone-800", children: r.user?.name || anonymousName }),
|
|
35
35
|
" ",
|
|
36
36
|
ACTION_WORDS[r.action] || r.action,
|
|
37
37
|
" ",
|
|
38
38
|
/* @__PURE__ */ jsx("span", { className: "font-medium text-tone-800", children: r.subject_label }),
|
|
39
|
-
/* @__PURE__ */ jsx("span", { className: "block text-[11px] text-tone-400", children: formatDistanceToNow(new Date(r.updated_at || r.created_at), { addSuffix: true }) })
|
|
39
|
+
/* @__PURE__ */ jsx("span", { className: "block text-[length:max(11px,var(--okjt-min-text,0px))] text-tone-400", children: formatDistanceToNow(new Date(r.updated_at || r.created_at), { addSuffix: true }) })
|
|
40
40
|
] }, r.id)) }) : /* @__PURE__ */ jsx("p", { className: "text-xs text-tone-500", children: "No changes recorded here yet." }),
|
|
41
41
|
/* @__PURE__ */ jsx(Button, { size: "sm", icon: History, fullWidth: true, onClick: openHistory, children: "Version history" })
|
|
42
42
|
] }),
|
package/dist/AdminPageHero.js
CHANGED
|
@@ -44,7 +44,7 @@ function PlainPageHero({ title, description, breadcrumb, icon }) {
|
|
|
44
44
|
children: [
|
|
45
45
|
icon && /* @__PURE__ */ jsx("div", { className: "w-8 h-8 rounded-lg flex items-center justify-center shrink-0", style: { background: "color-mix(in srgb, var(--color-accent) 10%, transparent)" }, children: icon }),
|
|
46
46
|
/* @__PURE__ */ jsxs("div", { className: "min-w-0 leading-tight", children: [
|
|
47
|
-
parent && /* @__PURE__ */ jsx("p", { className: "hidden sm:block text-[11px] text-tone-400 truncate", children: parent.path ? /* @__PURE__ */ jsx(Link, { to: parent.path, className: "hover:text-accent", children: parent.label }) : parent.label }),
|
|
47
|
+
parent && /* @__PURE__ */ jsx("p", { className: "hidden sm:block text-[length:max(11px,var(--okjt-min-text,0px))] text-tone-400 truncate", children: parent.path ? /* @__PURE__ */ jsx(Link, { to: parent.path, className: "hover:text-accent", children: parent.label }) : parent.label }),
|
|
48
48
|
/* @__PURE__ */ jsx("p", { className: "text-base font-semibold text-body truncate", children: title })
|
|
49
49
|
] }),
|
|
50
50
|
/* @__PURE__ */ jsx(
|
|
@@ -127,7 +127,7 @@ function BoldPageHero({ title, subtitle, description, breadcrumbs = [], breadcru
|
|
|
127
127
|
className: "flex items-center gap-3 min-w-0",
|
|
128
128
|
children: [
|
|
129
129
|
/* @__PURE__ */ jsxs("div", { className: "min-w-0 leading-tight", children: [
|
|
130
|
-
parent && /* @__PURE__ */ jsx("p", { className: "hidden sm:block text-[11px] text-soft truncate", children: parentTo ? /* @__PURE__ */ jsx(Link, { to: parentTo, className: "hover:text-ink transition", children: parent.label }) : parent.label }),
|
|
130
|
+
parent && /* @__PURE__ */ jsx("p", { className: "hidden sm:block text-[length:max(11px,var(--okjt-min-text,0px))] text-soft truncate", children: parentTo ? /* @__PURE__ */ jsx(Link, { to: parentTo, className: "hover:text-ink transition", children: parent.label }) : parent.label }),
|
|
131
131
|
/* @__PURE__ */ jsx("p", { className: "text-ink font-semibold truncate", children: title })
|
|
132
132
|
] }),
|
|
133
133
|
/* @__PURE__ */ jsxs(
|
package/dist/AdminSidePanel.js
CHANGED
|
@@ -10,7 +10,7 @@ const Named = ({ name, fallback: Fallback, className }) => /* @__PURE__ */ jsx(D
|
|
|
10
10
|
function Badge({ item }) {
|
|
11
11
|
if (useLook() === "bold") return /* @__PURE__ */ jsx(BoldBadge, { item });
|
|
12
12
|
if (item.badge > 0) {
|
|
13
|
-
return /* @__PURE__ */ jsx("span", { className: "ml-auto shrink-0 min-w-[1.25rem] h-5 px-1.5 rounded-full bg-accent/15 text-accent-dark text-[11px] font-semibold flex items-center justify-center", children: item.badge > 99 ? "99+" : item.badge });
|
|
13
|
+
return /* @__PURE__ */ jsx("span", { className: "ml-auto shrink-0 min-w-[1.25rem] h-5 px-1.5 rounded-full bg-accent/15 text-accent-dark text-[length:max(11px,var(--okjt-min-text,0px))] font-semibold flex items-center justify-center", children: item.badge > 99 ? "99+" : item.badge });
|
|
14
14
|
}
|
|
15
15
|
if (item.dot) {
|
|
16
16
|
return /* @__PURE__ */ jsx("span", { className: "ml-auto shrink-0 w-2 h-2 rounded-full bg-amber-500", "aria-label": "Unsaved changes" });
|
|
@@ -22,7 +22,7 @@ function Badge({ item }) {
|
|
|
22
22
|
}
|
|
23
23
|
function BoldBadge({ item }) {
|
|
24
24
|
if (item.badge > 0) {
|
|
25
|
-
return /* @__PURE__ */ jsx("span", { className: "ml-auto flex h-5 min-w-[1.25rem] shrink-0 items-center justify-center rounded-full bg-accent/15 px-1.5 text-[11px] font-semibold text-accent-dark", children: item.badge > 99 ? "99+" : item.badge });
|
|
25
|
+
return /* @__PURE__ */ jsx("span", { className: "ml-auto flex h-5 min-w-[1.25rem] shrink-0 items-center justify-center rounded-full bg-accent/15 px-1.5 text-[length:max(11px,var(--okjt-min-text,0px))] font-semibold text-accent-dark", children: item.badge > 99 ? "99+" : item.badge });
|
|
26
26
|
}
|
|
27
27
|
if (item.dot) return /* @__PURE__ */ jsx("span", { className: "ml-auto h-2 w-2 shrink-0 rounded-full bg-amber-400", "aria-label": "Unsaved changes" });
|
|
28
28
|
if (item.count != null) return /* @__PURE__ */ jsx("span", { className: "ml-auto shrink-0 text-xs tabular-nums text-tone-400", children: item.count });
|
|
@@ -48,7 +48,7 @@ function SidePanelNav({ panel, onPicked, selection, manage = {} }) {
|
|
|
48
48
|
role: "tab",
|
|
49
49
|
"aria-selected": active,
|
|
50
50
|
onClick: () => pick(item.id),
|
|
51
|
-
className: `relative flex flex-col items-center gap-1 py-2 px-0.5 rounded-xl text-[10px] font-semibold uppercase tracking-wide transition-colors border ${active ? "bg-accent/10 border-accent/30 text-accent-dark" : "border-transparent text-tone-500 hover:bg-tone-50 hover:text-tone-700"}`,
|
|
51
|
+
className: `relative flex flex-col items-center gap-1 py-2 px-0.5 rounded-xl text-[length:max(10px,var(--okjt-min-text,0px))] font-semibold uppercase tracking-wide transition-colors border ${active ? "bg-accent/10 border-accent/30 text-accent-dark" : "border-transparent text-tone-500 hover:bg-tone-50 hover:text-tone-700"}`,
|
|
52
52
|
children: [
|
|
53
53
|
Icon && /* @__PURE__ */ jsx(Icon, { className: "w-4 h-4", "aria-hidden": "true" }),
|
|
54
54
|
item.label,
|
|
@@ -68,7 +68,7 @@ function SidePanelNav({ panel, onPicked, selection, manage = {} }) {
|
|
|
68
68
|
const selecting = !!selection?.selecting;
|
|
69
69
|
const canReorder = !!manage.canReorder && !selecting && movable.length > 1;
|
|
70
70
|
const row = ({ item, groupStart }, leading) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
71
|
-
groupStart && /* @__PURE__ */ jsx("p", { className: `${look === "bold" ? "px-2.5 pb-1 text-xs font-semibold capitalize text-tone-400" : "px-2 pb-1 text-[10px] font-bold uppercase tracking-[0.16em] text-tone-400"} ${groupStart === "later" ? "pt-3" : ""}`, children: item.group }),
|
|
71
|
+
groupStart && /* @__PURE__ */ jsx("p", { className: `${look === "bold" ? "px-2.5 pb-1 text-xs font-semibold capitalize text-tone-400" : "px-2 pb-1 text-[length:max(10px,var(--okjt-min-text,0px))] font-bold uppercase tracking-[0.16em] text-tone-400"} ${groupStart === "later" ? "pt-3" : ""}`, children: item.group }),
|
|
72
72
|
/* @__PURE__ */ jsx(
|
|
73
73
|
ItemRow,
|
|
74
74
|
{
|
|
@@ -93,7 +93,7 @@ function BoldStatCard({ icon, label, value, trend, hint, onClick, active = false
|
|
|
93
93
|
{
|
|
94
94
|
icon: up ? "trend-up" : down ? "trend-down" : "trend-flat",
|
|
95
95
|
fallback: up ? TrendingUp : down ? TrendingDown : Minus,
|
|
96
|
-
className: `${trendColor} text-[10px]`
|
|
96
|
+
className: `${trendColor} text-[length:max(10px,var(--okjt-min-text,0px))]`
|
|
97
97
|
}
|
|
98
98
|
),
|
|
99
99
|
/* @__PURE__ */ jsxs("span", { className: `text-xs font-medium ${trendColor}`, children: [
|
|
@@ -60,7 +60,7 @@ function AdminToolbarFilters({ filters }) {
|
|
|
60
60
|
children: [
|
|
61
61
|
/* @__PURE__ */ jsx(SlidersHorizontal, { className: "w-4 h-4" }),
|
|
62
62
|
/* @__PURE__ */ jsx("span", { className: "hidden sm:inline max-w-[10rem] truncate", children: buttonLabel }),
|
|
63
|
-
activeCount > 0 && /* @__PURE__ */ jsx("span", { className: "min-w-5 h-5 px-1 rounded-full bg-accent text-white text-[10px] font-bold flex items-center justify-center", children: activeCount })
|
|
63
|
+
activeCount > 0 && /* @__PURE__ */ jsx("span", { className: "min-w-5 h-5 px-1 rounded-full bg-accent text-white text-[length:max(10px,var(--okjt-min-text,0px))] font-bold flex items-center justify-center", children: activeCount })
|
|
64
64
|
]
|
|
65
65
|
}
|
|
66
66
|
),
|
|
@@ -76,7 +76,7 @@ function AdminToolbarFilters({ filters }) {
|
|
|
76
76
|
className: "absolute bottom-full left-0 mb-3 w-[min(20rem,calc(100vw-2rem))] max-h-[60vh] overflow-y-auto bg-surface rounded-2xl shadow-2xl border border-tone-100 p-4 space-y-4 text-left",
|
|
77
77
|
children: [
|
|
78
78
|
groups.map((group) => /* @__PURE__ */ jsxs("div", { children: [
|
|
79
|
-
/* @__PURE__ */ jsx("p", { className: "text-[11px] font-semibold uppercase tracking-wider text-tone-500 mb-2", children: group.label || "Show" }),
|
|
79
|
+
/* @__PURE__ */ jsx("p", { className: "text-[length:max(11px,var(--okjt-min-text,0px))] font-semibold uppercase tracking-wider text-tone-500 mb-2", children: group.label || "Show" }),
|
|
80
80
|
/* @__PURE__ */ jsx(
|
|
81
81
|
SegmentedControl,
|
|
82
82
|
{
|
|
@@ -100,7 +100,7 @@ function AdminToolbarFilters({ filters }) {
|
|
|
100
100
|
)
|
|
101
101
|
] }, group.id)),
|
|
102
102
|
sort && /* @__PURE__ */ jsxs("div", { children: [
|
|
103
|
-
/* @__PURE__ */ jsx("p", { className: "text-[11px] font-semibold uppercase tracking-wider text-tone-500 mb-2", children: sort.label || "Sort by" }),
|
|
103
|
+
/* @__PURE__ */ jsx("p", { className: "text-[length:max(11px,var(--okjt-min-text,0px))] font-semibold uppercase tracking-wider text-tone-500 mb-2", children: sort.label || "Sort by" }),
|
|
104
104
|
/* @__PURE__ */ jsx(
|
|
105
105
|
"select",
|
|
106
106
|
{
|
|
@@ -114,7 +114,7 @@ function AdminToolbarFilters({ filters }) {
|
|
|
114
114
|
] }),
|
|
115
115
|
filters.extra && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: filters.extra }),
|
|
116
116
|
views && /* @__PURE__ */ jsxs("div", { children: [
|
|
117
|
-
/* @__PURE__ */ jsx("p", { className: "text-[11px] font-semibold uppercase tracking-wider text-tone-500 mb-2", children: "Saved views" }),
|
|
117
|
+
/* @__PURE__ */ jsx("p", { className: "text-[length:max(11px,var(--okjt-min-text,0px))] font-semibold uppercase tracking-wider text-tone-500 mb-2", children: "Saved views" }),
|
|
118
118
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-1.5", children: [
|
|
119
119
|
views.items.map((view2) => /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center rounded-lg bg-tone-50 text-sm text-tone-700", children: [
|
|
120
120
|
/* @__PURE__ */ jsxs("button", { type: "button", onClick: () => {
|
package/dist/AdminTutorial.js
CHANGED
|
@@ -203,7 +203,7 @@ function AdminTutorial({ steps: allSteps, onComplete, isRestarted = false, open,
|
|
|
203
203
|
/* @__PURE__ */ jsx("div", { className: "p-6 pb-0", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-start mb-4", children: [
|
|
204
204
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
205
205
|
/* @__PURE__ */ jsx("div", { className: "w-10 h-10 rounded-xl bg-accent/10 flex items-center justify-center", children: currentStep === steps.length - 1 ? /* @__PURE__ */ jsx(Trophy, { className: "w-5 h-5 text-accent" }) : /* @__PURE__ */ jsx("span", { className: "text-accent font-bold text-base", children: currentStep + 1 }) }),
|
|
206
|
-
currentStep === 0 && /* @__PURE__ */ jsx("span", { className: "bg-accent/10 text-accent text-[10px] uppercase tracking-wider font-bold px-2 py-1 rounded-md", children: "New Feature" })
|
|
206
|
+
currentStep === 0 && /* @__PURE__ */ jsx("span", { className: "bg-accent/10 text-accent text-[length:max(10px,var(--okjt-min-text,0px))] uppercase tracking-wider font-bold px-2 py-1 rounded-md", children: "New Feature" })
|
|
207
207
|
] }),
|
|
208
208
|
/* @__PURE__ */ jsx(
|
|
209
209
|
"button",
|
package/dist/BoldToolbar.js
CHANGED
|
@@ -74,7 +74,7 @@ function FiltersMenu({ filters, search, storageKey }) {
|
|
|
74
74
|
children: [
|
|
75
75
|
/* @__PURE__ */ jsx(Named, { name: "filters", fallback: SlidersHorizontal }),
|
|
76
76
|
/* @__PURE__ */ jsx("span", { className: "hidden sm:inline", children: "Filters" }),
|
|
77
|
-
active > 0 && /* @__PURE__ */ jsx("span", { className: "min-w-[1.25rem] h-5 px-1 rounded-full bg-accent text-[11px] leading-5 text-white text-center", children: active })
|
|
77
|
+
active > 0 && /* @__PURE__ */ jsx("span", { className: "min-w-[1.25rem] h-5 px-1 rounded-full bg-accent text-[length:max(11px,var(--okjt-min-text,0px))] leading-5 text-white text-center", children: active })
|
|
78
78
|
]
|
|
79
79
|
}
|
|
80
80
|
),
|
|
@@ -210,7 +210,7 @@ function BoldToolbar({ search, filters = [], view, actions = [], selection, chil
|
|
|
210
210
|
className: "w-40 sm:w-56 sm:focus:w-72 rounded-xl border border-contrast/10 bg-contrast/5 py-2 pl-9 pr-9 text-sm transition-all"
|
|
211
211
|
}
|
|
212
212
|
),
|
|
213
|
-
/* @__PURE__ */ jsx("kbd", { className: "pointer-events-none absolute right-2.5 top-1/2 -translate-y-1/2 hidden sm:block rounded border border-contrast/15 px-1.5 text-[10px] text-soft", children: "/" })
|
|
213
|
+
/* @__PURE__ */ jsx("kbd", { className: "pointer-events-none absolute right-2.5 top-1/2 -translate-y-1/2 hidden sm:block rounded border border-contrast/15 px-1.5 text-[length:max(10px,var(--okjt-min-text,0px))] text-soft", children: "/" })
|
|
214
214
|
] }),
|
|
215
215
|
filters.length > 0 && /* @__PURE__ */ jsx(FiltersMenu, { filters, search, storageKey }),
|
|
216
216
|
view && view.modes?.length > 1 && /* @__PURE__ */ jsx("div", { className: "flex gap-1 rounded-xl border border-contrast/10 bg-ink-deep/30 p-1", children: view.modes.map((mode) => /* @__PURE__ */ jsx(
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { collaboratorColor, initials, useModules } from "./modules.js";
|
|
3
3
|
const SIZES = {
|
|
4
|
-
xs: "w-5 h-5 text-[9px]",
|
|
5
|
-
sm: "w-7 h-7 text-[11px]",
|
|
4
|
+
xs: "w-5 h-5 text-[length:max(9px,var(--okjt-min-text,0px))]",
|
|
5
|
+
sm: "w-7 h-7 text-[length:max(11px,var(--okjt-min-text,0px))]",
|
|
6
6
|
md: "w-9 h-9 text-xs"
|
|
7
7
|
};
|
|
8
8
|
function CollaboratorAvatar({ person, size = "sm", className = "" }) {
|
|
@@ -41,7 +41,7 @@ const DEFAULT_SHELL = {
|
|
|
41
41
|
logoBoxClass: "p-4",
|
|
42
42
|
logoClass: "h-10 w-auto",
|
|
43
43
|
railLogoClass: "h-9 w-12 object-contain",
|
|
44
|
-
navTitleClass: "px-3 mb-1 text-[10px] font-bold uppercase tracking-[0.18em] text-white/50",
|
|
44
|
+
navTitleClass: "px-3 mb-1 text-[length:max(10px,var(--okjt-min-text,0px))] font-bold uppercase tracking-[0.18em] text-white/50",
|
|
45
45
|
navItemClass: "px-3 py-2 rounded-lg",
|
|
46
46
|
navActiveClass: "text-accent-dark bg-white shadow-sm",
|
|
47
47
|
navIdleClass: "text-white/75 hover:text-accent-dark hover:bg-white",
|
package/dist/DashboardSidebar.js
CHANGED
|
@@ -78,7 +78,7 @@ function DashboardSidebar({ isOpen, onClose, collapsed = false }) {
|
|
|
78
78
|
!rail && /* @__PURE__ */ jsx("span", { className: shell.navLabelClass, children: item.label }),
|
|
79
79
|
!rail && (here.length > 0 || newCount > 0) && /* @__PURE__ */ jsxs("span", { className: "ml-auto flex items-center gap-1.5 shrink-0", "aria-hidden": "true", children: [
|
|
80
80
|
/* @__PURE__ */ jsx(CollaboratorAvatars, { people: here, size: "xs", max: 2 }),
|
|
81
|
-
newCount > 0 && /* @__PURE__ */ jsx("span", { className: `min-w-[1.25rem] h-5 px-1.5 rounded-full ${shell.badgeClass} text-[10px] font-bold flex items-center justify-center`, children: newCount > 99 ? "99+" : newCount })
|
|
81
|
+
newCount > 0 && /* @__PURE__ */ jsx("span", { className: `min-w-[1.25rem] h-5 px-1.5 rounded-full ${shell.badgeClass} text-[length:max(10px,var(--okjt-min-text,0px))] font-bold flex items-center justify-center`, children: newCount > 99 ? "99+" : newCount })
|
|
82
82
|
] }),
|
|
83
83
|
isActive && !rail && /* @__PURE__ */ jsx(
|
|
84
84
|
motion.div,
|
package/dist/ShareModal.js
CHANGED
|
@@ -196,7 +196,7 @@ function ShareModal({ isOpen, onClose }) {
|
|
|
196
196
|
className: selectClass,
|
|
197
197
|
children: ROLES.map((r) => /* @__PURE__ */ jsx("option", { value: r.value, children: r.label }, r.value))
|
|
198
198
|
}
|
|
199
|
-
) : /* @__PURE__ */ jsx("span", { className: "px-2 py-0.5 rounded-full bg-tone-100 text-[11px] font-medium text-tone-600", children: roleLabel(person.role) }),
|
|
199
|
+
) : /* @__PURE__ */ jsx("span", { className: "px-2 py-0.5 rounded-full bg-tone-100 text-[length:max(11px,var(--okjt-min-text,0px))] font-medium text-tone-600", children: roleLabel(person.role) }),
|
|
200
200
|
isOwner && person.pending && /* @__PURE__ */ jsx(
|
|
201
201
|
Button,
|
|
202
202
|
{
|
package/dist/TwoPaneDialog.js
CHANGED
|
@@ -46,7 +46,7 @@ function TwoPaneDialog({ open, title, subtitle, sections, active, onSelect, onCl
|
|
|
46
46
|
"aria-current": on ? "step" : void 0,
|
|
47
47
|
className: `flex w-full items-start gap-3 rounded-xl px-3 py-2 text-left transition-colors ${on ? "bg-ink text-white" : "text-body hover:bg-tint"}`,
|
|
48
48
|
children: [
|
|
49
|
-
/* @__PURE__ */ jsx("span", { className: `mt-0.5 grid h-5 w-5 shrink-0 place-items-center rounded-full text-[11px] font-semibold ${on ? "bg-white/20" : s.done ? "bg-positive text-white" : "bg-line text-soft"}`, children: s.done && !on ? "\u2713" : i + 1 }),
|
|
49
|
+
/* @__PURE__ */ jsx("span", { className: `mt-0.5 grid h-5 w-5 shrink-0 place-items-center rounded-full text-[length:max(11px,var(--okjt-min-text,0px))] font-semibold ${on ? "bg-white/20" : s.done ? "bg-positive text-white" : "bg-line text-soft"}`, children: s.done && !on ? "\u2713" : i + 1 }),
|
|
50
50
|
/* @__PURE__ */ jsxs("span", { className: "min-w-0", children: [
|
|
51
51
|
/* @__PURE__ */ jsx("span", { className: "block text-sm font-semibold", children: s.label }),
|
|
52
52
|
s.hint && /* @__PURE__ */ jsx("span", { className: `hidden text-xs sm:block ${on ? "text-white/70" : "text-tone-500"}`, children: s.hint })
|
|
@@ -38,13 +38,13 @@ function Entry({ revision, batchSize, showModule, onRestore, restoring, canResto
|
|
|
38
38
|
" ",
|
|
39
39
|
/* @__PURE__ */ jsx("span", { className: "font-medium text-tone-900", children: revision.subject_label || revision.subject_type })
|
|
40
40
|
] }),
|
|
41
|
-
/* @__PURE__ */ jsxs("p", { className: "text-[11px] text-tone-500 flex flex-wrap gap-x-2", children: [
|
|
41
|
+
/* @__PURE__ */ jsxs("p", { className: "text-[length:max(11px,var(--okjt-min-text,0px))] text-tone-500 flex flex-wrap gap-x-2", children: [
|
|
42
42
|
/* @__PURE__ */ jsx("span", { title: format(when, "PPpp"), children: formatDistanceToNow(when, { addSuffix: true }) }),
|
|
43
43
|
showModule && /* @__PURE__ */ jsx("span", { className: "px-1.5 rounded bg-tone-100 text-tone-600", children: moduleLabel })
|
|
44
44
|
] }),
|
|
45
45
|
revision.changes?.length > 0 && /* @__PURE__ */ jsxs("ul", { className: "space-y-0.5 pt-0.5", children: [
|
|
46
46
|
revision.changes.slice(0, 4).map((change) => /* @__PURE__ */ jsx(Change, { change }, change.field)),
|
|
47
|
-
revision.changes.length > 4 && /* @__PURE__ */ jsxs("li", { className: "text-[11px] text-tone-400", children: [
|
|
47
|
+
revision.changes.length > 4 && /* @__PURE__ */ jsxs("li", { className: "text-[length:max(11px,var(--okjt-min-text,0px))] text-tone-400", children: [
|
|
48
48
|
"+",
|
|
49
49
|
revision.changes.length - 4,
|
|
50
50
|
" more fields"
|
|
@@ -147,7 +147,7 @@ function VersionHistoryDrawer({ module, onClose, onRestored }) {
|
|
|
147
147
|
const header = day !== lastDay ? day : null;
|
|
148
148
|
lastDay = day;
|
|
149
149
|
return /* @__PURE__ */ jsxs("li", { children: [
|
|
150
|
-
header && /* @__PURE__ */ jsx("h3", { className: "sticky top-0 z-10 bg-surface/95 backdrop-blur pt-3 pb-1 text-[11px] font-bold uppercase tracking-wider text-tone-500", children: header }),
|
|
150
|
+
header && /* @__PURE__ */ jsx("h3", { className: "sticky top-0 z-10 bg-surface/95 backdrop-blur pt-3 pb-1 text-[length:max(11px,var(--okjt-min-text,0px))] font-bold uppercase tracking-wider text-tone-500", children: header }),
|
|
151
151
|
/* @__PURE__ */ jsx("ul", { className: "divide-y divide-tone-100", children: /* @__PURE__ */ jsx(
|
|
152
152
|
Entry,
|
|
153
153
|
{
|
package/dist/useAdminAction.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { useCallback, useMemo, useRef, useState } from "react";
|
|
2
|
-
import {
|
|
1
|
+
import { useCallback, useContext, useMemo, useRef, useState } from "react";
|
|
2
|
+
import { QueryClientContext } from "@tanstack/react-query";
|
|
3
3
|
import { toast } from "react-hot-toast";
|
|
4
4
|
import { usePermissions, confirmAction, notifyError, notifySuccess } from "@okjt/ui";
|
|
5
|
-
import { useDashboard } from "./DashboardProvider.js";
|
|
5
|
+
import { useComponentDefaults, useDashboard } from "./DashboardProvider.js";
|
|
6
6
|
const resolve = (value, ...args) => typeof value === "function" ? value(...args) : value;
|
|
7
7
|
const deniedByRole = (err) => err?.response?.status === 403 && err.response.data?.reason === "role";
|
|
8
8
|
function useAdminAction(fn, options = {}) {
|
|
9
9
|
const { canEdit, isOwner } = usePermissions();
|
|
10
10
|
const allowed = options.role === "owner" ? isOwner : canEdit;
|
|
11
|
-
const queryClient =
|
|
11
|
+
const queryClient = useContext(QueryClientContext);
|
|
12
|
+
const defaults = useComponentDefaults("AdminAction", {});
|
|
12
13
|
const refreshCollaboration = useDashboard().useAfterChange();
|
|
13
14
|
const [pendingKeys, setPendingKeys] = useState(() => /* @__PURE__ */ new Set());
|
|
14
15
|
const latest = useRef({ fn, options });
|
|
15
|
-
latest.current = { fn, options };
|
|
16
|
+
latest.current = { fn, options: { ...defaults, ...options } };
|
|
16
17
|
const run = useCallback(async (...args) => {
|
|
17
18
|
const { fn: write, options: opts } = latest.current;
|
|
18
19
|
if (!allowed) {
|
|
@@ -27,10 +28,12 @@ function useAdminAction(fn, options = {}) {
|
|
|
27
28
|
const result = await write(...args);
|
|
28
29
|
const message = resolve(opts.success, result, ...args);
|
|
29
30
|
if (message) notifySuccess(message);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
if (queryClient) {
|
|
32
|
+
await Promise.all([
|
|
33
|
+
...(opts.invalidate || []).map((queryKey) => queryClient.invalidateQueries({ queryKey })),
|
|
34
|
+
...opts.refreshHistory === false ? [] : [queryClient.invalidateQueries({ queryKey: ["revisions"] })]
|
|
35
|
+
]);
|
|
36
|
+
}
|
|
34
37
|
refreshCollaboration?.();
|
|
35
38
|
opts.onSuccess?.(result, ...args);
|
|
36
39
|
return result;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@okjt/dashboard",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Dashboard pages for OKJTech projects: page layout, hero, summary cards, floating toolbar with search and filters, side panel, lists, bulk actions, one way to save, and working together: presence, version history, sharing; the dashboard shell, sign-in pages and account menu",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"test": "node build.mjs && vitest run"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@okjt/ui": "^0.
|
|
29
|
+
"@okjt/ui": "^0.5.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@tanstack/react-query": ">=5",
|