@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.d.ts CHANGED
@@ -62,6 +62,7 @@ export * from './lib/side-menu/side-menu';
62
62
  export * from './lib/skeleton/skeleton';
63
63
  export * from './lib/spacer/spacer';
64
64
  export * from './lib/spinner/spinner';
65
+ export * from './lib/scroll-panel/scroll-panel';
65
66
  export * from './lib/table/table';
66
67
  export * from './lib/table/table-sort-header';
67
68
  export * from './lib/tabs/tabs';
@@ -80,3 +81,4 @@ export * from './lib/work-side-menu-item/work-side-menu-item';
80
81
  export * from './lib/work-side-notification-item/work-side-notification-item';
81
82
  export * from './lib/work-side-notification-panel/work-side-notification-panel';
82
83
  export * from './lib/theme/theme-context';
84
+ export * from './lib/workspace-layout/workspace-layout';
package/index.js CHANGED
@@ -135,9 +135,14 @@ function GoabBadge({
135
135
  }
136
136
  );
137
137
  }
138
- function GoabBlock({ testId, children, ...rest }) {
138
+ function GoabBlock({
139
+ testId,
140
+ stretch,
141
+ children,
142
+ ...rest
143
+ }) {
139
144
  const _props = transformProps({ testid: testId, ...rest }, kebab);
140
- return /* @__PURE__ */ jsxRuntime.jsx("goa-block", { ..._props, children });
145
+ return /* @__PURE__ */ jsxRuntime.jsx("goa-block", { ..._props, stretch: stretch ? "true" : void 0, children });
141
146
  }
142
147
  function GoabButton({
143
148
  disabled,
@@ -412,6 +417,9 @@ function GoabDataGrid({
412
417
  }
413
418
  );
414
419
  }
420
+ const GoabWorkspaceLayoutScrollState = {
421
+ NO_SCROLL: "no-scroll"
422
+ };
415
423
  function dispatch(el, eventName, detail, opts) {
416
424
  if (!el) {
417
425
  console.error("dispatch element is null");
@@ -3962,6 +3970,21 @@ function GoabSpinner({
3962
3970
  }
3963
3971
  );
3964
3972
  }
3973
+ function GoabScrollPanel({
3974
+ header,
3975
+ children,
3976
+ footer,
3977
+ height,
3978
+ testId,
3979
+ ...rest
3980
+ }) {
3981
+ const hostStyle = height ? { height } : void 0;
3982
+ return /* @__PURE__ */ jsxRuntime.jsxs("goa-scroll-panel", { height, testid: testId, style: hostStyle, ...rest, children: [
3983
+ header && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "header", children: header }),
3984
+ children,
3985
+ footer && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "footer", children: footer })
3986
+ ] });
3987
+ }
3965
3988
  function GoabTable({ onSort, onMultiSort, sortMode, ...props }) {
3966
3989
  const ref = react.useRef(null);
3967
3990
  react.useEffect(() => {
@@ -4505,6 +4528,50 @@ function useTheme() {
4505
4528
  }
4506
4529
  return ctx;
4507
4530
  }
4531
+ const GoabWorkspaceLayoutScrollStateDefault = {
4532
+ scrollPosition: GoabWorkspaceLayoutScrollState.NO_SCROLL,
4533
+ isScrollable: false
4534
+ };
4535
+ const GoabWorkspaceLayoutScrollStateContext = react.createContext(
4536
+ GoabWorkspaceLayoutScrollStateDefault
4537
+ );
4538
+ function useGoabWorkspaceLayoutScrollState() {
4539
+ return react.useContext(GoabWorkspaceLayoutScrollStateContext);
4540
+ }
4541
+ function GoabWorkspaceLayout({
4542
+ sideMenu,
4543
+ pageHeader,
4544
+ pageFooter,
4545
+ pushDrawer,
4546
+ children,
4547
+ testId,
4548
+ onScrollStateChange,
4549
+ ...rest
4550
+ }) {
4551
+ const ref = react.useRef(null);
4552
+ const [scrollState, setScrollState] = react.useState(GoabWorkspaceLayoutScrollStateDefault);
4553
+ react.useEffect(() => {
4554
+ const el = ref.current;
4555
+ if (!el) return;
4556
+ const listener = (e) => {
4557
+ const detail = e.detail;
4558
+ setScrollState({
4559
+ scrollPosition: detail.state,
4560
+ isScrollable: detail.isScrollable
4561
+ });
4562
+ onScrollStateChange == null ? void 0 : onScrollStateChange({ ...detail, event: e });
4563
+ };
4564
+ el.addEventListener("_scrollStateChange", listener);
4565
+ return () => el.removeEventListener("_scrollStateChange", listener);
4566
+ }, [onScrollStateChange]);
4567
+ return /* @__PURE__ */ jsxRuntime.jsx(GoabWorkspaceLayoutScrollStateContext.Provider, { value: scrollState, children: /* @__PURE__ */ jsxRuntime.jsxs("goa-workspace-layout", { ref, testid: testId, ...rest, children: [
4568
+ sideMenu && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "side-menu", children: sideMenu }),
4569
+ pageHeader && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "page-header", children: pageHeader }),
4570
+ children,
4571
+ pageFooter && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "page-footer", children: pageFooter }),
4572
+ pushDrawer && /* @__PURE__ */ jsxRuntime.jsx("div", { slot: "push-drawer", children: pushDrawer })
4573
+ ] }) });
4574
+ }
4508
4575
  exports.GoALinkButton = GoALinkButton;
4509
4576
  exports.GoabAccordion = GoabAccordion;
4510
4577
  exports.GoabAppFooter = GoabAppFooter;
@@ -4579,6 +4646,7 @@ exports.GoabPublicSubformIndex = GoabPublicSubformIndex;
4579
4646
  exports.GoabPushDrawer = GoabPushDrawer;
4580
4647
  exports.GoabRadioGroup = GoabRadioGroup;
4581
4648
  exports.GoabRadioItem = GoabRadioItem;
4649
+ exports.GoabScrollPanel = GoabScrollPanel;
4582
4650
  exports.GoabSideMenu = GoabSideMenu;
4583
4651
  exports.GoabSideMenuGroup = GoabSideMenuGroup;
4584
4652
  exports.GoabSideMenuHeading = GoabSideMenuHeading;
@@ -4602,6 +4670,8 @@ exports.GoabWorkSideMenuGroup = GoabWorkSideMenuGroup;
4602
4670
  exports.GoabWorkSideMenuItem = GoabWorkSideMenuItem;
4603
4671
  exports.GoabWorkSideNotificationItem = GoabWorkSideNotificationItem;
4604
4672
  exports.GoabWorkSideNotificationPanel = GoabWorkSideNotificationPanel;
4673
+ exports.GoabWorkspaceLayout = GoabWorkspaceLayout;
4674
+ exports.useGoabWorkspaceLayoutScrollState = useGoabWorkspaceLayoutScrollState;
4605
4675
  exports.usePublicFormController = usePublicFormController;
4606
4676
  exports.useTheme = useTheme;
4607
4677
  //# sourceMappingURL=index.js.map