@uniformdev/mesh-sdk-react 20.6.2-alpha.11 → 20.7.1-alpha.102

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.js CHANGED
@@ -920,7 +920,7 @@ var import_zod = require("@hookform/resolvers/zod");
920
920
  var import_design_system4 = require("@uniformdev/design-system");
921
921
  var import_react12 = require("react");
922
922
  var import_react_hook_form = require("react-hook-form");
923
- var import_zod2 = require("zod");
923
+ var z = __toESM(require("zod"));
924
924
 
925
925
  // src/components/Variables/styles/VariableEditor.styles.ts
926
926
  var import_react11 = require("@emotion/react");
@@ -932,13 +932,13 @@ var variablesFormContainer = import_react11.css`
932
932
 
933
933
  // src/components/Variables/VariableEditor.tsx
934
934
  var import_jsx_runtime18 = require("@emotion/react/jsx-runtime");
935
- var schema = import_zod2.z.object({
936
- name: import_zod2.z.string().nonempty("Name can't be empty").regex(/^[^${}]+$/, "$, {, and } are reserved characters and cannot be used in a variable name"),
937
- default: import_zod2.z.string(),
938
- displayName: import_zod2.z.string().optional(),
939
- helpText: import_zod2.z.string().optional(),
940
- order: import_zod2.z.number().optional(),
941
- type: import_zod2.z.string().optional()
935
+ var schema = z.object({
936
+ name: z.string().nonempty("Name can't be empty").regex(/^[^${}]+$/, "$, {, and } are reserved characters and cannot be used in a variable name"),
937
+ default: z.string(),
938
+ displayName: z.string().optional(),
939
+ helpText: z.string().optional(),
940
+ order: z.number().optional(),
941
+ type: z.string().optional()
942
942
  });
943
943
  function VariableEditor({
944
944
  variable,
@@ -1390,7 +1390,8 @@ function VariablesPlugin({
1390
1390
  enableEditingVariables,
1391
1391
  getEditorContext,
1392
1392
  replaceValueOnVariableInsert,
1393
- filterVariable
1393
+ filterVariable,
1394
+ disableVariableDisplayNames
1394
1395
  }) {
1395
1396
  const [editor] = (0, import_LexicalComposerContext2.useLexicalComposerContext)();
1396
1397
  const { variables, dispatch, isEditing, canDispatch, readOnly, knownUndefinedValues, isLoading } = useVariables(true);
@@ -1468,9 +1469,10 @@ function VariablesPlugin({
1468
1469
  });
1469
1470
  return;
1470
1471
  }
1472
+ const initialDisplayName = disableVariableDisplayNames ? prettifyBindExpression(result.selectedVariable.name) : result.selectedVariable.displayName;
1471
1473
  editor.dispatchCommand(INSERT_VARIABLE_COMMAND, {
1472
1474
  variable: result.selectedVariable.name,
1473
- initialDisplayName: result.selectedVariable.displayName,
1475
+ initialDisplayName,
1474
1476
  targetKey: sourceKey,
1475
1477
  overwriteExistingValue: replaceValueOnVariableInsert
1476
1478
  });
@@ -1518,9 +1520,10 @@ function VariablesPlugin({
1518
1520
  if (result.canceled) {
1519
1521
  return;
1520
1522
  }
1523
+ const initialDisplayName = disableVariableDisplayNames ? prettifyBindExpression(result.selectedVariable.name) : result.selectedVariable.displayName;
1521
1524
  editor.dispatchCommand(INSERT_VARIABLE_COMMAND, {
1522
1525
  variable: result.selectedVariable.name,
1523
- initialDisplayName: result.selectedVariable.displayName,
1526
+ initialDisplayName,
1524
1527
  targetKey: void 0,
1525
1528
  overwriteExistingValue: replaceValueOnVariableInsert
1526
1529
  });
@@ -1539,8 +1542,9 @@ function VariablesPlugin({
1539
1542
  var _a, _b;
1540
1543
  if (!disableVariables) {
1541
1544
  const targetVariable = variablesRef.current.variables[reference];
1545
+ const displayName = disableVariableDisplayNames ? prettifyBindExpression(reference) : initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || prettifyBindExpression(reference);
1542
1546
  const variableNode = $createVariableNode(reference, {
1543
- displayName: initialDisplayName != null ? initialDisplayName : (targetVariable == null ? void 0 : targetVariable.displayName) || prettifyBindExpression(reference),
1547
+ displayName,
1544
1548
  hasClickEvent: canEditVariable(reference, targetVariable),
1545
1549
  referenceIsValid: true,
1546
1550
  tooltip: (_a = targetVariable == null ? void 0 : targetVariable.tooltip) != null ? _a : targetVariable == null ? void 0 : targetVariable.helpText,
@@ -1577,7 +1581,8 @@ function VariablesPlugin({
1577
1581
  readOnly,
1578
1582
  getEditorContext,
1579
1583
  editVariable,
1580
- replaceValueOnVariableInsert
1584
+ replaceValueOnVariableInsert,
1585
+ disableVariableDisplayNames
1581
1586
  ]);
1582
1587
  const updateExistingNodeIfChanged = (0, import_react15.useCallback)(
1583
1588
  (variableNode) => {
@@ -1590,9 +1595,10 @@ function VariablesPlugin({
1590
1595
  return;
1591
1596
  }
1592
1597
  const tooltip = (_d = (_c = (_b = (_a = targetVar == null ? void 0 : targetVar.tooltip) != null ? _a : targetVar == null ? void 0 : targetVar.helpText) != null ? _b : targetUndefinedVar == null ? void 0 : targetUndefinedVar.error) != null ? _c : targetUndefinedVar == null ? void 0 : targetUndefinedVar.warning) != null ? _d : targetUndefinedVar == null ? void 0 : targetUndefinedVar.info;
1598
+ const displayName = disableVariableDisplayNames ? prettifyBindExpression(variableNode.reference) : (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || prettifyBindExpression(variableNode.reference);
1593
1599
  const newState = {
1594
1600
  ...currentState,
1595
- displayName: (targetVar == null ? void 0 : targetVar.displayName) || (targetUndefinedVar == null ? void 0 : targetUndefinedVar.displayName) || prettifyBindExpression(variableNode.reference),
1601
+ displayName,
1596
1602
  isLoading: isLoadingVariables && !targetVar && !(targetUndefinedVar == null ? void 0 : targetUndefinedVar.info),
1597
1603
  hasClickEvent: canEditVariable(variableNode.reference, targetVar),
1598
1604
  referenceIsValid: (targetUndefinedVar == null ? void 0 : targetUndefinedVar.error) ? false : (targetUndefinedVar == null ? void 0 : targetUndefinedVar.warning) ? "warning" : (targetUndefinedVar == null ? void 0 : targetUndefinedVar.info) ? "info" : isLoadingVariables ? true : Boolean(targetVar),
@@ -1603,7 +1609,7 @@ function VariablesPlugin({
1603
1609
  variableNode.setState(newState);
1604
1610
  }
1605
1611
  },
1606
- [canEditVariable]
1612
+ [canEditVariable, disableVariableDisplayNames]
1607
1613
  );
1608
1614
  (0, import_react15.useEffect)(() => {
1609
1615
  let selection;
@@ -1612,6 +1618,7 @@ function VariablesPlugin({
1612
1618
  });
1613
1619
  editor.update(() => {
1614
1620
  var _a;
1621
+ (0, import_lexical4.$addUpdateTag)("skip-dom-selection");
1615
1622
  (0, import_lexical4.$setSelection)((_a = selection == null ? void 0 : selection.clone()) != null ? _a : null);
1616
1623
  (0, import_utils.$dfs)().filter(({ node }) => $isVariableNode(node)).forEach(({ node: variableNode }) => {
1617
1624
  updateExistingNodeIfChanged(variableNode);
@@ -1761,6 +1768,14 @@ var VariableNode = class _VariableNode extends import_lexical5.DecoratorNode {
1761
1768
  updateDOM() {
1762
1769
  return false;
1763
1770
  }
1771
+ static importDOM() {
1772
+ return {
1773
+ binding: () => ({
1774
+ conversion: $convertBindingElement,
1775
+ priority: 0
1776
+ })
1777
+ };
1778
+ }
1764
1779
  /**
1765
1780
  * Render the variable node using React.
1766
1781
  * NOTE: this is effectively an island of React, and you may not call hooks,
@@ -1770,6 +1785,21 @@ var VariableNode = class _VariableNode extends import_lexical5.DecoratorNode {
1770
1785
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VariableNodeComponent, { state: this.__state, reference: this.reference, nodeKey: this.__key });
1771
1786
  }
1772
1787
  };
1788
+ function $convertBindingElement(domNode) {
1789
+ const element = domNode;
1790
+ const reference = element.textContent.replace(variablePrefix, "").replace(variableSuffix, "");
1791
+ const node = $createVariableNode(reference, {
1792
+ displayName: prettifyBindExpression(reference),
1793
+ hasClickEvent: true,
1794
+ referenceIsValid: true,
1795
+ tooltip: void 0,
1796
+ isFresh: true,
1797
+ isLoading: false
1798
+ });
1799
+ return {
1800
+ node
1801
+ };
1802
+ }
1773
1803
  function $createVariableNode(variableReference, state) {
1774
1804
  return new VariableNode(variableReference, state);
1775
1805
  }
@@ -1947,7 +1977,7 @@ var menuBtn2 = import_react18.css`
1947
1977
  transform: translateY(-50%);
