@telia/teddy 0.2.11 → 0.2.13

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.
@@ -22,6 +22,8 @@ const styles = {
22
22
  scaleInAnimation
23
23
  };
24
24
  function setCursorOnInput(e) {
25
+ if (e.defaultPrevented)
26
+ return;
25
27
  const target = e == null ? void 0 : e.target;
26
28
  if (target.closest("input, button, a"))
27
29
  return;
@@ -45,10 +47,23 @@ const Root = React.forwardRef(
45
47
  const classes = clsx([styles[`${rootClassName}`]], className);
46
48
  const inputRef = React.useRef(null);
47
49
  const [isDirty, setIsDirty] = React.useState(false);
48
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { ...props, onPointerDown: setCursorOnInput, ref: forwardRef, className: classes, children: [
49
- /* @__PURE__ */ jsxRuntime.jsx(InputGroupContext.Provider, { value: { isDirty, setIsDirty, inputRef }, children }),
50
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx(styles[`${rootClassName}__frame`], frameClassName) })
51
- ] });
50
+ return /* @__PURE__ */ jsxRuntime.jsxs(
51
+ "div",
52
+ {
53
+ ...props,
54
+ onPointerDown: (e) => {
55
+ var _a;
56
+ (_a = props.onPointerDown) == null ? void 0 : _a.call(props, e);
57
+ setCursorOnInput(e);
58
+ },
59
+ ref: forwardRef,
60
+ className: classes,
61
+ children: [
62
+ /* @__PURE__ */ jsxRuntime.jsx(InputGroupContext.Provider, { value: { isDirty, setIsDirty, inputRef }, children }),
63
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx(styles[`${rootClassName}__frame`], frameClassName) })
64
+ ]
65
+ }
66
+ );
52
67
  }
53
68
  );
54
69
  Root.displayName = "Root";
@@ -20,6 +20,8 @@ const styles = {
20
20
  scaleInAnimation
21
21
  };
22
22
  function setCursorOnInput(e) {
23
+ if (e.defaultPrevented)
24
+ return;
23
25
  const target = e == null ? void 0 : e.target;
24
26
  if (target.closest("input, button, a"))
25
27
  return;
@@ -43,10 +45,23 @@ const Root = React__default.forwardRef(
43
45
  const classes = clsx([styles[`${rootClassName}`]], className);
44
46
  const inputRef = React__default.useRef(null);
45
47
  const [isDirty, setIsDirty] = React__default.useState(false);
46
- return /* @__PURE__ */ jsxs("div", { ...props, onPointerDown: setCursorOnInput, ref: forwardRef, className: classes, children: [
47
- /* @__PURE__ */ jsx(InputGroupContext.Provider, { value: { isDirty, setIsDirty, inputRef }, children }),
48
- /* @__PURE__ */ jsx("div", { className: clsx(styles[`${rootClassName}__frame`], frameClassName) })
49
- ] });
48
+ return /* @__PURE__ */ jsxs(
49
+ "div",
50
+ {
51
+ ...props,
52
+ onPointerDown: (e) => {
53
+ var _a;
54
+ (_a = props.onPointerDown) == null ? void 0 : _a.call(props, e);
55
+ setCursorOnInput(e);
56
+ },
57
+ ref: forwardRef,
58
+ className: classes,
59
+ children: [
60
+ /* @__PURE__ */ jsx(InputGroupContext.Provider, { value: { isDirty, setIsDirty, inputRef }, children }),
61
+ /* @__PURE__ */ jsx("div", { className: clsx(styles[`${rootClassName}__frame`], frameClassName) })
62
+ ]
63
+ }
64
+ );
50
65
  }
51
66
  );
52
67
  Root.displayName = "Root";
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "pnpm": ">=9"
21
21
  },
22
22
  "private": false,
23
- "version": "0.2.11",
23
+ "version": "0.2.13",
24
24
  "sideEffects": [
25
25
  "**/*.css",
26
26
  "**/*.svg"