@kodiak-finance/orderly-ui-scaffold 2.8.20 → 2.8.21-alpha.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/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, windowGuard } from '@kodiak-finance/orderly-utils';
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, NotificationUI as NotificationUI$1, AnnouncementCenterUI } from '@kodiak-finance/orderly-ui-notification';
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, showAnnouncement, className } = props;
3655
3655
  const { routerAdapter } = useScaffoldContext();
3656
3656
  const onItemClick = (url) => {
3657
3657
  if (!url)
@@ -3662,74 +3662,27 @@ 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
  }
3707
3669
  return /* @__PURE__ */ jsx(
3708
- "div",
3670
+ AnnouncementBannerUI,
3709
3671
  {
3710
- ref: notificationRef,
3711
- "data-state": showAnnouncement ? "open" : "closed",
3712
- className: cn(
3713
- "oui-fixed oui-bottom-[calc(env(safe-area-inset-bottom)+8px)] oui-left-2 oui-z-50 oui-w-[calc(100%_-_16px)] oui-translate-y-[120%] oui-rounded-lg oui-border oui-border-line-6 oui-bg-base-8 md:oui-bottom-10 md:oui-left-auto md:oui-right-3 md:oui-w-[420px]",
3714
- "oui-transition-all oui-duration-300 oui-ease-in-out",
3715
- showAnnouncement ? "oui-visible" : "oui-invisible"
3716
- ),
3717
- children: /* @__PURE__ */ jsx(
3718
- NotificationUI$1,
3719
- {
3720
- dataSource,
3721
- onClose,
3722
- onItemClick
3723
- }
3724
- )
3672
+ dataSource,
3673
+ showAnnouncement,
3674
+ onClose: props.onClose,
3675
+ onItemClick,
3676
+ className: cn("oui-mx-auto", className)
3725
3677
  }
3726
3678
  );
3727
3679
  };
3728
- var NotificationWidget = () => {
3680
+ var NotificationWidget = ({ className }) => {
3729
3681
  const { announcementState } = useScaffoldContext();
3730
3682
  return /* @__PURE__ */ jsx(
3731
3683
  NotificationUI,
3732
3684
  {
3685
+ className,
3733
3686
  dataSource: announcementState.tips,
3734
3687
  onClose: announcementState.closeTips,
3735
3688
  showAnnouncement: announcementState.showAnnouncement
@@ -3770,6 +3723,7 @@ var MobileScaffold = (props) => {
3770
3723
  classNames?.root
3771
3724
  ),
3772
3725
  children: [
3726
+ /* @__PURE__ */ jsx("div", { className: "oui-mx-1 oui-mb-1", children: /* @__PURE__ */ jsx(NotificationWidget, {}) }),
3773
3727
  /* @__PURE__ */ jsx(
3774
3728
  "header",
3775
3729
  {
@@ -3826,8 +3780,7 @@ var MobileScaffold = (props) => {
3826
3780
  }
3827
3781
  ) })
3828
3782
  }
3829
- ),
3830
- /* @__PURE__ */ jsx(NotificationWidget, {})
3783
+ )
3831
3784
  ]
3832
3785
  }
3833
3786
  );
@@ -4294,18 +4247,20 @@ var DesktopScaffold = (props) => {
4294
4247
  classNames?.container
4295
4248
  ),
4296
4249
  children: [
4297
- /* @__PURE__ */ jsx(Box, { px: 2, ref: announcementRef, children: /* @__PURE__ */ jsx(
4298
- RestrictedInfoWidget,
4299
- {
4300
- className: cn(
4301
- "oui-scaffold-restricted-info",
4302
- "oui-relative oui-z-[1]",
4303
- "oui-mt-2",
4304
- "oui-bg-base-9",
4305
- "oui-min-w-[994px]"
4306
- )
4307
- }
4308
- ) }),
4250
+ /* @__PURE__ */ jsxs(Box, { px: 2, ref: announcementRef, className: "oui-space-y-2", children: [
4251
+ /* @__PURE__ */ jsx(
4252
+ RestrictedInfoWidget,
4253
+ {
4254
+ className: cn(
4255
+ "oui-scaffold-restricted-info",
4256
+ "oui-relative oui-z-[1]",
4257
+ "oui-bg-base-9",
4258
+ "oui-min-w-[994px]"
4259
+ )
4260
+ }
4261
+ ),
4262
+ /* @__PURE__ */ jsx(NotificationWidget, { className: "oui-mx-auto" })
4263
+ ] }),
4309
4264
  !hasLeftSidebar ? (
4310
4265
  // ----------No leftSidebar layout start ---------
4311
4266
  /* @__PURE__ */ jsx(Box, { height: "100%", className: cn(classNames?.content), children })