cloudmr-ux 4.1.2 → 4.1.4

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.
@@ -19,6 +19,7 @@ export interface CmrSelectProps {
19
19
  className?: string;
20
20
  /** Pass-through kept for compatibility */
21
21
  SelectProps?: Record<string, any>;
22
+ primaryColor?: string;
22
23
  }
23
24
  declare const CmrSelect: React.FC<CmrSelectProps>;
24
25
  export default CmrSelect;
@@ -14,18 +14,18 @@ import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { useEffect, useId, useMemo, useState } from 'react';
15
15
  import ReactSelect from 'react-select';
16
16
  import './CmrSelect.css';
17
- var baseStyles = {
18
- control: function (base, state) { return (__assign(__assign({}, base), { minHeight: 40, borderColor: state.isFocused ? '#580F8B' : base.borderColor, boxShadow: state.isFocused ? '0 0 0 1px #580F8B' : 'none', '&:hover': { borderColor: '#580F8B' }, fontFamily: 'Inter, Roboto, Helvetica, Arial, sans-serif', borderRadius: 4 })); },
17
+ var createStyles = function (primaryColor) { return ({
18
+ control: function (base, state) { return (__assign(__assign({}, base), { minHeight: 40, borderColor: state.isFocused ? primaryColor : base.borderColor, boxShadow: state.isFocused ? "0 0 0 1px ".concat(primaryColor) : 'none', '&:hover': { borderColor: primaryColor }, fontFamily: 'Inter, Roboto, Helvetica, Arial, sans-serif', borderRadius: 4 })); },
19
19
  placeholder: function (base) { return (__assign(__assign({}, base), { color: 'rgba(0,0,0,0.6)' })); },
20
- singleValue: function (base) { return (__assign(__assign({}, base), { color: '#580F8B', fontWeight: 400, fontFamily: 'Inter, Roboto, Helvetica, Arial, sans-serif' })); },
20
+ singleValue: function (base) { return (__assign(__assign({}, base), { color: primaryColor, fontWeight: 400, fontFamily: 'Inter, Roboto, Helvetica, Arial, sans-serif' })); },
21
21
  option: function (base, state) { return (__assign(__assign({}, base), { backgroundColor: state.isFocused || state.isSelected ? '#F3E5F5' : 'white', color: '#000', fontFamily: 'Inter, Roboto, Helvetica, Arial, sans-serif', cursor: state.isDisabled ? 'not-allowed' : 'pointer' })); },
22
22
  menuPortal: function (base) { return (__assign(__assign({}, base), { zIndex: 2000 })); },
23
23
  menu: function (base) { return (__assign(__assign({}, base), { zIndex: 1300 })); }
24
- };
24
+ }); };
25
25
  var CmrSelect = function (_a) {
26
- var options = _a.options, disabled = _a.disabled, value = _a.value, onChange = _a.onChange, _b = _a.defaultValue, defaultValue = _b === void 0 ? '' : _b, fullWidth = _a.fullWidth, sx = _a.sx, className = _a.className;
26
+ var options = _a.options, disabled = _a.disabled, value = _a.value, onChange = _a.onChange, _b = _a.defaultValue, defaultValue = _b === void 0 ? '' : _b, fullWidth = _a.fullWidth, sx = _a.sx, className = _a.className, _c = _a.primaryColor, primaryColor = _c === void 0 ? '#580F8B' : _c;
27
27
  var isControlled = value !== undefined;
28
- var _c = useState(defaultValue), internal = _c[0], setInternal = _c[1];
28
+ var _d = useState(defaultValue), internal = _d[0], setInternal = _d[1];
29
29
  var currentValue = isControlled ? value : internal;
30
30
  useEffect(function () {
31
31
  if (isControlled)
@@ -41,6 +41,6 @@ var CmrSelect = function (_a) {
41
41
  onChange === null || onChange === void 0 ? void 0 : onChange(next);
42
42
  };
43
43
  var wrapperStyle = __assign({ minWidth: 200, maxWidth: 400, width: fullWidth ? '100%' : 'auto' }, sx);
44
- return (_jsx("div", __assign({ className: className !== null && className !== void 0 ? className : 'dropdown-select', style: wrapperStyle }, { children: _jsx(ReactSelect, { inputId: id, isDisabled: !!disabled, options: options.map(function (o) { return (__assign(__assign({}, o), { isDisabled: o.disabled })); }), value: rsValue, onChange: handleChange, placeholder: "Select", isClearable: true, styles: baseStyles, menuPortalTarget: document.body }) })));
44
+ return (_jsx("div", __assign({ className: className !== null && className !== void 0 ? className : 'dropdown-select', style: wrapperStyle }, { children: _jsx(ReactSelect, { inputId: id, isDisabled: !!disabled, options: options.map(function (o) { return (__assign(__assign({}, o), { isDisabled: o.disabled })); }), value: rsValue, onChange: handleChange, placeholder: "Select", isClearable: true, styles: createStyles(primaryColor), menuPortalTarget: document.body }) })));
45
45
  };
46
46
  export default CmrSelect;
@@ -1,3 +1,10 @@
1
- export default function Register({ onBackToSignin, }: {
1
+ type RegisterProps = {
2
2
  onBackToSignin: () => void;
3
- }): import("react/jsx-runtime").JSX.Element;
3
+ /**
4
+ * When true, do not render Container/Paper wrapper.
5
+ * Useful for embedded usage (e.g., inside a Popover) to avoid double-card outlines.
6
+ */
7
+ hidePaper?: boolean;
8
+ };
9
+ export default function Register({ onBackToSignin, hidePaper, }: RegisterProps): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -26,20 +26,20 @@ import { useEffect, useState } from "react";
26
26
  import { validatePassword, isPasswordValid as checkPasswordValid, } from "../../utils/passwordValidation";
27
27
  import PasswordRequirements from "../../components/PasswordRequirements";
28
28
  export default function Register(_a) {
29
- var onBackToSignin = _a.onBackToSignin;
29
+ var onBackToSignin = _a.onBackToSignin, _b = _a.hidePaper, hidePaper = _b === void 0 ? false : _b;
30
30
  var dispatch = useAppDispatch();
31
- var _b = useAppSelector(function (state) { return state.authenticate; }), loading = _b.loading, error = _b.error, registerSuccess = _b.registerSuccess;
32
- var _c = useState(false), showSuccess = _c[0], setShowSuccess = _c[1];
33
- var _d = useState(""), password = _d[0], setPassword = _d[1];
34
- var _e = useState(""), confirmPassword = _e[0], setConfirmPassword = _e[1];
35
- var _f = useState(false), showPasswordValidation = _f[0], setShowPasswordValidation = _f[1];
36
- var _g = useState({
31
+ var _c = useAppSelector(function (state) { return state.authenticate; }), loading = _c.loading, error = _c.error, registerSuccess = _c.registerSuccess;
32
+ var _d = useState(false), showSuccess = _d[0], setShowSuccess = _d[1];
33
+ var _e = useState(""), password = _e[0], setPassword = _e[1];
34
+ var _f = useState(""), confirmPassword = _f[0], setConfirmPassword = _f[1];
35
+ var _g = useState(false), showPasswordValidation = _g[0], setShowPasswordValidation = _g[1];
36
+ var _h = useState({
37
37
  minLength: false,
38
38
  hasNumber: false,
39
39
  hasSpecial: false,
40
40
  hasUppercase: false,
41
41
  hasLowercase: false
42
- }), passwordValidation = _g[0], setPasswordValidation = _g[1];
42
+ }), passwordValidation = _h[0], setPasswordValidation = _h[1];
43
43
  useEffect(function () {
44
44
  if (registerSuccess) {
45
45
  setShowSuccess(true);
@@ -117,10 +117,14 @@ export default function Register(_a) {
117
117
  };
118
118
  dispatch(registerUser(registerData));
119
119
  };
120
- return (_jsx(Container, __assign({ maxWidth: "md", sx: { mt: 4, mb: 4 } }, { children: _jsx(Paper, __assign({ sx: { p: 3 } }, { children: _jsxs(Box, __assign({ component: "form", onSubmit: handleSubmit, noValidate: true }, { children: [_jsx(Typography, __assign({ variant: "h6", gutterBottom: true, sx: { mb: 2 } }, { children: "Create Account" })), error && (_jsx(Alert, __assign({ severity: "error", sx: { mb: 2 }, onClose: function () { return dispatch(clearError()); } }, { children: error }))), showSuccess && (_jsx(Alert, __assign({ severity: "success", sx: { mb: 2 } }, { children: "Registration successful! Please wait for admin approval before signing in." }))), _jsxs(Grid, __assign({ container: true, spacing: 2 }, { children: [_jsx(Grid, __assign({ item: true, xs: 12, sm: 6 }, { children: _jsx(TextField, { margin: "normal", required: true, fullWidth: true, id: "firstname", label: "First Name", name: "firstname", size: "small", autoFocus: true }) })), _jsx(Grid, __assign({ item: true, xs: 12, sm: 6 }, { children: _jsx(TextField, { margin: "normal", required: true, fullWidth: true, id: "lastname", label: "Last Name", name: "lastname", size: "small" }) }))] })), _jsx(TextField, { margin: "normal", required: true, fullWidth: true, id: "username", label: "Username", name: "username", size: "small" }), _jsx(TextField, { margin: "normal", required: true, fullWidth: true, id: "email", label: "Email Address", name: "email", type: "email", size: "small", autoComplete: "email" }), _jsx(TextField, { margin: "normal", required: true, fullWidth: true, name: "password", label: "Password", type: "password", id: "password", size: "small", autoComplete: "new-password", value: password, onChange: handlePasswordChange }), _jsx(PasswordRequirements, { validation: passwordValidation, show: showPasswordValidation }), _jsx(TextField, { margin: "normal", required: true, fullWidth: true, name: "confirmPassword", label: "Confirm Password", type: "password", id: "confirmPassword", size: "small", autoComplete: "new-password", value: confirmPassword, onChange: handleConfirmPasswordChange, error: confirmPassword.length > 0 && !passwordsMatch, helperText: confirmPassword.length > 0 && !passwordsMatch
121
- ? "Passwords do not match"
122
- : "" }), _jsx(Button, __assign({ type: "submit", fullWidth: true, variant: "contained", sx: { mt: 3, mb: 2 }, disabled: loading || !isFormValid() }, { children: loading ? "Registering..." : "Register" })), _jsx(Grid, __assign({ container: true, justifyContent: "flex-end" }, { children: _jsx(Grid, __assign({ item: true }, { children: _jsx(Link, __assign({ href: "#", onClick: function (e) {
123
- e.preventDefault();
124
- onBackToSignin();
125
- }, variant: "body2" }, { children: "Already have an account? Sign in" })) })) }))] })) })) })));
120
+ var body = (_jsxs(Box, __assign({ component: "form", onSubmit: handleSubmit, noValidate: true }, { children: [_jsx(Typography, __assign({ variant: "h6", gutterBottom: true, sx: { mb: 2 } }, { children: "Create Account" })), error && (_jsx(Alert, __assign({ severity: "error", sx: { mb: 2 }, onClose: function () { return dispatch(clearError()); } }, { children: error }))), showSuccess && (_jsx(Alert, __assign({ severity: "success", sx: { mb: 2 } }, { children: "Registration successful! Please wait for admin approval before signing in." }))), _jsxs(Grid, __assign({ container: true, spacing: 2 }, { children: [_jsx(Grid, __assign({ item: true, xs: 12, sm: 6 }, { children: _jsx(TextField, { margin: "normal", required: true, fullWidth: true, id: "firstname", label: "First Name", name: "firstname", size: "small", autoFocus: true }) })), _jsx(Grid, __assign({ item: true, xs: 12, sm: 6 }, { children: _jsx(TextField, { margin: "normal", required: true, fullWidth: true, id: "lastname", label: "Last Name", name: "lastname", size: "small" }) }))] })), _jsx(TextField, { margin: "normal", required: true, fullWidth: true, id: "username", label: "Username", name: "username", size: "small" }), _jsx(TextField, { margin: "normal", required: true, fullWidth: true, id: "email", label: "Email Address", name: "email", type: "email", size: "small", autoComplete: "email" }), _jsx(TextField, { margin: "normal", required: true, fullWidth: true, name: "password", label: "Password", type: "password", id: "password", size: "small", autoComplete: "new-password", value: password, onChange: handlePasswordChange }), _jsx(PasswordRequirements, { validation: passwordValidation, show: showPasswordValidation }), _jsx(TextField, { margin: "normal", required: true, fullWidth: true, name: "confirmPassword", label: "Confirm Password", type: "password", id: "confirmPassword", size: "small", autoComplete: "new-password", value: confirmPassword, onChange: handleConfirmPasswordChange, error: confirmPassword.length > 0 && !passwordsMatch, helperText: confirmPassword.length > 0 && !passwordsMatch ? "Passwords do not match" : "" }), _jsx(Button, __assign({ type: "submit", fullWidth: true, variant: "contained", sx: { mt: 3, mb: 2 }, disabled: loading || !isFormValid() }, { children: loading ? "Registering..." : "Register" })), _jsx(Grid, __assign({ container: true, justifyContent: "flex-end" }, { children: _jsx(Grid, __assign({ item: true }, { children: _jsx(Link, __assign({ href: "#", onClick: function (e) {
121
+ e.preventDefault();
122
+ onBackToSignin();
123
+ }, variant: "body2" }, { children: "Already have an account? Sign in" })) })) }))] })));
124
+ // Embedded mode: no container/paper outline (popover provides the frame)
125
+ if (hidePaper) {
126
+ return _jsx(Box, __assign({ sx: { p: 0 } }, { children: body }));
127
+ }
128
+ // Default mode: same as before
129
+ return (_jsx(Container, __assign({ maxWidth: "md", sx: { mt: 4, mb: 4 } }, { children: _jsx(Paper, __assign({ sx: { p: 3 } }, { children: body })) })));
126
130
  }
@@ -80,7 +80,7 @@ export default function Signin(_a) {
80
80
  }, variant: "body2" }, { children: "Forgot Password?" })) })), _jsx(Grid, __assign({ item: true }, { children: _jsx(Link, __assign({ href: "#", onClick: function (e) {
81
81
  e.preventDefault();
82
82
  setShowRegister(true);
83
- }, variant: "body2" }, { children: "Sign Up" })) }))] }))] })) })) }))) : showForgotPassword ? (_jsx(ForgotPassword, { onBackToSignin: function () { return setShowForgotPassword(false); } })) : (_jsx(Register, { onBackToSignin: function () { return setShowRegister(false); } })) }))] })));
83
+ }, variant: "body2" }, { children: "Sign Up" })) }))] }))] })) })) }))) : showForgotPassword ? (_jsx(ForgotPassword, { onBackToSignin: function () { return setShowForgotPassword(false); } })) : (_jsx(Register, { onBackToSignin: function () { return setShowRegister(false); }, hidePaper: variant === "embed" })) }))] })));
84
84
  return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: variant === "embed" ? (
85
85
  // Popover/card mode: no "page layout" wrapper
86
86
  content) : (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudmr-ux",
3
- "version": "4.1.2",
3
+ "version": "4.1.4",
4
4
  "author": "erosmontin@gmail.com",
5
5
  "license": "MIT",
6
6
  "repository": "erosmontin/cloudmr-ux",