@uniformdev/mesh-sdk-react 20.7.1-alpha.12 → 20.7.1-alpha.120

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;
@@ -1762,6 +1768,14 @@ var VariableNode = class _VariableNode extends import_lexical5.DecoratorNode {
1762
1768
  updateDOM() {
1763
1769
  return false;
1764
1770
  }
1771
+ static importDOM() {
1772
+ return {
1773
+ binding: () => ({
1774
+ conversion: $convertBindingElement,
1775
+ priority: 0
1776
+ })
1777
+ };
1778
+ }
1765
1779
  /**
1766
1780
  * Render the variable node using React.
1767
1781
  * NOTE: this is effectively an island of React, and you may not call hooks,
@@ -1771,6 +1785,21 @@ var VariableNode = class _VariableNode extends import_lexical5.DecoratorNode {
1771
1785
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VariableNodeComponent, { state: this.__state, reference: this.reference, nodeKey: this.__key });
1772
1786
  }
1773
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
+ }
1774
1803
  function $createVariableNode(variableReference, state) {
1775
1804
  return new VariableNode(variableReference, state);
1776
1805
  }
@@ -1948,7 +1977,7 @@ var menuBtn2 = import_react18.css`
1948
1977
  transform: translateY(-50%);
1949
1978
  `;
1950
1979
  var input = import_react18.css`
1951
- --input-padding: 12px var(--spacing-base) 12px var(--spacing-sm);
1980
+ --input-padding: 12px var(--spacing-lg) 12px var(--spacing-sm);
1952
1981
  appearance: none;
1953
1982
  background-color: var(--white);
1954
1983
  border: 1px solid var(--gray-300);
@@ -2085,6 +2114,7 @@ var input2 = import_react19.css`
2085
2114
  &:disabled,
2086
2115
  &:disabled::placeholder,
2087
2116
  &:disabled:hover {
2117
+ border-color: var(--gray-200);
2088
2118
  border-radius: var(--rounded-sm);
2089
2119
  cursor: not-allowed;
2090
2120
  color: var(--gray-400);
@@ -2094,6 +2124,7 @@ var input2 = import_react19.css`
2094
2124
  &[contenteditable='false'] {
2095
2125
  cursor: not-allowed;
2096
2126
  color: var(--gray-400);
2127
+ border-color: var(--gray-200);
2097
2128
  }
2098
2129
 
2099
2130
  > p {
@@ -2588,7 +2619,8 @@ function InputVariables(props) {
2588
2619
  styleVariant = "default",
2589
2620
  renderMenuInPortal,
2590
2621
  disableDismissEditorOnChange,
2591
- singleTokenMode
2622
+ singleTokenMode,
2623
+ disableVariableDisplayNames
2592
2624
  } = props;
2593
2625
  const [finalId] = (0, import_react28.useState)(id != null ? id : () => (0, import_uuid.v4)());
2594
2626
  const { dispatch, canDispatch, isEditing } = useVariables(true);
@@ -2611,7 +2643,7 @@ function InputVariables(props) {
2611
2643
  gap: "xs",
2612
2644
  css: import_react27.css`
2613
2645
  position: relative;
2614
- & > div:first-child {
2646
+ & > div:first-of-type {
2615
2647
  flex-grow: 1;
2616
2648
  }
2617
2649
  `,
@@ -2697,6 +2729,7 @@ function InputVariables(props) {
2697
2729
  replaceValueOnVariableInsert: useInputWithNoVariables,
2698
2730
  autoFocus,
2699
2731
  filterVariable,
2732
+ disableVariableDisplayNames,
2700
2733
  children: [
2701
2734
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PasteTransformerPlugin, { transformPaste }),
2702
2735
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ControlledValuePlugin, { value, enabled: singleTokenMode || useInputWithNoVariables }),
@@ -3065,6 +3098,8 @@ var variableValue = import_react34.css`
3065
3098
 
3066
3099
  // src/components/Variables/VariablesList.tsx
3067
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;
3068
3103
  function VariablesList() {
3069
3104
  const { variables, dispatch, readOnly } = useVariables();
3070
3105
  const sorted = variablesToList(variables).filter((variable) => !variable.system);
@@ -3086,7 +3121,7 @@ function VariablesList() {
3086
3121
  }
3087
3122
  };
3088
3123
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
3089
- /* @__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: [
3090
3125
  /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_design_system13.TableHead, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_design_system13.TableRow, { children: [
3091
3126
  /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_design_system13.TableCellHead, { children: "Name" }),
3092
3127
  /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_design_system13.TableCellHead, { children: "Default Value" }),
@@ -3097,7 +3132,7 @@ function VariablesList() {
3097
3132
  const text = displayName != null ? displayName : name2;
3098
3133
  const textValue = variableDefaultTextValue(defaultValue);
3099
3134
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
3100
- import_react_beautiful_dnd2.Draggable,
3135
+ DraggableHack,
3101
3136
  {
3102
3137
  draggableId: name2,
3103
3138
  index,
@@ -3692,8 +3727,8 @@ function urlEncodeRequestParameter(parameter, varValues) {
3692
3727
  value: decodeVariablesInUrlEncodedString(encodeURIComponent(parameter.value), varValues)
3693
3728
  };
3694
3729
  }
3695
- function decodeVariablesInUrlEncodedString(string, varValues) {
3696
- 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) => {
3697
3732
  var _a;
3698
3733
  const varName = decodeURIComponent(body);
3699
3734
  return ((_a = varValues == null ? void 0 : varValues[varName]) == null ? void 0 : _a.default) ? variableDefaultTextValue(varValues[varName].default) : `\${${varName}}`;
@@ -4026,7 +4061,7 @@ var DataRefreshButton = ({
4026
4061
  onRefreshData,
4027
4062
  ...props
4028
4063
  }) => {
4029
- 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: [
4030
4065
  !isLoading ? null : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
4031
4066
  import_design_system20.LoadingIndicator,
4032
4067
  {
@@ -4293,7 +4328,7 @@ var ObjectSearchListItem = ({
4293
4328
  ),
4294
4329
  /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { css: ObjectListItemInfoContainer, children: [
4295
4330
  selected ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_design_system22.Chip, { text: "selected", size: "xs" }) : null,
4296
- !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 })
4297
4332
  ] }),
4298
4333
  !children ? null : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { css: ObjectListItemUnControlledContent, children })
4299
4334
  ]
@@ -4323,7 +4358,6 @@ var ObjectSearchContainer = ({
4323
4358
  role: "list",
4324
4359
  css: import_react45.css`
4325
4360
  > div {
4326
- transition: max-height var(--duration-slow) var(--timing-ease-out);
4327
4361
  max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
4328
4362
  }
4329
4363
  `,
@@ -4601,6 +4635,11 @@ var ObjectSearchResultItemTimeStamp = import_react49.css`
4601
4635
  color: var(--gray-500);
4602
4636
  font-size: var(--fs-xs);
4603
4637
  `;
4638
+ var ObjectSearchResultItemTitleLink = import_react49.css`
4639
+ text-decoration: none;
4640
+ color: var(--primary-action-default);
4641
+ font-size: var(--fs-sm);
4642
+ `;
4604
4643
  var ObjectSearchAuthorStateGroup = import_react49.css`
4605
4644
  align-items: center;
4606
4645
  display: flex;
@@ -4635,7 +4674,8 @@ var ObjectSearchResultItem = ({
4635
4674
  publishedAt,
4636
4675
  hideRemoveButton = false,
4637
4676
  disableDnD = false,
4638
- children
4677
+ children,
4678
+ onClick
4639
4679
  }) => {
4640
4680
  const { onSelectItem } = useObjectSearchContext();
4641
4681
  const formatedContentType = Array.isArray(contentType) ? contentType.join(", ") : contentType;
@@ -4658,7 +4698,19 @@ var ObjectSearchResultItem = ({
4658
4698
  /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { children: [
4659
4699
  /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { css: ObjectSearchResultItemSubtitle, "data-testid": "sub-title", children: formatedContentType }),
4660
4700
  /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { role: "heading", css: ObjectSearchResultItemTitle, "data-testid": "title", children: [
4661
- 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 }),
4662
4714
  !popoverData ? null : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_design_system26.Popover, { ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
4663
4715
  ] }),
4664
4716
  !createdAt && !publishStatus ? null : /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { css: ObjectSearchAuthorStateGroup, children: [
@@ -4729,6 +4781,8 @@ var ObjectSearchResultListTitle = import_react50.css`
4729
4781
 
4730
4782
  // src/components/ObjectSearch/ObjectSearchResultList.tsx
4731
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;
4732
4786
  function ObjectSearchResultList({
4733
4787
  resultLabelText = "Selected",
4734
4788
  removeButtonText = "Remove all",
@@ -4800,7 +4854,7 @@ function ObjectSearchResultList({
4800
4854
  ] })
4801
4855
  ] }),
4802
4856
  !selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
4803
- import_react_beautiful_dnd3.Droppable,
4857
+ DroppableHack2,
4804
4858
  {
4805
4859
  droppableId: multiSelectId != null ? multiSelectId : "canvas-multi-select",
4806
4860
  renderClone: getContainerForDnDReparenting ? getDraggableItem : void 0,
@@ -4808,7 +4862,7 @@ function ObjectSearchResultList({
4808
4862
  children: (provided) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
4809
4863
  selectedListItems.map((item, i) => {
4810
4864
  return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
4811
- import_react_beautiful_dnd3.Draggable,
4865
+ DraggableHack2,
4812
4866
  {
4813
4867
  draggableId: item.id,
4814
4868
  index: i,
@@ -5258,18 +5312,6 @@ var DATE_TIME_OPERATORS = [
5258
5312
  value: "sys-date-gte",
5259
5313
  editorType: "date",
5260
5314
  expectedValueType: "single"
5261
- },
5262
- {
5263
- label: "is empty",
5264
- value: "ndef",
5265
- editorType: "empty",
5266
- expectedValueType: "false"
5267
- },
5268
- {
5269
- label: "is not empty",
5270
- value: "def",
5271
- editorType: "empty",
5272
- expectedValueType: "true"
5273
5315
  }
5274
5316
  ];
5275
5317
  var RICHTEXT_OPERATORS = [
@@ -6287,8 +6329,6 @@ var SearchAndFilterOptionsContainer = import_react63.css`
6287
6329
  gap: var(--spacing-sm);
6288
6330
  padding: var(--spacing-md) 0 var(--spacing-base);
6289
6331
  will-change: height;
6290
- position: relative;
6291
- z-index: 2;
6292
6332
  `;
6293
6333
  var SearchAndFilterOptionsInnerContainer = import_react63.css`
6294
6334
  display: flex;
@@ -6307,8 +6347,6 @@ var SearchAndFilterAdditionalContainer = import_react63.css`
6307
6347
  flex-wrap: nowrap;
6308
6348
  gap: var(--spacing-base);
6309
6349
  padding: var(--spacing-base) var(--spacing-md) 0;
6310
- position: relative;
6311
- z-index: 0;
6312
6350
  `;
6313
6351
 
6314
6352
  // src/components/SearchAndFilter/FilterButton.tsx
@@ -6387,6 +6425,7 @@ function withInputVariables(WrappedComponent, noSwapping = false) {
6387
6425
  return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
6388
6426
  InputVariables,
6389
6427
  {
6428
+ "data-testid": "filter-value",
6390
6429
  disableInlineMenu: true,
6391
6430
  showMenuPosition: "inline-right",
6392
6431
  onChange: (newValue) => props.onChange(newValue != null ? newValue : ""),
@@ -6407,6 +6446,7 @@ function withInputVariablesForMultiValue(WrappedComponent) {
6407
6446
  return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
6408
6447
  InputVariables,
6409
6448
  {
6449
+ "data-testid": "filter-value",
6410
6450
  disableInlineMenu: true,
6411
6451
  showMenuPosition: "inline-right",
6412
6452
  onChange: (newValue) => props.onChange(newValue ? [newValue] : []),
@@ -6459,6 +6499,7 @@ var SearchAndFilterProvider = ({
6459
6499
  onSearchChange,
6460
6500
  onChange,
6461
6501
  resetFilterValues = [{ field: "", operator: "", value: "" }],
6502
+ onResetFilterValues,
6462
6503
  totalResults,
6463
6504
  filterMapper: filterMapper2 = filterMapper,
6464
6505
  children,
@@ -6487,9 +6528,12 @@ var SearchAndFilterProvider = ({
6487
6528
  onChange([...filters, { field: "", operator: "", value: "" }]);
6488
6529
  }, [filters, onChange]);
6489
6530
  const handleResetFilters = (0, import_react64.useCallback)(() => {
6531
+ if (onResetFilterValues) {
6532
+ return onResetFilterValues();
6533
+ }
6490
6534
  onSearchChange == null ? void 0 : onSearchChange("");
6491
6535
  onChange(resetFilterValues);
6492
- }, [onChange, resetFilterValues, onSearchChange]);
6536
+ }, [onChange, resetFilterValues, onSearchChange, onResetFilterValues]);
6493
6537
  const handleDeleteFilter = (0, import_react64.useCallback)(
6494
6538
  (index) => {
6495
6539
  const remainingFilters = filters.filter((_, i) => i !== index);
@@ -6561,17 +6605,17 @@ var FilterControls = ({
6561
6605
  const editorRef = (0, import_react65.useRef)(null);
6562
6606
  const variableRefernceCountInSearchTerm = (0, import_canvas10.hasReferencedVariables)(searchTerm);
6563
6607
  const [idToResetInputVariables, setIdToResetInputVariables] = (0, import_react65.useState)("data-resource-search-term-input");
6564
- const [localeSearchTerm, setLocaleSearchTerm] = (0, import_react65.useState)(searchTerm);
6608
+ const [localSearchTerm, setLocalSearchTerm] = (0, import_react65.useState)(searchTerm);
6565
6609
  (0, import_react_use7.useDebounce)(
6566
6610
  () => {
6567
- setSearchTerm(localeSearchTerm);
6611
+ setSearchTerm(localSearchTerm);
6568
6612
  },
6569
6613
  300,
6570
- [localeSearchTerm]
6614
+ [localSearchTerm]
6571
6615
  );
6572
6616
  (0, import_react65.useEffect)(() => {
6573
6617
  if (searchTerm === "") {
6574
- setLocaleSearchTerm("");
6618
+ setLocalSearchTerm("");
6575
6619
  setIdToResetInputVariables(`data-resource-search-term-input-${(0, import_uuid2.v4)()}`);
6576
6620
  }
6577
6621
  }, [searchTerm]);
@@ -6589,7 +6633,7 @@ var FilterControls = ({
6589
6633
  dataTestId: "filters-button"
6590
6634
  }
6591
6635
  ),
6592
- 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: [
6593
6637
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
6594
6638
  InputVariables,
6595
6639
  {
@@ -6597,18 +6641,24 @@ var FilterControls = ({
6597
6641
  id: idToResetInputVariables,
6598
6642
  showMenuPosition: "inline-right",
6599
6643
  editorRef,
6600
- value: localeSearchTerm,
6601
- onChange: (value) => setLocaleSearchTerm(value != null ? value : ""),
6644
+ value: localSearchTerm,
6645
+ onChange: (value) => setLocalSearchTerm(value != null ? value : ""),
6602
6646
  disableVariables: !allowBindingSearchTerm,
6603
6647
  inputWhenNoVariables: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
6604
6648
  import_design_system44.InputKeywordSearch,
6605
6649
  {
6606
6650
  placeholder: "Search...",
6607
- onSearchTextChanged: (e) => setLocaleSearchTerm(e),
6608
- value: localeSearchTerm,
6651
+ onSearchTextChanged: (e) => setLocalSearchTerm(e),
6652
+ value: localSearchTerm,
6609
6653
  compact: true,
6610
6654
  rounded: true,
6611
- css: SearchInput
6655
+ css: SearchInput,
6656
+ onKeyPress: (e) => {
6657
+ if (e.key === "Enter") {
6658
+ e.preventDefault();
6659
+ e.stopPropagation();
6660
+ }
6661
+ }
6612
6662
  }
6613
6663
  )
6614
6664
  }
@@ -6618,7 +6668,7 @@ var FilterControls = ({
6618
6668
  {
6619
6669
  css: ClearSearchButtonStyles,
6620
6670
  onClick: () => {
6621
- setLocaleSearchTerm("");
6671
+ setLocalSearchTerm("");
6622
6672
  if (editorRef.current) {
6623
6673
  if (editorRef.current.getRootElement() !== document.activeElement) {
6624
6674
  editorRef.current.dispatchCommand(import_lexical11.CLEAR_EDITOR_COMMAND, void 0);
@@ -7055,15 +7105,36 @@ var SearchAndFilterResultContainer = ({
7055
7105
  hideClearButton
7056
7106
  }) => {
7057
7107
  const { searchTerm, totalResults, filters, handleResetFilters, setSearchTerm } = useSearchAndFilter();
7058
- const automateCalloutTitle = () => {
7059
- if (searchTerm && !filters.length) {
7060
- 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;
7061
7120
  }
7062
- if (filters.length && !searchTerm) {
7063
- return "No results match the selected filters";
7121
+ if (!emptyFilters && !searchTerm) {
7122
+ return filterText;
7064
7123
  }
7065
- return "No matching results found";
7124
+ return fallbackText;
7066
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
+ });
7067
7138
  if (totalResults && totalResults > 0) {
7068
7139
  return null;
7069
7140
  }
@@ -7084,7 +7155,7 @@ var SearchAndFilterResultContainer = ({
7084
7155
  ] }),
7085
7156
  !searchTerm || hideClearButton ? null : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_design_system48.Button, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
7086
7157
  ] }),
7087
- 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: [
7088
7159
  calloutText ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_design_system48.Paragraph, { children: calloutText }) : null,
7089
7160
  hideClearButton ? null : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
7090
7161
  import_design_system48.Button,
@@ -7093,7 +7164,7 @@ var SearchAndFilterResultContainer = ({
7093
7164
  size: "xs",
7094
7165
  onClick: handleClearSearch,
7095
7166
  "data-testid": "clear-search",
7096
- children: buttonText != null ? buttonText : "Clear search"
7167
+ children: clearButtonText
7097
7168
  }
7098
7169
  )
7099
7170
  ] }) : null
@@ -7116,7 +7187,8 @@ var SearchAndFilter = ({
7116
7187
  onSearchChange,
7117
7188
  totalResults,
7118
7189
  allowBindingSearchTerm = false,
7119
- resetFilterValues = []
7190
+ resetFilterValues = [],
7191
+ onResetFilterValues
7120
7192
  }) => {
7121
7193
  return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
7122
7194
  SearchAndFilterProvider,
@@ -7131,6 +7203,7 @@ var SearchAndFilter = ({
7131
7203
  resetFilterValues,
7132
7204
  filterMapper: filterMapper2,
7133
7205
  allowBindingSearchTerm,
7206
+ onResetFilterValues,
7134
7207
  children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_design_system49.VerticalRhythm, { "data-testid": "search-and-filter", children: [
7135
7208
  /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
7136
7209
  /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(