@kodiak-finance/orderly-ui-scaffold 2.8.20 → 2.8.21-beta.3
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/index.js +29 -72
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -74
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +11 -11
package/dist/index.mjs
CHANGED
|
@@ -7,10 +7,10 @@ import { useAppContext, useAppConfig } from '@kodiak-finance/orderly-react-app';
|
|
|
7
7
|
import { AccountStatusEnum, ABSTRACT_CHAIN_ID_MAP, EMPTY_LIST, TrackerEventName, EMPTY_OBJECT } from '@kodiak-finance/orderly-types';
|
|
8
8
|
import { ChainSelectorSheetId, ChainSelectorDialogId, ChainSelectorWidget } from '@kodiak-finance/orderly-ui-chain-selector';
|
|
9
9
|
import { WalletConnectorSheetId, WalletConnectorModalId } from '@kodiak-finance/orderly-ui-connector';
|
|
10
|
-
import { Decimal, getTimestamp
|
|
10
|
+
import { Decimal, getTimestamp } from '@kodiak-finance/orderly-utils';
|
|
11
11
|
import jsQR from 'jsqr';
|
|
12
12
|
import { qrcode } from '@akamfoad/qr';
|
|
13
|
-
import { useAnnouncement,
|
|
13
|
+
import { useAnnouncement, AnnouncementBannerUI, AnnouncementCenterUI } from '@kodiak-finance/orderly-ui-notification';
|
|
14
14
|
import { format } from 'date-fns';
|
|
15
15
|
import { UTCDateMini } from '@date-fns/utc';
|
|
16
16
|
|
|
@@ -3651,7 +3651,7 @@ var isExternalUrl = (href) => {
|
|
|
3651
3651
|
}
|
|
3652
3652
|
};
|
|
3653
3653
|
var NotificationUI = (props) => {
|
|
3654
|
-
const { dataSource, showAnnouncement } = props;
|
|
3654
|
+
const { dataSource, className, showAnnouncement } = props;
|
|
3655
3655
|
const { routerAdapter } = useScaffoldContext();
|
|
3656
3656
|
const onItemClick = (url) => {
|
|
3657
3657
|
if (!url)
|
|
@@ -3662,74 +3662,30 @@ var NotificationUI = (props) => {
|
|
|
3662
3662
|
target: isExternalUrl(url) ? "_blank" : void 0
|
|
3663
3663
|
});
|
|
3664
3664
|
};
|
|
3665
|
-
const notificationRef = useRef(null);
|
|
3666
3665
|
const len = useMemo(() => dataSource?.length ?? 0, [dataSource]);
|
|
3667
|
-
const onClose = useCallback(() => {
|
|
3668
|
-
if (len === 0) {
|
|
3669
|
-
return;
|
|
3670
|
-
}
|
|
3671
|
-
windowGuard(() => {
|
|
3672
|
-
if (notificationRef.current) {
|
|
3673
|
-
const animationendHandler = () => {
|
|
3674
|
-
props.onClose();
|
|
3675
|
-
notificationRef.current.removeEventListener(
|
|
3676
|
-
"transitionend",
|
|
3677
|
-
animationendHandler
|
|
3678
|
-
);
|
|
3679
|
-
};
|
|
3680
|
-
notificationRef.current.addEventListener(
|
|
3681
|
-
"transitionend",
|
|
3682
|
-
animationendHandler
|
|
3683
|
-
);
|
|
3684
|
-
requestAnimationFrame(() => {
|
|
3685
|
-
notificationRef.current.style.transform = "translateY(120%)";
|
|
3686
|
-
});
|
|
3687
|
-
}
|
|
3688
|
-
});
|
|
3689
|
-
}, [props.onClose, len]);
|
|
3690
|
-
useEffect(() => {
|
|
3691
|
-
if (len === 0) {
|
|
3692
|
-
return;
|
|
3693
|
-
}
|
|
3694
|
-
if (showAnnouncement) {
|
|
3695
|
-
windowGuard(() => {
|
|
3696
|
-
if (notificationRef.current) {
|
|
3697
|
-
requestAnimationFrame(() => {
|
|
3698
|
-
notificationRef.current.style.transform = "translateY(0)";
|
|
3699
|
-
});
|
|
3700
|
-
}
|
|
3701
|
-
});
|
|
3702
|
-
}
|
|
3703
|
-
}, [showAnnouncement, len]);
|
|
3704
3666
|
if (len === 0) {
|
|
3705
3667
|
return null;
|
|
3706
3668
|
}
|
|
3669
|
+
if (!showAnnouncement) {
|
|
3670
|
+
return null;
|
|
3671
|
+
}
|
|
3707
3672
|
return /* @__PURE__ */ jsx(
|
|
3708
|
-
|
|
3673
|
+
AnnouncementBannerUI,
|
|
3709
3674
|
{
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
showAnnouncement ? "oui-visible" : "oui-invisible"
|
|
3716
|
-
),
|
|
3717
|
-
children: /* @__PURE__ */ jsx(
|
|
3718
|
-
NotificationUI$1,
|
|
3719
|
-
{
|
|
3720
|
-
dataSource,
|
|
3721
|
-
onClose,
|
|
3722
|
-
onItemClick
|
|
3723
|
-
}
|
|
3724
|
-
)
|
|
3675
|
+
dataSource,
|
|
3676
|
+
showAnnouncement,
|
|
3677
|
+
onClose: props.onClose,
|
|
3678
|
+
onItemClick,
|
|
3679
|
+
className: cn("oui-mx-auto", className)
|
|
3725
3680
|
}
|
|
3726
3681
|
);
|
|
3727
3682
|
};
|
|
3728
|
-
var NotificationWidget = () => {
|
|
3683
|
+
var NotificationWidget = ({ className }) => {
|
|
3729
3684
|
const { announcementState } = useScaffoldContext();
|
|
3730
3685
|
return /* @__PURE__ */ jsx(
|
|
3731
3686
|
NotificationUI,
|
|
3732
3687
|
{
|
|
3688
|
+
className,
|
|
3733
3689
|
dataSource: announcementState.tips,
|
|
3734
3690
|
onClose: announcementState.closeTips,
|
|
3735
3691
|
showAnnouncement: announcementState.showAnnouncement
|
|
@@ -3770,6 +3726,7 @@ var MobileScaffold = (props) => {
|
|
|
3770
3726
|
classNames?.root
|
|
3771
3727
|
),
|
|
3772
3728
|
children: [
|
|
3729
|
+
/* @__PURE__ */ jsx("div", { className: "oui-mx-1 oui-mt-1", children: /* @__PURE__ */ jsx(NotificationWidget, {}) }),
|
|
3773
3730
|
/* @__PURE__ */ jsx(
|
|
3774
3731
|
"header",
|
|
3775
3732
|
{
|
|
@@ -3826,8 +3783,7 @@ var MobileScaffold = (props) => {
|
|
|
3826
3783
|
}
|
|
3827
3784
|
) })
|
|
3828
3785
|
}
|
|
3829
|
-
)
|
|
3830
|
-
/* @__PURE__ */ jsx(NotificationWidget, {})
|
|
3786
|
+
)
|
|
3831
3787
|
]
|
|
3832
3788
|
}
|
|
3833
3789
|
);
|
|
@@ -4294,18 +4250,20 @@ var DesktopScaffold = (props) => {
|
|
|
4294
4250
|
classNames?.container
|
|
4295
4251
|
),
|
|
4296
4252
|
children: [
|
|
4297
|
-
/* @__PURE__ */
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4253
|
+
/* @__PURE__ */ jsxs(Box, { px: 2, ref: announcementRef, className: cn("oui-space-y-2", "oui-mt-2"), children: [
|
|
4254
|
+
/* @__PURE__ */ jsx(
|
|
4255
|
+
RestrictedInfoWidget,
|
|
4256
|
+
{
|
|
4257
|
+
className: cn(
|
|
4258
|
+
"oui-scaffold-restricted-info",
|
|
4259
|
+
"oui-relative oui-z-[1]",
|
|
4260
|
+
"oui-bg-base-9",
|
|
4261
|
+
"oui-min-w-[994px]"
|
|
4262
|
+
)
|
|
4263
|
+
}
|
|
4264
|
+
),
|
|
4265
|
+
/* @__PURE__ */ jsx(NotificationWidget, { className: "oui-mx-auto" })
|
|
4266
|
+
] }),
|
|
4309
4267
|
!hasLeftSidebar ? (
|
|
4310
4268
|
// ----------No leftSidebar layout start ---------
|
|
4311
4269
|
/* @__PURE__ */ jsx(Box, { height: "100%", className: cn(classNames?.content), children })
|
|
@@ -4354,8 +4312,7 @@ var DesktopScaffold = (props) => {
|
|
|
4354
4312
|
),
|
|
4355
4313
|
children: footer || /* @__PURE__ */ jsx(FooterWidget, { ...footerProps })
|
|
4356
4314
|
}
|
|
4357
|
-
)
|
|
4358
|
-
/* @__PURE__ */ jsx(NotificationWidget, {})
|
|
4315
|
+
)
|
|
4359
4316
|
]
|
|
4360
4317
|
}
|
|
4361
4318
|
);
|