@jars-labs/jars-components 1.0.2 → 1.0.3
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/Input/Input.d.ts +31 -1
- package/dist/Input/Input.d.ts.map +1 -1
- package/dist/NavBar/NavBar.d.ts.map +1 -1
- package/dist/PasswordInput/PasswordInput.d.ts +33 -0
- package/dist/PasswordInput/PasswordInput.d.ts.map +1 -0
- package/dist/assets/index.css +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +60 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +60 -8
- package/dist/index.js.map +1 -1
- package/dist/utils/stringUtils.d.ts +2 -0
- package/dist/utils/stringUtils.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -377,6 +377,7 @@ const inputRightIcon = "mcfb7df269_inputRightIcon";
|
|
|
377
377
|
const label$6 = "mcfb7df269_label";
|
|
378
378
|
const labelFocused$1 = "mcfb7df269_labelFocused";
|
|
379
379
|
const labelError$1 = "mcfb7df269_labelError";
|
|
380
|
+
const labelDisabled$1 = "mcfb7df269_labelDisabled";
|
|
380
381
|
const description$1 = "mcfb7df269_description";
|
|
381
382
|
const error$1 = "mcfb7df269_error";
|
|
382
383
|
const errorText$1 = "mcfb7df269_errorText";
|
|
@@ -391,6 +392,7 @@ inputRightIcon,
|
|
|
391
392
|
label: label$6,
|
|
392
393
|
labelFocused: labelFocused$1,
|
|
393
394
|
labelError: labelError$1,
|
|
395
|
+
labelDisabled: labelDisabled$1,
|
|
394
396
|
description: description$1,
|
|
395
397
|
error: error$1,
|
|
396
398
|
errorText: errorText$1,
|
|
@@ -488,32 +490,81 @@ var elementType = {
|
|
|
488
490
|
h4: 'h4',
|
|
489
491
|
};
|
|
490
492
|
var Text = t.forwardRef(function (props, ref) {
|
|
491
|
-
var
|
|
493
|
+
var as = props.as, children = props.children, className = props.className, color = props.color, style = props.style, variant = props.variant, weight = props.weight, rest = __rest(props, ["as", "children", "className", "color", "style", "variant", "weight"]);
|
|
492
494
|
var combinedStyle = __assign(__assign({}, style), { color: color });
|
|
493
495
|
var combinedClassName = classNames(className, styles$j['text'], styles$j[variant || ''], styles$j[weight || '']);
|
|
494
|
-
return t.createElement(
|
|
496
|
+
return t.createElement(as || elementType[variant] || 'p', __assign({ ref: ref, className: combinedClassName, style: combinedStyle }, rest), children);
|
|
495
497
|
});
|
|
496
498
|
|
|
499
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
500
|
+
function capitalizeFirstSentenceLetter(input) {
|
|
501
|
+
var str;
|
|
502
|
+
if (typeof input !== 'string') {
|
|
503
|
+
if (Array.isArray(input)) {
|
|
504
|
+
str = input.join(' ');
|
|
505
|
+
}
|
|
506
|
+
else {
|
|
507
|
+
return String(input);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
else {
|
|
511
|
+
str = input;
|
|
512
|
+
}
|
|
513
|
+
var lowerCaseString = str.toLowerCase().replace(/_/g, ' ');
|
|
514
|
+
return lowerCaseString.charAt(0).toUpperCase() + lowerCaseString.slice(1);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Input component that extends the TextInput component from Mantine.
|
|
519
|
+
* It includes additional features like error handling, description, and label visibility.
|
|
520
|
+
*
|
|
521
|
+
* @param {string} name - The name of the input field.
|
|
522
|
+
* @param {string} label - The label for the input field.
|
|
523
|
+
* @param {string} placeholder - The placeholder text for the input field.
|
|
524
|
+
* @param {string} value - The value of the input field.
|
|
525
|
+
* @param {function} onChange - The function to call when the input value changes.
|
|
526
|
+
* @param {function} onBlur - The function to call when the input loses focus.
|
|
527
|
+
* @param {string} error - The error message to display.
|
|
528
|
+
* @param {string} description - The description text to display below the input field.
|
|
529
|
+
* @param {boolean} holdSpace - Whether to hold space for the error message even when there is no error.
|
|
530
|
+
* @param {React.ReactNode} leftSection - The icon to display on the left side of the input field.
|
|
531
|
+
* @param {React.ReactNode} rightSection - The icon to display on the right side of the input field.
|
|
532
|
+
* @param {boolean} hideLabel - Whether to hide the label when it's not required.
|
|
533
|
+
* @param {string} type - The type of the input field (default is 'text').
|
|
534
|
+
*
|
|
535
|
+
* @example
|
|
536
|
+
* <Input
|
|
537
|
+
* name="username"
|
|
538
|
+
* label="Username"
|
|
539
|
+
* placeholder="Enter your username"
|
|
540
|
+
* value={username}
|
|
541
|
+
* onChange={(e) => setUsername(e.target.value)}
|
|
542
|
+
* onBlur={() => console.log('Input blurred')}
|
|
543
|
+
* error="Username is required"
|
|
544
|
+
* description="Your unique username"
|
|
545
|
+
* />
|
|
546
|
+
*/
|
|
497
547
|
var Input = function (_a) {
|
|
498
548
|
var _b, _c;
|
|
499
|
-
var _d = _a.error, error = _d === void 0 ? '' : _d, name = _a.name, placeholder = _a.placeholder, _e = _a.value, value = _e === void 0 ? '' : _e, onChange = _a.onChange, label = _a.label, description = _a.description, leftSection = _a.leftSection, rightSection = _a.rightSection, _f = _a.type, type = _f === void 0 ? 'text' : _f, _g = _a.holdSpace, holdSpace = _g === void 0 ? true : _g, _h = _a.hideLabel, hideLabel = _h === void 0 ? false : _h, rest = __rest(_a, ["error", "name", "placeholder", "value", "onChange", "label", "description", "leftSection", "rightSection", "type", "holdSpace", "hideLabel"]);
|
|
500
|
-
var
|
|
501
|
-
var
|
|
549
|
+
var _d = _a.error, error = _d === void 0 ? '' : _d, name = _a.name, placeholder = _a.placeholder, _e = _a.value, value = _e === void 0 ? '' : _e, onChange = _a.onChange, label = _a.label, description = _a.description, leftSection = _a.leftSection, rightSection = _a.rightSection, _f = _a.type, type = _f === void 0 ? 'text' : _f, _g = _a.holdSpace, holdSpace = _g === void 0 ? true : _g, _h = _a.hideLabel, hideLabel = _h === void 0 ? false : _h, _j = _a.disabled, disabled = _j === void 0 ? false : _j, rest = __rest(_a, ["error", "name", "placeholder", "value", "onChange", "label", "description", "leftSection", "rightSection", "type", "holdSpace", "hideLabel", "disabled"]);
|
|
550
|
+
var _k = t.useState(false), isFocused = _k[0], setIsFocused = _k[1];
|
|
551
|
+
var _l = t.useState(false), isHovered = _l[0], setIsHovered = _l[1];
|
|
502
552
|
var showLabel = !hideLabel && (isFocused || value.trim());
|
|
503
553
|
var placeHolderValue = showLabel ? placeholder : label;
|
|
504
554
|
var ErrorSection = t.useMemo(function () {
|
|
505
|
-
return holdSpace && (jsxRuntime.jsxs(core.Flex, { className: styles$k.error, gap: 4, ml: 0, style: { visibility: error ? 'visible' : 'hidden' }, children: [jsxRuntime.jsx(Info, { width: "18px", height: "18px", viewBox: "0 0 24 24", stroke: "var(--color-red-300)" }), jsxRuntime.jsx(Text, { variant: "xs", className: classNames(styles$k.errorText), children: error })] }));
|
|
555
|
+
return holdSpace && (jsxRuntime.jsxs(core.Flex, { className: styles$k.error, gap: 4, ml: 0, style: { visibility: error ? 'visible' : 'hidden' }, children: [jsxRuntime.jsx(Info, { width: "18px", height: "18px", viewBox: "0 0 24 24", stroke: "var(--color-red-300)" }), jsxRuntime.jsx(Text, { variant: "xs", className: classNames(styles$k.errorText), children: capitalizeFirstSentenceLetter(error) })] }));
|
|
506
556
|
}, [error]);
|
|
507
557
|
return (jsxRuntime.jsxs("div", { className: styles$k.container, children: [showLabel && (jsxRuntime.jsx("label", { className: classNames(styles$k.label, (_b = {},
|
|
508
558
|
_b[styles$k.labelError] = error && !isFocused,
|
|
509
559
|
_b[styles$k.labelFocused] = isFocused || isHovered,
|
|
560
|
+
_b[styles$k.labelDisabled] = disabled,
|
|
510
561
|
_b)), children: label })), jsxRuntime.jsx("div", { onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onFocus: function () { return setIsFocused(true); }, onBlur: function () { return setIsFocused(false); }, children: jsxRuntime.jsx(core.TextInput, __assign({ classNames: {
|
|
511
562
|
input: classNames(styles$k.input, (_c = {},
|
|
512
563
|
_c[styles$k.inputLeftIcon] = leftSection,
|
|
513
564
|
_c[styles$k.inputRightIcon] = rightSection,
|
|
514
565
|
_c[styles$k.inputError] = error,
|
|
515
566
|
_c)),
|
|
516
|
-
}, placeholder: placeHolderValue, name: name, error: ErrorSection, description: !error && jsxRuntime.jsx(Text, { variant: "xs", children: description }), descriptionProps: { className: styles$k.description }, errorProps: { className: styles$k.error }, inputWrapperOrder: ['label', 'input', 'description', 'error'], value: value, onChange: onChange, leftSection: leftSection, rightSection: rightSection, leftSectionProps: { className: styles$k.leftSection }, rightSectionProps: { className: styles$k.rightSection }
|
|
567
|
+
}, placeholder: placeHolderValue, name: name, error: ErrorSection, description: !error && jsxRuntime.jsx(Text, { variant: "xs", children: description }), descriptionProps: { className: styles$k.description }, errorProps: { className: styles$k.error }, inputWrapperOrder: ['label', 'input', 'description', 'error'], value: value, onChange: onChange, leftSection: leftSection, rightSection: rightSection, leftSectionProps: { className: styles$k.leftSection }, rightSectionProps: { className: styles$k.rightSection }, type: type, disabled: disabled }, rest)) })] }));
|
|
517
568
|
};
|
|
518
569
|
|
|
519
570
|
var Loader = function (props) {
|
|
@@ -1253,7 +1304,7 @@ var Umbrello = function (props) {
|
|
|
1253
1304
|
|
|
1254
1305
|
var NavBar = function (_a) {
|
|
1255
1306
|
var children = _a.children;
|
|
1256
|
-
return (jsxRuntime.jsxs(core.Flex, { p: "24px 120px", bg: "var(--color-white)", children: [jsxRuntime.jsx("a", { href: "/dashboard/management-companies", children: jsxRuntime.jsx(Umbrello, { fill: "var(--color-neutral-600)", width: "200", height: "40", viewBox: "0 0 200 40" }) }), children] }));
|
|
1307
|
+
return (jsxRuntime.jsxs(core.Flex, { p: "24px 120px", bg: "var(--color-white)", align: "center", justify: "space-between", children: [jsxRuntime.jsx("a", { href: "/dashboard/management-companies", children: jsxRuntime.jsx(Umbrello, { fill: "var(--color-neutral-600)", width: "200", height: "40", viewBox: "0 0 200 40" }) }), children] }));
|
|
1257
1308
|
};
|
|
1258
1309
|
|
|
1259
1310
|
var Pagination = function (_a) {
|
|
@@ -22015,5 +22066,6 @@ exports.Visa = Visa;
|
|
|
22015
22066
|
exports.Warning = Warning;
|
|
22016
22067
|
exports.World = World;
|
|
22017
22068
|
exports.badgeVariantMap = badgeVariantMap;
|
|
22069
|
+
exports.capitalizeFirstSentenceLetter = capitalizeFirstSentenceLetter;
|
|
22018
22070
|
exports.cardStatusVariantMap = cardStatusVariantMap;
|
|
22019
22071
|
//# sourceMappingURL=index.js.map
|