1948
1978
  `;
1949
1979
  var input = import_react18.css`
1950
- --input-padding: 12px var(--spacing-base) 12px var(--spacing-sm);
1980
+ --input-padding: 12px var(--spacing-lg) 12px var(--spacing-sm);
1951
1981
  appearance: none;
1952
1982
  background-color: var(--white);
1953
1983
  border: 1px solid var(--gray-300);
@@ -2084,6 +2114,7 @@ var input2 = import_react19.css`
2084
2114
  &:disabled,
2085
2115
  &:disabled::placeholder,
2086
2116
  &:disabled:hover {
2117
+ border-color: var(--gray-200);
2087
2118
  border-radius: var(--rounded-sm);
2088
2119
  cursor: not-allowed;
2089
2120
  color: var(--gray-400);
@@ -2093,6 +2124,7 @@ var input2 = import_react19.css`
2093
2124
  &[contenteditable='false'] {
2094
2125
  cursor: not-allowed;
2095
2126
  color: var(--gray-400);
2127
+ border-color: var(--gray-200);
2096
2128
  }
2097
2129
 
2098
2130
  > p {
@@ -2472,7 +2504,7 @@ function VariablesComposerInput({
2472
2504
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2473
2505
  import_LexicalPlainTextPlugin.PlainTextPlugin,
2474
2506
  {
2475
- contentEditable: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_LexicalContentEditable.ContentEditable, { ...contentEditableProps }),
2507
+ contentEditable: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_LexicalContentEditable.ContentEditable, { ...contentEditableProps, placeholder: null, "aria-placeholder": void 0 }),
2476
2508
  placeholder: placeholder ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: placeholder }) : null,
