@jars-labs/jars-components 1.1.2 → 1.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.
@@ -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-DsKwcNMJ.js').then(function (n) { return n.l; }).then(function (Lottie) { return setLottie(Lottie.default); });
186
+ import('./lottie-CTM27qrd.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) {
@@ -488,22 +488,30 @@ Loader.displayName = 'Loader';
488
488
  * @param minCharactersToShowDropdown - minimum characters to show dropdown options
489
489
  * @param style - custom styles for the input
490
490
  * @param initialValue - default value for the input (AutocompleteOption)
491
+ * @param renderOption - function to render the option (option: AutocompleteOption, highlightedLabel: React.ReactNode)
491
492
  *
492
493
  * @return Autocomplete component with dropdown
493
494
  */
494
495
  var Autocomplete = function (_a) {
495
- 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;
496
+ 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, renderOption = _a.renderOption;
496
497
  var handleOptionSubmit = function (option) {
497
498
  onOptionSubmit === null || onOptionSubmit === undefined ? undefined : onOptionSubmit(option);
498
499
  };
499
- var searchTrimmed = searchValue.trim();
500
- var boldedOptions = options.map(function (option) {
500
+ var getHighlightedLabel = function (option) {
501
501
  var index = option.label
502
502
  .toLowerCase()
503
503
  .indexOf(searchTrimmed.toLowerCase());
504
- if (index === -1)
505
- return (jsx(Dropdown.Option, { value: option.label, onClick: function () { return handleOptionSubmit(option); }, children: option.label }, option.id));
506
- 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));
504
+ if (index === -1) {
505
+ return option.label;
506
+ }
507
+ return (jsxs(Fragment, { children: [option.label.slice(0, index), jsx("strong", { children: option.label.slice(index, index + searchTrimmed.length) }), option.label.slice(index + searchTrimmed.length)] }));
508
+ };
509
+ var searchTrimmed = searchValue.trim();
510
+ var boldedOptions = options.map(function (option) {
511
+ var highlightedLabel = getHighlightedLabel(option);
512
+ return (jsx(Dropdown.Option, { value: option.label, onClick: function () { return handleOptionSubmit(option); }, children: renderOption
513
+ ? renderOption(option, highlightedLabel)
514
+ : highlightedLabel }, option.id));
507
515
  });
508
516
  var emptyOptions = (jsx(Dropdown.Option, { value: "No options found", style: { cursor: 'not-allowed', pointerEvents: 'none' }, children: "No matches found, try something else." }));
509
517
  var loadingOptions = (jsx(Dropdown.Option, { value: "Loading...", disabled: true, style: { display: 'flex', justifyContent: 'center' }, children: jsx(Loader, {}) }));
@@ -648,7 +656,7 @@ var Badge = forwardRef(function (_a, ref) {
648
656
  });
649
657
  Badge.displayName = 'Badge';
650
658
 
651
- var styles$l = {"button":"Button-module_button__7BLGt","label":"Button-module_label__447Ll","button-flex":"Button-module_button-flex__bzVRB","button--filled":"Button-module_button--filled__BKGu2","label-color--filled":"Button-module_label-color--filled__wJHlw","label-color--filled--disabled":"Button-module_label-color--filled--disabled__BbMbV","button--outlined":"Button-module_button--outlined__QZysw","label-color--outlined":"Button-module_label-color--outlined__seGi5","label-color--outlined--disabled":"Button-module_label-color--outlined--disabled__qXPjI","button--underlined":"Button-module_button--underlined__BsY5s","label-color--underlined":"Button-module_label-color--underlined__ymMfq","label-color--underlined--disabled":"Button-module_label-color--underlined--disabled__TBDd8","button--underlined-neutral":"Button-module_button--underlined-neutral__30A91","label-color--underlined-neutral":"Button-module_label-color--underlined-neutral__1xWMY","label-color--underlined-neutral--disabled":"Button-module_label-color--underlined-neutral--disabled__RQKW7","button--delete":"Button-module_button--delete__Xqpbl","label-color--delete":"Button-module_label-color--delete__iPB3X","label-color--delete--disabled":"Button-module_label-color--delete--disabled__lJkM6","button--small":"Button-module_button--small__3npYU","button--medium":"Button-module_button--medium__WRSIQ","button--large":"Button-module_button--large__bGVS1"};
659
+ var styles$l = {"button":"Button-module_button__7BLGt","label":"Button-module_label__447Ll","button-flex":"Button-module_button-flex__bzVRB","button--filled":"Button-module_button--filled__BKGu2","label-color--filled":"Button-module_label-color--filled__wJHlw","label-color--filled--disabled":"Button-module_label-color--filled--disabled__BbMbV","button--outlined":"Button-module_button--outlined__QZysw","label-color--outlined":"Button-module_label-color--outlined__seGi5","label-color--outlined--disabled":"Button-module_label-color--outlined--disabled__qXPjI","button--outlined-error":"Button-module_button--outlined-error__xR07R","label-color--outlined-error":"Button-module_label-color--outlined-error__-2cf9","label-color--outlined-error--disabled":"Button-module_label-color--outlined-error--disabled__LZB7z","button--underlined":"Button-module_button--underlined__BsY5s","label-color--underlined":"Button-module_label-color--underlined__ymMfq","label-color--underlined--disabled":"Button-module_label-color--underlined--disabled__TBDd8","button--underlined-neutral":"Button-module_button--underlined-neutral__30A91","label-color--underlined-neutral":"Button-module_label-color--underlined-neutral__1xWMY","label-color--underlined-neutral--disabled":"Button-module_label-color--underlined-neutral--disabled__RQKW7","button--delete":"Button-module_button--delete__Xqpbl","label-color--delete":"Button-module_label-color--delete__iPB3X","label-color--delete--disabled":"Button-module_label-color--delete--disabled__lJkM6","button--small":"Button-module_button--small__3npYU","button--medium":"Button-module_button--medium__WRSIQ","button--large":"Button-module_button--large__bGVS1"};
652
660
 
653
661
  var Button = forwardRef(function (_a, ref) {
654
662
  var _b;
@@ -915,7 +923,7 @@ var Clock = function (_a) {
915
923
  Clock.displayName = 'Clock';
916
924
 
917
925
  var Document = function (props) {
918
- return (jsxs(Icon, __assign({}, props, { children: [jsx("path", { fillRule: "evenodd", stroke: props.stroke, strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5", d: "M24.885 8.552l-3.77-3.77c-.5-.5-1.179-.782-1.886-.782H9.667A2.666 2.666 0 007 6.667v18.666A2.666 2.666 0 009.667 28H23a2.666 2.666 0 002.667-2.667V10.437c0-.706-.282-1.385-.782-1.885v0z", clipRule: "evenodd" }), jsx("path", { stroke: props.stroke, strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5", d: "M25.667 10.667h-5.334A1.334 1.334 0 0119 9.333V4" })] })));
926
+ return (jsxs(Icon, __assign({}, props, { children: [jsx("path", { fillRule: "evenodd", stroke: props.stroke, strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: props.strokeWidth || '1.5', d: "M24.885 8.552l-3.77-3.77c-.5-.5-1.179-.782-1.886-.782H9.667A2.666 2.666 0 007 6.667v18.666A2.666 2.666 0 009.667 28H23a2.666 2.666 0 002.667-2.667V10.437c0-.706-.282-1.385-.782-1.885v0z", clipRule: "evenodd" }), jsx("path", { stroke: props.stroke, strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: props.strokeWidth || '1.5', d: "M25.667 10.667h-5.334A1.334 1.334 0 0119 9.333V4" })] })));
919
927
  };
920
928
  Document.displayName = 'Document';
921
929
 
@@ -1305,19 +1313,13 @@ var MultiselectInternal = function (_a) {
1305
1313
  var dropdownOptions = useMemo(function () {
1306
1314
  var allSelected = filteredTempOptions.length > 0 &&
1307
1315
  filteredTempOptions.every(function (o) { return o.selected; });
1308
- var selectAllOption = (jsx(Dropdown.Option, { value: "select_all", py: 12, onClick: function (e) { return e.stopPropagation(); }, children: jsx(Checkbox, { label: "Select All", checked: allSelected, onChange: function (e) {
1309
- e.stopPropagation();
1310
- setTemporaryOptions(function (prev) {
1311
- return prev.map(function (item) { return (__assign(__assign({}, item), { selected: !allSelected })); });
1312
- });
1313
- }, w: "100%" }) }, "select_all"));
1316
+ var selectAllOption = (jsx(Dropdown.Option, { value: "select_all", py: 12, onClick: function () {
1317
+ return setTemporaryOptions(function (prev) {
1318
+ return prev.map(function (item) { return (__assign(__assign({}, item), { selected: !allSelected })); });
1319
+ });
1320
+ }, children: jsx(Box, { style: { pointerEvents: 'none' }, children: jsx(Checkbox, { label: "Select All", checked: allSelected, w: "100%" }) }) }, "select_all"));
1314
1321
  // Now build the rest of the normal checkboxes
1315
- var normalOptions = filteredTempOptions.map(function (option) { return (jsx(Dropdown.Option, { value: option.value, py: 12, disabled: option.disabled,
1316
- // Don’t close on click
1317
- onClick: function (e) { return e.stopPropagation(); }, children: jsx(Checkbox, { label: option.label, checked: option.selected, disabled: option.disabled, onChange: function (e) {
1318
- e.stopPropagation();
1319
- handleDraftToggle(option);
1320
- }, w: "100%" }, option.value) }, option.value)); });
1322
+ var normalOptions = filteredTempOptions.map(function (option) { return (jsx(Dropdown.Option, { value: option.value, py: 12, disabled: option.disabled, onClick: function () { return handleDraftToggle(option); }, children: jsx(Box, { style: { pointerEvents: 'none' }, children: jsx(Checkbox, { label: option.label, checked: option.selected, disabled: option.disabled, w: "100%" }, option.value) }) }, option.value)); });
1321
1323
  var emptyOptions = (jsx(Dropdown.Option, { value: "No options found", style: { cursor: 'not-allowed', pointerEvents: 'none' }, children: "No matches found, try something else." }));
1322
1324
  return normalOptions.length > 0
1323
1325
  ? __spreadArray([selectAllOption], normalOptions, true) : [emptyOptions];
@@ -1383,7 +1385,7 @@ var MultiselectInternal = function (_a) {
1383
1385
  _b[styles$o.inputError] = error && !isFocused,
1384
1386
  _b[multiselectStyles.inputFocused] = isFocused || store.dropdownOpened,
1385
1387
  _b[multiselectStyles.disabled] = disabled,
1386
- _b)), onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onClick: function () { return store.toggleDropdown(); }, onFocus: function () { return setIsFocused(true); }, onBlur: handleBlur, tabIndex: 0, children: [jsx(PillAndSearchSection, { store: store, maxPills: maxPills }), jsx(Chevron, { rotate: store.dropdownOpened ? 90 : 270 })] }), error ? ErrorSection : DescriptionSection] }));
1388
+ _b)), onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onClick: function () { return store.toggleDropdown(); }, onFocus: function () { return setIsFocused(true); }, onBlur: handleBlur, children: [jsx(PillAndSearchSection, { store: store, maxPills: maxPills }), jsx(Chevron, { rotate: store.dropdownOpened ? 90 : 270 })] }), error ? ErrorSection : DescriptionSection] }));
1387
1389
  } }));
