@linzjs/lui 17.5.7 → 17.5.10
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/CHANGELOG.md +16 -0
- package/dist/assets/icons/add_multiple.svg +1 -1
- package/dist/assets/svg-content.tsx +1 -1
- package/dist/components/LuiSearchBox/LuiSearchBox.d.ts +2 -1
- package/dist/components/LuiSearchInput/LuiSearchInput.d.ts +1 -0
- package/dist/index.js +23 -4
- package/dist/index.js.map +1 -1
- package/dist/lui.esm.js +23 -4
- package/dist/lui.esm.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## [17.5.10](https://github.com/linz/lui/compare/v17.5.9...v17.5.10) (2022-07-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **LuiSearchBox:** search 3306 search box auto focus. ([#704](https://github.com/linz/lui/issues/704)) ([c9b9938](https://github.com/linz/lui/commit/c9b9938714cdb5949525ece17314eb15668f8ea3))
|
|
7
|
+
|
|
8
|
+
## [17.5.9](https://github.com/linz/lui/compare/v17.5.8...v17.5.9) (2022-07-10)
|
|
9
|
+
|
|
10
|
+
## [17.5.8](https://github.com/linz/lui/compare/v17.5.7...v17.5.8) (2022-07-05)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* lui side panel responsive text ([#703](https://github.com/linz/lui/issues/703)) ([97ea6dc](https://github.com/linz/lui/commit/97ea6dc0c952d9d26bc3a668ee1af0d5f620d9aa))
|
|
16
|
+
|
|
1
17
|
## [17.5.7](https://github.com/linz/lui/compare/v17.5.6...v17.5.7) (2022-07-03)
|
|
2
18
|
|
|
3
19
|
## [17.5.6](https://github.com/linz/lui/compare/v17.5.5...v17.5.6) (2022-07-01)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="
|
|
1
|
+
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M20 6h2v14c0 1.1-.9 2-2 2H6v-2h14V6ZM4 2h12c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2Zm0 14h12V4H4v12Zm7-2H9v-3H6V9h3V6h2v3h3v2h-3v3Z" fill="#000"/></svg>
|
|
@@ -59,7 +59,7 @@ iconMap['ic_add_irregular_image'] = (
|
|
|
59
59
|
|
|
60
60
|
iconMap['ic_add_multiple'] = (
|
|
61
61
|
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
62
|
-
<path d="
|
|
62
|
+
<path d="M20 6h2v14c0 1.1-.9 2-2 2H6v-2h14V6ZM4 2h12c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2Zm0 14h12V4H4v12Zm7-2H9v-3H6V9h3V6h2v3h3v2h-3v3Z" />
|
|
63
63
|
</svg>
|
|
64
64
|
);
|
|
65
65
|
|
|
@@ -17,11 +17,12 @@ export interface ILuiSearchBoxProps {
|
|
|
17
17
|
searchBoxOptions: ISearchMenuOption[];
|
|
18
18
|
initOptionValue?: string;
|
|
19
19
|
onMenuSelect?: (e: Event) => void;
|
|
20
|
+
autoFocus?: boolean;
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
22
23
|
* LuiSearchBox is a search input with select menu.
|
|
23
24
|
* The options of the menu and input can be passed in as an array.
|
|
24
25
|
* See examples in SearchBox in storybook.
|
|
25
26
|
*/
|
|
26
|
-
export declare const LuiSearchBox: ({ searchBoxOptions, initOptionValue, onMenuSelect, }: ILuiSearchBoxProps) => JSX.Element;
|
|
27
|
+
export declare const LuiSearchBox: ({ searchBoxOptions, initOptionValue, onMenuSelect, autoFocus, }: ILuiSearchBoxProps) => JSX.Element;
|
|
27
28
|
export declare const LuiSearchBoxButton: React.ForwardRefExoticComponent<Pick<React.PropsWithChildren<LuiButtonProps>, "href" | "openInNewTab" | "level" | "type" | "size" | "disabled" | "style" | "onClick" | "name" | "title" | "data-testid" | "className" | "buttonProps" | "children"> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -20,6 +20,7 @@ export interface ISearchInputProps {
|
|
|
20
20
|
initialValue?: string;
|
|
21
21
|
inputTransformer?: (input: string) => string;
|
|
22
22
|
name?: string;
|
|
23
|
+
focusUpdate?: boolean;
|
|
23
24
|
}
|
|
24
25
|
export declare function isGroupedResult(result: ISearchResult[] | ISearchGroupedResult[]): result is ISearchGroupedResult[];
|
|
25
26
|
export declare const LuiSearchInput: React.FC<ISearchInputProps>;
|
package/dist/index.js
CHANGED
|
@@ -178,7 +178,7 @@ iconMap['ic_add_circle_outline'] = (React__default["default"].createElement("svg
|
|
|
178
178
|
iconMap['ic_add_irregular_image'] = (React__default["default"].createElement("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" },
|
|
179
179
|
React__default["default"].createElement("path", { d: "M19 5v14H5V5h14Zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2Zm-4.86 8.86-3 3.87L9 13.14 6 17h12l-3.86-5.14Z" })));
|
|
180
180
|
iconMap['ic_add_multiple'] = (React__default["default"].createElement("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" },
|
|
181
|
-
React__default["default"].createElement("path", { d: "
|
|
181
|
+
React__default["default"].createElement("path", { d: "M20 6h2v14c0 1.1-.9 2-2 2H6v-2h14V6ZM4 2h12c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2Zm0 14h12V4H4v12Zm7-2H9v-3H6V9h3V6h2v3h3v2h-3v3Z" })));
|
|
182
182
|
iconMap['ic_add_to_list'] = (React__default["default"].createElement("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" },
|
|
183
183
|
React__default["default"].createElement("path", { d: "M13 10H3c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1Zm0-4H3c-.55 0-1 .45-1 1s.45 1 1 1h10c.55 0 1-.45 1-1s-.45-1-1-1Zm5 8v-3c0-.55-.45-1-1-1s-1 .45-1 1v3h-3c-.55 0-1 .45-1 1s.45 1 1 1h3v3c0 .55.45 1 1 1s1-.45 1-1v-3h3c.55 0 1-.45 1-1s-.45-1-1-1h-3ZM3 16h6c.55 0 1-.45 1-1s-.45-1-1-1H3c-.55 0-1 .45-1 1s.45 1 1 1Z" })));
|
|
184
184
|
iconMap['ic_annotations'] = (React__default["default"].createElement("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" },
|
|
@@ -55927,6 +55927,12 @@ var LuiSearchInput = function (props) {
|
|
|
55927
55927
|
var _e = React.useState(false), isLoading = _e[0], setIsLoading = _e[1];
|
|
55928
55928
|
var inputRef = React.useRef(null);
|
|
55929
55929
|
var selectedRef = React.useRef(null);
|
|
55930
|
+
//set focus to inut box
|
|
55931
|
+
React.useEffect(function () {
|
|
55932
|
+
var _a;
|
|
55933
|
+
if (props.focusUpdate !== undefined)
|
|
55934
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
55935
|
+
}, [props.focusUpdate]);
|
|
55930
55936
|
//clear result after search types changed
|
|
55931
55937
|
React.useEffect(function () {
|
|
55932
55938
|
setResults([]);
|
|
@@ -56086,16 +56092,30 @@ var resultStyle$1 = { verticalAlign: 'middle' };
|
|
|
56086
56092
|
* See examples in SearchBox in storybook.
|
|
56087
56093
|
*/
|
|
56088
56094
|
var LuiSearchBox = function (_a) {
|
|
56089
|
-
var searchBoxOptions = _a.searchBoxOptions, initOptionValue = _a.initOptionValue, onMenuSelect = _a.onMenuSelect;
|
|
56095
|
+
var searchBoxOptions = _a.searchBoxOptions, initOptionValue = _a.initOptionValue, onMenuSelect = _a.onMenuSelect, autoFocus = _a.autoFocus;
|
|
56090
56096
|
var initOption = searchBoxOptions.find(function (_a) {
|
|
56091
56097
|
var value = _a.value;
|
|
56092
56098
|
return value === initOptionValue;
|
|
56093
56099
|
});
|
|
56094
56100
|
var _b = React.useState(initOption ? initOption : searchBoxOptions[0]), selectedMenuOption = _b[0], setSelectedMenuOption = _b[1];
|
|
56101
|
+
//auto focus every time select a menu item
|
|
56102
|
+
var _c = React.useState(false), focusUpdate = _c[0], setFocusUpdate = _c[1];
|
|
56103
|
+
//don't focus when first time display
|
|
56104
|
+
var _d = React.useState(false), isFocus = _d[0], setIsFocus = _d[1];
|
|
56105
|
+
React.useEffect(function () {
|
|
56106
|
+
var updatedOption = searchBoxOptions.find(function (_a) {
|
|
56107
|
+
var value = _a.value;
|
|
56108
|
+
return value === initOptionValue;
|
|
56109
|
+
});
|
|
56110
|
+
if (updatedOption)
|
|
56111
|
+
setSelectedMenuOption(updatedOption);
|
|
56112
|
+
}, [initOptionValue]);
|
|
56095
56113
|
var handleMenuSelected = function (e) {
|
|
56096
56114
|
setSelectedMenuOption(findSelectedOption(e.value));
|
|
56097
56115
|
if (onMenuSelect !== undefined)
|
|
56098
56116
|
onMenuSelect(e);
|
|
56117
|
+
setIsFocus(true);
|
|
56118
|
+
setFocusUpdate(!focusUpdate);
|
|
56099
56119
|
};
|
|
56100
56120
|
var findSelectedOption = function (v) {
|
|
56101
56121
|
var selectedOption = searchBoxOptions.find(function (_a) {
|
|
@@ -56111,7 +56131,7 @@ var LuiSearchBox = function (_a) {
|
|
|
56111
56131
|
? selectedMenuOption.renderItem
|
|
56112
56132
|
: function (item) {
|
|
56113
56133
|
return React__default["default"].createElement("span", { style: resultStyle$1 }, item.description);
|
|
56114
|
-
}, disclaimer: selectedMenuOption.disclaimer }))));
|
|
56134
|
+
}, disclaimer: selectedMenuOption.disclaimer, focusUpdate: autoFocus && isFocus ? focusUpdate : undefined }))));
|
|
56115
56135
|
};
|
|
56116
56136
|
var LuiSearchBoxButton = React__default["default"].forwardRef(function (props, ref) {
|
|
56117
56137
|
return (React__default["default"].createElement(LuiButton, __assign({ level: "tertiary" }, props, { ref: ref, className: "LuiSearchBox-button" }),
|
|
@@ -60409,7 +60429,6 @@ var LuiSidePanelContainer = function (props) {
|
|
|
60409
60429
|
transition: 'width 0.2s ease',
|
|
60410
60430
|
boxShadow: '-0.1em 0 0.4em rgba(0, 0, 0, 0.2)',
|
|
60411
60431
|
padding: 0,
|
|
60412
|
-
whiteSpace: 'nowrap',
|
|
60413
60432
|
zIndex: 3,
|
|
60414
60433
|
} },
|
|
60415
60434
|
children && (React__default["default"].createElement("button", { type: "button", "data-testid": "close", onClick: onClose, style: {
|