@jars-labs/jars-components 1.0.1 → 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/LICENSE.md +26 -0
- package/dist/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Icons/Icon.d.ts.map +1 -1
- 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 +63 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +63 -11
- 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 +26 -5
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) {
|
|
@@ -545,8 +596,8 @@ var Autocomplete = function (_a) {
|
|
|
545
596
|
var boldedOptions = options.map(function (option) {
|
|
546
597
|
var index = option.toLowerCase().indexOf(searchValue.toLowerCase());
|
|
547
598
|
if (index === -1)
|
|
548
|
-
return jsxRuntime.jsx(Dropdown.Option, { value: option, children: option });
|
|
549
|
-
return (jsxRuntime.jsxs(Dropdown.Option, { value: option, onClick: function () { return handleOptionSubmit(option); }, children: [option.slice(0, index), jsxRuntime.jsx("strong", { children: option.slice(index, index + searchValue.length) }), option.slice(index + searchValue.length)] }));
|
|
599
|
+
return (jsxRuntime.jsx(Dropdown.Option, { value: option, children: option }, option));
|
|
600
|
+
return (jsxRuntime.jsxs(Dropdown.Option, { value: option, onClick: function () { return handleOptionSubmit(option); }, children: [option.slice(0, index), jsxRuntime.jsx("strong", { children: option.slice(index, index + searchValue.length) }), option.slice(index + searchValue.length)] }, option));
|
|
550
601
|
});
|
|
551
602
|
var emptyOptions = (jsxRuntime.jsx(Dropdown.Option, { value: "No options found", style: { cursor: 'not-allowed', pointerEvents: 'none' }, children: "No matches found, try something else." }));
|
|
552
603
|
var loadingOptions = (jsxRuntime.jsx(Dropdown.Option, { value: "Loading...", disabled: true, style: { display: 'flex', justifyContent: 'center' }, children: jsxRuntime.jsx(Loader, {}) }));
|
|
@@ -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) {
|
|
@@ -1703,7 +1754,7 @@ var Attachment = function (props) {
|
|
|
1703
1754
|
|
|
1704
1755
|
var Bell = function (_a) {
|
|
1705
1756
|
var _b = _a.width, width = _b === void 0 ? '32px' : _b, _c = _a.height, height = _c === void 0 ? '32px' : _c, _d = _a.viewBox, viewBox = _d === void 0 ? '0 0 32 32' : _d, _e = _a.alert, alert = _e === void 0 ? false : _e;
|
|
1706
|
-
return (jsxRuntime.jsxs(Icon, { width: width, height: height, viewBox: viewBox, children: [jsxRuntime.jsx("path", { d: "M14.1429 27.8572H17.5714", stroke: "black",
|
|
1757
|
+
return (jsxRuntime.jsxs(Icon, { width: width, height: height, viewBox: viewBox, children: [jsxRuntime.jsx("path", { d: "M14.1429 27.8572H17.5714", stroke: "black", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsxRuntime.jsx("path", { d: "M22.7143 15C22.7143 13.1813 21.9919 11.4372 20.7059 10.1512C19.4199 8.86527 17.6758 8.14282 15.8572 8.14282C14.0385 8.14282 12.2944 8.86527 11.0084 10.1512C9.72247 11.4372 9.00002 13.1813 9.00002 15V21C9.00002 21.6819 8.72909 22.3361 8.24686 22.8183C7.76463 23.3005 7.11057 23.5714 6.42859 23.5714H25.2857C24.6038 23.5714 23.9496 23.3005 23.4674 22.8183C22.9852 22.3361 22.7143 21.6819 22.7143 21V15Z", stroke: "black", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsxRuntime.jsx("path", { d: "M4.71429 14.777C4.71522 13.1453 5.10435 11.5372 5.84956 10.0855C6.59476 8.63384 7.67464 7.38032 9.00001 6.42847", stroke: "black", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsxRuntime.jsx("path", { d: "M25.8648 10.0855C25.1196 8.63384 24.0396 7.38032 22.7143 6.42847", stroke: "black", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), alert && (jsxRuntime.jsx("circle", { cx: "22.2857", cy: "9.14282", r: "5.5", fill: "#7B34D6", stroke: "white" }))] }));
|
|
1707
1758
|
};
|
|
1708
1759
|
|
|
1709
1760
|
var Cat = function (props) {
|
|
@@ -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
|