@gearbox-protocol/ui-kit 3.14.0-next.55 → 3.14.0-next.57
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/cjs/components/composites/notification-center/notification-center.cjs +1 -1
- package/dist/cjs/components/tab-control/tab-control.cjs +1 -1
- package/dist/esm/components/composites/notification-center/notification-center.js +1 -1
- package/dist/esm/components/tab-control/tab-control.js +1 -1
- package/dist/types/components/composites/notification-center/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("@fortawesome/free-solid-svg-icons"),f=require("../../icons/fa-icon.cjs"),y=require("../../simple-dropdown/simple-dropdown.cjs");require("../../simple-dropdown/simple-dropdown-menu-item.cjs");const r=require("../../typed-intl/index.cjs"),n=require("../../typography/typography.cjs"),s=require("../../../test-ids/notification-center.cjs");require("react");require("@gearbox-protocol/sdk");const l=require("../../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk/common-utils");require("luxon");require("../../../utils/z-index.cjs");function g({row:t}){const i=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:l.cn("mt-[5px] size-[7px] shrink-0 rounded-full",t.isReady?"bg-success":"bg-gray-50")}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx(n.Typography,{as:"span",variant:"bodySmall",className:"truncate text-foreground",children:t.title}),e.jsx(n.Typography,{as:"span",variant:"bodySmall",color:t.isReady?"success":"muted",className:"shrink-0 text-right",children:t.statusLabel})]}),e.jsx(n.Typography,{as:"span",variant:"bodySmall",color:"muted",children:t.positionName})]})]});return t.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("@fortawesome/free-solid-svg-icons"),f=require("../../icons/fa-icon.cjs"),y=require("../../simple-dropdown/simple-dropdown.cjs");require("../../simple-dropdown/simple-dropdown-menu-item.cjs");const r=require("../../typed-intl/index.cjs"),n=require("../../typography/typography.cjs"),s=require("../../../test-ids/notification-center.cjs");require("react");require("@gearbox-protocol/sdk");const l=require("../../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk/common-utils");require("luxon");require("../../../utils/z-index.cjs");function g({row:t}){const i=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:l.cn("mt-[5px] size-[7px] shrink-0 rounded-full",t.isReady?"bg-success":"bg-gray-50")}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx(n.Typography,{as:"span",variant:"bodySmall",className:"truncate text-foreground",children:t.title}),e.jsx(n.Typography,{as:"span",variant:"bodySmall",color:t.isReady?"success":"muted",className:"shrink-0 text-right",children:t.statusLabel})]}),e.jsx(n.Typography,{as:"span",variant:"bodySmall",color:"muted",children:t.positionName})]})]});return t.isClickable&&t.onExecute?e.jsx("button",{type:"button","data-testid":s.notificationCenterTestIds.requestRow,onClick:t.onExecute,className:"flex w-full cursor-pointer items-start gap-2 py-4 text-left hover:opacity-80",children:i}):e.jsx("div",{"data-testid":s.notificationCenterTestIds.requestRow,className:"flex w-full items-start gap-2 py-4",children:i})}function h({open:t,onOpenChange:i,deferredRows:o,successRows:c,deferredCount:d,hasReady:m,hasAny:u,onClear:p}){return e.jsx(y.SimpleDropdown,{open:t,onOpenChange:i,align:"end",asChild:!0,className:"w-[460px] max-w-[calc(100vw-32px)] bg-modal p-0",title:e.jsxs("button",{type:"button","data-testid":s.notificationCenterTestIds.trigger,className:"relative flex size-8 items-center justify-center rounded-md text-secondary-foreground hover:text-foreground",children:[e.jsx(f.FaIcon,{icon:x.faBell,className:"size-4"}),d>0?e.jsx("span",{"data-testid":s.notificationCenterTestIds.badge,className:l.cn("absolute -right-0.5 -top-0.5 flex size-[15px] items-center justify-center rounded-full text-[10px] font-medium leading-none text-white",m?"bg-primary":"bg-gray-50"),children:d}):null]}),children:e.jsxs("div",{"data-testid":s.notificationCenterTestIds.panel,className:"flex flex-col p-8",children:[u?null:e.jsx(n.Typography,{as:"span",variant:"bodySmall",color:"muted","data-testid":s.notificationCenterTestIds.empty,children:e.jsx(r.FormattedMessageTyped,{messageId:"components.notificationCenter.empty"})}),o.length>0?e.jsxs("div",{className:"flex flex-col","data-testid":s.notificationCenterTestIds.requestsSection,children:[e.jsx(n.Typography,{as:"span",variant:"bodySmall",className:"pb-2 font-medium text-foreground",children:e.jsx(r.FormattedMessageTyped,{messageId:"components.notificationCenter.requests"})}),e.jsx("div",{className:"-mr-2 flex max-h-[40dvh] flex-col divide-y divide-gray-60 overflow-y-auto overflow-x-hidden pr-2 [scrollbar-gutter:stable]",children:o.map(a=>e.jsx(g,{row:a},a.id))})]}):null,c.length>0?e.jsxs("div",{className:l.cn("flex flex-col",o.length>0&&"mt-4 pt-4"),"data-testid":s.notificationCenterTestIds.successSection,children:[e.jsxs("div",{className:"flex items-center justify-between pb-2",children:[e.jsx(n.Typography,{as:"span",variant:"bodySmall",className:"font-medium text-foreground",children:e.jsx(r.FormattedMessageTyped,{messageId:"components.notificationCenter.recent"})}),p?e.jsx("button",{type:"button","data-testid":s.notificationCenterTestIds.clear,onClick:p,className:"cursor-pointer text-xs text-secondary-foreground hover:text-foreground",children:e.jsx(r.FormattedMessageTyped,{messageId:"components.notificationCenter.clear"})}):null]}),e.jsx("div",{className:"-mr-2 flex max-h-[30dvh] flex-col overflow-y-auto overflow-x-hidden pr-2 [scrollbar-gutter:stable]",children:c.map(a=>e.jsxs("button",{type:"button","data-testid":s.notificationCenterTestIds.successRow,onClick:a.onView,className:"flex cursor-pointer items-center justify-between gap-3 py-2 text-left hover:opacity-80",children:[e.jsx(n.Typography,{as:"span",variant:"bodySmall",className:"truncate text-foreground",children:a.label}),e.jsx(n.Typography,{as:"span",variant:"caption",color:"muted",children:a.timestampLabel})]},a.id))})]}):null]})})}exports.NotificationCenter=h;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),i=require("react"),p=require("../navigation-context/navigation-context.cjs");require("@gearbox-protocol/sdk");const x=require("../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk/common-utils");require("luxon");require("../../utils/z-index.cjs");function w(n){if(!n)return null;const{width:r=0,height:o=0}=n?.getBoundingClientRect()||{},a=n?.offsetTop||0,s=n?.offsetLeft||0;return{width:r,height:o,left:s,top:a}}function C(n,r,o){const a=i.useRef(null),[s,h]=i.useState(null),l=i.useRef(null),d=i.useCallback(e=>{h(e),l.current=e},[]);return i.useEffect(()=>{const e=o.current[n],c=()=>{const u=w(e),b=u?.height!==l.current?.height,g=u?.width!==l.current?.width,m=u?.left!==l.current?.left,v=u?.top!==l.current?.top;(b||g||m||v)&&d(u)};a.current=c,c();const t=e?new ResizeObserver(c):null;return e&&t?.observe(e),()=>{e&&t?.unobserve(e)}},[n,o,d]),i.useEffect(()=>{const e=r?new ResizeObserver(()=>{a.current?.()}):null;return r&&e?.observe(r),()=>{r&&e?.unobserve(r)}},[r]),s}function T({className:n,tabs:r,state:o,showBorder:a=!0,tabItemWrapPadding:s,variant:h="auto"}){const l=i.useRef(null),d=i.useRef({}),e=C(o.id,l.current,d),c=(t,u)=>()=>o.handleTabChange(t,u);return f.jsx("div",{className:x.cn("relative w-full flex flex-col flex-wrap",n),children:f.jsxs("div",{ref:l,className:x.cn("relative w-full max-w-full grow-0 shrink-0 basis-full flex items-stretch overflow-x-auto overflow-y-hidden","scrollbar-hidden",a&&"after:content-[''] after:absolute after:bottom-0 after:left-0 after:right-0 after:h-px after:bg-border"),children:[e&&f.jsx("div",{className:"absolute left-0 h-[3px] bg-accent transition-[transform] duration-200 ease-in-out pointer-events-none bottom-[-1px]",style:{width:`${e.width}px`,transform:`translate(${e.left}px)`}}),r.map((t,u,b)=>{const g=u===b.length-1;return f.jsx("button",{ref:m=>{d.current[t.id]=m},type:"button",onClick:t.disabled?void 0:c(t.id,u),disabled:t.disabled,className:x.cn("flex items-center bg-transparent border-none shrink-0 text-foreground",s?"":"p-0 pb-3.5",h==="equal"?"grow shrink-0 basis-[0%] justify-center min-w-0":!g&&"mr-10 max-[500px]:mr-8",t.disabled&&"cursor-not-allowed",!t.disabled&&"cursor-pointer",!t.disabled&&"hover:text-foreground hover:[&>*]:text-foreground"),style:s?{padding:s}:void 0,children:t.item},`tab-item-${t.id}`)})]})})}function j({icon:n,label:r,selected:o,textSize:a="default",amount:s}){return f.jsxs(f.Fragment,{children:[n&&f.jsx("div",{className:x.cn("mr-3",o?"text-foreground":"text-secondary-foreground"),children:n}),f.jsx("div",{className:x.cn("m-0 p-0 whitespace-nowrap",a==="default"&&"text-sm leading-[17px] font-normal",a==="unset"&&"text-[unset] leading-[unset] font-[unset]",o?"text-foreground":"text-secondary-foreground"),children:r}),!!s&&f.jsx("div",{className:"ml-1.5",children:f.jsx("div",{className:"py-0.5 px-[9px] text-[11px] leading-[150%] font-normal bg-gray-50 rounded-[19px]",children:s})})]})}function N(n,r=0){const[o,a]=i.useState(n),[s,h]=i.useState(r),l=i.useCallback((d,e)=>{a(d),h(e)},[]);return{id:o,index:s,handleTabChange:l}}function y(n){const{useLocation:r,useNavigate:o}=p.useNavigationAdapter(),{hash:a}=r(),s=o(),h=i.useMemo(()=>n.reduce((t,u,b)=>(t[u.id]={id:u.id,index:b},t),{}),[n]),l=i.useMemo(()=>a.slice(1).toLowerCase(),[a]),{id:d,index:e}=h[l]||{},c=i.useCallback(t=>{s(`#${t}`)},[s]);return{id:d,index:e,handleTabChange:c}}function S({defaultTabs:n,pathRoot:r,selectedSection:o}){const{useNavigate:a}=p.useNavigationAdapter(),s=a(),h=i.useMemo(()=>n.reduce((c,t,u)=>(c[t.id]={id:t.id,index:u},c),{}),[n]),l=i.useCallback(c=>{s(`${r}/${c}`)},[s,r]),{id:d,index:e}=h[o]||{};return{id:d,index:e,handleTabChange:l}}exports.TabControl=T;exports.TabItem=j;exports.useHashTabs=y;exports.useSectionTab=S;exports.useTabControl=N;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),i=require("react"),p=require("../navigation-context/navigation-context.cjs");require("@gearbox-protocol/sdk");const x=require("../../utils/cn.cjs");require("sonner");require("@gearbox-protocol/sdk/common-utils");require("luxon");require("../../utils/z-index.cjs");function w(n){if(!n)return null;const{width:r=0,height:o=0}=n?.getBoundingClientRect()||{},a=n?.offsetTop||0,s=n?.offsetLeft||0;return{width:r,height:o,left:s,top:a}}function C(n,r,o){const a=i.useRef(null),[s,h]=i.useState(null),l=i.useRef(null),d=i.useCallback(e=>{h(e),l.current=e},[]);return i.useEffect(()=>{const e=o.current[n],c=()=>{const u=w(e),b=u?.height!==l.current?.height,g=u?.width!==l.current?.width,m=u?.left!==l.current?.left,v=u?.top!==l.current?.top;(b||g||m||v)&&d(u)};a.current=c,c();const t=e?new ResizeObserver(c):null;return e&&t?.observe(e),()=>{e&&t?.unobserve(e)}},[n,o,d]),i.useEffect(()=>{const e=r?new ResizeObserver(()=>{a.current?.()}):null;return r&&e?.observe(r),()=>{r&&e?.unobserve(r)}},[r]),s}function T({className:n,tabs:r,state:o,showBorder:a=!0,tabItemWrapPadding:s,variant:h="auto"}){const l=i.useRef(null),d=i.useRef({}),e=C(o.id,l.current,d),c=(t,u)=>()=>o.handleTabChange(t,u);return f.jsx("div",{className:x.cn("relative w-full flex flex-col flex-wrap",n),children:f.jsxs("div",{ref:l,className:x.cn("relative w-full max-w-full grow-0 shrink-0 basis-full flex items-stretch overflow-x-auto overflow-y-hidden","scrollbar-hidden",a&&"after:content-[''] after:absolute after:bottom-0 after:left-0 after:right-0 after:h-px after:bg-border"),children:[e&&f.jsx("div",{className:"absolute left-0 h-[3px] bg-accent transition-[transform] duration-200 ease-in-out pointer-events-none bottom-[-1px]",style:{width:`${e.width}px`,transform:`translate(${e.left}px)`}}),r.map((t,u,b)=>{const g=u===b.length-1;return f.jsx("button",{ref:m=>{d.current[t.id]=m},type:"button",onClick:t.disabled?void 0:c(t.id,u),disabled:t.disabled,className:x.cn("flex items-center bg-transparent border-none shrink-0 text-foreground outline-none",s?"":"p-0 pb-3.5",h==="equal"?"grow shrink-0 basis-[0%] justify-center min-w-0":!g&&"mr-10 max-[500px]:mr-8",t.disabled&&"cursor-not-allowed",!t.disabled&&"cursor-pointer",!t.disabled&&"hover:text-foreground hover:[&>*]:text-foreground"),style:s?{padding:s}:void 0,children:t.item},`tab-item-${t.id}`)})]})})}function j({icon:n,label:r,selected:o,textSize:a="default",amount:s}){return f.jsxs(f.Fragment,{children:[n&&f.jsx("div",{className:x.cn("mr-3",o?"text-foreground":"text-secondary-foreground"),children:n}),f.jsx("div",{className:x.cn("m-0 p-0 whitespace-nowrap",a==="default"&&"text-sm leading-[17px] font-normal",a==="unset"&&"text-[unset] leading-[unset] font-[unset]",o?"text-foreground":"text-secondary-foreground"),children:r}),!!s&&f.jsx("div",{className:"ml-1.5",children:f.jsx("div",{className:"py-0.5 px-[9px] text-[11px] leading-[150%] font-normal bg-gray-50 rounded-[19px]",children:s})})]})}function N(n,r=0){const[o,a]=i.useState(n),[s,h]=i.useState(r),l=i.useCallback((d,e)=>{a(d),h(e)},[]);return{id:o,index:s,handleTabChange:l}}function y(n){const{useLocation:r,useNavigate:o}=p.useNavigationAdapter(),{hash:a}=r(),s=o(),h=i.useMemo(()=>n.reduce((t,u,b)=>(t[u.id]={id:u.id,index:b},t),{}),[n]),l=i.useMemo(()=>a.slice(1).toLowerCase(),[a]),{id:d,index:e}=h[l]||{},c=i.useCallback(t=>{s(`#${t}`)},[s]);return{id:d,index:e,handleTabChange:c}}function S({defaultTabs:n,pathRoot:r,selectedSection:o}){const{useNavigate:a}=p.useNavigationAdapter(),s=a(),h=i.useMemo(()=>n.reduce((c,t,u)=>(c[t.id]={id:t.id,index:u},c),{}),[n]),l=i.useCallback(c=>{s(`${r}/${c}`)},[s,r]),{id:d,index:e}=h[o]||{};return{id:d,index:e,handleTabChange:l}}exports.TabControl=T;exports.TabItem=j;exports.useHashTabs=y;exports.useSectionTab=S;exports.useTabControl=N;
|
|
@@ -49,7 +49,7 @@ function b({ row: t }) {
|
|
|
49
49
|
/* @__PURE__ */ e(n, { as: "span", variant: "bodySmall", color: "muted", children: t.positionName })
|
|
50
50
|
] })
|
|
51
51
|
] });
|
|
52
|
-
return t.
|
|
52
|
+
return t.isClickable && t.onExecute ? /* @__PURE__ */ e(
|
|
53
53
|
"button",
|
|
54
54
|
{
|
|
55
55
|
type: "button",
|
|
@@ -80,7 +80,7 @@ function B({
|
|
|
80
80
|
onClick: t.disabled ? void 0 : d(t.id, a),
|
|
81
81
|
disabled: t.disabled,
|
|
82
82
|
className: m(
|
|
83
|
-
"flex items-center bg-transparent border-none shrink-0 text-foreground",
|
|
83
|
+
"flex items-center bg-transparent border-none shrink-0 text-foreground outline-none",
|
|
84
84
|
o ? "" : "p-0 pb-3.5",
|
|
85
85
|
u === "equal" ? "grow shrink-0 basis-[0%] justify-center min-w-0" : !x && "mr-10 max-[500px]:mr-8",
|
|
86
86
|
t.disabled && "cursor-not-allowed",
|
|
@@ -5,6 +5,7 @@ export interface DeferredRowView {
|
|
|
5
5
|
readonly title: React.ReactNode;
|
|
6
6
|
readonly positionName: React.ReactNode;
|
|
7
7
|
readonly isReady: boolean;
|
|
8
|
+
readonly isClickable: boolean;
|
|
8
9
|
readonly statusLabel: React.ReactNode;
|
|
9
10
|
/** Present only for reopenable (matured) rows; makes the row clickable. */
|
|
10
11
|
readonly onExecute?: () => void;
|