@mmb-digital/ds-lilly 0.3.0 → 0.3.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.
package/dist/ds-lilly.js
CHANGED
|
@@ -98277,21 +98277,21 @@ var Autocomplete2_spreadArray = (undefined && undefined.__spreadArray) || functi
|
|
|
98277
98277
|
|
|
98278
98278
|
var Autocomplete2 = function (_a) {
|
|
98279
98279
|
var _b;
|
|
98280
|
-
var _c = _a.asyncDelayMilliseconds, asyncDelayMilliseconds = _c === void 0 ? 200 : _c, disabledTooltip = _a.disabledTooltip,
|
|
98281
|
-
var
|
|
98282
|
-
var
|
|
98283
|
-
var
|
|
98284
|
-
var
|
|
98285
|
-
var
|
|
98286
|
-
var
|
|
98287
|
-
var
|
|
98280
|
+
var _c = _a.asyncDelayMilliseconds, asyncDelayMilliseconds = _c === void 0 ? 200 : _c, _d = _a.canAlwaysCreateNewItem, canAlwaysCreateNewItem = _d === void 0 ? false : _d, disabledTooltip = _a.disabledTooltip, _e = _a.displayDetails, displayDetails = _e === void 0 ? false : _e, dropdownTheme = _a.dropdownTheme, emptyValueLabel = _a.emptyValueLabel, error = _a.error, _f = _a.filterMinimumLength, filterMinimumLength = _f === void 0 ? 2 : _f, _g = _a.hasFullWidthOptions, hasFullWidthOptions = _g === void 0 ? true : _g, help = _a.help, isDisabled = _a.isDisabled, isLazyLoaded = _a.isLazyLoaded, isLoading = _a.isLoading, _h = _a.items, inputItems = _h === void 0 ? [] : _h, label = _a.label, labelTooltip = _a.labelTooltip, loadItems = _a.loadItems, loadMoreItems = _a.loadMoreItems, name = _a.name, messages = _a.messages, _j = _a.newItemMinimumLength, newItemMinimumLength = _j === void 0 ? 2 : _j, onBlur = _a.onBlur, onChange = _a.onChange, onCreateNewItem = _a.onCreateNewItem, onFocus = _a.onFocus, placeholder = _a.placeholder, testId = _a.testId, theme = _a.theme, value = _a.value;
|
|
98281
|
+
var _k = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useState"])(false), isDropdownVisible = _k[0], setIsDropdownVisible = _k[1];
|
|
98282
|
+
var _l = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useState"])(null), buttonValue = _l[0], setButtonValue = _l[1];
|
|
98283
|
+
var _m = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useState"])(false), typingMode = _m[0], setTypingMode = _m[1];
|
|
98284
|
+
var _o = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useState"])(''), fulltextValue = _o[0], setFulltextValue = _o[1];
|
|
98285
|
+
var _p = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useState"])(-1), currentItemPosition = _p[0], setCurrentItemPosition = _p[1];
|
|
98286
|
+
var _q = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useState"])([]), items = _q[0], setItems = _q[1];
|
|
98287
|
+
var _r = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useState"])({
|
|
98288
98288
|
loading: false,
|
|
98289
98289
|
found: -1
|
|
98290
|
-
}), searchState =
|
|
98291
|
-
var
|
|
98290
|
+
}), searchState = _r[0], setSearchState = _r[1];
|
|
98291
|
+
var _s = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useState"])({
|
|
98292
98292
|
loading: false,
|
|
98293
98293
|
found: -1
|
|
98294
|
-
}), pagingState =
|
|
98294
|
+
}), pagingState = _s[0], setPagingState = _s[1];
|
|
98295
98295
|
var loadAsyncItems = function (query) { return Autocomplete2_awaiter(void 0, void 0, void 0, function () {
|
|
98296
98296
|
var newItems, isCategorised, found;
|
|
98297
98297
|
var _a;
|
|
@@ -98337,16 +98337,17 @@ var Autocomplete2 = function (_a) {
|
|
|
98337
98337
|
return map;
|
|
98338
98338
|
}, [items, isCategorised]);
|
|
98339
98339
|
var showCreatable = !!onCreateNewItem &&
|
|
98340
|
-
itemsIndex.length === 0 &&
|
|
98340
|
+
(itemsIndex.length === 0 || canAlwaysCreateNewItem) &&
|
|
98341
98341
|
typingMode &&
|
|
98342
98342
|
fulltextValue.length >= newItemMinimumLength &&
|
|
98343
|
-
(!loadItems || (!!loadItems && searchState.found === 0));
|
|
98344
|
-
var getItemIndexByValue = function (val) {
|
|
98343
|
+
(!loadItems || (!!loadItems && searchState.found === 0) || (!!loadItems && canAlwaysCreateNewItem));
|
|
98344
|
+
var getItemIndexByValue = function (val, sourceItems) {
|
|
98345
|
+
if (sourceItems === void 0) { sourceItems = items; }
|
|
98345
98346
|
if (val === '' || val === undefined) {
|
|
98346
98347
|
return { item: -1, category: -1 };
|
|
98347
98348
|
}
|
|
98348
98349
|
if (isCategorised) {
|
|
98349
|
-
var index =
|
|
98350
|
+
var index = sourceItems
|
|
98350
98351
|
.map(function (category, categoryIndex) {
|
|
98351
98352
|
var item = category.items.findIndex(function (item) { return item.value === val && !item.isDisabled; });
|
|
98352
98353
|
return { item: item, category: categoryIndex };
|
|
@@ -98357,7 +98358,7 @@ var Autocomplete2 = function (_a) {
|
|
|
98357
98358
|
});
|
|
98358
98359
|
return index || { item: -1, category: -1 };
|
|
98359
98360
|
}
|
|
98360
|
-
var item =
|
|
98361
|
+
var item = sourceItems.findIndex(function (item) { return item.value === val && !item.isDisabled; });
|
|
98361
98362
|
return { item: item, category: -1 };
|
|
98362
98363
|
};
|
|
98363
98364
|
var getItemIndexPosition = function (index) {
|
|
@@ -98397,8 +98398,17 @@ var Autocomplete2 = function (_a) {
|
|
|
98397
98398
|
Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useEffect"])(function () {
|
|
98398
98399
|
if (inputItems.length) {
|
|
98399
98400
|
setItems(inputItems);
|
|
98401
|
+
var _a = getItemIndexByValue(value, inputItems), category = _a.category, item = _a.item;
|
|
98402
|
+
if (item > -1) {
|
|
98403
|
+
var selectedItem = isCategorised
|
|
98404
|
+
? inputItems[category].items[item]
|
|
98405
|
+
: inputItems[item];
|
|
98406
|
+
if (selectedItem) {
|
|
98407
|
+
setButtonValue(selectedItem);
|
|
98408
|
+
}
|
|
98409
|
+
}
|
|
98400
98410
|
}
|
|
98401
|
-
}, [inputItems]);
|
|
98411
|
+
}, [value, inputItems]);
|
|
98402
98412
|
Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useEffect"])(function () {
|
|
98403
98413
|
var itemIndex = getItemIndexByValue(value);
|
|
98404
98414
|
var itemIndexPosition = getItemIndexPosition(itemIndex);
|
|
@@ -98430,9 +98440,10 @@ var Autocomplete2 = function (_a) {
|
|
|
98430
98440
|
var itemElementId = isCategorised ? name + "_option-" + category + "-" + item : name + "_option-" + item;
|
|
98431
98441
|
(_a = document.getElementById(itemElementId)) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ block: center ? 'center' : 'nearest' });
|
|
98432
98442
|
};
|
|
98433
|
-
var
|
|
98434
|
-
var _a;
|
|
98443
|
+
var focusCreatable = function () {
|
|
98444
|
+
var _a, _b;
|
|
98435
98445
|
(_a = document.getElementById(name + "_option-createNew")) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ block: 'nearest' });
|
|
98446
|
+
(_b = document.getElementById(name + "_list-createNew")) === null || _b === void 0 ? void 0 : _b.focus();
|
|
98436
98447
|
};
|
|
98437
98448
|
var focusFulltextInput = function () {
|
|
98438
98449
|
setTimeout(function () {
|
|
@@ -98478,6 +98489,8 @@ var Autocomplete2 = function (_a) {
|
|
|
98478
98489
|
}
|
|
98479
98490
|
}, [fulltextValue]);
|
|
98480
98491
|
var handleComboBoxClick = function () {
|
|
98492
|
+
if (isDisabled || isLoading)
|
|
98493
|
+
return;
|
|
98481
98494
|
if (!isDropdownVisible) {
|
|
98482
98495
|
// dropdown is going to be opened
|
|
98483
98496
|
setFulltextValue((buttonValue === null || buttonValue === void 0 ? void 0 : buttonValue.label) || '');
|
|
@@ -98547,11 +98560,11 @@ var Autocomplete2 = function (_a) {
|
|
|
98547
98560
|
scrollToItem(item, category);
|
|
98548
98561
|
};
|
|
98549
98562
|
var handleCreateNewOption = function () {
|
|
98550
|
-
|
|
98563
|
+
setButtonValue({ label: fulltextValue, value: fulltextValue });
|
|
98551
98564
|
onCreateNewItem && onCreateNewItem(fulltextValue);
|
|
98552
98565
|
};
|
|
98553
98566
|
var handleOptionKeyPress = function (event) {
|
|
98554
|
-
var ctrlKey = event.ctrlKey, key = event.key, target = event.target;
|
|
98567
|
+
var ctrlKey = event.ctrlKey, key = event.key, metaKey = event.metaKey, target = event.target;
|
|
98555
98568
|
switch (key) {
|
|
98556
98569
|
case KEYS.Enter:
|
|
98557
98570
|
case KEYS.Tab:
|
|
@@ -98573,9 +98586,9 @@ var Autocomplete2 = function (_a) {
|
|
|
98573
98586
|
handleFocusedItem(itemIndex.item, itemIndex.category);
|
|
98574
98587
|
}
|
|
98575
98588
|
else if (showCreatable) {
|
|
98576
|
-
if (currentItemPosition ===
|
|
98589
|
+
if (currentItemPosition + 1 === itemsIndex.length) {
|
|
98577
98590
|
setCurrentItemPosition(itemsIndex.length);
|
|
98578
|
-
|
|
98591
|
+
focusCreatable();
|
|
98579
98592
|
}
|
|
98580
98593
|
else {
|
|
98581
98594
|
setCurrentItemPosition(-1);
|
|
@@ -98630,7 +98643,7 @@ var Autocomplete2 = function (_a) {
|
|
|
98630
98643
|
event.preventDefault();
|
|
98631
98644
|
break;
|
|
98632
98645
|
default:
|
|
98633
|
-
if (!ctrlKey) {
|
|
98646
|
+
if (!(ctrlKey || metaKey)) {
|
|
98634
98647
|
setFulltextValue(function (prev) { return "" + prev + key; });
|
|
98635
98648
|
}
|
|
98636
98649
|
break;
|
|
@@ -98655,9 +98668,7 @@ var Autocomplete2 = function (_a) {
|
|
|
98655
98668
|
else if (showCreatable) {
|
|
98656
98669
|
setCurrentItemPosition(itemsIndex.length);
|
|
98657
98670
|
setTimeout(function () {
|
|
98658
|
-
|
|
98659
|
-
scrollToCreatable();
|
|
98660
|
-
(_a = document.getElementById(name + "_list-createNew")) === null || _a === void 0 ? void 0 : _a.focus();
|
|
98671
|
+
focusCreatable();
|
|
98661
98672
|
});
|
|
98662
98673
|
}
|
|
98663
98674
|
return;
|
|
@@ -98680,7 +98691,7 @@ var Autocomplete2 = function (_a) {
|
|
|
98680
98691
|
}
|
|
98681
98692
|
if (key === KEYS.ArrowUp && isDropdownVisible) {
|
|
98682
98693
|
event.preventDefault();
|
|
98683
|
-
if (itemsIndex.length > 0) {
|
|
98694
|
+
if (itemsIndex.length > 0 && !showCreatable) {
|
|
98684
98695
|
if (isLazyLoaded && currentItemPosition === -1)
|
|
98685
98696
|
return;
|
|
98686
98697
|
var _b = itemsIndex[currentItemPosition > -1 ? currentItemPosition : itemsIndex.length - 1], category_2 = _b.category, item_2 = _b.item;
|
|
@@ -98692,12 +98703,10 @@ var Autocomplete2 = function (_a) {
|
|
|
98692
98703
|
(_a = document.getElementById(listElementId)) === null || _a === void 0 ? void 0 : _a.focus();
|
|
98693
98704
|
});
|
|
98694
98705
|
}
|
|
98695
|
-
else if (showCreatable
|
|
98706
|
+
else if (showCreatable) {
|
|
98696
98707
|
setCurrentItemPosition(itemsIndex.length);
|
|
98697
98708
|
setTimeout(function () {
|
|
98698
|
-
|
|
98699
|
-
scrollToCreatable();
|
|
98700
|
-
(_a = document.getElementById(name + "_list-createNew")) === null || _a === void 0 ? void 0 : _a.focus();
|
|
98709
|
+
focusCreatable();
|
|
98701
98710
|
});
|
|
98702
98711
|
}
|
|
98703
98712
|
else {
|
|
@@ -98774,20 +98783,20 @@ var Autocomplete2 = function (_a) {
|
|
|
98774
98783
|
}
|
|
98775
98784
|
};
|
|
98776
98785
|
var renderDropdownContent = function () {
|
|
98777
|
-
if (loadItems && items.length === 0 && !searchState.loading && searchState.found === -1) {
|
|
98786
|
+
if (loadItems && items.length === 0 && !searchState.loading && searchState.found === -1 && messages.typeToFilter) {
|
|
98778
98787
|
return external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("div", { className: "f-autocomplete__message" }, messages.typeToFilter);
|
|
98779
98788
|
}
|
|
98780
|
-
if (searchState.loading) {
|
|
98789
|
+
if (searchState.loading && messages.loadingItems) {
|
|
98781
98790
|
return (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("div", { className: "f-autocomplete__message" },
|
|
98782
98791
|
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(Icon, { name: "loading", size: "large" }),
|
|
98783
98792
|
messages.loadingItems));
|
|
98784
98793
|
}
|
|
98785
98794
|
return (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["Fragment"], null,
|
|
98786
98795
|
isCategorised ? external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(Select2CategorisedOptions, null) : external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(Select2Options, null),
|
|
98787
|
-
pagingState.loading && (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("div", { className: "f-autocomplete__message", id: "autocomplete_loading-more-items" },
|
|
98796
|
+
pagingState.loading && messages.loadingItems && (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("div", { className: "f-autocomplete__message", id: "autocomplete_loading-more-items" },
|
|
98788
98797
|
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(Icon, { name: "loading", size: "large" }),
|
|
98789
98798
|
messages.loadingMoreItems)),
|
|
98790
|
-
(searchState.found === 0 || items.length === 0) && (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("div", { className: "f-autocomplete__message" }, messages.nohingFound)),
|
|
98799
|
+
(searchState.found === 0 || items.length === 0) && messages.nohingFound && (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("div", { className: "f-autocomplete__message" }, messages.nohingFound)),
|
|
98791
98800
|
showCreatable && (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(DropdownMenu, { activeDescendant: name + "_option-createNew", id: name + "_list-createNew", role: "listbox", tabIndex: -1, onKeyDown: handleOptionKeyPress },
|
|
98792
98801
|
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(DropdownItem, { id: name + "_option-createNew", isFocused: currentItemPosition === itemsIndex.length, role: "option", theme: "c-dropdown__footer", onClick: handleCreateNewOption, onMouseOver: function () {
|
|
98793
98802
|
setCurrentItemPosition(itemsIndex.length);
|
|
@@ -98824,7 +98833,11 @@ var Autocomplete2 = function (_a) {
|
|
|
98824
98833
|
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(Dropdown, { forceVisibility: isDropdownVisible, hasSameWidthAsTrigger: hasFullWidthOptions, placement: "bottom-start", theme: dropdownTheme, trigger: null, triggerComponent: external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("div", { className: "f-controlWrap", "data-testid": testId, role: "combobox" }, typingMode ? (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("div", { className: classBinder_cx('f-control2 f-control2--select', { 'f-control2--large': displayDetails }) },
|
|
98825
98834
|
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("input", { autoComplete: "off", className: classBinder_cx('f-autocomplete__input'), disabled: isDisabled, id: name + "_input", name: name, placeholder: placeholder, type: "text", value: fulltextValue, onChange: handleFulltextChange, onKeyDown: handleFulltextKeyPress }),
|
|
98826
98835
|
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("button", { "aria-invalid": !!error, className: classBinder_cx('f-autocomplete__button'), disabled: isDisabled, id: name + "_toggle_button", name: name, tabIndex: -1, type: "button", onClick: toggleDropdown },
|
|
98827
|
-
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(Icon, { name: "arrowDown", size: "small", theme: "f-control2__selectIcon" })))) : (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("button", { "aria-expanded": isDropdownVisible, "aria-haspopup": "listbox", "aria-invalid": !!error, "aria-labelledby": name + "_label " + name, className: classBinder_cx('f-control2 f-control2--select', {
|
|
98836
|
+
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(Icon, { name: "arrowDown", size: "small", theme: "f-control2__selectIcon" })))) : (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("button", { "aria-expanded": isDropdownVisible, "aria-haspopup": "listbox", "aria-invalid": !!error, "aria-labelledby": name + "_label " + name, className: classBinder_cx('f-control2 f-control2--select', {
|
|
98837
|
+
'f-control2--large': displayDetails,
|
|
98838
|
+
'f-autocomplete__trigger--loading': isLoading
|
|
98839
|
+
}), disabled: isDisabled, id: name + "_button", name: name, type: "button", onClick: handleComboBoxClick, onFocus: handleFocus },
|
|
98840
|
+
isLoading && external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(Icon, { name: "loading" }),
|
|
98828
98841
|
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("span", { className: classBinder_cx("f-control2__" + (buttonValue ? 'value' : 'placeholder')) }, buttonValue ? external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(SelectedOption, Autocomplete2_assign({ displayDetails: displayDetails }, buttonValue)) : placeholder),
|
|
98829
98842
|
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(Icon, { name: "arrowDown", size: "small", theme: "f-control2__selectIcon" })))), onScrollToEnd: handleScrollToEnd, onVisibleChange: handleDropdownVisibilityChange }, renderDropdownContent()))));
|
|
98830
98843
|
};
|
|
@@ -104245,9 +104258,9 @@ var Checkbox2_assign = (undefined && undefined.__assign) || function () {
|
|
|
104245
104258
|
|
|
104246
104259
|
|
|
104247
104260
|
var Checkbox2 = function (_a) {
|
|
104248
|
-
var _b = _a.allowEventPropagation, allowEventPropagation = _b === void 0 ? false : _b, disabledTooltip = _a.disabledTooltip, error = _a.error, help = _a.help, isDisabled = _a.isDisabled, label = _a.label, name = _a.name, onChange = _a.onChange, testId = _a.testId, theme = _a.theme, _c = _a.value, defaultState = _c === void 0 ? false : _c;
|
|
104261
|
+
var _b = _a.allowEventPropagation, allowEventPropagation = _b === void 0 ? false : _b, disabledTooltip = _a.disabledTooltip, error = _a.error, help = _a.help, isDisabled = _a.isDisabled, label = _a.label, labelTooltip = _a.labelTooltip, name = _a.name, onChange = _a.onChange, testId = _a.testId, theme = _a.theme, _c = _a.value, defaultState = _c === void 0 ? false : _c;
|
|
104249
104262
|
var _d = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useState"])(defaultState), isChecked = _d[0], setIsChecked = _d[1];
|
|
104250
|
-
var handleOnChange = function (event) {
|
|
104263
|
+
var handleOnChange = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useCallback"])(function (event) {
|
|
104251
104264
|
if (!isDisabled) {
|
|
104252
104265
|
onChange && onChange(!isChecked);
|
|
104253
104266
|
setIsChecked(!isChecked);
|
|
@@ -104255,15 +104268,15 @@ var Checkbox2 = function (_a) {
|
|
|
104255
104268
|
if (!allowEventPropagation) {
|
|
104256
104269
|
event.stopPropagation();
|
|
104257
104270
|
}
|
|
104258
|
-
};
|
|
104271
|
+
}, [allowEventPropagation, isChecked, isDisabled, onChange]);
|
|
104259
104272
|
Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useEffect"])(function () {
|
|
104260
104273
|
setIsChecked(defaultState);
|
|
104261
104274
|
}, [defaultState]);
|
|
104262
|
-
var handleOnKeyPress = function (event) {
|
|
104275
|
+
var handleOnKeyPress = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useCallback"])(function (event) {
|
|
104263
104276
|
var key = event.key;
|
|
104264
104277
|
if (key === KEYS.Space)
|
|
104265
104278
|
handleOnChange(event);
|
|
104266
|
-
};
|
|
104279
|
+
}, [handleOnChange]);
|
|
104267
104280
|
var formGroupProps = {
|
|
104268
104281
|
error: error,
|
|
104269
104282
|
disabledTooltip: disabledTooltip,
|
|
@@ -104284,7 +104297,11 @@ var Checkbox2 = function (_a) {
|
|
|
104284
104297
|
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("span", { className: classBinder_cx('f-checkbox2__indicator', {
|
|
104285
104298
|
'f-checkbox2__indicator--checked': isChecked
|
|
104286
104299
|
}) }, isChecked && external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(Icon, { name: "tickFill" }))),
|
|
104287
|
-
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("span", { className: "f-checkbox2__text" },
|
|
104300
|
+
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("span", { className: "f-checkbox2__text" },
|
|
104301
|
+
label,
|
|
104302
|
+
labelTooltip && (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(Tooltip, { content: labelTooltip },
|
|
104303
|
+
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("span", { className: classBinder_cx('f-label__tooltip2') },
|
|
104304
|
+
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(Icon, { backgroundColor: "info", name: "info", size: "small" }))))))));
|
|
104288
104305
|
};
|
|
104289
104306
|
|
|
104290
104307
|
// CONCATENATED MODULE: ./src/components/Form/Checkbox2/index.ts
|
|
@@ -4,6 +4,8 @@ import { FormField2PropsType, Theme } from '../../../types';
|
|
|
4
4
|
export interface Autocomplete2PropsType extends FormField2PropsType {
|
|
5
5
|
/** A delay before async loadItems is called after user stops typing */
|
|
6
6
|
asyncDelayMilliseconds?: number;
|
|
7
|
+
/** A flag whether option to create new item should be rendered always (true) or only on empty result (false, default) */
|
|
8
|
+
canAlwaysCreateNewItem?: boolean;
|
|
7
9
|
/** Displays additional information for selected option. (perex, amount) */
|
|
8
10
|
displayDetails?: boolean;
|
|
9
11
|
/** Custom theme for dropdown items. */
|
|
@@ -18,6 +20,8 @@ export interface Autocomplete2PropsType extends FormField2PropsType {
|
|
|
18
20
|
items?: ItemType[] | CategorisedItemType[];
|
|
19
21
|
/** A flag whether items are lazy loaded (on focus) */
|
|
20
22
|
isLazyLoaded?: boolean;
|
|
23
|
+
/** Set loading state to dropdown trigger. */
|
|
24
|
+
isLoading?: boolean;
|
|
21
25
|
/** Async callback to load items */
|
|
22
26
|
loadItems?: (query?: string) => Promise<ItemType[] | CategorisedItemType[]>;
|
|
23
27
|
/** Async callback to load more items */
|
|
@@ -40,5 +44,5 @@ export interface Autocomplete2PropsType extends FormField2PropsType {
|
|
|
40
44
|
/** A callback to create new item */
|
|
41
45
|
onCreateNewItem?: (value?: string) => void;
|
|
42
46
|
}
|
|
43
|
-
export declare const Autocomplete2: ({ asyncDelayMilliseconds, disabledTooltip, displayDetails, dropdownTheme, emptyValueLabel, error, filterMinimumLength, hasFullWidthOptions, help, isDisabled, isLazyLoaded, items: inputItems, label, labelTooltip, loadItems, loadMoreItems, name, messages, newItemMinimumLength, onBlur, onChange, onCreateNewItem, onFocus, placeholder, testId, theme, value }: Autocomplete2PropsType) => JSX.Element;
|
|
47
|
+
export declare const Autocomplete2: ({ asyncDelayMilliseconds, canAlwaysCreateNewItem, disabledTooltip, displayDetails, dropdownTheme, emptyValueLabel, error, filterMinimumLength, hasFullWidthOptions, help, isDisabled, isLazyLoaded, isLoading, items: inputItems, label, labelTooltip, loadItems, loadMoreItems, name, messages, newItemMinimumLength, onBlur, onChange, onCreateNewItem, onFocus, placeholder, testId, theme, value }: Autocomplete2PropsType) => JSX.Element;
|
|
44
48
|
//# sourceMappingURL=Autocomplete2.d.ts.map
|
|
@@ -2,5 +2,5 @@ import { FormField2PropsType } from '../../../types';
|
|
|
2
2
|
export declare type Checkbox2PropsType = Omit<FormField2PropsType, 'value'> & {
|
|
3
3
|
value?: boolean;
|
|
4
4
|
};
|
|
5
|
-
export declare const Checkbox2: ({ allowEventPropagation, disabledTooltip, error, help, isDisabled, label, name, onChange, testId, theme, value: defaultState }: Checkbox2PropsType) => JSX.Element;
|
|
5
|
+
export declare const Checkbox2: ({ allowEventPropagation, disabledTooltip, error, help, isDisabled, label, labelTooltip, name, onChange, testId, theme, value: defaultState }: Checkbox2PropsType) => JSX.Element;
|
|
6
6
|
//# sourceMappingURL=Checkbox2.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mmb-digital/ds-lilly",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "MMB LILLY design system",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -79,15 +79,15 @@
|
|
|
79
79
|
"@cypress/react": "^5.8.0",
|
|
80
80
|
"@cypress/webpack-dev-server": "^1.3.0",
|
|
81
81
|
"@namics/stylelint-bem": "^6.3.4",
|
|
82
|
-
"@storybook/addon-a11y": "^6.
|
|
83
|
-
"@storybook/addon-actions": "^6.
|
|
84
|
-
"@storybook/addon-essentials": "^6.
|
|
85
|
-
"@storybook/addon-links": "^6.
|
|
86
|
-
"@storybook/node-logger": "^6.
|
|
82
|
+
"@storybook/addon-a11y": "^6.4.18",
|
|
83
|
+
"@storybook/addon-actions": "^6.4.18",
|
|
84
|
+
"@storybook/addon-essentials": "^6.4.18",
|
|
85
|
+
"@storybook/addon-links": "^6.4.18",
|
|
86
|
+
"@storybook/node-logger": "^6.4.18",
|
|
87
87
|
"@storybook/preset-create-react-app": "^3.2.0",
|
|
88
88
|
"@storybook/preset-scss": "^1.0.3",
|
|
89
|
-
"@storybook/react": "^6.
|
|
90
|
-
"@storybook/testing-react": "^
|
|
89
|
+
"@storybook/react": "^6.4.18",
|
|
90
|
+
"@storybook/testing-react": "^1.2.3",
|
|
91
91
|
"@svgr/cli": "^5.5.0",
|
|
92
92
|
"@testing-library/jest-dom": "^5.12.0",
|
|
93
93
|
"@testing-library/react": "^11.2.7",
|
|
@@ -104,6 +104,7 @@
|
|
|
104
104
|
"@types/react-text-mask": "^5.4.7",
|
|
105
105
|
"@typescript-eslint/eslint-plugin": "^4.25.0",
|
|
106
106
|
"@typescript-eslint/parser": "^4.25.0",
|
|
107
|
+
"@whitespace/storybook-addon-html": "^5.0.0",
|
|
107
108
|
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.1",
|
|
108
109
|
"awesome-typescript-loader": "^5.2.1",
|
|
109
110
|
"babel-loader": "8.1.0",
|
|
@@ -134,7 +135,7 @@
|
|
|
134
135
|
"sass": "^1.34.0",
|
|
135
136
|
"sass-loader": "10.2.0",
|
|
136
137
|
"sort-package-json": "^1.50.0",
|
|
137
|
-
"storybook-addon-designs": "^6.
|
|
138
|
+
"storybook-addon-designs": "^6.2.1",
|
|
138
139
|
"storybook-dark-mode": "^1.0.8",
|
|
139
140
|
"stylelint": "^13.13.1",
|
|
140
141
|
"stylelint-config-sass-guidelines": "^8.0.0",
|