@sudobility/entity_pages 0.0.119 → 0.0.120

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.
Files changed (2) hide show
  1. package/dist/index.js +70 -71
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1,11 +1,10 @@
1
- import { jsx as e, jsxs as t, Fragment as S } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as t, Fragment as R } from "react/jsx-runtime";
2
2
  import * as M from "react";
3
3
  import { useState as k } from "react";
4
- import { createPortal as K } from "react-dom";
5
- import { Section as I } from "@sudobility/components";
6
- import { EntityList as z, InvitationForm as Y, InvitationList as A, MemberList as q } from "@sudobility/entity-components";
7
- import { useEntities as U, useCreateEntity as B, useEntityMembers as G, useUpdateMemberRole as H, useRemoveMember as J, useEntityInvitations as Q, useCreateInvitation as V, useCancelInvitation as X, useMyInvitations as Z, useAcceptInvitation as _, useDeclineInvitation as ee } from "@sudobility/entity_client";
8
- function te({
4
+ import { createPortal as W } from "react-dom";
5
+ import { EntityList as L, InvitationForm as K, InvitationList as A, MemberList as Y } from "@sudobility/entity-components";
6
+ import { useEntities as q, useCreateEntity as U, useEntityMembers as B, useUpdateMemberRole as G, useRemoveMember as H, useEntityInvitations as J, useCreateInvitation as Q, useCancelInvitation as V, useMyInvitations as X, useAcceptInvitation as Z, useDeclineInvitation as _ } from "@sudobility/entity_client";
7
+ function ee({
9
8
  title: n,
10
9
  titleId: a,
11
10
  ...l
@@ -28,13 +27,13 @@ function te({
28
27
  d: "M12 4.5v15m7.5-7.5h-15"
29
28
  }));
30
29
  }
31
- const ne = /* @__PURE__ */ M.forwardRef(te), L = {
30
+ const te = /* @__PURE__ */ M.forwardRef(ee), E = {
32
31
  // Background utilities
33
32
  background: {
34
33
  overlay: "bg-black/50 dark:bg-black/70"
35
34
  }
36
35
  };
37
- function re() {
36
+ function ne() {
38
37
  return /* @__PURE__ */ t("div", { className: "space-y-3", role: "status", "aria-label": "Loading workspaces", children: [
39
38
  [1, 2, 3].map((n) => /* @__PURE__ */ e(
40
39
  "div",
@@ -46,7 +45,7 @@ function re() {
46
45
  /* @__PURE__ */ e("span", { className: "sr-only", children: "Loading workspaces..." })
47
46
  ] });
48
47
  }
49
- function ge({
48
+ function me({
50
49
  client: n,
51
50
  onSelectEntity: a
52
51
  }) {
@@ -59,7 +58,7 @@ function ge({
59
58
  isError: y,
60
59
  error: N,
61
60
  refetch: w
62
- } = U(n), p = B(n), b = v.filter((s) => s.entityType === "personal"), c = v.filter(
61
+ } = q(n), f = U(n), b = v.filter((s) => s.entityType === "personal"), c = v.filter(
63
62
  (s) => s.entityType === "organization"
64
63
  ), x = async (s) => {
65
64
  if (s.preventDefault(), m(null), !i.displayName.trim()) {
@@ -67,15 +66,15 @@ function ge({
67
66
  return;
68
67
  }
69
68
  try {
70
- await p.mutateAsync({
69
+ await f.mutateAsync({
71
70
  displayName: i.displayName.trim(),
72
71
  description: i.description.trim() || void 0
73
72
  }), r(!1), o({ displayName: "", description: "" });
74
- } catch (f) {
75
- m(f.message || "Failed to create organization");
73
+ } catch (p) {
74
+ m(p.message || "Failed to create organization");
76
75
  }
77
76
  };
78
- return /* @__PURE__ */ e(I, { spacing: "lg", maxWidth: "4xl", children: /* @__PURE__ */ t("div", { role: "main", "aria-label": "Workspaces", children: [
77
+ return /* @__PURE__ */ e("div", { className: "w-full", children: /* @__PURE__ */ t("div", { role: "main", "aria-label": "Workspaces", children: [
79
78
  /* @__PURE__ */ t("div", { className: "flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-6 sm:mb-8", children: [
80
79
  /* @__PURE__ */ t("div", { children: [
81
80
  /* @__PURE__ */ e("h1", { className: "text-xl sm:text-2xl font-bold text-foreground", children: "Workspaces" }),
@@ -89,17 +88,17 @@ function ge({
89
88
  "aria-label": "Create new organization",
90
89
  className: "flex items-center justify-center gap-2 px-4 py-2 rounded-lg bg-primary text-primary-foreground font-medium hover:bg-primary/90 transition-colors focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 w-full sm:w-auto",
91
90
  children: [
92
- /* @__PURE__ */ e(ne, { className: "h-4 w-4", "aria-hidden": "true" }),
91
+ /* @__PURE__ */ e(te, { className: "h-4 w-4", "aria-hidden": "true" }),
93
92
  /* @__PURE__ */ e("span", { children: "New Organization" })
94
93
  ]
95
94
  }
96
95
  )
97
96
  ] }),
98
- l && K(
97
+ l && W(
99
98
  /* @__PURE__ */ e(
100
99
  "div",
101
100
  {
102
- className: `fixed inset-0 z-50 flex items-center justify-center ${L.background.overlay} p-4`,
101
+ className: `fixed inset-0 z-50 flex items-center justify-center ${E.background.overlay} p-4`,
103
102
  role: "dialog",
104
103
  "aria-modal": "true",
105
104
  "aria-label": "Create organization",
@@ -133,8 +132,8 @@ function ge({
133
132
  id: "create-org-name",
134
133
  type: "text",
135
134
  value: i.displayName,
136
- onChange: (s) => o((f) => ({
137
- ...f,
135
+ onChange: (s) => o((p) => ({
136
+ ...p,
138
137
  displayName: s.target.value
139
138
  })),
140
139
  placeholder: "My Organization",
@@ -158,8 +157,8 @@ function ge({
158
157
  {
159
158
  id: "create-org-description",
160
159
  value: i.description,
161
- onChange: (s) => o((f) => ({
162
- ...f,
160
+ onChange: (s) => o((p) => ({
161
+ ...p,
163
162
  description: s.target.value
164
163
  })),
165
164
  placeholder: "What is this organization for?",
@@ -196,10 +195,10 @@ function ge({
196
195
  "button",
197
196
  {
198
197
  type: "submit",
199
- disabled: p.isPending,
200
- "aria-busy": p.isPending,
198
+ disabled: f.isPending,
199
+ "aria-busy": f.isPending,
201
200
  className: "px-4 py-2 rounded-lg bg-primary text-primary-foreground font-medium hover:bg-primary/90 transition-colors disabled:opacity-50 focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 w-full sm:w-auto",
202
- children: p.isPending ? "Creating..." : "Create"
201
+ children: f.isPending ? "Creating..." : "Create"
203
202
  }
204
203
  )
205
204
  ] })
@@ -233,12 +232,12 @@ function ge({
233
232
  ]
234
233
  }
235
234
  ),
236
- u && /* @__PURE__ */ e(re, {}),
237
- !u && !y && /* @__PURE__ */ t(S, { children: [
235
+ u && /* @__PURE__ */ e(ne, {}),
236
+ !u && !y && /* @__PURE__ */ t(R, { children: [
238
237
  b.length > 0 && /* @__PURE__ */ t("section", { className: "mb-6 sm:mb-8", "aria-label": "Personal workspace", children: [
239
238
  /* @__PURE__ */ e("h2", { className: "text-base sm:text-lg font-semibold mb-3", children: "Personal Workspace" }),
240
239
  /* @__PURE__ */ e(
241
- z,
240
+ L,
242
241
  {
243
242
  entities: b,
244
243
  onSelect: a,
@@ -268,7 +267,7 @@ function ge({
268
267
  ]
269
268
  }
270
269
  ) : /* @__PURE__ */ e(
271
- z,
270
+ L,
272
271
  {
273
272
  entities: c,
274
273
  onSelect: a,
@@ -290,7 +289,7 @@ function ge({
290
289
  ] })
291
290
  ] }) });
292
291
  }
293
- function R() {
292
+ function z() {
294
293
  return /* @__PURE__ */ t("div", { className: "space-y-3", role: "status", "aria-label": "Loading members", children: [
295
294
  [1, 2, 3].map((n) => /* @__PURE__ */ e(
296
295
  "div",
@@ -302,7 +301,7 @@ function R() {
302
301
  /* @__PURE__ */ e("span", { className: "sr-only", children: "Loading members..." })
303
302
  ] });
304
303
  }
305
- function ie({
304
+ function re({
306
305
  title: n,
307
306
  message: a,
308
307
  confirmLabel: l,
@@ -312,7 +311,7 @@ function ie({
312
311
  return /* @__PURE__ */ e(
313
312
  "div",
314
313
  {
315
- className: `fixed inset-0 z-50 flex items-center justify-center ${L.background.overlay} p-4`,
314
+ className: `fixed inset-0 z-50 flex items-center justify-center ${E.background.overlay} p-4`,
316
315
  role: "dialog",
317
316
  "aria-modal": "true",
318
317
  "aria-label": n,
@@ -349,7 +348,7 @@ function ie({
349
348
  }
350
349
  );
351
350
  }
352
- function pe({
351
+ function ue({
353
352
  client: n,
354
353
  entity: a,
355
354
  currentUserId: l
@@ -360,13 +359,13 @@ function pe({
360
359
  isError: v,
361
360
  error: u,
362
361
  refetch: y
363
- } = G(n, a.entitySlug), N = H(n), w = J(n), {
364
- data: p = [],
362
+ } = B(n, a.entitySlug), N = G(n), w = H(n), {
363
+ data: f = [],
365
364
  isLoading: b,
366
365
  isError: c,
367
366
  error: x,
368
367
  refetch: s
369
- } = Q(n, r ? a.entitySlug : null), f = V(n), D = X(n), F = async (d, h) => {
368
+ } = J(n, r ? a.entitySlug : null), p = Q(n), D = V(n), S = async (d, h) => {
370
369
  try {
371
370
  await N.mutateAsync({
372
371
  entitySlug: a.entitySlug,
@@ -376,14 +375,14 @@ function pe({
376
375
  } catch (C) {
377
376
  console.error("Failed to update role:", C);
378
377
  }
379
- }, j = (d) => {
380
- const h = g.find((E) => E.id === d), C = h?.user?.displayName || h?.user?.email || "this member";
378
+ }, F = (d) => {
379
+ const h = g.find((I) => I.id === d), C = h?.user?.displayName || h?.user?.email || "this member";
381
380
  o({
382
381
  type: "removeMember",
383
382
  id: d,
384
383
  displayLabel: C
385
384
  });
386
- }, P = async (d) => {
385
+ }, j = async (d) => {
387
386
  try {
388
387
  await w.mutateAsync({
389
388
  entitySlug: a.entitySlug,
@@ -392,13 +391,13 @@ function pe({
392
391
  } catch (h) {
393
392
  console.error("Failed to remove member:", h);
394
393
  }
395
- }, T = async (d) => {
396
- await f.mutateAsync({
394
+ }, P = async (d) => {
395
+ await p.mutateAsync({
397
396
  entitySlug: a.entitySlug,
398
397
  request: d
399
398
  });
400
- }, W = (d) => {
401
- const C = p.find((E) => E.id === d)?.email || "this invitation";
399
+ }, T = (d) => {
400
+ const C = f.find((I) => I.id === d)?.email || "this invitation";
402
401
  o({
403
402
  type: "cancelInvitation",
404
403
  id: d,
@@ -414,9 +413,9 @@ function pe({
414
413
  console.error("Failed to cancel invitation:", h);
415
414
  }
416
415
  }, $ = async () => {
417
- i && (i.type === "removeMember" ? await P(i.id) : i.type === "cancelInvitation" && await O(i.id), o(null));
416
+ i && (i.type === "removeMember" ? await j(i.id) : i.type === "cancelInvitation" && await O(i.id), o(null));
418
417
  };
419
- return a.entityType === "personal" ? /* @__PURE__ */ e(I, { spacing: "lg", maxWidth: "4xl", children: /* @__PURE__ */ t(
418
+ return a.entityType === "personal" ? /* @__PURE__ */ e("div", { className: "w-full", children: /* @__PURE__ */ t(
420
419
  "div",
421
420
  {
422
421
  className: "text-center py-8 sm:py-12 text-muted-foreground",
@@ -427,9 +426,9 @@ function pe({
427
426
  /* @__PURE__ */ e("p", { className: "mt-2", children: "Create an organization to collaborate with others." })
428
427
  ]
429
428
  }
430
- ) }) : /* @__PURE__ */ e(I, { spacing: "lg", maxWidth: "4xl", children: /* @__PURE__ */ t("div", { role: "main", "aria-label": "Members management", children: [
429
+ ) }) : /* @__PURE__ */ e("div", { className: "w-full", children: /* @__PURE__ */ t("div", { role: "main", "aria-label": "Members management", children: [
431
430
  i && /* @__PURE__ */ e(
432
- ie,
431
+ re,
433
432
  {
434
433
  title: i.type === "removeMember" ? "Remove Member" : "Cancel Invitation",
435
434
  message: i.type === "removeMember" ? `Are you sure you want to remove ${i.displayLabel}? They will lose access to this organization.` : `Are you sure you want to cancel the invitation to ${i.displayLabel}?`,
@@ -453,10 +452,10 @@ function pe({
453
452
  children: [
454
453
  /* @__PURE__ */ e("h2", { className: "text-base sm:text-lg font-semibold mb-3 sm:mb-4", children: "Invite Members" }),
455
454
  /* @__PURE__ */ e(
456
- Y,
455
+ K,
457
456
  {
458
- onSubmit: T,
459
- isSubmitting: f.isPending
457
+ onSubmit: P,
458
+ isSubmitting: p.isPending
460
459
  }
461
460
  )
462
461
  ]
@@ -485,7 +484,7 @@ function pe({
485
484
  )
486
485
  ]
487
486
  }
488
- ) : b ? /* @__PURE__ */ e(R, {}) : p.length === 0 ? /* @__PURE__ */ e(
487
+ ) : b ? /* @__PURE__ */ e(z, {}) : f.length === 0 ? /* @__PURE__ */ e(
489
488
  "div",
490
489
  {
491
490
  className: "text-center py-4 sm:py-6 text-muted-foreground border border-dashed rounded-lg",
@@ -495,9 +494,9 @@ function pe({
495
494
  ) : /* @__PURE__ */ e("div", { className: "overflow-x-auto", children: /* @__PURE__ */ e(
496
495
  A,
497
496
  {
498
- invitations: p,
497
+ invitations: f,
499
498
  mode: "admin",
500
- onCancel: W,
499
+ onCancel: T,
501
500
  isLoading: b,
502
501
  emptyMessage: "No pending invitations"
503
502
  }
@@ -530,7 +529,7 @@ function pe({
530
529
  )
531
530
  ]
532
531
  }
533
- ) : m ? /* @__PURE__ */ e(R, {}) : g.length === 0 ? /* @__PURE__ */ t(
532
+ ) : m ? /* @__PURE__ */ e(z, {}) : g.length === 0 ? /* @__PURE__ */ t(
534
533
  "div",
535
534
  {
536
535
  className: "text-center py-4 sm:py-6 text-muted-foreground border border-dashed rounded-lg",
@@ -541,20 +540,20 @@ function pe({
541
540
  ]
542
541
  }
543
542
  ) : /* @__PURE__ */ e("div", { className: "overflow-x-auto", children: /* @__PURE__ */ e(
544
- q,
543
+ Y,
545
544
  {
546
545
  members: g,
547
546
  currentUserId: l,
548
547
  canManage: r,
549
- onRoleChange: F,
550
- onRemove: j,
548
+ onRoleChange: S,
549
+ onRemove: F,
551
550
  isLoading: m
552
551
  }
553
552
  ) })
554
553
  ] })
555
554
  ] }) });
556
555
  }
557
- function ae() {
556
+ function ie() {
558
557
  return /* @__PURE__ */ t("div", { className: "space-y-3", role: "status", "aria-label": "Loading invitations", children: [
559
558
  [1, 2].map((n) => /* @__PURE__ */ e(
560
559
  "div",
@@ -566,7 +565,7 @@ function ae() {
566
565
  /* @__PURE__ */ e("span", { className: "sr-only", children: "Loading invitations..." })
567
566
  ] });
568
567
  }
569
- function oe({
568
+ function ae({
570
569
  entityName: n,
571
570
  onConfirm: a,
572
571
  onCancel: l
@@ -574,7 +573,7 @@ function oe({
574
573
  return /* @__PURE__ */ e(
575
574
  "div",
576
575
  {
577
- className: `fixed inset-0 z-50 flex items-center justify-center ${L.background.overlay} p-4`,
576
+ className: `fixed inset-0 z-50 flex items-center justify-center ${E.background.overlay} p-4`,
578
577
  role: "dialog",
579
578
  "aria-modal": "true",
580
579
  "aria-label": "Decline invitation",
@@ -616,7 +615,7 @@ function oe({
616
615
  }
617
616
  );
618
617
  }
619
- function fe({
618
+ function ge({
620
619
  client: n,
621
620
  onInvitationAccepted: a
622
621
  }) {
@@ -626,16 +625,16 @@ function fe({
626
625
  isError: i,
627
626
  error: o,
628
627
  refetch: g
629
- } = Z(n), m = _(n), v = ee(n), [u, y] = k(null), N = async (c) => {
628
+ } = X(n), m = Z(n), v = _(n), [u, y] = k(null), N = async (c) => {
630
629
  try {
631
630
  await m.mutateAsync(c), a?.();
632
631
  } catch (x) {
633
632
  console.error("Failed to accept invitation:", x);
634
633
  }
635
634
  }, w = (c) => {
636
- const s = l.find((f) => f.token === c)?.entity?.displayName || "this organization";
635
+ const s = l.find((p) => p.token === c)?.entity?.displayName || "this organization";
637
636
  y({ token: c, entityName: s });
638
- }, p = async () => {
637
+ }, f = async () => {
639
638
  if (u) {
640
639
  try {
641
640
  await v.mutateAsync(u.token);
@@ -647,12 +646,12 @@ function fe({
647
646
  }, b = l.filter(
648
647
  (c) => c.status === "pending"
649
648
  ).length;
650
- return /* @__PURE__ */ e(I, { spacing: "lg", maxWidth: "4xl", children: /* @__PURE__ */ t("div", { role: "main", "aria-label": "Invitations", children: [
649
+ return /* @__PURE__ */ e("div", { className: "w-full", children: /* @__PURE__ */ t("div", { role: "main", "aria-label": "Invitations", children: [
651
650
  u && /* @__PURE__ */ e(
652
- oe,
651
+ ae,
653
652
  {
654
653
  entityName: u.entityName,
655
- onConfirm: p,
654
+ onConfirm: f,
656
655
  onCancel: () => y(null)
657
656
  }
658
657
  ),
@@ -682,8 +681,8 @@ function fe({
682
681
  ]
683
682
  }
684
683
  ),
685
- r && /* @__PURE__ */ e(ae, {}),
686
- !r && !i && /* @__PURE__ */ e(S, { children: l.length === 0 ? /* @__PURE__ */ t(
684
+ r && /* @__PURE__ */ e(ie, {}),
685
+ !r && !i && /* @__PURE__ */ e(R, { children: l.length === 0 ? /* @__PURE__ */ t(
687
686
  "div",
688
687
  {
689
688
  className: "text-center py-6 sm:py-8 text-muted-foreground border border-dashed rounded-lg",
@@ -707,7 +706,7 @@ function fe({
707
706
  ] }) });
708
707
  }
709
708
  export {
710
- ge as EntityListPage,
711
- fe as InvitationsPage,
712
- pe as MembersManagementPage
709
+ me as EntityListPage,
710
+ ge as InvitationsPage,
711
+ ue as MembersManagementPage
713
712
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sudobility/entity_pages",
3
- "version": "0.0.119",
3
+ "version": "0.0.120",
4
4
  "description": "Page containers for entity/organization management",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -40,7 +40,7 @@
40
40
  "react": "^18.0.0 || ^19.0.0",
41
41
  "react-dom": "^18.0.0 || ^19.0.0",
42
42
  "@tanstack/react-query": "^5.0.0",
43
- "@sudobility/components": "^5.0.80",
43
+ "@sudobility/components": "^5.0.81",
44
44
  "@sudobility/entity_client": "^0.0.36",
45
45
  "@sudobility/entity-components": "^1.0.13",
46
46
  "@heroicons/react": "^2.2.0",
@@ -50,7 +50,7 @@
50
50
  "devDependencies": {
51
51
  "@eslint/js": "^9.38.0",
52
52
  "@heroicons/react": "^2.2.0",
53
- "@sudobility/components": "^5.0.80",
53
+ "@sudobility/components": "^5.0.81",
54
54
  "@sudobility/design": "^1.1.32",
55
55
  "@sudobility/entity-components": "^1.0.13",
56
56
  "@sudobility/entity_client": "^0.0.36",