@jars-labs/jars-components 1.0.53 → 1.0.55-hotfix-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.
@@ -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-CfbCx5ue.js').then(function (n) { return n.l; }).then(function (Lottie) { return setLottie(Lottie.default); });
186
+ import('./lottie-lyoNo44r.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) {
@@ -464,31 +464,31 @@ Loader.displayName = 'Loader';
464
464
  * Autocomplete component
465
465
  * Autocomplete user input with any list of options
466
466
  *
467
- * @param options - list of options to display in dropdown
467
+ * @param options - list of options to display in dropdown (array of AutocompleteOption)
468
468
  * @param label - input label
469
469
  * @param placeholder - input placeholder
470
- * @param onOptionSubmit - function to call when option is selected by click or enter
470
+ * @param onOptionSubmit - function to call when option is selected by click or enter (option: AutocompleteOption | null)
471
+ * @param onClear - function to call when clear button is clicked
471
472
  * @param disabled - disable input
472
473
  * @param onSearchChange - function to call when search value changes
473
474
  * @param searchValue - search value
474
475
  * @param loading - show loading spinner
475
476
  * @param minCharactersToShowDropdown - minimum characters to show dropdown options
476
477
  * @param style - custom styles for the input
477
- * @param initialValue - default value for the input
478
+ * @param initialValue - default value for the input (AutocompleteOption)
478
479
  *
479
480
  * @return Autocomplete component with dropdown
480
481
  */
481
482
  var Autocomplete = function (_a) {
482
- var options = _a.options, _b = _a.placeholder, placeholder = _b === undefined ? 'Search' : _b, onOptionSubmit = _a.onOptionSubmit, _c = _a.disabled, disabled = _c === undefined ? false : _c, onSearchChange = _a.onSearchChange, searchValue = _a.searchValue, _d = _a.loading, loading = _d === undefined ? false : _d, _e = _a.minCharactersToShowDropdown, minCharactersToShowDropdown = _e === undefined ? 2 : _e, style = _a.style, initialValue = _a.initialValue;
483
- var handleOptionSubmit = function (value) {
484
- onOptionSubmit === null || onOptionSubmit === undefined ? undefined : onOptionSubmit(value);
485
- onSearchChange(value);
483
+ var options = _a.options, _b = _a.placeholder, placeholder = _b === undefined ? 'Search' : _b, onOptionSubmit = _a.onOptionSubmit, _c = _a.disabled, disabled = _c === undefined ? false : _c, onClear = _a.onClear, onSearchChange = _a.onSearchChange, searchValue = _a.searchValue, _d = _a.loading, loading = _d === undefined ? false : _d, _e = _a.minCharactersToShowDropdown, minCharactersToShowDropdown = _e === undefined ? 2 : _e, style = _a.style, initialValue = _a.initialValue;
484
+ var handleOptionSubmit = function (option) {
485
+ onOptionSubmit === null || onOptionSubmit === undefined ? undefined : onOptionSubmit(option);
486
486
  };
487
487
  var boldedOptions = options.map(function (option) {
488
- var index = option.toLowerCase().indexOf(searchValue.toLowerCase());
488
+ var index = option.label.toLowerCase().indexOf(searchValue.toLowerCase());
489
489
  if (index === -1)
490
- return (jsx(Dropdown.Option, { value: option, children: option }, option));
491
- return (jsxs(Dropdown.Option, { value: option, onClick: function () { return handleOptionSubmit(option); }, children: [option.slice(0, index), jsx("strong", { children: option.slice(index, index + searchValue.length) }), option.slice(index + searchValue.length)] }, option));
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));
492
492
  });
493
493
  var emptyOptions = (jsx(Dropdown.Option, { value: "No options found", style: { cursor: 'not-allowed', pointerEvents: 'none' }, children: "No matches found, try something else." }));
494
494
  var loadingOptions = (jsx(Dropdown.Option, { value: "Loading...", disabled: true, style: { display: 'flex', justifyContent: 'center' }, children: jsx(Loader, {}) }));
@@ -498,12 +498,15 @@ var Autocomplete = function (_a) {
498
498
  return boldedOptions.length > 0 ? boldedOptions : emptyOptions;
499
499
  };
500
500
  var _f = useState(false), touched = _f[0], setTouched = _f[1];
501
- return (jsx(Dropdown, { options: renderOptions(), onOptionSubmit: handleOptionSubmit, maxHeight: 250, closeOnSelect: true, children: function (store) { return (jsx(Input, { hideLabel: true, label: "Search", placeholder: placeholder, onClick: function () {
501
+ var _g = useState(false), hasClearedInitial = _g[0], setHasClearedInitial = _g[1];
502
+ var inputValue = touched || hasClearedInitial ? searchValue : initialValue || '';
503
+ return (jsx(Dropdown, { options: renderOptions(), maxHeight: 250, closeOnSelect: true, children: function (store) { return (jsx(Input, { hideLabel: true, label: "Search", placeholder: placeholder, onClick: function () {
502
504
  return !disabled &&
503
505
  searchValue.length >= minCharactersToShowDropdown &&
504
506
  store.toggleDropdown();
505
- }, onChange: function (event) {
507
+ }, value: inputValue, onChange: function (event) {
506
508
  setTouched(true);
509
+ setHasClearedInitial(true);
507
510
  var value = event.currentTarget.value;
508
511
  onSearchChange(value);
509
512
  if (!store.dropdownOpened &&
@@ -514,20 +517,18 @@ var Autocomplete = function (_a) {
514
517
  store.resetSelectedOption();
515
518
  store.closeDropdown();
516
519
  }
517
- }, value: touched ? searchValue : initialValue || '', holdSpace: false, leftSection: jsx(Search, {}), rightSection: jsx(ActionIcon, { radius: "sm", variant: "light", onClick: function () {
520
+ }, holdSpace: false, leftSection: jsx(Search, {}), rightSection: jsx(ActionIcon, { radius: "sm", variant: "light", onClick: function () {
521
+ setHasClearedInitial(true);
522
+ setTouched(true);
518
523
  onSearchChange('');
519
- onOptionSubmit === null || onOptionSubmit === undefined ? undefined : onOptionSubmit('');
524
+ onClear === null || onClear === undefined ? undefined : onClear();
520
525
  store.resetSelectedOption();
521
526
  store.closeDropdown();
522
- }, style: { visibility: searchValue ? 'visible' : 'hidden' }, children: jsx(Close, {}) }), onKeyDown: function (event) {
523
- if (event.key === 'Enter' && options.length !== 1) {
524
- handleOptionSubmit(searchValue);
525
- store.toggleDropdown();
526
- }
527
- else if (event.key === 'Enter' && !loading) {
528
- handleOptionSubmit(options[0]);
529
- store.toggleDropdown();
530
- }
527
+ }, style: { visibility: inputValue ? 'visible' : 'hidden' }, children: jsx(Close, {}) }), onKeyDown: function (event) {
528
+ if (event.key !== 'Enter')
529
+ return;
530
+ onOptionSubmit(null);
531
+ store.closeDropdown();
531
532
  }, style: style })); } }));
532
533
  };
533
534
  Autocomplete.displayName = 'Autocomplete';
@@ -1331,6 +1332,7 @@ var Select = function (_a) {
1331
1332
  var _f = useState(false), isFocused = _f[0], setIsFocused = _f[1];
1332
1333
  var _g = useState(false), isHovered = _g[0], setIsHovered = _g[1];
1333
1334
  var _h = useState(false), isOpen = _h[0], setIsOpen = _h[1];
1335
+ var allowedValues = useMemo(function () { return data.map(function (option) { return option.value; }); }, [data]);
1334
1336
  var showLabel = isFocused || value;
1335
1337
  var placeHolderValue = showLabel ? placeholder : label;
1336
1338
  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]);
@@ -1339,8 +1341,8 @@ var Select = function (_a) {
1339
1341
  if (onBlur) {
1340
1342
  onBlur();
1341
1343
  }
1342
- if (!value && onChange) {
1343
- onChange(null);
1344
+ if (value && !allowedValues.includes(value)) {
1345
+ onChange === null || onChange === undefined ? undefined : onChange(null);
1344
1346
  }
1345
1347
  };
1346
1348
  return (jsxs("div", { className: styles$6.container, children: [showLabel && (jsx("label", { className: classNames(styles$6.label, (_b = {},
@@ -1355,7 +1357,7 @@ var Select = function (_a) {
1355
1357
  option: styles$6.option,
1356
1358
  }, 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: {
1357
1359
  className: styles$6.chevron,
1358
- }, withCheckIcon: false, onDropdownOpen: function () { return setIsOpen(true); }, onDropdownClose: function () { return setIsOpen(false); }, disabled: disabled, searchable: searchable }) })] }));
1360
+ }, withCheckIcon: false, onDropdownOpen: function () { return setIsOpen(true); }, onDropdownClose: function () { return setIsOpen(false); }, disabled: disabled, searchable: searchable, allowDeselect: false, autoComplete: "new-password" }) })] }));
1359
1361
  };
