@mmb-digital/ds-lilly 0.6.1 → 0.6.3
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 +25 -19
- package/dist/types/src/components/Form/Autocomplete/Autocomplete.d.ts +2 -2
- package/dist/types/src/components/Form/Select2/Select2.d.ts +2 -1
- package/dist/types/src/contexts/Select2Context.d.ts +2 -2
- package/dist/types/src/types/common.d.ts +3 -2
- package/package.json +1 -1
package/dist/ds-lilly.js
CHANGED
|
@@ -98059,10 +98059,10 @@ var Autocomplete_assign = (undefined && undefined.__assign) || function () {
|
|
|
98059
98059
|
|
|
98060
98060
|
var Autocomplete = function (_a) {
|
|
98061
98061
|
var _b, _c, _d;
|
|
98062
|
-
var disabledTooltip = _a.disabledTooltip, dropdownTheme = _a.dropdownTheme, error = _a.error, _e = _a.hasAlwaysValue, hasAlwaysValue = _e === void 0 ? false : _e, _f = _a.hasFullWidthOptions, hasFullWidthOptions = _f === void 0 ? true : _f, help = _a.help, _g = _a.inputAutocomplete, inputAutocomplete = _g === void 0 ? false : _g, isCreatable = _a.isCreatable, isDisabled = _a.isDisabled, items = _a.items, label = _a.label, labelTooltip = _a.labelTooltip, messages = _a.messages, name = _a.name, onBlur = _a.onBlur, onChange = _a.onChange, onCreate = _a.onCreate, placeholder = _a.placeholder, testId = _a.testId, theme = _a.theme,
|
|
98062
|
+
var disabledTooltip = _a.disabledTooltip, dropdownTheme = _a.dropdownTheme, error = _a.error, _e = _a.hasAlwaysValue, hasAlwaysValue = _e === void 0 ? false : _e, _f = _a.hasFullWidthOptions, hasFullWidthOptions = _f === void 0 ? true : _f, help = _a.help, _g = _a.inputAutocomplete, inputAutocomplete = _g === void 0 ? false : _g, isCreatable = _a.isCreatable, isDisabled = _a.isDisabled, items = _a.items, label = _a.label, labelTooltip = _a.labelTooltip, messages = _a.messages, name = _a.name, onBlur = _a.onBlur, onChange = _a.onChange, onCreate = _a.onCreate, placeholder = _a.placeholder, testId = _a.testId, theme = _a.theme, outerValue = _a.value;
|
|
98063
98063
|
var isCategorised = !!((_b = items[0]) === null || _b === void 0 ? void 0 : _b.items);
|
|
98064
98064
|
var _h = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useState"])(false), isDropdownVisible = _h[0], setIsDropdownVisible = _h[1];
|
|
98065
|
-
var _j = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useState"])(
|
|
98065
|
+
var _j = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useState"])(outerValue || ''), value = _j[0], setValue = _j[1];
|
|
98066
98066
|
var _k = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useState"])(-1), focusedItemIndex = _k[0], setFocusedItemIndex = _k[1];
|
|
98067
98067
|
var _l = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useState"])(0), focusedCategoryIndex = _l[0], setFocusedCategoryIndex = _l[1];
|
|
98068
98068
|
var _m = Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useState"])(items), filteredItems = _m[0], setFilteredItems = _m[1];
|
|
@@ -98072,15 +98072,15 @@ var Autocomplete = function (_a) {
|
|
|
98072
98072
|
var searchedItem;
|
|
98073
98073
|
if (isCategorised) {
|
|
98074
98074
|
var categories = items;
|
|
98075
|
-
categories.map(function (category) { return (searchedItem = category.items.filter(function (item) { return item.value ===
|
|
98075
|
+
categories.map(function (category) { return (searchedItem = category.items.filter(function (item) { return item.value === outerValue; })[0]); });
|
|
98076
98076
|
}
|
|
98077
98077
|
else {
|
|
98078
|
-
searchedItem = items.filter(function (item) { return item.value ===
|
|
98078
|
+
searchedItem = items.filter(function (item) { return item.value === outerValue; })[0];
|
|
98079
98079
|
}
|
|
98080
98080
|
var htmlInput = document.getElementById("" + name);
|
|
98081
|
-
htmlInput.value = searchedItem ? searchedItem.label :
|
|
98082
|
-
setValue(
|
|
98083
|
-
}, [
|
|
98081
|
+
htmlInput.value = searchedItem ? searchedItem.label : outerValue || '';
|
|
98082
|
+
setValue(outerValue || '');
|
|
98083
|
+
}, [outerValue]);
|
|
98084
98084
|
Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useEffect"])(function () {
|
|
98085
98085
|
if (value && focusedItemIndex === -1) {
|
|
98086
98086
|
setFocusedItemIndex(0);
|
|
@@ -98315,7 +98315,7 @@ var Autocomplete = function (_a) {
|
|
|
98315
98315
|
setFilteredItems(newItems);
|
|
98316
98316
|
setIsDropdownVisible(true);
|
|
98317
98317
|
};
|
|
98318
|
-
var
|
|
98318
|
+
var handleDropdownToggle = function () {
|
|
98319
98319
|
setFilteredItems(getFilteredItems(''));
|
|
98320
98320
|
setIsDropdownVisible(!isDropdownVisible);
|
|
98321
98321
|
};
|
|
@@ -98381,7 +98381,7 @@ var Autocomplete = function (_a) {
|
|
|
98381
98381
|
messages.create, " \"" + (isSelectedValue ? (_d = getMatchingItem()) === null || _d === void 0 ? void 0 : _d.label : value) + "\"")))),
|
|
98382
98382
|
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("button", { "aria-expanded": isDropdownVisible, "aria-haspopup": "listbox", "aria-labelledby": name + "_label " + name + "_button", className: classBinder_cx('f-controlSuffix f-controlSuffix--button', {
|
|
98383
98383
|
'f-controlSuffix--open': isDropdownVisible
|
|
98384
|
-
}), disabled: isDisabled, id: name + "_button", tabIndex: -1, type: "button", onClick:
|
|
98384
|
+
}), disabled: isDisabled, id: name + "_button", tabIndex: -1, type: "button", onClick: handleDropdownToggle },
|
|
98385
98385
|
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(Icon, { name: "arrowDown", size: "small", theme: "f-control2__selectIcon" }))))));
|
|
98386
98386
|
};
|
|
98387
98387
|
|
|
@@ -98651,15 +98651,17 @@ var Autocomplete2 = function (_a) {
|
|
|
98651
98651
|
(_b = document.getElementById(name + "_list-createNew")) === null || _b === void 0 ? void 0 : _b.focus();
|
|
98652
98652
|
};
|
|
98653
98653
|
var focusFulltextInput = function () {
|
|
98654
|
-
|
|
98655
|
-
|
|
98656
|
-
|
|
98657
|
-
|
|
98658
|
-
|
|
98659
|
-
|
|
98660
|
-
|
|
98661
|
-
|
|
98662
|
-
|
|
98654
|
+
setTimeout(function () {
|
|
98655
|
+
var _a;
|
|
98656
|
+
try {
|
|
98657
|
+
var inputElement = document.getElementById(name + "_input");
|
|
98658
|
+
inputElement === null || inputElement === void 0 ? void 0 : inputElement.select();
|
|
98659
|
+
}
|
|
98660
|
+
catch (err) {
|
|
98661
|
+
// set focus as failback
|
|
98662
|
+
(_a = document.getElementById(name + "_input")) === null || _a === void 0 ? void 0 : _a.focus();
|
|
98663
|
+
}
|
|
98664
|
+
});
|
|
98663
98665
|
};
|
|
98664
98666
|
var resetFulltext = function (clearFulltext) {
|
|
98665
98667
|
if (clearFulltext === void 0) { clearFulltext = true; }
|
|
@@ -99002,10 +99004,14 @@ var Autocomplete2 = function (_a) {
|
|
|
99002
99004
|
}); };
|
|
99003
99005
|
var handleDropdownVisibilityChange = function (isVisible) {
|
|
99004
99006
|
if (!isVisible) {
|
|
99007
|
+
var trimmedFulltextValue = fulltextValue.trim();
|
|
99005
99008
|
setIsDropdownVisible(isVisible);
|
|
99006
99009
|
setTypingMode(isVisible);
|
|
99010
|
+
if (!trimmedFulltextValue) {
|
|
99011
|
+
propagateChange();
|
|
99012
|
+
}
|
|
99007
99013
|
resetFulltext();
|
|
99008
|
-
handleBlur(buttonValue);
|
|
99014
|
+
handleBlur(trimmedFulltextValue ? buttonValue : undefined);
|
|
99009
99015
|
}
|
|
99010
99016
|
};
|
|
99011
99017
|
var renderDropdownContent = function () {
|
|
@@ -30,7 +30,7 @@ export interface AutocompletePropsType extends FormField2PropsType {
|
|
|
30
30
|
/** Handler for value change. It will return matching item (if exists) as a second parameter. */
|
|
31
31
|
onChange?: (value: string | number | boolean | null, item?: ItemType) => void;
|
|
32
32
|
/** Handler function called when creatable item clicked. */
|
|
33
|
-
onCreate?: (value: string) => void;
|
|
33
|
+
onCreate?: (value: string | number) => void;
|
|
34
34
|
}
|
|
35
|
-
export declare const Autocomplete: ({ disabledTooltip, dropdownTheme, error, hasAlwaysValue, hasFullWidthOptions, help, inputAutocomplete, isCreatable, isDisabled, items, label, labelTooltip, messages, name, onBlur, onChange, onCreate, placeholder, testId, theme, value:
|
|
35
|
+
export declare const Autocomplete: ({ disabledTooltip, dropdownTheme, error, hasAlwaysValue, hasFullWidthOptions, help, inputAutocomplete, isCreatable, isDisabled, items, label, labelTooltip, messages, name, onBlur, onChange, onCreate, placeholder, testId, theme, value: outerValue }: AutocompletePropsType) => JSX.Element;
|
|
36
36
|
//# sourceMappingURL=Autocomplete.d.ts.map
|
|
@@ -12,8 +12,8 @@ interface Select2ContextType {
|
|
|
12
12
|
optionKeyPress?: (event: React.KeyboardEvent<HTMLUListElement>) => void;
|
|
13
13
|
setFocusedCategoryIndex?: (index: number) => void;
|
|
14
14
|
setFocusedItemIndex: (index: number, categoryIndex?: number) => void;
|
|
15
|
-
setValue?: (value: string) => void;
|
|
16
|
-
value?: string;
|
|
15
|
+
setValue?: (value: string | number) => void;
|
|
16
|
+
value?: string | number;
|
|
17
17
|
}
|
|
18
18
|
declare const Select2Context: import("react").Context<Select2ContextType>;
|
|
19
19
|
export default Select2Context;
|
|
@@ -5,6 +5,7 @@ declare type ThemeValue = CSSModule | string;
|
|
|
5
5
|
export declare type Theme = ThemeValue | Array<Theme>;
|
|
6
6
|
export declare type TargetType = '_blank' | '_parent' | '_self' | '_top';
|
|
7
7
|
export declare type BreakpointsType = 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
8
|
+
export declare type FormField2Value = string | number | boolean | null;
|
|
8
9
|
export interface FormField2PropsType extends ComponentPropsType, DisabledTooltipPropsType {
|
|
9
10
|
/** Allow click event propagation */
|
|
10
11
|
allowEventPropagation?: boolean;
|
|
@@ -23,9 +24,9 @@ export interface FormField2PropsType extends ComponentPropsType, DisabledTooltip
|
|
|
23
24
|
/** Name of form field. */
|
|
24
25
|
name: string;
|
|
25
26
|
/** Handler for input blur. */
|
|
26
|
-
onBlur?: (value:
|
|
27
|
+
onBlur?: (value: FormField2Value) => void;
|
|
27
28
|
/** Handler for value change. */
|
|
28
|
-
onChange?: (value:
|
|
29
|
+
onChange?: (value: FormField2Value) => void;
|
|
29
30
|
/** Click event handler */
|
|
30
31
|
onClick?: (event: SyntheticEvent) => void;
|
|
31
32
|
/** Function to call when the form control emits a `focus` event. */
|