@procore/saved-views 1.0.1-estimatingFork.5 → 1.0.1-estimatingFork.6.1

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.
@@ -110,7 +110,7 @@ var require_react_is_production_min = __commonJS({
110
110
  var E2 = n2;
111
111
  var F2 = c2;
112
112
  var G2 = f2;
113
- var H3 = e2;
113
+ var H2 = e2;
114
114
  var I = l2;
115
115
  exports.ContextConsumer = h;
116
116
  exports.ContextProvider = z2;
@@ -121,7 +121,7 @@ var require_react_is_production_min = __commonJS({
121
121
  exports.Memo = E2;
122
122
  exports.Portal = F2;
123
123
  exports.Profiler = G2;
124
- exports.StrictMode = H3;
124
+ exports.StrictMode = H2;
125
125
  exports.Suspense = I;
126
126
  exports.isAsyncMode = function() {
127
127
  return false;
@@ -7868,7 +7868,7 @@ function __rest(s2, e2) {
7868
7868
  return t2;
7869
7869
  }
7870
7870
 
7871
- // ../../node_modules/@procore/core-icons/dist/Icon.js
7871
+ // node_modules/@procore/core-icons/dist/Icon.js
7872
7872
  import * as React from "react";
7873
7873
  function getSize(size) {
7874
7874
  if (size === "sm") {
@@ -7887,7 +7887,7 @@ function Icon(_a) {
7887
7887
  return React.isValidElement(children) ? React.cloneElement(children, __assign(__assign({ "aria-hidden": true, "data-qa": "ci-".concat(props.name) }, props), { width: getSize(props.size), height: getSize(props.size), focusable: false, style: __assign(__assign({}, props.style), { flex: "0 0 auto" }) })) : null;
7888
7888
  }
7889
7889
 
7890
- // ../../node_modules/@procore/core-icons/dist/icons/Building.js
7890
+ // node_modules/@procore/core-icons/dist/icons/Building.js
7891
7891
  import * as React2 from "react";
7892
7892
  var Building = React2.forwardRef(function Building2(props, ref) {
7893
7893
  return React2.createElement(
@@ -7903,7 +7903,7 @@ var Building = React2.forwardRef(function Building2(props, ref) {
7903
7903
  Building.displayName = "Building";
7904
7904
  var Building_default = Building;
7905
7905
 
7906
- // ../../node_modules/@procore/core-icons/dist/icons/ChevronDown.js
7906
+ // node_modules/@procore/core-icons/dist/icons/ChevronDown.js
7907
7907
  import * as React3 from "react";
7908
7908
  var ChevronDown = React3.forwardRef(function ChevronDown2(props, ref) {
7909
7909
  return React3.createElement(
@@ -7919,7 +7919,7 @@ var ChevronDown = React3.forwardRef(function ChevronDown2(props, ref) {
7919
7919
  ChevronDown.displayName = "ChevronDown";
7920
7920
  var ChevronDown_default = ChevronDown;
7921
7921
 
7922
- // ../../node_modules/@procore/core-icons/dist/icons/ChevronRight.js
7922
+ // node_modules/@procore/core-icons/dist/icons/ChevronRight.js
7923
7923
  import * as React4 from "react";
7924
7924
  var ChevronRight = React4.forwardRef(function ChevronRight2(props, ref) {
7925
7925
  return React4.createElement(
@@ -7935,7 +7935,7 @@ var ChevronRight = React4.forwardRef(function ChevronRight2(props, ref) {
7935
7935
  ChevronRight.displayName = "ChevronRight";
7936
7936
  var ChevronRight_default = ChevronRight;
7937
7937
 
7938
- // ../../node_modules/@procore/core-icons/dist/icons/Clear.js
7938
+ // node_modules/@procore/core-icons/dist/icons/Clear.js
7939
7939
  import * as React5 from "react";
7940
7940
  var Clear = React5.forwardRef(function Clear2(props, ref) {
7941
7941
  return React5.createElement(
@@ -7951,7 +7951,7 @@ var Clear = React5.forwardRef(function Clear2(props, ref) {
7951
7951
  Clear.displayName = "Clear";
7952
7952
  var Clear_default = Clear;
7953
7953
 
7954
- // ../../node_modules/@procore/core-icons/dist/icons/Excavator.js
7954
+ // node_modules/@procore/core-icons/dist/icons/Excavator.js
7955
7955
  import * as React6 from "react";
7956
7956
  var Excavator = React6.forwardRef(function Excavator2(props, ref) {
7957
7957
  return React6.createElement(
@@ -7968,7 +7968,7 @@ var Excavator = React6.forwardRef(function Excavator2(props, ref) {
7968
7968
  Excavator.displayName = "Excavator";
7969
7969
  var Excavator_default = Excavator;
7970
7970
 
7971
- // ../../node_modules/@procore/core-icons/dist/icons/ExpandSidebar.js
7971
+ // node_modules/@procore/core-icons/dist/icons/ExpandSidebar.js
7972
7972
  import * as React7 from "react";
7973
7973
  var ExpandSidebar = React7.forwardRef(function ExpandSidebar2(props, ref) {
7974
7974
  return React7.createElement(
@@ -7986,7 +7986,7 @@ var ExpandSidebar = React7.forwardRef(function ExpandSidebar2(props, ref) {
7986
7986
  ExpandSidebar.displayName = "ExpandSidebar";
7987
7987
  var ExpandSidebar_default = ExpandSidebar;
7988
7988
 
7989
- // ../../node_modules/@procore/core-icons/dist/icons/Help.js
7989
+ // node_modules/@procore/core-icons/dist/icons/Help.js
7990
7990
  import * as React8 from "react";
7991
7991
  var Help = React8.forwardRef(function Help2(props, ref) {
7992
7992
  return React8.createElement(
@@ -8002,7 +8002,7 @@ var Help = React8.forwardRef(function Help2(props, ref) {
8002
8002
  Help.displayName = "Help";
8003
8003
  var Help_default = Help;
8004
8004
 
8005
- // ../../node_modules/@procore/core-icons/dist/icons/Link.js
8005
+ // node_modules/@procore/core-icons/dist/icons/Link.js
8006
8006
  import * as React9 from "react";
8007
8007
  var Link = React9.forwardRef(function Link2(props, ref) {
8008
8008
  return React9.createElement(
@@ -8019,7 +8019,7 @@ var Link = React9.forwardRef(function Link2(props, ref) {
8019
8019
  Link.displayName = "Link";
8020
8020
  var Link_default = Link;
8021
8021
 
8022
- // ../../node_modules/@procore/core-icons/dist/icons/Person.js
8022
+ // node_modules/@procore/core-icons/dist/icons/Person.js
8023
8023
  import * as React10 from "react";
8024
8024
  var Person = React10.forwardRef(function Person2(props, ref) {
8025
8025
  return React10.createElement(
@@ -8035,7 +8035,7 @@ var Person = React10.forwardRef(function Person2(props, ref) {
8035
8035
  Person.displayName = "Person";
8036
8036
  var Person_default = Person;
8037
8037
 
8038
- // ../../node_modules/@procore/core-icons/dist/icons/Plus.js
8038
+ // node_modules/@procore/core-icons/dist/icons/Plus.js
8039
8039
  import * as React11 from "react";
8040
8040
  var Plus = React11.forwardRef(function Plus2(props, ref) {
8041
8041
  return React11.createElement(
@@ -8148,7 +8148,7 @@ function stylis_min(W2) {
8148
8148
  }
8149
8149
  k2 = M2(c2, r2, k2, g2, a2 + 1);
8150
8150
  t2 = k2.length;
8151
- 0 < A2 && (r2 = X2(O2, f2, I), C2 = H3(3, k2, r2, c2, D2, z2, t2, g2, a2, h), f2 = r2.join(""), void 0 !== C2 && 0 === (t2 = (k2 = C2.trim()).length) && (g2 = 0, k2 = ""));
8151
+ 0 < A2 && (r2 = X2(O2, f2, I), C2 = H2(3, k2, r2, c2, D2, z2, t2, g2, a2, h), f2 = r2.join(""), void 0 !== C2 && 0 === (t2 = (k2 = C2.trim()).length) && (g2 = 0, k2 = ""));
8152
8152
  if (0 < t2)
8153
8153
  switch (g2) {
8154
8154
  case 115:
@@ -8181,7 +8181,7 @@ function stylis_min(W2) {
8181
8181
  case 59:
8182
8182
  f2 = (0 < r2 ? f2.replace(N, "") : f2).trim();
8183
8183
  if (1 < (t2 = f2.length))
8184
- switch (0 === u2 && (q2 = f2.charCodeAt(0), 45 === q2 || 96 < q2 && 123 > q2) && (t2 = (f2 = f2.replace(" ", ":")).length), 0 < A2 && void 0 !== (C2 = H3(1, f2, c2, d, D2, z2, p.length, h, a2, h)) && 0 === (t2 = (f2 = C2.trim()).length) && (f2 = "\0\0"), q2 = f2.charCodeAt(0), g2 = f2.charCodeAt(1), q2) {
8184
+ switch (0 === u2 && (q2 = f2.charCodeAt(0), 45 === q2 || 96 < q2 && 123 > q2) && (t2 = (f2 = f2.replace(" ", ":")).length), 0 < A2 && void 0 !== (C2 = H2(1, f2, c2, d, D2, z2, p.length, h, a2, h)) && 0 === (t2 = (f2 = C2.trim()).length) && (f2 = "\0\0"), q2 = f2.charCodeAt(0), g2 = f2.charCodeAt(1), q2) {
8185
8185
  case 0:
8186
8186
  break;
8187
8187
  case 64:
@@ -8201,7 +8201,7 @@ function stylis_min(W2) {
8201
8201
  case 13:
8202
8202
  case 10:
8203
8203
  47 === b2 ? b2 = 0 : 0 === 1 + q2 && 107 !== h && 0 < f2.length && (r2 = 1, f2 += "\0");
8204
- 0 < A2 * Y2 && H3(0, f2, c2, d, D2, z2, p.length, h, a2, h);
8204
+ 0 < A2 * Y2 && H2(0, f2, c2, d, D2, z2, p.length, h, a2, h);
8205
8205
  z2 = 1;
8206
8206
  D2++;
8207
8207
  break;
@@ -8310,7 +8310,7 @@ function stylis_min(W2) {
8310
8310
  t2 = p.length;
8311
8311
  if (0 < t2) {
8312
8312
  r2 = c2;
8313
- if (0 < A2 && (C2 = H3(2, p, r2, d, D2, z2, t2, h, a2, h), void 0 !== C2 && 0 === (p = C2).length))
8313
+ if (0 < A2 && (C2 = H2(2, p, r2, d, D2, z2, t2, h, a2, h), void 0 !== C2 && 0 === (p = C2).length))
8314
8314
  return G3 + p + F3;
8315
8315
  p = r2.join(",") + "{" + p + "}";
8316
8316
  if (0 !== w2 * E2) {
@@ -8487,7 +8487,7 @@ function stylis_min(W2) {
8487
8487
  var e2 = P4(c2, c2.charCodeAt(0), c2.charCodeAt(1), c2.charCodeAt(2));
8488
8488
  return e2 !== c2 + ";" ? e2.replace(oa, " or ($1)").substring(4) : "(" + c2 + ")";
8489
8489
  }
8490
- function H3(d, c2, e2, h, a2, m2, b2, v2, n2, q2) {
8490
+ function H2(d, c2, e2, h, a2, m2, b2, v2, n2, q2) {
8491
8491
  for (var g2 = 0, x2 = c2, w3; g2 < A2; ++g2) {
8492
8492
  switch (w3 = S2[g2].call(B2, d, x2, e2, h, a2, m2, b2, v2, n2, q2)) {
8493
8493
  case void 0:
@@ -8531,11 +8531,11 @@ function stylis_min(W2) {
8531
8531
  V2 = e2;
8532
8532
  e2 = [V2];
8533
8533
  if (0 < A2) {
8534
- var h = H3(-1, c2, e2, e2, D2, z2, 0, 0, 0, 0);
8534
+ var h = H2(-1, c2, e2, e2, D2, z2, 0, 0, 0, 0);
8535
8535
  void 0 !== h && "string" === typeof h && (c2 = h);
8536
8536
  }
8537
8537
  var a2 = M2(O2, e2, c2, 0, 0);
8538
- 0 < A2 && (h = H3(-2, a2, e2, e2, D2, z2, a2.length, 0, 0, 0), void 0 !== h && (a2 = h));
8538
+ 0 < A2 && (h = H2(-2, a2, e2, e2, D2, z2, a2.length, 0, 0, 0), void 0 !== h && (a2 = h));
8539
8539
  V2 = "";
8540
8540
  E2 = 0;
8541
8541
  z2 = D2 = 1;
@@ -9343,8 +9343,8 @@ var useSavedViewsPanel = (domain, tableName) => {
9343
9343
  setIsOpen(!isOpen);
9344
9344
  localStorage.setItem(key(domain, tableName), JSON.stringify(!isOpen));
9345
9345
  };
9346
- const Button7 = () => /* @__PURE__ */ React14.createElement(SavedViewsButton, { handleClick, isOpen });
9347
- return { isOpen, SavedViewsButton: Button7 };
9346
+ const Button8 = () => /* @__PURE__ */ React14.createElement(SavedViewsButton, { handleClick, isOpen });
9347
+ return { isOpen, SavedViewsButton: Button8 };
9348
9348
  };
9349
9349
  var useSavedViewsPanel_default = useSavedViewsPanel;
9350
9350
 
@@ -9424,6 +9424,17 @@ var SavedViewCollectionMenuItem = (props) => {
9424
9424
  label: i18n.t("savedViews.actions.delete")
9425
9425
  }
9426
9426
  ];
9427
+ const preventEventBubbleToNotTriggerViewSelectEvent = React15.useCallback(
9428
+ (e2) => {
9429
+ e2.stopPropagation();
9430
+ },
9431
+ []
9432
+ );
9433
+ const hasUpdateButton = props.item.view_level !== "default" && props.canUpdate;
9434
+ const hasCopyShareLinkButton = props.enableSharingViews !== false && props.item.view_level !== "default" && props.selected && !props.canUpdate && props.item.id !== "temporary";
9435
+ const hasClearTemporaryButton = props.item.id === "temporary";
9436
+ const hasOverflowMenu = props.item.view_level !== "default" && props.canEditOrDelete;
9437
+ const hasActions = hasUpdateButton || hasCopyShareLinkButton || hasClearTemporaryButton || hasOverflowMenu;
9427
9438
  return /* @__PURE__ */ React15.createElement(
9428
9439
  Container2,
9429
9440
  {
@@ -9433,7 +9444,8 @@ var SavedViewCollectionMenuItem = (props) => {
9433
9444
  "aria-label": i18n.t("savedViews.ariaLabels.menuItem", {
9434
9445
  name: props.item.name
9435
9446
  }),
9436
- "data-testid": "saved-view-collection-menu-item"
9447
+ "data-testid": "saved-view-collection-menu-item",
9448
+ onKeyDown: preventEventBubbleToNotTriggerViewSelectEvent
9437
9449
  },
9438
9450
  /* @__PURE__ */ React15.createElement(
9439
9451
  "span",
@@ -9443,7 +9455,7 @@ var SavedViewCollectionMenuItem = (props) => {
9443
9455
  },
9444
9456
  props.item.name
9445
9457
  ),
9446
- /* @__PURE__ */ React15.createElement(RowActionsBox, null, /* @__PURE__ */ React15.createElement(Box, { justifyContent: "space-between" }, props.item.view_level !== "default" && props.canUpdate && /* @__PURE__ */ React15.createElement("div", null, /* @__PURE__ */ React15.createElement(
9458
+ hasActions && /* @__PURE__ */ React15.createElement(RowActionsBox, null, /* @__PURE__ */ React15.createElement(Box, { justifyContent: "space-between" }, hasUpdateButton && /* @__PURE__ */ React15.createElement(
9447
9459
  Button2,
9448
9460
  {
9449
9461
  onClick: updateItem,
@@ -9454,7 +9466,7 @@ var SavedViewCollectionMenuItem = (props) => {
9454
9466
  loading: props.isUpdateProcessing
9455
9467
  },
9456
9468
  i18n.t("savedViews.actions.update")
9457
- )), (props.enableSharingViews ?? true) && props.item.view_level !== "default" && props.selected && !props.canUpdate && props.item.id !== "temporary" && /* @__PURE__ */ React15.createElement("div", null, /* @__PURE__ */ React15.createElement(
9469
+ ), hasCopyShareLinkButton && /* @__PURE__ */ React15.createElement(
9458
9470
  Button2,
9459
9471
  {
9460
9472
  onClick: copyShareLink,
@@ -9464,7 +9476,7 @@ var SavedViewCollectionMenuItem = (props) => {
9464
9476
  "data-testid": "copy-share-link-button"
9465
9477
  },
9466
9478
  /* @__PURE__ */ React15.createElement(IconWrapper, null, /* @__PURE__ */ React15.createElement(Link_default, { size: "sm" }))
9467
- )), props.item.id === "temporary" && /* @__PURE__ */ React15.createElement("div", null, /* @__PURE__ */ React15.createElement(
9479
+ ), hasClearTemporaryButton && /* @__PURE__ */ React15.createElement(
9468
9480
  Button2,
9469
9481
  {
9470
9482
  onClick: (e2) => {
@@ -9478,7 +9490,7 @@ var SavedViewCollectionMenuItem = (props) => {
9478
9490
  "data-testid": "clear-temporary-view-button"
9479
9491
  },
9480
9492
  /* @__PURE__ */ React15.createElement(IconWrapper, null, /* @__PURE__ */ React15.createElement(Clear_default, { size: "sm" }))
9481
- ))), /* @__PURE__ */ React15.createElement(Box, null, props.item.view_level !== "default" && props.canEditOrDelete && /* @__PURE__ */ React15.createElement("div", { onClick: (e2) => e2.stopPropagation() }, /* @__PURE__ */ React15.createElement(
9493
+ )), /* @__PURE__ */ React15.createElement(Box, null, hasOverflowMenu && /* @__PURE__ */ React15.createElement(
9482
9494
  DropdownFlyout,
9483
9495
  {
9484
9496
  "data-testid": "saved-view-overflow-button",
@@ -9489,7 +9501,7 @@ var SavedViewCollectionMenuItem = (props) => {
9489
9501
  variant: "tertiary",
9490
9502
  disabled: props.isUpdateProcessing
9491
9503
  }
9492
- ))))
9504
+ )))
9493
9505
  );
9494
9506
  };
9495
9507
 
@@ -9523,7 +9535,7 @@ var useScrollToRef = (dependency) => {
9523
9535
  };
9524
9536
 
9525
9537
  // src/components/panels/PanelContent.tsx
9526
- import { Flex as Flex3, useI18nContext as useI18nContext4 } from "@procore/core-react";
9538
+ import { Flex as Flex2, MenuImperative as MenuImperative2, useI18nContext as useI18nContext4 } from "@procore/core-react";
9527
9539
  import { useToastAlertContext as useToastAlertContext2 } from "@procore/toast-alert";
9528
9540
  import React17 from "react";
9529
9541
 
@@ -9531,7 +9543,7 @@ import React17 from "react";
9531
9543
  import {
9532
9544
  colors,
9533
9545
  DetailPage,
9534
- UNSAFE_Menu as MenuImperative,
9546
+ MenuImperative,
9535
9547
  spacing
9536
9548
  } from "@procore/core-react";
9537
9549
  var Row = styled_components_esm_default(MenuImperative.Item)`
@@ -9795,9 +9807,9 @@ var useGroups = (isProjectLevelTool) => {
9795
9807
 
9796
9808
  // src/components/panels/ViewLevelHeader.tsx
9797
9809
  import {
9810
+ Box as Box2,
9811
+ Button as Button3,
9798
9812
  colors as colors2,
9799
- Flex as Flex2,
9800
- spacing as spacing2,
9801
9813
  Typography,
9802
9814
  useI18nContext as useI18nContext3
9803
9815
  } from "@procore/core-react";
@@ -9812,31 +9824,40 @@ var groupIcon = (group) => {
9812
9824
  return /* @__PURE__ */ React16.createElement(Building_default, null);
9813
9825
  }
9814
9826
  };
9815
- var Header = styled_components_esm_default(Flex2)`
9816
- width: 100%;
9827
+ var StyledButton2 = styled_components_esm_default(Button3)`
9817
9828
  &:hover {
9818
9829
  background-color: ${colors2.gray98};
9819
9830
  }
9820
9831
  `;
9821
9832
  var ViewLevelHeader = ({ expanded, toggleGroup, group }) => {
9822
9833
  const I18n = useI18nContext3();
9823
- return /* @__PURE__ */ React16.createElement(
9824
- Header,
9834
+ return /* @__PURE__ */ React16.createElement(Box2, { style: { width: "100%" } }, /* @__PURE__ */ React16.createElement(
9835
+ StyledButton2,
9825
9836
  {
9826
- alignItems: "center",
9827
- padding: `${spacing2.sm}px`,
9828
- gap: `${spacing2.sm}px`,
9829
- style: { cursor: "pointer" },
9830
- onClick: () => toggleGroup(group)
9837
+ block: true,
9838
+ style: {
9839
+ justifyContent: "start",
9840
+ height: "40px"
9841
+ },
9842
+ variant: "tertiary",
9843
+ size: "sm",
9844
+ onClick: () => toggleGroup(group),
9845
+ "aria-controls": `saved-views-collections-${group}`,
9846
+ "aria-expanded": expanded,
9847
+ icon: expanded ? /* @__PURE__ */ React16.createElement(ChevronDown_default, { size: "sm" }) : /* @__PURE__ */ React16.createElement(ChevronRight_default, { size: "sm" })
9831
9848
  },
9832
- expanded ? /* @__PURE__ */ React16.createElement(ChevronDown_default, { size: "sm" }) : /* @__PURE__ */ React16.createElement(ChevronRight_default, { size: "sm" }),
9833
9849
  groupIcon(group),
9834
9850
  /* @__PURE__ */ React16.createElement(Typography, { weight: "semibold" }, I18n.t(`savedViews.viewLevel.${group}`))
9835
- );
9851
+ ));
9836
9852
  };
9837
9853
  var ViewLevelHeader_default = ViewLevelHeader;
9838
9854
 
9839
9855
  // src/components/panels/PanelContent.tsx
9856
+ var StyledMenuImperative = styled_components_esm_default(MenuImperative2)`
9857
+ div[role='listbox'] {
9858
+ padding: 0;
9859
+ }
9860
+ `;
9840
9861
  var PanelContent = (props) => {
9841
9862
  const { queryInput, selectedSavedView, tableConfig } = props;
9842
9863
  const { showToast } = useToastAlertContext2();
@@ -9879,42 +9900,54 @@ var PanelContent = (props) => {
9879
9900
  }
9880
9901
  });
9881
9902
  };
9882
- return /* @__PURE__ */ React17.createElement(Panel2, { "data-testid": "inner-panel" }, /* @__PURE__ */ React17.createElement(Flex3, { direction: "column", style: { height: "100%", width: "100%" } }, temporaryView && /* @__PURE__ */ React17.createElement(
9883
- Row,
9903
+ return /* @__PURE__ */ React17.createElement(Panel2, { "data-testid": "inner-panel" }, /* @__PURE__ */ React17.createElement(Flex2, { direction: "column", style: { height: "100%", width: "100%" } }, (temporaryView || presetViews) && /* @__PURE__ */ React17.createElement(
9904
+ StyledMenuImperative,
9884
9905
  {
9885
- selected: isTemporarySelected,
9886
- onClick: () => props.onSelect({ item: temporaryView }),
9887
- ref: isTemporarySelected ? selectedRowRef : null
9906
+ role: "listbox",
9907
+ onSelect: (selection) => {
9908
+ if (selectedSavedView?.id !== selection.item.id) {
9909
+ props.onSelect({ item: selection.item });
9910
+ }
9911
+ }
9888
9912
  },
9889
- /* @__PURE__ */ React17.createElement(
9890
- SavedViewCollectionMenuItem,
9913
+ /* @__PURE__ */ React17.createElement(MenuImperative2.Options, null, temporaryView && /* @__PURE__ */ React17.createElement(
9914
+ Row,
9891
9915
  {
9916
+ key: temporaryView.id,
9892
9917
  item: temporaryView,
9893
9918
  selected: isTemporarySelected,
9894
- onClearTemporary: props.onClearTemporary,
9895
- enableSharingViews: false
9896
- }
9897
- )
9898
- ), presetViews.map((presetView) => {
9899
- const isSelected = selectedSavedView?.id === presetView.id;
9900
- return /* @__PURE__ */ React17.createElement(
9901
- Row,
9902
- {
9903
- key: presetView.id,
9904
- selected: isSelected,
9905
- onClick: () => props.onSelect({ item: presetView }),
9906
- ref: isSelected ? selectedRowRef : null
9919
+ ref: isTemporarySelected ? selectedRowRef : null
9907
9920
  },
9908
9921
  /* @__PURE__ */ React17.createElement(
9909
9922
  SavedViewCollectionMenuItem,
9910
9923
  {
9911
- item: presetView,
9912
- selected: isSelected,
9913
- enableSharingViews: false
9924
+ item: temporaryView,
9925
+ selected: isTemporarySelected,
9926
+ onClearTemporary: props.onClearTemporary,
9927
+ enableSharingViews: props.enableSharingViews
9914
9928
  }
9915
9929
  )
9916
- );
9917
- }), viewLevels.map((level) => {
9930
+ ), presetViews.map((presetView) => {
9931
+ const isSelected = selectedSavedView?.id === presetView.id;
9932
+ return /* @__PURE__ */ React17.createElement(
9933
+ Row,
9934
+ {
9935
+ key: presetView.id,
9936
+ item: presetView,
9937
+ selected: isSelected,
9938
+ ref: isSelected ? selectedRowRef : null
9939
+ },
9940
+ /* @__PURE__ */ React17.createElement(
9941
+ SavedViewCollectionMenuItem,
9942
+ {
9943
+ item: presetView,
9944
+ selected: isSelected,
9945
+ enableSharingViews: props.enableSharingViews
9946
+ }
9947
+ )
9948
+ );
9949
+ }))
9950
+ ), viewLevels.map((level) => {
9918
9951
  const isExpanded = groups[level];
9919
9952
  const views = isExpanded && savedViews ? savedViews.filter(
9920
9953
  (view) => view.view_level === level && view.id !== "temporary"
@@ -9926,63 +9959,75 @@ var PanelContent = (props) => {
9926
9959
  toggleGroup,
9927
9960
  expanded: isExpanded
9928
9961
  }
9929
- ), views.map((view) => {
9930
- const isSelected = selectedSavedView?.id === view.id;
9931
- const canUpdate = isSelected && hasPermissionForViewLevel(view.view_level, permissions) && !isEqual(
9932
- view.table_config,
9933
- tableConfig,
9934
- props.defaultView.table_config,
9935
- props.provider
9936
- );
9937
- const canEditOrDelete = isSelected && hasPermissionForViewLevel(view.view_level, permissions);
9938
- return /* @__PURE__ */ React17.createElement(
9939
- Row,
9940
- {
9941
- key: view.id,
9942
- item: view,
9943
- selected: isSelected,
9944
- onClick: () => {
9945
- props.onSelect({ item: view });
9946
- },
9947
- ref: isSelected ? selectedRowRef : null
9948
- },
9949
- /* @__PURE__ */ React17.createElement(
9950
- SavedViewCollectionMenuItem,
9962
+ ), isExpanded && views.length > 0 && /* @__PURE__ */ React17.createElement(
9963
+ StyledMenuImperative,
9964
+ {
9965
+ id: `saved-views-collections-${level}`,
9966
+ role: "listbox",
9967
+ onSelect: (selection) => {
9968
+ if (selectedSavedView?.id !== selection.item.id) {
9969
+ props.onSelect({ item: selection.item });
9970
+ }
9971
+ }
9972
+ },
9973
+ /* @__PURE__ */ React17.createElement(MenuImperative2.Options, null, views.map((view) => {
9974
+ const isSelected = selectedSavedView?.id === view.id;
9975
+ const canUpdate = isSelected && hasPermissionForViewLevel(
9976
+ view.view_level,
9977
+ permissions
9978
+ ) && !isEqual(
9979
+ view.table_config,
9980
+ tableConfig,
9981
+ props.defaultView.table_config,
9982
+ props.provider
9983
+ );
9984
+ const canEditOrDelete = isSelected && hasPermissionForViewLevel(view.view_level, permissions);
9985
+ return /* @__PURE__ */ React17.createElement(
9986
+ Row,
9951
9987
  {
9952
- item: view,
9953
9988
  key: view.id,
9989
+ item: view,
9954
9990
  selected: isSelected,
9955
- canUpdate,
9956
- canEditOrDelete,
9957
- onUpdate: (data) => onUpdate(data),
9958
- isUpdateProcessing: isUpdateLoading,
9959
- onEdit: () => props.openModal("update" /* UPDATE */),
9960
- onDelete: props.onDelete,
9961
- permissions,
9962
- enableSharingViews: false
9963
- }
9964
- )
9965
- );
9966
- }));
9991
+ ref: isSelected ? selectedRowRef : null
9992
+ },
9993
+ /* @__PURE__ */ React17.createElement(
9994
+ SavedViewCollectionMenuItem,
9995
+ {
9996
+ item: view,
9997
+ key: view.id,
9998
+ selected: isSelected,
9999
+ canUpdate,
10000
+ canEditOrDelete,
10001
+ onUpdate: (data) => onUpdate(data),
10002
+ isUpdateProcessing: isUpdateLoading,
10003
+ onEdit: () => props.openModal("update" /* UPDATE */),
10004
+ onDelete: props.onDelete,
10005
+ permissions,
10006
+ enableSharingViews: props.enableSharingViews
10007
+ }
10008
+ )
10009
+ );
10010
+ }))
10011
+ ));
9967
10012
  })));
9968
10013
  };
9969
10014
 
9970
10015
  // src/components/saved-views/SavedViews.tsx
9971
10016
  import {
9972
- Box as Box2,
9973
- Button as Button6,
9974
- Flex as Flex6,
10017
+ Box as Box3,
10018
+ Button as Button7,
10019
+ Flex as Flex5,
9975
10020
  Panel as Panel3,
9976
10021
  Tooltip,
9977
- useI18nContext as useI18nContext11
10022
+ useI18nContext as useI18nContext12
9978
10023
  } from "@procore/core-react";
9979
- import React22, { useState as useState4, useEffect as useEffect4, useCallback as useCallback3 } from "react";
10024
+ import React23, { useState as useState4, useEffect as useEffect5, useCallback as useCallback3 } from "react";
9980
10025
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
9981
10026
  import { useToastAlertContext as useToastAlertContext3, ToastAlertProvider } from "@procore/toast-alert";
9982
10027
 
9983
10028
  // src/components/modals/DeleteConfirmationModal.tsx
9984
10029
  import {
9985
- Button as Button3,
10030
+ Button as Button4,
9986
10031
  ConfirmModal,
9987
10032
  Modal,
9988
10033
  P as P2,
@@ -10006,28 +10051,27 @@ var SavedViewsDeleteConfirmationModalShared = ({
10006
10051
  style: { overflowWrap: "anywhere" }
10007
10052
  },
10008
10053
  /* @__PURE__ */ React18.createElement(Modal.Body, null, /* @__PURE__ */ React18.createElement(P2, null, i18n.t("savedViews.modal.delete.description"))),
10009
- /* @__PURE__ */ React18.createElement(Modal.Footer, null, /* @__PURE__ */ React18.createElement(Modal.FooterButtons, null, /* @__PURE__ */ React18.createElement(Button3, { variant: "secondary", onClick: onCancel }, i18n.t("savedViews.actions.cancel")), /* @__PURE__ */ React18.createElement(Button3, { variant: "primary", onClick: onDelete }, i18n.t("savedViews.actions.delete"))))
10054
+ /* @__PURE__ */ React18.createElement(Modal.Footer, null, /* @__PURE__ */ React18.createElement(Modal.FooterButtons, null, /* @__PURE__ */ React18.createElement(Button4, { variant: "secondary", onClick: onCancel }, i18n.t("savedViews.actions.cancel")), /* @__PURE__ */ React18.createElement(Button4, { variant: "primary", onClick: onDelete }, i18n.t("savedViews.actions.delete"))))
10010
10055
  );
10011
10056
  };
10012
10057
 
10013
10058
  // src/components/modals/form-modal/FormModal.tsx
10014
- import React20 from "react";
10059
+ import React21 from "react";
10015
10060
 
10016
10061
  // src/components/modals/form-modal/FormModalBase.tsx
10017
10062
  import {
10018
10063
  Banner,
10019
- Button as Button4,
10064
+ Button as Button5,
10020
10065
  colors as colors3,
10021
10066
  ErrorBanner,
10022
- Flex as Flex4,
10023
- Form,
10024
- H2,
10067
+ Flex as Flex3,
10068
+ Form as Form2,
10025
10069
  Modal as Modal2,
10026
- spacing as spacing3,
10070
+ spacing as spacing2,
10027
10071
  Typography as Typography2,
10028
- useI18nContext as useI18nContext6
10072
+ useI18nContext as useI18nContext7
10029
10073
  } from "@procore/core-react";
10030
- import * as React19 from "react";
10074
+ import * as React20 from "react";
10031
10075
  import * as yup from "yup";
10032
10076
 
10033
10077
  // src/components/modals/form-modal/FormModalBaseUtils.ts
@@ -10064,8 +10108,38 @@ function extractMessage(error, I18n) {
10064
10108
  return { form: I18n.t("savedViews.modal.errors.unknown") };
10065
10109
  }
10066
10110
 
10111
+ // src/components/modals/form-modal/NameInputField.tsx
10112
+ import { Form, useFormContext, useI18nContext as useI18nContext6 } from "@procore/core-react";
10113
+ import * as React19 from "react";
10114
+ var NAME_INPUT_ID = "saved-view-form-name-input";
10115
+ var NameInputField = ({
10116
+ error,
10117
+ onResetMutations
10118
+ }) => {
10119
+ const I18n = useI18nContext6();
10120
+ const label = I18n.t("savedViews.modal.fields.name");
10121
+ const { errors: formErrors, submitCount } = useFormContext();
10122
+ React19.useEffect(() => {
10123
+ if (submitCount > 0 && formErrors?.name) {
10124
+ document.getElementById(NAME_INPUT_ID)?.focus();
10125
+ }
10126
+ }, [formErrors?.name, submitCount]);
10127
+ return /* @__PURE__ */ React19.createElement(
10128
+ Form.Text,
10129
+ {
10130
+ id: NAME_INPUT_ID,
10131
+ name: "name",
10132
+ error,
10133
+ placeholder: label,
10134
+ label,
10135
+ colWidth: 12,
10136
+ onChange: onResetMutations
10137
+ }
10138
+ );
10139
+ };
10140
+
10067
10141
  // src/components/modals/form-modal/FormModalBase.tsx
10068
- var { useEffect: useEffect2, useRef: useRef2 } = React19;
10142
+ var { useEffect: useEffect3, useRef: useRef2 } = React20;
10069
10143
  var ScrollContainer = styled_components_esm_default("div")`
10070
10144
  overflow: auto;
10071
10145
  `;
@@ -10085,10 +10159,10 @@ var FormModalBase = ({
10085
10159
  onSelect,
10086
10160
  backend
10087
10161
  }) => {
10088
- const I18n = useI18nContext6();
10162
+ const I18n = useI18nContext7();
10089
10163
  const NAME_MAX_LENGTH = 150;
10090
10164
  const originalBodyWidth = useRef2("");
10091
- useEffect2(() => {
10165
+ useEffect3(() => {
10092
10166
  if (open) {
10093
10167
  originalBodyWidth.current = document.body.style.width || "";
10094
10168
  document.body.style.width = "100%";
@@ -10159,24 +10233,17 @@ var FormModalBase = ({
10159
10233
  I18n,
10160
10234
  isProjectLevelTool
10161
10235
  );
10162
- return /* @__PURE__ */ React19.createElement(
10236
+ return /* @__PURE__ */ React20.createElement(
10163
10237
  Modal2,
10164
10238
  {
10165
- "aria-label": I18n.t("savedViews.ariaLabels.modal"),
10166
- onClickOverlay: onClose,
10239
+ howToClose: ["x", "scrim"],
10240
+ onClose,
10167
10241
  open,
10168
- style: { width: "540px" },
10242
+ width: "md",
10169
10243
  "data-testid": "create-update-modal"
10170
10244
  },
10171
- /* @__PURE__ */ React19.createElement(ScrollContainer, null, /* @__PURE__ */ React19.createElement(
10172
- Modal2.Header,
10173
- {
10174
- onClose,
10175
- style: { borderBottom: `1px solid ${colors3.gray85}` }
10176
- },
10177
- /* @__PURE__ */ React19.createElement(H2, null, header)
10178
- ), /* @__PURE__ */ React19.createElement(
10179
- Form,
10245
+ /* @__PURE__ */ React20.createElement(ScrollContainer, null, /* @__PURE__ */ React20.createElement(Modal2.Header, { style: { borderBottom: `1px solid ${colors3.gray85}` } }, /* @__PURE__ */ React20.createElement(Modal2.Heading, null, header)), /* @__PURE__ */ React20.createElement(
10246
+ Form2,
10180
10247
  {
10181
10248
  initialValues: {
10182
10249
  name: initialName,
@@ -10201,30 +10268,26 @@ var FormModalBase = ({
10201
10268
  onReset: onCancel,
10202
10269
  validateOnChange: true
10203
10270
  },
10204
- /* @__PURE__ */ React19.createElement(Form.Form, { name: header }, /* @__PURE__ */ React19.createElement(
10271
+ /* @__PURE__ */ React20.createElement(Form2.Form, { name: header }, /* @__PURE__ */ React20.createElement(
10205
10272
  Modal2.Body,
10206
10273
  {
10207
- style: { paddingTop: 0, paddingBottom: 0, marginTop: spacing3.lg }
10274
+ style: { paddingTop: 0, paddingBottom: 0, marginTop: spacing2.lg }
10208
10275
  },
10209
- errors && /* @__PURE__ */ React19.createElement(ErrorBanner, { style: { marginBottom: spacing3.xl } }, /* @__PURE__ */ React19.createElement(Banner.Content, null, /* @__PURE__ */ React19.createElement(Banner.Title, null, I18n.t("savedViews.modal.errors.title", { mode })), /* @__PURE__ */ React19.createElement(Banner.Body, null, errors?.form || I18n.t(`savedViews.modal.errors.description.${mode}`)))),
10210
- /* @__PURE__ */ React19.createElement(Form.Row, null, /* @__PURE__ */ React19.createElement(
10211
- Form.Text,
10276
+ errors && /* @__PURE__ */ React20.createElement(ErrorBanner, { style: { marginBottom: spacing2.xl } }, /* @__PURE__ */ React20.createElement(Banner.Content, null, /* @__PURE__ */ React20.createElement(Banner.Title, null, I18n.t("savedViews.modal.errors.title", { mode })), /* @__PURE__ */ React20.createElement(Banner.Body, null, errors?.form || I18n.t(`savedViews.modal.errors.description.${mode}`)))),
10277
+ /* @__PURE__ */ React20.createElement(Form2.Row, null, /* @__PURE__ */ React20.createElement(
10278
+ NameInputField,
10212
10279
  {
10213
- name: "name",
10214
10280
  error: errors?.name,
10215
- placeholder: I18n.t("savedViews.modal.fields.name"),
10216
- label: I18n.t("savedViews.modal.fields.name"),
10217
- colWidth: 12,
10218
- onChange: () => resetMutations()
10281
+ onResetMutations: resetMutations
10219
10282
  }
10220
10283
  )),
10221
- /* @__PURE__ */ React19.createElement(
10222
- Form.Row,
10284
+ /* @__PURE__ */ React20.createElement(
10285
+ Form2.Row,
10223
10286
  {
10224
- style: { marginTop: errors?.name ? spacing3.xl : spacing3.none }
10287
+ style: { marginTop: errors?.name ? spacing2.xl : spacing2.none }
10225
10288
  },
10226
- /* @__PURE__ */ React19.createElement(
10227
- Form.TextArea,
10289
+ /* @__PURE__ */ React20.createElement(
10290
+ Form2.TextArea,
10228
10291
  {
10229
10292
  name: "description",
10230
10293
  placeholder: I18n.t("savedViews.modal.fields.description"),
@@ -10234,8 +10297,8 @@ var FormModalBase = ({
10234
10297
  }
10235
10298
  )
10236
10299
  ),
10237
- viewLevelOptions.length > 1 && mode === "create" /* CREATE */ ? /* @__PURE__ */ React19.createElement(Form.Row, null, /* @__PURE__ */ React19.createElement(
10238
- Form.Select,
10300
+ viewLevelOptions.length > 1 && mode === "create" /* CREATE */ ? /* @__PURE__ */ React20.createElement(Form2.Row, null, /* @__PURE__ */ React20.createElement(
10301
+ Form2.Select,
10239
10302
  {
10240
10303
  name: "view_level",
10241
10304
  qa: { label: "view-level" },
@@ -10245,9 +10308,9 @@ var FormModalBase = ({
10245
10308
  onSearch: false,
10246
10309
  onClear: false
10247
10310
  }
10248
- )) : /* @__PURE__ */ React19.createElement(React19.Fragment, null)
10249
- ), /* @__PURE__ */ React19.createElement(Modal2.Footer, { style: { borderTop: `1px solid ${colors3.gray85}` } }, /* @__PURE__ */ React19.createElement(Flex4, { grow: "1", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React19.createElement(Typography2, { color: "gray45", italic: true }, /* @__PURE__ */ React19.createElement(Typography2, { color: "red45" }, "*"), " ", I18n.t("savedViews.modal.info.required_fields")), /* @__PURE__ */ React19.createElement(Modal2.FooterButtons, null, /* @__PURE__ */ React19.createElement(Button4, { type: "reset", variant: "tertiary", disabled: isLoading }, I18n.t("savedViews.actions.cancel")), /* @__PURE__ */ React19.createElement(
10250
- Button4,
10311
+ )) : /* @__PURE__ */ React20.createElement(React20.Fragment, null)
10312
+ ), /* @__PURE__ */ React20.createElement(Modal2.Footer, { style: { borderTop: `1px solid ${colors3.gray85}` } }, /* @__PURE__ */ React20.createElement(Flex3, { grow: "1", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React20.createElement(Typography2, { color: "gray45", italic: true }, /* @__PURE__ */ React20.createElement(Typography2, { color: "red45" }, "*"), " ", I18n.t("savedViews.modal.info.required_fields")), /* @__PURE__ */ React20.createElement(Modal2.FooterButtons, null, /* @__PURE__ */ React20.createElement(Button5, { type: "reset", variant: "tertiary", disabled: isLoading }, I18n.t("savedViews.actions.cancel")), /* @__PURE__ */ React20.createElement(
10313
+ Button5,
10251
10314
  {
10252
10315
  "data-testid": "create-update-modal-button",
10253
10316
  type: "submit",
@@ -10262,7 +10325,7 @@ var FormModalBase = ({
10262
10325
  };
10263
10326
 
10264
10327
  // src/components/modals/form-modal/FormModal.tsx
10265
- import { useI18nContext as useI18nContext7 } from "@procore/core-react";
10328
+ import { useI18nContext as useI18nContext8 } from "@procore/core-react";
10266
10329
  var FormModal = ({
10267
10330
  open,
10268
10331
  mode,
@@ -10276,8 +10339,8 @@ var FormModal = ({
10276
10339
  defaultView,
10277
10340
  backend
10278
10341
  }) => {
10279
- const i18n = useI18nContext7();
10280
- return /* @__PURE__ */ React20.createElement(
10342
+ const i18n = useI18nContext8();
10343
+ return /* @__PURE__ */ React21.createElement(
10281
10344
  FormModalBase,
10282
10345
  {
10283
10346
  open,
@@ -10301,18 +10364,18 @@ var FormModal = ({
10301
10364
  // src/components/modals/form-modal/SharedViewFormModal.tsx
10302
10365
  import {
10303
10366
  Banner as Banner2,
10304
- Button as Button5,
10367
+ Button as Button6,
10305
10368
  colors as colors4,
10306
10369
  ErrorBanner as ErrorBanner2,
10307
- Flex as Flex5,
10308
- Form as Form2,
10370
+ Flex as Flex4,
10371
+ Form as Form3,
10309
10372
  Modal as Modal3,
10310
10373
  P as P3,
10311
- spacing as spacing4,
10374
+ spacing as spacing3,
10312
10375
  Typography as Typography3,
10313
- useI18nContext as useI18nContext8
10376
+ useI18nContext as useI18nContext9
10314
10377
  } from "@procore/core-react";
10315
- import * as React21 from "react";
10378
+ import * as React22 from "react";
10316
10379
  import * as yup2 from "yup";
10317
10380
  var SharedViewFormModal = ({
10318
10381
  open,
@@ -10324,7 +10387,7 @@ var SharedViewFormModal = ({
10324
10387
  isCreating,
10325
10388
  resetCreateError
10326
10389
  }) => {
10327
- const I18n = useI18nContext8();
10390
+ const I18n = useI18nContext9();
10328
10391
  const NAME_MAX_LENGTH = 150;
10329
10392
  const errors = extractMessage(createError, I18n);
10330
10393
  const handleNameChange = () => {
@@ -10335,35 +10398,36 @@ var SharedViewFormModal = ({
10335
10398
  const handleOnSubmit = (data) => {
10336
10399
  onCreateView(data.name, data.description);
10337
10400
  };
10338
- return /* @__PURE__ */ React21.createElement(
10401
+ return /* @__PURE__ */ React22.createElement(
10339
10402
  Modal3,
10340
10403
  {
10341
10404
  "data-testid": "shared-view-form-modal",
10342
10405
  open,
10343
- onClickOverlay: onClose,
10406
+ howToClose: ["x", "scrim"],
10407
+ onClose,
10344
10408
  style: { width: "540px" }
10345
10409
  },
10346
- /* @__PURE__ */ React21.createElement(
10410
+ /* @__PURE__ */ React22.createElement(
10347
10411
  Modal3.Header,
10348
10412
  {
10349
10413
  onClose,
10350
10414
  style: {
10351
- paddingTop: spacing4.lg,
10352
- paddingBottom: spacing4.xs,
10353
- paddingLeft: spacing4.xl,
10354
- paddingRight: spacing4.xl
10415
+ paddingTop: spacing3.lg,
10416
+ paddingBottom: spacing3.xs,
10417
+ paddingLeft: spacing3.xl,
10418
+ paddingRight: spacing3.xl
10355
10419
  }
10356
10420
  },
10357
- I18n.t("savedViews.modal.create.title")
10421
+ /* @__PURE__ */ React22.createElement(Modal3.Heading, null, I18n.t("savedViews.modal.create.title"))
10358
10422
  ),
10359
- /* @__PURE__ */ React21.createElement(
10423
+ /* @__PURE__ */ React22.createElement(
10360
10424
  P3,
10361
10425
  {
10362
10426
  style: {
10363
- paddingLeft: spacing4.xl,
10364
- paddingRight: spacing4.xl,
10365
- paddingBottom: spacing4.lg,
10366
- paddingTop: spacing4.none,
10427
+ paddingLeft: spacing3.xl,
10428
+ paddingRight: spacing3.xl,
10429
+ paddingBottom: spacing3.lg,
10430
+ paddingTop: spacing3.none,
10367
10431
  margin: 0,
10368
10432
  color: colors4.gray45,
10369
10433
  whiteSpace: "pre-line"
@@ -10371,8 +10435,8 @@ var SharedViewFormModal = ({
10371
10435
  },
10372
10436
  I18n.t("savedViews.modal.copyConfirmation.description")
10373
10437
  ),
10374
- /* @__PURE__ */ React21.createElement(
10375
- Form2,
10438
+ /* @__PURE__ */ React22.createElement(
10439
+ Form3,
10376
10440
  {
10377
10441
  initialValues: {
10378
10442
  name: fetchedView.name,
@@ -10390,36 +10454,32 @@ var SharedViewFormModal = ({
10390
10454
  onSubmit: handleOnSubmit,
10391
10455
  validateOnChange: true
10392
10456
  },
10393
- /* @__PURE__ */ React21.createElement(Form2.Form, { name: "share-view-form" }, /* @__PURE__ */ React21.createElement(
10457
+ /* @__PURE__ */ React22.createElement(Form3.Form, { name: "share-view-form" }, /* @__PURE__ */ React22.createElement(
10394
10458
  Modal3.Body,
10395
10459
  {
10396
10460
  style: {
10397
- paddingTop: spacing4.lg,
10461
+ paddingTop: spacing3.lg,
10398
10462
  paddingBottom: 0,
10399
10463
  borderTop: `1px solid ${colors4.gray85}`
10400
10464
  }
10401
10465
  },
10402
- errors && /* @__PURE__ */ React21.createElement(ErrorBanner2, { style: { marginBottom: spacing4.xl } }, /* @__PURE__ */ React21.createElement(Banner2.Content, null, /* @__PURE__ */ React21.createElement(Banner2.Title, null, I18n.t("savedViews.modal.errors.title", {
10466
+ errors && /* @__PURE__ */ React22.createElement(ErrorBanner2, { style: { marginBottom: spacing3.xl } }, /* @__PURE__ */ React22.createElement(Banner2.Content, null, /* @__PURE__ */ React22.createElement(Banner2.Title, null, I18n.t("savedViews.modal.errors.title", {
10403
10467
  mode: "create"
10404
- })), /* @__PURE__ */ React21.createElement(Banner2.Body, null, errors?.form || I18n.t("savedViews.modal.errors.description.create")))),
10405
- /* @__PURE__ */ React21.createElement(Form2.Row, null, /* @__PURE__ */ React21.createElement(
10406
- Form2.Text,
10468
+ })), /* @__PURE__ */ React22.createElement(Banner2.Body, null, errors?.form || I18n.t("savedViews.modal.errors.description.create")))),
10469
+ /* @__PURE__ */ React22.createElement(Form3.Row, null, /* @__PURE__ */ React22.createElement(
10470
+ NameInputField,
10407
10471
  {
10408
- name: "name",
10409
10472
  error: errors?.name,
10410
- placeholder: I18n.t("savedViews.modal.fields.name"),
10411
- label: I18n.t("savedViews.modal.fields.name"),
10412
- colWidth: 12,
10413
- onChange: handleNameChange
10473
+ onResetMutations: handleNameChange
10414
10474
  }
10415
10475
  )),
10416
- /* @__PURE__ */ React21.createElement(
10417
- Form2.Row,
10476
+ /* @__PURE__ */ React22.createElement(
10477
+ Form3.Row,
10418
10478
  {
10419
- style: { marginTop: errors?.name ? spacing4.xl : spacing4.none }
10479
+ style: { marginTop: errors?.name ? spacing3.xl : spacing3.none }
10420
10480
  },
10421
- /* @__PURE__ */ React21.createElement(
10422
- Form2.TextArea,
10481
+ /* @__PURE__ */ React22.createElement(
10482
+ Form3.TextArea,
10423
10483
  {
10424
10484
  name: "description",
10425
10485
  placeholder: I18n.t("savedViews.modal.fields.description"),
@@ -10429,8 +10489,8 @@ var SharedViewFormModal = ({
10429
10489
  }
10430
10490
  )
10431
10491
  )
10432
- ), /* @__PURE__ */ React21.createElement(Modal3.Footer, { style: { borderTop: `1px solid ${colors4.gray85}` } }, /* @__PURE__ */ React21.createElement(Flex5, { grow: "1", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React21.createElement(Typography3, { color: "gray45", italic: true }, /* @__PURE__ */ React21.createElement(Typography3, { color: "red45" }, "*"), " ", I18n.t("savedViews.modal.info.required_fields")), /* @__PURE__ */ React21.createElement(Modal3.FooterButtons, null, /* @__PURE__ */ React21.createElement(
10433
- Button5,
10492
+ ), /* @__PURE__ */ React22.createElement(Modal3.Footer, { style: { borderTop: `1px solid ${colors4.gray85}` } }, /* @__PURE__ */ React22.createElement(Flex4, { grow: "1", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React22.createElement(Typography3, { color: "gray45", italic: true }, /* @__PURE__ */ React22.createElement(Typography3, { color: "red45" }, "*"), " ", I18n.t("savedViews.modal.info.required_fields")), /* @__PURE__ */ React22.createElement(Modal3.FooterButtons, null, /* @__PURE__ */ React22.createElement(
10493
+ Button6,
10434
10494
  {
10435
10495
  variant: "secondary",
10436
10496
  onClick: onCreateTemporaryView,
@@ -10438,8 +10498,8 @@ var SharedViewFormModal = ({
10438
10498
  disabled: isCreating
10439
10499
  },
10440
10500
  I18n.t("savedViews.actions.viewTemporarily")
10441
- ), /* @__PURE__ */ React21.createElement(
10442
- Button5,
10501
+ ), /* @__PURE__ */ React22.createElement(
10502
+ Button6,
10443
10503
  {
10444
10504
  type: "submit",
10445
10505
  variant: "primary",
@@ -10454,9 +10514,9 @@ var SharedViewFormModal = ({
10454
10514
  };
10455
10515
 
10456
10516
  // src/utils/hooks/useViewSelection.ts
10457
- import { useState as useState3, useCallback as useCallback2, useEffect as useEffect3, useRef as useRef3, useMemo } from "react";
10517
+ import { useState as useState3, useCallback as useCallback2, useEffect as useEffect4, useRef as useRef3, useMemo } from "react";
10458
10518
  import { useSearchParams } from "react-router-dom";
10459
- import { useI18nContext as useI18nContext9 } from "@procore/core-react";
10519
+ import { useI18nContext as useI18nContext10 } from "@procore/core-react";
10460
10520
 
10461
10521
  // src/utils/viewStorage.ts
10462
10522
  var ViewStorage = {
@@ -10519,7 +10579,7 @@ var restoreUrlParameter = (currentParam, previousParam, setSearchParams) => {
10519
10579
  }
10520
10580
  };
10521
10581
  var useViewSelection = (config, savedViews, presetViews, openSharedViewModal) => {
10522
- const I18n = useI18nContext9();
10582
+ const I18n = useI18nContext10();
10523
10583
  const projectIdSegment = config.projectId ?? "company";
10524
10584
  const storageKey = `savedView_${config.domain}_${config.tableName}_${config.companyId}_${projectIdSegment}_${config.userId}`;
10525
10585
  const temporaryStorageKey = `${storageKey}-temporary`;
@@ -10595,7 +10655,7 @@ var useViewSelection = (config, savedViews, presetViews, openSharedViewModal) =>
10595
10655
  },
10596
10656
  [isViewAlreadySelected, openSharedViewModal, allViews, selectView]
10597
10657
  );
10598
- useEffect3(() => {
10658
+ useEffect4(() => {
10599
10659
  const savedViewId = searchParams.get("saved-view");
10600
10660
  restoreUrlParameter(
10601
10661
  savedViewId,
@@ -10626,7 +10686,7 @@ import { useQuery } from "@tanstack/react-query";
10626
10686
  // src/utils/api/queriesHandler.ts
10627
10687
  import { requestJSON } from "@procore/core-http";
10628
10688
  import { useMutation, useQueryClient } from "@tanstack/react-query";
10629
- import { useI18nContext as useI18nContext10 } from "@procore/core-react";
10689
+ import { useI18nContext as useI18nContext11 } from "@procore/core-react";
10630
10690
  var getBasePath = (companyId, projectId) => {
10631
10691
  if (projectId) {
10632
10692
  return `/rest/v2.0/companies/${companyId}/projects/${projectId}/saved_views`;
@@ -10636,7 +10696,7 @@ var getBasePath = (companyId, projectId) => {
10636
10696
  var useApiRequest = (props, method, mutationKey) => {
10637
10697
  const { projectId, companyId, domain, tableName } = props;
10638
10698
  const queryClient2 = useQueryClient();
10639
- const { locale } = useI18nContext10();
10699
+ const { locale } = useI18nContext11();
10640
10700
  const basePath = getBasePath(companyId, projectId);
10641
10701
  const queryKey = ["savedViews", domain, tableName, companyId, projectId];
10642
10702
  return useMutation({
@@ -10783,7 +10843,7 @@ var SavedViewsContent = (props) => {
10783
10843
  const { data: savedViews } = backend.useSavedViewsQuery(queryInput);
10784
10844
  const { mutate: deleteSavedView } = backend.useDeleteSavedView(queryInput);
10785
10845
  const { showToast } = useToastAlertContext3();
10786
- const i18n = useI18nContext11();
10846
+ const i18n = useI18nContext12();
10787
10847
  const [activeModal, setActiveModal] = useState4(null);
10788
10848
  const [modalData, setModalData] = useState4(null);
10789
10849
  const openModal = (type, data) => {
@@ -10829,7 +10889,7 @@ var SavedViewsContent = (props) => {
10829
10889
  error: createError,
10830
10890
  reset: resetCreateError
10831
10891
  } = backend.useCreateSavedView(queryInput);
10832
- useEffect4(() => {
10892
+ useEffect5(() => {
10833
10893
  if (fetchError) {
10834
10894
  showToast.error(i18n.t("savedViews.errors.notFound"));
10835
10895
  selectView(selectedView ?? props.defaultView);
@@ -10877,31 +10937,45 @@ var SavedViewsContent = (props) => {
10877
10937
  deleteSelectedView();
10878
10938
  closeModal();
10879
10939
  };
10880
- return /* @__PURE__ */ React22.createElement(StyledPanel, { provider: props.provider }, /* @__PURE__ */ React22.createElement(
10940
+ return /* @__PURE__ */ React23.createElement(StyledPanel, { provider: props.provider }, /* @__PURE__ */ React23.createElement(
10881
10941
  ExpandedPanel,
10882
10942
  {
10883
10943
  "data-testid": "saved-view-expanded-panel",
10884
10944
  provider: props.provider
10885
10945
  },
10886
- /* @__PURE__ */ React22.createElement(Panel3.Header, { id: "saved-views-collections-panel-header" }, /* @__PURE__ */ React22.createElement(Panel3.Title, null, /* @__PURE__ */ React22.createElement(Flex6, { alignItems: "center" }, /* @__PURE__ */ React22.createElement(Box2, { paddingRight: "sm" }, i18n.t("savedViews.title")), /* @__PURE__ */ React22.createElement(Tooltip, { showDelay: 200, overlay: i18n.t("savedViews.tooltip") }, /* @__PURE__ */ React22.createElement(Help_default, { size: "sm" })))), /* @__PURE__ */ React22.createElement(
10946
+ /* @__PURE__ */ React23.createElement(Panel3.Header, { id: "saved-views-collections-panel-header" }, /* @__PURE__ */ React23.createElement(Panel3.Title, null, /* @__PURE__ */ React23.createElement(Flex5, { alignItems: "center" }, /* @__PURE__ */ React23.createElement(Box3, { paddingRight: "sm" }, i18n.t("savedViews.title")), /* @__PURE__ */ React23.createElement(
10947
+ Tooltip,
10948
+ {
10949
+ showDelay: 200,
10950
+ overlay: /* @__PURE__ */ React23.createElement(Tooltip.Content, null, i18n.t("savedViews.tooltip"))
10951
+ },
10952
+ /* @__PURE__ */ React23.createElement(
10953
+ Help_default,
10954
+ {
10955
+ tabIndex: 0,
10956
+ size: "sm",
10957
+ "aria-label": i18n.t("savedViews.tooltip")
10958
+ }
10959
+ )
10960
+ ))), /* @__PURE__ */ React23.createElement(
10887
10961
  Tooltip,
10888
10962
  {
10889
10963
  overlay: i18n.t("savedViews.actions.create"),
10890
10964
  showDelay: 1e3
10891
10965
  },
10892
- /* @__PURE__ */ React22.createElement("span", null, /* @__PURE__ */ React22.createElement(
10893
- Button6,
10966
+ /* @__PURE__ */ React23.createElement(
10967
+ Button7,
10894
10968
  {
10895
- icon: /* @__PURE__ */ React22.createElement(Plus_default, null),
10969
+ icon: /* @__PURE__ */ React23.createElement(Plus_default, null),
10896
10970
  variant: "secondary",
10897
10971
  "data-testid": "expanded-panel-create-button",
10898
10972
  onClick: () => openModal("create" /* CREATE */),
10899
10973
  "aria-label": i18n.t("savedViews.actions.create")
10900
10974
  },
10901
10975
  i18n.t("savedViews.actions.create")
10902
- ))
10976
+ )
10903
10977
  )),
10904
- /* @__PURE__ */ React22.createElement(Panel3.Body, { style: { display: "flex", flexFlow: "column" } }, /* @__PURE__ */ React22.createElement(
10978
+ /* @__PURE__ */ React23.createElement(Panel3.Body, { style: { display: "flex", flexFlow: "column" } }, /* @__PURE__ */ React23.createElement(
10905
10979
  PanelContent,
10906
10980
  {
10907
10981
  onSelect: ({ item }) => selectView(item),
@@ -10914,12 +10988,13 @@ var SavedViewsContent = (props) => {
10914
10988
  presetViews: props.presetViews,
10915
10989
  savedViews: allViews,
10916
10990
  provider: props.provider,
10917
- userId: props.userId.toString(),
10991
+ userId: props.userId,
10918
10992
  onClearTemporary: clearTemporaryView,
10919
- backend
10993
+ backend,
10994
+ enableSharingViews: props.enableSharingViews
10920
10995
  }
10921
10996
  ))
10922
- ), (isModalOpen("create" /* CREATE */) || isModalOpen("update" /* UPDATE */)) && /* @__PURE__ */ React22.createElement(
10997
+ ), (isModalOpen("create" /* CREATE */) || isModalOpen("update" /* UPDATE */)) && /* @__PURE__ */ React23.createElement(
10923
10998
  FormModal,
10924
10999
  {
10925
11000
  open: true,
@@ -10934,14 +11009,14 @@ var SavedViewsContent = (props) => {
10934
11009
  defaultView: props.defaultView,
10935
11010
  backend
10936
11011
  }
10937
- ), selectedView && isModalOpen("delete" /* DELETE */) && /* @__PURE__ */ React22.createElement(
11012
+ ), selectedView && isModalOpen("delete" /* DELETE */) && /* @__PURE__ */ React23.createElement(
10938
11013
  SavedViewsDeleteConfirmationModalShared,
10939
11014
  {
10940
11015
  open: true,
10941
11016
  onDelete: confirmDeleteAndCloseModal,
10942
11017
  onCancel: closeModal
10943
11018
  }
10944
- ), fetchedView && isModalOpen("sharedView" /* SHARED_VIEW */) && /* @__PURE__ */ React22.createElement(
11019
+ ), fetchedView && isModalOpen("sharedView" /* SHARED_VIEW */) && /* @__PURE__ */ React23.createElement(
10945
11020
  SharedViewFormModal,
10946
11021
  {
10947
11022
  open: true,
@@ -10956,11 +11031,11 @@ var SavedViewsContent = (props) => {
10956
11031
  ));
10957
11032
  };
10958
11033
  var SavedViews = (props) => {
10959
- return /* @__PURE__ */ React22.createElement(EnvironmentI18nProvider, null, /* @__PURE__ */ React22.createElement(QueryClientProvider, { client: queryClient }, /* @__PURE__ */ React22.createElement(ToastAlertProvider, null, /* @__PURE__ */ React22.createElement(SavedViewsContent, { ...props }))));
11034
+ return /* @__PURE__ */ React23.createElement(EnvironmentI18nProvider, null, /* @__PURE__ */ React23.createElement(QueryClientProvider, { client: queryClient }, /* @__PURE__ */ React23.createElement(ToastAlertProvider, null, /* @__PURE__ */ React23.createElement(SavedViewsContent, { ...props }))));
10960
11035
  };
10961
11036
 
10962
11037
  // src/components/adapters/smart-grid/SmartGridSavedViews.tsx
10963
- import React23, { useCallback as useCallback4 } from "react";
11038
+ import React24, { useCallback as useCallback4 } from "react";
10964
11039
 
10965
11040
  // src/components/adapters/smart-grid/SmartGridDefaultSavedView.tsx
10966
11041
  import { useMemo as useMemo2 } from "react";
@@ -11034,7 +11109,7 @@ var useNormalizedDefaultViews = (defaultViews, gridApi) => {
11034
11109
  };
11035
11110
 
11036
11111
  // src/components/adapters/smart-grid/useSmartGridConfig.ts
11037
- import { useState as useState5, useEffect as useEffect5, useRef as useRef4 } from "react";
11112
+ import { useState as useState5, useEffect as useEffect6, useRef as useRef4 } from "react";
11038
11113
  var GRID_STATE_EVENTS = [
11039
11114
  "sortChanged",
11040
11115
  "filterOpened",
@@ -11054,7 +11129,7 @@ var useSmartGridConfig = (gridApi) => {
11054
11129
  () => getSmartGridConfig(gridApi)
11055
11130
  );
11056
11131
  const eventListenersDisabledRef = useRef4(false);
11057
- useEffect5(() => {
11132
+ useEffect6(() => {
11058
11133
  if (!gridApi)
11059
11134
  return;
11060
11135
  const updateConfig = () => {
@@ -11124,7 +11199,7 @@ var SmartGridSavedViews = (props) => {
11124
11199
  },
11125
11200
  [gridApi, tableConfig, setTableConfig]
11126
11201
  );
11127
- return /* @__PURE__ */ React23.createElement(
11202
+ return /* @__PURE__ */ React24.createElement(
11128
11203
  SavedViews,
11129
11204
  {
11130
11205
  onSelect,
@@ -11137,13 +11212,14 @@ var SmartGridSavedViews = (props) => {
11137
11212
  presetViews,
11138
11213
  tableName: props.tableName,
11139
11214
  tableConfig,
11140
- backend: props.backend
11215
+ backend: props.backend,
11216
+ enableSharingViews: props.enableSharingViews
11141
11217
  }
11142
11218
  );
11143
11219
  };
11144
11220
 
11145
11221
  // src/components/adapters/data-table/DataTableSavedViews.tsx
11146
- import React24, {
11222
+ import React25, {
11147
11223
  forwardRef as forwardRef11,
11148
11224
  useImperativeHandle,
11149
11225
  useState as useState6,
@@ -11243,7 +11319,7 @@ var DataTableSavedViews = forwardRef11((props, ref) => {
11243
11319
  if (!internalTableConfig) {
11244
11320
  return null;
11245
11321
  }
11246
- return /* @__PURE__ */ React24.createElement(
11322
+ return /* @__PURE__ */ React25.createElement(
11247
11323
  SavedViews,
11248
11324
  {
11249
11325
  onSelect,
@@ -11255,7 +11331,8 @@ var DataTableSavedViews = forwardRef11((props, ref) => {
11255
11331
  defaultView,
11256
11332
  presetViews,
11257
11333
  tableName: props.tableName,
11258
- tableConfig: internalTableConfig
11334
+ tableConfig: internalTableConfig,
11335
+ enableSharingViews: props.enableSharingViews
11259
11336
  }
11260
11337
  );
11261
11338
  });