@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 CHANGED
@@ -3658,7 +3658,7 @@ var isExternalUrl = (href) => {
3658
3658
  }
3659
3659
  };
3660
3660
  var NotificationUI = (props) => {
3661
- const { dataSource, showAnnouncement } = props;
3661
+ const { dataSource, className, showAnnouncement } = props;
3662
3662
  const { routerAdapter } = useScaffoldContext();
3663
3663
  const onItemClick = (url) => {
3664
3664
  if (!url)
@@ -3669,74 +3669,30 @@ var NotificationUI = (props) => {
3669
3669
  target: isExternalUrl(url) ? "_blank" : void 0
3670
3670
  });
3671
3671
  };
3672
- const notificationRef = React6.useRef(null);
3673
3672
  const len = React6.useMemo(() => dataSource?.length ?? 0, [dataSource]);
3674
- const onClose = React6.useCallback(() => {
3675
- if (len === 0) {
3676
- return;
3677
- }
3678
- orderlyUtils.windowGuard(() => {
3679
- if (notificationRef.current) {
3680
- const animationendHandler = () => {
3681
- props.onClose();
3682
- notificationRef.current.removeEventListener(
3683
- "transitionend",
3684
- animationendHandler
3685
- );
3686
- };
3687
- notificationRef.current.addEventListener(
3688
- "transitionend",
3689
- animationendHandler
3690
- );
3691
- requestAnimationFrame(() => {
3692
- notificationRef.current.style.transform = "translateY(120%)";
3693
- });
3694
- }
3695
- });
3696
- }, [props.onClose, len]);
3697
- React6.useEffect(() => {
3698
- if (len === 0) {
3699
- return;
3700
- }
3701
- if (showAnnouncement) {
3702
- orderlyUtils.windowGuard(() => {
3703
- if (notificationRef.current) {
3704
- requestAnimationFrame(() => {
3705
- notificationRef.current.style.transform = "translateY(0)";
3706
- });
3707
- }
3708
- });
3709
- }
3710
- }, [showAnnouncement, len]);
3711
3673
  if (len === 0) {
3712
3674
  return null;
3713
3675
  }
3676
+ if (!showAnnouncement) {
3677
+ return null;
3678
+ }
3714
3679
  return /* @__PURE__ */ jsxRuntime.jsx(
3715
- "div",
3680
+ orderlyUiNotification.AnnouncementBannerUI,
3716
3681
  {
3717
- ref: notificationRef,
3718
- "data-state": showAnnouncement ? "open" : "closed",
3719
- className: orderlyUi.cn(
3720
- "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]",
3721
- "oui-transition-all oui-duration-300 oui-ease-in-out",
3722
- showAnnouncement ? "oui-visible" : "oui-invisible"
3723
- ),
3724
- children: /* @__PURE__ */ jsxRuntime.jsx(
3725
- orderlyUiNotification.NotificationUI,
3726
- {
3727
- dataSource,
3728
- onClose,
3729
- onItemClick
3730
- }
3731
- )
3682
+ dataSource,
3683
+ showAnnouncement,
3684
+ onClose: props.onClose,
3685
+ onItemClick,
3686
+ className: orderlyUi.cn("oui-mx-auto", className)
3732
3687
  }
3733
3688
  );
3734
3689
  };
3735
- var NotificationWidget = () => {
3690
+ var NotificationWidget = ({ className }) => {
3736
3691
  const { announcementState } = useScaffoldContext();
3737
3692
  return /* @__PURE__ */ jsxRuntime.jsx(
3738
3693
  NotificationUI,
3739
3694
  {
3695
+ className,
3740
3696
  dataSource: announcementState.tips,
3741
3697
  onClose: announcementState.closeTips,
3742
3698
  showAnnouncement: announcementState.showAnnouncement
@@ -3777,6 +3733,7 @@ var MobileScaffold = (props) => {
3777
3733
  classNames?.root
3778
3734
  ),
3779
3735
  children: [
3736
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-mx-1 oui-mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(NotificationWidget, {}) }),
3780
3737
  /* @__PURE__ */ jsxRuntime.jsx(
3781
3738
  "header",
3782
3739
  {
@@ -3833,8 +3790,7 @@ var MobileScaffold = (props) => {
3833
3790
  }
3834
3791
  ) })
3835
3792
  }
3836
- ),
3837
- /* @__PURE__ */ jsxRuntime.jsx(NotificationWidget, {})
3793
+ )
3838
3794
  ]
3839
3795
  }
3840
3796
  );
@@ -4301,18 +4257,20 @@ var DesktopScaffold = (props) => {
4301
4257
  classNames?.container
4302
4258
  ),
4303
4259
  children: [
4304
- /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Box, { px: 2, ref: announcementRef, children: /* @__PURE__ */ jsxRuntime.jsx(
4305
- exports.RestrictedInfoWidget,
4306
- {
4307
- className: orderlyUi.cn(
4308
- "oui-scaffold-restricted-info",
4309
- "oui-relative oui-z-[1]",
4310
- "oui-mt-2",
4311
- "oui-bg-base-9",
4312
- "oui-min-w-[994px]"
4313
- )
4314
- }
4315
- ) }),
4260
+ /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Box, { px: 2, ref: announcementRef, className: orderlyUi.cn("oui-space-y-2", "oui-mt-2"), children: [
4261
+ /* @__PURE__ */ jsxRuntime.jsx(
4262
+ exports.RestrictedInfoWidget,
4263
+ {
4264
+ className: orderlyUi.cn(
4265
+ "oui-scaffold-restricted-info",
4266
+ "oui-relative oui-z-[1]",
4267
+ "oui-bg-base-9",
4268
+ "oui-min-w-[994px]"
4269
+ )
4270
+ }
4271
+ ),
4272
+ /* @__PURE__ */ jsxRuntime.jsx(NotificationWidget, { className: "oui-mx-auto" })
4273
+ ] }),
4316
4274
  !hasLeftSidebar ? (
4317
4275
  // ----------No leftSidebar layout start ---------
4318
4276
  /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Box, { height: "100%", className: orderlyUi.cn(classNames?.content), children })
@@ -4361,8 +4319,7 @@ var DesktopScaffold = (props) => {
4361
4319
  ),
4362
4320
  children: footer || /* @__PURE__ */ jsxRuntime.jsx(FooterWidget, { ...footerProps })
4363
4321
  }
4364
- ),
4365
- /* @__PURE__ */ jsxRuntime.jsx(NotificationWidget, {})
4322
+ )
4366
4323
  ]
4367
4324
  }
4368
4325
  );