@abgov/react-components 7.2.0-dev.11 → 7.2.0-dev.13

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/index.mjs CHANGED
@@ -410,6 +410,9 @@ function GoabDataGrid({
410
410
  }
411
411
  );
412
412
  }
413
+ const GoabWorkspaceLayoutScrollState = {
414
+ NO_SCROLL: "no-scroll"
415
+ };
413
416
  function dispatch(el, eventName, detail, opts) {
414
417
  if (!el) {
415
418
  console.error("dispatch element is null");
@@ -3960,6 +3963,21 @@ function GoabSpinner({
3960
3963
  }
3961
3964
  );
3962
3965
  }
3966
+ function GoabScrollPanel({
3967
+ header,
3968
+ children,
3969
+ footer,
3970
+ height,
3971
+ testId,
3972
+ ...rest
3973
+ }) {
3974
+ const hostStyle = height ? { height } : void 0;
3975
+ return /* @__PURE__ */ jsxs("goa-scroll-panel", { height, testid: testId, style: hostStyle, ...rest, children: [
3976
+ header && /* @__PURE__ */ jsx("div", { slot: "header", children: header }),
3977
+ children,
3978
+ footer && /* @__PURE__ */ jsx("div", { slot: "footer", children: footer })
3979
+ ] });
3980
+ }
3963
3981
  function GoabTable({ onSort, onMultiSort, sortMode, ...props }) {
3964
3982
  const ref = useRef(null);
3965
3983
  useEffect(() => {
@@ -4503,6 +4521,50 @@ function useTheme() {
4503
4521
  }
4504
4522
  return ctx;
4505
4523
  }
4524
+ const GoabWorkspaceLayoutScrollStateDefault = {
4525
+ scrollPosition: GoabWorkspaceLayoutScrollState.NO_SCROLL,
4526
+ isScrollable: false
4527
+ };
4528
+ const GoabWorkspaceLayoutScrollStateContext = createContext(
4529
+ GoabWorkspaceLayoutScrollStateDefault
4530
+ );
4531
+ function useGoabWorkspaceLayoutScrollState() {
4532
+ return useContext(GoabWorkspaceLayoutScrollStateContext);
4533
+ }
4534
+ function GoabWorkspaceLayout({
4535
+ sideMenu,
4536
+ pageHeader,
4537
+ pageFooter,
4538
+ pushDrawer,
4539
+ children,
4540
+ testId,
4541
+ onScrollStateChange,
4542
+ ...rest
4543
+ }) {
4544
+ const ref = useRef(null);
4545
+ const [scrollState, setScrollState] = useState(GoabWorkspaceLayoutScrollStateDefault);
4546
+ useEffect(() => {
4547
+ const el = ref.current;
4548
+ if (!el) return;
4549
+ const listener = (e) => {
4550
+ const detail = e.detail;
4551
+ setScrollState({
4552
+ scrollPosition: detail.state,
4553
+ isScrollable: detail.isScrollable
4554
+ });
4555
+ onScrollStateChange == null ? void 0 : onScrollStateChange({ ...detail, event: e });
4556
+ };
4557
+ el.addEventListener("_scrollStateChange", listener);
4558
+ return () => el.removeEventListener("_scrollStateChange", listener);
4559
+ }, [onScrollStateChange]);
4560
+ return /* @__PURE__ */ jsx(GoabWorkspaceLayoutScrollStateContext.Provider, { value: scrollState, children: /* @__PURE__ */ jsxs("goa-workspace-layout", { ref, testid: testId, ...rest, children: [
4561
+ sideMenu && /* @__PURE__ */ jsx("div", { slot: "side-menu", children: sideMenu }),
4562
+ pageHeader && /* @__PURE__ */ jsx("div", { slot: "page-header", children: pageHeader }),
4563
+ children,
4564
+ pageFooter && /* @__PURE__ */ jsx("div", { slot: "page-footer", children: pageFooter }),
4565
+ pushDrawer && /* @__PURE__ */ jsx("div", { slot: "push-drawer", children: pushDrawer })
4566
+ ] }) });
4567
+ }
4506
4568
  export {
4507
4569
  GoALinkButton,
4508
4570
  GoabAccordion,
@@ -4578,6 +4640,7 @@ export {
4578
4640
  GoabPushDrawer,
4579
4641
  GoabRadioGroup,
4580
4642
  GoabRadioItem,
4643
+ GoabScrollPanel,
4581
4644
  GoabSideMenu,
4582
4645
  GoabSideMenuGroup,
4583
4646
  GoabSideMenuHeading,
@@ -4601,6 +4664,8 @@ export {
4601
4664
  GoabWorkSideMenuItem,
4602
4665
  GoabWorkSideNotificationItem,
4603
4666
  GoabWorkSideNotificationPanel,
4667
+ GoabWorkspaceLayout,
4668
+ useGoabWorkspaceLayoutScrollState,
4604
4669
  usePublicFormController,
4605
4670
  useTheme
4606
4671
  };