@m4l/components 9.4.27 → 9.4.28

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.
@@ -15,7 +15,7 @@ function useMultipleChips(props) {
15
15
  getOptionStartAdornment,
16
16
  getOptionEndAdornment
17
17
  } = props;
18
- const startAdornmentClone = useMemo(() => {
18
+ const externalStartAdornment = useMemo(() => {
19
19
  if (!startAdornment) {
20
20
  return null;
21
21
  }
@@ -53,7 +53,7 @@ function useMultipleChips(props) {
53
53
  getOptionEndAdornment,
54
54
  adjustedSize
55
55
  ]);
56
- const memoizedStartAdornment = useMemo(() => {
56
+ const selectedOptionStartAdornment = useMemo(() => {
57
57
  if (multiple || !selectedValue || Array.isArray(selectedValue) && selectedValue.length === 0) {
58
58
  return null;
59
59
  }
@@ -69,7 +69,7 @@ function useMultipleChips(props) {
69
69
  getOptionStartAdornment,
70
70
  adjustedSize
71
71
  ]);
72
- const internalAdornments = useMemo(() => {
72
+ const multipleSelectionChips = useMemo(() => {
73
73
  if (!(Array.isArray(selectedValue) && multiple && selectedValue.length > 0)) {
74
74
  return null;
75
75
  }
@@ -100,18 +100,21 @@ function useMultipleChips(props) {
100
100
  ownerState,
101
101
  memoizedIcons
102
102
  ]);
103
- if (startAdornmentClone && internalAdornments) {
103
+ if (externalStartAdornment && multipleSelectionChips) {
104
104
  return /* @__PURE__ */ jsxs(Fragment, { children: [
105
- /* @__PURE__ */ jsx(WrapperStartAdornmentStyled, { role: "img", "aria-hidden": "true", ownerState, children: startAdornmentClone }),
106
- internalAdornments
105
+ /* @__PURE__ */ jsx(WrapperStartAdornmentStyled, { role: "img", "aria-hidden": "true", ownerState, children: externalStartAdornment }),
106
+ multipleSelectionChips
107
107
  ] });
108
108
  }
109
- if (startAdornmentClone) {
109
+ if (externalStartAdornment) {
110
110
  return /* @__PURE__ */ jsxs(WrapperStartAdornmentStyled, { role: "img", "aria-hidden": "true", ownerState, children: [
111
- startAdornmentClone,
112
- !multiple && memoizedStartAdornment
111
+ externalStartAdornment,
112
+ !multiple && selectedOptionStartAdornment
113
113
  ] });
114
114
  }
115
+ if (!multiple && selectedOptionStartAdornment && !externalStartAdornment) {
116
+ return /* @__PURE__ */ jsx(WrapperStartAdornmentStyled, { role: "img", "aria-hidden": "true", ownerState, children: selectedOptionStartAdornment });
117
+ }
115
118
  if (!getOptionLabelLocal) {
116
119
  console.error("useStartAdornments: getOptionLabelLocal is required");
117
120
  return null;
@@ -120,7 +123,7 @@ function useMultipleChips(props) {
120
123
  console.error("useStartAdornments: handleDelete is required");
121
124
  return null;
122
125
  }
123
- return internalAdornments;
126
+ return multipleSelectionChips;
124
127
  }
125
128
  export {
126
129
  useMultipleChips as u
@@ -126,11 +126,6 @@ function useValuesAndHandlers(props) {
126
126
  }
127
127
  }
128
128
  }, [readOnly, value, getOptionLabelLocal, multiple, inputValue]);
129
- useEffect(() => {
130
- if (open === false && value === null && inputValue !== "") {
131
- setInputValue("");
132
- }
133
- }, [value, open, inputValue]);
134
129
  const checkKeyDown = (e) => {
135
130
  if (e.code === "Enter") {
136
131
  e.preventDefault();
@@ -24,7 +24,8 @@ const renderAdornment = (propsResource, adjustedSize) => {
24
24
  {
25
25
  src: resource,
26
26
  width: 14,
27
- height: 14
27
+ height: 14,
28
+ enableIntersectionObserver: false
28
29
  }
29
30
  );
30
31
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "9.4.27",
3
+ "version": "9.4.28",
4
4
  "license": "UNLICENSED",
5
5
  "description": "M4L Components",
6
6
  "lint-staged": {