1388
1390
  };
1389
1391
  MultiselectInternal.displayName = 'MultiselectInternal';
@@ -1473,12 +1475,12 @@ var Pagination = function (_a) {
1473
1475
  Pagination.displayName = 'Pagination';
1474
1476
 
1475
1477
  var EyeHide = function (props) {
1476
- return (jsx(Icon, __assign({}, props, { children: jsx("path", { stroke: props.stroke, strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5", d: "M16 25.333c-1.123 0-2.247-.237-3.339-.66M16 25.333c4.66 0 9.32-4.044 11.843-8.709.209-.388.209-.859 0-1.247a20.174 20.174 0 00-2.404-3.482M6.667 25.333L25.333 6.667M13.031 18.969a4.2 4.2 0 015.94-5.94m3.754-3.754C20.663 7.679 18.331 6.667 16 6.667c-4.66 0-9.32 4.044-11.843 8.71-.209.388-.209.859 0 1.247 1.262 2.332 3.056 4.508 5.118 6.103" }) })));
1478
+ return (jsx(Icon, __assign({}, props, { children: jsx("path", { stroke: props.stroke, strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: props.strokeWidth || '1.5', d: "M16 25.333c-1.123 0-2.247-.237-3.339-.66M16 25.333c4.66 0 9.32-4.044 11.843-8.709.209-.388.209-.859 0-1.247a20.174 20.174 0 00-2.404-3.482M6.667 25.333L25.333 6.667M13.031 18.969a4.2 4.2 0 015.94-5.94m3.754-3.754C20.663 7.679 18.331 6.667 16 6.667c-4.66 0-9.32 4.044-11.843 8.71-.209.388-.209.859 0 1.247 1.262 2.332 3.056 4.508 5.118 6.103" }) })));
1477
1479
  };
1478
1480
  EyeHide.displayName = 'EyeHide';
1479
1481
 
1480
1482
  var EyeShow = function (props) {
1481
- return (jsxs(Icon, __assign({}, props, { children: [jsx("path", { fillRule: "evenodd", stroke: props.stroke, strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5", d: "M18.83 13.173a4.005 4.005 0 010 5.66 4.005 4.005 0 01-5.66 0 4.005 4.005 0 010-5.66 4 4 0 015.66 0z", clipRule: "evenodd" }), jsx("path", { fillRule: "evenodd", stroke: props.stroke, strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5", d: "M4 16c0-.879.203-1.748.595-2.55C6.615 9.322 11.079 6.668 16 6.668c4.921 0 9.385 2.654 11.405 6.784.392.801.595 1.67.595 2.549s-.203 1.748-.595 2.55c-2.02 4.129-6.484 6.783-11.405 6.783-4.921 0-9.385-2.654-11.405-6.784A5.795 5.795 0 014 16z", clipRule: "evenodd" })] })));
1483
+ return (jsxs(Icon, __assign({}, props, { children: [jsx("path", { fillRule: "evenodd", stroke: props.stroke, strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: props.strokeWidth || '1.5', d: "M18.83 13.173a4.005 4.005 0 010 5.66 4.005 4.005 0 01-5.66 0 4.005 4.005 0 010-5.66 4 4 0 015.66 0z", clipRule: "evenodd" }), jsx("path", { fillRule: "evenodd", stroke: props.stroke, strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: props.strokeWidth || '1.5', d: "M4 16c0-.879.203-1.748.595-2.55C6.615 9.322 11.079 6.668 16 6.668c4.921 0 9.385 2.654 11.405 6.784.392.801.595 1.67.595 2.549s-.203 1.748-.595 2.55c-2.02 4.129-6.484 6.783-11.405 6.783-4.921 0-9.385-2.654-11.405-6.784A5.795 5.795 0 014 16z", clipRule: "evenodd" })] })));
1482
1484
  };
1483
1485
  EyeShow.displayName = 'EyeShow';
1484
1486
 
@@ -2084,7 +2086,7 @@ var Plus = function (_a) {
2084
2086
  Plus.displayName = 'Plus';
2085
2087
 
2086
2088
  var Refresh = function (props) {
2087
- 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" })] })));
2089
+ return (jsxs(Icon, __assign({}, props, { children: [jsx("path", { d: "M20.3846 16.5176L24.077 15.5945L25 19.2869", stroke: "black", strokeWidth: props.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: props.strokeWidth || '1.5', strokeLinecap: "round", strokeLinejoin: "round" }), jsx("path", { d: "M5.61538 9.133L1.92308 10.0561L1 6.36377", stroke: "black", strokeWidth: props.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: props.strokeWidth || '1.5', strokeLinecap: "round", strokeLinejoin: "round" })] })));
2088
2090
  };
2089
2091
  Refresh.displayName = 'Refresh';
2090
2092
 
@@ -2122,4 +2124,4 @@ var World = function (_a) {
2122
2124
  World.displayName = 'World';
2123
2125
 
2124
2126
  export { Attachment as $, Accordion as A, Badge as B, Card as C, DateInput as D, EnterCodeInput as E, FileInput as F, Stepper as G, Tabs as H, IncrementNumber as I, Text as J, Textarea as K, Link as L, Message as M, NavBar as N, ToastContainer as O, Pagination as P, Tooltip as Q, RadioButton as R, SegmentedControl as S, Table as T, AIGenerate as U, AIPrompt as V, AIRedo as W, AISearch as X, Alert as Y, Archive as Z, Arrow as _, AccordionItem as a, AvatarPlaceholder as a0, Bell as a1, Calendar as a2, Camera as a3, Cat as a4, Chat as a5, Check as a6, Chevron as a7, ChevronCollapse as a8, Clock as a9, Plaid as aA, Plus as aB, Refresh as aC, Remove as aD, Search as aE, Shield as aF, StepIndicator as aG, ThreeDots as aH, ThumbsDown as aI, Tick as aJ, Umbrello as aK, Upload as aL, Visa as aM, Warning as aN, World as aO, capitalizeFirstSentenceLetter as aP, Close as aa, Cloud as ab, CloudUpload as ac, CreditCard as ad, Delete as ae, Document as af, Dog as ag, EyeHide as ah, EyeShow as ai, Fingerprint as aj, Google as ak, Grid as al, Hamburger as am, HappyFace as an, House as ao, HouseTime as ap, Identification as aq, Info as ar, Location as as, Mail as at, Menu as au, MenuTouched as av, Notification as aw, Open as ax, Pets as ay, Phone as az, AccordionControl as b, AccordionPanel as c, ActionIcon as d, Animation as e, Autocomplete as f, getDefaultExportFromCjs as g, Avatar as h, badgeVariantMap as i, Button as j, cardStatusVariantMap as k, CardStatus as l, Checkbox as m, Chip as n, Dropdown as o, FileUpload as p, Input as q, LinkModal as r, Loader as s, Modal as t, Multiselect as u, NavBarSide as v, PasswordInput as w, Pill as x, Select as y, StatusBadge as z };
2125
- //# sourceMappingURL=index-CYIjT38s.js.map
2127
+ //# sourceMappingURL=index-pzIR0dAA.js.map