@wavelengthusaf/components 2.7.0 → 2.7.1
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/README.md +5 -0
- package/dist/cjs/index.cjs +112 -38
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +4 -1
- package/dist/components/TextField/WavelengthTextField.d.ts +4 -1
- package/dist/components/TextField/WavelengthTextField.d.ts.map +1 -1
- package/dist/esm/index.d.ts +4 -1
- package/dist/esm/index.js +113 -39
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/cjs/index.cjs
CHANGED
|
@@ -206,7 +206,7 @@ var require_react_is_development = __commonJS({
|
|
|
206
206
|
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
207
207
|
var Element = REACT_ELEMENT_TYPE;
|
|
208
208
|
var ForwardRef2 = REACT_FORWARD_REF_TYPE;
|
|
209
|
-
var
|
|
209
|
+
var Fragment14 = REACT_FRAGMENT_TYPE;
|
|
210
210
|
var Lazy = REACT_LAZY_TYPE;
|
|
211
211
|
var Memo2 = REACT_MEMO_TYPE;
|
|
212
212
|
var Portal = REACT_PORTAL_TYPE;
|
|
@@ -265,7 +265,7 @@ var require_react_is_development = __commonJS({
|
|
|
265
265
|
exports.ContextProvider = ContextProvider;
|
|
266
266
|
exports.Element = Element;
|
|
267
267
|
exports.ForwardRef = ForwardRef2;
|
|
268
|
-
exports.Fragment =
|
|
268
|
+
exports.Fragment = Fragment14;
|
|
269
269
|
exports.Lazy = Lazy;
|
|
270
270
|
exports.Memo = Memo2;
|
|
271
271
|
exports.Portal = Portal;
|
|
@@ -5959,6 +5959,54 @@ function DefaultPagination({ totalPages, currentPageNumber, siblingCount = 1, bo
|
|
|
5959
5959
|
|
|
5960
5960
|
|
|
5961
5961
|
|
|
5962
|
+
|
|
5963
|
+
var InputWrapper = _styledcomponents2.default.div`
|
|
5964
|
+
position: relative;
|
|
5965
|
+
width: 100%;
|
|
5966
|
+
`;
|
|
5967
|
+
var StandardTextField = _styledcomponents2.default.input`
|
|
5968
|
+
width: ${(props) => props.width || "320px"};
|
|
5969
|
+
height: ${(props) => props.height || "35px"};
|
|
5970
|
+
padding-left: 12px;
|
|
5971
|
+
font-size: 16px;
|
|
5972
|
+
border: none;
|
|
5973
|
+
border-bottom: 2px solid ${(props) => props.error ? "red" : props.borderColor || "#ccc"}; /* Red border when error */
|
|
5974
|
+
color: ${(props) => props.textColor || "black"};
|
|
5975
|
+
outline: none;
|
|
5976
|
+
box-sizing: border-box;
|
|
5977
|
+
background-color: transparent;
|
|
5978
|
+
|
|
5979
|
+
&:focus {
|
|
5980
|
+
border-bottom-color: ${(props) => props.error ? "red" : props.focusColor || "#d16a2f"};
|
|
5981
|
+
}
|
|
5982
|
+
|
|
5983
|
+
&::placeholder {
|
|
5984
|
+
opacity: 0.4;
|
|
5985
|
+
color: ${(props) => props.error ? "red" : "#888"}; /* Placeholder color changes to red on error */
|
|
5986
|
+
}
|
|
5987
|
+
|
|
5988
|
+
&:focus + label,
|
|
5989
|
+
&:valid + label {
|
|
5990
|
+
top: -5px;
|
|
5991
|
+
font-size: 12px;
|
|
5992
|
+
color: ${(props) => props.error ? "red" : props.labelColor}; // Change label color on error
|
|
5993
|
+
}
|
|
5994
|
+
|
|
5995
|
+
&:not(:placeholder-shown) + label {
|
|
5996
|
+
top: -8px;
|
|
5997
|
+
font-size: 12px;
|
|
5998
|
+
color: ${(props) => props.error ? "red" : props.labelColor}; // Label color when input has a value
|
|
5999
|
+
}
|
|
6000
|
+
`;
|
|
6001
|
+
var StyledLabel = _styledcomponents2.default.label`
|
|
6002
|
+
position: absolute;
|
|
6003
|
+
top: 8px;
|
|
6004
|
+
left: 16px;
|
|
6005
|
+
font-size: 14px;
|
|
6006
|
+
color: ${(props) => props.color || "#aaa"};
|
|
6007
|
+
pointer-events: none;
|
|
6008
|
+
transition: all 0.3s ease-out;
|
|
6009
|
+
`;
|
|
5962
6010
|
function WavelengthTextField(props) {
|
|
5963
6011
|
const [hasError, setHasError] = _react.useState.call(void 0, false);
|
|
5964
6012
|
const handleChange = _react.useCallback.call(void 0,
|
|
@@ -5969,48 +6017,74 @@ function WavelengthTextField(props) {
|
|
|
5969
6017
|
}
|
|
5970
6018
|
},
|
|
5971
6019
|
[props.regex]
|
|
5972
|
-
// Ensures function doesn't change unless `regex` does
|
|
5973
6020
|
);
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
error: hasError,
|
|
5985
|
-
helperText: hasError ? "Invalid Input" : "",
|
|
5986
|
-
sx: {
|
|
5987
|
-
"& .MuiInputBase-root": {
|
|
5988
|
-
height: props.height || "51px",
|
|
5989
|
-
width: props.width || "320px",
|
|
5990
|
-
borderRadius: "8px"
|
|
6021
|
+
if (props.variant === "outlined") {
|
|
6022
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6023
|
+
_TextField2.default,
|
|
6024
|
+
{
|
|
6025
|
+
type: props.type,
|
|
6026
|
+
required: props.required,
|
|
6027
|
+
label: props.label,
|
|
6028
|
+
onChange: (e) => {
|
|
6029
|
+
handleChange(e);
|
|
6030
|
+
_optionalChain([props, 'access', _18 => _18.onChange, 'optionalCall', _19 => _19(e)]);
|
|
5991
6031
|
},
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6032
|
+
error: hasError,
|
|
6033
|
+
helperText: hasError ? props.errorMessage : "",
|
|
6034
|
+
sx: {
|
|
6035
|
+
"& .MuiInputBase-root": {
|
|
6036
|
+
height: props.height || "51px",
|
|
6037
|
+
width: props.width || "320px",
|
|
6038
|
+
borderRadius: "8px"
|
|
6039
|
+
},
|
|
6040
|
+
"&.MuiTextField-root": {
|
|
6041
|
+
"& label": { color: !hasError ? props.labelColor || "rgba(89, 99, 129, 1)" : "red" },
|
|
6042
|
+
"& .MuiOutlinedInput-root": {
|
|
6043
|
+
"& fieldset": {
|
|
6044
|
+
border: "1px solid",
|
|
6045
|
+
borderColor: !hasError ? props.borderColor || `rgba(89, 99, 129, 1)` : "red"
|
|
6046
|
+
},
|
|
6047
|
+
"&.Mui-focused fieldset": {
|
|
6048
|
+
borderColor: !hasError ? props.focusColor || `rgba(26, 128, 131, 0.1)` : "red"
|
|
6049
|
+
}
|
|
6001
6050
|
}
|
|
6002
6051
|
}
|
|
6052
|
+
},
|
|
6053
|
+
placeholder: props.placeholder,
|
|
6054
|
+
InputLabelProps: {
|
|
6055
|
+
shrink: props.shrink
|
|
6056
|
+
},
|
|
6057
|
+
InputProps: {
|
|
6058
|
+
style: { color: props.textColor || "inherit" }
|
|
6003
6059
|
}
|
|
6004
|
-
},
|
|
6005
|
-
placeholder: props.placeholder,
|
|
6006
|
-
InputLabelProps: {
|
|
6007
|
-
shrink: props.shrink
|
|
6008
|
-
},
|
|
6009
|
-
InputProps: {
|
|
6010
|
-
style: { color: props.textColor || "inherit" }
|
|
6011
6060
|
}
|
|
6012
|
-
|
|
6013
|
-
)
|
|
6061
|
+
);
|
|
6062
|
+
} else if (props.variant === "standard") {
|
|
6063
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, InputWrapper, { children: [
|
|
6064
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6065
|
+
StandardTextField,
|
|
6066
|
+
{
|
|
6067
|
+
type: props.type,
|
|
6068
|
+
id: "custom-input",
|
|
6069
|
+
placeholder: props.placeholder,
|
|
6070
|
+
required: props.required,
|
|
6071
|
+
focusColor: props.focusColor,
|
|
6072
|
+
borderColor: props.borderColor,
|
|
6073
|
+
width: props.width,
|
|
6074
|
+
height: props.height,
|
|
6075
|
+
textColor: props.textColor,
|
|
6076
|
+
error: hasError,
|
|
6077
|
+
onChange: (e) => {
|
|
6078
|
+
handleChange(e);
|
|
6079
|
+
_optionalChain([props, 'access', _20 => _20.onChange, 'optionalCall', _21 => _21(e)]);
|
|
6080
|
+
}
|
|
6081
|
+
}
|
|
6082
|
+
),
|
|
6083
|
+
props.label && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, StyledLabel, { htmlFor: "custom-input", color: props.labelColor, children: props.label }),
|
|
6084
|
+
props.error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { fontSize: ".75rem", color: "red", paddingLeft: "12px", marginTop: "3px" }, children: props.errorMessage })
|
|
6085
|
+
] });
|
|
6086
|
+
}
|
|
6087
|
+
return null;
|
|
6014
6088
|
}
|
|
6015
6089
|
|
|
6016
6090
|
|