@mmb-digital/ds-lilly 0.1.1 → 0.3.0
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/README.md +7 -43
- package/dist/ds-lilly.js +30 -44
- package/dist/types/src/components/Form/Autocomplete2/Autocomplete2.d.ts +5 -0
- package/dist/types/src/components/Graphs/ChartLegend/ChartLegend.d.ts +1 -1
- package/dist/types/src/components/Graphs/PieChartExtended/PieChartExtended.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,46 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Design system Lilly
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## How to versioning
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
We are using [Semver](https://www.npmjs.com/package/semver) **MAJOR.MINOR.PATCH[-SUFFIX]**:
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Runs the app in the development mode.\
|
|
12
|
-
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
|
13
|
-
|
|
14
|
-
The page will reload if you make edits.\
|
|
15
|
-
You will also see any lint errors in the console.
|
|
16
|
-
|
|
17
|
-
### `yarn test`
|
|
18
|
-
|
|
19
|
-
Launches the test runner in the interactive watch mode.\
|
|
20
|
-
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
|
21
|
-
|
|
22
|
-
### `yarn build`
|
|
23
|
-
|
|
24
|
-
Builds the app for production to the `build` folder.\
|
|
25
|
-
It correctly bundles React in production mode and optimizes the build for the best performance.
|
|
26
|
-
|
|
27
|
-
The build is minified and the filenames include the hashes.\
|
|
28
|
-
Your app is ready to be deployed!
|
|
29
|
-
|
|
30
|
-
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
|
31
|
-
|
|
32
|
-
### `yarn eject`
|
|
33
|
-
|
|
34
|
-
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
|
|
35
|
-
|
|
36
|
-
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
|
37
|
-
|
|
38
|
-
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
|
|
39
|
-
|
|
40
|
-
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
|
|
41
|
-
|
|
42
|
-
## Learn More
|
|
43
|
-
|
|
44
|
-
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
|
45
|
-
|
|
46
|
-
To learn React, check out the [React documentation](https://reactjs.org/).
|
|
7
|
+
* **MAJOR** - incompatible API changes
|
|
8
|
+
* **MINOR** - add functionality (backwards-compatible)
|
|
9
|
+
* **PATCH** - bug fixes (backwards-compatible)
|
|
10
|
+
* **-SUFFIX** - pre-release or for testing purposes only
|
package/dist/ds-lilly.js
CHANGED
|
@@ -98298,7 +98298,6 @@ var Autocomplete2 = function (_a) {
|
|
|
98298
98298
|
return Autocomplete2_generator(this, function (_b) {
|
|
98299
98299
|
switch (_b.label) {
|
|
98300
98300
|
case 0:
|
|
98301
|
-
// console.log('loadAsyncItems')
|
|
98302
98301
|
if (!loadItems)
|
|
98303
98302
|
return [2 /*return*/];
|
|
98304
98303
|
setSearchState({ loading: true, found: -1 });
|
|
@@ -98342,7 +98341,6 @@ var Autocomplete2 = function (_a) {
|
|
|
98342
98341
|
typingMode &&
|
|
98343
98342
|
fulltextValue.length >= newItemMinimumLength &&
|
|
98344
98343
|
(!loadItems || (!!loadItems && searchState.found === 0));
|
|
98345
|
-
// console.log('showCreatable', showCreatable)
|
|
98346
98344
|
var getItemIndexByValue = function (val) {
|
|
98347
98345
|
if (val === '' || val === undefined) {
|
|
98348
98346
|
return { item: -1, category: -1 };
|
|
@@ -98414,26 +98412,23 @@ var Autocomplete2 = function (_a) {
|
|
|
98414
98412
|
setButtonValue(selectedItem);
|
|
98415
98413
|
}
|
|
98416
98414
|
}
|
|
98417
|
-
}, [value]);
|
|
98415
|
+
}, [value]);
|
|
98418
98416
|
Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useEffect"])(function () {
|
|
98419
|
-
// console.log('isDropdownVisible hook', isDropdownVisible)
|
|
98420
98417
|
var itemIndex = getItemIndexByValue(value);
|
|
98421
98418
|
var itemIndexPosition = getItemIndexPosition(itemIndex);
|
|
98422
98419
|
setCurrentItemPosition(itemIndexPosition);
|
|
98423
|
-
// if (!isDropdownVisible) {
|
|
98424
|
-
// focusFulltextInput() // TODO: ???
|
|
98425
|
-
// }
|
|
98426
98420
|
}, [isDropdownVisible]);
|
|
98427
98421
|
Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useEffect"])(function () {
|
|
98428
98422
|
if (pagingState.loading) {
|
|
98429
98423
|
setTimeout(function () { var _a; return (_a = document.getElementById('autocomplete_loading-more-items')) === null || _a === void 0 ? void 0 : _a.scrollIntoView(); });
|
|
98430
98424
|
}
|
|
98431
98425
|
}, [pagingState.loading]);
|
|
98432
|
-
var scrollToItem = function (item, category) {
|
|
98426
|
+
var scrollToItem = function (item, category, center) {
|
|
98433
98427
|
var _a;
|
|
98434
98428
|
if (category === void 0) { category = -1; }
|
|
98429
|
+
if (center === void 0) { center = false; }
|
|
98435
98430
|
var itemElementId = isCategorised ? name + "_option-" + category + "-" + item : name + "_option-" + item;
|
|
98436
|
-
(_a = document.getElementById(itemElementId)) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ block: 'nearest' });
|
|
98431
|
+
(_a = document.getElementById(itemElementId)) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ block: center ? 'center' : 'nearest' });
|
|
98437
98432
|
};
|
|
98438
98433
|
var scrollToCreatable = function () {
|
|
98439
98434
|
var _a;
|
|
@@ -98441,14 +98436,20 @@ var Autocomplete2 = function (_a) {
|
|
|
98441
98436
|
};
|
|
98442
98437
|
var focusFulltextInput = function () {
|
|
98443
98438
|
setTimeout(function () {
|
|
98444
|
-
var _a;
|
|
98445
|
-
|
|
98446
|
-
|
|
98439
|
+
var _a, _b;
|
|
98440
|
+
try {
|
|
98441
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
98442
|
+
// @ts-ignore
|
|
98443
|
+
(_a = document.getElementById(name + "_input")) === null || _a === void 0 ? void 0 : _a.select();
|
|
98444
|
+
}
|
|
98445
|
+
catch (err) {
|
|
98446
|
+
// set focus as failback
|
|
98447
|
+
(_b = document.getElementById(name + "_input")) === null || _b === void 0 ? void 0 : _b.focus();
|
|
98448
|
+
}
|
|
98447
98449
|
}, 100);
|
|
98448
98450
|
};
|
|
98449
98451
|
var resetFulltext = function (clearFulltext) {
|
|
98450
98452
|
if (clearFulltext === void 0) { clearFulltext = true; }
|
|
98451
|
-
// console.log('resetFulltext', clearFulltext)
|
|
98452
98453
|
if (clearFulltext) {
|
|
98453
98454
|
setFulltextValue((buttonValue === null || buttonValue === void 0 ? void 0 : buttonValue.label) || '');
|
|
98454
98455
|
}
|
|
@@ -98461,7 +98462,6 @@ var Autocomplete2 = function (_a) {
|
|
|
98461
98462
|
}
|
|
98462
98463
|
};
|
|
98463
98464
|
Object(external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_["useEffect"])(function () {
|
|
98464
|
-
// console.log('fulltextValue hook', fulltextValue)
|
|
98465
98465
|
if (fulltextValue && !isDropdownVisible) {
|
|
98466
98466
|
setIsDropdownVisible(true);
|
|
98467
98467
|
}
|
|
@@ -98478,7 +98478,6 @@ var Autocomplete2 = function (_a) {
|
|
|
98478
98478
|
}
|
|
98479
98479
|
}, [fulltextValue]);
|
|
98480
98480
|
var handleComboBoxClick = function () {
|
|
98481
|
-
// console.log('handleComboBoxClick')
|
|
98482
98481
|
if (!isDropdownVisible) {
|
|
98483
98482
|
// dropdown is going to be opened
|
|
98484
98483
|
setFulltextValue((buttonValue === null || buttonValue === void 0 ? void 0 : buttonValue.label) || '');
|
|
@@ -98486,22 +98485,23 @@ var Autocomplete2 = function (_a) {
|
|
|
98486
98485
|
if (isLazyLoaded && searchState.found === -1) {
|
|
98487
98486
|
loadAsyncItems();
|
|
98488
98487
|
}
|
|
98488
|
+
var selectedItem_1 = itemsIndex[currentItemPosition];
|
|
98489
|
+
if (selectedItem_1) {
|
|
98490
|
+
setTimeout(function () { return scrollToItem(selectedItem_1.item, selectedItem_1.category, true); }, 100);
|
|
98491
|
+
}
|
|
98489
98492
|
}
|
|
98490
98493
|
setIsDropdownVisible(function (prev) { return !prev; });
|
|
98491
98494
|
setTypingMode(function (prev) { return !prev; });
|
|
98492
98495
|
};
|
|
98493
98496
|
var toggleDropdown = function () {
|
|
98494
|
-
// console.log('toggleDropdown')
|
|
98495
98497
|
setTypingMode(true);
|
|
98496
98498
|
setIsDropdownVisible(function (prev) { return !prev; });
|
|
98497
98499
|
};
|
|
98498
98500
|
var handleFocus = function (event) {
|
|
98499
|
-
// console.log('handleFocus')
|
|
98500
98501
|
handleComboBoxClick();
|
|
98501
98502
|
onFocus && onFocus(event);
|
|
98502
98503
|
};
|
|
98503
98504
|
var propagateChange = function (item) {
|
|
98504
|
-
// console.log('propagateChange')
|
|
98505
98505
|
if (item) {
|
|
98506
98506
|
setButtonValue(item);
|
|
98507
98507
|
}
|
|
@@ -98511,13 +98511,11 @@ var Autocomplete2 = function (_a) {
|
|
|
98511
98511
|
onChange && onChange((item === null || item === void 0 ? void 0 : item.value) || '');
|
|
98512
98512
|
};
|
|
98513
98513
|
var handleOptionClick = function (item) {
|
|
98514
|
-
// console.log('handleOptionClick')
|
|
98515
98514
|
propagateChange(item);
|
|
98516
98515
|
setIsDropdownVisible(false);
|
|
98517
98516
|
setTypingMode(false);
|
|
98518
98517
|
};
|
|
98519
98518
|
var handleEmptyOptionClick = function () {
|
|
98520
|
-
// console.log('handleEmptyOptionClick')
|
|
98521
98519
|
propagateChange();
|
|
98522
98520
|
setIsDropdownVisible(false);
|
|
98523
98521
|
setTypingMode(false);
|
|
@@ -98544,19 +98542,16 @@ var Autocomplete2 = function (_a) {
|
|
|
98544
98542
|
};
|
|
98545
98543
|
var handleFocusedItem = function (item, category) {
|
|
98546
98544
|
if (category === void 0) { category = -1; }
|
|
98547
|
-
// console.log('handleFocusedItem')
|
|
98548
98545
|
var position = getItemIndexPosition({ item: item, category: category });
|
|
98549
98546
|
setCurrentItemPosition(position);
|
|
98550
98547
|
scrollToItem(item, category);
|
|
98551
98548
|
};
|
|
98552
98549
|
var handleCreateNewOption = function () {
|
|
98553
|
-
// console.log('handleCreateNewOption')
|
|
98554
98550
|
propagateChange({ label: fulltextValue, value: fulltextValue });
|
|
98555
98551
|
onCreateNewItem && onCreateNewItem(fulltextValue);
|
|
98556
98552
|
};
|
|
98557
98553
|
var handleOptionKeyPress = function (event) {
|
|
98558
|
-
var key = event.key, target = event.target;
|
|
98559
|
-
// console.log('handleOptionKeyPress', key)
|
|
98554
|
+
var ctrlKey = event.ctrlKey, key = event.key, target = event.target;
|
|
98560
98555
|
switch (key) {
|
|
98561
98556
|
case KEYS.Enter:
|
|
98562
98557
|
case KEYS.Tab:
|
|
@@ -98583,10 +98578,12 @@ var Autocomplete2 = function (_a) {
|
|
|
98583
98578
|
scrollToCreatable();
|
|
98584
98579
|
}
|
|
98585
98580
|
else {
|
|
98581
|
+
setCurrentItemPosition(-1);
|
|
98586
98582
|
focusFulltextInput();
|
|
98587
98583
|
}
|
|
98588
98584
|
}
|
|
98589
|
-
else if (!pagingState.loading) {
|
|
98585
|
+
else if (!pagingState.loading && !isLazyLoaded) {
|
|
98586
|
+
setCurrentItemPosition(-1);
|
|
98590
98587
|
focusFulltextInput();
|
|
98591
98588
|
}
|
|
98592
98589
|
event.preventDefault();
|
|
@@ -98633,6 +98630,9 @@ var Autocomplete2 = function (_a) {
|
|
|
98633
98630
|
event.preventDefault();
|
|
98634
98631
|
break;
|
|
98635
98632
|
default:
|
|
98633
|
+
if (!ctrlKey) {
|
|
98634
|
+
setFulltextValue(function (prev) { return "" + prev + key; });
|
|
98635
|
+
}
|
|
98636
98636
|
break;
|
|
98637
98637
|
}
|
|
98638
98638
|
};
|
|
@@ -98641,7 +98641,7 @@ var Autocomplete2 = function (_a) {
|
|
|
98641
98641
|
if (key === KEYS.ArrowDown) {
|
|
98642
98642
|
event.preventDefault();
|
|
98643
98643
|
setIsDropdownVisible(true);
|
|
98644
|
-
var selectedItem = itemsIndex[
|
|
98644
|
+
var selectedItem = itemsIndex[currentItemPosition > -1 ? currentItemPosition : 0];
|
|
98645
98645
|
if (selectedItem) {
|
|
98646
98646
|
var category_1 = selectedItem.category, item_1 = selectedItem.item;
|
|
98647
98647
|
handleFocusedItem(item_1, category_1);
|
|
@@ -98681,7 +98681,9 @@ var Autocomplete2 = function (_a) {
|
|
|
98681
98681
|
if (key === KEYS.ArrowUp && isDropdownVisible) {
|
|
98682
98682
|
event.preventDefault();
|
|
98683
98683
|
if (itemsIndex.length > 0) {
|
|
98684
|
-
|
|
98684
|
+
if (isLazyLoaded && currentItemPosition === -1)
|
|
98685
|
+
return;
|
|
98686
|
+
var _b = itemsIndex[currentItemPosition > -1 ? currentItemPosition : itemsIndex.length - 1], category_2 = _b.category, item_2 = _b.item;
|
|
98685
98687
|
handleFocusedItem(item_2, category_2);
|
|
98686
98688
|
setTimeout(function () {
|
|
98687
98689
|
var _a;
|
|
@@ -98740,7 +98742,6 @@ var Autocomplete2 = function (_a) {
|
|
|
98740
98742
|
var target = _a.target;
|
|
98741
98743
|
setFulltextValue(target.value);
|
|
98742
98744
|
};
|
|
98743
|
-
var handleFulltextFocus = function () { return setCurrentItemPosition(-1); };
|
|
98744
98745
|
var handleScrollToEnd = function () { return Autocomplete2_awaiter(void 0, void 0, void 0, function () {
|
|
98745
98746
|
var newItems, isCategorised, found;
|
|
98746
98747
|
var _a;
|
|
@@ -98819,24 +98820,9 @@ var Autocomplete2 = function (_a) {
|
|
|
98819
98820
|
name: name
|
|
98820
98821
|
};
|
|
98821
98822
|
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),
|
|
98822
|
-
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("div", null,
|
|
98823
|
-
"value: ", value === null || value === void 0 ? void 0 :
|
|
98824
|
-
value.toString()),
|
|
98825
|
-
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("div", null,
|
|
98826
|
-
"isDropdownVisible: ",
|
|
98827
|
-
isDropdownVisible.toString()),
|
|
98828
|
-
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("div", null,
|
|
98829
|
-
"typingMode: ",
|
|
98830
|
-
typingMode.toString()),
|
|
98831
|
-
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("div", null,
|
|
98832
|
-
"fulltextValue: ",
|
|
98833
|
-
fulltextValue),
|
|
98834
|
-
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement("div", null,
|
|
98835
|
-
"searchState ",
|
|
98836
|
-
JSON.stringify(searchState)),
|
|
98837
98823
|
external_root_React_commonjs2_react_commonjs_react_amd_react_umd_react_default.a.createElement(contexts_Select2Context.Provider, { value: select2context },
|
|
98838
98824
|
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 }) },
|
|
98839
|
-
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,
|
|
98825
|
+
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 }),
|
|
98840
98826
|
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 },
|
|
98841
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', { 'f-control2--large': displayDetails }), disabled: isDisabled, id: name + "_button", name: name, type: "button", onClick: handleComboBoxClick, onFocus: handleFocus },
|
|
98842
98828
|
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),
|
|
@@ -24,10 +24,15 @@ export interface Autocomplete2PropsType extends FormField2PropsType {
|
|
|
24
24
|
loadMoreItems?: (query?: string) => Promise<ItemType[] | CategorisedItemType[]>;
|
|
25
25
|
/** Messages for inner texts */
|
|
26
26
|
messages: {
|
|
27
|
+
/** Loading items */
|
|
27
28
|
loadingItems?: ReactNode;
|
|
29
|
+
/** Loading more items (next page) */
|
|
28
30
|
loadingMoreItems?: ReactNode;
|
|
31
|
+
/** Nothing found */
|
|
29
32
|
nohingFound?: ReactNode;
|
|
33
|
+
/** Type min. chars to start searching */
|
|
30
34
|
typeToFilter?: ReactNode;
|
|
35
|
+
/** Create item prefix */
|
|
31
36
|
createItem?: ReactNode;
|
|
32
37
|
};
|
|
33
38
|
/** Minimum length of new item */
|
|
@@ -12,9 +12,9 @@ export interface ChartLegendPropsType extends ComponentPropsType {
|
|
|
12
12
|
}
|
|
13
13
|
interface Data {
|
|
14
14
|
label: string;
|
|
15
|
-
percentage: string;
|
|
16
15
|
value: number;
|
|
17
16
|
color: ColorType;
|
|
17
|
+
percentage?: string;
|
|
18
18
|
}
|
|
19
19
|
export declare const ChartLegend: ({ data, emptySummaryColor, hasSummaryRow, summaryLabel, theme }: ChartLegendPropsType) => JSX.Element;
|
|
20
20
|
export {};
|
|
@@ -11,9 +11,9 @@ export interface PieChartExtendedPropsType extends ComponentPropsType {
|
|
|
11
11
|
}
|
|
12
12
|
interface Data {
|
|
13
13
|
label: string;
|
|
14
|
-
percentage: string;
|
|
15
14
|
value: number;
|
|
16
15
|
color: ColorType;
|
|
16
|
+
percentage?: string;
|
|
17
17
|
}
|
|
18
18
|
export declare const PieChartExtended: ({ data, graphContent, graphIcon, theme }: PieChartExtendedPropsType) => JSX.Element;
|
|
19
19
|
export {};
|