@uniformdev/design-system 20.26.2 → 20.26.3-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/esm/index.js CHANGED
@@ -4621,6 +4621,12 @@ var Fieldset = React7.forwardRef(
4621
4621
  // src/components/Input/Input.tsx
4622
4622
  import * as React8 from "react";
4623
4623
 
4624
+ // src/utils/disableMouseWheelEvent.ts
4625
+ var disableMouseWheelEvent = (e) => {
4626
+ e.stopPropagation();
4627
+ e.currentTarget.blur();
4628
+ };
4629
+
4624
4630
  // src/components/Input/Label.tsx
4625
4631
  import { jsx as jsx36 } from "@emotion/react/jsx-runtime";
4626
4632
  var Label = ({ children, className, testId, ...props }) => {
@@ -4655,8 +4661,10 @@ var Input = React8.forwardRef(
4655
4661
  classNameContainer,
4656
4662
  classNameControl,
4657
4663
  classNameLabel,
4664
+ enableMouseWheel = false,
4658
4665
  ...props
4659
4666
  }, ref) => {
4667
+ const isNumberInputAndMouseWheelDisabled = enableMouseWheel !== true && props.type === "number";
4660
4668
  return /* @__PURE__ */ jsxs22(
4661
4669
  "div",
4662
4670
  {
@@ -4691,6 +4699,7 @@ var Input = React8.forwardRef(
4691
4699
  ],
4692
4700
  "aria-label": showLabel || typeof label !== "string" ? void 0 : label,
4693
4701
  className: typeof classNameControl === "string" ? classNameControl : "",
4702
+ onWheel: isNumberInputAndMouseWheelDisabled ? disableMouseWheelEvent : void 0,
4694
4703
  ...props,
4695
4704
  ref
4696
4705
  }
@@ -12126,23 +12135,23 @@ var ParameterInput = forwardRef23((props, ref) => {
12126
12135
  const { shellProps, innerProps } = extractParameterProps(props);
12127
12136
  return /* @__PURE__ */ jsx122(ParameterShell, { "data-testid": "parameter-input", ...shellProps, children: /* @__PURE__ */ jsx122(ParameterInputInner, { ref, ...innerProps }) });
12128
12137
  });
12129
- var ParameterInputInner = forwardRef23(
12130
- ({ ...props }, ref) => {
12131
- const { id, label, hiddenLabel } = useParameterShell();
12132
- return /* @__PURE__ */ jsx122(
12133
- "input",
12134
- {
12135
- css: input3,
12136
- id,
12137
- type: props.type || "text",
12138
- "aria-label": hiddenLabel && typeof label === "string" ? label : void 0,
12139
- autoComplete: "off",
12140
- ref,
12141
- ...props
12142
- }
12143
- );
12144
- }
12145
- );
12138
+ var ParameterInputInner = forwardRef23(({ enableMouseWheel = false, ...props }, ref) => {
12139
+ const { id, label, hiddenLabel } = useParameterShell();
12140
+ const isNumberInputAndMouseWheelDisabled = enableMouseWheel !== true && props.type === "number";
12141
+ return /* @__PURE__ */ jsx122(
12142
+ "input",
12143
+ {
12144
+ css: input3,
12145
+ id,
12146
+ type: props.type || "text",
12147
+ "aria-label": hiddenLabel && typeof label === "string" ? label : void 0,
12148
+ autoComplete: "off",
12149
+ ref,
12150
+ onWheel: isNumberInputAndMouseWheelDisabled ? disableMouseWheelEvent : void 0,
12151
+ ...props
12152
+ }
12153
+ );
12154
+ });
12146
12155
 
12147
12156
  // src/components/ParameterInputs/ParameterLink.tsx
12148
12157
  import { forwardRef as forwardRef24 } from "react";
@@ -12858,7 +12867,9 @@ import { useCallback as useCallback8, useEffect as useEffect17, useRef as useRef
12858
12867
 
12859
12868
  // src/components/ParameterInputs/rich-text/utils.ts
12860
12869
  import { $isAtNodeEnd } from "@lexical/selection";
12861
- import { $isElementNode } from "lexical";
12870
+ import {
12871
+ $isElementNode
12872
+ } from "lexical";
12862
12873
  var getElementNodesInSelection = (selection) => {
12863
12874
  const nodesInSelection = selection.getNodes();
12864
12875
  if (nodesInSelection.length === 0) {
@@ -12889,6 +12900,27 @@ var getSelectedNode = (selection) => {
12889
12900
  return $isAtNodeEnd(anchor) ? anchorNode : focusNode;
12890
12901
  }
12891
12902
  };
12903
+ var walkSerializedEditorState = (node, callback) => {
12904
+ callback(node);
12905
+ for (const child of node.children) {
12906
+ if ("children" in child) {
12907
+ walkSerializedEditorState(child, callback);
12908
+ } else {
12909
+ callback(child);
12910
+ }
12911
+ }
12912
+ };
12913
+ var normalizeStateForDeepEqualComparison = (editorState) => {
12914
+ walkSerializedEditorState(editorState.root, (node) => {
12915
+ if ("direction" in node) {
12916
+ node.direction = null;
12917
+ }
12918
+ if ("textFormat" in node) {
12919
+ delete node.textFormat;
12920
+ }
12921
+ });
12922
+ return editorState;
12923
+ };
12892
12924
 
12893
12925
  // src/components/ParameterInputs/rich-text/LinkNodePlugin.tsx
12894
12926
  import { Fragment as Fragment15, jsx as jsx126, jsxs as jsxs84 } from "@emotion/react/jsx-runtime";
@@ -15122,7 +15154,12 @@ var RichText = ({
15122
15154
  useEffect23(() => {
15123
15155
  const removeUpdateListener = editor.registerUpdateListener(({ editorState, prevEditorState, tags }) => {
15124
15156
  requestAnimationFrame(() => {
15125
- if (!deepEqual2(editorState.toJSON(), prevEditorState.toJSON())) {
15157
+ const previousEditorState = prevEditorState.toJSON();
15158
+ const currentEditorState = editorState.toJSON();
15159
+ if (!deepEqual2(
15160
+ normalizeStateForDeepEqualComparison(currentEditorState),
15161
+ normalizeStateForDeepEqualComparison(previousEditorState)
15162
+ )) {
15126
15163
  onChange == null ? void 0 : onChange(editorState.toJSON(), tags);
15127
15164
  }
15128
15165
  });
package/dist/index.d.mts CHANGED
@@ -2045,6 +2045,11 @@ type InputProps = React$1.InputHTMLAttributes<HTMLInputElement> & {
2045
2045
  * (optional) sets an overriding classname on the label element
2046
2046
  * @deprecated */
2047
2047
  classNameLabel?: string | SerializedStyles;
2048
+ /**
2049
+ * If true, the input will allow mouse wheel scrolling to change the value.
2050
+ * @default false
2051
+ */
2052
+ enableMouseWheel?: boolean;
2048
2053
  };
2049
2054
  /**
2050
2055
  * Input Component
@@ -2087,6 +2092,11 @@ declare const Input: React$1.ForwardRefExoticComponent<React$1.InputHTMLAttribut
2087
2092
  * (optional) sets an overriding classname on the label element
2088
2093
  * @deprecated */
2089
2094
  classNameLabel?: string | SerializedStyles;
2095
+ /**
2096
+ * If true, the input will allow mouse wheel scrolling to change the value.
2097
+ * @default false
2098
+ */
2099
+ enableMouseWheel?: boolean;
2090
2100
  } & React$1.RefAttributes<HTMLInputElement>>;
2091
2101
 
2092
2102
  /**
@@ -3207,8 +3217,16 @@ declare function ParameterImagePreview({ imageSrc }: {
3207
3217
  imageSrc: string;
3208
3218
  }): _emotion_react_jsx_runtime.JSX.Element | null;
3209
3219
 
3210
- type ParameterInputProps = CommonParameterInputProps & React.InputHTMLAttributes<HTMLInputElement>;
3211
- /** @example <ParameterInput label="label value" id="my-input" /> */
3220
+ type ParameterInputProps = CommonParameterInputProps & React.InputHTMLAttributes<HTMLInputElement> & {
3221
+ /**
3222
+ * If true, the input will allow mouse wheel scrolling to change the value.
3223
+ * @default false
3224
+ */
3225
+ enableMouseWheel?: boolean;
3226
+ };
3227
+ /** @example <ParameterInput label="label value" id="my-input" />
3228
+ * @example <ParameterInput label="Number input" id="my-number" type="number" enableMouseWheel={false} />
3229
+ */
3212
3230
  declare const ParameterInput: React$1.ForwardRefExoticComponent<CommonParameterProps & {
3213
3231
  caption?: string;
3214
3232
  menuItems?: React$1.ReactNode;
@@ -3216,8 +3234,16 @@ declare const ParameterInput: React$1.ForwardRefExoticComponent<CommonParameterP
3216
3234
  errorTestId?: string;
3217
3235
  captionTestId?: string;
3218
3236
  title?: string;
3219
- } & React$1.InputHTMLAttributes<HTMLInputElement> & React$1.RefAttributes<HTMLInputElement>>;
3220
- declare const ParameterInputInner: React$1.ForwardRefExoticComponent<React$1.InputHTMLAttributes<HTMLInputElement> & React$1.RefAttributes<HTMLInputElement>>;
3237
+ } & React$1.InputHTMLAttributes<HTMLInputElement> & {
3238
+ /**
3239
+ * If true, the input will allow mouse wheel scrolling to change the value.
3240
+ * @default false
3241
+ */
3242
+ enableMouseWheel?: boolean;
3243
+ } & React$1.RefAttributes<HTMLInputElement>>;
3244
+ declare const ParameterInputInner: React$1.ForwardRefExoticComponent<React$1.InputHTMLAttributes<HTMLInputElement> & {
3245
+ enableMouseWheel?: boolean;
3246
+ } & React$1.RefAttributes<HTMLInputElement>>;
3221
3247
 
3222
3248
  type ParameterLabelProps = HTMLAttributes<HTMLLabelElement> & {
3223
3249
  /** sets the value for label and id on the input field */
package/dist/index.d.ts CHANGED
@@ -2045,6 +2045,11 @@ type InputProps = React$1.InputHTMLAttributes<HTMLInputElement> & {
2045
2045
  * (optional) sets an overriding classname on the label element
2046
2046
  * @deprecated */
2047
2047
  classNameLabel?: string | SerializedStyles;
2048
+ /**
2049
+ * If true, the input will allow mouse wheel scrolling to change the value.
2050
+ * @default false
2051
+ */
2052
+ enableMouseWheel?: boolean;
2048
2053
  };
2049
2054
  /**
2050
2055
  * Input Component
@@ -2087,6 +2092,11 @@ declare const Input: React$1.ForwardRefExoticComponent<React$1.InputHTMLAttribut
2087
2092
  * (optional) sets an overriding classname on the label element
2088
2093
  * @deprecated */
2089
2094
  classNameLabel?: string | SerializedStyles;
2095
+ /**
2096
+ * If true, the input will allow mouse wheel scrolling to change the value.
2097
+ * @default false
2098
+ */
2099
+ enableMouseWheel?: boolean;
2090
2100
  } & React$1.RefAttributes<HTMLInputElement>>;
2091
2101
 
2092
2102
  /**
@@ -3207,8 +3217,16 @@ declare function ParameterImagePreview({ imageSrc }: {
3207
3217
  imageSrc: string;
3208
3218
  }): _emotion_react_jsx_runtime.JSX.Element | null;
3209
3219
 
3210
- type ParameterInputProps = CommonParameterInputProps & React.InputHTMLAttributes<HTMLInputElement>;
3211
- /** @example <ParameterInput label="label value" id="my-input" /> */
3220
+ type ParameterInputProps = CommonParameterInputProps & React.InputHTMLAttributes<HTMLInputElement> & {
3221
+ /**
3222
+ * If true, the input will allow mouse wheel scrolling to change the value.
3223
+ * @default false
3224
+ */
3225
+ enableMouseWheel?: boolean;
3226
+ };
3227
+ /** @example <ParameterInput label="label value" id="my-input" />
3228
+ * @example <ParameterInput label="Number input" id="my-number" type="number" enableMouseWheel={false} />
3229
+ */
3212
3230
  declare const ParameterInput: React$1.ForwardRefExoticComponent<CommonParameterProps & {
3213
3231
  caption?: string;
3214
3232
  menuItems?: React$1.ReactNode;
@@ -3216,8 +3234,16 @@ declare const ParameterInput: React$1.ForwardRefExoticComponent<CommonParameterP
3216
3234
  errorTestId?: string;
3217
3235
  captionTestId?: string;
3218
3236
  title?: string;
3219
- } & React$1.InputHTMLAttributes<HTMLInputElement> & React$1.RefAttributes<HTMLInputElement>>;
3220
- declare const ParameterInputInner: React$1.ForwardRefExoticComponent<React$1.InputHTMLAttributes<HTMLInputElement> & React$1.RefAttributes<HTMLInputElement>>;
3237
+ } & React$1.InputHTMLAttributes<HTMLInputElement> & {
3238
+ /**
3239
+ * If true, the input will allow mouse wheel scrolling to change the value.
3240
+ * @default false
3241
+ */
3242
+ enableMouseWheel?: boolean;
3243
+ } & React$1.RefAttributes<HTMLInputElement>>;
3244
+ declare const ParameterInputInner: React$1.ForwardRefExoticComponent<React$1.InputHTMLAttributes<HTMLInputElement> & {
3245
+ enableMouseWheel?: boolean;
3246
+ } & React$1.RefAttributes<HTMLInputElement>>;
3221
3247
 
3222
3248
  type ParameterLabelProps = HTMLAttributes<HTMLLabelElement> & {
3223
3249
  /** sets the value for label and id on the input field */
package/dist/index.js CHANGED
@@ -6368,6 +6368,13 @@ var Fieldset = React7.forwardRef(
6368
6368
  init_emotion_jsx_shim();
6369
6369
  var React8 = __toESM(require("react"));
6370
6370
 
6371
+ // src/utils/disableMouseWheelEvent.ts
6372
+ init_emotion_jsx_shim();
6373
+ var disableMouseWheelEvent = (e) => {
6374
+ e.stopPropagation();
6375
+ e.currentTarget.blur();
6376
+ };
6377
+
6371
6378
  // src/components/Input/Label.tsx
6372
6379
  init_emotion_jsx_shim();
6373
6380
  var import_jsx_runtime36 = require("@emotion/react/jsx-runtime");
@@ -6403,8 +6410,10 @@ var Input = React8.forwardRef(
6403
6410
  classNameContainer,
6404
6411
  classNameControl,
6405
6412
  classNameLabel,
6413
+ enableMouseWheel = false,
6406
6414
  ...props
6407
6415
  }, ref) => {
6416
+ const isNumberInputAndMouseWheelDisabled = enableMouseWheel !== true && props.type === "number";
6408
6417
  return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
6409
6418
  "div",
6410
6419
  {
@@ -6439,6 +6448,7 @@ var Input = React8.forwardRef(
6439
6448
  ],
6440
6449
  "aria-label": showLabel || typeof label !== "string" ? void 0 : label,
6441
6450
  className: typeof classNameControl === "string" ? classNameControl : "",
6451
+ onWheel: isNumberInputAndMouseWheelDisabled ? disableMouseWheelEvent : void 0,
6442
6452
  ...props,
6443
6453
  ref
6444
6454
  }
@@ -14042,23 +14052,23 @@ var ParameterInput = (0, import_react142.forwardRef)((props, ref) => {
14042
14052
  const { shellProps, innerProps } = extractParameterProps(props);
14043
14053
  return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(ParameterShell, { "data-testid": "parameter-input", ...shellProps, children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(ParameterInputInner, { ref, ...innerProps }) });
14044
14054
  });
14045
- var ParameterInputInner = (0, import_react142.forwardRef)(
14046
- ({ ...props }, ref) => {
14047
- const { id, label, hiddenLabel } = useParameterShell();
14048
- return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
14049
- "input",
14050
- {
14051
- css: input3,
14052
- id,
14053
- type: props.type || "text",
14054
- "aria-label": hiddenLabel && typeof label === "string" ? label : void 0,
14055
- autoComplete: "off",
14056
- ref,
14057
- ...props
14058
- }
14059
- );
14060
- }
14061
- );
14055
+ var ParameterInputInner = (0, import_react142.forwardRef)(({ enableMouseWheel = false, ...props }, ref) => {
14056
+ const { id, label, hiddenLabel } = useParameterShell();
14057
+ const isNumberInputAndMouseWheelDisabled = enableMouseWheel !== true && props.type === "number";
14058
+ return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
14059
+ "input",
14060
+ {
14061
+ css: input3,
14062
+ id,
14063
+ type: props.type || "text",
14064
+ "aria-label": hiddenLabel && typeof label === "string" ? label : void 0,
14065
+ autoComplete: "off",
14066
+ ref,
14067
+ onWheel: isNumberInputAndMouseWheelDisabled ? disableMouseWheelEvent : void 0,
14068
+ ...props
14069
+ }
14070
+ );
14071
+ });
14062
14072
 
14063
14073
  // src/components/ParameterInputs/ParameterLink.tsx
14064
14074
  init_emotion_jsx_shim();
@@ -14791,6 +14801,27 @@ var getSelectedNode = (selection) => {
14791
14801
  return (0, import_selection.$isAtNodeEnd)(anchor) ? anchorNode : focusNode;
14792
14802
  }
14793
14803
  };
14804
+ var walkSerializedEditorState = (node, callback) => {
14805
+ callback(node);
14806
+ for (const child of node.children) {
14807
+ if ("children" in child) {
14808
+ walkSerializedEditorState(child, callback);
14809
+ } else {
14810
+ callback(child);
14811
+ }
14812
+ }
14813
+ };
14814
+ var normalizeStateForDeepEqualComparison = (editorState) => {
14815
+ walkSerializedEditorState(editorState.root, (node) => {
14816
+ if ("direction" in node) {
14817
+ node.direction = null;
14818
+ }
14819
+ if ("textFormat" in node) {
14820
+ delete node.textFormat;
14821
+ }
14822
+ });
14823
+ return editorState;
14824
+ };
14794
14825
 
14795
14826
  // src/components/ParameterInputs/rich-text/LinkNodePlugin.tsx
14796
14827
  var import_jsx_runtime126 = require("@emotion/react/jsx-runtime");
@@ -16972,7 +17003,12 @@ var RichText = ({
16972
17003
  (0, import_react158.useEffect)(() => {
16973
17004
  const removeUpdateListener = editor.registerUpdateListener(({ editorState, prevEditorState, tags }) => {
16974
17005
  requestAnimationFrame(() => {
16975
- if (!(0, import_fast_equals2.deepEqual)(editorState.toJSON(), prevEditorState.toJSON())) {
17006
+ const previousEditorState = prevEditorState.toJSON();
17007
+ const currentEditorState = editorState.toJSON();
17008
+ if (!(0, import_fast_equals2.deepEqual)(
17009
+ normalizeStateForDeepEqualComparison(currentEditorState),
17010
+ normalizeStateForDeepEqualComparison(previousEditorState)
17011
+ )) {
16976
17012
  onChange == null ? void 0 : onChange(editorState.toJSON(), tags);
16977
17013
  }
16978
17014
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/design-system",
3
- "version": "20.26.2",
3
+ "version": "20.26.3-alpha.7+2e8db29af3",
4
4
  "description": "Uniform design system components",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "exports": {
@@ -38,8 +38,8 @@
38
38
  "@storybook/theming": "^8.3.3",
39
39
  "@types/react": "18.3.11",
40
40
  "@types/react-dom": "18.3.1",
41
- "@uniformdev/canvas": "^20.26.2",
42
- "@uniformdev/richtext": "^20.26.2",
41
+ "@uniformdev/canvas": "^20.26.3-alpha.7+2e8db29af3",
42
+ "@uniformdev/richtext": "^20.26.3-alpha.7+2e8db29af3",
43
43
  "@vitest/coverage-v8": "^3.1.2",
44
44
  "autoprefixer": "10.4.21",
45
45
  "hygen": "6.2.11",
@@ -91,5 +91,5 @@
91
91
  "publishConfig": {
92
92
  "access": "public"
93
93
  },
94
- "gitHead": "e9f8f8081d816af23d625d40d1a0557979b85feb"
94
+ "gitHead": "2e8db29af31430de36e78f47cffc374433450419"
95
95
  }