@toptal/picasso-number-input 4.0.13-alpha-fx-6095-number-input-misses-type-button-353a18c00.1 → 4.0.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,6 +11,8 @@ export interface Props extends Omit<OmitInternalProps<OutlinedInputProps>, 'defa
11
11
  max?: number | string;
12
12
  /** Next value of the `input` element will be calculated based on step */
13
13
  step?: number | string;
14
+ /** Enable value change on mouse wheel */
15
+ enableChangeOnMouseWheel?: boolean;
14
16
  /** Should controls be hidden or not */
15
17
  hideControls?: boolean;
16
18
  /** Specify icon which should be rendered inside NumberInput */
@@ -1 +1 @@
1
- {"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../../../src/NumberInput/NumberInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAA6B,MAAM,OAAO,CAAA;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAI1E,OAAO,KAAK,EAAE,KAAK,IAAI,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AAKjF,MAAM,WAAW,KACf,SAAQ,IAAI,CACR,iBAAiB,CAAC,kBAAkB,CAAC,EACrC,cAAc,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAC/C,EACD,SAAS;IACX,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,4CAA4C;IAC5C,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACrB,4CAA4C;IAC5C,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACrB,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,uCAAuC;IACvC,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,+DAA+D;IAC/D,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,uDAAuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,6D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K,IAAI,CAAA;IAC/D,SAAS,CAAC,EAAE,UAAU,CAAA;CACvB;AAED,eAAO,MAAM,WAAW,gFAoFvB,CAAA;AAeD,eAAe,WAAW,CAAA"}
@@ -16,7 +16,7 @@ import { useCombinedRefs } from '@toptal/picasso-utils';
16
16
  import { twJoin } from '@toptal/picasso-tailwind-merge';
17
17
  import { NumberInputEndAdornment } from '../NumberInputEndAdornment';
18
18
  export const NumberInput = forwardRef(function NumberInput(props, ref) {
19
- const { step = 1, min = -Infinity, max = Infinity, hideControls, value, onChange, disabled, status, onResetClick, enableReset, width, icon, size, testIds, highlight } = props, rest = __rest(props, ["step", "min", "max", "hideControls", "value", "onChange", "disabled", "status", "onResetClick", "enableReset", "width", "icon", "size", "testIds", "highlight"]);
19
+ const { step = 1, min = -Infinity, max = Infinity, hideControls, enableChangeOnMouseWheel, value, onChange, disabled, status, onResetClick, enableReset, width, icon, size, testIds, highlight } = props, rest = __rest(props, ["step", "min", "max", "hideControls", "enableChangeOnMouseWheel", "value", "onChange", "disabled", "status", "onResetClick", "enableReset", "width", "icon", "size", "testIds", "highlight"]);
20
20
  const inputRef = useCombinedRefs(ref, useRef(null));
21
21
  const endAdornment = hideControls ? null : (React.createElement(NumberInputEndAdornment, { step: step, min: min, max: max, value: value, disabled: disabled, size: size, inputRef: inputRef }));
22
22
  const startAdornment = icon ? (React.createElement(InputAdornment, { position: 'start', disablePointerEvents: true }, icon)) : null;
@@ -29,7 +29,11 @@ export const NumberInput = forwardRef(function NumberInput(props, ref) {
29
29
  '[-moz-appearance:textfield]'),
30
30
  }, highlight: highlight, inputProps: Object.assign(Object.assign({}, rest), { step,
31
31
  min,
32
- max }), width: width, onResetClick: onResetClick, enableReset: enableReset, status: status, inputRef: inputRef, type: 'number', value: value, disabled: disabled, onChange: onChange, endAdornment: endAdornment, startAdornment: startAdornment, size: size, testIds: testIds }));
32
+ max,
33
+ // TODO: [FX-6102] Add test for wheel event
34
+ onWheel: enableChangeOnMouseWheel
35
+ ? undefined
36
+ : event => event.currentTarget.blur() }), width: width, onResetClick: onResetClick, enableReset: enableReset, status: status, inputRef: inputRef, type: 'number', value: value, disabled: disabled, onChange: onChange, endAdornment: endAdornment, startAdornment: startAdornment, size: size, testIds: testIds }));
33
37
  });
