@abgov/react-components 7.2.0-dev.12 → 7.2.0-dev.14

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
@@ -133,9 +133,14 @@ function GoabBadge({
133
133
  }
134
134
  );
135
135
  }
136
- function GoabBlock({ testId, children, ...rest }) {
136
+ function GoabBlock({
137
+ testId,
138
+ stretch,
139
+ children,
140
+ ...rest
141
+ }) {
137
142
  const _props = transformProps({ testid: testId, ...rest }, kebab);
138
- return /* @__PURE__ */ jsx("goa-block", { ..._props, children });
143
+ return /* @__PURE__ */ jsx("goa-block", { ..._props, stretch: stretch ? "true" : void 0, children });
139
144
  }
140
145
  function GoabButton({
141
146
  disabled,
@@ -410,6 +415,9 @@ function GoabDataGrid({
410
415
  }
411
416
  );
412
417
  }
418
+ const GoabWorkspaceLayoutScrollState = {
419
+ NO_SCROLL: "no-scroll"
420
+ };
413
421
  function dispatch(el, eventName, detail, opts) {
414
422
  if (!el) {
415
423
  console.error("dispatch element is null");
@@ -3960,6 +3968,21 @@ function GoabSpinner({
3960
3968
  }
3961
3969
  );
3962
3970
  }
3971
+ function GoabScrollPanel({
3972
+ header,
3973
+ children,
3974
+ footer,
3975
+ height,
3976
+ testId,
3977
+ ...rest
3978
+ }) {
3979
+ const hostStyle = height ? { height } : void 0;
3980
+ return /* @__PURE__ */ jsxs("goa-scroll-panel", { height, testid: testId, style: hostStyle, ...rest, children: [
3981
+ header && /* @__PURE__ */ jsx("div", { slot: "header", children: header }),
3982
+ children,
3983
+ footer && /* @__PURE__ */ jsx("div", { slot: "footer", children: footer })
3984
+ ] });
3985
+ }
3963
3986
  function GoabTable({ onSort, onMultiSort, sortMode, ...props }) {
3964
3987
  const ref = useRef(null);
3965
3988
  useEffect(() => {
@@ -4503,6 +4526,50 @@ function useTheme() {
4503
4526
  }
4504
4527
  return ctx;
4505
4528
  }
4529
+ const GoabWorkspaceLayoutScrollStateDefault = {
4530
+ scrollPosition: GoabWorkspaceLayoutScrollState.NO_SCROLL,
4531
+ isScrollable: false
4532
+ };
4533
+ const GoabWorkspaceLayoutScrollStateContext = createContext(
4534
+ GoabWorkspaceLayoutScrollStateDefault
4535
+ );
4536
+ function useGoabWorkspaceLayoutScrollState() {
4537
+ return useContext(GoabWorkspaceLayoutScrollStateContext);
4538
+ }
4539
+ function GoabWorkspaceLayout({
4540
+ sideMenu,
4541
+ pageHeader,
4542
+ pageFooter,
4543
+ pushDrawer,
4544
+ children,
4545
+ testId,
4546
+ onScrollStateChange,
4547
+ ...rest
4548
+ }) {
4549
+ const ref = useRef(null);
4550
+ const [scrollState, setScrollState] = useState(GoabWorkspaceLayoutScrollStateDefault);
4551
+ useEffect(() => {
4552
+ const el = ref.current;
4553
+ if (!el) return;
4554
+ const listener = (e) => {
4555
+ const detail = e.detail;
4556
+ setScrollState({
4557
+ scrollPosition: detail.state,
4558
+ isScrollable: detail.isScrollable
4559
+ });
4560
+ onScrollStateChange == null ? void 0 : onScrollStateChange({ ...detail, event: e });
4561
+ };
4562
+ el.addEventListener("_scrollStateChange", listener);
4563
+ return () => el.removeEventListener("_scrollStateChange", listener);
4564
+ }, [onScrollStateChange]);
4565
+ return /* @__PURE__ */ jsx(GoabWorkspaceLayoutScrollStateContext.Provider, { value: scrollState, children: /* @__PURE__ */ jsxs("goa-workspace-layout", { ref, testid: testId, ...rest, children: [
4566
+ sideMenu && /* @__PURE__ */ jsx("div", { slot: "side-menu", children: sideMenu }),
4567
+ pageHeader && /* @__PURE__ */ jsx("div", { slot: "page-header", children: pageHeader }),
4568
+ children,
4569
+ pageFooter && /* @__PURE__ */ jsx("div", { slot: "page-footer", children: pageFooter }),
4570
+ pushDrawer && /* @__PURE__ */ jsx("div", { slot: "push-drawer", children: pushDrawer })
4571
+ ] }) });
4572
+ }
4506
4573
  export {
4507
4574
  GoALinkButton,
4508
4575
  GoabAccordion,
@@ -4578,6 +4645,7 @@ export {
4578
4645
  GoabPushDrawer,
4579
4646
  GoabRadioGroup,
4580
4647
  GoabRadioItem,
4648
+ GoabScrollPanel,
4581
4649
  GoabSideMenu,
4582
4650
  GoabSideMenuGroup,
4583
4651
  GoabSideMenuHeading,
@@ -4601,6 +4669,8 @@ export {
4601
4669
  GoabWorkSideMenuItem,
4602
4670
  GoabWorkSideNotificationItem,
4603
4671
  GoabWorkSideNotificationPanel,
4672
+ GoabWorkspaceLayout,
4673
+ useGoabWorkspaceLayoutScrollState,
4604
4674
  usePublicFormController,
4605
4675
  useTheme
4606
4676
  };