@alfalab/core-components-number-input 2.0.0 → 2.0.2

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.
Files changed (85) hide show
  1. package/components/number-input/Component.js +19 -9
  2. package/components/number-input/default.css +24 -0
  3. package/components/number-input/index.css +4 -11
  4. package/components/number-input/inverted.css +24 -0
  5. package/components/steppers/Component.d.ts +1 -0
  6. package/components/steppers/Component.js +15 -5
  7. package/components/steppers/default.css +20 -0
  8. package/components/steppers/index.css +5 -7
  9. package/components/steppers/inverted.css +20 -0
  10. package/cssm/Component.responsive.js +4 -0
  11. package/cssm/components/number-input/Component.js +18 -8
  12. package/cssm/components/number-input/default.module.css +23 -0
  13. package/cssm/components/number-input/index.js +4 -0
  14. package/cssm/components/number-input/index.module.css +1 -8
  15. package/cssm/components/number-input/inverted.module.css +23 -0
  16. package/cssm/components/steppers/Component.d.ts +1 -0
  17. package/cssm/components/steppers/Component.js +12 -4
  18. package/cssm/components/steppers/default.module.css +19 -0
  19. package/cssm/components/steppers/index.js +2 -0
  20. package/cssm/components/steppers/index.module.css +1 -3
  21. package/cssm/components/steppers/inverted.module.css +19 -0
  22. package/{Component.desktop.d.ts → cssm/desktop/Component.desktop.d.ts} +1 -1
  23. package/cssm/{Component.desktop.js → desktop/Component.desktop.js} +9 -5
  24. package/cssm/desktop/index.d.ts +1 -1
  25. package/cssm/desktop/index.js +6 -2
  26. package/cssm/index.js +4 -0
  27. package/{esm → cssm/mobile}/Component.mobile.d.ts +1 -1
  28. package/cssm/{Component.mobile.js → mobile/Component.mobile.js} +9 -5
  29. package/cssm/mobile/index.d.ts +1 -1
  30. package/cssm/mobile/index.js +6 -2
  31. package/{cssm → desktop}/Component.desktop.d.ts +1 -1
  32. package/{Component.desktop.js → desktop/Component.desktop.js} +3 -3
  33. package/desktop/index.d.ts +1 -1
  34. package/desktop/index.js +2 -2
  35. package/esm/components/number-input/Component.js +19 -9
  36. package/esm/components/number-input/default.css +24 -0
  37. package/esm/components/number-input/index.css +4 -11
  38. package/esm/components/number-input/inverted.css +24 -0
  39. package/esm/components/steppers/Component.d.ts +1 -0
  40. package/esm/components/steppers/Component.js +15 -5
  41. package/esm/components/steppers/default.css +20 -0
  42. package/esm/components/steppers/index.css +5 -7
  43. package/esm/components/steppers/inverted.css +20 -0
  44. package/esm/{Component.desktop.d.ts → desktop/Component.desktop.d.ts} +1 -1
  45. package/esm/{Component.desktop.js → desktop/Component.desktop.js} +3 -3
  46. package/esm/desktop/index.d.ts +1 -1
  47. package/esm/desktop/index.js +1 -1
  48. package/{modern → esm/mobile}/Component.mobile.d.ts +1 -1
  49. package/esm/{Component.mobile.js → mobile/Component.mobile.js} +3 -3
  50. package/esm/mobile/index.d.ts +1 -1
  51. package/esm/mobile/index.js +1 -1
  52. package/{Component.mobile.d.ts → mobile/Component.mobile.d.ts} +1 -1
  53. package/{Component.mobile.js → mobile/Component.mobile.js} +3 -3
  54. package/mobile/index.d.ts +1 -1
  55. package/mobile/index.js +2 -2
  56. package/modern/components/number-input/Component.js +16 -6
  57. package/modern/components/number-input/default.css +24 -0
  58. package/modern/components/number-input/index.css +4 -11
  59. package/modern/components/number-input/inverted.css +24 -0
  60. package/modern/components/steppers/Component.d.ts +1 -0
  61. package/modern/components/steppers/Component.js +15 -5
  62. package/modern/components/steppers/default.css +20 -0
  63. package/modern/components/steppers/index.css +5 -7
  64. package/modern/components/steppers/inverted.css +20 -0
  65. package/modern/{Component.desktop.d.ts → desktop/Component.desktop.d.ts} +1 -1
  66. package/modern/{Component.desktop.js → desktop/Component.desktop.js} +3 -3
  67. package/modern/desktop/index.d.ts +1 -1
  68. package/modern/desktop/index.js +1 -1
  69. package/{cssm → modern/mobile}/Component.mobile.d.ts +1 -1
  70. package/modern/{Component.mobile.js → mobile/Component.mobile.js} +3 -3
  71. package/modern/mobile/index.d.ts +1 -1
  72. package/modern/mobile/index.js +1 -1
  73. package/package.json +3 -3
  74. package/src/components/number-input/Component.tsx +13 -3
  75. package/src/components/number-input/default.module.css +10 -0
  76. package/src/components/number-input/index.module.css +0 -9
  77. package/src/components/number-input/inverted.module.css +10 -0
  78. package/src/components/steppers/Component.tsx +12 -1
  79. package/src/components/steppers/default.module.css +5 -0
  80. package/src/components/steppers/index.module.css +0 -1
  81. package/src/components/steppers/inverted.module.css +5 -0
  82. package/src/{Component.desktop.tsx → desktop/Component.desktop.tsx} +1 -1
  83. package/src/desktop/index.ts +1 -1
  84. package/src/{Component.mobile.tsx → mobile/Component.mobile.tsx} +1 -1
  85. package/src/mobile/index.ts +1 -1