34
38
  NumberInput.defaultProps = {
35
39
  onChange: () => { },
@@ -1 +1 @@
1
- {"version":3,"file":"NumberInput.js","sourceRoot":"","sources":["../../../src/NumberInput/NumberInput.tsx"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAA;AAEvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAA;AA2BpE,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CACnC,SAAS,WAAW,CAAC,KAAK,EAAE,GAAG;IAC7B,MAAM,EACJ,IAAI,GAAG,CAAC,EACR,GAAG,GAAG,CAAC,QAAQ,EACf,GAAG,GAAG,QAAQ,EACd,YAAY,EACZ,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,WAAW,EACX,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,SAAS,KAEP,KAAK,EADJ,IAAI,UACL,KAAK,EAjBH,iKAiBL,CAAQ,CAAA;IAET,MAAM,QAAQ,GAAG,eAAe,CAC9B,GAAG,EACH,MAAM,CAAmB,IAAI,CAAC,CAC/B,CAAA;IAED,MAAM,YAAY,GAAG,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACzC,oBAAC,uBAAuB,IACtB,IAAI,EAAE,IAAI,EACV,GAAG,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HANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toptal/picasso-number-input",
3
- "version": "4.0.13-alpha-fx-6095-number-input-misses-type-button-353a18c00.1+353a18c00",
3
+ "version": "4.0.14",
4
4
  "description": "Toptal UI components library - NumberInput",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -22,34 +22,33 @@
22
22
  },
23
23
  "homepage": "https://github.com/toptal/picasso/tree/master/packages/picasso#readme",
24
24
  "dependencies": {
25
- "@toptal/picasso-container": "3.1.2-alpha-fx-6095-number-input-misses-type-button-353a18c00.1+353a18c00",
26
- "@toptal/picasso-form": "6.1.5-alpha-fx-6095-number-input-misses-type-button-353a18c00.1+353a18c00",
27
- "@toptal/picasso-icons": "1.8.2-alpha-fx-6095-number-input-misses-type-button-353a18c00.1+353a18c00",
28
- "@toptal/picasso-input-adornment": "3.0.6-alpha-fx-6095-number-input-misses-type-button-353a18c00.1+353a18c00",
29
- "@toptal/picasso-outlined-input": "4.0.13-alpha-fx-6095-number-input-misses-type-button-353a18c00.1+353a18c00",
30
- "@toptal/picasso-shared": "15.0.1-alpha-fx-6095-number-input-misses-type-button-353a18c00.254+353a18c00",
31
- "@toptal/picasso-utils": "3.0.1-alpha-fx-6095-number-input-misses-type-button-353a18c00.1+353a18c00"
25
+ "@toptal/picasso-container": "3.1.1",
26
+ "@toptal/picasso-form": "6.1.4",
27
+ "@toptal/picasso-icons": "1.8.1",
28
+ "@toptal/picasso-input-adornment": "3.0.5",
29
+ "@toptal/picasso-outlined-input": "4.0.12",
30
+ "@toptal/picasso-shared": "15.0.0",
31
+ "@toptal/picasso-utils": "3.0.0"
32
32
  },
33
33
  "sideEffects": [
34
34
  "**/styles.ts",
35
35
  "**/styles.js"
36
36
  ],
37
37
  "peerDependencies": {
38
- "@toptal/picasso-tailwind": ">=2.7",
39
38
  "@toptal/picasso-tailwind-merge": "^2.0.0",
39
+ "@toptal/picasso-tailwind": ">=2.7",
40
40
  "react": ">=16.12.0 < 19.0.0"
41
41
  },
42
42
  "exports": {
43
43
  ".": "./dist-package/src/index.js"
44
44
  },
45
45
  "devDependencies": {
46
- "@toptal/picasso-tailwind-merge": "2.0.3-alpha-fx-6095-number-input-misses-type-button-353a18c00.1+353a18c00",
47
- "@toptal/picasso-test-utils": "1.1.2-alpha-fx-6095-number-input-misses-type-button-353a18c00.254+353a18c00"
46
+ "@toptal/picasso-tailwind-merge": "2.0.2",
47
+ "@toptal/picasso-test-utils": "1.1.1"
48
48
  },
49
49
  "files": [
50
50
  "dist-package/**",
51
51
  "!dist-package/tsconfig.tsbuildinfo",
52
52
  "src"
53
- ],
54
- "gitHead": "353a18c00d04fe7c52e2ba8a52a4bc900ca33bda"
53
+ ]
55
54
  }
@@ -23,6 +23,8 @@ export interface Props
23
23
  max?: number | string
24
24
  /** Next value of the `input` element will be calculated based on step */
25
25
  step?: number | string
26
+ /** Enable value change on mouse wheel */
27
+ enableChangeOnMouseWheel?: boolean
26
28
  /** Should controls be hidden or not */
27
29
  hideControls?: boolean
28
30
  /** Specify icon which should be rendered inside NumberInput */
@@ -41,6 +43,7 @@ export const NumberInput = forwardRef<HTMLInputElement, Props>(
41
43
  min = -Infinity,
42
44
  max = Infinity,
43
45
  hideControls,
46
+ enableChangeOnMouseWheel,
44
47
  value,
45
48
  onChange,
46
49
  disabled,
@@ -96,6 +99,10 @@ export const NumberInput = forwardRef<HTMLInputElement, Props>(
96
99
  step,
97
100
  min,
98
101
  max,
102
+ // TODO: [FX-6102] Add test for wheel event
103
+ onWheel: enableChangeOnMouseWheel
104
+ ? undefined
105
+ : event => event.currentTarget.blur(),
99
106
  }}
100
107
  width={width}
101
108
  onResetClick={onResetClick}
package/LICENSE DELETED
@@ -1,20 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2021-2022 Toptal, LLC
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of
6
- this software and associated documentation files (the “Software”), to deal in
7
- the Software without restriction, including without limitation the rights to
8
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
- the Software, and to permit persons to whom the Software is furnished to do so,
10
- subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.