@equinor/cpl-compact-autocomplete 0.0.8 → 0.0.9

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
@@ -120,11 +120,19 @@ function CompactAutocomplete(_a) {
120
120
  const selectedLabels = optionLabel ? selectedOptions == null ? void 0 : selectedOptions.map((option) => optionLabel(option)) : selectedOptions;
121
121
  return selectedLabels == null ? void 0 : selectedLabels.join(", ");
122
122
  }, [multiple, optionLabel, selectedOptions]);
123
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(CompactAutocompleteWrapper, { children: [
123
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(CompactAutocompleteWrapper, { onClick: handleClick, children: [
124
124
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CompactAutocompleteLabel, { 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
+ function handleClick(event) {
129
+ var _a;
130
+ const clickedLabel = ((_a = event.target) == null ? void 0 : _a.nodeName) === "LABEL";
131
+ if (!clickedLabel) {
132
+ event.stopPropagation();
133
+ event.preventDefault();
134
+ }
135
+ }
128
136
  var CPLAutocompleteWrapper = import_styled_components3.default.div`
129
137
  div:has(input) {
130
138
  box-shadow: none;
package/dist/index.mjs CHANGED
@@ -85,11 +85,19 @@ function CompactAutocomplete(_a) {
85
85
  const selectedLabels = optionLabel ? selectedOptions == null ? void 0 : selectedOptions.map((option) => optionLabel(option)) : selectedOptions;
86
86
  return selectedLabels == null ? void 0 : selectedLabels.join(", ");
87
87
  }, [multiple, optionLabel, selectedOptions]);
88
- return /* @__PURE__ */ jsxs(CompactAutocompleteWrapper, { children: [
88
+ return /* @__PURE__ */ jsxs(CompactAutocompleteWrapper, { onClick: handleClick, children: [
89
89
  /* @__PURE__ */ jsx(CompactAutocompleteLabel, { children: label }),
90
90
  /* @__PURE__ */ jsx(CPLAutocompleteWrapper, { children: /* @__PURE__ */ jsx(Autocomplete, __spreadValues({ label: null, placeholder, ref: autocompleteRef }, props)) })
91
91
  ] });
92
92
  }
93
+ function handleClick(event) {
94
+ var _a;
95
+ const clickedLabel = ((_a = event.target) == null ? void 0 : _a.nodeName) === "LABEL";
96
+ if (!clickedLabel) {
97
+ event.stopPropagation();
98
+ event.preventDefault();
99
+ }
100
+ }
93
101
  var CPLAutocompleteWrapper = styled3.div`
94
102
  div:has(input) {
95
103
  box-shadow: none;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/cpl-compact-autocomplete",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",