@toptal/picasso-number-input 1.0.26 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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;AAGjD,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAO1E,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,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAA;IAC/D,SAAS,CAAC,EAAE,UAAU,CAAA;CACvB;AAMD,eAAO,MAAM,WAAW,gFAqFvB,CAAA;AAeD,eAAe,WAAW,CAAA"}
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;AAO1E,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,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAA;IAC/D,SAAS,CAAC,EAAE,UAAU,CAAA;CACvB;AAED,eAAO,MAAM,WAAW,gFAyFvB,CAAA;AAeD,eAAe,WAAW,CAAA"}
@@ -10,15 +10,11 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import React, { forwardRef, useRef } from 'react';
13
- import { makeStyles } from '@material-ui/core/styles';
14
13
  import { OutlinedInput } from '@toptal/picasso-outlined-input';
15
14
  import { InputAdornment } from '@toptal/picasso-input-adornment';
16
15
  import { useCombinedRefs, usePropDeprecationWarning, } from '@toptal/picasso-utils';
17
- import styles from './styles';
16
+ import { twJoin } from '@toptal/picasso-tailwind-merge';
18
17
  import { NumberInputEndAdornment } from '../NumberInputEndAdornment';
19
- const useStyles = makeStyles(styles, {
20
- name: 'PicassoNumberInput',
21
- });
22
18
  export const NumberInput = forwardRef(function NumberInput(props, ref) {
23
19
  const { step = 1, min = -Infinity, max = Infinity, hideControls, value, onChange, disabled, error, status, onResetClick, enableReset, width, icon, size, testIds, highlight } = props, rest = __rest(props
24
20
  // TODO: [FX-4715]
@@ -30,13 +26,16 @@ export const NumberInput = forwardRef(function NumberInput(props, ref) {
30
26
  componentName: 'NumberInput',
31
27
  description: 'Use the `status` prop instead. `error` is deprecated and will be removed in the next major release.',
32
28
  });
33
- const classes = useStyles(props);
34
29
  const inputRef = useCombinedRefs(ref, useRef(null));
35
30
  const endAdornment = hideControls ? null : (React.createElement(NumberInputEndAdornment, { step: step, min: min, max: max, value: value, disabled: disabled, size: size, inputRef: inputRef }));
36
31
  const startAdornment = icon ? (React.createElement(InputAdornment, { position: 'start', disablePointerEvents: true }, icon)) : null;
37
32
  return (React.createElement(OutlinedInput, { classes: {
38
- root: classes.root,
39
- input: classes.input,
33
+ root: 'pr-0 cursor-text',
34
+ input: twJoin(
35
+ // required to remove arrows in WebKit based browsers
36
+ '[&::-webkit-outer-spin-button]:appearance-none [&::-webkit-outer-spin-button]:m-0 ', '[&::-webkit-inner-spin-button]:appearance-none [&::-webkit-inner-spin-button]:m-0 ',
37
+ // required to remove arrows in Firefox
38
+ '[-moz-appearance:textfield]'),
40
39
  }, highlight: highlight, inputProps: Object.assign(Object.assign({}, rest), { step,
41
40
  min,
42
41
  max }), width: width, onResetClick: onResetClick, enableReset: enableReset, status: error ? 'error' : status, inputRef: inputRef, type: 'number', value: value, disabled: disabled, onChange: onChange, endAdornment: endAdornment, startAdornment: startAdornment, size: size, testIds: testIds }));
@@ -1 +1 @@
1
- {"version":3,"file":"NumberInput.js","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AG,EAAE,QAAQ;IACb,YAAY,EAAE,KAAK;IACnB,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE,SAAS;CAClB,CAAA;AAED,WAAW,CAAC,WAAW,GAAG,aAAa,CAAA;AAEvC,eAAe,WAAW,CAAA"}
@@ -1,5 +1,6 @@
1
1
  import type { RefObject } from 'react';
2
2
  import type { BaseProps, SizeType } from '@toptal/picasso-shared';
3
+ export declare type Size = SizeType<'small' | 'medium' | 'large'>;
3
4
  export interface Props extends BaseProps {
4
5
  /** Value of the `input` element. */
5
6
  value?: string | number;
@@ -12,7 +13,7 @@ export interface Props extends BaseProps {
12
13
  /** Indicates whether component is in disabled state */
13
14
  disabled?: boolean;
14
15
  /** Component size */
15
- size?: SizeType<'small' | 'medium' | 'large'>;
16
+ size?: Size;
16
17
  /** Ref of the input element */
17
18
  inputRef: RefObject<HTMLInputElement>;
18
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"NumberInputEndAdornment.d.ts","sourceRoot":"","sources":["../../../src/NumberInputEndAdornment/NumberInputEndAdornment.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAejE,MAAM,WAAW,KAAM,SAAQ,SAAS;IACtC,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,uDAAuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,qBAAqB;IACrB,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,CAAA;IAC7C,+BAA+B;IAC/B,QAAQ,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAA;CACtC;AAiBD,eAAO,MAAM,uBAAuB;YAAW,KAAK;;;;;;;;;;CA2GnD,CAAA;AAaD,eAAe,uBAAuB,CAAA"}
1
+ {"version":3,"file":"NumberInputEndAdornment.d.ts","sourceRoot":"","sources":["../../../src/NumberInputEndAdornment/NumberInputEndAdornment.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAYjE,oBAAY,IAAI,GAAG,QAAQ,CAAC,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,CAAA;AAEzD,MAAM,WAAW,KAAM,SAAQ,SAAS;IACtC,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,uDAAuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,qBAAqB;IACrB,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,+BAA+B;IAC/B,QAAQ,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAA;CACtC;AAmBD,eAAO,MAAM,uBAAuB;YAAW,KAAK;;;;;;;;;;CAyHnD,CAAA;AAaD,eAAe,uBAAuB,CAAA"}
@@ -1,24 +1,22 @@
1
1
  import React from 'react';
2
- import { makeStyles } from '@material-ui/core/styles';
3
2
  import { isBrowser } from '@toptal/picasso-shared';
4
- import { ButtonBase } from '@material-ui/core';
5
- import cx from 'classnames';
6
3
  import { InputAdornment } from '@toptal/picasso-input-adornment';
7
4
  import { Container } from '@toptal/picasso-container';
8
5
  import { ArrowDownMinor16, ArrowUpMinor16, ArrowDownMinor24, ArrowUpMinor24, } from '@toptal/picasso-icons';
9
- import styles from './styles';
10
- const useStyles = makeStyles(styles, {
11
- name: 'NumberInputEndAdornment',
12
- });
6
+ import { twJoin } from '@toptal/picasso-tailwind-merge';
13
7
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
14
8
  const nativeInputValueSetter = isBrowser()
15
9
  ? Object.getOwnPropertyDescriptor(
16
10
  // eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
17
11
  window.HTMLInputElement.prototype, 'value').set
18
12
  : undefined;
13
+ const classBySize = {
14
+ small: 'h-3 w-[1.375rem]',
15
+ medium: 'h-4 w-[1.625rem]',
16
+ large: 'h-6 w-[2.125rem]',
17
+ };
19
18
  export const NumberInputEndAdornment = (props) => {
20
19
  const { step = 1, min = -Infinity, max = Infinity, value, disabled, size = 'medium', inputRef, } = props;
21
- const classes = useStyles(props);
22
20
  const normalizedStep = Number(step);
23
21
  const normalizedValue = Number(value);
24
22
  const normalizedMin = Number(min);
@@ -42,7 +40,7 @@ export const NumberInputEndAdornment = (props) => {
42
40
  return;
43
41
  }
44
42
  let nextValue = normalizedValue + normalizedStep;
45
- if (nextValue <= max) {
43
+ if (nextValue <= Number(max)) {
46
44
  if (normalizedValue < normalizedMin + normalizedStep) {
47
45
  nextValue = normalizedMin + normalizedStep;
48
46
  }
@@ -58,7 +56,7 @@ export const NumberInputEndAdornment = (props) => {
58
56
  return;
59
57
  }
60
58
  let nextValue = normalizedValue - normalizedStep;
61
- if (nextValue >= min) {
59
+ if (nextValue >= Number(min)) {
62
60
  if (normalizedValue > normalizedMax - normalizedStep) {
63
61
  nextValue = normalizedMax - normalizedStep;
64
62
  }
@@ -69,17 +67,32 @@ export const NumberInputEndAdornment = (props) => {
69
67
  fireEvent(nextValue);
70
68
  }
71
69
  };
72
- const rootClassName = cx({
73
- [classes.disabled]: disabled,
74
- }, classes[size], classes.root);
70
+ const rootClassName = twJoin(`flex relative items-center justify-center align-middle
71
+
72
+ p-0 bottom-0 cursor-pointer
73
+
74
+ text-graphite-700 decoration-graphite-700 bg-inherit bg-transparent
75
+
76
+ border-t-0 border-b-0 border-l border-r border-l-solid border-r-solid
77
+ border-l-gray-400 border-r-transparent
78
+
79
+ hover:bg-gray-400 hover:border-gray-400
80
+
81
+ [&+&]:border-t [&+&]:border-solid
82
+ [&+&]:border-t-gray-400
83
+
84
+ active:[&+&]:border-t active:[&+&]:border-t-solid
85
+ active:[&+&]:border-gray-500
86
+
87
+ active:bg-gray-500 active:border-t-gray-500
88
+
89
+ [&:first-child]:rounded-tr-sm [&:last-child]:rounded-br-sm
90
+
91
+ transition-[color,_border,_background] ease-out duration-350`, classBySize[size], disabled && 'opacity-[0.48]');
75
92
  return (React.createElement(InputAdornment, { position: 'end' },
76
93
  React.createElement(Container, { flex: true, direction: 'column', inline: true },
77
- React.createElement(ButtonBase, { disabled: disabled, classes: {
78
- root: rootClassName,
79
- }, onClick: handleUpClick }, size === 'large' ? React.createElement(ArrowUpMinor24, null) : React.createElement(ArrowUpMinor16, null)),
80
- React.createElement(ButtonBase, { disabled: disabled, classes: {
81
- root: rootClassName,
82
- }, onClick: handleDownClick }, size === 'large' ? React.createElement(ArrowDownMinor24, null) : React.createElement(ArrowDownMinor16, null)))));
94
+ React.createElement("button", { disabled: disabled, className: rootClassName, onClick: handleUpClick }, size === 'large' ? React.createElement(ArrowUpMinor24, null) : React.createElement(ArrowUpMinor16, null)),
95
+ React.createElement("button", { disabled: disabled, className: rootClassName, onClick: handleDownClick }, size === 'large' ? React.createElement(ArrowDownMinor24, null) : React.createElement(ArrowDownMinor16, null)))));
83
96
  };
84
97
  NumberInputEndAdornment.defaultProps = {
85
98
  min: -Infinity,
@@ -1 +1 @@
1
- {"version":3,"file":"NumberInputEndAdornment.js","sourceRoot":"","sources":["../../../src/NumberInputEndAdornment/NumberInputEndAdornment.tsx"],"names":[],"mappings":"AAEA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;YACzB,SAAS,CAAC,SAAS,CAAC,CAAA;SACrB;IACH,CAAC,CAAA;IAED,MAAM,aAAa,GAAG,MAAM,CAC1B;;;;;;;;;;;;;;;;;;;;;iEAqB6D,EAC7D,WAAW,CAAC,IAAI,CAAC,EACjB,QAAQ,IAAI,gBAAgB,CAC7B,CAAA;IAED,OAAO,CACL,oBAAC,cAAc,IAAC,QAAQ,EAAC,KAAK;QAC5B,oBAAC,SAAS,IAAC,IAAI,QAAC,SAAS,EAAC,QAAQ,EAAC,MAAM;YACvC,gCACE,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,aAAa,IAErB,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,oBAAC,cAAc,OAAG,CAAC,CAAC,CAAC,oBAAC,cAAc,OAAG,CACpD;YAET,gCACE,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,eAAe,IAEvB,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,oBAAC,gBAAgB,OAAG,CAAC,CAAC,CAAC,oBAAC,gBAAgB,OAAG,CACxD,CACC,CACG,CAClB,CAAA;AACH,CAAC,CAAA;AAED,uBAAuB,CAAC,YAAY,GAAG;IACrC,GAAG,EAAE,CAAC,QAAQ;IACd,GAAG,EAAE,QAAQ;IACb,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,QAAQ,EAAE,KAAK;IACf,IAAI,EAAE,QAAQ;CACf,CAAA;AAED,uBAAuB,CAAC,WAAW,GAAG,yBAAyB,CAAA;AAE/D,eAAe,uBAAuB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toptal/picasso-number-input",
3
- "version": "1.0.26",
3
+ "version": "2.0.0",
4
4
  "description": "Toptal UI components library - NumberInput",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -22,27 +22,28 @@
22
22
  },
23
23
  "homepage": "https://github.com/toptal/picasso/tree/master/packages/picasso#readme",
24
24
  "dependencies": {
25
- "@toptal/picasso-container": "1.0.3",
26
- "@toptal/picasso-form": "3.0.7",
25
+ "@toptal/picasso-container": "2.0.0",
26
+ "@toptal/picasso-form": "4.0.0",
27
27
  "@toptal/picasso-icons": "1.5.0",
28
- "@toptal/picasso-input-adornment": "1.0.8",
29
- "@toptal/picasso-outlined-input": "1.1.5",
28
+ "@toptal/picasso-input-adornment": "2.0.0",
29
+ "@toptal/picasso-outlined-input": "2.0.0",
30
30
  "@toptal/picasso-shared": "15.0.0",
31
- "@toptal/picasso-utils": "1.0.3",
32
- "classnames": "^2.5.1"
31
+ "@toptal/picasso-utils": "1.0.3"
33
32
  },
34
33
  "sideEffects": [
35
34
  "**/styles.ts",
36
35
  "**/styles.js"
37
36
  ],
38
37
  "peerDependencies": {
39
- "@material-ui/core": "4.12.4",
38
+ "@toptal/picasso-tailwind-merge": "^1.0.1",
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": "1.2.0",
46
47
  "@toptal/picasso-test-utils": "1.1.1"
47
48
  },
48
49
  "files": [
@@ -1,7 +1,5 @@
1
1
  import type { ReactNode } from 'react'
2
2
  import React, { forwardRef, useRef } from 'react'
3
- import type { Theme } from '@material-ui/core/styles'
4
- import { makeStyles } from '@material-ui/core/styles'
5
3
  import type { BaseProps, OmitInternalProps } from '@toptal/picasso-shared'
6
4
  import { OutlinedInput } from '@toptal/picasso-outlined-input'
7
5
  import { InputAdornment } from '@toptal/picasso-input-adornment'
@@ -10,8 +8,8 @@ import {
10
8
  usePropDeprecationWarning,
11
9
  } from '@toptal/picasso-utils'
12
10
  import type { Props as OutlinedInputProps } from '@toptal/picasso-outlined-input'
11
+ import { twJoin } from '@toptal/picasso-tailwind-merge'
13
12
 
14
- import styles from './styles'
15
13
  import { NumberInputEndAdornment } from '../NumberInputEndAdornment'
16
14
 
17
15
  export interface Props
@@ -39,10 +37,6 @@ export interface Props
39
37
  highlight?: 'autofill'
40
38
  }
41
39
 
42
- const useStyles = makeStyles<Theme, Props>(styles, {
43
- name: 'PicassoNumberInput',
44
- })
45
-
46
40
  export const NumberInput = forwardRef<HTMLInputElement, Props>(
47
41
  function NumberInput(props, ref) {
48
42
  const {
@@ -74,8 +68,6 @@ export const NumberInput = forwardRef<HTMLInputElement, Props>(
74
68
  'Use the `status` prop instead. `error` is deprecated and will be removed in the next major release.',
75
69
  })
76
70
 
77
- const classes = useStyles(props)
78
-
79
71
  const inputRef = useCombinedRefs<HTMLInputElement>(
80
72
  ref,
81
73
  useRef<HTMLInputElement>(null)
@@ -102,8 +94,14 @@ export const NumberInput = forwardRef<HTMLInputElement, Props>(
102
94
  return (
103
95
  <OutlinedInput
104
96
  classes={{
105
- root: classes.root,
106
- input: classes.input,
97
+ root: 'pr-0 cursor-text',
98
+ input: twJoin(
99
+ // required to remove arrows in WebKit based browsers
100
+ '[&::-webkit-outer-spin-button]:appearance-none [&::-webkit-outer-spin-button]:m-0 ',
101
+ '[&::-webkit-inner-spin-button]:appearance-none [&::-webkit-inner-spin-button]:m-0 ',
102
+ // required to remove arrows in Firefox
103
+ '[-moz-appearance:textfield]'
104
+ ),
107
105
  }}
108
106
  highlight={highlight}
109
107
  inputProps={{
@@ -5,11 +5,11 @@ exports[`NumberInput renders 1`] = `
5
5
  class="Picasso-root"
6
6
  >
7
7
  <div
8
- class="MuiInputBase-root MuiOutlinedInput-root PicassoOutlinedInput-root PicassoNumberInput-root PicassoOutlinedInput-rootAuto PicassoOutlinedInput-rootMedium MuiInputBase-adornedEnd MuiOutlinedInput-adornedEnd"
8
+ class="base-Input base-Input relative inline-flex gap-y gap-x items-center rounded-sm [font-size:_unset] hover:[&_.resetButtonDirty]:visible p-2 h-8 w-[18.75rem] bg-white after:content-[""] after:inline-block after:absolute after:top-0 after:bottom-0 after:right-0 after:left-0 after:pointer-events after:border-solid after:rounded-sm after:border-gray [&:has(input:focus)]:after:border-blue after:border [&:has(input:focus)]:after:shadow-[0_0_0_3px] [&:has(input:focus)]:after:shadow-blue hover:[&:not(:has(input:focus))]:after:border-gray text-black pr-0 cursor-text"
9
9
  >
10
10
  <input
11
11
  aria-invalid="false"
12
- class="MuiInputBase-input MuiOutlinedInput-input PicassoOutlinedInput-input PicassoNumberInput-input PicassoOutlinedInput-inputMedium MuiInputBase-inputAdornedEnd MuiOutlinedInput-inputAdornedEnd"
12
+ class="base-Input [&::-webkit-calendar-picker-indicator]:bg bg-transparent border-none box-border cursor-[inherit] h-full outline-none p-0 peer resize-none w-full text-md leading-4 text-black [&::placeholder]:text-gray [&::placeholder]:opacity-100 [&::-webkit-outer-spin-button]:appearance [&::-webkit-outer-spin-button]:m [&::-webkit-inner-spin-button]:appearance [&::-webkit-inner-spin-button]:m [-moz"
13
13
  max="100"
14
14
  min="-100"
15
15
  step="5"
@@ -17,15 +17,13 @@ exports[`NumberInput renders 1`] = `
17
17
  value="10"
18
18
  />
19
19
  <div
20
- class="MuiInputAdornment-root PicassoInputAdornment-root MuiInputAdornment-positionEnd"
20
+ class="text-graphite h-auto flex items-center whitespace-nowrap max-h justify-end ml-auto flex-grow flex-shrink basis-auto"
21
21
  >
22
22
  <div
23
- class="PicassoContainer-flex PicassoContainer-inline PicassoContainer-column"
23
+ class="inline-flex flex-col"
24
24
  >
25
25
  <button
26
- class="MuiButtonBase-root NumberInputEndAdornment-medium NumberInputEndAdornment-root"
27
- tabindex="0"
28
- type="button"
26
+ class="flex relative items-center justify-center align-middle p-0 bottom-0 cursor-pointer text-graphite decoration-graphite bg-inherit bg-transparent border-t border-b border-l border-r border-l border-r border-l-gray border-r hover:bg-gray hover:border-gray [&+&]:border-t [&+&]:border-solid [&+&]:border-t-gray active:[&+&]:border-t active:[&+&]:border-t active:[&+&]:border-gray active:bg-gray active:border-t-gray [&:first-child]:rounded-tr [&:last-child]:rounded-br transition-[color,_border,_background] ease-out duration-350 h-4 w-[1.625rem]"
29
27
  >
30
28
  <svg
31
29
  class="PicassoSvgArrowUpMinor16-root"
@@ -38,9 +36,7 @@ exports[`NumberInput renders 1`] = `
38
36
  </svg>
39
37
  </button>
40
38
  <button
41
- class="MuiButtonBase-root NumberInputEndAdornment-medium NumberInputEndAdornment-root"
42
- tabindex="0"
43
- type="button"
39
+ class="flex relative items-center justify-center align-middle p-0 bottom-0 cursor-pointer text-graphite decoration-graphite bg-inherit bg-transparent border-t border-b border-l border-r border-l border-r border-l-gray border-r hover:bg-gray hover:border-gray [&+&]:border-t [&+&]:border-solid [&+&]:border-t-gray active:[&+&]:border-t active:[&+&]:border-t active:[&+&]:border-gray active:bg-gray active:border-t-gray [&:first-child]:rounded-tr [&:last-child]:rounded-br transition-[color,_border,_background] ease-out duration-350 h-4 w-[1.625rem]"
44
40
  >
45
41
  <svg
46
42
  class="PicassoSvgArrowDownMinor16-root"
@@ -54,20 +50,6 @@ exports[`NumberInput renders 1`] = `
54
50
  </button>
55
51
  </div>
56
52
  </div>
57
- <fieldset
58
- aria-hidden="true"
59
- class="PrivateNotchedOutline-root MuiOutlinedInput-notchedOutline PicassoOutlinedInput-notchedOutline"
60
- style="padding-left: 8px;"
61
- >
62
- <legend
63
- class="PrivateNotchedOutline-legend"
64
- style="width: 0.01px;"
65
- >
66
- <span>
67
-
68
- </span>
69
- </legend>
70
- </fieldset>
71
53
  </div>
72
54
  </div>
73
55
  `;
@@ -1,12 +1,8 @@
1
1
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
2
2
  import type { RefObject } from 'react'
3
3
  import React from 'react'
4
- import type { Theme } from '@material-ui/core/styles'
5
- import { makeStyles } from '@material-ui/core/styles'
6
4
  import type { BaseProps, SizeType } from '@toptal/picasso-shared'
7
5
  import { isBrowser } from '@toptal/picasso-shared'
8
- import { ButtonBase } from '@material-ui/core'
9
- import cx from 'classnames'
10
6
  import { InputAdornment } from '@toptal/picasso-input-adornment'
11
7
  import { Container } from '@toptal/picasso-container'
12
8
  import {
@@ -15,8 +11,9 @@ import {
15
11
  ArrowDownMinor24,
16
12
  ArrowUpMinor24,
17
13
  } from '@toptal/picasso-icons'
14
+ import { twJoin } from '@toptal/picasso-tailwind-merge'
18
15
 
19
- import styles from './styles'
16
+ export type Size = SizeType<'small' | 'medium' | 'large'>
20
17
 
21
18
  export interface Props extends BaseProps {
22
19
  /** Value of the `input` element. */
@@ -30,15 +27,11 @@ export interface Props extends BaseProps {
30
27
  /** Indicates whether component is in disabled state */
31
28
  disabled?: boolean
32
29
  /** Component size */
33
- size?: SizeType<'small' | 'medium' | 'large'>
30
+ size?: Size
34
31
  /** Ref of the input element */
35
32
  inputRef: RefObject<HTMLInputElement>
36
33
  }
37
34
 
38
- const useStyles = makeStyles<Theme, Props>(styles, {
39
- name: 'NumberInputEndAdornment',
40
- })
41
-
42
35
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
43
36
  const nativeInputValueSetter = isBrowser()
44
37
  ? (
@@ -50,6 +43,12 @@ const nativeInputValueSetter = isBrowser()
50
43
  ).set!
51
44
  : undefined
52
45
 
46
+ const classBySize: Record<Size, string> = {
47
+ small: 'h-3 w-[1.375rem]',
48
+ medium: 'h-4 w-[1.625rem]',
49
+ large: 'h-6 w-[2.125rem]',
50
+ }
51
+
53
52
  export const NumberInputEndAdornment = (props: Props) => {
54
53
  const {
55
54
  step = 1,
@@ -61,8 +60,6 @@ export const NumberInputEndAdornment = (props: Props) => {
61
60
  inputRef,
62
61
  } = props
63
62
 
64
- const classes = useStyles(props)
65
-
66
63
  const normalizedStep = Number(step)
67
64
  const normalizedValue = Number(value)
68
65
  const normalizedMin = Number(min)
@@ -94,7 +91,7 @@ export const NumberInputEndAdornment = (props: Props) => {
94
91
 
95
92
  let nextValue = normalizedValue + normalizedStep
96
93
 
97
- if (nextValue <= max) {
94
+ if (nextValue <= Number(max)) {
98
95
  if (normalizedValue < normalizedMin + normalizedStep) {
99
96
  nextValue = normalizedMin + normalizedStep
100
97
  }
@@ -113,7 +110,7 @@ export const NumberInputEndAdornment = (props: Props) => {
113
110
 
114
111
  let nextValue = normalizedValue - normalizedStep
115
112
 
116
- if (nextValue >= min) {
113
+ if (nextValue >= Number(min)) {
117
114
  if (normalizedValue > normalizedMax - normalizedStep) {
118
115
  nextValue = normalizedMax - normalizedStep
119
116
  }
@@ -125,35 +122,51 @@ export const NumberInputEndAdornment = (props: Props) => {
125
122
  }
126
123
  }
127
124
 
128
- const rootClassName = cx(
129
- {
130
- [classes.disabled]: disabled,
131
- },
132
- classes[size],
133
- classes.root
125
+ const rootClassName = twJoin(
126
+ `flex relative items-center justify-center align-middle
127
+
128
+ p-0 bottom-0 cursor-pointer
129
+
130
+ text-graphite-700 decoration-graphite-700 bg-inherit bg-transparent
131
+
132
+ border-t-0 border-b-0 border-l border-r border-l-solid border-r-solid
133
+ border-l-gray-400 border-r-transparent
134
+
135
+ hover:bg-gray-400 hover:border-gray-400
136
+
137
+ [&+&]:border-t [&+&]:border-solid
138
+ [&+&]:border-t-gray-400
139
+
140
+ active:[&+&]:border-t active:[&+&]:border-t-solid
141
+ active:[&+&]:border-gray-500
142
+
143
+ active:bg-gray-500 active:border-t-gray-500
144
+
145
+ [&:first-child]:rounded-tr-sm [&:last-child]:rounded-br-sm
146
+
147
+ transition-[color,_border,_background] ease-out duration-350`,
148
+ classBySize[size],
149
+ disabled && 'opacity-[0.48]'
134
150
  )
135
151
 
136
152
  return (
137
153
  <InputAdornment position='end'>
138
154
  <Container flex direction='column' inline>
139
- <ButtonBase
155
+ <button
140
156
  disabled={disabled}
141
- classes={{
142
- root: rootClassName,
143
- }}
157
+ className={rootClassName}
144
158
  onClick={handleUpClick}
145
159
  >
146
160
  {size === 'large' ? <ArrowUpMinor24 /> : <ArrowUpMinor16 />}
147
- </ButtonBase>
148
- <ButtonBase
161
+ </button>
162
+
163
+ <button
149
164
  disabled={disabled}
150
- classes={{
151
- root: rootClassName,
152
- }}
165
+ className={rootClassName}
153
166
  onClick={handleDownClick}
154
167
  >
155
168
  {size === 'large' ? <ArrowDownMinor24 /> : <ArrowDownMinor16 />}
156
- </ButtonBase>
169
+ </button>
157
170
  </Container>
158
171
  </InputAdornment>
159
172
  )
@@ -1,3 +0,0 @@
1
- declare const _default: () => import("@material-ui/styles").StyleRules<{}, "root" | "input">;
2
- export default _default;
3
- //# sourceMappingURL=styles.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/NumberInput/styles.ts"],"names":[],"mappings":";AAEA,wBAcI"}
@@ -1,16 +0,0 @@
1
- import { createStyles } from '@material-ui/core/styles';
2
- export default () => createStyles({
3
- root: {
4
- paddingRight: 0,
5
- cursor: 'text',
6
- },
7
- input: {
8
- '&::-webkit-outer-spin-button, &::-webkit-inner-spin-button': {
9
- '-webkit-appearance': 'none',
10
- appearance: 'none',
11
- margin: 0,
12
- },
13
- '-moz-appearance': 'textfield',
14
- },
15
- });
16
- //# sourceMappingURL=styles.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/NumberInput/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEvD,eAAe,GAAG,EAAE,CAClB,YAAY,CAAC;IACX,IAAI,EAAE;QACJ,YAAY,EAAE,CAAC;QACf,MAAM,EAAE,MAAM;KACf;IACD,KAAK,EAAE;QACL,4DAA4D,EAAE;YAC5D,oBAAoB,EAAE,MAAM;YAC5B,UAAU,EAAE,MAAM;YAClB,MAAM,EAAE,CAAC;SACV;QACD,iBAAiB,EAAE,WAAW;KAC/B;CACF,CAAC,CAAA"}
@@ -1,4 +0,0 @@
1
- import type { Theme } from '@material-ui/core/styles';
2
- declare const _default: ({ palette, transitions, sizes: { borderRadius } }: Theme) => import("@material-ui/styles").StyleRules<{}, "root" | "medium" | "large" | "small" | "disabled">;
3
- export default _default;
4
- //# sourceMappingURL=styles.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/NumberInputEndAdornment/styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;4EAGc,KAAK;AAAxE,wBAsDI"}
@@ -1,45 +0,0 @@
1
- import { createStyles } from '@material-ui/core/styles';
2
- export default ({ palette, transitions, sizes: { borderRadius } }) => createStyles({
3
- root: {
4
- borderLeft: `1px solid ${palette.grey.light2}`,
5
- borderRight: '1px solid transparent',
6
- '&:hover': {
7
- background: palette.grey.light2,
8
- borderColor: palette.grey.light2,
9
- },
10
- '& + &': {
11
- borderTop: `1px solid ${palette.grey.light2}`,
12
- },
13
- '&:active + &': {
14
- borderTop: `1px solid ${palette.grey.main}`,
15
- },
16
- '&:active': {
17
- background: palette.grey.main,
18
- borderColor: palette.grey.main,
19
- },
20
- '&:first-child': {
21
- borderTopRightRadius: borderRadius.small,
22
- },
23
- '&:last-child': {
24
- borderBottomRightRadius: borderRadius.small,
25
- },
26
- transition: `all ${transitions.duration.short}ms ${transitions.easing.easeOut}`,
27
- transitionProperty: 'border, color, background',
28
- },
29
- disabled: {
30
- opacity: 0.48,
31
- },
32
- small: {
33
- height: '0.75rem',
34
- width: '1.375rem',
35
- },
36
- medium: {
37
- height: '1rem',
38
- width: '1.625rem',
39
- },
40
- large: {
41
- height: '1.5rem',
42
- width: '2.125rem',
43
- },
44
- });
45
- //# sourceMappingURL=styles.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/NumberInputEndAdornment/styles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEvD,eAAe,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,YAAY,EAAE,EAAS,EAAE,EAAE,CAC1E,YAAY,CAAC;IACX,IAAI,EAAE;QACJ,UAAU,EAAE,aAAa,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE;QAC9C,WAAW,EAAE,uBAAuB;QAEpC,SAAS,EAAE;YACT,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM;YAC/B,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM;SACjC;QAED,OAAO,EAAE;YACP,SAAS,EAAE,aAAa,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE;SAC9C;QAED,cAAc,EAAE;YACd,SAAS,EAAE,aAAa,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE;SAC5C;QAED,UAAU,EAAE;YACV,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI;YAC7B,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI;SAC/B;QAED,eAAe,EAAE;YACf,oBAAoB,EAAE,YAAY,CAAC,KAAK;SACzC;QAED,cAAc,EAAE;YACd,uBAAuB,EAAE,YAAY,CAAC,KAAK;SAC5C;QAED,UAAU,EAAE,OAAO,WAAW,CAAC,QAAQ,CAAC,KAAK,MAAM,WAAW,CAAC,MAAM,CAAC,OAAO,EAAE;QAC/E,kBAAkB,EAAE,2BAA2B;KAChD;IAED,QAAQ,EAAE;QACR,OAAO,EAAE,IAAI;KACd;IAED,KAAK,EAAE;QACL,MAAM,EAAE,SAAS;QACjB,KAAK,EAAE,UAAU;KAClB;IAED,MAAM,EAAE;QACN,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,UAAU;KAClB;IAED,KAAK,EAAE;QACL,MAAM,EAAE,QAAQ;QAChB,KAAK,EAAE,UAAU;KAClB;CACF,CAAC,CAAA"}
@@ -1,17 +0,0 @@
1
- import { createStyles } from '@material-ui/core/styles'
2
-
3
- export default () =>
4
- createStyles({
5
- root: {
6
- paddingRight: 0,
7
- cursor: 'text',
8
- },
9
- input: {
10
- '&::-webkit-outer-spin-button, &::-webkit-inner-spin-button': {
11
- '-webkit-appearance': 'none',
12
- appearance: 'none',
13
- margin: 0,
14
- },
15
- '-moz-appearance': 'textfield',
16
- },
17
- })
@@ -1,58 +0,0 @@
1
- import type { Theme } from '@material-ui/core/styles'
2
- import { createStyles } from '@material-ui/core/styles'
3
-
4
- export default ({ palette, transitions, sizes: { borderRadius } }: Theme) =>
5
- createStyles({
6
- root: {
7
- borderLeft: `1px solid ${palette.grey.light2}`,
8
- borderRight: '1px solid transparent',
9
-
10
- '&:hover': {
11
- background: palette.grey.light2,
12
- borderColor: palette.grey.light2,
13
- },
14
-
15
- '& + &': {
16
- borderTop: `1px solid ${palette.grey.light2}`,
17
- },
18
-
19
- '&:active + &': {
20
- borderTop: `1px solid ${palette.grey.main}`,
21
- },
22
-
23
- '&:active': {
24
- background: palette.grey.main,
25
- borderColor: palette.grey.main,
26
- },
27
-
28
- '&:first-child': {
29
- borderTopRightRadius: borderRadius.small,
30
- },
31
-
32
- '&:last-child': {
33
- borderBottomRightRadius: borderRadius.small,
34
- },
35
-
36
- transition: `all ${transitions.duration.short}ms ${transitions.easing.easeOut}`,
37
- transitionProperty: 'border, color, background',
38
- },
39
-
40
- disabled: {
41
- opacity: 0.48,
42
- },
43
-
44
- small: {
45
- height: '0.75rem',
46
- width: '1.375rem',
47
- },
48
-
49
- medium: {
50
- height: '1rem',
51
- width: '1.625rem',
52
- },
53
-
54
- large: {
55
- height: '1.5rem',
56
- width: '2.125rem',
57
- },
58
- })