@jars-labs/jars-components 1.0.57 → 1.0.58

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.
@@ -183,7 +183,7 @@ var Animation = function (_a) {
183
183
  var refVector = useRef(null);
184
184
  var _b = useState(null), lottie = _b[0], setLottie = _b[1];
185
185
  useEffect(function () {
186
- import('./lottie-D45kmDuF.js').then(function (n) { return n.l; }).then(function (Lottie) { return setLottie(Lottie.default); });
186
+ import('./lottie-DPfByjxI.js').then(function (n) { return n.l; }).then(function (Lottie) { return setLottie(Lottie.default); });
187
187
  }, []);
188
188
  useEffect(function () {
189
189
  if (lottie && refVector.current) {
@@ -438,7 +438,7 @@ var Input = function (_a) {
438
438
  var showLabel = !hideLabel && (isFocused || value.trim());
439
439
  var placeHolderValue = placeholder || label;
440
440
  var ErrorSection = useMemo(function () {
441
- return holdSpace && (jsxs(Flex, { className: classNames(styles$m.error, error ? styles$m.errorVisible : styles$m.errorHidden), gap: 4, ml: 0, children: [jsx(Info, { width: "18px", height: "18px", viewBox: "0 0 24 24", stroke: "var(--color-red-300)" }), jsx(Text, { variant: "xs", className: classNames(styles$m.errorText), as: "span", children: capitalizeFirstSentenceLetter(error) })] }));
441
+ return holdSpace && (jsxs(Flex, { className: classNames(styles$m.error, error ? styles$m.errorVisible : styles$m.errorHidden), gap: 4, ml: 0, style: { alignItems: 'flex-start' }, children: [jsx(Flex, { style: { flexShrink: 0 }, children: jsx(Info, { width: "18px", height: "18px", viewBox: "0 0 24 24", stroke: "var(--color-red-300)" }) }), jsx(Text, { variant: "xs", className: classNames(styles$m.errorText), as: "span", children: capitalizeFirstSentenceLetter(error) })] }));
442
442
  }, [error]);
443
443
  return (jsxs("div", { className: styles$m.container, children: [showLabel && (jsx("label", { className: classNames(styles$m.label, (_b = {},
444
444
  _b[styles$m.labelError] = error && !isFocused,
@@ -484,11 +484,14 @@ var Autocomplete = function (_a) {
484
484
  var handleOptionSubmit = function (option) {
485
485
  onOptionSubmit === null || onOptionSubmit === undefined ? undefined : onOptionSubmit(option);
486
486
  };
487
+ var searchTrimmed = searchValue.trim();
487
488
  var boldedOptions = options.map(function (option) {
488
- var index = option.label.toLowerCase().indexOf(searchValue.toLowerCase());
489
+ var index = option.label
490
+ .toLowerCase()
491
+ .indexOf(searchTrimmed.toLowerCase());
489
492
  if (index === -1)
490
- return (jsx(Dropdown.Option, { value: option.label, children: option.label }, option.id));
491
- return (jsxs(Dropdown.Option, { value: option.label, onClick: function () { return handleOptionSubmit(option); }, children: [option.label.slice(0, index), jsx("strong", { children: option.label.slice(index, index + searchValue.length) }), option.label.slice(index + searchValue.length)] }, option.id));
493
+ return (jsx(Dropdown.Option, { value: option.label, onClick: function () { return handleOptionSubmit(option); }, children: option.label }, option.id));
494
+ return (jsxs(Dropdown.Option, { value: option.label, onClick: function () { return handleOptionSubmit(option); }, children: [option.label.slice(0, index), jsx("strong", { children: option.label.slice(index, index + searchTrimmed.length) }), option.label.slice(index + searchTrimmed.length)] }, option.id));
492
495
  });
493
496
  var emptyOptions = (jsx(Dropdown.Option, { value: "No options found", style: { cursor: 'not-allowed', pointerEvents: 'none' }, children: "No matches found, try something else." }));
494
497
  var loadingOptions = (jsx(Dropdown.Option, { value: "Loading...", disabled: true, style: { display: 'flex', justifyContent: 'center' }, children: jsx(Loader, {}) }));
@@ -808,7 +811,10 @@ var DateInput = function (_a) {
808
811
  var showLabel = !hideLabel && (isFocused || value);
809
812
  var placeHolderValue = showLabel ? placeholder : label;
810
813
  var ErrorSection = useMemo(function () {
811
- return holdSpace && (jsxs(Flex, { className: styles$m.error, gap: 4, ml: 0, style: { visibility: error ? 'visible' : 'hidden' }, children: [jsx(Info, { width: "18px", height: "18px", viewBox: "0 0 24 24", stroke: "var(--color-red-300)" }), jsx(Text, { variant: "xs", className: classNames(styles$m.errorText), children: capitalizeFirstSentenceLetter(error || '') })] }));
814
+ return holdSpace && (jsxs(Flex, { className: styles$m.error, gap: 4, ml: 16, style: {
815
+ visibility: error ? 'visible' : 'hidden',
816
+ alignItems: 'flex-start',
817
+ }, children: [jsx(Flex, { style: { flexShrink: 0 }, children: jsx(Info, { width: "18px", height: "18px", viewBox: "0 0 24 24", stroke: "var(--color-red-300)" }) }), jsx(Text, { variant: "xs", className: classNames(styles$m.errorText), children: capitalizeFirstSentenceLetter(error || '') })] }));
812
818
  }, [error, holdSpace]);
813
819
  var handleBlur = function (e) {
814
820
  setIsFocused(false);
@@ -1041,6 +1047,8 @@ EyeShow.displayName = 'EyeShow';
1041
1047
  * @param {function} onChange - The function to call when the input password value changes.
1042
1048
  * @param {function} onBlur - The function to call when the input password loses focus.
1043
1049
  * @param {string} error - The error message to display.
1050
+ * @param {boolean} disabled - Whether to disable the input password field.
1051
+ * @param {boolean} defaultVisible - Whether to show the password by default.
1044
1052
  *
1045
1053
  * @return Attaches PasswordInput to target element and displays options
1046
1054
  *
@@ -1057,12 +1065,15 @@ EyeShow.displayName = 'EyeShow';
1057
1065
  *
1058
1066
  */
1059
1067
  var PasswordInput = function (_a) {
1060
- var name = _a.name, label = _a.label, placeholder = _a.placeholder, value = _a.value, onChange = _a.onChange, onBlur = _a.onBlur, error = _a.error;
1061
- var _b = useState(false), showPassword = _b[0], setShowPassword = _b[1];
1068
+ var name = _a.name, label = _a.label, placeholder = _a.placeholder, value = _a.value, onChange = _a.onChange, onBlur = _a.onBlur, error = _a.error, _b = _a.disabled, disabled = _b === undefined ? false : _b, _c = _a.defaultVisible, defaultVisible = _c === undefined ? false : _c;
1069
+ var _d = useState(defaultVisible), showPassword = _d[0], setShowPassword = _d[1];
1062
1070
  var togglePasswordVisibility = function () {
1063
1071
  setShowPassword(function (prevShowPassword) { return !prevShowPassword; });
1064
1072
  };
1065
- return (jsx(Input, { "data-testid": name, name: name, label: label, placeholder: placeholder, type: showPassword ? 'text' : 'password', value: value, onChange: onChange, onBlur: onBlur, error: error, rightSection: jsx(Flex, { onClick: togglePasswordVisibility, align: 'center', style: { cursor: 'pointer' }, children: showPassword ? (jsx(EyeShow, { width: "32px", height: "32px", stroke: "var(--color-neutral-600)" })) : (jsx(EyeHide, { width: "32px", height: "32px", stroke: "var(--color-neutral-600)" })) }) }));
1073
+ return (jsx(Input, { "data-testid": name, name: name, label: label, disabled: disabled, placeholder: placeholder, type: showPassword ? 'text' : 'password', value: value, onChange: onChange, onBlur: onBlur, error: error, rightSection: jsx(Flex, { onClick: !disabled ? togglePasswordVisibility : undefined, align: 'center', style: {
1074
+ cursor: !disabled ? 'pointer' : 'default',
1075
+ opacity: disabled ? 0.5 : 1,
1076
+ }, children: showPassword ? (jsx(EyeShow, { width: "32px", height: "32px", stroke: "var(--color-neutral-600)" })) : (jsx(EyeHide, { width: "32px", height: "32px", stroke: "var(--color-neutral-600)" })) }) }));
1066
1077
  };
1067
1078
  PasswordInput.displayName = 'PasswordInput';
1068
1079
 
@@ -1328,10 +1339,11 @@ var styles$6 = {"container":"Select-module_container__T9nVd","input":"Select-mod
1328
1339
  */
1329
1340
  var Select = function (_a) {
1330
1341
  var _b, _c;
1331
- var error = _a.error, description = _a.description, label = _a.label, placeholder = _a.placeholder, value = _a.value, onChange = _a.onChange, onBlur = _a.onBlur, name = _a.name, data = _a.data, _d = _a.disabled, disabled = _d === undefined ? false : _d, _e = _a.searchable, searchable = _e === undefined ? true : _e;
1342
+ var error = _a.error, description = _a.description, label = _a.label, placeholder = _a.placeholder, value = _a.value, onChange = _a.onChange, onBlur = _a.onBlur, name = _a.name, data = _a.data, _d = _a.disabled, disabled = _d === undefined ? false : _d, _e = _a.searchable, searchable = _e === undefined ? true : _e, renderOption = _a.renderOption;
1332
1343
  var _f = useState(false), isFocused = _f[0], setIsFocused = _f[1];
1333
1344
  var _g = useState(false), isHovered = _g[0], setIsHovered = _g[1];
1334
1345
  var _h = useState(false), isOpen = _h[0], setIsOpen = _h[1];
1346
+ var allowedValues = useMemo(function () { return data.map(function (option) { return option.value; }); }, [data]);
1335
1347
  var showLabel = isFocused || value;
1336
1348
  var placeHolderValue = showLabel ? placeholder : label;
1337
1349
  var ErrorSection = useMemo(function () { return (jsxs(Flex, { className: styles$6.error, gap: 4, ml: 0, style: { visibility: error ? 'visible' : 'hidden' }, children: [jsx(Info, { width: "18px", height: "18px", viewBox: "0 0 24 24", stroke: "var(--color-red-300)" }), jsx(Text, { variant: "xs", className: classNames(styles$6.errorText), children: error })] })); }, [error]);
@@ -1340,8 +1352,8 @@ var Select = function (_a) {
1340
1352
  if (onBlur) {
1341
1353
  onBlur();
1342
1354
  }
1343
- if (!value && onChange) {
1344
- onChange(null);
1355
+ if (value && !allowedValues.includes(value)) {
1356
+ onChange === null || onChange === undefined ? undefined : onChange(null);
1345
1357
  }
1346
1358
  };
1347
1359
  return (jsxs("div", { className: styles$6.container, children: [showLabel && (jsx("label", { className: classNames(styles$6.label, (_b = {},
@@ -1356,7 +1368,7 @@ var Select = function (_a) {
1356
1368
  option: styles$6.option,
1357
1369
  }, data: data, placeholder: placeHolderValue, value: value, name: name || '', onChange: onChange, comboboxProps: { zIndex: 1000 }, error: ErrorSection, onFocus: function () { return setIsFocused(true); }, onBlur: handleBlur, inputWrapperOrder: ['label', 'input', 'description', 'error'], description: !error && description && jsx(Text, { variant: "xs", children: description }), descriptionProps: { className: styles$6.description }, errorProps: { className: styles$6.error }, rightSection: jsx(Chevron, { rotate: isOpen ? 90 : 270 }), rightSectionProps: {
1358
1370
  className: styles$6.chevron,
1359
- }, withCheckIcon: false, onDropdownOpen: function () { return setIsOpen(true); }, onDropdownClose: function () { return setIsOpen(false); }, disabled: disabled, searchable: searchable }) })] }));
1371
+ }, withCheckIcon: false, onDropdownOpen: function () { return setIsOpen(true); }, onDropdownClose: function () { return setIsOpen(false); }, disabled: disabled, searchable: searchable, allowDeselect: false, autoComplete: "new-password", renderOption: renderOption }) })] }));
1360
1372
  };
1361
1373
  Select.displayName = 'Select';
1362
1374
 
@@ -1985,4 +1997,4 @@ var Refresh = function (props) {
1985
1997
  Refresh.displayName = 'Refresh';
1986
1998
 
1987
1999
  export { ChevronCollapse as $, Accordion as A, Badge as B, Card as C, DateInput as D, EnterCodeInput as E, FileInput as F, ToastContainer as G, Tooltip as H, IncrementNumber as I, Multiselect as J, NavBarSide as K, Link as L, Message as M, NavBar as N, Alert as O, PasswordInput as P, Arrow as Q, RadioButton as R, SegmentedControl as S, Table as T, Attachment as U, AvatarPlaceholder as V, Bell as W, Calendar as X, Cat as Y, Chat as Z, Chevron as _, AccordionItem as a, Clock as a0, Close as a1, Cloud as a2, Delete as a3, Document as a4, Dog as a5, EyeHide as a6, EyeShow as a7, Fingerprint as a8, Google as a9, Visa as aA, Warning as aB, World as aC, AISearch as aD, AIGenerate as aE, AIPrompt as aF, AIRedo as aG, Refresh as aH, capitalizeFirstSentenceLetter as aI, Grid as aa, Hamburger as ab, HappyFace as ac, House as ad, HouseTime as ae, Identification as af, Info as ag, Location as ah, Mail as ai, Menu as aj, MenuTouched as ak, Notification as al, Open as am, Pets as an, Phone as ao, Plaid as ap, Plus as aq, Remove as ar, Search as as, Shield as at, StepIndicator as au, ThreeDots as av, ThumbsDown as aw, Tick as ax, Umbrello as ay, Upload as az, AccordionControl as b, AccordionPanel as c, ActionIcon as d, Animation as e, Autocomplete as f, getDefaultExportFromCjs as g, badgeVariantMap as h, Button as i, cardStatusVariantMap as j, CardStatus as k, Checkbox as l, Chip as m, Dropdown as n, FileUpload as o, Input as p, LinkModal as q, Loader as r, Modal as s, Pagination as t, Select as u, StatusBadge as v, Stepper as w, Tabs as x, Text as y, Textarea as z };
1988
- //# sourceMappingURL=index-BA-eBbTW.js.map
2000
+ //# sourceMappingURL=index-BNZjZyyj.js.map