@equinor/cpl-compact-autocomplete 0.0.9 → 0.0.10

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
@@ -121,13 +121,14 @@ function CompactAutocomplete(_a) {
121
121
  return selectedLabels == null ? void 0 : selectedLabels.join(", ");
122
122
  }, [multiple, optionLabel, selectedOptions]);
123
123
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(CompactAutocompleteWrapper, { onClick: handleClick, children: [
124
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CompactAutocompleteLabel, { children: label }),
124
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CompactAutocompleteLabel, { className: LABEL_CLASS_NAME, children: label }),
125
125
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CPLAutocompleteWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_eds_core_react.Autocomplete, __spreadValues({ label: null, placeholder, ref: autocompleteRef }, props)) })
126
126
  ] });
127
127
  }
128
+ var LABEL_CLASS_NAME = "cpl-compact-autocomplete-label";
128
129
  function handleClick(event) {
129
130
  var _a;
130
- const clickedLabel = ((_a = event.target) == null ? void 0 : _a.nodeName) === "LABEL";
131
+ const clickedLabel = (_a = event.target) == null ? void 0 : _a.classList.contains(LABEL_CLASS_NAME);
131
132
  if (!clickedLabel) {
132
133
  event.stopPropagation();
133
134
  event.preventDefault();
package/dist/index.mjs CHANGED
@@ -86,13 +86,14 @@ function CompactAutocomplete(_a) {
86
86
  return selectedLabels == null ? void 0 : selectedLabels.join(", ");
87
87
  }, [multiple, optionLabel, selectedOptions]);
88
88
  return /* @__PURE__ */ jsxs(CompactAutocompleteWrapper, { onClick: handleClick, children: [
89
- /* @__PURE__ */ jsx(CompactAutocompleteLabel, { children: label }),
89
+ /* @__PURE__ */ jsx(CompactAutocompleteLabel, { className: LABEL_CLASS_NAME, children: label }),
90
90
  /* @__PURE__ */ jsx(CPLAutocompleteWrapper, { children: /* @__PURE__ */ jsx(Autocomplete, __spreadValues({ label: null, placeholder, ref: autocompleteRef }, props)) })
91
91
  ] });
92
92
  }
93
+ var LABEL_CLASS_NAME = "cpl-compact-autocomplete-label";
93
94
  function handleClick(event) {
94
95
  var _a;
95
- const clickedLabel = ((_a = event.target) == null ? void 0 : _a.nodeName) === "LABEL";
96
+ const clickedLabel = (_a = event.target) == null ? void 0 : _a.classList.contains(LABEL_CLASS_NAME);
96
97
  if (!clickedLabel) {
97
98
  event.stopPropagation();
98
99
  event.preventDefault();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/cpl-compact-autocomplete",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",