@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/dist/lui.esm.js CHANGED
@@ -150,7 +150,7 @@ iconMap['ic_add_circle_outline'] = (React__default.createElement("svg", { viewBo
150
150
  iconMap['ic_add_irregular_image'] = (React__default.createElement("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" },
151
151
  React__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" })));
152
152
  iconMap['ic_add_multiple'] = (React__default.createElement("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" },
153
- React__default.createElement("path", { d: "M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6Zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2Zm0 14H8V4h12v12Zm-7-2h2v-3h3V9h-3V6h-2v3h-3v2h3v3Z" })));
153
+ React__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" })));
154
154
  iconMap['ic_add_to_list'] = (React__default.createElement("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" },
155
155
  React__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" })));
156
156
  iconMap['ic_annotations'] = (React__default.createElement("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" },
@@ -55899,6 +55899,12 @@ var LuiSearchInput = function (props) {
55899
55899
  var _e = useState(false), isLoading = _e[0], setIsLoading = _e[1];
55900
55900
  var inputRef = useRef(null);
55901
55901
  var selectedRef = useRef(null);
55902
+ //set focus to inut box
55903
+ useEffect(function () {
55904
+ var _a;
55905
+ if (props.focusUpdate !== undefined)
55906
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
55907
+ }, [props.focusUpdate]);
55902
55908
  //clear result after search types changed
55903
55909
  useEffect(function () {
55904
55910
  setResults([]);
@@ -56058,16 +56064,30 @@ var resultStyle$1 = { verticalAlign: 'middle' };
56058
56064
  * See examples in SearchBox in storybook.
56059
56065
  */
56060
56066
  var LuiSearchBox = function (_a) {
56061
- var searchBoxOptions = _a.searchBoxOptions, initOptionValue = _a.initOptionValue, onMenuSelect = _a.onMenuSelect;
56067
+ var searchBoxOptions = _a.searchBoxOptions, initOptionValue = _a.initOptionValue, onMenuSelect = _a.onMenuSelect, autoFocus = _a.autoFocus;
56062
56068
  var initOption = searchBoxOptions.find(function (_a) {
56063
56069
  var value = _a.value;
56064
56070
  return value === initOptionValue;
56065
56071
  });
56066
56072
  var _b = useState(initOption ? initOption : searchBoxOptions[0]), selectedMenuOption = _b[0], setSelectedMenuOption = _b[1];
56073
+ //auto focus every time select a menu item
56074
+ var _c = useState(false), focusUpdate = _c[0], setFocusUpdate = _c[1];
56075
+ //don't focus when first time display
56076
+ var _d = useState(false), isFocus = _d[0], setIsFocus = _d[1];
56077
+ useEffect(function () {
56078
+ var updatedOption = searchBoxOptions.find(function (_a) {
56079
+ var value = _a.value;
56080
+ return value === initOptionValue;
56081
+ });
56082
+ if (updatedOption)
56083
+ setSelectedMenuOption(updatedOption);
56084
+ }, [initOptionValue]);
56067
56085
  var handleMenuSelected = function (e) {
56068
56086
  setSelectedMenuOption(findSelectedOption(e.value));
56069
56087
  if (onMenuSelect !== undefined)
56070
56088
  onMenuSelect(e);
56089
+ setIsFocus(true);
56090
+ setFocusUpdate(!focusUpdate);
56071
56091
  };
56072
56092
  var findSelectedOption = function (v) {
56073
56093
  var selectedOption = searchBoxOptions.find(function (_a) {
@@ -56083,7 +56103,7 @@ var LuiSearchBox = function (_a) {
56083
56103
  ? selectedMenuOption.renderItem
56084
56104
  : function (item) {
56085
56105
  return React__default.createElement("span", { style: resultStyle$1 }, item.description);
56086
- }, disclaimer: selectedMenuOption.disclaimer }))));
56106
+ }, disclaimer: selectedMenuOption.disclaimer, focusUpdate: autoFocus && isFocus ? focusUpdate : undefined }))));
56087
56107
  };
56088
56108
  var LuiSearchBoxButton = React__default.forwardRef(function (props, ref) {
56089
56109
  return (React__default.createElement(LuiButton, __assign({ level: "tertiary" }, props, { ref: ref, className: "LuiSearchBox-button" }),
@@ -60381,7 +60401,6 @@ var LuiSidePanelContainer = function (props) {
60381
60401
  transition: 'width 0.2s ease',
60382
60402
  boxShadow: '-0.1em 0 0.4em rgba(0, 0, 0, 0.2)',
60383
60403
  padding: 0,
60384
- whiteSpace: 'nowrap',
60385
60404
  zIndex: 3,
60386
60405
  } },
60387
60406
  children && (React__default.createElement("button", { type: "button", "data-testid": "close", onClick: onClose, style: {