@blakesteve/roster 5.7.0 → 5.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -4
- package/dist/components/atoms/Avatar/Avatar.cjs +1 -1
- package/dist/components/atoms/Avatar/Avatar.d.ts +4 -0
- package/dist/components/atoms/Avatar/Avatar.js +1 -1
- package/dist/components/atoms/AvatarStrip/AvatarStrip.cjs +1 -1
- package/dist/components/atoms/AvatarStrip/AvatarStrip.d.ts +10 -1
- package/dist/components/atoms/AvatarStrip/AvatarStrip.js +34 -30
- package/dist/components/atoms/Button/button-variants.cjs +1 -1
- package/dist/components/atoms/Button/button-variants.js +5 -3
- package/dist/components/atoms/Eyebrow/eyebrow-variants.cjs +1 -1
- package/dist/components/atoms/Eyebrow/eyebrow-variants.js +8 -4
- package/dist/components/atoms/MultiSelect/MultiSelect.cjs +1 -1
- package/dist/components/atoms/MultiSelect/MultiSelect.d.ts +3 -1
- package/dist/components/atoms/MultiSelect/MultiSelect.js +87 -89
- package/dist/components/atoms/Progress/Progress.cjs +1 -1
- package/dist/components/atoms/Progress/Progress.d.ts +1 -0
- package/dist/components/atoms/Progress/Progress.js +28 -27
- package/dist/components/atoms/Stat/Stat.cjs +1 -1
- package/dist/components/atoms/Stat/Stat.js +5 -5
- package/dist/components/atoms/Stat/stat-variants.cjs +1 -1
- package/dist/components/atoms/Stat/stat-variants.js +10 -8
- package/dist/components/molecules/Breadcrumbs/Breadcrumbs.cjs +1 -1
- package/dist/components/molecules/Breadcrumbs/Breadcrumbs.d.ts +10 -1
- package/dist/components/molecules/Breadcrumbs/Breadcrumbs.js +31 -29
- package/dist/components/molecules/CallToAction/CallToAction.cjs +1 -1
- package/dist/components/molecules/CallToAction/CallToAction.d.ts +8 -1
- package/dist/components/molecules/CallToAction/CallToAction.js +34 -29
- package/dist/components/molecules/Carousel/Carousel.cjs +1 -1
- package/dist/components/molecules/Carousel/Carousel.d.ts +7 -0
- package/dist/components/molecules/Carousel/Carousel.js +155 -155
- package/dist/components/molecules/ErrorState/ErrorState.cjs +1 -1
- package/dist/components/molecules/ErrorState/ErrorState.d.ts +8 -1
- package/dist/components/molecules/ErrorState/ErrorState.js +44 -39
- package/dist/components/molecules/FileUpload/FileUpload.cjs +1 -1
- package/dist/components/molecules/FileUpload/FileUpload.js +23 -22
- package/dist/components/molecules/MediaPreview/MediaPreview.cjs +1 -1
- package/dist/components/molecules/MediaPreview/MediaPreview.d.ts +3 -1
- package/dist/components/molecules/MediaPreview/MediaPreview.js +13 -12
- package/dist/components/molecules/Pagination/Pagination.cjs +1 -1
- package/dist/components/molecules/Pagination/Pagination.d.ts +1 -0
- package/dist/components/molecules/Pagination/Pagination.js +47 -46
- package/dist/components/molecules/ProgressField/ProgressField.d.ts +1 -0
- package/dist/components/molecules/SkeletonPresets/SkeletonPresets.cjs +1 -1
- package/dist/components/molecules/SkeletonPresets/SkeletonPresets.d.ts +2 -2
- package/dist/components/molecules/SkeletonPresets/SkeletonPresets.js +17 -17
- package/dist/components/molecules/StepProgress/StepProgress.cjs +1 -1
- package/dist/components/molecules/StepProgress/StepProgress.d.ts +1 -0
- package/dist/components/molecules/StepProgress/StepProgress.js +9 -8
- package/dist/components/organisms/Countdown/Countdown.cjs +1 -1
- package/dist/components/organisms/Countdown/Countdown.d.ts +13 -0
- package/dist/components/organisms/Countdown/Countdown.js +54 -47
- package/dist/components/organisms/DataTable/DataTable.cjs +1 -1
- package/dist/components/organisms/DataTable/DataTable.d.ts +5 -3
- package/dist/components/organisms/DataTable/DataTable.js +27 -26
- package/dist/components/organisms/Dialog/Dialog.cjs +1 -1
- package/dist/components/organisms/Dialog/Dialog.d.ts +8 -1
- package/dist/components/organisms/Dialog/Dialog.js +25 -23
- package/dist/components/organisms/Footer/Footer.cjs +1 -1
- package/dist/components/organisms/Footer/Footer.d.ts +9 -0
- package/dist/components/organisms/Footer/Footer.js +21 -23
- package/dist/components/organisms/ModerationQueue/ModerationQueue.cjs +1 -1
- package/dist/components/organisms/ModerationQueue/ModerationQueue.d.ts +40 -1
- package/dist/components/organisms/ModerationQueue/ModerationQueue.js +262 -237
- package/dist/components/organisms/ModerationQueue/QueueEditDialog.cjs +1 -1
- package/dist/components/organisms/ModerationQueue/QueueEditDialog.d.ts +1 -1
- package/dist/components/organisms/ModerationQueue/QueueEditDialog.js +23 -21
- package/dist/components/organisms/ModerationQueue/QueueEditSheet.cjs +1 -1
- package/dist/components/organisms/ModerationQueue/QueueEditSheet.d.ts +1 -1
- package/dist/components/organisms/ModerationQueue/QueueEditSheet.js +22 -20
- package/dist/components/organisms/ModerationQueue/queue-actions.d.ts +29 -10
- package/dist/components/organisms/Navbar/Navbar.cjs +1 -1
- package/dist/components/organisms/Navbar/Navbar.d.ts +38 -3
- package/dist/components/organisms/Navbar/Navbar.js +210 -187
- package/dist/components/organisms/Navbar/navbar-variants.cjs +1 -1
- package/dist/components/organisms/Navbar/navbar-variants.js +4 -2
- package/dist/components/organisms/Sheet/Sheet.cjs +1 -1
- package/dist/components/organisms/Sheet/Sheet.d.ts +8 -1
- package/dist/components/organisms/Sheet/Sheet.js +65 -63
- package/dist/lib/labels.cjs +1 -0
- package/dist/lib/labels.d.ts +7 -0
- package/dist/lib/labels.js +12 -0
- package/dist/meta.json +3 -3
- package/dist/roster.css +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("../Dialog/Dialog.cjs");function g({open:i,title:t,description:l,busy:r,onCancel:o,onAfterClose:n,children:u,submitButton:a,cancelButton:c,closeLabel:s}){return e.jsx(d.Dialog,{isOpen:i,onClose:r?()=>{}:o,title:t,description:l,size:"lg",onAfterClose:n,labels:s===void 0?void 0:{close:s},children:e.jsxs("div",{className:"rst:flex rst:flex-col rst:gap-6",children:[u,e.jsxs("div",{className:"rst:flex rst:flex-wrap rst:justify-end rst:gap-2",children:[c,a]})]})})}exports.QueueEditDialog=g;
|
|
@@ -4,5 +4,5 @@ import { QueueSurfaceProps } from './queue-actions';
|
|
|
4
4
|
* two. Pass it as the edit's `surface`. A separate export, so a queue that
|
|
5
5
|
* never edits in a Dialog never ships one.
|
|
6
6
|
*/
|
|
7
|
-
declare function QueueEditDialog({ open, title, description, busy, onCancel, onAfterClose, children, submitButton, cancelButton, }: QueueSurfaceProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function QueueEditDialog({ open, title, description, busy, onCancel, onAfterClose, children, submitButton, cancelButton, closeLabel, }: QueueSurfaceProps): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export { QueueEditDialog };
|
|
@@ -1,37 +1,39 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as f, jsxs as e } from "react/jsx-runtime";
|
|
3
|
-
import { Dialog as
|
|
4
|
-
function
|
|
5
|
-
open:
|
|
6
|
-
title:
|
|
7
|
-
description:
|
|
8
|
-
busy:
|
|
9
|
-
onCancel:
|
|
10
|
-
onAfterClose:
|
|
11
|
-
children:
|
|
12
|
-
submitButton:
|
|
13
|
-
cancelButton: c
|
|
3
|
+
import { Dialog as p } from "../Dialog/Dialog.js";
|
|
4
|
+
function u({
|
|
5
|
+
open: r,
|
|
6
|
+
title: i,
|
|
7
|
+
description: l,
|
|
8
|
+
busy: t,
|
|
9
|
+
onCancel: o,
|
|
10
|
+
onAfterClose: n,
|
|
11
|
+
children: a,
|
|
12
|
+
submitButton: d,
|
|
13
|
+
cancelButton: c,
|
|
14
|
+
closeLabel: s
|
|
14
15
|
}) {
|
|
15
16
|
return /* @__PURE__ */ f(
|
|
16
|
-
|
|
17
|
+
p,
|
|
17
18
|
{
|
|
18
|
-
isOpen:
|
|
19
|
-
onClose:
|
|
20
|
-
} :
|
|
21
|
-
title:
|
|
22
|
-
description:
|
|
19
|
+
isOpen: r,
|
|
20
|
+
onClose: t ? () => {
|
|
21
|
+
} : o,
|
|
22
|
+
title: i,
|
|
23
|
+
description: l,
|
|
23
24
|
size: "lg",
|
|
24
|
-
onAfterClose:
|
|
25
|
+
onAfterClose: n,
|
|
26
|
+
labels: s === void 0 ? void 0 : { close: s },
|
|
25
27
|
children: /* @__PURE__ */ e("div", { className: "rst:flex rst:flex-col rst:gap-6", children: [
|
|
26
|
-
|
|
28
|
+
a,
|
|
27
29
|
/* @__PURE__ */ e("div", { className: "rst:flex rst:flex-wrap rst:justify-end rst:gap-2", children: [
|
|
28
30
|
c,
|
|
29
|
-
|
|
31
|
+
d
|
|
30
32
|
] })
|
|
31
33
|
] })
|
|
32
34
|
}
|
|
33
35
|
);
|
|
34
36
|
}
|
|
35
37
|
export {
|
|
36
|
-
|
|
38
|
+
u as QueueEditDialog
|
|
37
39
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),l=require("../Sheet/Sheet.cjs");function S({open:t,title:i,description:u,busy:n,onCancel:o,onAfterClose:s,children:r,submitButton:c,closeLabel:e}){return d.jsx(l.Sheet,{isOpen:t,onClose:n?()=>{}:o,title:i,description:u,actions:c,onAfterClose:s,labels:e===void 0?void 0:{close:e},children:r})}exports.QueueEditSheet=S;
|
|
@@ -8,5 +8,5 @@ import { QueueSurfaceProps } from './queue-actions';
|
|
|
8
8
|
* Cancel is the Sheet's own close button, so there's one way out rather than
|
|
9
9
|
* two side by side.
|
|
10
10
|
*/
|
|
11
|
-
declare function QueueEditSheet({ open, title, description, busy, onCancel, onAfterClose, children, submitButton, }: QueueSurfaceProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare function QueueEditSheet({ open, title, description, busy, onCancel, onAfterClose, children, submitButton, closeLabel, }: QueueSurfaceProps): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
export { QueueEditSheet };
|
|
@@ -1,30 +1,32 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { Sheet as
|
|
4
|
-
function
|
|
5
|
-
open:
|
|
2
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
3
|
+
import { Sheet as c } from "../Sheet/Sheet.js";
|
|
4
|
+
function l({
|
|
5
|
+
open: o,
|
|
6
6
|
title: t,
|
|
7
|
-
description:
|
|
8
|
-
busy:
|
|
9
|
-
onCancel:
|
|
10
|
-
onAfterClose:
|
|
11
|
-
children:
|
|
12
|
-
submitButton:
|
|
7
|
+
description: i,
|
|
8
|
+
busy: n,
|
|
9
|
+
onCancel: r,
|
|
10
|
+
onAfterClose: s,
|
|
11
|
+
children: u,
|
|
12
|
+
submitButton: m,
|
|
13
|
+
closeLabel: e
|
|
13
14
|
}) {
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
-
|
|
15
|
+
return /* @__PURE__ */ p(
|
|
16
|
+
c,
|
|
16
17
|
{
|
|
17
|
-
isOpen:
|
|
18
|
-
onClose:
|
|
19
|
-
} :
|
|
18
|
+
isOpen: o,
|
|
19
|
+
onClose: n ? () => {
|
|
20
|
+
} : r,
|
|
20
21
|
title: t,
|
|
21
|
-
description:
|
|
22
|
-
actions:
|
|
23
|
-
onAfterClose:
|
|
24
|
-
|
|
22
|
+
description: i,
|
|
23
|
+
actions: m,
|
|
24
|
+
onAfterClose: s,
|
|
25
|
+
labels: e === void 0 ? void 0 : { close: e },
|
|
26
|
+
children: u
|
|
25
27
|
}
|
|
26
28
|
);
|
|
27
29
|
}
|
|
28
30
|
export {
|
|
29
|
-
|
|
31
|
+
l as QueueEditSheet
|
|
30
32
|
};
|
|
@@ -26,21 +26,38 @@ export interface QueueReason {
|
|
|
26
26
|
/** The note, when the step takes one. Trimmed; absent when empty. */
|
|
27
27
|
note?: string;
|
|
28
28
|
}
|
|
29
|
-
export interface
|
|
29
|
+
export interface QueueReasonOption {
|
|
30
|
+
value: string;
|
|
31
|
+
label: string;
|
|
32
|
+
}
|
|
33
|
+
interface QueueReasonStepBase {
|
|
30
34
|
/** The question the step asks, and its accessible name. */
|
|
31
35
|
prompt: string;
|
|
32
|
-
/** A short list, shown as radios. */
|
|
33
|
-
options?: {
|
|
34
|
-
value: string;
|
|
35
|
-
label: string;
|
|
36
|
-
}[];
|
|
37
|
-
/** An option must be picked before submitting. */
|
|
38
|
-
required?: boolean;
|
|
39
36
|
/** Whether a free-text note is offered, and whether it's required. */
|
|
40
37
|
note?: "none" | "optional" | "required";
|
|
41
38
|
/** The note field's label. */
|
|
42
39
|
noteLabel?: string;
|
|
43
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* A reason step. `required` asks for one of the `options`, so the types ask
|
|
43
|
+
* for `options` with it: a required reason with nothing to pick from could
|
|
44
|
+
* never be submitted. (An empty list gets past the types; the queue then
|
|
45
|
+
* doesn't block on a pick.) For a reason that is only a note, leave
|
|
46
|
+
* `required` off and set `note: "required"`.
|
|
47
|
+
*
|
|
48
|
+
* A type rather than an interface, to say that: extend it with `&`, not
|
|
49
|
+
* `extends`.
|
|
50
|
+
*/
|
|
51
|
+
export type QueueReasonStep = QueueReasonStepBase & ({
|
|
52
|
+
/** An option must be picked before submitting. */
|
|
53
|
+
required: true;
|
|
54
|
+
/** A short list, shown as radios. */
|
|
55
|
+
options: QueueReasonOption[];
|
|
56
|
+
} | {
|
|
57
|
+
required?: false;
|
|
58
|
+
/** A short list, shown as radios. */
|
|
59
|
+
options?: QueueReasonOption[];
|
|
60
|
+
});
|
|
44
61
|
/**
|
|
45
62
|
* Every action that isn't an edit: one click, or a step that asks first.
|
|
46
63
|
*
|
|
@@ -48,8 +65,8 @@ export interface QueueReasonStep {
|
|
|
48
65
|
* - `confirm`: asks in place, "Remove this post?", with the action and
|
|
49
66
|
* Cancel.
|
|
50
67
|
* - `reason`: asks why in place (options, a note, or both), and hands the
|
|
51
|
-
* answer to `run`. Takes precedence over `confirm
|
|
52
|
-
* the confirmation.
|
|
68
|
+
* answer to `run`. Takes precedence over `confirm`: its prompt is the one
|
|
69
|
+
* asked, and its submit button is the confirmation.
|
|
53
70
|
*
|
|
54
71
|
* One type rather than three, so an action written as an object literal gets
|
|
55
72
|
* its parameters typed: TypeScript can't tell three shapes apart by whether
|
|
@@ -91,6 +108,8 @@ export interface QueueSurfaceProps {
|
|
|
91
108
|
children: ReactNode;
|
|
92
109
|
submitButton: ReactNode;
|
|
93
110
|
cancelButton: ReactNode;
|
|
111
|
+
/** The surface's own close button's name, when the queue's `labels` set one. */
|
|
112
|
+
closeLabel?: string;
|
|
94
113
|
}
|
|
95
114
|
export type QueueSurface = ComponentType<QueueSurfaceProps>;
|
|
96
115
|
export interface QueueEdit<T, D> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),y=require("react"),u=require("../../../node_modules/@fortawesome/react-fontawesome/dist/index.cjs"),h=require("../../../node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),e=require("../../../lib/utils.cjs"),g=require("../../atoms/Button/Button.cjs"),v=require("../../atoms/Link/Link.cjs"),E=require("../../atoms/Badge/Badge.cjs"),W=require("../../atoms/Avatar/Avatar.cjs"),T=require("../../atoms/Switch/switch-variants.cjs"),Y=require("./navbar-variants.cjs"),m=require("../../../node_modules/@headlessui/react/dist/components/menu/menu.cjs"),q=require("../../../node_modules/@headlessui/react/dist/components/popover/popover.cjs"),P=require("../../../node_modules/@headlessui/react/dist/components/transition/transition.cjs");function X({on:s,size:a}){return r.jsx("span",{"aria-hidden":"true","data-testid":"navbar-theme-track","data-checked":s?"":void 0,className:e.cn(T.switchTrackVariants({size:a,variant:"neutral"}),"rst:pointer-events-none"),children:r.jsx("span",{className:e.cn(T.switchThumbVariants({size:a}))})})}const Z=s=>{s?.setAttribute("role","menuitemcheckbox")},$=(s,a)=>typeof s=="function"?s({close:a}):s;function _(s){return y.useSyncExternalStore(a=>{if(!s||typeof document>"u")return()=>{};const o=new MutationObserver(a);return o.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>o.disconnect()},()=>s&&document.documentElement.classList.contains("dark"),()=>!1)}function rr({close:s}){return y.useEffect(()=>{const a=o=>{const b=document.querySelector("[data-roster-mobile-panel]"),k=document.querySelector("[data-roster-hamburger]"),x=o.target;!b?.contains(x)&&!k?.contains(x)&&s()};return document.addEventListener("pointerdown",a,{capture:!0}),()=>document.removeEventListener("pointerdown",a,{capture:!0})},[s]),null}function tr({activePath:s,close:a}){const o=y.useRef(s);return y.useEffect(()=>{o.current!==s&&(o.current=s,a())},[s,a]),null}const sr=({logoSrc:s,logoSize:a="2rem",logoClassName:o,brandName:b,items:k,activePath:x,routerElement:p,user:n,onLogin:j,onLogout:N,onInboxClick:w,onThemeToggle:f,actions:K,brandElement:z,navActions:G,userMenuItems:B=[],className:H,variant:d="default",position:J="sticky",themeMode:S,notificationVariant:L="error",notificationFill:O="solid",...Q})=>{const A=(n?.notificationCount||0)>0,R=typeof a=="number"?`${a}px`:a,V={width:R,height:R},U=_(S==="auto"),c=(S==="auto"?U?"dark":"light":S??(d==="white"||d==="default"?"light":"dark"))==="dark",C=d==="slate"||d==="primary"||d==="default"&&c||d==="white"&&c||d==="transparent"&&c,F={brand:C?"rst:text-white rst:dark:text-white rst:hover:text-gray-200 rst:dark:hover:text-gray-200":"rst:text-gray-900 rst:dark:text-gray-900 rst:hover:text-gray-600 rst:dark:hover:text-gray-600",linkBase:C?"rst:text-gray-300 rst:dark:text-gray-300 rst:hover:text-white rst:dark:hover:text-white":"rst:text-gray-600 rst:dark:text-gray-600 rst:hover:text-gray-900 rst:dark:hover:text-gray-900",linkActive:C?"rst:text-primary-400 rst:dark:text-primary-400 rst:font-semibold rst:hover:text-primary-300 rst:dark:hover:text-primary-300":"rst:text-primary-600 rst:dark:text-primary-600 rst:font-semibold rst:hover:text-primary-700 rst:dark:hover:text-primary-700",hamburger:C?"rst:text-gray-300 rst:dark:text-gray-300 rst:hover:bg-white/10 rst:dark:hover:bg-white/10 rst:hover:text-white rst:dark:hover:text-white":"rst:text-gray-500 rst:dark:text-gray-500 rst:hover:bg-gray-100 rst:dark:hover:bg-gray-100 rst:hover:text-gray-700 rst:dark:hover:text-gray-700"};return r.jsx(q.Popover,{as:"nav",className:e.cn("rst:z-50",Y.navbarVariants({variant:d,position:J}),H),...Q,children:({open:M,close:l})=>{const I=$(K,l),D=$(G,l);return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"rst:container rst:mx-auto rst:flex rst:items-center rst:justify-between rst:px-4 rst:h-16",children:[r.jsxs(v.Link,{as:p,href:"/",to:"/",variant:"neutral",underline:"none",className:e.cn("rst:flex rst:items-center rst:gap-3 rst:transition-opacity",F.brand),children:[r.jsx("img",{src:s,alt:"",style:V,className:e.cn("rst:shrink-0",o??"rst:rounded-md")}),z??r.jsx("span",{className:"rst:text-xl rst:font-bold rst:tracking-tight",children:b})]}),r.jsxs("div",{className:"rst:hidden rst:md:flex rst:items-center rst:gap-8",children:[r.jsx("div",{className:"rst:flex rst:items-center rst:gap-6",children:k.map(t=>{const i=x===t.path;return r.jsxs(v.Link,{as:p,href:t.path,to:t.path,variant:"neutral",underline:"none",className:e.cn("rst:inline-flex rst:items-center rst:gap-1.5 rst:text-sm rst:transition-colors rst:duration-200",i?F.linkActive:F.linkBase),children:[t.label,t.badge&&r.jsx("span",{className:"rst:inline-flex",children:t.badge})]},t.path)})}),D,I??(n?r.jsxs(m.Menu,{as:"div",className:"rst:relative rst:ml-2",children:[r.jsxs(m.MenuButton,{className:"rst:relative rst:flex rst:rounded-full rst:text-sm rst:focus-visible:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:focus-visible:ring-offset-2 rst:ring-offset-background",children:[r.jsx("span",{className:"rst:sr-only",children:"Open user menu"}),r.jsx(W.Avatar,{initials:n.initials,src:n.avatarSrc,size:"sm",shape:"circle",colorScheme:n.avatarColor??"primary"}),A&&r.jsx("div",{className:"rst:absolute rst:-top-1 rst:-right-2",children:r.jsx(E.Badge,{fill:O,size:"xs",statusBadge:!0,variant:L,children:n.notificationCount})})]}),r.jsx(P.Transition,{as:y.Fragment,enter:"rst:transition rst:ease-out rst:duration-100",enterFrom:"rst:transform rst:opacity-0 rst:scale-95",enterTo:"rst:transform rst:opacity-100 rst:scale-100",leave:"rst:transition rst:ease-in rst:duration-75",leaveFrom:"rst:transform rst:opacity-100 rst:scale-100",leaveTo:"rst:transform rst:opacity-0 rst:scale-95",children:r.jsxs(m.MenuItems,{className:"rst:absolute rst:right-0 rst:z-50 rst:mt-2 rst:w-48 rst:origin-top-right rst:rounded-md rst:bg-white rst:dark:bg-gray-800 rst:py-1 rst:elevation-anchored rst:ring rst:ring-black/5 rst:dark:ring-white/10 rst:focus:outline-hidden rst:divide-y rst:divide-gray-100 rst:dark:divide-gray-700",children:[r.jsxs("div",{className:"rst:py-1",children:[A&&w&&r.jsx(m.MenuItem,{children:({focus:t})=>r.jsxs(g.Button,{variant:"ghost",colorScheme:"neutral",size:"sm",onClick:w,className:e.cn("rst:w-full rst:justify-start rst:rounded-none rst:px-4",t&&"rst:bg-gray-50 rst:dark:bg-gray-700"),startIcon:r.jsx(u.FontAwesomeIcon,{icon:h.faInbox,className:"rst:text-primary-500 rst:w-4"}),children:["Inbox (",n.notificationCount,")"]})}),f&&r.jsx(m.MenuItem,{children:({focus:t})=>r.jsxs("div",{ref:Z,"aria-checked":c,onClick:i=>{i.preventDefault(),f()},className:e.cn("rst:flex rst:w-full rst:items-center rst:justify-between rst:px-4 rst:py-2 rst:text-sm rst:text-gray-700 rst:dark:text-gray-200 rst:cursor-pointer rst:transition-colors",t&&"rst:bg-gray-50 rst:dark:bg-gray-700"),children:[r.jsxs("div",{className:"rst:flex rst:items-center rst:gap-2",children:[r.jsx(u.FontAwesomeIcon,{icon:h.faMoon,className:e.cn("rst:w-4 rst:transition-colors",c?"rst:text-amber-500":"rst:text-gray-400")}),r.jsx("span",{className:"rst:font-medium",children:"Dark Mode"})]}),r.jsx(X,{on:c,size:"xs"})]})})]}),B.length>0&&r.jsx("div",{className:"rst:py-1",children:B.map(t=>r.jsx(m.MenuItem,{children:({focus:i})=>r.jsxs(v.Link,{as:p,href:t.path,to:t.path,variant:"neutral",underline:"none",className:e.cn("rst:flex rst:w-full rst:items-center rst:justify-between rst:gap-2 rst:px-4 rst:py-2 rst:text-sm rst:text-gray-700 rst:dark:text-gray-200 rst:transition-colors",i&&"rst:bg-gray-50 rst:dark:bg-gray-700"),children:[t.label,t.badge&&r.jsx("span",{className:"rst:inline-flex",children:t.badge})]})},t.path))}),N&&r.jsx("div",{className:"rst:py-1",children:r.jsx(m.MenuItem,{children:({focus:t})=>r.jsx(g.Button,{variant:"ghost",colorScheme:"neutral",size:"sm",onClick:N,className:e.cn("rst:w-full rst:justify-start rst:rounded-none rst:px-4",t&&"rst:bg-gray-50 rst:dark:bg-gray-700"),startIcon:r.jsx(u.FontAwesomeIcon,{icon:h.faRightFromBracket,className:"rst:text-gray-400 rst:dark:text-gray-500 rst:w-4"}),children:"Log Out"})})})]})})]}):r.jsx(g.Button,{size:"sm",variant:"solid",colorScheme:"primary",onClick:j,children:"Log In"}))]}),r.jsx("div",{"data-roster-hamburger":!0,className:"rst:flex rst:md:hidden",children:r.jsxs(q.PopoverButton,{className:e.cn("rst:inline-flex rst:items-center rst:justify-center rst:rounded-md rst:p-2 rst:focus-visible:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:focus-visible:ring-offset-2 rst:ring-offset-background",F.hamburger),children:[r.jsx("span",{className:"rst:sr-only",children:"Open main menu"}),M?r.jsx(u.FontAwesomeIcon,{icon:h.faXmark,className:"rst:block rst:h-6 rst:w-6","aria-hidden":"true"}):r.jsxs("div",{className:"rst:relative",children:[r.jsx(u.FontAwesomeIcon,{icon:h.faBars,className:"rst:block rst:h-6 rst:w-6","aria-hidden":"true"}),A&&r.jsx("span",{className:"rst:absolute rst:top-0 rst:right-0 rst:block rst:h-2.5 rst:w-2.5 rst:rounded-full rst:bg-error-500 rst:ring-2 rst:ring-transparent rst:transform rst:translate-x-1/4 rst:-translate-y-1/4"})]})]})})]}),M&&r.jsx(rr,{close:l}),M&&r.jsx(tr,{activePath:x,close:l}),r.jsx(P.Transition,{as:y.Fragment,enter:"rst:duration-200 rst:ease-out",enterFrom:"rst:opacity-0 rst:scale-95",enterTo:"rst:opacity-100 rst:scale-100",leave:"rst:duration-100 rst:ease-in",leaveFrom:"rst:opacity-100 rst:scale-100",leaveTo:"rst:opacity-0 rst:scale-95",children:r.jsx(q.PopoverPanel,{focus:!0,className:"rst:absolute rst:top-0 rst:inset-x-0 rst:z-50 rst:origin-top-right rst:transform rst:p-2 rst:transition rst:md:hidden",children:r.jsxs("div",{"data-roster-mobile-panel":!0,className:"rst:rounded-lg rst:elevation-anchored rst:ring rst:ring-black/5 rst:dark:ring-white/10 rst:divide-y rst:divide-gray-100 rst:dark:divide-gray-700 rst:bg-white rst:dark:bg-gray-800",children:[r.jsxs("div",{className:"rst:px-5 rst:pt-5 rst:pb-6",children:[r.jsxs("div",{className:"rst:flex rst:items-center rst:justify-between",children:[r.jsxs("div",{className:"rst:flex rst:items-center rst:gap-3",children:[r.jsx("img",{src:s,alt:"",style:V,className:e.cn("rst:shrink-0",o??"rst:rounded-md")}),z??r.jsx("span",{className:"rst:font-bold rst:text-gray-900 rst:dark:text-white",children:b})]}),r.jsx("div",{className:"rst:-mr-2",children:r.jsxs(q.PopoverButton,{className:"rst:inline-flex rst:items-center rst:justify-center rst:rounded-md rst:p-2 rst:text-gray-400 rst:hover:bg-gray-100 rst:dark:hover:bg-gray-700 rst:hover:text-gray-500 rst:dark:hover:text-white rst:focus:outline-hidden",children:[r.jsx("span",{className:"rst:sr-only",children:"Close menu"}),r.jsx(u.FontAwesomeIcon,{icon:h.faXmark,className:"rst:h-6 rst:w-6","aria-hidden":"true"})]})})]}),r.jsxs("div",{className:"rst:mt-6",children:[D&&r.jsx("div",{className:"rst:mb-4",children:D}),r.jsxs("nav",{className:"rst:grid rst:gap-y-4",children:[k.map(t=>{const i=x===t.path;return r.jsx(v.Link,{as:p,href:t.path,to:t.path,onClick:()=>l(),variant:"neutral",underline:"none",className:e.cn("rst:-m-3 rst:flex rst:items-center rst:rounded-md rst:p-3 rst:transition-colors","rst:hover:bg-gray-50 rst:dark:hover:bg-gray-700",i?"rst:bg-gray-50 rst:dark:bg-gray-700":"rst:text-gray-900 rst:dark:text-gray-100"),children:r.jsxs("span",{className:e.cn("rst:ml-3 rst:inline-flex rst:items-center rst:gap-1.5 rst:text-base rst:font-medium",i?"rst:text-primary-600 rst:dark:text-primary-400 rst:font-bold":"rst:text-gray-900 rst:dark:text-gray-100"),children:[t.label,t.badge&&r.jsx("span",{className:"rst:inline-flex",children:t.badge})]})},t.path)}),n&&B.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("hr",{className:"rst:border-gray-100 rst:dark:border-gray-700"}),B.map(t=>{const i=x===t.path;return r.jsxs(v.Link,{as:p,href:t.path,to:t.path,onClick:()=>l(),variant:"neutral",underline:"none",className:e.cn("rst:-m-3 rst:flex rst:items-center rst:rounded-md rst:p-3 rst:transition-colors","rst:hover:bg-gray-50 rst:dark:hover:bg-gray-700",i?"rst:bg-gray-50 rst:dark:bg-gray-700":"rst:text-gray-900 rst:dark:text-gray-100"),children:[r.jsx("span",{className:e.cn("rst:ml-3 rst:text-base rst:font-medium",i?"rst:text-primary-600 rst:dark:text-primary-400 rst:font-bold":"rst:text-gray-900 rst:dark:text-gray-100"),children:t.label}),t.badge&&r.jsx("span",{className:"rst:ml-2 rst:inline-flex",children:t.badge})]},t.path)})]})]})]})]}),(n||I||j)&&r.jsx("div",{className:"rst:py-6 rst:px-5 rst:space-y-4",children:I||(!n&&j?r.jsx(g.Button,{variant:"solid",colorScheme:"primary",className:"rst:w-full rst:justify-center",onClick:()=>{j(),l()},children:"Log In"}):r.jsxs(r.Fragment,{children:[A&&w&&r.jsx(g.Button,{variant:"ghost",colorScheme:"neutral",onClick:()=>{w?.(),l()},className:"rst:w-full rst:justify-between rst:px-4 rst:text-base rst:font-medium rst:hover:bg-gray-50 rst:dark:hover:bg-gray-700 rst:text-gray-900 rst:dark:text-gray-100",endIcon:r.jsx(E.Badge,{fill:O,size:"xs",statusBadge:!0,variant:L,children:n?.notificationCount}),children:"Pending Invitations"}),f&&r.jsxs("div",{onClick:t=>{t.preventDefault(),f()},role:"switch","aria-checked":c,tabIndex:0,onKeyDown:t=>{t.repeat||(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),f())},className:"rst:flex rst:w-full rst:items-center rst:justify-between rst:rounded-md rst:px-4 rst:py-2 rst:text-base rst:transition-colors rst:cursor-pointer rst:hover:bg-gray-50 rst:dark:hover:bg-gray-700 rst:text-gray-900 rst:dark:text-gray-100",children:[r.jsxs("div",{className:"rst:flex rst:items-center rst:gap-3 rst:font-medium",children:[r.jsx(u.FontAwesomeIcon,{icon:h.faMoon,className:e.cn("rst:w-5 rst:transition-colors",c?"rst:text-amber-500":"rst:text-gray-400")}),r.jsx("span",{children:"Dark Mode"})]}),r.jsx(X,{on:c,size:"sm"})]}),N&&r.jsx(g.Button,{variant:"outline",colorScheme:"error",className:"rst:w-full rst:justify-center",onClick:()=>{N?.(),l()},children:"Log Out"})]}))})]})})})]})}})};exports.Navbar=sr;
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),p=require("react"),u=require("../../../node_modules/@fortawesome/react-fontawesome/dist/index.cjs"),m=require("../../../node_modules/@fortawesome/free-solid-svg-icons/index.cjs"),e=require("../../../lib/utils.cjs"),sr=require("../../../lib/labels.cjs"),y=require("../../atoms/Button/Button.cjs"),j=require("../../atoms/Link/Link.cjs"),X=require("../../atoms/Badge/Badge.cjs"),er=require("../../atoms/Avatar/Avatar.cjs"),K=require("../../atoms/Switch/switch-variants.cjs"),ar=require("./navbar-variants.cjs"),g=require("../../../node_modules/@headlessui/react/dist/components/menu/menu.cjs"),O=require("../../../node_modules/@headlessui/react/dist/components/popover/popover.cjs"),G=require("../../../node_modules/@headlessui/react/dist/components/transition/transition.cjs");function J({on:s,size:a}){return r.jsx("span",{"aria-hidden":"true","data-testid":"navbar-theme-track","data-checked":s?"":void 0,className:e.cn(K.switchTrackVariants({size:a,variant:"neutral"}),"rst:pointer-events-none"),children:r.jsx("span",{className:e.cn(K.switchThumbVariants({size:a}))})})}const nr=s=>{s?.setAttribute("role","menuitemcheckbox")},Q=(s,a)=>typeof s=="function"?s({close:a}):s,ir={openMainMenu:"Open main menu",closeMainMenu:"Close menu",openUserMenu:"Open user menu",logIn:"Log In",logOut:"Log Out",darkMode:"Dark Mode",pendingInvitations:"Pending Invitations",inbox:s=>`Inbox (${s})`};function or(s){return p.useSyncExternalStore(a=>{if(!s||typeof document>"u")return()=>{};const n=new MutationObserver(a);return n.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>n.disconnect()},()=>s&&document.documentElement.classList.contains("dark"),()=>!1)}function cr({close:s}){return p.useEffect(()=>{const a=n=>{const v=document.querySelector("[data-roster-mobile-panel]"),N=document.querySelector("[data-roster-hamburger]"),f=n.target;!v?.contains(f)&&!N?.contains(f)&&s()};return document.addEventListener("pointerdown",a,{capture:!0}),()=>document.removeEventListener("pointerdown",a,{capture:!0})},[s]),null}function lr({activePath:s,close:a}){const n=p.useRef(s);return p.useEffect(()=>{n.current!==s&&(n.current=s,a())},[s,a]),null}const dr=({logoSrc:s,logoSize:a="2rem",logoHeight:n,logoWidth:v,logoClassName:N,brandName:f,items:E,activePath:w,routerElement:k,user:i,onLogin:M,onLogout:B,onInboxClick:I,onThemeToggle:b,actions:Y,brandElement:R,navActions:Z,userMenuItems:A=[],className:_,variant:l="default",position:H="sticky",themeMode:z,labels:W,notificationVariant:V="error",notificationFill:T="solid",...rr})=>{const o=sr.withLabels(ir,W),F=(i?.notificationCount||0)>0,q=h=>typeof h=="number"?`${h}px`:h,$=n!==void 0||v!==void 0,P=$?{width:v===void 0?"auto":q(v),height:n===void 0?"auto":q(n)}:{width:q(a),height:q(a)},U=$&&"rst:object-contain rst:object-left rst:rtl:object-right",tr=or(z==="auto"),d=(z==="auto"?tr?"dark":"light":z??(l==="white"||l==="default"?"light":"dark"))==="dark",C=l==="slate"||l==="primary"||l==="default"&&d||l==="white"&&d||l==="transparent"&&d,S=l==="primary"?{brand:"rst:text-primary-700-ink rst:hover:text-primary-700-ink/80 rst:dark:text-white rst:dark:hover:text-gray-200",linkBase:"rst:text-primary-700-ink/80 rst:hover:text-primary-700-ink rst:dark:text-gray-300 rst:dark:hover:text-white",linkActive:"rst:text-primary-700-ink rst:font-semibold rst:hover:text-primary-700-ink/80 rst:dark:text-primary-400 rst:dark:hover:text-primary-300",hamburger:"rst:text-primary-700-ink/80 rst:hover:bg-primary-700-ink/10 rst:hover:text-primary-700-ink rst:dark:text-gray-300 rst:dark:hover:bg-white/10 rst:dark:hover:text-white"}:{brand:C?"rst:text-white rst:dark:text-white rst:hover:text-gray-200 rst:dark:hover:text-gray-200":"rst:text-gray-900 rst:dark:text-gray-900 rst:hover:text-gray-600 rst:dark:hover:text-gray-600",linkBase:C?"rst:text-gray-300 rst:dark:text-gray-300 rst:hover:text-white rst:dark:hover:text-white":"rst:text-gray-600 rst:dark:text-gray-600 rst:hover:text-gray-900 rst:dark:hover:text-gray-900",linkActive:C?"rst:text-primary-400 rst:dark:text-primary-400 rst:font-semibold rst:hover:text-primary-300 rst:dark:hover:text-primary-300":"rst:text-primary-600 rst:dark:text-primary-600 rst:font-semibold rst:hover:text-primary-700 rst:dark:hover:text-primary-700",hamburger:C?"rst:text-gray-300 rst:dark:text-gray-300 rst:hover:bg-white/10 rst:dark:hover:bg-white/10 rst:hover:text-white rst:dark:hover:text-white":"rst:text-gray-500 rst:dark:text-gray-500 rst:hover:bg-gray-100 rst:dark:hover:bg-gray-100 rst:hover:text-gray-700 rst:dark:hover:text-gray-700"};return r.jsx(O.Popover,{as:"nav",className:e.cn("rst:z-50",ar.navbarVariants({variant:l,position:H}),_),...rr,children:({open:h,close:x})=>{const D=Q(Y,x),L=Q(Z,x);return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"rst:container rst:mx-auto rst:flex rst:items-center rst:justify-between rst:px-4 rst:h-16",children:[r.jsxs(j.Link,{as:k,href:"/",to:"/",variant:"neutral",underline:"none",className:e.cn("rst:flex rst:items-center rst:gap-3 rst:transition-opacity",S.brand),children:[r.jsx("img",{src:s,alt:"",style:P,className:e.cn("rst:shrink-0",U,N??"rst:rounded-md")}),R??r.jsx("span",{className:"rst:text-xl rst:font-bold rst:tracking-tight",children:f})]}),r.jsxs("div",{className:"rst:hidden rst:md:flex rst:items-center rst:gap-8",children:[r.jsx("div",{className:"rst:flex rst:items-center rst:gap-6",children:E.map(t=>{const c=w===t.path;return r.jsxs(j.Link,{as:k,href:t.path,to:t.path,variant:"neutral",underline:"none",className:e.cn("rst:inline-flex rst:items-center rst:gap-1.5 rst:text-sm rst:transition-colors rst:duration-200",c?S.linkActive:S.linkBase),children:[t.label,t.badge&&r.jsx("span",{className:"rst:inline-flex",children:t.badge})]},t.path)})}),L,D??(i?r.jsxs(g.Menu,{as:"div",className:"rst:relative rst:ml-2",children:[r.jsxs(g.MenuButton,{className:"rst:relative rst:flex rst:rounded-full rst:text-sm rst:focus-visible:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:focus-visible:ring-offset-2 rst:ring-offset-background",children:[r.jsx("span",{className:"rst:sr-only",children:o.openUserMenu}),r.jsx(er.Avatar,{"aria-hidden":"true",alt:"",initials:i.initials,src:i.avatarSrc,size:"sm",shape:"circle",colorScheme:i.avatarColor??"primary"}),F&&r.jsx("div",{className:"rst:absolute rst:-top-1 rst:-right-2",children:r.jsx(X.Badge,{fill:T,size:"xs",statusBadge:!0,variant:V,children:i.notificationCount})})]}),r.jsx(G.Transition,{as:p.Fragment,enter:"rst:transition rst:ease-out rst:duration-100",enterFrom:"rst:transform rst:opacity-0 rst:scale-95",enterTo:"rst:transform rst:opacity-100 rst:scale-100",leave:"rst:transition rst:ease-in rst:duration-75",leaveFrom:"rst:transform rst:opacity-100 rst:scale-100",leaveTo:"rst:transform rst:opacity-0 rst:scale-95",children:r.jsxs(g.MenuItems,{className:"rst:absolute rst:right-0 rst:z-50 rst:mt-2 rst:w-48 rst:origin-top-right rst:rounded-md rst:bg-white rst:dark:bg-gray-800 rst:py-1 rst:elevation-anchored rst:ring rst:ring-black/5 rst:dark:ring-white/10 rst:focus:outline-hidden rst:divide-y rst:divide-gray-100 rst:dark:divide-gray-700",children:[r.jsxs("div",{className:"rst:py-1",children:[F&&I&&r.jsx(g.MenuItem,{children:({focus:t})=>r.jsx(y.Button,{variant:"ghost",colorScheme:"neutral",size:"sm",onClick:I,className:e.cn("rst:w-full rst:justify-start rst:rounded-none rst:px-4",t&&"rst:bg-gray-50 rst:dark:bg-gray-700"),startIcon:r.jsx(u.FontAwesomeIcon,{icon:m.faInbox,className:"rst:text-primary-500 rst:w-4"}),children:o.inbox(i.notificationCount??0)})}),b&&r.jsx(g.MenuItem,{children:({focus:t})=>r.jsxs("div",{ref:nr,"aria-checked":d,onClick:c=>{c.preventDefault(),b()},className:e.cn("rst:flex rst:w-full rst:items-center rst:justify-between rst:px-4 rst:py-2 rst:text-sm rst:text-gray-700 rst:dark:text-gray-200 rst:cursor-pointer rst:transition-colors",t&&"rst:bg-gray-50 rst:dark:bg-gray-700"),children:[r.jsxs("div",{className:"rst:flex rst:items-center rst:gap-2",children:[r.jsx(u.FontAwesomeIcon,{icon:m.faMoon,className:e.cn("rst:w-4 rst:transition-colors",d?"rst:text-amber-500":"rst:text-gray-400")}),r.jsx("span",{className:"rst:font-medium",children:o.darkMode})]}),r.jsx(J,{on:d,size:"xs"})]})})]}),A.length>0&&r.jsx("div",{className:"rst:py-1",children:A.map(t=>r.jsx(g.MenuItem,{children:({focus:c})=>r.jsxs(j.Link,{as:k,href:t.path,to:t.path,variant:"neutral",underline:"none",className:e.cn("rst:flex rst:w-full rst:items-center rst:justify-between rst:gap-2 rst:px-4 rst:py-2 rst:text-sm rst:text-gray-700 rst:dark:text-gray-200 rst:transition-colors",c&&"rst:bg-gray-50 rst:dark:bg-gray-700"),children:[t.label,t.badge&&r.jsx("span",{className:"rst:inline-flex",children:t.badge})]})},t.path))}),B&&r.jsx("div",{className:"rst:py-1",children:r.jsx(g.MenuItem,{children:({focus:t})=>r.jsx(y.Button,{variant:"ghost",colorScheme:"neutral",size:"sm",onClick:B,className:e.cn("rst:w-full rst:justify-start rst:rounded-none rst:px-4",t&&"rst:bg-gray-50 rst:dark:bg-gray-700"),startIcon:r.jsx(u.FontAwesomeIcon,{icon:m.faRightFromBracket,className:"rst:text-gray-400 rst:dark:text-gray-500 rst:w-4"}),children:o.logOut})})})]})})]}):r.jsx(y.Button,{size:"sm",variant:"solid",colorScheme:"primary",onClick:M,children:o.logIn}))]}),r.jsx("div",{"data-roster-hamburger":!0,className:"rst:flex rst:md:hidden",children:r.jsxs(O.PopoverButton,{className:e.cn("rst:inline-flex rst:items-center rst:justify-center rst:rounded-md rst:p-2 rst:focus-visible:outline-hidden rst:focus-visible:ring-2 rst:focus-visible:ring-ring rst:focus-visible:ring-offset-2 rst:ring-offset-background",S.hamburger),children:[r.jsx("span",{className:"rst:sr-only",children:o.openMainMenu}),h?r.jsx(u.FontAwesomeIcon,{icon:m.faXmark,className:"rst:block rst:h-6 rst:w-6","aria-hidden":"true"}):r.jsxs("div",{className:"rst:relative",children:[r.jsx(u.FontAwesomeIcon,{icon:m.faBars,className:"rst:block rst:h-6 rst:w-6","aria-hidden":"true"}),F&&r.jsx("span",{className:"rst:absolute rst:top-0 rst:right-0 rst:block rst:h-2.5 rst:w-2.5 rst:rounded-full rst:bg-error-500 rst:ring-2 rst:ring-transparent rst:transform rst:translate-x-1/4 rst:-translate-y-1/4"})]})]})})]}),h&&r.jsx(cr,{close:x}),h&&r.jsx(lr,{activePath:w,close:x}),r.jsx(G.Transition,{as:p.Fragment,enter:"rst:duration-200 rst:ease-out",enterFrom:"rst:opacity-0 rst:scale-95",enterTo:"rst:opacity-100 rst:scale-100",leave:"rst:duration-100 rst:ease-in",leaveFrom:"rst:opacity-100 rst:scale-100",leaveTo:"rst:opacity-0 rst:scale-95",children:r.jsx(O.PopoverPanel,{focus:!0,className:"rst:absolute rst:top-0 rst:inset-x-0 rst:z-50 rst:origin-top-right rst:transform rst:p-2 rst:transition rst:md:hidden",children:r.jsxs("div",{"data-roster-mobile-panel":!0,className:"rst:rounded-lg rst:elevation-anchored rst:ring rst:ring-black/5 rst:dark:ring-white/10 rst:divide-y rst:divide-gray-100 rst:dark:divide-gray-700 rst:bg-white rst:dark:bg-gray-800",children:[r.jsxs("div",{className:"rst:px-5 rst:pt-5 rst:pb-6",children:[r.jsxs("div",{className:"rst:flex rst:items-center rst:justify-between",children:[r.jsxs("div",{className:"rst:flex rst:items-center rst:gap-3",children:[r.jsx("img",{src:s,alt:"",style:P,className:e.cn("rst:shrink-0",U,N??"rst:rounded-md")}),R??r.jsx("span",{className:"rst:font-bold rst:text-gray-900 rst:dark:text-white",children:f})]}),r.jsx("div",{className:"rst:-mr-2",children:r.jsxs(O.PopoverButton,{className:"rst:inline-flex rst:items-center rst:justify-center rst:rounded-md rst:p-2 rst:text-gray-400 rst:hover:bg-gray-100 rst:dark:hover:bg-gray-700 rst:hover:text-gray-500 rst:dark:hover:text-white rst:focus:outline-hidden",children:[r.jsx("span",{className:"rst:sr-only",children:o.closeMainMenu}),r.jsx(u.FontAwesomeIcon,{icon:m.faXmark,className:"rst:h-6 rst:w-6","aria-hidden":"true"})]})})]}),r.jsxs("div",{className:"rst:mt-6",children:[L&&r.jsx("div",{className:"rst:mb-4",children:L}),r.jsxs("nav",{className:"rst:grid rst:gap-y-4",children:[E.map(t=>{const c=w===t.path;return r.jsx(j.Link,{as:k,href:t.path,to:t.path,onClick:()=>x(),variant:"neutral",underline:"none",className:e.cn("rst:-m-3 rst:flex rst:items-center rst:rounded-md rst:p-3 rst:transition-colors","rst:hover:bg-gray-50 rst:dark:hover:bg-gray-700",c?"rst:bg-gray-50 rst:dark:bg-gray-700":"rst:text-gray-900 rst:dark:text-gray-100"),children:r.jsxs("span",{className:e.cn("rst:ml-3 rst:inline-flex rst:items-center rst:gap-1.5 rst:text-base rst:font-medium",c?"rst:text-primary-600 rst:dark:text-primary-400 rst:font-bold":"rst:text-gray-900 rst:dark:text-gray-100"),children:[t.label,t.badge&&r.jsx("span",{className:"rst:inline-flex",children:t.badge})]})},t.path)}),i&&A.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("hr",{className:"rst:border-gray-100 rst:dark:border-gray-700"}),A.map(t=>{const c=w===t.path;return r.jsxs(j.Link,{as:k,href:t.path,to:t.path,onClick:()=>x(),variant:"neutral",underline:"none",className:e.cn("rst:-m-3 rst:flex rst:items-center rst:rounded-md rst:p-3 rst:transition-colors","rst:hover:bg-gray-50 rst:dark:hover:bg-gray-700",c?"rst:bg-gray-50 rst:dark:bg-gray-700":"rst:text-gray-900 rst:dark:text-gray-100"),children:[r.jsx("span",{className:e.cn("rst:ml-3 rst:text-base rst:font-medium",c?"rst:text-primary-600 rst:dark:text-primary-400 rst:font-bold":"rst:text-gray-900 rst:dark:text-gray-100"),children:t.label}),t.badge&&r.jsx("span",{className:"rst:ml-2 rst:inline-flex",children:t.badge})]},t.path)})]})]})]})]}),(i||D||M)&&r.jsx("div",{className:"rst:py-6 rst:px-5 rst:space-y-4",children:D||(!i&&M?r.jsx(y.Button,{variant:"solid",colorScheme:"primary",className:"rst:w-full rst:justify-center",onClick:()=>{M(),x()},children:o.logIn}):r.jsxs(r.Fragment,{children:[F&&I&&r.jsx(y.Button,{variant:"ghost",colorScheme:"neutral",onClick:()=>{I?.(),x()},className:"rst:w-full rst:justify-between rst:px-4 rst:text-base rst:font-medium rst:hover:bg-gray-50 rst:dark:hover:bg-gray-700 rst:text-gray-900 rst:dark:text-gray-100",endIcon:r.jsx(X.Badge,{fill:T,size:"xs",statusBadge:!0,variant:V,children:i?.notificationCount}),children:o.pendingInvitations}),b&&r.jsxs("div",{onClick:t=>{t.preventDefault(),b()},role:"switch","aria-checked":d,tabIndex:0,onKeyDown:t=>{t.repeat||(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),b())},className:"rst:flex rst:w-full rst:items-center rst:justify-between rst:rounded-md rst:px-4 rst:py-2 rst:text-base rst:transition-colors rst:cursor-pointer rst:hover:bg-gray-50 rst:dark:hover:bg-gray-700 rst:text-gray-900 rst:dark:text-gray-100",children:[r.jsxs("div",{className:"rst:flex rst:items-center rst:gap-3 rst:font-medium",children:[r.jsx(u.FontAwesomeIcon,{icon:m.faMoon,className:e.cn("rst:w-5 rst:transition-colors",d?"rst:text-amber-500":"rst:text-gray-400")}),r.jsx("span",{children:o.darkMode})]}),r.jsx(J,{on:d,size:"sm"})]}),B&&r.jsx(y.Button,{variant:"outline",colorScheme:"error",className:"rst:w-full rst:justify-center",onClick:()=>{B?.(),x()},children:o.logOut})]}))})]})})})]})}})};exports.Navbar=dr;
|
|
@@ -18,13 +18,46 @@ export interface NavItem {
|
|
|
18
18
|
* Appears in both the desktop nav and the mobile slide-out panel. */
|
|
19
19
|
badge?: React.ReactNode;
|
|
20
20
|
}
|
|
21
|
+
/** Every word Navbar shows or says of its own. Pass any of them in `labels` to replace it. */
|
|
22
|
+
export interface NavbarLabels {
|
|
23
|
+
/** The menu button's name, on a phone. */
|
|
24
|
+
openMainMenu: string;
|
|
25
|
+
/** The menu panel's close button. */
|
|
26
|
+
closeMainMenu: string;
|
|
27
|
+
/** The avatar button's name. */
|
|
28
|
+
openUserMenu: string;
|
|
29
|
+
/** The log-in button, without a `user`. */
|
|
30
|
+
logIn: string;
|
|
31
|
+
/** The log-out item, with `onLogout`. */
|
|
32
|
+
logOut: string;
|
|
33
|
+
/** The theme row, with `onThemeToggle`. */
|
|
34
|
+
darkMode: string;
|
|
35
|
+
/** The menu panel's inbox button, with `onInboxClick` and a `notificationCount`. */
|
|
36
|
+
pendingInvitations: string;
|
|
37
|
+
/** The user menu's inbox item, with `onInboxClick` and a `notificationCount`. */
|
|
38
|
+
inbox: (count: number) => string;
|
|
39
|
+
}
|
|
21
40
|
export interface NavbarProps extends React.HTMLAttributes<HTMLElement>, VariantProps<typeof navbarVariants> {
|
|
22
41
|
logoSrc: string;
|
|
23
42
|
/**
|
|
24
|
-
* Size of
|
|
25
|
-
* Defaults to `2rem`, the previous hard-coded `h-8 w-8`.
|
|
43
|
+
* Size of a square logo: its width and its height. Accepts any CSS length
|
|
44
|
+
* (`"2.75rem"`, `44`). Defaults to `2rem`, the previous hard-coded `h-8 w-8`.
|
|
26
45
|
*/
|
|
27
46
|
logoSize?: string | number;
|
|
47
|
+
/**
|
|
48
|
+
* The logo's height, for a logo that isn't square. A wide lockup takes
|
|
49
|
+
* `logoHeight` alone and keeps its own proportions: its width follows the
|
|
50
|
+
* image. Either this or `logoWidth` replaces `logoSize`. When you know the
|
|
51
|
+
* ratio, set both: the box is then held before the image loads, so the name
|
|
52
|
+
* beside it doesn't move.
|
|
53
|
+
*/
|
|
54
|
+
logoHeight?: string | number;
|
|
55
|
+
/**
|
|
56
|
+
* The logo's width, for a logo that isn't square. Alone, the height follows
|
|
57
|
+
* the image; with `logoHeight`, the image is fitted inside that box,
|
|
58
|
+
* never stretched.
|
|
59
|
+
*/
|
|
60
|
+
logoWidth?: string | number;
|
|
28
61
|
/**
|
|
29
62
|
* Classes applied to the logo image. Replaces the default rounding, so a
|
|
30
63
|
* circular mark can pass `"rst:rounded-full"` and a square one `""`.
|
|
@@ -53,6 +86,8 @@ export interface NavbarProps extends React.HTMLAttributes<HTMLElement>, VariantP
|
|
|
53
86
|
* entirely and the mode is inferred from `variant`, as before.
|
|
54
87
|
*/
|
|
55
88
|
themeMode?: "light" | "dark" | "auto";
|
|
89
|
+
/** The component's own words, replaced; any left out stay English. */
|
|
90
|
+
labels?: Partial<NavbarLabels>;
|
|
56
91
|
notificationVariant?: "primary" | "error" | "amber" | "success" | "neutral" | "orange" | "teal" | "purple";
|
|
57
92
|
/**
|
|
58
93
|
* Fill style of the notification count badge. Defaults to `"solid"`, which
|
|
@@ -96,5 +131,5 @@ export interface NavbarProps extends React.HTMLAttributes<HTMLElement>, VariantP
|
|
|
96
131
|
*/
|
|
97
132
|
userMenuItems?: NavItem[];
|
|
98
133
|
}
|
|
99
|
-
declare const Navbar: ({ logoSrc, logoSize, logoClassName, brandName, items, activePath, routerElement, user, onLogin, onLogout, onInboxClick, onThemeToggle, actions, brandElement, navActions, userMenuItems, className, variant, position, themeMode, notificationVariant, notificationFill, ...props }: NavbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
134
|
+
declare const Navbar: ({ logoSrc, logoSize, logoHeight, logoWidth, logoClassName, brandName, items, activePath, routerElement, user, onLogin, onLogout, onInboxClick, onThemeToggle, actions, brandElement, navActions, userMenuItems, className, variant, position, themeMode, labels, notificationVariant, notificationFill, ...props }: NavbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
100
135
|
export { Navbar };
|