@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.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, showAnnouncement, className } = props;
3662
3662
  const { routerAdapter } = useScaffoldContext();
3663
3663
  const onItemClick = (url) => {
3664
3664
  if (!url)
@@ -3669,74 +3669,27 @@ 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
  }
3714
3676
  return /* @__PURE__ */ jsxRuntime.jsx(
3715
- "div",
3677
+ orderlyUiNotification.AnnouncementBannerUI,
3716
3678
  {
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
- )
3679
+ dataSource,
3680
+ showAnnouncement,
3681
+ onClose: props.onClose,
3682
+ onItemClick,
3683
+ className: orderlyUi.cn("oui-mx-auto", className)
3732
3684
  }
3733
3685
  );
3734
3686
  };
3735
- var NotificationWidget = () => {
3687
+ var NotificationWidget = ({ className }) => {
3736
3688
  const { announcementState } = useScaffoldContext();
3737
3689
  return /* @__PURE__ */ jsxRuntime.jsx(
3738
3690
  NotificationUI,
3739
3691
  {
3692
+ className,
3740
3693
  dataSource: announcementState.tips,
3741
3694
  onClose: announcementState.closeTips,
3742
3695
  showAnnouncement: announcementState.showAnnouncement
@@ -3777,6 +3730,7 @@ var MobileScaffold = (props) => {
3777
3730
  classNames?.root
3778
3731
  ),
3779
3732
  children: [
3733
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-mx-1 oui-mb-1", children: /* @__PURE__ */ jsxRuntime.jsx(NotificationWidget, {}) }),
3780
3734
  /* @__PURE__ */ jsxRuntime.jsx(
3781
3735
  "header",
3782
3736
  {
@@ -3833,8 +3787,7 @@ var MobileScaffold = (props) => {
3833
3787
  }
3834
3788
  ) })
3835
3789
  }
3836
- ),
3837
- /* @__PURE__ */ jsxRuntime.jsx(NotificationWidget, {})
3790
+ )
3838
3791
  ]
3839
3792
  }
3840
3793
  );
@@ -4301,18 +4254,20 @@ var DesktopScaffold = (props) => {
4301
4254
  classNames?.container
4302
4255
  ),
4303
4256
  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
- ) }),
4257
+ /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Box, { px: 2, ref: announcementRef, className: "oui-space-y-2", children: [
4258
+ /* @__PURE__ */ jsxRuntime.jsx(
4259
+ exports.RestrictedInfoWidget,
4260
+ {
4261
+ className: orderlyUi.cn(
4262
+ "oui-scaffold-restricted-info",
4263
+ "oui-relative oui-z-[1]",
4264
+ "oui-bg-base-9",
4265
+ "oui-min-w-[994px]"
4266
+ )
4267
+ }
4268
+ ),
4269
+ /* @__PURE__ */ jsxRuntime.jsx(NotificationWidget, { className: "oui-mx-auto" })
4270
+ ] }),
4316
4271
  !hasLeftSidebar ? (
4317
4272
  // ----------No leftSidebar layout start ---------
4318
4273
  /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Box, { height: "100%", className: orderlyUi.cn(classNames?.content), children })