@flamingo-stack/openframe-frontend-core 0.0.263 → 0.0.264

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.
Files changed (68) hide show
  1. package/dist/{chunk-C3FAOQAH.cjs → chunk-3LWUHLPK.cjs} +28 -28
  2. package/dist/{chunk-C3FAOQAH.cjs.map → chunk-3LWUHLPK.cjs.map} +1 -1
  3. package/dist/{chunk-U7UDESAU.js → chunk-6ZEKKAAL.js} +2 -2
  4. package/dist/{chunk-YC357BPF.js → chunk-JOUI6TQY.js} +3 -3
  5. package/dist/{chunk-2XUWR7AH.cjs → chunk-P67D545X.cjs} +11 -11
  6. package/dist/{chunk-2XUWR7AH.cjs.map → chunk-P67D545X.cjs.map} +1 -1
  7. package/dist/{chunk-3DC6MHW6.cjs → chunk-QLWBBCI5.cjs} +491 -391
  8. package/dist/chunk-QLWBBCI5.cjs.map +1 -0
  9. package/dist/{chunk-36HLBLDK.cjs → chunk-SIYHXLFH.cjs} +462 -454
  10. package/dist/chunk-SIYHXLFH.cjs.map +1 -0
  11. package/dist/{chunk-ALEKX56R.js → chunk-SSUUMPAQ.js} +2 -2
  12. package/dist/{chunk-6AIXHYBZ.js → chunk-VYTU7JZR.js} +64 -56
  13. package/dist/chunk-VYTU7JZR.js.map +1 -0
  14. package/dist/{chunk-6GBA6YJN.js → chunk-ZMFT5XOB.js} +576 -476
  15. package/dist/chunk-ZMFT5XOB.js.map +1 -0
  16. package/dist/{chunk-XKA7UFED.cjs → chunk-ZOOTBYZO.cjs} +30 -30
  17. package/dist/{chunk-XKA7UFED.cjs.map → chunk-ZOOTBYZO.cjs.map} +1 -1
  18. package/dist/components/chat/index.cjs +3 -3
  19. package/dist/components/chat/index.js +2 -2
  20. package/dist/components/contact/index.cjs +4 -4
  21. package/dist/components/contact/index.js +3 -3
  22. package/dist/components/features/index.cjs +3 -3
  23. package/dist/components/features/index.js +2 -2
  24. package/dist/components/features/notifications/notification-drawer.d.ts.map +1 -1
  25. package/dist/components/features/notifications/notifications-context.d.ts +9 -1
  26. package/dist/components/features/notifications/notifications-context.d.ts.map +1 -1
  27. package/dist/components/index.cjs +50 -50
  28. package/dist/components/index.js +4 -4
  29. package/dist/components/navigation/index.cjs +3 -3
  30. package/dist/components/navigation/index.js +2 -2
  31. package/dist/components/navigation/sliding-sidebar.d.ts.map +1 -1
  32. package/dist/components/related-content/index.cjs +4 -4
  33. package/dist/components/related-content/index.js +3 -3
  34. package/dist/components/tickets/index.cjs +58 -58
  35. package/dist/components/tickets/index.js +4 -4
  36. package/dist/components/ui/drawer.d.ts +5 -0
  37. package/dist/components/ui/drawer.d.ts.map +1 -1
  38. package/dist/components/ui/index.cjs +3 -3
  39. package/dist/components/ui/index.js +2 -2
  40. package/dist/hooks/index.cjs +6 -2
  41. package/dist/hooks/index.cjs.map +1 -1
  42. package/dist/hooks/index.js +5 -1
  43. package/dist/hooks/ui/index.d.ts +6 -4
  44. package/dist/hooks/ui/index.d.ts.map +1 -1
  45. package/dist/hooks/ui/use-header-height.d.ts +8 -0
  46. package/dist/hooks/ui/use-header-height.d.ts.map +1 -0
  47. package/dist/hooks/ui/use-horizontal-scrollbar.d.ts.map +1 -1
  48. package/dist/hooks/ui/use-notification-permission.d.ts +14 -0
  49. package/dist/hooks/ui/use-notification-permission.d.ts.map +1 -0
  50. package/dist/index.cjs +7 -3
  51. package/dist/index.cjs.map +1 -1
  52. package/dist/index.js +6 -2
  53. package/package.json +1 -1
  54. package/src/components/features/notifications/notification-drawer.tsx +51 -2
  55. package/src/components/features/notifications/notifications-context.tsx +26 -0
  56. package/src/components/navigation/sliding-sidebar.tsx +3 -82
  57. package/src/components/ui/drawer.tsx +17 -6
  58. package/src/hooks/ui/index.ts +6 -4
  59. package/src/hooks/ui/use-header-height.ts +55 -0
  60. package/src/hooks/ui/use-horizontal-scrollbar.ts +19 -2
  61. package/src/hooks/ui/use-notification-permission.ts +64 -0
  62. package/dist/chunk-36HLBLDK.cjs.map +0 -1
  63. package/dist/chunk-3DC6MHW6.cjs.map +0 -1
  64. package/dist/chunk-6AIXHYBZ.js.map +0 -1
  65. package/dist/chunk-6GBA6YJN.js.map +0 -1
  66. /package/dist/{chunk-U7UDESAU.js.map → chunk-6ZEKKAAL.js.map} +0 -0
  67. /package/dist/{chunk-YC357BPF.js.map → chunk-JOUI6TQY.js.map} +0 -0
  68. /package/dist/{chunk-ALEKX56R.js.map → chunk-SSUUMPAQ.js.map} +0 -0