1360
1362
  Select.displayName = 'Select';
1361
1363
 
@@ -1978,5 +1980,10 @@ var AIRedo = function (props) {
1978
1980
  };
1979
1981
  AIRedo.displayName = 'AI Redo';
1980
1982
 
1981
- 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, capitalizeFirstSentenceLetter as aH, 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 };
1982
- //# sourceMappingURL=index-BHJYO-So.js.map
1983
+ var Refresh = function (props) {
1984
+ return (jsxs(Icon, __assign({}, props, { children: [jsx("path", { d: "M20.3846 16.5176L24.077 15.5945L25 19.2869", stroke: "black", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsx("path", { d: "M24.077 15.5945C23.292 17.9399 21.8117 19.9908 19.8332 21.4747C17.8546 22.9587 15.4713 23.8053 13 23.9022C10.7258 23.9026 8.5065 23.2031 6.64367 21.8984C4.78085 20.5937 3.36474 18.7474 2.58771 16.6099", stroke: "black", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsx("path", { d: "M5.61538 9.133L1.92308 10.0561L1 6.36377", stroke: "black", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsx("path", { d: "M1.92303 10.0561C2.74932 7.73647 4.24047 5.71157 6.21039 4.23411C8.18031 2.75667 10.5417 1.89214 13 1.74841C15.2853 1.75484 17.5127 2.46797 19.3768 3.79004C21.241 5.11211 22.6505 6.97838 23.4123 9.13303", stroke: "black", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] })));
1985
+ };
1986
+ Refresh.displayName = 'Refresh';
1987
+
1988
+ 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 };
1989
+ //# sourceMappingURL=index-d_mR-3VI.js.map