@@ -10,10 +10,20 @@ import '@alfalab/core-components-icon-button/modern';
10
10
  import '@alfalab/icons-glyph/MinusMIcon';
11
11
  import '@alfalab/icons-glyph/PlusMediumMIcon';
12
12
 
13
- const styles = {"steppers":"number-input__steppers_1g1qu","steppersFocused":"number-input__steppersFocused_1g1qu","steppersDisable":"number-input__steppersDisable_1g1qu","s":"number-input__s_1g1qu","m":"number-input__m_1g1qu"};
13
+ const defaultColors = {"steppers":"number-input__steppers_rxb9r","steppersFocused":"number-input__steppersFocused_rxb9r","steppersDisabled":"number-input__steppersDisabled_rxb9r"};
14
+ require('./default.css')
15
+
16
+ const styles = {"s":"number-input__s_ua8m2","m":"number-input__m_ua8m2"};
14
17
  require('./index.css')
15
18
 
16
- const NumberInput = forwardRef(({ value: propValue, onChange, separator = ',', fractionLength = MAX_DIGITS, defaultValue, Input, min: minProp, max: maxProp, rightAddons, dataTestId, disabled, onBlur, onFocus, view, step: stepProp, size = 's', disableUserInput, clear: clearProp, ...restProps }, ref) => {
19
+ const invertedColors = {"steppers":"number-input__steppers_12art","steppersFocused":"number-input__steppersFocused_12art","steppersDisabled":"number-input__steppersDisabled_12art"};
20
+ require('./inverted.css')
21
+
22
+ const colorStyles = {
23
+ default: defaultColors,
24
+ inverted: invertedColors,
25
+ };
26
+ const NumberInput = forwardRef(({ value: propValue, onChange, separator = ',', fractionLength = MAX_DIGITS, defaultValue, Input, min: minProp, max: maxProp, rightAddons, dataTestId, disabled, onBlur, onFocus, view, step: stepProp, size = 's', disableUserInput, clear: clearProp, colors = 'default', ...restProps }, ref) => {
17
27
  const min = Math.max(MIN_SAFE_INTEGER, minProp ?? MIN_SAFE_INTEGER);
18
28
  const max = Math.min(MAX_SAFE_INTEGER, maxProp ?? MAX_SAFE_INTEGER);
19
29
  const withStepper = stepProp !== undefined;
@@ -86,11 +96,11 @@ const NumberInput = forwardRef(({ value: propValue, onChange, separator = ',', f
86
96
  };
87
97
  return (React.createElement(Input, { maxLength: getMaxLength(value), ...restProps,
88
98
  // В iOS в цифровой клавиатуре невозможно ввести минус.
89
- inputMode: min < 0 && os.isIOS() ? 'text' : 'decimal', ref: mergeRefs([ref, maskRef]), value: value, onInput: handleChange, dataTestId: dataTestId, disabled: disabled, onFocus: handleFocus, onBlur: handleBlur, size: size, disableUserInput: disableUserInput, clear: clearProp && /\d/.test(value), rightAddons: withStepper ? (React.createElement(React.Fragment, null,
99
+ inputMode: min < 0 && os.isIOS() ? 'text' : 'decimal', ref: mergeRefs([ref, maskRef]), value: value, onInput: handleChange, dataTestId: dataTestId, colors: colors, disabled: disabled, onFocus: handleFocus, onBlur: handleBlur, size: size, disableUserInput: disableUserInput, clear: clearProp && /\d/.test(value), rightAddons: withStepper ? (React.createElement(React.Fragment, null,
90
100
  rightAddons,
91
- React.createElement(Steppers, { dataTestId: dataTestId, disabled: disabled, value: parseNumber(value), min: min, max: max, className: cn(styles.steppers, styles[size], {
92
- [styles.steppersFocused]: focused,
93
- [styles.steppersDisable]: disabled,
101
+ React.createElement(Steppers, { colors: colors, dataTestId: dataTestId, disabled: disabled, value: parseNumber(value), min: min, max: max, className: cn(colorStyles[colors].steppers, styles[size], {
102
+ [colorStyles[colors].steppersFocused]: focused,
103
+ [colorStyles[colors].steppersDisabled]: disabled,
94
104
  }), onIncrement: handleIncrement, onDecrement: handleDecrement }))) : (rightAddons) }));
95
105
  });
96
106
 
@@ -0,0 +1,24 @@
1
+ /* hash: 1v873 */
2
+ :root {
3
+ } /* deprecated */ :root {
4
+ --color-light-neutral-1500-inverted: #fff;
5
+ --color-light-neutral-translucent-200: rgba(30, 43, 68, 0.08); /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
6
+ } :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
7
+ } :root {
8
+ } :root {
9
+
10
+ /* Hard */
11
+
12
+ /* Up */
13
+
14
+ /* Hard up */
15
+ } :root {
16
+ } :root {
17
+ } :root {
18
+ } :root {
19
+ } .number-input__steppers_rxb9r {
20
+ background-color: var(--color-light-neutral-1500-inverted);
21
+ } .number-input__steppersFocused_rxb9r,
22
+ .number-input__steppersDisabled_rxb9r {
23
+ background-color: var(--color-light-neutral-translucent-200);
24
+ }
@@ -1,8 +1,6 @@
1
- /* hash: ppwj9 */
1
+ /* hash: wriah */
2
2
  :root {
3
- } /* deprecated */ :root {
4
- --color-light-neutral-0: #fff;
5
- --color-light-neutral-translucent-200: rgba(30, 43, 68, 0.08); /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
3
+ } /* deprecated */ :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
6
4
  } :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
7
5
  } :root {
8
6
  } :root {
@@ -18,13 +16,8 @@
18
16
  --gap-xs-neg: -8px;
19
17
  } :root {
20
18
  } :root {
21
- } .number-input__steppers_1g1qu {
22
- background-color: var(--color-light-neutral-0);
23
- } .number-input__steppersFocused_1g1qu,
24
- .number-input__steppersDisable_1g1qu {
25
- background-color: var(--color-light-neutral-translucent-200);
26
- } .number-input__s_1g1qu {
19
+ } .number-input__s_ua8m2 {
27
20
  margin-right: var(--gap-xs-neg);
28
- } .number-input__m_1g1qu {
21
+ } .number-input__m_ua8m2 {
29
22
  margin-right: var(--gap-2xs-neg);
30
23
  }
@@ -0,0 +1,24 @@
1
+ /* hash: 1vphq */
2
+ :root {
3
+ } /* deprecated */ :root {
4
+ --color-light-neutral-1500: #0e0e0e;
5
+ --color-light-neutral-translucent-300-inverted: rgba(222, 222, 238, 0.13); /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
6
+ } :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
7
+ } :root {
8
+ } :root {
9
+
10
+ /* Hard */
11
+
12
+ /* Up */
13
+
14
+ /* Hard up */
15
+ } :root {
16
+ } :root {
17
+ } :root {
18
+ } :root {
19
+ } .number-input__steppers_12art {
20
+ background-color: var(--color-light-neutral-1500);
21
+ } .number-input__steppersFocused_12art,
22
+ .number-input__steppersDisabled_12art {
23
+ background-color: var(--color-light-neutral-translucent-300-inverted);
24
+ }
@@ -9,6 +9,7 @@ type SteppersProps = {
9
9
  onIncrement: () => void;
10
10
  onDecrement: () => void;
11
11
  dataTestId?: string;
12
+ colors: 'default' | 'inverted';
12
13
  };
13
14
  declare const Steppers: React.FC<SteppersProps>;
14
15
  export { SteppersProps, Steppers };
@@ -5,19 +5,29 @@ import { getDataTestId } from '@alfalab/core-components-shared/modern';
5
5
  import { MinusMIcon } from '@alfalab/icons-glyph/MinusMIcon';
6
6
  import { PlusMediumMIcon } from '@alfalab/icons-glyph/PlusMediumMIcon';
7
7
 
8
- const styles = {"component":"number-input__component_1k8eq","separator":"number-input__separator_1k8eq","button":"number-input__button_1k8eq"};
8
+ const defaultColors = {"separator":"number-input__separator_5558q"};
9
+ require('./default.css')
10
+
11
+ const styles = {"component":"number-input__component_dl4y5","separator":"number-input__separator_dl4y5","button":"number-input__button_dl4y5"};
9
12
  require('./index.css')
10
13
 
14
+ const invertedColors = {"separator":"number-input__separator_898tm"};
15
+ require('./inverted.css')
16
+
17
+ const colorStyles = {
18
+ default: defaultColors,
19
+ inverted: invertedColors,
20
+ };
11
21
  function preventDefault(e) {
12
22
  e.preventDefault();
13
23
  }
14
- const Steppers = ({ className, onIncrement, onDecrement, value, min, max, disabled, dataTestId, }) => {
24
+ const Steppers = ({ className, onIncrement, onDecrement, value, min, max, disabled, dataTestId, colors, }) => {
15
25
  const decButtonDisabled = disabled || value <= min;
16
26
  const incButtonDisabled = disabled || value >= max;
17
27
  return (React.createElement("div", { className: cn(styles.component, className) },
18
- React.createElement(IconButton, { disabled: decButtonDisabled, className: styles.button, icon: React.createElement(MinusMIcon, null), "aria-label": '\u0443\u043C\u0435\u043D\u044C\u0448\u0438\u0442\u044C', onMouseDown: preventDefault, onClick: onDecrement, dataTestId: getDataTestId(dataTestId, 'decrement-button'), view: 'secondary' }),
19
- React.createElement("div", { className: styles.separator }),
20
- React.createElement(IconButton, { disabled: incButtonDisabled, className: styles.button, icon: React.createElement(PlusMediumMIcon, null), "aria-label": '\u0443\u0432\u0435\u043B\u0438\u0447\u0438\u0442\u044C', onMouseDown: preventDefault, onClick: onIncrement, dataTestId: getDataTestId(dataTestId, 'increment-button'), view: 'secondary' })));
28
+ React.createElement(IconButton, { colors: colors, disabled: decButtonDisabled, className: styles.button, icon: React.createElement(MinusMIcon, null), "aria-label": '\u0443\u043C\u0435\u043D\u044C\u0448\u0438\u0442\u044C', onMouseDown: preventDefault, onClick: onDecrement, dataTestId: getDataTestId(dataTestId, 'decrement-button'), view: 'secondary' }),
29
+ React.createElement("div", { className: cn(styles.separator, colorStyles[colors].separator) }),
30
+ React.createElement(IconButton, { colors: colors, disabled: incButtonDisabled, className: styles.button, icon: React.createElement(PlusMediumMIcon, null), "aria-label": '\u0443\u0432\u0435\u043B\u0438\u0447\u0438\u0442\u044C', onMouseDown: preventDefault, onClick: onIncrement, dataTestId: getDataTestId(dataTestId, 'increment-button'), view: 'secondary' })));
21
31
  };
22
32
 
23
33
  export { Steppers };
@@ -0,0 +1,20 @@
1
+ /* hash: 1a2sq */
2
+ :root {
3
+ } /* deprecated */ :root {
4
+ --color-light-neutral-translucent-300: rgba(15, 25, 55, 0.1); /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
5
+ } :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
6
+ } :root {
7
+ } :root {
8
+
9
+ /* Hard */
10
+
11
+ /* Up */
12
+
13
+ /* Hard up */
14
+ } :root {
15
+ } :root {
16
+ } :root {
17
+ } :root {
18
+ } .number-input__separator_5558q {
19
+ background-color: var(--color-light-neutral-translucent-300);
20
+ }
@@ -1,7 +1,6 @@
1
- /* hash: 1x7ch */
1
+ /* hash: 73hh8 */
2
2
  :root {
3
- } /* deprecated */ :root {
4
- --color-light-neutral-translucent-300: rgba(15, 25, 55, 0.1); /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
3
+ } /* deprecated */ :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
5
4
  } :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
6
5
  } :root {
7
6
  } :root {
@@ -15,18 +14,17 @@
15
14
  } :root {
16
15
  } :root {
17
16
  } :root {
18
- } .number-input__component_1k8eq {
17
+ } .number-input__component_dl4y5 {
19
18
  display: flex;
20
19
  flex-flow: row nowrap;
21
20
  align-items: center;
22
21
  border-radius: 5px;
23
22
  transition: background-color 0.2s ease;
24
23
  overflow: visible;
25
- } .number-input__separator_1k8eq {
24
+ } .number-input__separator_dl4y5 {
26
25
  height: 18px;
27
26
  width: 1px;
28
- background-color: var(--color-light-neutral-translucent-300);
29
- } .number-input__button_1k8eq {
27
+ } .number-input__button_dl4y5 {
30
28
  width: 40px;
31
29
  height: 40px;
32
30
  }
@@ -0,0 +1,20 @@
1
+ /* hash: 1eb6x */
2
+ :root {
3
+ } /* deprecated */ :root {
4
+ --color-light-neutral-translucent-300-inverted: rgba(222, 222, 238, 0.13); /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
5
+ } :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
6
+ } :root {
7
+ } :root {
8
+
9
+ /* Hard */
10
+
11
+ /* Up */
12
+
13
+ /* Hard up */
14
+ } :root {
15
+ } :root {
16
+ } :root {
17
+ } :root {
18
+ } .number-input__separator_898tm {
19
+ background-color: var(--color-light-neutral-translucent-300-inverted);
20
+ }
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import React from 'react';
3
- import { NumberInputProps } from "./components/number-input/index";
3
+ import { NumberInputProps } from "../components/number-input/index";
4
4
  type NumberInputDesktopProps = Omit<NumberInputProps, 'Input' | 'breakpoint' | 'view'>;
5
5
  declare const NumberInputDesktop: React.ForwardRefExoticComponent<NumberInputDesktopProps & React.RefAttributes<HTMLInputElement>>;
6
6
  export { NumberInputDesktopProps, NumberInputDesktop };
@@ -1,13 +1,13 @@
1
1
  import React, { forwardRef } from 'react';
2
2
  import { InputDesktop } from '@alfalab/core-components-input/modern/desktop';
3
- import { NumberInput } from './components/number-input/Component.js';
3
+ import { NumberInput } from '../components/number-input/Component.js';
4
4
  import 'react-merge-refs';
5
5
  import '@maskito/core';
6
6
  import '@maskito/react';
7
7
  import 'classnames';
8
8
  import '@alfalab/core-components-shared/modern';
9
- import './utils.js';
10
- import './components/steppers/Component.js';
9
+ import '../utils.js';
10
+ import '../components/steppers/Component.js';
11
11
  import '@alfalab/core-components-icon-button/modern';
12
12
  import '@alfalab/icons-glyph/MinusMIcon';
13
13
  import '@alfalab/icons-glyph/PlusMediumMIcon';
@@ -1,2 +1,2 @@
1
- export { NumberInputDesktop, NumberInputDesktopProps } from "../Component.desktop";
1
+ export { NumberInputDesktop, NumberInputDesktopProps } from "./Component.desktop";
2
2
  export {};
@@ -1,4 +1,4 @@
1
- export { NumberInputDesktop } from '../Component.desktop.js';
1
+ export { NumberInputDesktop } from './Component.desktop.js';
2
2
  import 'react';
3
3
  import '@alfalab/core-components-input/modern/desktop';
4
4
  import '../components/number-input/Component.js';
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import React from 'react';
3
- import { NumberInputProps } from "./components/number-input/index";
3
+ import { NumberInputProps } from "../components/number-input/index";
4
4
  type NumberInputMobileProps = Omit<NumberInputProps, 'Input' | 'breakpoint' | 'view'>;
5
5
  declare const NumberInputMobile: React.ForwardRefExoticComponent<NumberInputMobileProps & React.RefAttributes<HTMLInputElement>>;
6
6
  export { NumberInputMobileProps, NumberInputMobile };
@@ -1,13 +1,13 @@
1
1
  import React, { forwardRef } from 'react';
2
2
  import { InputMobile } from '@alfalab/core-components-input/modern/mobile';
3
- import { NumberInput } from './components/number-input/Component.js';
3
+ import { NumberInput } from '../components/number-input/Component.js';
4
4
  import 'react-merge-refs';
5
5
  import '@maskito/core';
6
6
  import '@maskito/react';
7
7
  import 'classnames';
8
8
  import '@alfalab/core-components-shared/modern';
9
- import './utils.js';
10
- import './components/steppers/Component.js';
9
+ import '../utils.js';
10
+ import '../components/steppers/Component.js';
11
11
  import '@alfalab/core-components-icon-button/modern';
12
12
  import '@alfalab/icons-glyph/MinusMIcon';
13
13
  import '@alfalab/icons-glyph/PlusMediumMIcon';
@@ -1,2 +1,2 @@
1
- export { NumberInputMobile, NumberInputMobileProps } from "../Component.mobile";
1
+ export { NumberInputMobile, NumberInputMobileProps } from "./Component.mobile";
2
2
  export {};
@@ -1,4 +1,4 @@
1
- export { NumberInputMobile } from '../Component.mobile.js';
1
+ export { NumberInputMobile } from './Component.mobile.js';
2
2
  import 'react';
3
3
  import '@alfalab/core-components-input/modern/mobile';
4
4
  import '../components/number-input/Component.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfalab/core-components-number-input",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -14,9 +14,9 @@
14
14
  "react": "^16.9.0 || ^17.0.1 || ^18.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@alfalab/core-components-input": "^13.0.0",
17
+ "@alfalab/core-components-input": "^13.0.2",
18
18
  "@alfalab/core-components-mq": "^4.2.0",
19
- "@alfalab/core-components-icon-button": "^6.4.0",
19
+ "@alfalab/core-components-icon-button": "^6.4.2",
20
20
  "@alfalab/core-components-shared": "^0.8.0",
21
21
  "@alfalab/icons-glyph": "^2.108.0",
22
22
  "@maskito/core": "^1.7.0",
@@ -27,7 +27,14 @@ import {
27
27
  } from '../../utils';
28
28
  import { Steppers } from '../steppers';
29
29
 
30
+ import defaultColors from './default.module.css';
30
31
  import styles from './index.module.css';
32
+ import invertedColors from './inverted.module.css';
33
+
34
+ const colorStyles = {
35
+ default: defaultColors,
36
+ inverted: invertedColors,
37
+ };
31
38
 
32
39
  export interface NumberInputProps
33
40
  extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'defaultValue'> {
@@ -106,6 +113,7 @@ export const NumberInput = forwardRef<HTMLInputElement, NumberInputProps>(
106
113
  size = 's',
107
114
  disableUserInput,
108
115
  clear: clearProp,
116
+ colors = 'default',
109
117
  ...restProps
110
118
  },
111
119
  ref,
@@ -233,6 +241,7 @@ export const NumberInput = forwardRef<HTMLInputElement, NumberInputProps>(
233
241
  value={value}
234
242
  onInput={handleChange}
235
243
  dataTestId={dataTestId}
244
+ colors={colors}
236
245
  disabled={disabled}
237
246
  onFocus={handleFocus}
238
247
  onBlur={handleBlur}
@@ -244,14 +253,15 @@ export const NumberInput = forwardRef<HTMLInputElement, NumberInputProps>(
244
253
  <React.Fragment>
245
254
  {rightAddons}
246
255
  <Steppers
256
+ colors={colors}
247
257
  dataTestId={dataTestId}
248
258
  disabled={disabled}
249
259
  value={parseNumber(value)}
250
260
  min={min}
251
261
  max={max}
252
- className={cn(styles.steppers, styles[size], {
253
- [styles.steppersFocused]: focused,
254
- [styles.steppersDisable]: disabled,
262
+ className={cn(colorStyles[colors].steppers, styles[size], {
263
+ [colorStyles[colors].steppersFocused]: focused,
264
+ [colorStyles[colors].steppersDisabled]: disabled,
255
265
  })}
256
266
  onIncrement={handleIncrement}
257
267
  onDecrement={handleDecrement}
@@ -0,0 +1,10 @@
1
+ @import '@alfalab/core-components-themes/src/default.css';
2
+
3
+ .steppers {
4
+ background-color: var(--color-light-neutral-1500-inverted);
5
+ }
6
+
7
+ .steppersFocused,
8
+ .steppersDisabled {
9
+ background-color: var(--color-light-neutral-translucent-200);
10
+ }
@@ -1,14 +1,5 @@
1
1
  @import '@alfalab/core-components-themes/src/default.css';
2
2
 
3
- .steppers {
4
- background-color: var(--color-light-neutral-0);
5
- }
6
-
7
- .steppersFocused,
8
- .steppersDisable {
9
- background-color: var(--color-light-neutral-translucent-200);
10
- }
11
-
12
3
  .s {
13
4
  margin-right: var(--gap-xs-neg);
14
5
  }
@@ -0,0 +1,10 @@
1
+ @import '@alfalab/core-components-themes/src/default.css';
2
+
3
+ .steppers {
4
+ background-color: var(--color-light-neutral-1500);
5
+ }
6
+
7
+ .steppersFocused,
8
+ .steppersDisabled {
9
+ background-color: var(--color-light-neutral-translucent-300-inverted);
10
+ }
@@ -6,7 +6,9 @@ import { getDataTestId } from '@alfalab/core-components-shared';
6
6
  import { MinusMIcon } from '@alfalab/icons-glyph/MinusMIcon';
7
7
  import { PlusMediumMIcon } from '@alfalab/icons-glyph/PlusMediumMIcon';
8
8
 
9
+ import defaultColors from './default.module.css';
9
10
  import styles from './index.module.css';
11
+ import invertedColors from './inverted.module.css';
10
12
 
11
13
  export type SteppersProps = {
12
14
  value: number;
@@ -17,6 +19,12 @@ export type SteppersProps = {
17
19
  onIncrement: () => void;
18
20
  onDecrement: () => void;
19
21
  dataTestId?: string;
22
+ colors: 'default' | 'inverted';
23
+ };
24
+
25
+ const colorStyles = {
26
+ default: defaultColors,
27
+ inverted: invertedColors,
20
28
  };
21
29
 
22
30
  function preventDefault(e: React.MouseEvent<HTMLElement>) {
@@ -32,6 +40,7 @@ export const Steppers: React.FC<SteppersProps> = ({
32
40
  max,
33
41
  disabled,
34
42
  dataTestId,
43
+ colors,
35
44
  }) => {
36
45
  const decButtonDisabled = disabled || value <= min;
37
46
  const incButtonDisabled = disabled || value >= max;
@@ -39,6 +48,7 @@ export const Steppers: React.FC<SteppersProps> = ({
39
48
  return (
40
49
  <div className={cn(styles.component, className)}>
41
50
  <IconButton
51
+ colors={colors}
42
52
  disabled={decButtonDisabled}
43
53
  className={styles.button}
44
54
  icon={<MinusMIcon />}
@@ -48,8 +58,9 @@ export const Steppers: React.FC<SteppersProps> = ({
48
58
  dataTestId={getDataTestId(dataTestId, 'decrement-button')}
49
59
  view='secondary'
50
60
  />
51
- <div className={styles.separator} />
61
+ <div className={cn(styles.separator, colorStyles[colors].separator)} />
52
62
  <IconButton
63
+ colors={colors}
53
64
  disabled={incButtonDisabled}
54
65
  className={styles.button}
55
66
  icon={<PlusMediumMIcon />}
@@ -0,0 +1,5 @@
1
+ @import '@alfalab/core-components-themes/src/default.css';
2
+
3
+ .separator {
4
+ background-color: var(--color-light-neutral-translucent-300);
5
+ }
@@ -12,7 +12,6 @@
12
12
  .separator {
13
13
  height: 18px;
14
14
  width: 1px;
15
- background-color: var(--color-light-neutral-translucent-300);
16
15
  }
17
16
 
18
17
  .button {
@@ -0,0 +1,5 @@
1
+ @import '@alfalab/core-components-themes/src/default.css';
2
+
3
+ .separator {
4
+ background-color: var(--color-light-neutral-translucent-300-inverted);
5
+ }
@@ -2,7 +2,7 @@ import React, { forwardRef } from 'react';
2
2
 
3
3
  import { InputDesktop } from '@alfalab/core-components-input/desktop';
4
4
 
5
- import { NumberInput, NumberInputProps } from './components/number-input';
5
+ import { NumberInput, NumberInputProps } from '../components/number-input';
6
6
 
7
7
  export type NumberInputDesktopProps = Omit<NumberInputProps, 'Input' | 'breakpoint' | 'view'>;
8
8
 
@@ -1 +1 @@
1
- export { NumberInputDesktop, NumberInputDesktopProps } from '../Component.desktop';
1
+ export { NumberInputDesktop, NumberInputDesktopProps } from './Component.desktop';
@@ -2,7 +2,7 @@ import React, { forwardRef } from 'react';
2
2
 
3
3
  import { InputMobile } from '@alfalab/core-components-input/mobile';
4
4
 
5
- import { NumberInput, NumberInputProps } from './components/number-input';
5
+ import { NumberInput, NumberInputProps } from '../components/number-input';
6
6
 
7
7
  export type NumberInputMobileProps = Omit<NumberInputProps, 'Input' | 'breakpoint' | 'view'>;
8
8
 
@@ -1 +1 @@
1
- export { NumberInputMobile, NumberInputMobileProps } from '../Component.mobile';
1
+ export { NumberInputMobile, NumberInputMobileProps } from './Component.mobile';