@linzjs/lui 17.30.0 → 17.31.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/CHANGELOG.md +8 -0
- package/README.md +3 -2
- package/dist/components/LuiHeader/LuiHeader.d.ts +8 -0
- package/dist/components/LuiHeaderMenu/LuiHeaderMenus.d.ts +12 -0
- package/dist/components/LuiHeaderMenuV2/LuiHeaderMenusV2.d.ts +69 -0
- package/dist/components/LuiHeaderV2/LuiHeaderV2.d.ts +20 -0
- package/dist/components/LuiIcon/LuiIcon.d.ts +2 -1
- package/dist/components/common/StorybookSupport.d.ts +1 -1
- package/dist/components/common/UseMediaQuery.d.ts +9 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +203 -2
- package/dist/index.js.map +1 -1
- package/dist/lui.css +338 -0
- package/dist/lui.css.map +1 -1
- package/dist/lui.esm.js +192 -3
- package/dist/lui.esm.js.map +1 -1
- package/dist/scss/Components/HeaderV2/header-v2.scss +242 -0
- package/dist/scss/Components/MenuV2/menu-v2.scss +172 -0
- package/dist/scss/base.scss +2 -0
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
# [17.31.0](https://github.com/linz/lui/compare/v17.30.0...v17.31.0) (2023-02-07)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* implement a new version LuiHeader ([#838](https://github.com/linz/lui/issues/838)) ([50d2364](https://github.com/linz/lui/commit/50d23648aa92ce36d927239b034ff045a3fd280a))
|
|
7
|
+
* implement new version LuiHeader and associated componenets ([#840](https://github.com/linz/lui/issues/840)) ([c6c9de3](https://github.com/linz/lui/commit/c6c9de36e0d4108d3aaaf445809d78ebefdfce5e))
|
|
8
|
+
|
|
1
9
|
# [17.30.0](https://github.com/linz/lui/compare/v17.29.1...v17.30.0) (2023-02-07)
|
|
2
10
|
|
|
3
11
|
## [17.29.1](https://github.com/linz/lui/compare/v17.29.0...v17.29.1) (2023-02-06)
|
package/README.md
CHANGED
|
@@ -42,10 +42,11 @@ We aim to make each component generic, extendable, accessible, and amazing.
|
|
|
42
42
|
All styles are implemented in SCSS and compiled to plain CSS. This means any team can use the CSS. A ReactJS wrapper
|
|
43
43
|
over the CSS is part of this project.
|
|
44
44
|
|
|
45
|
-
There are lots of things to do in this project, often things will be left until there is demand. Please join the Slack channel
|
|
45
|
+
There are lots of things to do in this project, often things will be left until there is demand, e.g add new components or implement new version components. Please join the Slack channel
|
|
46
|
+
|
|
46
47
|
#cop-lui.
|
|
47
48
|
|
|
48
|
-
## Documentation
|
|
49
|
+
## Documentation
|
|
49
50
|
|
|
50
51
|
Storybook is the main source of documentation.
|
|
51
52
|
|
|
@@ -9,6 +9,9 @@ interface HeaderProps {
|
|
|
9
9
|
transparent?: boolean;
|
|
10
10
|
sticky?: boolean;
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated: this is replaced by LuiHeaderV2
|
|
14
|
+
*/
|
|
12
15
|
declare const LuiHeader: React.FC<React.PropsWithChildren<HeaderProps>>;
|
|
13
16
|
interface ILuiIcon {
|
|
14
17
|
/**
|
|
@@ -39,6 +42,8 @@ interface ILuiHeaderMenuItem extends ILuiIcon {
|
|
|
39
42
|
'data-testid'?: string;
|
|
40
43
|
}
|
|
41
44
|
/**
|
|
45
|
+
* @deprecated: this is replaced by LuiHeaderMenuItemV2
|
|
46
|
+
*
|
|
42
47
|
* The \`LuiHeaderMenuItem\` is the base component for all menu items that are to be shown in the header.
|
|
43
48
|
* Note that it depends on it being rendered inside a LuiHeader for its styles to apply properly.
|
|
44
49
|
* To configure the item for responsiveness, ensure to set any of the hideOn* properties.
|
|
@@ -56,6 +61,9 @@ interface ILuiCloseableHeaderMenuItem extends Omit<ILuiHeaderMenuItem, 'onClick'
|
|
|
56
61
|
open: boolean;
|
|
57
62
|
setOpen: (value: boolean) => void;
|
|
58
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* @deprecated replaced by LuiCloseableHeaderMenuItemV2
|
|
66
|
+
*/
|
|
59
67
|
declare const LuiCloseableHeaderMenuItem: React.FC<React.PropsWithChildren<ILuiCloseableHeaderMenuItem>>;
|
|
60
68
|
interface ILuiMenuCloseButton extends ILuiIcon {
|
|
61
69
|
'data-testid'?: string;
|
|
@@ -18,13 +18,25 @@ interface ILuiDrawerMenuOption {
|
|
|
18
18
|
*/
|
|
19
19
|
onClick?: () => void;
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated replaced by LuiDrawerMenuOptionsV2
|
|
23
|
+
*/
|
|
21
24
|
declare const LuiDrawerMenuOptions: React.FC<React.PropsWithChildren<ILuiIcon>>;
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated replaced by LuiDrawerMenuOptionV2
|
|
27
|
+
*/
|
|
22
28
|
declare const LuiDrawerMenuOption: React.FC<React.PropsWithChildren<ILuiDrawerMenuOption>>;
|
|
23
29
|
declare type ILuiDrawerMenu = Omit<ILuiHeaderMenuItem, 'onClick'> & {
|
|
24
30
|
hasStickyHeader?: boolean;
|
|
25
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated replaced by LuiDrawerMenuV2
|
|
34
|
+
*/
|
|
26
35
|
declare const LuiDrawerMenu: React.FC<React.PropsWithChildren<ILuiDrawerMenu>>;
|
|
27
36
|
declare type ILuiDropdownMenu = Omit<ILuiHeaderMenuItem, 'onClick'>;
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated replaced by LuiDropdownMenuV2
|
|
39
|
+
*/
|
|
28
40
|
declare const LuiDropdownMenu: React.FC<React.PropsWithChildren<ILuiDropdownMenu>>;
|
|
29
41
|
interface ILuiDrawerMenuSection {
|
|
30
42
|
/**
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { ILuiHeaderMenuItem, ILuiIcon } from '../LuiHeader/LuiHeader';
|
|
3
|
+
import { ILuiDrawerMenu, ILuiDrawerMenuSection } from '../LuiHeaderMenu/LuiHeaderMenus';
|
|
4
|
+
import { Size } from '../common/ResponsiveUtils';
|
|
5
|
+
import { IconSize } from '../LuiIcon/LuiIcon';
|
|
6
|
+
interface ILuiDrawerMenuOptionV2 {
|
|
7
|
+
/**
|
|
8
|
+
* The material-ui icon name (see https://material.io/resources/icons/?search=account_c&style=round)
|
|
9
|
+
*/
|
|
10
|
+
icon?: string | ReactElement;
|
|
11
|
+
/**
|
|
12
|
+
* icon color, only applied when using LuiIcon
|
|
13
|
+
*/
|
|
14
|
+
iconColor?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The size of icon, only applied when using LuiIcon, default to 'md'
|
|
17
|
+
*/
|
|
18
|
+
iconSize?: IconSize;
|
|
19
|
+
/**
|
|
20
|
+
* The label shown beside the icon which is aligned at the left of the drawer
|
|
21
|
+
*/
|
|
22
|
+
label: string | ReactElement;
|
|
23
|
+
/**
|
|
24
|
+
* The badge which is shown which is aligned at the right of the drawer
|
|
25
|
+
*/
|
|
26
|
+
badge?: ReactElement;
|
|
27
|
+
/**
|
|
28
|
+
* The function to be bound together with closing the drawer on click
|
|
29
|
+
*/
|
|
30
|
+
onClick?: () => void;
|
|
31
|
+
}
|
|
32
|
+
declare const LuiDrawerMenuOptionsV2: ({ children, }: ILuiIcon & {
|
|
33
|
+
children: ReactNode;
|
|
34
|
+
}) => JSX.Element;
|
|
35
|
+
declare const LuiDrawerMenuOptionV2: ({ icon, iconColor, label, badge, iconSize, onClick, }: ILuiDrawerMenuOptionV2) => JSX.Element;
|
|
36
|
+
declare const LuiDrawerMenuV2: ({ children, hasStickyHeader, ...menuPropsCopy }: Omit<ILuiHeaderMenuItem, "onClick"> & {
|
|
37
|
+
hasStickyHeader?: boolean | undefined;
|
|
38
|
+
} & {
|
|
39
|
+
children: ReactNode;
|
|
40
|
+
}) => JSX.Element;
|
|
41
|
+
declare type ILuiDropdownMenuV2 = Omit<ILuiHeaderMenuItem, 'onClick'> & {
|
|
42
|
+
/**
|
|
43
|
+
* The anchor origin of dropdown, default to left
|
|
44
|
+
*/
|
|
45
|
+
anchorOrigin?: {
|
|
46
|
+
horizontal?: 'left' | 'right';
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* the width of dropdown, default to 'md'
|
|
50
|
+
*/
|
|
51
|
+
size?: Size | 'xxl';
|
|
52
|
+
};
|
|
53
|
+
declare const LuiDropdownMenuV2: ({ ...restOfProps }: Omit<ILuiHeaderMenuItem, "onClick"> & {
|
|
54
|
+
/**
|
|
55
|
+
* The anchor origin of dropdown, default to left
|
|
56
|
+
*/
|
|
57
|
+
anchorOrigin?: {
|
|
58
|
+
horizontal?: "left" | "right" | undefined;
|
|
59
|
+
} | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* the width of dropdown, default to 'md'
|
|
62
|
+
*/
|
|
63
|
+
size?: Size | "xxl" | undefined;
|
|
64
|
+
} & {
|
|
65
|
+
children: ReactNode;
|
|
66
|
+
}) => JSX.Element;
|
|
67
|
+
declare const LuiDrawerMenuSectionV2: (props: ILuiDrawerMenuSection) => JSX.Element;
|
|
68
|
+
declare const LuiDrawerMenuDividerV2: () => JSX.Element;
|
|
69
|
+
export { LuiDrawerMenuV2, LuiDrawerMenuOptionsV2, LuiDrawerMenuOptionV2, ILuiDropdownMenuV2, LuiDropdownMenuV2, LuiDrawerMenuSectionV2, LuiDrawerMenuDividerV2, ILuiDrawerMenuOptionV2, };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { HeaderSize, ILuiCloseableHeaderMenuItem, ILuiHeaderMenuItem } from '../LuiHeader/LuiHeader';
|
|
3
|
+
interface HeaderPropsV2 {
|
|
4
|
+
headingText?: string;
|
|
5
|
+
size?: HeaderSize;
|
|
6
|
+
homeLink?: string | (() => void);
|
|
7
|
+
transparent?: boolean;
|
|
8
|
+
sticky?: boolean;
|
|
9
|
+
appMenu?: ReactNode;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
declare const LuiHeaderV2: ({ headingText, size, homeLink, transparent, children, sticky, appMenu, }: HeaderPropsV2) => JSX.Element;
|
|
13
|
+
declare const LuiHeaderMenuItemV2: React.ForwardRefExoticComponent<ILuiHeaderMenuItem & {
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
iconColor?: string | undefined;
|
|
16
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
+
declare const LuiCloseableHeaderMenuItemV2: ({ open, setOpen, children, ...props }: ILuiCloseableHeaderMenuItem & {
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
}) => JSX.Element;
|
|
20
|
+
export { LuiHeaderV2, LuiHeaderMenuItemV2, LuiCloseableHeaderMenuItemV2 };
|
|
@@ -14,6 +14,7 @@ export interface LuiIconProps {
|
|
|
14
14
|
className?: string;
|
|
15
15
|
title?: string;
|
|
16
16
|
spanProps?: InputHTMLAttributes<HTMLInputElement>;
|
|
17
|
+
color?: string;
|
|
17
18
|
}
|
|
18
19
|
export declare const ICON_SIZES: {
|
|
19
20
|
xs: string;
|
|
@@ -31,4 +32,4 @@ export declare const ICON_STATUS: {
|
|
|
31
32
|
interactive: string;
|
|
32
33
|
disabled: string;
|
|
33
34
|
};
|
|
34
|
-
export declare const LuiIcon: ({ name, className, size, title, alt, status, spanProps, }: LuiIconProps) => JSX.Element | null;
|
|
35
|
+
export declare const LuiIcon: ({ name, className, size, title, alt, status, spanProps, color, }: LuiIconProps) => JSX.Element | null;
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* Open menu after render so chromatic can see it.
|
|
3
3
|
* Place in useEffect in story. e.g. useEffect(openHeaderMenu, []);
|
|
4
4
|
*/
|
|
5
|
-
export declare const openHeaderMenu: () => void;
|
|
5
|
+
export declare const openHeaderMenu: (menuIconClass?: string) => void;
|
|
6
6
|
export declare const expandCollapsedContainer: () => void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Size } from './ResponsiveUtils';
|
|
2
|
+
export declare type Breakpoint = Exclude<Size | 'xxl', 'xs'>;
|
|
3
|
+
export declare const breakpoints: Record<Breakpoint, number>;
|
|
4
|
+
export declare const breakpointQuery: {
|
|
5
|
+
up: (bp: Breakpoint) => string;
|
|
6
|
+
down: (bp: Breakpoint) => string;
|
|
7
|
+
between: (bp1: Breakpoint, bp2: Breakpoint) => string;
|
|
8
|
+
};
|
|
9
|
+
export declare const useMediaQuery: (query: string) => boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -36,7 +36,9 @@ export { LuiFooter } from './components/LuiFooter/LuiFooter';
|
|
|
36
36
|
export { LuiComboSelect, LuiComboSelectProps, LuiComboSelectOption, } from './components/LuiForms/LuiComboSelect/LuiComboSelect';
|
|
37
37
|
export { LuiFormSectionHeader, IFormSectionHeaderProps, } from './components/LuiForms/LuiFormSection/LuiFormSectionHeader';
|
|
38
38
|
export * from './components/LuiHeader/LuiHeader';
|
|
39
|
+
export * from './components/LuiHeaderV2/LuiHeaderV2';
|
|
39
40
|
export * from './components/LuiHeaderMenu/LuiHeaderMenus';
|
|
41
|
+
export * from './components/LuiHeaderMenuV2/LuiHeaderMenusV2';
|
|
40
42
|
export { LuiUpdatesSplashModal } from './components/LuiUpdateSplashModal/LuiUpdatesSplashModal';
|
|
41
43
|
export { LuiModal, LuiAlertModal, LuiAlertModalButtons, } from './components/LuiModal/LuiModal';
|
|
42
44
|
export { ISearchInputProps, ISearchGroupedResult, ISearchResult, LuiSearchInput, } from './components/LuiSearchInput/LuiSearchInput';
|
|
@@ -67,3 +69,4 @@ export { RadioItemRenderer } from './components/LuiListBox/Renderers/RadioItemRe
|
|
|
67
69
|
export { CheckboxItemRenderer } from './components/LuiListBox/Renderers/CheckboxItemRenderer';
|
|
68
70
|
export { LuiSideMenu, ILuiSideMenuProps, } from './components/LuiSideMenu/LuiSideMenu';
|
|
69
71
|
export { LuiSideMenuItem, ILuiSideMenuItemProps, LuiMenuItemClickHandler, } from './components/LuiSideMenu/LuiSideMenuItem';
|
|
72
|
+
export { Breakpoint, breakpoints, breakpointQuery, useMediaQuery, } from './components/common/UseMediaQuery';
|
package/dist/index.js
CHANGED
|
@@ -549,13 +549,14 @@ var ICON_STATUS = {
|
|
|
549
549
|
disabled: 'LuiIcon--disabled'
|
|
550
550
|
};
|
|
551
551
|
var LuiIcon = function (_a) {
|
|
552
|
-
var name = _a.name, className = _a.className, _b = _a.size, size = _b === void 0 ? 'ns' : _b, title = _a.title, alt = _a.alt, _c = _a.status, status = _c === void 0 ? 'none' : _c, spanProps = _a.spanProps;
|
|
552
|
+
var name = _a.name, className = _a.className, _b = _a.size, size = _b === void 0 ? 'ns' : _b, title = _a.title, alt = _a.alt, _c = _a.status, status = _c === void 0 ? 'none' : _c, spanProps = _a.spanProps, color = _a.color;
|
|
553
553
|
var iconSVG = ICONS[name];
|
|
554
554
|
if (!iconSVG) {
|
|
555
555
|
console.warn("<LuiIcon>: No icon found for: ".concat(iconSVG));
|
|
556
556
|
return null;
|
|
557
557
|
}
|
|
558
|
-
|
|
558
|
+
var customStyle = color ? { fill: color } : {};
|
|
559
|
+
return (React__namespace.createElement("span", __assign$3({ className: clsx$1('LuiIcon', className, size && ICON_SIZES[size], status && ICON_STATUS[status]), "data-icon": name, title: title, "aria-label": alt }, spanProps, { style: customStyle }), iconSVG));
|
|
559
560
|
};
|
|
560
561
|
|
|
561
562
|
function getMaterialIconForLevel(level) {
|
|
@@ -40120,8 +40121,12 @@ var buildHideClassDict = function (_a) {
|
|
|
40120
40121
|
};
|
|
40121
40122
|
};
|
|
40122
40123
|
|
|
40124
|
+
/**
|
|
40125
|
+
* @deprecated: this is replaced by LuiHeaderV2
|
|
40126
|
+
*/
|
|
40123
40127
|
var LuiHeader = function (_a) {
|
|
40124
40128
|
var headingText = _a.headingText, _b = _a.size, size = _b === void 0 ? 'small' : _b, homeLink = _a.homeLink, transparent = _a.transparent, children = _a.children, _c = _a.sticky, sticky = _c === void 0 ? true : _c;
|
|
40129
|
+
useDeprecatedWarning('LuiHeader');
|
|
40125
40130
|
var logoElement = size === 'normal' ? (React__default["default"].createElement("img", { className: "linz-logo", alt: "LINZ Logo", src: logo })) : (React__default["default"].createElement("img", { className: "linz-motif", alt: "LINZ Logo", src: motif }));
|
|
40126
40131
|
var logoContainer = logoElement;
|
|
40127
40132
|
if (typeof homeLink === 'string') {
|
|
@@ -40146,12 +40151,15 @@ var LuiHeader = function (_a) {
|
|
|
40146
40151
|
React__default["default"].createElement("div", { className: "lui-header-col" }, children))));
|
|
40147
40152
|
};
|
|
40148
40153
|
/**
|
|
40154
|
+
* @deprecated: this is replaced by LuiHeaderMenuItemV2
|
|
40155
|
+
*
|
|
40149
40156
|
* The \`LuiHeaderMenuItem\` is the base component for all menu items that are to be shown in the header.
|
|
40150
40157
|
* Note that it depends on it being rendered inside a LuiHeader for its styles to apply properly.
|
|
40151
40158
|
* To configure the item for responsiveness, ensure to set any of the hideOn* properties.
|
|
40152
40159
|
*/
|
|
40153
40160
|
var LuiHeaderMenuItem = React$1.forwardRef(function (_a, ref) {
|
|
40154
40161
|
var icon = _a.icon, label = _a.label, badge = _a.badge, hide = _a.hide, onClick = _a.onClick, _b = _a["data-testid"], dataTestId = _b === void 0 ? 'menu-item' : _b, children = _a.children;
|
|
40162
|
+
useDeprecatedWarning('LuiHeaderMenuItem');
|
|
40155
40163
|
var menuItemClasses = clsx$1('lui-header-menu-item', hide && buildHideClassDict(hide));
|
|
40156
40164
|
var resolvedIcon = !icon && !label ? 'menu' : icon;
|
|
40157
40165
|
return (React__default["default"].createElement("div", { className: menuItemClasses, ref: ref },
|
|
@@ -40166,8 +40174,12 @@ var LuiCloseableHeaderMenuContext = React$1.createContext({
|
|
|
40166
40174
|
open: function () { },
|
|
40167
40175
|
close: function () { }
|
|
40168
40176
|
});
|
|
40177
|
+
/**
|
|
40178
|
+
* @deprecated replaced by LuiCloseableHeaderMenuItemV2
|
|
40179
|
+
*/
|
|
40169
40180
|
var LuiCloseableHeaderMenuItem = function (_a) {
|
|
40170
40181
|
var open = _a.open, setOpen = _a.setOpen, props = __rest$1(_a, ["open", "setOpen"]);
|
|
40182
|
+
useDeprecatedWarning('LuiCloseableHeaderMenuItem');
|
|
40171
40183
|
useEscapeFunction(function () { return setOpen(false); });
|
|
40172
40184
|
var menuDiv = usePageClickFunction(function (event) { return open || event.stopPropagation(); }, function (event) {
|
|
40173
40185
|
if (!open) {
|
|
@@ -40191,12 +40203,77 @@ var LuiMenuCloseButton = function (_a) {
|
|
|
40191
40203
|
return (React__default["default"].createElement("i", { className: classes, onClick: menu.close, "data-testid": dataTestId }, icon));
|
|
40192
40204
|
};
|
|
40193
40205
|
|
|
40206
|
+
var LuiHeaderV2 = function (_a) {
|
|
40207
|
+
var headingText = _a.headingText, _b = _a.size, size = _b === void 0 ? 'small' : _b, homeLink = _a.homeLink, transparent = _a.transparent, children = _a.children, _c = _a.sticky, sticky = _c === void 0 ? true : _c, appMenu = _a.appMenu;
|
|
40208
|
+
var logoElement = size === 'normal' ? (React__default["default"].createElement("img", { className: "LuiHeaderV2-linz-logo", alt: "LINZ Logo", src: logo })) : (React__default["default"].createElement("img", { className: "LuiHeaderV2-linz-motif", alt: "LINZ Logo", src: motif }));
|
|
40209
|
+
var logoContainer = logoElement;
|
|
40210
|
+
if (typeof homeLink === 'string') {
|
|
40211
|
+
logoContainer = React__default["default"].createElement("a", { href: homeLink }, logoElement);
|
|
40212
|
+
}
|
|
40213
|
+
else if (typeof homeLink === 'function') {
|
|
40214
|
+
logoContainer = (React__default["default"].createElement("div", { className: "clickable", onClick: function () {
|
|
40215
|
+
homeLink();
|
|
40216
|
+
} }, logoElement));
|
|
40217
|
+
}
|
|
40218
|
+
return (React__default["default"].createElement("header", { className: clsx$1({
|
|
40219
|
+
LuiHeaderV2: true,
|
|
40220
|
+
'LuiHeaderV2-transparent': transparent,
|
|
40221
|
+
'LuiHeaderV2-small': size === 'small',
|
|
40222
|
+
'LuiHeaderV2-sticky': sticky
|
|
40223
|
+
}) },
|
|
40224
|
+
React__default["default"].createElement("div", { className: "LuiHeaderV2-row" },
|
|
40225
|
+
React__default["default"].createElement("div", { className: "LuiHeaderV2-col" },
|
|
40226
|
+
!!appMenu && appMenu,
|
|
40227
|
+
React__default["default"].createElement("div", { className: "LuiHeaderV2-logo" }, logoContainer),
|
|
40228
|
+
headingText && (React__default["default"].createElement("div", { className: "LuiHeaderV2-title" },
|
|
40229
|
+
React__default["default"].createElement("h1", null, headingText)))),
|
|
40230
|
+
React__default["default"].createElement("div", { className: "LuiHeaderV2-col" }, children))));
|
|
40231
|
+
};
|
|
40232
|
+
var LuiHeaderMenuItemV2 = React$1.forwardRef(function (_a, ref) {
|
|
40233
|
+
var icon = _a.icon, _b = _a.iconColor, iconColor = _b === void 0 ? '#ffffff' : _b, label = _a.label, badge = _a.badge, hide = _a.hide, onClick = _a.onClick, _c = _a["data-testid"], dataTestId = _c === void 0 ? 'menu-item' : _c, children = _a.children;
|
|
40234
|
+
var menuItemClasses = clsx$1('LuiHeaderV2-menu-item', hide && buildHideClassDict(hide));
|
|
40235
|
+
var resolvedIcon = !icon && !label ? 'ic_menu' : icon;
|
|
40236
|
+
return (React__default["default"].createElement("div", { className: menuItemClasses, ref: ref },
|
|
40237
|
+
React__default["default"].createElement("div", { className: "LuiHeaderV2-menu-button" },
|
|
40238
|
+
resolvedIcon && (React__default["default"].createElement("div", { className: clsx$1('LuiHeaderV2-menu-icon', onClick && 'clickable'), "data-testid": dataTestId, onClick: onClick },
|
|
40239
|
+
React__default["default"].createElement(LuiIcon, { size: "lg", name: resolvedIcon, alt: '', color: iconColor }))),
|
|
40240
|
+
label && (React__default["default"].createElement("div", { className: clsx$1(onClick && 'clickable', { 'LuiHeaderV2-menu-label': !!resolvedIcon }, { 'LuiHeaderV2-menu-label-only': !resolvedIcon }), onClick: onClick }, label)),
|
|
40241
|
+
badge && React__default["default"].createElement("div", { className: "LuiHeaderV2-badge" }, badge)),
|
|
40242
|
+
!!children && children));
|
|
40243
|
+
});
|
|
40244
|
+
var LuiCloseableHeaderMenuItemV2 = function (_a) {
|
|
40245
|
+
var open = _a.open, setOpen = _a.setOpen, children = _a.children, props = __rest$1(_a, ["open", "setOpen", "children"]);
|
|
40246
|
+
useEscapeFunction(function () { return setOpen(false); });
|
|
40247
|
+
var menuDiv = usePageClickFunction(function (event) { return open || event.stopPropagation(); }, function (event) {
|
|
40248
|
+
if (!open) {
|
|
40249
|
+
event.stopPropagation();
|
|
40250
|
+
setOpen(false);
|
|
40251
|
+
}
|
|
40252
|
+
});
|
|
40253
|
+
var menuControls = {
|
|
40254
|
+
isOpen: function () { return open; },
|
|
40255
|
+
open: function () { return setOpen(!open); },
|
|
40256
|
+
close: function () { return setOpen(false); }
|
|
40257
|
+
};
|
|
40258
|
+
var menuItemProps = __assign$3({ onClick: function () { return menuControls.open(); } }, props);
|
|
40259
|
+
return (React__default["default"].createElement(LuiCloseableHeaderMenuContext.Provider, { value: menuControls },
|
|
40260
|
+
React__default["default"].createElement(LuiHeaderMenuItemV2, __assign$3({ ref: menuDiv }, menuItemProps), !!children && children)));
|
|
40261
|
+
};
|
|
40262
|
+
|
|
40263
|
+
/**
|
|
40264
|
+
* @deprecated replaced by LuiDrawerMenuOptionsV2
|
|
40265
|
+
*/
|
|
40194
40266
|
var LuiDrawerMenuOptions = function (_a) {
|
|
40195
40267
|
var children = _a.children;
|
|
40268
|
+
useDeprecatedWarning('LuiDrawerMenuOptions');
|
|
40196
40269
|
return React__default["default"].createElement("div", { className: "lui-menu-drawer-options" }, children);
|
|
40197
40270
|
};
|
|
40271
|
+
/**
|
|
40272
|
+
* @deprecated replaced by LuiDrawerMenuOptionV2
|
|
40273
|
+
*/
|
|
40198
40274
|
var LuiDrawerMenuOption = function (_a) {
|
|
40199
40275
|
var icon = _a.icon, label = _a.label, badge = _a.badge, _b = _a.onClick, onClick = _b === void 0 ? function () { } : _b;
|
|
40276
|
+
useDeprecatedWarning('LuiDrawerMenuOption');
|
|
40200
40277
|
var menu = React$1.useContext(LuiCloseableHeaderMenuContext);
|
|
40201
40278
|
return (React__default["default"].createElement("div", { className: "lui-menu-drawer-option", onClick: function () {
|
|
40202
40279
|
menu.close();
|
|
@@ -40207,8 +40284,12 @@ var LuiDrawerMenuOption = function (_a) {
|
|
|
40207
40284
|
label),
|
|
40208
40285
|
badge));
|
|
40209
40286
|
};
|
|
40287
|
+
/**
|
|
40288
|
+
* @deprecated replaced by LuiDrawerMenuV2
|
|
40289
|
+
*/
|
|
40210
40290
|
var LuiDrawerMenu = function (_a) {
|
|
40211
40291
|
var restOfProps = __rest$1(_a, []);
|
|
40292
|
+
useDeprecatedWarning('LuiDrawerMenu');
|
|
40212
40293
|
var children = restOfProps.children, _b = restOfProps.hasStickyHeader, hasStickyHeader = _b === void 0 ? true : _b, menuPropsCopy = __rest$1(restOfProps, ["children", "hasStickyHeader"]);
|
|
40213
40294
|
var _c = React$1.useState(false), open = _c[0], setOpen = _c[1];
|
|
40214
40295
|
var closeableMenuProps = __assign$3(__assign$3({}, menuPropsCopy), { open: open, setOpen: setOpen, icon: open ? 'close' : 'menu', onClick: function () { return setOpen(!open); } });
|
|
@@ -40231,8 +40312,12 @@ var LuiDrawerMenu = function (_a) {
|
|
|
40231
40312
|
'lui-menu-drawer-closed': !open
|
|
40232
40313
|
}), "data-testid": 'drawer', "aria-hidden": !open }, children)));
|
|
40233
40314
|
};
|
|
40315
|
+
/**
|
|
40316
|
+
* @deprecated replaced by LuiDropdownMenuV2
|
|
40317
|
+
*/
|
|
40234
40318
|
var LuiDropdownMenu = function (_a) {
|
|
40235
40319
|
var restOfProps = __rest$1(_a, []);
|
|
40320
|
+
useDeprecatedWarning('LuiDropdownMenu');
|
|
40236
40321
|
var children = restOfProps.children, menuPropsCopy = __rest$1(restOfProps, ["children"]);
|
|
40237
40322
|
var _b = React$1.useState(false), open = _b[0], setOpen = _b[1];
|
|
40238
40323
|
var closeableMenuProps = __assign$3(__assign$3({}, menuPropsCopy), { open: open, setOpen: setOpen });
|
|
@@ -40258,6 +40343,82 @@ var LuiDrawerMenuDivider = function () {
|
|
|
40258
40343
|
return React__default["default"].createElement("hr", { className: "LuiDrawerMenuDivider" });
|
|
40259
40344
|
};
|
|
40260
40345
|
|
|
40346
|
+
var LuiDrawerMenuOptionsV2 = function (_a) {
|
|
40347
|
+
var children = _a.children;
|
|
40348
|
+
return (React__default["default"].createElement("div", { className: "LuiHeaderMenuV2-drawer-options" }, children));
|
|
40349
|
+
};
|
|
40350
|
+
var LuiDrawerMenuOptionV2 = function (_a) {
|
|
40351
|
+
var icon = _a.icon, iconColor = _a.iconColor, label = _a.label, badge = _a.badge, _b = _a.iconSize, iconSize = _b === void 0 ? 'md' : _b, _c = _a.onClick, onClick = _c === void 0 ? function () { } : _c;
|
|
40352
|
+
var menu = React$1.useContext(LuiCloseableHeaderMenuContext);
|
|
40353
|
+
return (React__default["default"].createElement("div", { className: "LuiHeaderMenuV2-drawer-option", onClick: function () {
|
|
40354
|
+
menu.close();
|
|
40355
|
+
onClick();
|
|
40356
|
+
}, "data-testid": 'drawer-option' },
|
|
40357
|
+
React__default["default"].createElement("div", { className: "LuiHeaderMenuV2-drawer-option-label" },
|
|
40358
|
+
typeof icon === 'string' ? (React__default["default"].createElement(LuiIcon, { size: iconSize, name: icon, alt: '', color: iconColor, "data-testid": 'drawer-option-icon' })) : (icon),
|
|
40359
|
+
label),
|
|
40360
|
+
badge));
|
|
40361
|
+
};
|
|
40362
|
+
var LuiDrawerMenuV2 = function (_a) {
|
|
40363
|
+
var children = _a.children, _b = _a.hasStickyHeader, hasStickyHeader = _b === void 0 ? true : _b, menuPropsCopy = __rest$1(_a, ["children", "hasStickyHeader"]);
|
|
40364
|
+
var _c = React$1.useState(false), open = _c[0], setOpen = _c[1];
|
|
40365
|
+
var closeableMenuProps = __assign$3(__assign$3({}, menuPropsCopy), { open: open, setOpen: setOpen, icon: open ? 'ic_clear' : 'ic_menu', onClick: function () { return setOpen(!open); } });
|
|
40366
|
+
React$1.useEffect(function () {
|
|
40367
|
+
// Support for non-sticky headers. Scroll back to top when menu is opened
|
|
40368
|
+
if (open && !hasStickyHeader) {
|
|
40369
|
+
window.scrollTo({ top: 0, behavior: 'smooth' });
|
|
40370
|
+
}
|
|
40371
|
+
// Disable page scrolling while menu is open
|
|
40372
|
+
if (open) {
|
|
40373
|
+
document.body.classList.add('LuiHeaderMenuV2-drawer-open');
|
|
40374
|
+
}
|
|
40375
|
+
else {
|
|
40376
|
+
document.body.classList.remove('LuiHeaderMenuV2-drawer-open');
|
|
40377
|
+
}
|
|
40378
|
+
}, [open, hasStickyHeader]);
|
|
40379
|
+
return (React__default["default"].createElement(LuiCloseableHeaderMenuItemV2, __assign$3({}, closeableMenuProps),
|
|
40380
|
+
React__default["default"].createElement("div", { className: clsx$1({
|
|
40381
|
+
'LuiHeaderMenuV2-drawer': true,
|
|
40382
|
+
'LuiHeaderMenuV2-drawer-closed': !open
|
|
40383
|
+
}), "data-testid": 'drawer', "aria-hidden": !open }, children)));
|
|
40384
|
+
};
|
|
40385
|
+
var LuiDropdownMenuV2 = function (_a) {
|
|
40386
|
+
var restOfProps = __rest$1(_a, []);
|
|
40387
|
+
var children = restOfProps.children, _b = restOfProps.anchorOrigin, _c = _b === void 0 ? {
|
|
40388
|
+
horizontal: 'left'
|
|
40389
|
+
} : _b, _d = _c.horizontal, horizontal = _d === void 0 ? 'left' : _d, _e = restOfProps.size, size = _e === void 0 ? 'md' : _e, menuPropsCopy = __rest$1(restOfProps, ["children", "anchorOrigin", "size"]);
|
|
40390
|
+
var _f = React$1.useState(null), open = _f[0], setOpen = _f[1];
|
|
40391
|
+
var closeableMenuProps = __assign$3(__assign$3({}, menuPropsCopy), { open: open || false, setOpen: function (currentOpen) {
|
|
40392
|
+
setOpen(function (preOpen) {
|
|
40393
|
+
if (preOpen !== null) {
|
|
40394
|
+
return currentOpen;
|
|
40395
|
+
}
|
|
40396
|
+
// if the menu was not opened before, then ignore close event,
|
|
40397
|
+
// thus apply -closed animation css only if the menu is closed from the open state
|
|
40398
|
+
return currentOpen || null;
|
|
40399
|
+
});
|
|
40400
|
+
} });
|
|
40401
|
+
return (React__default["default"].createElement(LuiCloseableHeaderMenuItemV2, __assign$3({}, closeableMenuProps),
|
|
40402
|
+
React__default["default"].createElement("div", { className: "LuiHeaderMenuV2-dropdown-container" },
|
|
40403
|
+
React__default["default"].createElement("div", { className: clsx$1('LuiHeaderMenuV2-dropdown', 'lui-box-shadow', { 'anchor-horizontal-icon-left': horizontal === 'left' }, {
|
|
40404
|
+
'anchor-horizontal-icon-right': !menuPropsCopy.label && horizontal === 'right'
|
|
40405
|
+
}, {
|
|
40406
|
+
'anchor-horizontal-label-right': menuPropsCopy.label && horizontal === 'right'
|
|
40407
|
+
}, "dropdown-".concat(size), {
|
|
40408
|
+
'LuiHeaderMenuV2-dropdown-open': open
|
|
40409
|
+
}, {
|
|
40410
|
+
'LuiHeaderMenuV2-dropdown-closed': open !== null && !open
|
|
40411
|
+
}), "data-testid": 'dropdown', "aria-hidden": !open },
|
|
40412
|
+
children,
|
|
40413
|
+
' '))));
|
|
40414
|
+
};
|
|
40415
|
+
var LuiDrawerMenuSectionV2 = function (props) {
|
|
40416
|
+
return React__default["default"].createElement(LuiDrawerMenuSection, __assign$3({}, props));
|
|
40417
|
+
};
|
|
40418
|
+
var LuiDrawerMenuDividerV2 = function () {
|
|
40419
|
+
return React__default["default"].createElement(LuiDrawerMenuDivider, null);
|
|
40420
|
+
};
|
|
40421
|
+
|
|
40261
40422
|
var lib = {exports: {}};
|
|
40262
40423
|
|
|
40263
40424
|
var Modal$2 = {};
|
|
@@ -57990,6 +58151,34 @@ function LuiSideMenuItem(_a) {
|
|
|
57990
58151
|
React__default["default"].createElement("span", { className: "navText" }, label))));
|
|
57991
58152
|
}
|
|
57992
58153
|
|
|
58154
|
+
var breakpoints = {
|
|
58155
|
+
sm: 480,
|
|
58156
|
+
md: 768,
|
|
58157
|
+
lg: 1024,
|
|
58158
|
+
xl: 1280,
|
|
58159
|
+
xxl: 1600
|
|
58160
|
+
};
|
|
58161
|
+
var breakpointQuery = {
|
|
58162
|
+
up: function (bp) { return "(min-width: ".concat(breakpoints[bp], "px)"); },
|
|
58163
|
+
down: function (bp) { return "(max-width: ".concat(breakpoints[bp], "px)"); },
|
|
58164
|
+
between: function (bp1, bp2) {
|
|
58165
|
+
return "(min-width: ".concat(breakpoints[bp1], "px) and (max-width: ").concat(breakpoints[bp2], "px)");
|
|
58166
|
+
}
|
|
58167
|
+
};
|
|
58168
|
+
var useMediaQuery = function (query) {
|
|
58169
|
+
var _a = React$1.useState(false), matches = _a[0], setMatches = _a[1];
|
|
58170
|
+
React$1.useEffect(function () {
|
|
58171
|
+
var media = window.matchMedia(query);
|
|
58172
|
+
if (media.matches !== matches) {
|
|
58173
|
+
setMatches(media.matches);
|
|
58174
|
+
}
|
|
58175
|
+
var listener = function () { return setMatches(media.matches); };
|
|
58176
|
+
window.addEventListener('resize', listener);
|
|
58177
|
+
return function () { return window.removeEventListener('resize', listener); };
|
|
58178
|
+
}, [matches, query]);
|
|
58179
|
+
return matches;
|
|
58180
|
+
};
|
|
58181
|
+
|
|
57993
58182
|
exports.CheckboxItemRenderer = CheckboxItemRenderer;
|
|
57994
58183
|
exports.FIRM_KEY = FIRM_KEY;
|
|
57995
58184
|
exports.FIRM_NAME_KEY = FIRM_NAME_KEY;
|
|
@@ -58022,14 +58211,21 @@ exports.LuiButtonGroup = LuiButtonGroup;
|
|
|
58022
58211
|
exports.LuiCheckboxInput = LuiCheckboxInput;
|
|
58023
58212
|
exports.LuiCloseableHeaderMenuContext = LuiCloseableHeaderMenuContext;
|
|
58024
58213
|
exports.LuiCloseableHeaderMenuItem = LuiCloseableHeaderMenuItem;
|
|
58214
|
+
exports.LuiCloseableHeaderMenuItemV2 = LuiCloseableHeaderMenuItemV2;
|
|
58025
58215
|
exports.LuiComboSelect = LuiComboSelect;
|
|
58026
58216
|
exports.LuiControlledMenu = LuiControlledMenu;
|
|
58027
58217
|
exports.LuiDrawerMenu = LuiDrawerMenu;
|
|
58028
58218
|
exports.LuiDrawerMenuDivider = LuiDrawerMenuDivider;
|
|
58219
|
+
exports.LuiDrawerMenuDividerV2 = LuiDrawerMenuDividerV2;
|
|
58029
58220
|
exports.LuiDrawerMenuOption = LuiDrawerMenuOption;
|
|
58221
|
+
exports.LuiDrawerMenuOptionV2 = LuiDrawerMenuOptionV2;
|
|
58030
58222
|
exports.LuiDrawerMenuOptions = LuiDrawerMenuOptions;
|
|
58223
|
+
exports.LuiDrawerMenuOptionsV2 = LuiDrawerMenuOptionsV2;
|
|
58031
58224
|
exports.LuiDrawerMenuSection = LuiDrawerMenuSection;
|
|
58225
|
+
exports.LuiDrawerMenuSectionV2 = LuiDrawerMenuSectionV2;
|
|
58226
|
+
exports.LuiDrawerMenuV2 = LuiDrawerMenuV2;
|
|
58032
58227
|
exports.LuiDropdownMenu = LuiDropdownMenu;
|
|
58228
|
+
exports.LuiDropdownMenuV2 = LuiDropdownMenuV2;
|
|
58033
58229
|
exports.LuiErrorPage = LuiErrorPage;
|
|
58034
58230
|
exports.LuiExpandableBanner = LuiExpandableBanner;
|
|
58035
58231
|
exports.LuiFileInputBox = LuiFileInputBox;
|
|
@@ -58049,6 +58245,8 @@ exports.LuiFormikSelect = LuiFormikSelect;
|
|
|
58049
58245
|
exports.LuiFormikTextInput = LuiFormikTextInput;
|
|
58050
58246
|
exports.LuiHeader = LuiHeader;
|
|
58051
58247
|
exports.LuiHeaderMenuItem = LuiHeaderMenuItem;
|
|
58248
|
+
exports.LuiHeaderMenuItemV2 = LuiHeaderMenuItemV2;
|
|
58249
|
+
exports.LuiHeaderV2 = LuiHeaderV2;
|
|
58052
58250
|
exports.LuiIcon = LuiIcon;
|
|
58053
58251
|
exports.LuiListBox = LuiListBox;
|
|
58054
58252
|
exports.LuiLoadingSpinner = LuiLoadingSpinner;
|
|
@@ -58088,11 +58286,14 @@ exports.LuiToastMessage = LuiToastMessage;
|
|
|
58088
58286
|
exports.LuiTooltip = LuiTooltip;
|
|
58089
58287
|
exports.LuiUpdatesSplashModal = LuiUpdatesSplashModal;
|
|
58090
58288
|
exports.RadioItemRenderer = RadioItemRenderer;
|
|
58289
|
+
exports.breakpointQuery = breakpointQuery;
|
|
58290
|
+
exports.breakpoints = breakpoints;
|
|
58091
58291
|
exports.getDefaultSearchMenuOptions = getDefaultSearchMenuOptions;
|
|
58092
58292
|
exports.isChromatic = isChromatic;
|
|
58093
58293
|
exports.useClickedOutsideElement = useClickedOutsideElement;
|
|
58094
58294
|
exports.useLOLGlobalClientRefContext = useLOLGlobalClientRefContext;
|
|
58095
58295
|
exports.useLOLUserContext = useLOLUserContext;
|
|
58096
58296
|
exports.useLuiFloatingWindow = useFloatingWindow;
|
|
58297
|
+
exports.useMediaQuery = useMediaQuery;
|
|
58097
58298
|
exports.useShowLUIMessage = useShowLUIMessage;
|
|
58098
58299
|
//# sourceMappingURL=index.js.map
|