@@ -27,7 +27,7 @@ import {
27
27
  getContentRefLabelOrTitleCase,
28
28
  init_pagination,
29
29
  orderContentRefTypes
30
- } from "./chunk-6AIXHYBZ.js";
30
+ } from "./chunk-VYTU7JZR.js";
31
31
  import {
32
32
  buildSuggestionUrl
33
33
  } from "./chunk-NR535XIY.js";
@@ -334,4 +334,4 @@ export {
334
334
  GROUP_PAGE_SIZE,
335
335
  RelatedContentSection
336
336
  };
337
- //# sourceMappingURL=chunk-ALEKX56R.js.map
337
+ //# sourceMappingURL=chunk-SSUUMPAQ.js.map
@@ -6,15 +6,17 @@ import {
6
6
  progressColorByVariant,
7
7
  toolLabels,
8
8
  useCopyToClipboard,
9
+ useHeaderHeight,
9
10
  useHorizontalScrollbar,
10
11
  useHumanitySignals,
11
12
  useImageEdgeColor,
12
13
  useLgUp,
13
14
  useLocalStorage,
14
15
  useMdUp,
16
+ useNotificationPermission,
15
17
  useOnboardingState,
16
18
  useToast
17
- } from "./chunk-6GBA6YJN.js";
19
+ } from "./chunk-ZMFT5XOB.js";
18
20
  import {
19
21
  cn as cn2
20
22
  } from "./chunk-NR535XIY.js";
