@linzjs/lui 12.2.0 → 13.0.2
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 +30 -0
- package/README.md +1 -1
- package/dist/components/LuiLoadingSpinner/LuiLoadingSpinner.stories.d.ts +1 -0
- package/dist/components/LuiLoadingSpinner/LuiLottieLight.d.ts +14 -0
- package/dist/components/LuiMenu/LuiMenu.d.ts +7 -39
- package/dist/components/LuiMenu/LuiMenu.stories.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/lui.cjs.development.js +64 -78
- package/dist/lui.cjs.development.js.map +1 -1
- package/dist/lui.cjs.production.min.js +1 -1
- package/dist/lui.cjs.production.min.js.map +1 -1
- package/dist/lui.css +15 -15
- package/dist/lui.css.map +1 -1
- package/dist/lui.esm.js +66 -77
- package/dist/lui.esm.js.map +1 -1
- package/dist/scss/Components/ContextMenu/context-menu.scss +15 -0
- package/dist/scss/Components/Menu/menu.scss +0 -12
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
## [13.0.2](https://github.com/linz/lui/compare/v13.0.1...v13.0.2) (2022-01-31)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* We now pass consts into LuiLottieLight, Used to pass new object, which caused useEffect to trigger distroy ([#541](https://github.com/linz/lui/issues/541)) ([7db8b0e](https://github.com/linz/lui/commit/7db8b0e903bafe3fb26da2b849f5696a44ecf638))
|
|
7
|
+
|
|
8
|
+
## [13.0.1](https://github.com/linz/lui/compare/v13.0.0...v13.0.1) (2022-01-31)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* handle destroy correctly for lottie ([#539](https://github.com/linz/lui/issues/539)) ([143d0f1](https://github.com/linz/lui/commit/143d0f1692f655e0c18a048d6536e3797dac29c3))
|
|
14
|
+
|
|
15
|
+
# [13.0.0](https://github.com/linz/lui/compare/v12.2.0...v13.0.0) (2022-01-31)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### breaking
|
|
19
|
+
|
|
20
|
+
* **LuiMenu,LuiControlledMenu:** PR to trigger build ([#535](https://github.com/linz/lui/issues/535)) ([c3f117e](https://github.com/linz/lui/commit/c3f117e42476876742517bddb0515b42d9ab46bf))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### BREAKING CHANGES
|
|
24
|
+
|
|
25
|
+
* **LuiMenu,LuiControlledMenu:** breaking(LuiMenu,LuiControlledMenu) PR to trigger build
|
|
26
|
+
|
|
27
|
+
This is the breaking change commit for https://github.com/linz/Lui/pull/531
|
|
28
|
+
|
|
29
|
+
* Update README.md
|
|
30
|
+
|
|
1
31
|
# [12.2.0](https://github.com/linz/lui/compare/v12.1.4...v12.2.0) (2022-01-20)
|
|
2
32
|
|
|
3
33
|
|
package/README.md
CHANGED
|
@@ -6,6 +6,7 @@ declare const _default: {
|
|
|
6
6
|
};
|
|
7
7
|
export default _default;
|
|
8
8
|
export declare const LoadingSpinner: () => JSX.Element;
|
|
9
|
+
export declare const LoadingSpinnerReRender: () => JSX.Element;
|
|
9
10
|
export declare const MiniSpinner: () => JSX.Element;
|
|
10
11
|
export declare const StatusSpinner: () => JSX.Element;
|
|
11
12
|
export declare const StatusSpinnerLongContent: () => JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface LuiLottieLightProps {
|
|
3
|
+
animationData: any;
|
|
4
|
+
loop: boolean;
|
|
5
|
+
autoplay: boolean;
|
|
6
|
+
rendererSettings: any;
|
|
7
|
+
style: any;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Very trivial react wrapper for Lottie-web light. Using lottie-web directly rather than with `react-lottie` or
|
|
11
|
+
* `lottie-react` reduces our bundle size and enables use to use lottie-web in light mode.
|
|
12
|
+
*/
|
|
13
|
+
export declare const LuiLottieLight: ({ animationData, style, rendererSettings, autoplay, loop, }: LuiLottieLightProps) => JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -1,44 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ControlledMenuProps, MenuProps } from '@szhsin/react-menu';
|
|
2
2
|
import '@szhsin/react-menu/dist/index.css';
|
|
3
|
-
interface LuiMenuProps {
|
|
4
|
-
menuButton: ReactNode;
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
/** render the menu in a portal - required if the menu is contained in an absolutely positioned container with overflow settings. Default: false */
|
|
7
|
-
portal?: boolean;
|
|
8
|
-
boundingBoxRef?: React.MutableRefObject<HTMLElement | null>;
|
|
9
|
-
anchorRef?: React.MutableRefObject<HTMLElement | null>;
|
|
10
|
-
}
|
|
11
|
-
interface LuiControlledMenuProps {
|
|
12
|
-
isOpen: boolean;
|
|
13
|
-
onClose: () => void;
|
|
14
|
-
anchorPoint: {
|
|
15
|
-
x: number;
|
|
16
|
-
y: number;
|
|
17
|
-
};
|
|
18
|
-
children: ReactNode;
|
|
19
|
-
boundingBoxRef?: React.MutableRefObject<HTMLElement | null>;
|
|
20
|
-
anchorRef?: React.MutableRefObject<HTMLElement | null>;
|
|
21
|
-
}
|
|
22
|
-
interface LuiMenuItemProps {
|
|
23
|
-
onClick?: () => void;
|
|
24
|
-
disabled?: boolean;
|
|
25
|
-
href?: string | undefined;
|
|
26
|
-
target?: string | undefined;
|
|
27
|
-
rel?: string | undefined;
|
|
28
|
-
children: ReactNode;
|
|
29
|
-
}
|
|
30
|
-
interface LuiMenuHeaderProps {
|
|
31
|
-
children: ReactNode;
|
|
32
|
-
}
|
|
33
3
|
/**
|
|
34
|
-
* A menu controlled by a user-supplied MenuButton. Open/closed state is managed internally.
|
|
4
|
+
* A menu controlled by a user-supplied MenuButton. Open/closed state is managed internally. The defaulted style props,
|
|
5
|
+
* menuClassName and offsetY, can be overridden simply by setting them in the usual way.
|
|
35
6
|
*/
|
|
36
|
-
export declare const LuiMenu: (props:
|
|
7
|
+
export declare const LuiMenu: (props: MenuProps) => JSX.Element;
|
|
37
8
|
/**
|
|
38
|
-
* A menu with state managed externally. Can be used quite conveniently as a context menu.
|
|
9
|
+
* A menu with state managed externally. Can be used quite conveniently as a context menu. The defaulted style props,
|
|
10
|
+
* menuClassName and offsetY, can be overridden simply by setting them in the usual way.
|
|
39
11
|
*/
|
|
40
|
-
export declare const LuiControlledMenu: (props:
|
|
41
|
-
export declare const LuiMenuItem: (props: LuiMenuItemProps) => JSX.Element;
|
|
42
|
-
export declare const LuiMenuDivider: () => JSX.Element;
|
|
43
|
-
export declare const LuiMenuHeader: (props: LuiMenuHeaderProps) => JSX.Element;
|
|
44
|
-
export {};
|
|
12
|
+
export declare const LuiControlledMenu: (props: ControlledMenuProps) => JSX.Element;
|
|
@@ -4,6 +4,7 @@ declare const _default: {
|
|
|
4
4
|
};
|
|
5
5
|
export default _default;
|
|
6
6
|
export declare const MenuTriggeredByLuiButton: () => JSX.Element;
|
|
7
|
+
export declare const MenuWithOverride: () => JSX.Element;
|
|
7
8
|
export declare const MenuWithButtonChange: () => JSX.Element;
|
|
8
9
|
export declare const MenuTriggeredByDotsIcon: () => JSX.Element;
|
|
9
10
|
export declare const MenuWithBoundingBox: () => JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export * from './components/LuiToastMessage/LuiToastMessage';
|
|
|
5
5
|
export * from './contexts/LuiMessagingContextProvider';
|
|
6
6
|
export { LuiButtonGroup } from './components/LuiButton/LuiButton';
|
|
7
7
|
export { LuiExpandableBanner } from './components/LuiExpandableBanner/LuiExpandableBanner';
|
|
8
|
-
export { LuiMenu, LuiControlledMenu
|
|
8
|
+
export { LuiMenu, LuiControlledMenu } from './components/LuiMenu/LuiMenu';
|
|
9
9
|
export { LuiFilterMenu } from './components/LuiFilterMenu/LuiFilterMenu';
|
|
10
10
|
export { LuiTabs, LuiTabsContext } from './components/LuiTabs/LuiTabs';
|
|
11
11
|
export { LuiTab } from './components/LuiTabs/LuiTab/LuiTab';
|
|
@@ -13,7 +13,7 @@ var formik = require('formik');
|
|
|
13
13
|
var uuid = require('uuid');
|
|
14
14
|
var camelcase = _interopDefault(require('camelcase'));
|
|
15
15
|
var Select = _interopDefault(require('react-select'));
|
|
16
|
-
var
|
|
16
|
+
var lottie = _interopDefault(require('lottie-web/build/player/lottie_light'));
|
|
17
17
|
var CreatableSelect = _interopDefault(require('react-select/creatable'));
|
|
18
18
|
var Modal = _interopDefault(require('react-modal'));
|
|
19
19
|
var reactQuery = require('react-query');
|
|
@@ -331,74 +331,26 @@ var LuiExpandableBanner = function LuiExpandableBanner(props) {
|
|
|
331
331
|
};
|
|
332
332
|
|
|
333
333
|
/**
|
|
334
|
-
* A menu controlled by a user-supplied MenuButton. Open/closed state is managed internally.
|
|
334
|
+
* A menu controlled by a user-supplied MenuButton. Open/closed state is managed internally. The defaulted style props,
|
|
335
|
+
* menuClassName and offsetY, can be overridden simply by setting them in the usual way.
|
|
335
336
|
*/
|
|
336
337
|
|
|
337
338
|
var LuiMenu = function LuiMenu(props) {
|
|
338
|
-
return React__default.createElement(reactMenu.Menu, {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
portal: props.portal === true,
|
|
343
|
-
boundingBoxRef: props.boundingBoxRef,
|
|
344
|
-
anchorRef: props.anchorRef,
|
|
345
|
-
styles: {
|
|
346
|
-
zIndex: 10000
|
|
347
|
-
}
|
|
348
|
-
}, getMenuItems(props.children));
|
|
339
|
+
return React__default.createElement(reactMenu.Menu, Object.assign({
|
|
340
|
+
menuClassName: 'lui-menu',
|
|
341
|
+
offsetY: 12
|
|
342
|
+
}, props));
|
|
349
343
|
};
|
|
350
344
|
/**
|
|
351
|
-
* A menu with state managed externally. Can be used quite conveniently as a context menu.
|
|
345
|
+
* A menu with state managed externally. Can be used quite conveniently as a context menu. The defaulted style props,
|
|
346
|
+
* menuClassName and offsetY, can be overridden simply by setting them in the usual way.
|
|
352
347
|
*/
|
|
353
348
|
|
|
354
349
|
var LuiControlledMenu = function LuiControlledMenu(props) {
|
|
355
|
-
return React__default.createElement(reactMenu.ControlledMenu, {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
onClose: props.onClose,
|
|
360
|
-
animation: false,
|
|
361
|
-
boundingBoxRef: props.boundingBoxRef,
|
|
362
|
-
anchorRef: props.anchorRef
|
|
363
|
-
}, getMenuItems(props.children));
|
|
364
|
-
};
|
|
365
|
-
/**
|
|
366
|
-
* Convert the supplied LuiMenuItems into react-menu-compatible MenuItems. An error will be logged if any incompatible
|
|
367
|
-
* children are identified.
|
|
368
|
-
*/
|
|
369
|
-
|
|
370
|
-
var getMenuItems = function getMenuItems(children) {
|
|
371
|
-
return React__default.Children.map(children, function (child) {
|
|
372
|
-
if (!child) {
|
|
373
|
-
return null; // child may be false or undefined if conditional logic has been used to include a LuiMenuItem or not
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
if (React__default.isValidElement(child) && child.type === LuiMenuItem) {
|
|
377
|
-
return React__default.createElement(reactMenu.MenuItem, Object.assign({}, child.props));
|
|
378
|
-
} else if (React__default.isValidElement(child) && child.type === LuiMenuDivider) {
|
|
379
|
-
return React__default.createElement(reactMenu.MenuDivider, null);
|
|
380
|
-
} else if (React__default.isValidElement(child) && child.type === LuiMenuHeader) {
|
|
381
|
-
return React__default.createElement(reactMenu.MenuHeader, null, child.props.children);
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
console.error('A child of LuiMenu may only be a LuiMenuItem');
|
|
385
|
-
return null;
|
|
386
|
-
});
|
|
387
|
-
};
|
|
388
|
-
|
|
389
|
-
var LuiMenuItem = function LuiMenuItem( // @ts-ignore
|
|
390
|
-
props) {
|
|
391
|
-
// This component is never actually rendered
|
|
392
|
-
return React__default.createElement(React__default.Fragment, null);
|
|
393
|
-
};
|
|
394
|
-
var LuiMenuDivider = function LuiMenuDivider() {
|
|
395
|
-
// This component is never actually rendered
|
|
396
|
-
return React__default.createElement(React__default.Fragment, null);
|
|
397
|
-
};
|
|
398
|
-
var LuiMenuHeader = function LuiMenuHeader( // @ts-ignore
|
|
399
|
-
props) {
|
|
400
|
-
// This component is never actually rendered
|
|
401
|
-
return React__default.createElement(React__default.Fragment, null);
|
|
350
|
+
return React__default.createElement(reactMenu.ControlledMenu, Object.assign({
|
|
351
|
+
menuClassName: 'lui-menu',
|
|
352
|
+
offsetY: 12
|
|
353
|
+
}, props));
|
|
402
354
|
};
|
|
403
355
|
|
|
404
356
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -470,14 +422,13 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
470
422
|
return target;
|
|
471
423
|
}
|
|
472
424
|
|
|
473
|
-
var _excluded = ["
|
|
425
|
+
var _excluded = ["toggleMenu"];
|
|
474
426
|
var LuiFilterMenu = function LuiFilterMenu(props) {
|
|
475
427
|
var _useState = React.useState(''),
|
|
476
428
|
filter = _useState[0],
|
|
477
429
|
setFilter = _useState[1];
|
|
478
430
|
|
|
479
431
|
var _useMenuState = reactMenu.useMenuState(),
|
|
480
|
-
closeMenu = _useMenuState.closeMenu,
|
|
481
432
|
toggleMenu = _useMenuState.toggleMenu,
|
|
482
433
|
menuProps = _objectWithoutPropertiesLoose(_useMenuState, _excluded);
|
|
483
434
|
|
|
@@ -488,7 +439,7 @@ var LuiFilterMenu = function LuiFilterMenu(props) {
|
|
|
488
439
|
switch (props.enabled) {
|
|
489
440
|
case false:
|
|
490
441
|
{
|
|
491
|
-
|
|
442
|
+
toggleMenu(false);
|
|
492
443
|
break;
|
|
493
444
|
}
|
|
494
445
|
|
|
@@ -501,14 +452,14 @@ var LuiFilterMenu = function LuiFilterMenu(props) {
|
|
|
501
452
|
}), React__default.createElement(reactMenu.ControlledMenu, Object.assign({}, menuProps, {
|
|
502
453
|
anchorRef: ref,
|
|
503
454
|
onClose: function onClose() {
|
|
504
|
-
return
|
|
455
|
+
return toggleMenu(false);
|
|
505
456
|
},
|
|
506
457
|
className: "lui-menu",
|
|
507
458
|
offsetY: 12,
|
|
508
459
|
onChange: function onChange(e) {
|
|
509
460
|
e.open && setFilter('');
|
|
510
461
|
},
|
|
511
|
-
|
|
462
|
+
menuStyles: props.maxRows !== undefined ? {
|
|
512
463
|
maxHeight: 62 + 34 * props.maxRows,
|
|
513
464
|
overflowY: 'auto'
|
|
514
465
|
} : {}
|
|
@@ -18019,7 +17970,50 @@ var loaderDataChristmas = {
|
|
|
18019
17970
|
markers: markers$2
|
|
18020
17971
|
};
|
|
18021
17972
|
|
|
17973
|
+
/**
|
|
17974
|
+
* Very trivial react wrapper for Lottie-web light. Using lottie-web directly rather than with `react-lottie` or
|
|
17975
|
+
* `lottie-react` reduces our bundle size and enables use to use lottie-web in light mode.
|
|
17976
|
+
*/
|
|
17977
|
+
|
|
17978
|
+
var LuiLottieLight = function LuiLottieLight(_ref) {
|
|
17979
|
+
var animationData = _ref.animationData,
|
|
17980
|
+
style = _ref.style,
|
|
17981
|
+
rendererSettings = _ref.rendererSettings,
|
|
17982
|
+
autoplay = _ref.autoplay,
|
|
17983
|
+
loop = _ref.loop;
|
|
17984
|
+
var element = React__default.useRef(null);
|
|
17985
|
+
var lottieInstance = React__default.useRef();
|
|
17986
|
+
React__default.useEffect(function () {
|
|
17987
|
+
if (element.current) {
|
|
17988
|
+
lottieInstance.current = lottie.loadAnimation({
|
|
17989
|
+
animationData: animationData,
|
|
17990
|
+
container: element.current,
|
|
17991
|
+
rendererSettings: rendererSettings,
|
|
17992
|
+
autoplay: autoplay,
|
|
17993
|
+
loop: loop
|
|
17994
|
+
});
|
|
17995
|
+
}
|
|
17996
|
+
|
|
17997
|
+
return function () {
|
|
17998
|
+
var _lottieInstance$curre;
|
|
17999
|
+
|
|
18000
|
+
(_lottieInstance$curre = lottieInstance.current) == null ? void 0 : _lottieInstance$curre.destroy();
|
|
18001
|
+
};
|
|
18002
|
+
}, [animationData, autoplay, loop, rendererSettings]);
|
|
18003
|
+
return React__default.createElement("div", {
|
|
18004
|
+
style: style,
|
|
18005
|
+
ref: element
|
|
18006
|
+
});
|
|
18007
|
+
};
|
|
18008
|
+
|
|
18022
18009
|
var autoplay = ! /*#__PURE__*/isChromatic();
|
|
18010
|
+
var style = {
|
|
18011
|
+
height: 148,
|
|
18012
|
+
width: 148
|
|
18013
|
+
};
|
|
18014
|
+
var renderSettings = {
|
|
18015
|
+
preserveAspectRatio: 'xMidYMid slice'
|
|
18016
|
+
};
|
|
18023
18017
|
|
|
18024
18018
|
var LuiLoadingSpinnerBase = function LuiLoadingSpinnerBase(props) {
|
|
18025
18019
|
return React__default.createElement("div", {
|
|
@@ -18032,17 +18026,12 @@ var LuiLoadingSpinnerBase = function LuiLoadingSpinnerBase(props) {
|
|
|
18032
18026
|
marginTop: '-74px'
|
|
18033
18027
|
},
|
|
18034
18028
|
"data-testid": "loading-spinner"
|
|
18035
|
-
}, React__default.createElement(
|
|
18029
|
+
}, React__default.createElement(LuiLottieLight, {
|
|
18036
18030
|
animationData: props.animationData,
|
|
18037
18031
|
loop: true,
|
|
18038
18032
|
autoplay: autoplay,
|
|
18039
|
-
rendererSettings:
|
|
18040
|
-
|
|
18041
|
-
},
|
|
18042
|
-
style: {
|
|
18043
|
-
height: 148,
|
|
18044
|
-
width: 148
|
|
18045
|
-
}
|
|
18033
|
+
rendererSettings: renderSettings,
|
|
18034
|
+
style: style
|
|
18046
18035
|
}));
|
|
18047
18036
|
};
|
|
18048
18037
|
/**
|
|
@@ -18069,7 +18058,7 @@ var LuiStatusSpinner = function LuiStatusSpinner(props) {
|
|
|
18069
18058
|
}, props.children)));
|
|
18070
18059
|
};
|
|
18071
18060
|
var LuiMiniSpinner = function LuiMiniSpinner(props) {
|
|
18072
|
-
return React__default.createElement("div", Object.assign({}, props.divProps), React__default.createElement(
|
|
18061
|
+
return React__default.createElement("div", Object.assign({}, props.divProps), React__default.createElement(LuiLottieLight, {
|
|
18073
18062
|
animationData: loaderData,
|
|
18074
18063
|
loop: true,
|
|
18075
18064
|
autoplay: autoplay,
|
|
@@ -20511,9 +20500,6 @@ exports.LuiLoadingSpinnerChristmas = LuiLoadingSpinnerChristmas;
|
|
|
20511
20500
|
exports.LuiLoadingSpinnerEaster = LuiLoadingSpinnerEaster;
|
|
20512
20501
|
exports.LuiMenu = LuiMenu;
|
|
20513
20502
|
exports.LuiMenuCloseButton = LuiMenuCloseButton;
|
|
20514
|
-
exports.LuiMenuDivider = LuiMenuDivider;
|
|
20515
|
-
exports.LuiMenuHeader = LuiMenuHeader;
|
|
20516
|
-
exports.LuiMenuItem = LuiMenuItem;
|
|
20517
20503
|
exports.LuiMessagingContextProvider = LuiMessagingContextProvider;
|
|
20518
20504
|
exports.LuiMiniSpinner = LuiMiniSpinner;
|
|
20519
20505
|
exports.LuiModal = LuiModal;
|