2477
2509
  ErrorBoundary: import_LexicalErrorBoundary.default
2478
2510
  }
@@ -2587,7 +2619,8 @@ function InputVariables(props) {
2587
2619
  styleVariant = "default",
2588
2620
  renderMenuInPortal,
2589
2621
  disableDismissEditorOnChange,
2590
- singleTokenMode
2622
+ singleTokenMode,
2623
+ disableVariableDisplayNames
2591
2624
  } = props;
2592
2625
  const [finalId] = (0, import_react28.useState)(id != null ? id : () => (0, import_uuid.v4)());
2593
2626
  const { dispatch, canDispatch, isEditing } = useVariables(true);
@@ -2610,7 +2643,7 @@ function InputVariables(props) {
2610
2643
  gap: "xs",
2611
2644
  css: import_react27.css`
2612
2645
  position: relative;
2613
- & > div:first-child {
2646
+ & > div:first-of-type {
2614
2647
  flex-grow: 1;
2615
2648
  }
2616
2649
  `,
@@ -2696,6 +2729,7 @@ function InputVariables(props) {
2696
2729
  replaceValueOnVariableInsert: useInputWithNoVariables,
2697
2730
  autoFocus,
2698
2731
  filterVariable,
2732
+ disableVariableDisplayNames,
2699
2733
  children: [
2700
2734
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PasteTransformerPlugin, { transformPaste }),
2701
2735
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ControlledValuePlugin, { value, enabled: singleTokenMode || useInputWithNoVariables }),
@@ -3064,6 +3098,8 @@ var variableValue = import_react34.css`
3064
3098
 
3065
3099
  // src/components/Variables/VariablesList.tsx
3066
3100
  var import_jsx_runtime32 = require("@emotion/react/jsx-runtime");
3101
+ var DroppableHack = import_react_beautiful_dnd2.Droppable;
3102
+ var DraggableHack = import_react_beautiful_dnd2.Draggable;
3067
3103
  function VariablesList() {
3068
3104
  const { variables, dispatch, readOnly } = useVariables();
3069
3105
  const sorted = variablesToList(variables).filter((variable) => !variable.system);
@@ -3085,7 +3121,7 @@ function VariablesList() {
3085
3121
  }
3086
3122
  };
3087
3123
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
3088
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_beautiful_dnd2.Droppable, { droppableId: "variables-table", children: (provided) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_design_system13.Table, { ...provided.droppableProps, ref: provided.innerRef, children: [
3124
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DroppableHack, { droppableId: "variables-table", children: (provided) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_design_system13.Table, { ...provided.droppableProps, ref: provided.innerRef, children: [
3089
3125
  /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_design_system13.TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_design_system13.TableRow, { children: [
3090
3126
  /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_design_system13.TableCellHead, { children: "Name" }),
3091
3127
  /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_design_system13.TableCellHead, { children: "Default Value" }),
@@ -3096,7 +3132,7 @@ function VariablesList() {
3096
3132
  const text = displayName != null ? displayName : name2;
3097
3133
  const textValue = variableDefaultTextValue(defaultValue);
3098
3134
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
3099
- import_react_beautiful_dnd2.Draggable,
3135
+ DraggableHack,
3100
3136
  {
3101
3137
  draggableId: name2,
3102
3138
  index,
@@ -3691,8 +3727,8 @@ function urlEncodeRequestParameter(parameter, varValues) {
3691
3727
  value: decodeVariablesInUrlEncodedString(encodeURIComponent(parameter.value), varValues)
3692
3728
  };
3693
3729
  }
3694
- function decodeVariablesInUrlEncodedString(string, varValues) {
3695
- return string.replace(/(\$|%24)%7B(.*?)%7D/g, (_all, _money, body) => {
3730
+ function decodeVariablesInUrlEncodedString(string2, varValues) {
3731
+ return string2.replace(/(\$|%24)%7B(.*?)%7D/g, (_all, _money, body) => {
3696
3732
  var _a;
3697
3733
  const varName = decodeURIComponent(body);
3698
3734
  return ((_a = varValues == null ? void 0 : varValues[varName]) == null ? void 0 : _a.default) ? variableDefaultTextValue(varValues[varName].default) : `\${${varName}}`;
@@ -4025,7 +4061,7 @@ var DataRefreshButton = ({
4025
4061
  onRefreshData,
4026
4062
  ...props
4027
4063
  }) => {
4028
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_design_system20.Button, { buttonType: "primaryInvert", onClick: onRefreshData, disabled: isLoading, ...props, children: [
4064
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_design_system20.Button, { buttonType: "ghost", onClick: onRefreshData, disabled: isLoading, ...props, children: [
4029
4065
  !isLoading ? null : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
4030
4066
  import_design_system20.LoadingIndicator,
4031
4067
  {
@@ -4292,7 +4328,7 @@ var ObjectSearchListItem = ({
4292
4328
  ),
4293
4329
  /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { css: ObjectListItemInfoContainer, children: [
4294
4330
  selected ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system22.Chip, { text: "selected", size: "xs" }) : null,
4295
- !popoverData ? null : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system22.Popover, { ariaLabel: title, buttonText: `See ${title} details`, iconColor: "default", children: popoverData })
4331
+ !popoverData ? null : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system22.Popover, { ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
4296
4332
  ] }),
4297
4333
  !children ? null : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { css: ObjectListItemUnControlledContent, children })
4298
4334
  ]
@@ -4322,7 +4358,6 @@ var ObjectSearchContainer = ({
4322
4358
  role: "list",
4323
4359
  css: import_react45.css`
4324
4360
  > div {
4325
- transition: max-height var(--duration-slow) var(--timing-ease-out);
4326
4361
  max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
4327
4362
  }
4328
4363
  `,
@@ -4600,6 +4635,11 @@ var ObjectSearchResultItemTimeStamp = import_react49.css`
4600
4635
  color: var(--gray-500);
4601
4636
  font-size: var(--fs-xs);
4602
4637
  `;
4638
+ var ObjectSearchResultItemTitleLink = import_react49.css`
4639
+ text-decoration: none;
4640
+ color: var(--primary-action-default);
4641
+ font-size: var(--fs-sm);
4642
+ `;
4603
4643
  var ObjectSearchAuthorStateGroup = import_react49.css`
4604
4644
  align-items: center;
4605
4645
  display: flex;
@@ -4634,7 +4674,8 @@ var ObjectSearchResultItem = ({
4634
4674
  publishedAt,
4635
4675
  hideRemoveButton = false,
4636
4676
  disableDnD = false,
4637
- children
4677
+ children,
4678
+ onClick
4638
4679
  }) => {
4639
4680
  const { onSelectItem } = useObjectSearchContext();
4640
4681
  const formatedContentType = Array.isArray(contentType) ? contentType.join(", ") : contentType;
@@ -4657,7 +4698,19 @@ var ObjectSearchResultItem = ({
4657
4698
  /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { children: [
4658
4699
  /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { css: ObjectSearchResultItemSubtitle, "data-testid": "sub-title", children: formatedContentType }),
4659
4700
  /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { role: "heading", css: ObjectSearchResultItemTitle, "data-testid": "title", children: [
4660
- title != null ? title : name,
4701
+ onClick ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
4702
+ import_design_system26.Link,
4703
+ {
4704
+ onClick: (e) => {
4705
+ e.preventDefault();
4706
+ e.stopPropagation();
4707
+ onClick();
4708
+ },
4709
+ href: editLink,
4710
+ text: title != null ? title : name,
4711
+ css: ObjectSearchResultItemTitleLink
4712
+ }
4713
+ ) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { children: title != null ? title : name }),
4661
4714
  !popoverData ? null : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system26.Popover, { ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
4662
4715
  ] }),
4663
4716
  !createdAt && !publishStatus ? null : /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { css: ObjectSearchAuthorStateGroup, children: [
@@ -4728,6 +4781,8 @@ var ObjectSearchResultListTitle = import_react50.css`
4728
4781
 
4729
4782
  // src/components/ObjectSearch/ObjectSearchResultList.tsx
4730
4783
  var import_jsx_runtime55 = require("@emotion/react/jsx-runtime");
4784
+ var DroppableHack2 = import_react_beautiful_dnd3.Droppable;
4785
+ var DraggableHack2 = import_react_beautiful_dnd3.Draggable;
4731
4786
  function ObjectSearchResultList({
4732
4787
  resultLabelText = "Selected",
4733
4788
  removeButtonText = "Remove all",
@@ -4799,7 +4854,7 @@ function ObjectSearchResultList({
4799
4854
  ] })
4800
4855
  ] }),
4801
4856
  !selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
4802
- import_react_beautiful_dnd3.Droppable,
4857
+ DroppableHack2,
4803
4858
  {
4804
4859
  droppableId: multiSelectId != null ? multiSelectId : "canvas-multi-select",
4805
4860
  renderClone: getContainerForDnDReparenting ? getDraggableItem : void 0,
@@ -4807,7 +4862,7 @@ function ObjectSearchResultList({
4807
4862
  children: (provided) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
4808
4863
  selectedListItems.map((item, i) => {
4809
4864
  return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
4810
- import_react_beautiful_dnd3.Draggable,
4865
+ DraggableHack2,
4811
4866
  {
4812
4867
  draggableId: item.id,
4813
4868
  index: i,
@@ -5257,18 +5312,6 @@ var DATE_TIME_OPERATORS = [
5257
5312
  value: "sys-date-gte",
5258
5313
  editorType: "date",
5259
5314
  expectedValueType: "single"
5260
- },
5261
- {
5262
- label: "is empty",
5263
- value: "ndef",
5264
- editorType: "empty",
5265
- expectedValueType: "false"
5266
- },
5267
- {
5268
- label: "is not empty",
5269
- value: "def",
5270
- editorType: "empty",
5271
- expectedValueType: "true"
5272
5315
  }
5273
5316
  ];
5274
5317
  var RICHTEXT_OPERATORS = [
@@ -6286,8 +6329,6 @@ var SearchAndFilterOptionsContainer = import_react63.css`
6286
6329
  gap: var(--spacing-sm);
6287
6330
  padding: var(--spacing-md) 0 var(--spacing-base);
6288
6331
  will-change: height;
6289
- position: relative;
6290
- z-index: 2;
6291
6332
  `;
6292
6333
  var SearchAndFilterOptionsInnerContainer = import_react63.css`
6293
6334
  display: flex;
@@ -6306,8 +6347,6 @@ var SearchAndFilterAdditionalContainer = import_react63.css`
6306
6347
  flex-wrap: nowrap;
6307
6348
  gap: var(--spacing-base);
6308
6349
  padding: var(--spacing-base) var(--spacing-md) 0;
6309
- position: relative;
6310
- z-index: 0;
6311
6350
  `;
6312
6351
 
6313
6352
  // src/components/SearchAndFilter/FilterButton.tsx
@@ -6386,6 +6425,7 @@ function withInputVariables(WrappedComponent, noSwapping = false) {
6386
6425
  return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
6387
6426
  InputVariables,
6388
6427
  {
6428
+ "data-testid": "filter-value",
6389
6429
  disableInlineMenu: true,
6390
6430
  showMenuPosition: "inline-right",
6391
6431
  onChange: (newValue) => props.onChange(newValue != null ? newValue : ""),
@@ -6406,6 +6446,7 @@ function withInputVariablesForMultiValue(WrappedComponent) {
6406
6446
  return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
6407
6447
  InputVariables,
6408
6448
  {
6449
+ "data-testid": "filter-value",
6409
6450
  disableInlineMenu: true,
6410
6451
  showMenuPosition: "inline-right",
6411
6452
  onChange: (newValue) => props.onChange(newValue ? [newValue] : []),
@@ -6458,6 +6499,7 @@ var SearchAndFilterProvider = ({
6458
6499
  onSearchChange,
6459
6500
  onChange,
6460
6501
  resetFilterValues = [{ field: "", operator: "", value: "" }],
6502
+ onResetFilterValues,
6461
6503
  totalResults,
6462
6504
  filterMapper: filterMapper2 = filterMapper,
6463
6505
  children,
@@ -6486,9 +6528,12 @@ var SearchAndFilterProvider = ({
6486
6528
  onChange([...filters, { field: "", operator: "", value: "" }]);
6487
6529
  }, [filters, onChange]);
6488
6530
  const handleResetFilters = (0, import_react64.useCallback)(() => {
6531
+ if (onResetFilterValues) {
6532
+ return onResetFilterValues();
6533
+ }
6489
6534
  onSearchChange == null ? void 0 : onSearchChange("");
6490
6535
  onChange(resetFilterValues);
6491
- }, [onChange, resetFilterValues, onSearchChange]);
6536
+ }, [onChange, resetFilterValues, onSearchChange, onResetFilterValues]);
6492
6537
  const handleDeleteFilter = (0, import_react64.useCallback)(
6493
6538
  (index) => {
6494
6539
  const remainingFilters = filters.filter((_, i) => i !== index);
@@ -6560,17 +6605,17 @@ var FilterControls = ({
6560
6605
  const editorRef = (0, import_react65.useRef)(null);
6561
6606
  const variableRefernceCountInSearchTerm = (0, import_canvas10.hasReferencedVariables)(searchTerm);
6562
6607
  const [idToResetInputVariables, setIdToResetInputVariables] = (0, import_react65.useState)("data-resource-search-term-input");
6563
- const [localeSearchTerm, setLocaleSearchTerm] = (0, import_react65.useState)(searchTerm);
6608
+ const [localSearchTerm, setLocalSearchTerm] = (0, import_react65.useState)(searchTerm);
6564
6609
  (0, import_react_use7.useDebounce)(
6565
6610
  () => {
6566
- setSearchTerm(localeSearchTerm);
6611
+ setSearchTerm(localSearchTerm);
6567
6612
  },
6568
6613
  300,
6569
- [localeSearchTerm]
6614
+ [localSearchTerm]
6570
6615
  );
6571
6616
  (0, import_react65.useEffect)(() => {
6572
6617
  if (searchTerm === "") {
6573
- setLocaleSearchTerm("");
6618
+ setLocalSearchTerm("");
6574
6619
  setIdToResetInputVariables(`data-resource-search-term-input-${(0, import_uuid2.v4)()}`);
6575
6620
  }
6576
6621
  }, [searchTerm]);
@@ -6588,7 +6633,7 @@ var FilterControls = ({
6588
6633
  dataTestId: "filters-button"
6589
6634
  }
6590
6635
  ),
6591
- hideSearchInput ? null : /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { css: BindableKeywordSearchInputStyles, children: [
6636
+ hideSearchInput ? null : /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { css: BindableKeywordSearchInputStyles, "data-testid": "search-container", children: [
6592
6637
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
6593
6638
  InputVariables,
6594
6639
  {
@@ -6596,18 +6641,24 @@ var FilterControls = ({
6596
6641
  id: idToResetInputVariables,
6597
6642
  showMenuPosition: "inline-right",
6598
6643
  editorRef,
6599
- value: localeSearchTerm,
6600
- onChange: (value) => setLocaleSearchTerm(value != null ? value : ""),
6644
+ value: localSearchTerm,
6645
+ onChange: (value) => setLocalSearchTerm(value != null ? value : ""),
6601
6646
  disableVariables: !allowBindingSearchTerm,
6602
6647
  inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
6603
6648
  import_design_system44.InputKeywordSearch,
6604
6649
  {
6605
6650
  placeholder: "Search...",
6606
- onSearchTextChanged: (e) => setLocaleSearchTerm(e),
6607
- value: localeSearchTerm,
6651
+ onSearchTextChanged: (e) => setLocalSearchTerm(e),
6652
+ value: localSearchTerm,
6608
6653
  compact: true,
6609
6654
  rounded: true,
6610
- css: SearchInput
6655
+ css: SearchInput,
6656
+ onKeyPress: (e) => {
6657
+ if (e.key === "Enter") {
6658
+ e.preventDefault();
6659
+ e.stopPropagation();
6660
+ }
6661
+ }
6611
6662
  }
6612
6663
  )
6613
6664
  }
@@ -6617,7 +6668,7 @@ var FilterControls = ({
6617
6668
  {
6618
6669
  css: ClearSearchButtonStyles,
6619
6670
  onClick: () => {
6620
- setLocaleSearchTerm("");
6671
+ setLocalSearchTerm("");
6621
6672
  if (editorRef.current) {
6622
6673
  if (editorRef.current.getRootElement() !== document.activeElement) {
6623
6674
  editorRef.current.dispatchCommand(import_lexical11.CLEAR_EDITOR_COMMAND, void 0);
@@ -7054,15 +7105,36 @@ var SearchAndFilterResultContainer = ({
7054
7105
  hideClearButton
7055
7106
  }) => {
7056
7107
  const { searchTerm, totalResults, filters, handleResetFilters, setSearchTerm } = useSearchAndFilter();
7057
- const automateCalloutTitle = () => {
7058
- if (searchTerm && !filters.length) {
7059
- return "No search results found";
7108
+ const emptyFilters = filters.length === 0 || filters.every((filter) => !filter.value);
7109
+ const getTextValue = ({
7110
+ defaultPropText,
7111
+ searchText,
7112
+ filterText,
7113
+ fallbackText
7114
+ }) => {
7115
+ if (defaultPropText) {
7116
+ return defaultPropText;
7117
+ }
7118
+ if (searchTerm && emptyFilters) {
7119
+ return searchText;
7060
7120
  }
7061
- if (filters.length && !searchTerm) {
7062
- return "No results match the selected filters";
7121
+ if (!emptyFilters && !searchTerm) {
7122
+ return filterText;
7063
7123
  }
7064
- return "No matching results found";
7124
+ return fallbackText;
7065
7125
  };
7126
+ const clearButtonText = getTextValue({
7127
+ defaultPropText: buttonText,
7128
+ searchText: "Clear search",
7129
+ filterText: "Clear filters",
7130
+ fallbackText: "Clear results"
7131
+ });
7132
+ const automateCalloutTitle = getTextValue({
7133
+ defaultPropText: calloutTitle,
7134
+ searchText: "No search results found",
7135
+ filterText: "No results match the selected filters",
7136
+ fallbackText: "No matching results found"
7137
+ });
7066
7138
  if (totalResults && totalResults > 0) {
7067
7139
  return null;
7068
7140
  }
@@ -7083,7 +7155,7 @@ var SearchAndFilterResultContainer = ({
7083
7155
  ] }),
7084
7156
  !searchTerm || hideClearButton ? null : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_design_system48.Button, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
7085
7157
  ] }),
7086
- totalResults === 0 ? /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_design_system48.Callout, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
7158
+ totalResults === 0 ? /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_design_system48.Callout, { title: automateCalloutTitle, type: "note", children: [
7087
7159
  calloutText ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_design_system48.Paragraph, { children: calloutText }) : null,
7088
7160
  hideClearButton ? null : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
7089
7161
  import_design_system48.Button,
@@ -7092,7 +7164,7 @@ var SearchAndFilterResultContainer = ({
7092
7164
  size: "xs",
7093
7165
  onClick: handleClearSearch,
7094
7166
  "data-testid": "clear-search",
7095
- children: buttonText != null ? buttonText : "Clear search"
7167
+ children: clearButtonText
7096
7168
  }
7097
7169
  )
7098
7170
  ] }) : null
@@ -7115,7 +7187,8 @@ var SearchAndFilter = ({
7115
7187
  onSearchChange,
7116
7188
  totalResults,
7117
7189
  allowBindingSearchTerm = false,
7118
- resetFilterValues = []
7190
+ resetFilterValues = [],
7191
+ onResetFilterValues
7119
7192
  }) => {
7120
7193
  return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
7121
7194
  SearchAndFilterProvider,
@@ -7130,6 +7203,7 @@ var SearchAndFilter = ({
7130
7203
  resetFilterValues,
7131
7204
  filterMapper: filterMapper2,
7132
7205
  allowBindingSearchTerm,
7206
+ onResetFilterValues,
7133
7207
  children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_design_system49.VerticalRhythm, { "data-testid": "search-and-filter", children: [
7134
7208
  /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
7135
7209
  /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(