amp-workflow-ui 0.1.27 → 0.1.28

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.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import React7, { createContext, useState, useEffect, useCallback, useContext, useRef } from 'react';
1
+ import React2, { createContext, useState, useEffect, useCallback, useRef, useContext } from 'react';
2
2
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
3
  import Dialog$1 from '@mui/material/Dialog';
4
4
  import useMediaQuery from '@mui/material/useMediaQuery';
@@ -423,7 +423,7 @@ function WorkflowRequestCard({
423
423
  ] }),
424
424
  (_r = requestDetails == null ? void 0 : requestDetails.levels) == null ? void 0 : _r.map((_, idx) => {
425
425
  const level = idx + 1;
426
- return /* @__PURE__ */ jsx(React7.Fragment, { children: userLevel == "L" + level ? /* @__PURE__ */ jsxs(Fragment, { children: [
426
+ return /* @__PURE__ */ jsx(React2.Fragment, { children: userLevel == "L" + level ? /* @__PURE__ */ jsxs(Fragment, { children: [
427
427
  /* @__PURE__ */ jsx(Chip, { label: "L" + level, className: "step-chip-current" }),
428
428
  (requestDetails == null ? void 0 : requestDetails.levels.length) !== level && /* @__PURE__ */ jsx("div", { className: "step-line step-line-inactive" })
429
429
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -1786,10 +1786,10 @@ function ApprovalWorkflow({
1786
1786
  );
1787
1787
  console.log("\u{1F680} ~ ApprovalWorkflow ~ selectedOption:", selectedOption);
1788
1788
  const [expandedId, setExpandedId] = useState(null);
1789
- const [sendDialog, setSendDialog] = React7.useState(null);
1790
- const [approveTarget, setApproveTarget] = React7.useState(null);
1791
- const [rejectTarget, setRejectTarget] = React7.useState(null);
1792
- const [onHoldTarget, setOnHoldTarget] = React7.useState(null);
1789
+ const [sendDialog, setSendDialog] = useState(null);
1790
+ const [approveTarget, setApproveTarget] = useState(null);
1791
+ const [rejectTarget, setRejectTarget] = useState(null);
1792
+ const [onHoldTarget, setOnHoldTarget] = useState(null);
1793
1793
  const [expandedDetails, setExpandedDetails] = useState([]);
1794
1794
  console.log("\u{1F680} ~ ApprovalWorkflow ~ expandedDetails:", expandedDetails);
1795
1795
  const [descriptionView, setDescriptionView] = useState(null);
@@ -1797,6 +1797,7 @@ function ApprovalWorkflow({
1797
1797
  const [viewMoreDetails, setViewMoreDetails] = useState(null);
1798
1798
  const [isViewMoreOpen, setIsViewMoreOpen] = useState(false);
1799
1799
  const [isFilterOpen, setIsFilterOpen] = useState(false);
1800
+ console.log("\u{1F680} ~ PIPELINE TEST");
1800
1801
  const handleOpenViewMore = (details) => {
1801
1802
  setViewMoreDetails(details);
1802
1803
  setIsViewMoreOpen(true);
@@ -1878,7 +1879,7 @@ function ApprovalWorkflow({
1878
1879
  const handleSearchChange = useCallback((value) => {
1879
1880
  setSearchText(value);
1880
1881
  }, []);
1881
- const observer = React7.useRef(null);
1882
+ const observer = useRef(null);
1882
1883
  const lastCardRef = useCallback(
1883
1884
  (node) => {
1884
1885
  const currentTab = tabs[selectedOption];
@@ -1899,6 +1900,24 @@ function ApprovalWorkflow({
1899
1900
  },
1900
1901
  [tabs, selectedOption]
1901
1902
  );
1903
+ const scrollRef = useRef(null);
1904
+ useEffect(() => {
1905
+ const handleKeyDown = (e) => {
1906
+ var _a2, _b2, _c2, _d2;
1907
+ if (((_a2 = document.activeElement) == null ? void 0 : _a2.tagName) === "INPUT" || ((_b2 = document.activeElement) == null ? void 0 : _b2.tagName) === "TEXTAREA") {
1908
+ return;
1909
+ }
1910
+ if (e.key === "ArrowUp") {
1911
+ e.preventDefault();
1912
+ (_c2 = scrollRef.current) == null ? void 0 : _c2.scrollBy({ top: -100, behavior: "smooth" });
1913
+ } else if (e.key === "ArrowDown") {
1914
+ e.preventDefault();
1915
+ (_d2 = scrollRef.current) == null ? void 0 : _d2.scrollBy({ top: 100, behavior: "smooth" });
1916
+ }
1917
+ };
1918
+ window.addEventListener("keydown", handleKeyDown);
1919
+ return () => window.removeEventListener("keydown", handleKeyDown);
1920
+ }, []);
1902
1921
  const handleSendBack = (workflowLogId) => {
1903
1922
  setSendDialog(workflowLogId);
1904
1923
  };
@@ -2377,6 +2396,7 @@ function ApprovalWorkflow({
2377
2396
  /* @__PURE__ */ jsxs(
2378
2397
  Box$1,
2379
2398
  {
2399
+ ref: scrollRef,
2380
2400
  className: "fixedModal hide-scrollbar",
2381
2401
  sx: {
2382
2402
  overflowY: "auto",
@@ -2720,7 +2740,7 @@ function ApprovalWorkflow2(props) {
2720
2740
  ENV_VARIABLES,
2721
2741
  ...rest
2722
2742
  } = props;
2723
- console.log("\u{1F680} ~ ApprovalWorkflow ~ props:", props);
2743
+ console.log("\u{1F680} ~ PIPELINE TEST");
2724
2744
  return /* @__PURE__ */ jsx(
2725
2745
  WorkflowProvider,
2726
2746
  {