lecom-ui 5.3.54 → 5.3.55
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.
|
@@ -2,7 +2,7 @@ import React__default from 'react';
|
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { Typography } from '../Typography/Typography.js';
|
|
4
4
|
import { Input } from '../Input/Input.js';
|
|
5
|
-
import {
|
|
5
|
+
import { Plus, Minus, Info } from 'lucide-react';
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
7
7
|
|
|
8
8
|
const NumberControl = ({
|
|
@@ -13,7 +13,8 @@ const NumberControl = ({
|
|
|
13
13
|
required = false,
|
|
14
14
|
min = 0,
|
|
15
15
|
className = "",
|
|
16
|
-
info = false
|
|
16
|
+
info = false,
|
|
17
|
+
labelPosition = "top"
|
|
17
18
|
}) => {
|
|
18
19
|
const handleIncrement = () => {
|
|
19
20
|
const current = parseInt(value, 10) || 0;
|
|
@@ -38,17 +39,18 @@ const NumberControl = ({
|
|
|
38
39
|
onChange(numbersOnly);
|
|
39
40
|
}
|
|
40
41
|
};
|
|
41
|
-
|
|
42
|
+
const labelElement = /* @__PURE__ */ React__default.createElement(
|
|
42
43
|
Typography,
|
|
43
44
|
{
|
|
44
45
|
variant: "body-medium-400",
|
|
45
46
|
textColor: "text-grey-950",
|
|
46
|
-
className: "flex items-center gap-1"
|
|
47
|
+
className: "flex items-center gap-1 justify-center"
|
|
47
48
|
},
|
|
48
49
|
label,
|
|
49
50
|
required && /* @__PURE__ */ React__default.createElement("span", { className: "body-large-400 text-red-600" }, "*"),
|
|
50
51
|
info && /* @__PURE__ */ React__default.createElement(Info, { size: 12 })
|
|
51
|
-
)
|
|
52
|
+
);
|
|
53
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: twMerge(clsx("flex flex-col gap-1", className)) }, labelPosition === "top" && labelElement, /* @__PURE__ */ React__default.createElement(
|
|
52
54
|
Input,
|
|
53
55
|
{
|
|
54
56
|
value,
|
|
@@ -73,7 +75,7 @@ const NumberControl = ({
|
|
|
73
75
|
}
|
|
74
76
|
)
|
|
75
77
|
}
|
|
76
|
-
));
|
|
78
|
+
), labelPosition === "bottom" && labelElement);
|
|
77
79
|
};
|
|
78
80
|
|
|
79
81
|
export { NumberControl };
|
package/dist/index.d.ts
CHANGED
|
@@ -945,8 +945,9 @@ interface NumberControlProps {
|
|
|
945
945
|
min?: number;
|
|
946
946
|
className?: string;
|
|
947
947
|
info?: boolean;
|
|
948
|
+
labelPosition?: 'top' | 'bottom';
|
|
948
949
|
}
|
|
949
|
-
declare const NumberControl: ({ label, value, onChange, placeholder, required, min, className, info, }: NumberControlProps) => React__default.JSX.Element;
|
|
950
|
+
declare const NumberControl: ({ label, value, onChange, placeholder, required, min, className, info, labelPosition, }: NumberControlProps) => React__default.JSX.Element;
|
|
950
951
|
|
|
951
952
|
declare const Popover: React$1.FC<PopoverPrimitive.PopoverProps>;
|
|
952
953
|
declare const PopoverTrigger: React$1.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React$1.RefAttributes<HTMLButtonElement>>;
|