@mmb-digital/ds-lilly 0.3.5 → 0.3.6
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
|
@@ -96310,7 +96310,7 @@ var Dropdown_assign = (undefined && undefined.__assign) || function () {
|
|
|
96310
96310
|
|
|
96311
96311
|
var SCROLL_DEVIATION = 16;
|
|
96312
96312
|
var Dropdown = function (_a) {
|
|
96313
|
-
var children = _a.children, closeOnOutsideClick = _a.closeOnOutsideClick, closeOnTriggerHidden = _a.closeOnTriggerHidden, _b = _a.delayHide, delayHide = _b === void 0 ? 200 : _b, delayShow = _a.delayShow, forceVisibility = _a.forceVisibility, _c = _a.hasSameWidthAsTrigger, hasSameWidthAsTrigger = _c === void 0 ? false : _c, interactive = _a.interactive, _d = _a.isOpenByDefault, isOpenByDefault = _d === void 0 ? false : _d, onOutsideClick = _a.onOutsideClick, onScrollToEnd = _a.onScrollToEnd, onVisibleChange = _a.onVisibleChange, _e = _a.placement, placement = _e === void 0 ? 'auto' : _e, testId = _a.testId, theme = _a.theme, _f = _a.trigger, trigger = _f === void 0 ? 'focus' : _f, triggerComponent = _a.triggerComponent;
|
|
96313
|
+
var children = _a.children, closeOnOutsideClick = _a.closeOnOutsideClick, closeOnTriggerHidden = _a.closeOnTriggerHidden, _b = _a.delayHide, delayHide = _b === void 0 ? 200 : _b, delayShow = _a.delayShow, dropdownId = _a.dropdownId, forceVisibility = _a.forceVisibility, _c = _a.hasSameWidthAsTrigger, hasSameWidthAsTrigger = _c === void 0 ? false : _c, interactive = _a.interactive, _d = _a.isOpenByDefault, isOpenByDefault = _d === void 0 ? false : _d, onOutsideClick = _a.onOutsideClick, onScrollToEnd = _a.onScrollToEnd, onVisibleChange = _a.onVisibleChange, _e = _a.placement, placement = _e === void 0 ? 'auto' : _e, testId = _a.testId, theme = _a.theme, _f = _a.trigger, trigger = _f === void 0 ? 'focus' : _f, triggerComponent = _a.triggerComponent;
|
|
96314
96314
|
var tooltipRef = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useRef"])();
|
|
96315
96315
|
var _g = usePopperTooltip({
|
|
96316
96316
|
closeOnOutsideClick: closeOnOutsideClick,
|
|
@@ -96342,7 +96342,7 @@ var Dropdown = function (_a) {
|
|
|
96342
96342
|
visible && (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,
|
|
96343
96343
|
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("div", Dropdown_assign({ ref: setRef, "data-testid": testId }, getTooltipProps({
|
|
96344
96344
|
className: classBinder_cx('c-dropdown', { 'c-dropdown--fullWidth': hasSameWidthAsTrigger }, theme)
|
|
96345
|
-
}), { onScroll: handleScroll }), children),
|
|
96345
|
+
}), { id: dropdownId, onScroll: handleScroll }), children),
|
|
96346
96346
|
onOutsideClick && external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("div", { className: "c-dropdown__outside", onClick: onOutsideClick })))));
|
|
96347
96347
|
};
|
|
96348
96348
|
|
|
@@ -98331,11 +98331,11 @@ var Autocomplete2 = function (_a) {
|
|
|
98331
98331
|
.map(function (item, index) { return (!item.isDisabled ? { category: -1, item: index } : undefined); })
|
|
98332
98332
|
.filter(Boolean);
|
|
98333
98333
|
}
|
|
98334
|
-
if (emptyValueLabel) {
|
|
98334
|
+
if (emptyValueLabel && !fulltextValue) {
|
|
98335
98335
|
return Autocomplete2_spreadArray([{ item: -1, category: -1 }], map);
|
|
98336
98336
|
}
|
|
98337
98337
|
return map;
|
|
98338
|
-
}, [items, isCategorised]);
|
|
98338
|
+
}, [items, isCategorised, fulltextValue]);
|
|
98339
98339
|
var showCreatable = !!onCreateNewItem &&
|
|
98340
98340
|
(itemsIndex.length === 0 || canAlwaysCreateNewItem) &&
|
|
98341
98341
|
typingMode &&
|
|
@@ -98436,11 +98436,17 @@ var Autocomplete2 = function (_a) {
|
|
|
98436
98436
|
}
|
|
98437
98437
|
}, [pagingState.loading]);
|
|
98438
98438
|
var scrollToItem = function (item, category, center) {
|
|
98439
|
-
var _a;
|
|
98439
|
+
var _a, _b, _c;
|
|
98440
98440
|
if (category === void 0) { category = -1; }
|
|
98441
98441
|
if (center === void 0) { center = false; }
|
|
98442
98442
|
var itemElementId = isCategorised ? name + "_option-" + category + "-" + item : name + "_option-" + item;
|
|
98443
|
-
|
|
98443
|
+
if (center) {
|
|
98444
|
+
(_a = document
|
|
98445
|
+
.getElementById('autocomplete_dropdown')) === null || _a === void 0 ? void 0 : _a.scrollTo(0, ((_b = document.getElementById(itemElementId)) === null || _b === void 0 ? void 0 : _b.offsetTop) || 0);
|
|
98446
|
+
}
|
|
98447
|
+
else {
|
|
98448
|
+
(_c = document.getElementById(itemElementId)) === null || _c === void 0 ? void 0 : _c.scrollIntoView({ block: center ? 'center' : 'nearest' });
|
|
98449
|
+
}
|
|
98444
98450
|
};
|
|
98445
98451
|
var focusCreatable = function () {
|
|
98446
98452
|
var _a, _b;
|
|
@@ -98501,7 +98507,7 @@ var Autocomplete2 = function (_a) {
|
|
|
98501
98507
|
loadAsyncItems();
|
|
98502
98508
|
}
|
|
98503
98509
|
var selectedItem_1 = itemsIndex[currentItemPosition];
|
|
98504
|
-
if (selectedItem_1) {
|
|
98510
|
+
if (selectedItem_1 && selectedItem_1.item !== -1) {
|
|
98505
98511
|
setTimeout(function () { return scrollToItem(selectedItem_1.item, selectedItem_1.category, true); }, 100);
|
|
98506
98512
|
}
|
|
98507
98513
|
}
|
|
@@ -98833,7 +98839,7 @@ var Autocomplete2 = function (_a) {
|
|
|
98833
98839
|
};
|
|
98834
98840
|
var focusedItem = itemsIndex[currentItemPosition];
|
|
98835
98841
|
var select2context = {
|
|
98836
|
-
emptyValueLabel: emptyValueLabel,
|
|
98842
|
+
emptyValueLabel: !fulltextValue ? emptyValueLabel : undefined,
|
|
98837
98843
|
focusedCategoryIndex: focusedItem ? focusedItem.category : -1,
|
|
98838
98844
|
focusedItemIndex: focusedItem ? focusedItem.item : -1,
|
|
98839
98845
|
items: items,
|
|
@@ -98856,7 +98862,7 @@ var Autocomplete2 = function (_a) {
|
|
|
98856
98862
|
};
|
|
98857
98863
|
return (external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(FormGroup2, Autocomplete2_assign({ theme: classBinder_cx({ 'f-group2--open': isDropdownVisible }, theme) }, fromGroupProps),
|
|
98858
98864
|
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(contexts_Select2Context.Provider, { value: select2context },
|
|
98859
|
-
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 }) },
|
|
98865
|
+
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(Dropdown, { dropdownId: "autocomplete_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 }) },
|
|
98860
98866
|
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 }),
|
|
98861
98867
|
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 },
|
|
98862
98868
|
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', {
|
|
@@ -13,6 +13,8 @@ export interface DropdownPropsType extends ComponentPropsType {
|
|
|
13
13
|
delayHide?: number;
|
|
14
14
|
/** Delay in showing the tooltip (ms). */
|
|
15
15
|
delayShow?: number;
|
|
16
|
+
/** Dropdown menu element ID */
|
|
17
|
+
dropdownId?: string;
|
|
16
18
|
/** Set to use same width as triggerComponent. */
|
|
17
19
|
hasSameWidthAsTrigger?: boolean;
|
|
18
20
|
/** If true, hovering the tooltip will keep it open. */
|
|
@@ -33,5 +35,5 @@ export interface DropdownPropsType extends ComponentPropsType {
|
|
|
33
35
|
triggerComponent: ReactElement;
|
|
34
36
|
forceVisibility?: boolean;
|
|
35
37
|
}
|
|
36
|
-
export declare const Dropdown: ({ children, closeOnOutsideClick, closeOnTriggerHidden, delayHide, delayShow, forceVisibility, hasSameWidthAsTrigger, interactive, isOpenByDefault, onOutsideClick, onScrollToEnd, onVisibleChange, placement, testId, theme, trigger, triggerComponent }: DropdownPropsType) => JSX.Element;
|
|
38
|
+
export declare const Dropdown: ({ children, closeOnOutsideClick, closeOnTriggerHidden, delayHide, delayShow, dropdownId, forceVisibility, hasSameWidthAsTrigger, interactive, isOpenByDefault, onOutsideClick, onScrollToEnd, onVisibleChange, placement, testId, theme, trigger, triggerComponent }: DropdownPropsType) => JSX.Element;
|
|
37
39
|
//# sourceMappingURL=Dropdown.d.ts.map
|