@codezee/sixtify-brahma 0.2.195 → 0.2.196
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/package.json +1 -1
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/SmartTextField.d.ts +5 -0
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/SmartTextField.d.ts.map +1 -0
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/SmartTextField.js +59 -0
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/index.d.ts +1 -0
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/index.d.ts.map +1 -1
- package/packages/shared-components/dist/SmartGrid/Components/EditableFields/index.js +1 -0
package/package.json
CHANGED
package/packages/shared-components/dist/SmartGrid/Components/EditableFields/SmartTextField.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { InputHTMLAttributes } from "react";
|
|
2
|
+
export declare const SmartTextField: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<{
|
|
3
|
+
errorMessage?: string;
|
|
4
|
+
} & InputHTMLAttributes<HTMLInputElement> & import("react").RefAttributes<HTMLInputElement>>>;
|
|
5
|
+
//# sourceMappingURL=SmartTextField.d.ts.map
|
package/packages/shared-components/dist/SmartGrid/Components/EditableFields/SmartTextField.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmartTextField.d.ts","sourceRoot":"","sources":["../../../../src/SmartGrid/Components/EditableFields/SmartTextField.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAiFjD,eAAO,MAAM,cAAc;mBA5EV,MAAM;6FAwFtB,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SmartTextField = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const SmartTooltip_1 = require("./SmartTooltip");
|
|
8
|
+
const SmartTextFieldComponent = (0, react_1.forwardRef)(({ errorMessage, ...rest }, ref) => {
|
|
9
|
+
const theme = (0, material_1.useTheme)();
|
|
10
|
+
const { butterflyBlue, lipstickRed, iron } = theme.palette.app.color;
|
|
11
|
+
const [isFocused, setIsFocused] = (0, react_1.useState)(false);
|
|
12
|
+
const getBorderColor = () => {
|
|
13
|
+
if (errorMessage && !isFocused) {
|
|
14
|
+
return lipstickRed[900];
|
|
15
|
+
}
|
|
16
|
+
if (isFocused) {
|
|
17
|
+
return butterflyBlue[900];
|
|
18
|
+
}
|
|
19
|
+
return iron[800];
|
|
20
|
+
};
|
|
21
|
+
return ((0, jsx_runtime_1.jsx)(SmartTooltip_1.SmartTooltip, { title: errorMessage ?? "", position: "top", delay: 50, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
22
|
+
display: "flex",
|
|
23
|
+
flexDirection: "column",
|
|
24
|
+
gap: "4px",
|
|
25
|
+
width: "100%",
|
|
26
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
27
|
+
display: "flex",
|
|
28
|
+
alignItems: "center",
|
|
29
|
+
border: `2px solid ${getBorderColor()}`,
|
|
30
|
+
borderRadius: "4px",
|
|
31
|
+
padding: "4px 8px",
|
|
32
|
+
background: "white",
|
|
33
|
+
minHeight: "20px",
|
|
34
|
+
}, children: (0, jsx_runtime_1.jsx)("input", { ref: ref, ...rest, style: {
|
|
35
|
+
width: "100%",
|
|
36
|
+
border: "none",
|
|
37
|
+
background: "transparent",
|
|
38
|
+
padding: "0",
|
|
39
|
+
fontSize: "14px",
|
|
40
|
+
outline: "none",
|
|
41
|
+
}, onClick: (e) => e.stopPropagation(), onFocus: (e) => {
|
|
42
|
+
e.stopPropagation();
|
|
43
|
+
setIsFocused(true);
|
|
44
|
+
}, onBlur: (e) => {
|
|
45
|
+
e.stopPropagation();
|
|
46
|
+
setIsFocused(false);
|
|
47
|
+
} }) }) }) }));
|
|
48
|
+
});
|
|
49
|
+
SmartTextFieldComponent.displayName = "SmartTextFieldComponent";
|
|
50
|
+
// Memoize with custom comparison to prevent unnecessary re-renders
|
|
51
|
+
exports.SmartTextField = (0, react_1.memo)(SmartTextFieldComponent, (prevProps, nextProps) => {
|
|
52
|
+
// Only re-render if these specific props change
|
|
53
|
+
return (prevProps.name === nextProps.name &&
|
|
54
|
+
prevProps.value === nextProps.value &&
|
|
55
|
+
prevProps.disabled === nextProps.disabled &&
|
|
56
|
+
prevProps.type === nextProps.type &&
|
|
57
|
+
prevProps.errorMessage === nextProps.errorMessage);
|
|
58
|
+
});
|
|
59
|
+
exports.SmartTextField.displayName = "SmartTextField";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/SmartGrid/Components/EditableFields/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/SmartGrid/Components/EditableFields/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC"}
|
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./SmartSelectField"), exports);
|
|
18
18
|
__exportStar(require("./SmartTooltip"), exports);
|
|
19
|
+
__exportStar(require("./SmartTextField"), exports);
|