@ttoss/ui 1.32.0 → 1.32.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.
package/dist/esm/index.js CHANGED
@@ -413,11 +413,133 @@ var CloseButton = /*#__PURE__*/React9.forwardRef(({
413
413
  });
414
414
  CloseButton.displayName = "CloseButton";
415
415
 
416
+ // src/components/InputNumber.tsx
417
+ import { Input as Input2 } from "theme-ui";
418
+ import React10 from "react";
419
+ import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
420
+ var InputNumber = /*#__PURE__*/React10.forwardRef(({
421
+ sx,
422
+ value,
423
+ infoIcon,
424
+ onChange,
425
+ onClickInfoIcon,
426
+ ...inputProps
427
+ }, ref) => {
428
+ const sxProps = React10.useMemo(() => {
429
+ const size = String(typeof value === "undefined" ? 0 : value).length;
430
+ if (inputProps["aria-invalid"] === "true") {
431
+ return {
432
+ width: `calc(139px + ${size > 1 ? size * 10 : 0}px)`,
433
+ textAlign: "left",
434
+ "&[type=number]::-webkit-inner-spin-button, &[type=number]::-webkit-outer-spin-button": {
435
+ "-webkit-appearance": "none",
436
+ margin: 0
437
+ },
438
+ ...sx,
439
+ paddingLeft: "3xl",
440
+ paddingRight: "2xl",
441
+ margin: 0
442
+ };
443
+ }
444
+ return {
445
+ width: `calc(108px + ${size > 1 ? size * 10 : 0}px)`,
446
+ textAlign: "center",
447
+ "&[type=number]::-webkit-inner-spin-button, &[type=number]::-webkit-outer-spin-button": {
448
+ "-webkit-appearance": "none",
449
+ margin: 0
450
+ },
451
+ ...sx,
452
+ paddingLeft: "2xl",
453
+ paddingRight: "2xl",
454
+ margin: 0
455
+ };
456
+ }, [inputProps, value, sx]);
457
+ const handleChangeUp = () => {
458
+ if (inputProps.disabled) {
459
+ return;
460
+ }
461
+ if (typeof value !== "number") {
462
+ onChange(-1);
463
+ return;
464
+ }
465
+ onChange(value - 1);
466
+ };
467
+ const handleChangeDown = () => {
468
+ if (inputProps.disabled) {
469
+ return;
470
+ }
471
+ if (typeof value !== "number") {
472
+ onChange(1);
473
+ return;
474
+ }
475
+ onChange(value + 1);
476
+ };
477
+ return /* @__PURE__ */jsxs9(Flex, {
478
+ sx: {
479
+ width: "fit-content",
480
+ ...sx,
481
+ position: "relative",
482
+ padding: 0,
483
+ border: "none"
484
+ },
485
+ ref,
486
+ "aria-invalid": inputProps["aria-invalid"],
487
+ children: [/* @__PURE__ */jsx13(Input2, {
488
+ ref,
489
+ variant: "forms.inputNumber",
490
+ sx: sxProps,
491
+ type: "number",
492
+ onChange: e => {
493
+ onChange(Number(e.target.value));
494
+ },
495
+ value,
496
+ ...inputProps
497
+ }), /* @__PURE__ */jsx13(Text, {
498
+ sx: {
499
+ position: "absolute",
500
+ alignSelf: "center",
501
+ left: "1rem",
502
+ zIndex: 1,
503
+ cursor: "pointer"
504
+ },
505
+ onClick: handleChangeUp,
506
+ children: /* @__PURE__ */jsx13(Icon, {
507
+ icon: "picker-down"
508
+ })
509
+ }), infoIcon && /* @__PURE__ */jsx13(Text, {
510
+ sx: {
511
+ position: "absolute",
512
+ alignSelf: "center",
513
+ right: "2.5rem",
514
+ zIndex: 1,
515
+ cursor: onClickInfoIcon ? "pointer" : "default"
516
+ },
517
+ onClick: onClickInfoIcon,
518
+ children: /* @__PURE__ */jsx13(Icon, {
519
+ icon: "info"
520
+ })
521
+ }), /* @__PURE__ */jsx13(Text, {
522
+ sx: {
523
+ position: "absolute",
524
+ alignSelf: "center",
525
+ right: "1rem",
526
+ zIndex: 1,
527
+ cursor: "pointer"
528
+ },
529
+ onClick: handleChangeDown,
530
+ children: /* @__PURE__ */jsx13(Icon, {
531
+ icon: "picker-up"
532
+ })
533
+ })]
534
+ });
535
+ });
536
+ InputNumber.displayName = "InputNumber";
537
+
416
538
  // src/components/Stack.tsx
417
- import * as React10 from "react";
418
- import { jsx as jsx13 } from "react/jsx-runtime";
419
- var Stack = /*#__PURE__*/React10.forwardRef((props, ref) => {
420
- return /* @__PURE__ */jsx13(Flex, {
539
+ import * as React11 from "react";
540
+ import { jsx as jsx14 } from "react/jsx-runtime";
541
+ var Stack = /*#__PURE__*/React11.forwardRef((props, ref) => {
542
+ return /* @__PURE__ */jsx14(Flex, {
421
543
  ref,
422
544
  ...props,
423
545
  sx: {
@@ -427,4 +549,4 @@ var Stack = /*#__PURE__*/React10.forwardRef((props, ref) => {
427
549
  });
428
550
  });
429
551
  Stack.displayName = "Stack";
430
- export { Badge, BaseStyles, Box, Button, Card, Checkbox, CloseButton, Container, Divider, Flex, Grid, Heading, HelpText, Icon, IconButton, Image, InfiniteLinearProgress, Input, Label, Progress as LinearProgress, Link, Radio, Select, Slider, Spinner, Stack, Text, Textarea, ThemeProvider, useBreakpointIndex, useResponsiveValue, useTheme };
552
+ export { Badge, BaseStyles, Box, Button, Card, Checkbox, CloseButton, Container, Divider, Flex, Grid, Heading, HelpText, Icon, IconButton, Image, InfiniteLinearProgress, Input, InputNumber, Label, Progress as LinearProgress, Link, Radio, Select, Slider, Spinner, Stack, Text, Textarea, ThemeProvider, useBreakpointIndex, useResponsiveValue, useTheme };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as theme_ui from 'theme-ui';
2
- import { Theme, BadgeProps as BadgeProps$1, ButtonProps as ButtonProps$1, InputProps as InputProps$1, LabelProps as LabelProps$1, SelectProps as SelectProps$1, IconButtonProps, TextareaProps as TextareaProps$1, TextProps, FlexProps } from 'theme-ui';
3
- export { BaseStyles, Box, BoxProps, Card, CardProps, Checkbox, CheckboxProps, Container, ContainerProps, Divider, DividerProps, Flex, FlexProps, Grid, GridProps, Heading, HeadingProps, IconButtonProps, Image, ImageProps, Progress as LinearProgress, ProgressProps as LinearProgressProps, Link, LinkProps, Radio, RadioProps, Slider, SliderProps, Spinner, SpinnerProps, Text, TextProps, Theme } from 'theme-ui';
2
+ import { Theme, BadgeProps as BadgeProps$1, ButtonProps as ButtonProps$1, InputProps as InputProps$1, LabelProps as LabelProps$1, SelectProps, IconButtonProps, TextareaProps as TextareaProps$1, TextProps, FlexProps } from 'theme-ui';
3
+ export { BaseStyles, Box, BoxProps, Card, CardProps, Checkbox, CheckboxProps, Container, ContainerProps, Divider, DividerProps, Flex, FlexProps, Grid, GridProps, Heading, HeadingProps, IconButtonProps, Image, ImageProps, Progress as LinearProgress, ProgressProps as LinearProgressProps, Link, LinkProps, Radio, RadioProps, SelectProps, Slider, SliderProps, Spinner, SpinnerProps, Text, TextProps, Theme } from 'theme-ui';
4
4
  export { useBreakpointIndex, useResponsiveValue } from '@theme-ui/match-media';
5
5
  import * as React from 'react';
6
6
  import React__default from 'react';
@@ -34,10 +34,10 @@ type ButtonProps = ButtonProps$1 & {
34
34
  };
35
35
  declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
36
36
 
37
- type InputProps = InputProps$1 & {
37
+ interface InputProps extends InputProps$1 {
38
38
  leadingIcon?: IconType;
39
39
  trailingIcon?: IconType;
40
- };
40
+ }
41
41
  declare const Input: React__default.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React__default.RefAttributes<HTMLInputElement>>;
42
42
 
43
43
  type LabelProps = LabelProps$1 & {
@@ -46,16 +46,15 @@ type LabelProps = LabelProps$1 & {
46
46
  };
47
47
  declare const Label: ({ children, onTooltipClick, tooltip, ...props }: LabelProps) => JSX.Element;
48
48
 
49
- type SelectProps = SelectProps$1;
50
- declare const Select: React__default.ForwardRefExoticComponent<Omit<SelectProps$1, "ref"> & React__default.RefAttributes<HTMLSelectElement>>;
49
+ declare const Select: React__default.ForwardRefExoticComponent<Omit<SelectProps, "ref"> & React__default.RefAttributes<HTMLSelectElement>>;
51
50
 
52
51
  declare const IconButton: React.ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
53
52
 
54
53
  declare const InfiniteLinearProgress: () => JSX.Element;
55
54
 
56
- type TextareaProps = TextareaProps$1 & {
55
+ interface TextareaProps extends TextareaProps$1 {
57
56
  trailingIcon?: IconType;
58
- };
57
+ }
59
58
  declare const Textarea: React__default.ForwardRefExoticComponent<Omit<TextareaProps, "ref"> & React__default.RefAttributes<HTMLTextAreaElement>>;
60
59
 
61
60
  type HelpTextProps = Omit<TextProps, 'variant'> & {
@@ -69,10 +68,18 @@ type CloseButtonProps = ButtonProps$1 & {
69
68
  };
70
69
  declare const CloseButton: React__default.ForwardRefExoticComponent<Omit<CloseButtonProps, "ref"> & React__default.RefAttributes<HTMLButtonElement>>;
71
70
 
71
+ type InputNumberProps = Omit<InputProps$1, 'type' | 'variant' | 'onChange'> & {
72
+ onChange: (value: number) => void;
73
+ value?: number;
74
+ infoIcon?: boolean;
75
+ onClickInfoIcon?: () => void;
76
+ };
77
+ declare const InputNumber: React__default.ForwardRefExoticComponent<Omit<InputNumberProps, "ref"> & React__default.RefAttributes<HTMLInputElement>>;
78
+
72
79
  type StackProps = FlexProps;
73
80
  /**
74
81
  * A component that renders its children in a column.
75
82
  */
76
83
  declare const Stack: React.ForwardRefExoticComponent<theme_ui.BoxProps & React.RefAttributes<HTMLElement>>;
77
84
 
78
- export { Badge, BadgeProps, Button, ButtonProps, CloseButton, CloseButtonProps, HelpText, HelpTextProps, Icon, IconButton, IconProps, IconType, InfiniteLinearProgress, Input, InputProps, Label, LabelProps, Select, SelectProps, Stack, StackProps, Textarea, TextareaProps, ThemeProvider, ThemeProviderProps, useTheme };
85
+ export { Badge, BadgeProps, Button, ButtonProps, CloseButton, CloseButtonProps, HelpText, HelpTextProps, Icon, IconButton, IconProps, IconType, InfiniteLinearProgress, Input, InputNumber, InputNumberProps, InputProps, Label, LabelProps, Select, Stack, StackProps, Textarea, TextareaProps, ThemeProvider, ThemeProviderProps, useTheme };
package/dist/index.js CHANGED
@@ -39,7 +39,7 @@ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
39
39
  var src_exports = {};
40
40
  __export(src_exports, {
41
41
  Badge: () => Badge,
42
- BaseStyles: () => import_theme_ui26.BaseStyles,
42
+ BaseStyles: () => import_theme_ui27.BaseStyles,
43
43
  Box: () => import_theme_ui4.Box,
44
44
  Button: () => Button,
45
45
  Card: () => import_theme_ui6.Card,
@@ -56,6 +56,7 @@ __export(src_exports, {
56
56
  Image: () => import_theme_ui11.Image,
57
57
  InfiniteLinearProgress: () => InfiniteLinearProgress,
58
58
  Input: () => Input,
59
+ InputNumber: () => InputNumber,
59
60
  Label: () => Label,
60
61
  LinearProgress: () => import_theme_ui15.Progress,
61
62
  Link: () => import_theme_ui14.Link,
@@ -72,7 +73,7 @@ __export(src_exports, {
72
73
  useTheme: () => useTheme
73
74
  });
74
75
  module.exports = __toCommonJS(src_exports);
75
- var import_theme_ui26 = require("theme-ui");
76
+ var import_theme_ui27 = require("theme-ui");
76
77
  var import_match_media = require("@theme-ui/match-media");
77
78
 
78
79
  // src/theme/ThemeProvider.tsx
@@ -484,11 +485,133 @@ var CloseButton = import_react6.default.forwardRef(({
484
485
  });
485
486
  CloseButton.displayName = "CloseButton";
486
487
 
487
- // src/components/Stack.tsx
488
- var React10 = __toESM(require("react"));
488
+ // src/components/InputNumber.tsx
489
+ var import_theme_ui26 = require("theme-ui");
490
+ var import_react7 = __toESM(require("react"));
489
491
  var import_jsx_runtime13 = require("react/jsx-runtime");
490
- var Stack = React10.forwardRef((props, ref) => {
491
- return /* @__PURE__ */(0, import_jsx_runtime13.jsx)(import_theme_ui8.Flex, {
492
+ var InputNumber = import_react7.default.forwardRef(({
493
+ sx,
494
+ value,
495
+ infoIcon,
496
+ onChange,
497
+ onClickInfoIcon,
498
+ ...inputProps
499
+ }, ref) => {
500
+ const sxProps = import_react7.default.useMemo(() => {
501
+ const size = String(typeof value === "undefined" ? 0 : value).length;
502
+ if (inputProps["aria-invalid"] === "true") {
503
+ return {
504
+ width: `calc(139px + ${size > 1 ? size * 10 : 0}px)`,
505
+ textAlign: "left",
506
+ "&[type=number]::-webkit-inner-spin-button, &[type=number]::-webkit-outer-spin-button": {
507
+ "-webkit-appearance": "none",
508
+ margin: 0
509
+ },
510
+ ...sx,
511
+ paddingLeft: "3xl",
512
+ paddingRight: "2xl",
513
+ margin: 0
514
+ };
515
+ }
516
+ return {
517
+ width: `calc(108px + ${size > 1 ? size * 10 : 0}px)`,
518
+ textAlign: "center",
519
+ "&[type=number]::-webkit-inner-spin-button, &[type=number]::-webkit-outer-spin-button": {
520
+ "-webkit-appearance": "none",
521
+ margin: 0
522
+ },
523
+ ...sx,
524
+ paddingLeft: "2xl",
525
+ paddingRight: "2xl",
526
+ margin: 0
527
+ };
528
+ }, [inputProps, value, sx]);
529
+ const handleChangeUp = () => {
530
+ if (inputProps.disabled) {
531
+ return;
532
+ }
533
+ if (typeof value !== "number") {
534
+ onChange(-1);
535
+ return;
536
+ }
537
+ onChange(value - 1);
538
+ };
539
+ const handleChangeDown = () => {
540
+ if (inputProps.disabled) {
541
+ return;
542
+ }
543
+ if (typeof value !== "number") {
544
+ onChange(1);
545
+ return;
546
+ }
547
+ onChange(value + 1);
548
+ };
549
+ return /* @__PURE__ */(0, import_jsx_runtime13.jsxs)(import_theme_ui8.Flex, {
550
+ sx: {
551
+ width: "fit-content",
552
+ ...sx,
553
+ position: "relative",
554
+ padding: 0,
555
+ border: "none"
556
+ },
557
+ ref,
558
+ "aria-invalid": inputProps["aria-invalid"],
559
+ children: [/* @__PURE__ */(0, import_jsx_runtime13.jsx)(import_theme_ui26.Input, {
560
+ ref,
561
+ variant: "forms.inputNumber",
562
+ sx: sxProps,
563
+ type: "number",
564
+ onChange: e => {
565
+ onChange(Number(e.target.value));
566
+ },
567
+ value,
568
+ ...inputProps
569
+ }), /* @__PURE__ */(0, import_jsx_runtime13.jsx)(import_theme_ui16.Text, {
570
+ sx: {
571
+ position: "absolute",
572
+ alignSelf: "center",
573
+ left: "1rem",
574
+ zIndex: 1,
575
+ cursor: "pointer"
576
+ },
577
+ onClick: handleChangeUp,
578
+ children: /* @__PURE__ */(0, import_jsx_runtime13.jsx)(Icon, {
579
+ icon: "picker-down"
580
+ })
581
+ }), infoIcon && /* @__PURE__ */(0, import_jsx_runtime13.jsx)(import_theme_ui16.Text, {
582
+ sx: {
583
+ position: "absolute",
584
+ alignSelf: "center",
585
+ right: "2.5rem",
586
+ zIndex: 1,
587
+ cursor: onClickInfoIcon ? "pointer" : "default"
588
+ },
589
+ onClick: onClickInfoIcon,
590
+ children: /* @__PURE__ */(0, import_jsx_runtime13.jsx)(Icon, {
591
+ icon: "info"
592
+ })
593
+ }), /* @__PURE__ */(0, import_jsx_runtime13.jsx)(import_theme_ui16.Text, {
594
+ sx: {
595
+ position: "absolute",
596
+ alignSelf: "center",
597
+ right: "1rem",
598
+ zIndex: 1,
599
+ cursor: "pointer"
600
+ },
601
+ onClick: handleChangeDown,
602
+ children: /* @__PURE__ */(0, import_jsx_runtime13.jsx)(Icon, {
603
+ icon: "picker-up"
604
+ })
605
+ })]
606
+ });
607
+ });
608
+ InputNumber.displayName = "InputNumber";
609
+
610
+ // src/components/Stack.tsx
611
+ var React11 = __toESM(require("react"));
612
+ var import_jsx_runtime14 = require("react/jsx-runtime");
613
+ var Stack = React11.forwardRef((props, ref) => {
614
+ return /* @__PURE__ */(0, import_jsx_runtime14.jsx)(import_theme_ui8.Flex, {
492
615
  ref,
493
616
  ...props,
494
617
  sx: {
@@ -518,6 +641,7 @@ Stack.displayName = "Stack";
518
641
  Image,
519
642
  InfiniteLinearProgress,
520
643
  Input,
644
+ InputNumber,
521
645
  Label,
522
646
  LinearProgress,
523
647
  Link,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/ui",
3
- "version": "1.32.0",
3
+ "version": "1.32.2",
4
4
  "description": "Primitive layout, typographic, and other components for styling applications.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "ttoss",
@@ -15,7 +15,6 @@
15
15
  ],
16
16
  "scripts": {
17
17
  "build": "tsup",
18
- "dev": "yarn workspace @docs/storybook run dev",
19
18
  "test": "jest"
20
19
  },
21
20
  "sideEffects": false,
@@ -24,16 +23,19 @@
24
23
  "@emotion/react": "^11.10.6",
25
24
  "@iconify-icon/react": "^1.0.7",
26
25
  "@theme-ui/match-media": "^0.15.7",
27
- "@ttoss/theme": "^1.4.15",
26
+ "@ttoss/theme": "^1.4.17",
28
27
  "theme-ui": "^0.15.7"
29
28
  },
30
29
  "peerDependencies": {
31
30
  "react": ">=16.8.0"
32
31
  },
33
32
  "devDependencies": {
34
- "@ttoss/config": "^1.29.3",
35
- "@ttoss/test-utils": "^1.21.2",
33
+ "@iconify-icons/mdi-light": "^1.2.5",
34
+ "@iconify/types": "^2.0.0",
35
+ "@ttoss/config": "^1.29.4",
36
+ "@ttoss/test-utils": "^1.21.3",
36
37
  "@types/jest": "^29.5.0",
38
+ "@types/react": "^18.0.35",
37
39
  "jest": "^29.5.0",
38
40
  "react": "^18.2.0",
39
41
  "tsup": "^6.7.0"
@@ -46,5 +48,5 @@
46
48
  "publishConfig": {
47
49
  "access": "public"
48
50
  },
49
- "gitHead": "d8d388f73b22a40e68b59c3276bb2d3b2f486225"
51
+ "gitHead": "0ea6f4641c1d97631f38c72da681a9e2dc54d0b7"
50
52
  }
@@ -1,11 +1,11 @@
1
1
  import { Flex, Icon, type IconType, Text } from '..';
2
- import { type InputProps as InputPropsUI, Input as InputUI } from 'theme-ui';
2
+ import { InputProps as InputPropsUI, Input as InputUI } from 'theme-ui';
3
3
  import React from 'react';
4
4
 
5
- export type InputProps = InputPropsUI & {
5
+ export interface InputProps extends InputPropsUI {
6
6
  leadingIcon?: IconType;
7
7
  trailingIcon?: IconType;
8
- };
8
+ }
9
9
 
10
10
  export const Input = React.forwardRef<HTMLInputElement, InputProps>(
11
11
  ({ leadingIcon, trailingIcon, className, sx, ...inputProps }, ref) => {
@@ -0,0 +1,146 @@
1
+ import { Flex, Icon, Text } from '..';
2
+ import { Input, type InputProps as InputPropsUI } from 'theme-ui';
3
+ import React from 'react';
4
+
5
+ export type InputNumberProps = Omit<
6
+ InputPropsUI,
7
+ 'type' | 'variant' | 'onChange'
8
+ > & {
9
+ onChange: (value: number) => void;
10
+ value?: number;
11
+ infoIcon?: boolean;
12
+ onClickInfoIcon?: () => void;
13
+ };
14
+
15
+ export const InputNumber = React.forwardRef<HTMLInputElement, InputNumberProps>(
16
+ ({ sx, value, infoIcon, onChange, onClickInfoIcon, ...inputProps }, ref) => {
17
+ const sxProps: InputPropsUI['sx'] = React.useMemo(() => {
18
+ const size = String(typeof value === 'undefined' ? 0 : value).length;
19
+
20
+ if (inputProps['aria-invalid'] === 'true') {
21
+ return {
22
+ width: `calc(139px + ${size > 1 ? size * 10 : 0}px)`,
23
+ textAlign: 'left',
24
+ '&[type=number]::-webkit-inner-spin-button, &[type=number]::-webkit-outer-spin-button':
25
+ {
26
+ '-webkit-appearance': 'none',
27
+ margin: 0,
28
+ },
29
+ ...sx,
30
+ paddingLeft: '3xl',
31
+ paddingRight: '2xl',
32
+ margin: 0,
33
+ };
34
+ }
35
+
36
+ return {
37
+ width: `calc(108px + ${size > 1 ? size * 10 : 0}px)`,
38
+ textAlign: 'center',
39
+ '&[type=number]::-webkit-inner-spin-button, &[type=number]::-webkit-outer-spin-button':
40
+ {
41
+ '-webkit-appearance': 'none',
42
+ margin: 0,
43
+ },
44
+ ...sx,
45
+ paddingLeft: '2xl',
46
+ paddingRight: '2xl',
47
+ margin: 0,
48
+ };
49
+ }, [inputProps, value, sx]);
50
+
51
+ const handleChangeUp = () => {
52
+ if (inputProps.disabled) {
53
+ return;
54
+ }
55
+
56
+ if (typeof value !== 'number') {
57
+ onChange(-1);
58
+ return;
59
+ }
60
+
61
+ onChange(value - 1);
62
+ };
63
+
64
+ const handleChangeDown = () => {
65
+ if (inputProps.disabled) {
66
+ return;
67
+ }
68
+
69
+ if (typeof value !== 'number') {
70
+ onChange(1);
71
+ return;
72
+ }
73
+
74
+ onChange(value + 1);
75
+ };
76
+
77
+ return (
78
+ <Flex
79
+ sx={{
80
+ width: 'fit-content',
81
+ ...sx,
82
+ position: 'relative',
83
+ padding: 0,
84
+ border: 'none',
85
+ }}
86
+ ref={ref}
87
+ aria-invalid={inputProps['aria-invalid']}
88
+ >
89
+ <Input
90
+ ref={ref}
91
+ variant="forms.inputNumber"
92
+ sx={sxProps}
93
+ type="number"
94
+ onChange={(e) => {
95
+ onChange(Number(e.target.value));
96
+ }}
97
+ value={value}
98
+ {...inputProps}
99
+ />
100
+
101
+ <Text
102
+ sx={{
103
+ position: 'absolute',
104
+ alignSelf: 'center',
105
+ left: '1rem',
106
+ zIndex: 1,
107
+ cursor: 'pointer',
108
+ }}
109
+ onClick={handleChangeUp}
110
+ >
111
+ <Icon icon="picker-down" />
112
+ </Text>
113
+
114
+ {infoIcon && (
115
+ <Text
116
+ sx={{
117
+ position: 'absolute',
118
+ alignSelf: 'center',
119
+ right: '2.5rem',
120
+ zIndex: 1,
121
+ cursor: onClickInfoIcon ? 'pointer' : 'default',
122
+ }}
123
+ onClick={onClickInfoIcon}
124
+ >
125
+ <Icon icon="info" />
126
+ </Text>
127
+ )}
128
+
129
+ <Text
130
+ sx={{
131
+ position: 'absolute',
132
+ alignSelf: 'center',
133
+ right: '1rem',
134
+ zIndex: 1,
135
+ cursor: 'pointer',
136
+ }}
137
+ onClick={handleChangeDown}
138
+ >
139
+ <Icon icon="picker-up" />
140
+ </Text>
141
+ </Flex>
142
+ );
143
+ }
144
+ );
145
+
146
+ InputNumber.displayName = 'InputNumber';
@@ -1,11 +1,8 @@
1
1
  import { Icon, Text } from '..';
2
- import {
3
- type SelectProps as SelectPropsUi,
4
- Select as SelectUi,
5
- } from 'theme-ui';
2
+ import { SelectProps, Select as SelectUi } from 'theme-ui';
6
3
  import React from 'react';
7
4
 
8
- export type SelectProps = SelectPropsUi;
5
+ export { type SelectProps };
9
6
 
10
7
  export const Select = React.forwardRef<HTMLSelectElement, SelectProps>(
11
8
  ({ arrow, ...props }, ref) => {
@@ -5,9 +5,9 @@ import {
5
5
  } from 'theme-ui';
6
6
  import React from 'react';
7
7
 
8
- export type TextareaProps = TextareaPropsUI & {
8
+ export interface TextareaProps extends TextareaPropsUI {
9
9
  trailingIcon?: IconType;
10
- };
10
+ }
11
11
 
12
12
  export const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
13
13
  ({ trailingIcon, className, sx, ...textareaProps }, ref) => {
package/src/index.ts CHANGED
@@ -34,4 +34,5 @@ export { Textarea, type TextareaProps } from './components/Textarea';
34
34
  export { Container, type ContainerProps } from './components/Container';
35
35
  export { HelpText, type HelpTextProps } from './components/HelpText';
36
36
  export { CloseButton, type CloseButtonProps } from './components/CloseButton';
37
+ export { InputNumber, type InputNumberProps } from './components/InputNumber';
37
38
  export { Stack, type StackProps } from './components/Stack';