@uniformdev/mesh-sdk-react 20.30.1 → 20.31.1-alpha.7

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
@@ -4232,7 +4232,6 @@ var ObjectSearchContainer = ({
4232
4232
  role: "list",
4233
4233
  css: css16`
4234
4234
  > div {
4235
- transition: max-height var(--duration-slow) var(--timing-ease-out);
4236
4235
  max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
4237
4236
  }
4238
4237
  `,
@@ -7004,15 +7003,36 @@ var SearchAndFilterResultContainer = ({
7004
7003
  hideClearButton
7005
7004
  }) => {
7006
7005
  const { searchTerm, totalResults, filters, handleResetFilters, setSearchTerm } = useSearchAndFilter();
7007
- const automateCalloutTitle = () => {
7008
- if (searchTerm && !filters.length) {
7009
- return "No search results found";
7006
+ const emptyFilters = filters.length === 0 || filters.every((filter) => !filter.value);
7007
+ const getTextValue = ({
7008
+ defaultPropText,
7009
+ searchText,
7010
+ filterText,
7011
+ fallbackText
7012
+ }) => {
7013
+ if (defaultPropText) {
7014
+ return defaultPropText;
7015
+ }
7016
+ if (searchTerm && emptyFilters) {
7017
+ return searchText;
7010
7018
  }
7011
- if (filters.length && !searchTerm) {
7012
- return "No results match the selected filters";
7019
+ if (!emptyFilters && !searchTerm) {
7020
+ return filterText;
7013
7021
  }
7014
- return "No matching results found";
7022
+ return fallbackText;
7015
7023
  };
7024
+ const clearButtonText = getTextValue({
7025
+ defaultPropText: buttonText,
7026
+ searchText: "Clear search",
7027
+ filterText: "Clear filters",
7028
+ fallbackText: "Clear results"
7029
+ });
7030
+ const automateCalloutTitle = getTextValue({
7031
+ defaultPropText: calloutTitle,
7032
+ searchText: "No search results found",
7033
+ filterText: "No results match the selected filters",
7034
+ fallbackText: "No matching results found"
7035
+ });
7016
7036
  if (totalResults && totalResults > 0) {
7017
7037
  return null;
7018
7038
  }
@@ -7033,7 +7053,7 @@ var SearchAndFilterResultContainer = ({
7033
7053
  ] }),
7034
7054
  !searchTerm || hideClearButton ? null : /* @__PURE__ */ jsx78(Button5, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
7035
7055
  ] }),
7036
- totalResults === 0 ? /* @__PURE__ */ jsxs37(Callout4, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
7056
+ totalResults === 0 ? /* @__PURE__ */ jsxs37(Callout4, { title: automateCalloutTitle, type: "note", children: [
7037
7057
  calloutText ? /* @__PURE__ */ jsx78(Paragraph, { children: calloutText }) : null,
7038
7058
  hideClearButton ? null : /* @__PURE__ */ jsx78(
7039
7059
  Button5,
@@ -7042,7 +7062,7 @@ var SearchAndFilterResultContainer = ({
7042
7062
  size: "xs",
7043
7063
  onClick: handleClearSearch,
7044
7064
  "data-testid": "clear-search",
7045
- children: buttonText != null ? buttonText : "Clear search"
7065
+ children: clearButtonText
7046
7066
  }
7047
7067
  )
7048
7068
  ] }) : null
package/dist/index.js CHANGED
@@ -4323,7 +4323,6 @@ var ObjectSearchContainer = ({
4323
4323
  role: "list",
4324
4324
  css: import_react45.css`
4325
4325
  > div {
4326
- transition: max-height var(--duration-slow) var(--timing-ease-out);
4327
4326
  max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
4328
4327
  }
4329
4328
  `,
@@ -7069,15 +7068,36 @@ var SearchAndFilterResultContainer = ({
7069
7068
  hideClearButton
7070
7069
  }) => {
7071
7070
  const { searchTerm, totalResults, filters, handleResetFilters, setSearchTerm } = useSearchAndFilter();
7072
- const automateCalloutTitle = () => {
7073
- if (searchTerm && !filters.length) {
7074
- return "No search results found";
7071
+ const emptyFilters = filters.length === 0 || filters.every((filter) => !filter.value);
7072
+ const getTextValue = ({
7073
+ defaultPropText,
7074
+ searchText,
7075
+ filterText,
7076
+ fallbackText
7077
+ }) => {
7078
+ if (defaultPropText) {
7079
+ return defaultPropText;
7080
+ }
7081
+ if (searchTerm && emptyFilters) {
7082
+ return searchText;
7075
7083
  }
7076
- if (filters.length && !searchTerm) {
7077
- return "No results match the selected filters";
7084
+ if (!emptyFilters && !searchTerm) {
7085
+ return filterText;
7078
7086
  }
7079
- return "No matching results found";
7087
+ return fallbackText;
7080
7088
  };
7089
+ const clearButtonText = getTextValue({
7090
+ defaultPropText: buttonText,
7091
+ searchText: "Clear search",
7092
+ filterText: "Clear filters",
7093
+ fallbackText: "Clear results"
7094
+ });
7095
+ const automateCalloutTitle = getTextValue({
7096
+ defaultPropText: calloutTitle,
7097
+ searchText: "No search results found",
7098
+ filterText: "No results match the selected filters",
7099
+ fallbackText: "No matching results found"
7100
+ });
7081
7101
  if (totalResults && totalResults > 0) {
7082
7102
  return null;
7083
7103
  }
@@ -7098,7 +7118,7 @@ var SearchAndFilterResultContainer = ({
7098
7118
  ] }),
7099
7119
  !searchTerm || hideClearButton ? null : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_design_system48.Button, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
7100
7120
  ] }),
7101
- totalResults === 0 ? /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_design_system48.Callout, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
7121
+ totalResults === 0 ? /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_design_system48.Callout, { title: automateCalloutTitle, type: "note", children: [
7102
7122
  calloutText ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_design_system48.Paragraph, { children: calloutText }) : null,
7103
7123
  hideClearButton ? null : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
7104
7124
  import_design_system48.Button,
@@ -7107,7 +7127,7 @@ var SearchAndFilterResultContainer = ({
7107
7127
  size: "xs",
7108
7128
  onClick: handleClearSearch,
7109
7129
  "data-testid": "clear-search",
7110
- children: buttonText != null ? buttonText : "Clear search"
7130
+ children: clearButtonText
7111
7131
  }
7112
7132
  )
7113
7133
  ] }) : null
package/dist/index.mjs CHANGED
@@ -4232,7 +4232,6 @@ var ObjectSearchContainer = ({
4232
4232
  role: "list",
4233
4233
  css: css16`
4234
4234
  > div {
4235
- transition: max-height var(--duration-slow) var(--timing-ease-out);
4236
4235
  max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
4237
4236
  }
4238
4237
  `,
@@ -7004,15 +7003,36 @@ var SearchAndFilterResultContainer = ({
7004
7003
  hideClearButton
7005
7004
  }) => {
7006
7005
  const { searchTerm, totalResults, filters, handleResetFilters, setSearchTerm } = useSearchAndFilter();
7007
- const automateCalloutTitle = () => {
7008
- if (searchTerm && !filters.length) {
7009
- return "No search results found";
7006
+ const emptyFilters = filters.length === 0 || filters.every((filter) => !filter.value);
7007
+ const getTextValue = ({
7008
+ defaultPropText,
7009
+ searchText,
7010
+ filterText,
7011
+ fallbackText
7012
+ }) => {
7013
+ if (defaultPropText) {
7014
+ return defaultPropText;
7015
+ }
7016
+ if (searchTerm && emptyFilters) {
7017
+ return searchText;
7010
7018
  }
7011
- if (filters.length && !searchTerm) {
7012
- return "No results match the selected filters";
7019
+ if (!emptyFilters && !searchTerm) {
7020
+ return filterText;
7013
7021
  }
7014
- return "No matching results found";
7022
+ return fallbackText;
7015
7023
  };
7024
+ const clearButtonText = getTextValue({
7025
+ defaultPropText: buttonText,
7026
+ searchText: "Clear search",
7027
+ filterText: "Clear filters",
7028
+ fallbackText: "Clear results"
7029
+ });
7030
+ const automateCalloutTitle = getTextValue({
7031
+ defaultPropText: calloutTitle,
7032
+ searchText: "No search results found",
7033
+ filterText: "No results match the selected filters",
7034
+ fallbackText: "No matching results found"
7035
+ });
7016
7036
  if (totalResults && totalResults > 0) {
7017
7037
  return null;
7018
7038
  }
@@ -7033,7 +7053,7 @@ var SearchAndFilterResultContainer = ({
7033
7053
  ] }),
7034
7054
  !searchTerm || hideClearButton ? null : /* @__PURE__ */ jsx78(Button5, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
7035
7055
  ] }),
7036
- totalResults === 0 ? /* @__PURE__ */ jsxs37(Callout4, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
7056
+ totalResults === 0 ? /* @__PURE__ */ jsxs37(Callout4, { title: automateCalloutTitle, type: "note", children: [
7037
7057
  calloutText ? /* @__PURE__ */ jsx78(Paragraph, { children: calloutText }) : null,
7038
7058
  hideClearButton ? null : /* @__PURE__ */ jsx78(
7039
7059
  Button5,
@@ -7042,7 +7062,7 @@ var SearchAndFilterResultContainer = ({
7042
7062
  size: "xs",
7043
7063
  onClick: handleClearSearch,
7044
7064
  "data-testid": "clear-search",
7045
- children: buttonText != null ? buttonText : "Clear search"
7065
+ children: clearButtonText
7046
7066
  }
7047
7067
  )
7048
7068
  ] }) : 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.1-alpha.7+9d96376c09",
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.1-alpha.7+9d96376c09",
54
+ "@uniformdev/design-system": "20.31.1-alpha.7+9d96376c09",
55
+ "@uniformdev/mesh-sdk": "20.31.1-alpha.7+9d96376c09",
56
+ "@uniformdev/richtext": "20.31.1-alpha.7+9d96376c09",
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": "9d96376c09c3471f9ed1810db163c825314f9146"
90
90
  }