@uniformdev/mesh-sdk-react 20.30.1 → 20.31.0

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.esm.js CHANGED
@@ -7004,15 +7004,36 @@ var SearchAndFilterResultContainer = ({
7004
7004
  hideClearButton
7005
7005
  }) => {
7006
7006
  const { searchTerm, totalResults, filters, handleResetFilters, setSearchTerm } = useSearchAndFilter();
7007
- const automateCalloutTitle = () => {
7008
- if (searchTerm && !filters.length) {
7009
- return "No search results found";
7007
+ const emptyFilters = filters.length === 0 || filters.every((filter) => !filter.value);
7008
+ const getTextValue = ({
7009
+ defaultPropText,
7010
+ searchText,
7011
+ filterText,
7012
+ fallbackText
7013
+ }) => {
7014
+ if (defaultPropText) {
7015
+ return defaultPropText;
7016
+ }
7017
+ if (searchTerm && emptyFilters) {
7018
+ return searchText;
7010
7019
  }
7011
- if (filters.length && !searchTerm) {
7012
- return "No results match the selected filters";
7020
+ if (!emptyFilters && !searchTerm) {
7021
+ return filterText;
7013
7022
  }
7014
- return "No matching results found";
7023
+ return fallbackText;
7015
7024
  };
7025
+ const clearButtonText = getTextValue({
7026
+ defaultPropText: buttonText,
7027
+ searchText: "Clear search",
7028
+ filterText: "Clear filters",
7029
+ fallbackText: "Clear results"
7030
+ });
7031
+ const automateCalloutTitle = getTextValue({
7032
+ defaultPropText: calloutTitle,
7033
+ searchText: "No search results found",
7034
+ filterText: "No results match the selected filters",
7035
+ fallbackText: "No matching results found"
7036
+ });
7016
7037
  if (totalResults && totalResults > 0) {
7017
7038
  return null;
7018
7039
  }
@@ -7033,7 +7054,7 @@ var SearchAndFilterResultContainer = ({
7033
7054
  ] }),
7034
7055
  !searchTerm || hideClearButton ? null : /* @__PURE__ */ jsx78(Button5, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
7035
7056
  ] }),
7036
- totalResults === 0 ? /* @__PURE__ */ jsxs37(Callout4, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
7057
+ totalResults === 0 ? /* @__PURE__ */ jsxs37(Callout4, { title: automateCalloutTitle, type: "note", children: [
7037
7058
  calloutText ? /* @__PURE__ */ jsx78(Paragraph, { children: calloutText }) : null,
7038
7059
  hideClearButton ? null : /* @__PURE__ */ jsx78(
7039
7060
  Button5,
@@ -7042,7 +7063,7 @@ var SearchAndFilterResultContainer = ({
7042
7063
  size: "xs",
7043
7064
  onClick: handleClearSearch,
7044
7065
  "data-testid": "clear-search",
7045
- children: buttonText != null ? buttonText : "Clear search"
7066
+ children: clearButtonText
7046
7067
  }
7047
7068
  )
7048
7069
  ] }) : null
package/dist/index.js CHANGED
@@ -7069,15 +7069,36 @@ var SearchAndFilterResultContainer = ({
7069
7069
  hideClearButton
7070
7070
  }) => {
7071
7071
  const { searchTerm, totalResults, filters, handleResetFilters, setSearchTerm } = useSearchAndFilter();
7072
- const automateCalloutTitle = () => {
7073
- if (searchTerm && !filters.length) {
7074
- return "No search results found";
7072
+ const emptyFilters = filters.length === 0 || filters.every((filter) => !filter.value);
7073
+ const getTextValue = ({
7074
+ defaultPropText,
7075
+ searchText,
7076
+ filterText,
7077
+ fallbackText
7078
+ }) => {
7079
+ if (defaultPropText) {
7080
+ return defaultPropText;
7081
+ }
7082
+ if (searchTerm && emptyFilters) {
7083
+ return searchText;
7075
7084
  }
7076
- if (filters.length && !searchTerm) {
7077
- return "No results match the selected filters";
7085
+ if (!emptyFilters && !searchTerm) {
7086
+ return filterText;
7078
7087
  }
7079
- return "No matching results found";
7088
+ return fallbackText;
7080
7089
  };
7090
+ const clearButtonText = getTextValue({
7091
+ defaultPropText: buttonText,
7092
+ searchText: "Clear search",
7093
+ filterText: "Clear filters",
7094
+ fallbackText: "Clear results"
7095
+ });
7096
+ const automateCalloutTitle = getTextValue({
7097
+ defaultPropText: calloutTitle,
7098
+ searchText: "No search results found",
7099
+ filterText: "No results match the selected filters",
7100
+ fallbackText: "No matching results found"
7101
+ });
7081
7102
  if (totalResults && totalResults > 0) {
7082
7103
  return null;
7083
7104
  }
@@ -7098,7 +7119,7 @@ var SearchAndFilterResultContainer = ({
7098
7119
  ] }),
7099
7120
  !searchTerm || hideClearButton ? null : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_design_system48.Button, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
7100
7121
  ] }),
7101
- totalResults === 0 ? /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_design_system48.Callout, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
7122
+ totalResults === 0 ? /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_design_system48.Callout, { title: automateCalloutTitle, type: "note", children: [
7102
7123
  calloutText ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_design_system48.Paragraph, { children: calloutText }) : null,
7103
7124
  hideClearButton ? null : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
7104
7125
  import_design_system48.Button,
@@ -7107,7 +7128,7 @@ var SearchAndFilterResultContainer = ({
7107
7128
  size: "xs",
7108
7129
  onClick: handleClearSearch,
7109
7130
  "data-testid": "clear-search",
7110
- children: buttonText != null ? buttonText : "Clear search"
7131
+ children: clearButtonText
7111
7132
  }
7112
7133
  )
7113
7134
  ] }) : null
package/dist/index.mjs CHANGED
@@ -7004,15 +7004,36 @@ var SearchAndFilterResultContainer = ({
7004
7004
  hideClearButton
7005
7005
  }) => {
7006
7006
  const { searchTerm, totalResults, filters, handleResetFilters, setSearchTerm } = useSearchAndFilter();
7007
- const automateCalloutTitle = () => {
7008
- if (searchTerm && !filters.length) {
7009
- return "No search results found";
7007
+ const emptyFilters = filters.length === 0 || filters.every((filter) => !filter.value);
7008
+ const getTextValue = ({
7009
+ defaultPropText,
7010
+ searchText,
7011
+ filterText,
7012
+ fallbackText
7013
+ }) => {
7014
+ if (defaultPropText) {
7015
+ return defaultPropText;
7016
+ }
7017
+ if (searchTerm && emptyFilters) {
7018
+ return searchText;
7010
7019
  }
7011
- if (filters.length && !searchTerm) {
7012
- return "No results match the selected filters";
7020
+ if (!emptyFilters && !searchTerm) {
7021
+ return filterText;
7013
7022
  }
7014
- return "No matching results found";
7023
+ return fallbackText;
7015
7024
  };
7025
+ const clearButtonText = getTextValue({
7026
+ defaultPropText: buttonText,
7027
+ searchText: "Clear search",
7028
+ filterText: "Clear filters",
7029
+ fallbackText: "Clear results"
7030
+ });
7031
+ const automateCalloutTitle = getTextValue({
7032
+ defaultPropText: calloutTitle,
7033
+ searchText: "No search results found",
7034
+ filterText: "No results match the selected filters",
7035
+ fallbackText: "No matching results found"
7036
+ });
7016
7037
  if (totalResults && totalResults > 0) {
7017
7038
  return null;
7018
7039
  }
@@ -7033,7 +7054,7 @@ var SearchAndFilterResultContainer = ({
7033
7054
  ] }),
7034
7055
  !searchTerm || hideClearButton ? null : /* @__PURE__ */ jsx78(Button5, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
7035
7056
  ] }),
7036
- totalResults === 0 ? /* @__PURE__ */ jsxs37(Callout4, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
7057
+ totalResults === 0 ? /* @__PURE__ */ jsxs37(Callout4, { title: automateCalloutTitle, type: "note", children: [
7037
7058
  calloutText ? /* @__PURE__ */ jsx78(Paragraph, { children: calloutText }) : null,
7038
7059
  hideClearButton ? null : /* @__PURE__ */ jsx78(
7039
7060
  Button5,
@@ -7042,7 +7063,7 @@ var SearchAndFilterResultContainer = ({
7042
7063
  size: "xs",
7043
7064
  onClick: handleClearSearch,
7044
7065
  "data-testid": "clear-search",
7045
- children: buttonText != null ? buttonText : "Clear search"
7066
+ children: clearButtonText
7046
7067
  }
7047
7068
  )
7048
7069
  ] }) : null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/mesh-sdk-react",
3
- "version": "20.30.1",
3
+ "version": "20.31.0",
4
4
  "description": "Uniform Mesh Framework SDK for React",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -50,10 +50,10 @@
50
50
  "@lexical/selection": "0.25.0",
51
51
  "@lexical/utils": "0.25.0",
52
52
  "@react-icons/all-files": "https://github.com/react-icons/react-icons/releases/download/v5.5.0/react-icons-all-files-5.5.0.tgz",
53
- "@uniformdev/canvas": "20.30.1",
54
- "@uniformdev/design-system": "20.30.1",
55
- "@uniformdev/mesh-sdk": "20.30.1",
56
- "@uniformdev/richtext": "20.30.1",
53
+ "@uniformdev/canvas": "20.31.0",
54
+ "@uniformdev/design-system": "20.31.0",
55
+ "@uniformdev/mesh-sdk": "20.31.0",
56
+ "@uniformdev/richtext": "20.31.0",
57
57
  "dequal": "^2.0.3",
58
58
  "lexical": "0.25.0",
59
59
  "mitt": "3.0.1",
@@ -86,5 +86,5 @@
86
86
  "publishConfig": {
87
87
  "access": "public"
88
88
  },
89
- "gitHead": "8f255b1cff89486c0aca67be6c6409c68766276c"
89
+ "gitHead": "f0beedff37c21c6b6795018e82fa9ad5fe2b59fd"
90
90
  }