@@ -10406,12 +10408,14 @@ var DrawerContent = React40.forwardRef(
10406
10408
  style,
10407
10409
  panelStyle,
10408
10410
  panelClassName,
10411
+ offsetHeader = false,
10409
10412
  children,
10410
10413
  ...props
10411
10414
  }, ref) => {
10412
10415
  const resolvedSide = side ?? "right";
10413
10416
  const isHorizontal = HORIZONTAL_SIDES.has(resolvedSide);
10414
10417
  const initialSize = defaultSize ?? (isHorizontal ? 560 : 480);
10418
+ const headerHeight = useHeaderHeight();
10415
10419
  const [isMobile, setIsMobile] = React40.useState(false);
10416
10420
  React40.useEffect(() => {
10417
10421
  if (typeof window === "undefined") return;
@@ -10438,7 +10442,7 @@ var DrawerContent = React40.forwardRef(
10438
10442
  {
10439
10443
  ref,
10440
10444
  className: cn(drawerVariants({ side, flush })),
10441
- style,
10445
+ style: { ...offsetHeader ? { top: headerHeight } : {}, ...style },
10442
10446
  ...props,
10443
10447
  children: [
10444
10448
  applyInlineSize ? /* @__PURE__ */ jsx85(
@@ -10484,7 +10488,7 @@ var DrawerHeader = ({
10484
10488
  }
10485
10489
  );
10486
10490
  DrawerHeader.displayName = "DrawerHeader";
10487
- var DrawerTitle = React40.forwardRef(({ className, children, actions, ...props }, ref) => /* @__PURE__ */ jsxs66("div", { className: "flex items-start gap-4", children: [
10491
+ var DrawerTitle = React40.forwardRef(({ className, children, actions, hideClose, ...props }, ref) => /* @__PURE__ */ jsxs66("div", { className: "flex items-start gap-4", children: [
10488
10492
  /* @__PURE__ */ jsx85(
10489
10493
  DialogPrimitive2.Title,
10490
10494
  {
@@ -10498,7 +10502,7 @@ var DrawerTitle = React40.forwardRef(({ className, children, actions, ...props }
10498
10502
  }
10499
10503
  ),
10500
10504
  actions,
10501
- /* @__PURE__ */ jsxs66(DialogPrimitive2.Close, { className: "shrink-0 rounded-sm text-ods-text-secondary transition-colors hover:text-ods-text-primary outline-none ring-0 focus:outline-none focus:ring-0 focus-visible:outline-none focus-visible:ring-0", children: [
10505
+ !hideClose && /* @__PURE__ */ jsxs66(DialogPrimitive2.Close, { className: "shrink-0 rounded-sm text-ods-text-secondary transition-colors hover:text-ods-text-primary outline-none ring-0 focus:outline-none focus:ring-0 focus-visible:outline-none focus-visible:ring-0", children: [
10502
10506
  /* @__PURE__ */ jsx85(X5, { className: "size-6" }),
10503
10507
  /* @__PURE__ */ jsx85("span", { className: "sr-only", children: "Close" })
10504
10508
  ] })
@@ -20640,6 +20644,8 @@ function NotificationsProvider({
20640
20644
  maxNotifications = 50,
20641
20645
  defaultShowPopups = true,
20642
20646
  onShowPopupsChange,
20647
+ defaultShowDesktopPopups = false,
20648
+ onShowDesktopPopupsChange,
20643
20649
  onHistoryClick,
20644
20650
  actions,
20645
20651
  hasMore = false,
@@ -20650,6 +20656,8 @@ function NotificationsProvider({
20650
20656
  const [notifications, dispatch] = React69.useReducer(reducer, initialNotifications);
20651
20657
  const [isOpen, setIsOpen] = React69.useState(false);
20652
20658
  const [showPopups, setShowPopupsState] = React69.useState(defaultShowPopups);
20659
+ const [showDesktopPopups, setShowDesktopPopupsState] = React69.useState(defaultShowDesktopPopups);
20660
+ const desktopPopupsConfigured = onShowDesktopPopupsChange !== void 0;
20653
20661
  const actionsRef = React69.useRef(actions);
20654
20662
  React69.useEffect(() => {
20655
20663
  actionsRef.current = actions;
@@ -20711,6 +20719,13 @@ function NotificationsProvider({
20711
20719
  },
20712
20720
  [onShowPopupsChange]
20713
20721
  );
20722
+ const setShowDesktopPopups = React69.useCallback(
20723
+ (value2) => {
20724
+ setShowDesktopPopupsState(value2);
20725
+ onShowDesktopPopupsChange?.(value2);
20726
+ },
20727
+ [onShowDesktopPopupsChange]
20728
+ );
20714
20729
  const unreadCount = React69.useMemo(
20715
20730
  () => notifications.reduce((acc, n) => n.read ? acc : acc + 1, 0),
20716
20731
  [notifications]
@@ -20733,6 +20748,9 @@ function NotificationsProvider({
20733
20748
  close,
20734
20749
  toggle,
20735
20750
  setShowPopups,
20751
+ showDesktopPopups,
20752
+ setShowDesktopPopups,
20753
+ desktopPopupsConfigured,
20736
20754
  onHistoryClick,
20737
20755
  hasMore,
20738
20756
  isLoadingMore,
@@ -20744,6 +20762,9 @@ function NotificationsProvider({
20744
20762
  unreadCount,
20745
20763
  isOpen,
20746
20764
  showPopups,
20765
+ showDesktopPopups,
20766
+ setShowDesktopPopups,
20767
+ desktopPopupsConfigured,
20747
20768
  addNotification,
20748
20769
  upsertNotification,
20749
20770
  setNotifications,
@@ -20901,6 +20922,9 @@ function NotificationDrawer({
20901
20922
  markAllRead,
20902
20923
  markSettled,
20903
20924
  setShowPopups,
20925
+ showDesktopPopups,
20926
+ setShowDesktopPopups,
20927
+ desktopPopupsConfigured,
20904
20928
  onHistoryClick,
20905
20929
  hasMore,
20906
20930
  isLoadingMore,
@@ -20914,6 +20938,7 @@ function NotificationDrawer({
20914
20938
  {
20915
20939
  side: "right",
20916
20940
  "aria-describedby": void 0,
20941
+ offsetHeader: true,
20917
20942
  className: cn(
20918
20943
  "w-[calc(100vw-2rem)] sm:w-[26rem] sm:max-w-[calc(100vw-2rem)] gap-[var(--spacing-system-m)] p-[var(--spacing-system-zero)]",
20919
20944
  className
@@ -20922,6 +20947,7 @@ function NotificationDrawer({
20922
20947
  /* @__PURE__ */ jsx180("div", { className: "px-[var(--spacing-system-m)] pt-[var(--spacing-system-m)]", children: /* @__PURE__ */ jsx180(
20923
20948
  DrawerTitle,
20924
20949
  {
20950
+ hideClose: true,
20925
20951
  className: "truncate",
20926
20952
  actions: /* @__PURE__ */ jsx180(
20927
20953
  "button",
@@ -20951,7 +20977,10 @@ function NotificationDrawer({
20951
20977
  }
20952
20978
  ),
20953
20979
  /* @__PURE__ */ jsxs140("div", { className: "flex flex-col gap-[var(--spacing-system-xs)] px-[var(--spacing-system-m)] pb-[var(--spacing-system-m)]", children: [
20954
- /* @__PURE__ */ jsx180(ShowNotificationsToggleRow, { checked: showPopups, onChange: setShowPopups }),
20980
+ /* @__PURE__ */ jsxs140("div", { className: "overflow-hidden rounded-md border border-ods-border bg-ods-card", children: [
20981
+ /* @__PURE__ */ jsx180(ShowNotificationsToggleRow, { checked: showPopups, onChange: setShowPopups }),
20982
+ desktopPopupsConfigured && /* @__PURE__ */ jsx180(DesktopNotificationsToggleRow, { checked: showDesktopPopups, onChange: setShowDesktopPopups })
20983
+ ] }),
20955
20984
  /* @__PURE__ */ jsx180(
20956
20985
  NotificationsHistoryButton,
20957
20986
  {
@@ -21047,7 +21076,7 @@ function EmptyState() {
21047
21076
  ] });
21048
21077
  }
21049
21078
  function ShowNotificationsToggleRow({ checked, onChange }) {
21050
- return /* @__PURE__ */ jsxs140("div", { className: "flex items-center gap-[var(--spacing-system-s)] rounded-md border border-ods-border bg-ods-card p-[var(--spacing-system-sf)]", children: [
21079
+ return /* @__PURE__ */ jsxs140("div", { className: "flex items-center gap-[var(--spacing-system-s)] border-b border-ods-border p-[var(--spacing-system-sf)]", children: [
21051
21080
  /* @__PURE__ */ jsx180(
21052
21081
  Switch,
21053
21082
  {
@@ -21062,6 +21091,33 @@ function ShowNotificationsToggleRow({ checked, onChange }) {
21062
21091
  ] })
21063
21092
  ] });
21064
21093
  }
21094
+ function DesktopNotificationsToggleRow({ checked, onChange }) {
21095
+ const { supported, permission, request } = useNotificationPermission();
21096
+ if (!supported) return null;
21097
+ const blocked = permission === "denied";
21098
+ const handleChange = async (value) => {
21099
+ if (!value || permission === "granted") {
21100
+ onChange(value);
21101
+ return;
21102
+ }
21103
+ if (await request() === "granted") onChange(true);
21104
+ };
21105
+ return /* @__PURE__ */ jsxs140("div", { className: "flex items-center gap-[var(--spacing-system-s)] border-b border-ods-border p-[var(--spacing-system-sf)]", children: [
21106
+ /* @__PURE__ */ jsx180(
21107
+ Switch,
21108
+ {
21109
+ checked: checked && permission === "granted",
21110
+ disabled: blocked,
21111
+ onCheckedChange: handleChange,
21112
+ "aria-label": "Show desktop notifications"
21113
+ }
21114
+ ),
21115
+ /* @__PURE__ */ jsxs140("div", { className: "min-w-0 flex-1", children: [
21116
+ /* @__PURE__ */ jsx180("p", { className: cn("text-h4", blocked ? "text-ods-text-secondary" : "text-ods-text-primary"), children: "Desktop Notifications" }),
21117
+ /* @__PURE__ */ jsx180("p", { className: "text-h6 text-ods-text-secondary", children: blocked ? "Enable notifications in your browser settings" : "Notify when this tab is in the background" })
21118
+ ] })
21119
+ ] });
21120
+ }
21065
21121
  function NotificationsHistoryButton({ onClick }) {
21066
21122
  return /* @__PURE__ */ jsx180(
21067
21123
  Button,
@@ -22567,57 +22623,9 @@ import { Fragment as Fragment30, jsx as jsx193, jsxs as jsxs150 } from "react/js
22567
22623
  function SlidingSidebar({ config }) {
22568
22624
  const [expandedItems, setExpandedItems] = useState58(/* @__PURE__ */ new Set());
22569
22625
  const [mounted, setMounted] = useState58(false);
22570
- const [headerHeight, setHeaderHeight] = useState58(64);
22626
+ const headerHeight = useHeaderHeight();
22571
22627
  useEffect42(() => {
22572
22628
  setMounted(true);
22573
- const calculateHeaderHeight = () => {
22574
- let totalHeight = 0;
22575
- const header2 = document.querySelector("header");
22576
- if (header2) {
22577
- totalHeight += header2.offsetHeight;
22578
- }
22579
- const announcementBar2 = document.querySelector("[data-announcement-bar]");
22580
- if (announcementBar2 && announcementBar2 instanceof HTMLElement) {
22581
- totalHeight += announcementBar2.offsetHeight;
22582
- }
22583
- if (totalHeight > 0) {
22584
- setHeaderHeight(totalHeight);
22585
- } else {
22586
- setHeaderHeight(64);
22587
- }
22588
- };
22589
- setTimeout(calculateHeaderHeight, 100);
22590
- calculateHeaderHeight();
22591
- window.addEventListener("resize", calculateHeaderHeight);
22592
- const resizeObserver = new ResizeObserver(calculateHeaderHeight);
22593
- const header = document.querySelector("header");
22594
- if (header) {
22595
- resizeObserver.observe(header);
22596
- }
22597
- const announcementBar = document.querySelector("[data-announcement-bar]");
22598
- if (announcementBar) {
22599
- resizeObserver.observe(announcementBar);
22600
- }
22601
- const mutationObserver = new MutationObserver((mutations) => {
22602
- for (const mutation of mutations) {
22603
- if (mutation.type === "childList") {
22604
- calculateHeaderHeight();
22605
- const newAnnouncementBar = document.querySelector("[data-announcement-bar]");
22606
- if (newAnnouncementBar) {
22607
- resizeObserver.observe(newAnnouncementBar);
22608
- }
22609
- }
22610
- }
22611
- });
22612
- mutationObserver.observe(document.body, {
22613
- childList: true,
22614
- subtree: true
22615
- });
22616
- return () => {
22617
- window.removeEventListener("resize", calculateHeaderHeight);
22618
- resizeObserver.disconnect();
22619
- mutationObserver.disconnect();
22620
- };
22621
22629
  }, []);
22622
22630
  const toggleExpanded = (itemId) => {
22623
22631
  const newExpanded = new Set(expandedItems);
@@ -39674,4 +39682,4 @@ export {
39674
39682
  LogsList,
39675
39683
  assets
39676
39684
  };
39677
- //# sourceMappingURL=chunk-6AIXHYBZ.js.map
39685
+ //# sourceMappingURL=chunk-VYTU7JZR.js.map