@lunit/oui 2.4.11 → 2.4.12
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/components/Navigation/Navigation.d.ts +3 -0
- package/dist/components/Navigation/Navigation.js +6 -0
- package/dist/components/Navigation/Navigation.types.d.ts +2 -0
- package/dist/components/Navigation/Navigation.types.js +1 -0
- package/dist/components/Navigation/NavigationGroup.d.ts +3 -0
- package/dist/components/Navigation/NavigationGroup.js +22 -0
- package/dist/components/Navigation/NavigationGroup.styled.d.ts +6 -0
- package/dist/components/Navigation/NavigationGroup.styled.js +25 -0
- package/dist/components/Navigation/NavigationGroup.types.d.ts +18 -0
- package/dist/components/Navigation/NavigationGroup.types.js +1 -0
- package/dist/components/Navigation/NavigationItem.d.ts +3 -0
- package/dist/components/Navigation/NavigationItem.js +8 -0
- package/dist/components/Navigation/NavigationItem.styled.d.ts +3 -0
- package/dist/components/Navigation/NavigationItem.styled.js +24 -0
- package/dist/components/Navigation/NavigationItem.types.d.ts +14 -0
- package/dist/components/Navigation/NavigationItem.types.js +1 -0
- package/dist/components/Navigation/NavigationItemCaption.d.ts +3 -0
- package/dist/components/Navigation/NavigationItemCaption.js +6 -0
- package/dist/components/Navigation/NavigationItemCaption.types.d.ts +3 -0
- package/dist/components/Navigation/NavigationItemCaption.types.js +1 -0
- package/dist/components/Navigation/index.d.ts +8 -0
- package/dist/components/Navigation/index.js +4 -0
- package/package.json +3 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Collapse } from '@mui/material';
|
|
3
|
+
import { ArrowDown } from '../../icons';
|
|
4
|
+
import { NavLink } from 'react-router-dom';
|
|
5
|
+
import { StyledNavigationGroup, StyledNavigationGroupButton, StyledNavigationGroupArrowButton, StyledNavigationGroupText, StyledNavigationGroupSlot, EmptyIcon, } from './NavigationGroup.styled';
|
|
6
|
+
const buttonSize = 'small';
|
|
7
|
+
const NavigationGroup = (({ children,
|
|
8
|
+
// Root props
|
|
9
|
+
rootProps, className, classes, style, sx,
|
|
10
|
+
// Button props
|
|
11
|
+
label, icon = _jsx(EmptyIcon, {}), selected, open = false, onOpen, onClose, onClick, openOnClick = true, hideArrow = false, ...props }) => {
|
|
12
|
+
const onGroupClick = (event) => {
|
|
13
|
+
onClick?.(event);
|
|
14
|
+
if (openOnClick && !open) {
|
|
15
|
+
onOpen?.(event);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
return (_jsxs(_Fragment, { children: [_jsxs(StyledNavigationGroup, { ...rootProps, disablePadding: true, className: className, classes: classes, style: style, sx: sx, children: [_jsxs(StyledNavigationGroupButton, { ...props, disableRipple: true, component: props.component ?? NavLink, size: buttonSize, selected: selected, onClick: onGroupClick, children: [icon && _jsx(StyledNavigationGroupSlot, { children: icon }), _jsx(StyledNavigationGroupText, { primary: label })] }), !hideArrow && (_jsx(StyledNavigationGroupArrowButton, { disableRipple: true, size: buttonSize, selected: selected, tabIndex: -1, onClick: open ? onClose : onOpen, children: _jsx(StyledNavigationGroupSlot, { children: _jsx(ArrowDown, { style: {
|
|
19
|
+
transform: open ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
20
|
+
} }) }) }))] }), _jsx(Collapse, { in: open, timeout: "auto", unmountOnExit: true, children: children })] }));
|
|
21
|
+
});
|
|
22
|
+
export default NavigationGroup;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { EmptyIcon } from '../List/ListItem.styled';
|
|
2
|
+
export declare const StyledNavigationGroup: import("@emotion/styled").StyledComponent<any, {}, {}>;
|
|
3
|
+
export declare const StyledNavigationGroupButton: import("@emotion/styled").StyledComponent<import("../List/ListItem.types").StyledListItemButtonProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
4
|
+
export declare const StyledNavigationGroupArrowButton: import("@emotion/styled").StyledComponent<import("../List/ListItem.types").StyledListItemButtonProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
5
|
+
export declare const StyledNavigationGroupText: import("@emotion/styled").StyledComponent<any, {}, {}>;
|
|
6
|
+
export declare const StyledNavigationGroupSlot: import("react").ComponentType<any>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { styled } from '@mui/material';
|
|
2
|
+
import { StyledListItem, StyledListItemButton, StyledListItemStartSlot, StyledListItemText, } from '../List/ListItem.styled';
|
|
3
|
+
export { EmptyIcon } from '../List/ListItem.styled';
|
|
4
|
+
export const StyledNavigationGroup = styled(StyledListItem)({
|
|
5
|
+
width: '100%',
|
|
6
|
+
});
|
|
7
|
+
export const StyledNavigationGroupButton = styled(StyledListItemButton)(({ theme }) => ({
|
|
8
|
+
paddingTop: '8px',
|
|
9
|
+
paddingBottom: '8px',
|
|
10
|
+
'&.Mui-selected': {
|
|
11
|
+
color: theme.palette.lunitTeal[40],
|
|
12
|
+
},
|
|
13
|
+
}));
|
|
14
|
+
export const StyledNavigationGroupArrowButton = styled(StyledNavigationGroupButton)({
|
|
15
|
+
flex: '0 0 auto',
|
|
16
|
+
width: '36px',
|
|
17
|
+
});
|
|
18
|
+
export const StyledNavigationGroupText = styled(StyledListItemText)({
|
|
19
|
+
wordBreak: 'break-all',
|
|
20
|
+
display: '-webkit-box',
|
|
21
|
+
WebkitBoxOrient: 'vertical',
|
|
22
|
+
WebkitLineClamp: 1,
|
|
23
|
+
overflow: 'hidden',
|
|
24
|
+
});
|
|
25
|
+
export const StyledNavigationGroupSlot = StyledListItemStartSlot;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Link } from 'react-router-dom';
|
|
2
|
+
import type { OverridableComponent, OverrideProps } from '@mui/material/OverridableComponent';
|
|
3
|
+
import type { NavigationItemBaseProps } from './NavigationItem.types';
|
|
4
|
+
export interface NavigationGroupBaseProps extends Omit<NavigationItemBaseProps, 'caption'> {
|
|
5
|
+
icon?: React.ReactNode;
|
|
6
|
+
open?: boolean;
|
|
7
|
+
onOpen?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
8
|
+
onClose?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
9
|
+
openOnClick?: boolean;
|
|
10
|
+
hideArrow?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface NavigationGroupTypeMap<P = object, D extends React.ElementType = typeof Link> {
|
|
13
|
+
props: P & NavigationGroupBaseProps;
|
|
14
|
+
defaultComponent: D;
|
|
15
|
+
}
|
|
16
|
+
/** @see ListItemButton {@link ListItem.types.ts} */
|
|
17
|
+
export type NavigationGroupComponent = OverridableComponent<NavigationGroupTypeMap>;
|
|
18
|
+
export type NavigationGroupProps<D extends React.ElementType = NavigationGroupTypeMap['defaultComponent'], P = object> = OverrideProps<NavigationGroupTypeMap<P, D>, D>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { NavLink } from 'react-router-dom';
|
|
3
|
+
import NavigationItemCaption from './NavigationItemCaption';
|
|
4
|
+
import { EmptyIcon, StyledNavigationItem } from './NavigationItem.styled';
|
|
5
|
+
const NavigationItem = (({ icon = _jsx(EmptyIcon, {}), caption, ...props }) => {
|
|
6
|
+
return (_jsx(StyledNavigationItem, { ...props, component: props.component ?? NavLink, startElement: icon, endElement: _jsx(NavigationItemCaption, { children: caption }) }));
|
|
7
|
+
});
|
|
8
|
+
export default NavigationItem;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { styled, listItemButtonClasses, listItemTextClasses } from '@mui/material';
|
|
2
|
+
import { ListItem } from '../List';
|
|
3
|
+
import { ListItemCaptionClassName } from '../List/ListItemCaption';
|
|
4
|
+
export { EmptyIcon } from '../List/ListItem.styled';
|
|
5
|
+
export const StyledNavigationItem = styled(ListItem)(({ theme }) => ({
|
|
6
|
+
width: '100%',
|
|
7
|
+
[`& > .${listItemButtonClasses.root}`]: {
|
|
8
|
+
paddingTop: '8px',
|
|
9
|
+
paddingBottom: '8px',
|
|
10
|
+
},
|
|
11
|
+
[`& > .${listItemButtonClasses.root} .${listItemTextClasses.root}`]: {
|
|
12
|
+
wordBreak: 'break-all',
|
|
13
|
+
display: '-webkit-box',
|
|
14
|
+
WebkitBoxOrient: 'vertical',
|
|
15
|
+
WebkitLineClamp: 1,
|
|
16
|
+
overflow: 'hidden',
|
|
17
|
+
},
|
|
18
|
+
[`& > .${listItemButtonClasses.root}.Mui-selected`]: {
|
|
19
|
+
color: theme.palette.lunitTeal[40],
|
|
20
|
+
[`.${ListItemCaptionClassName}`]: {
|
|
21
|
+
color: theme.palette.lunitTeal[10],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
}));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NavLink } from 'react-router-dom';
|
|
2
|
+
import type { OverridableComponent, OverrideProps } from '@mui/material/OverridableComponent';
|
|
3
|
+
import type { ListItemProps } from '../List';
|
|
4
|
+
export interface NavigationItemBaseProps extends Omit<ListItemProps, 'startElement' | 'endElement'> {
|
|
5
|
+
icon?: React.ReactNode;
|
|
6
|
+
caption?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export interface NavigationItemTypeMap<P = object, D extends React.ElementType = typeof NavLink> {
|
|
9
|
+
props: P & NavigationItemBaseProps;
|
|
10
|
+
defaultComponent: D;
|
|
11
|
+
}
|
|
12
|
+
/** @see ListItemButton {@link ListItem.types.ts} */
|
|
13
|
+
export type NavigationItemComponent = OverridableComponent<NavigationItemTypeMap>;
|
|
14
|
+
export type NavigationItemProps<D extends React.ElementType = NavigationItemTypeMap['defaultComponent'], P = object> = OverrideProps<NavigationItemTypeMap<P, D>, D>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as Navigation } from './Navigation';
|
|
2
|
+
export type { NavigationProps } from './Navigation.types';
|
|
3
|
+
export { default as NavigationGroup } from './NavigationGroup';
|
|
4
|
+
export type { NavigationGroupProps } from './NavigationGroup.types';
|
|
5
|
+
export { default as NavigationItem } from './NavigationItem';
|
|
6
|
+
export type { NavigationItemProps } from './NavigationItem.types';
|
|
7
|
+
export { default as NavigationItemCaption } from './NavigationItemCaption';
|
|
8
|
+
export type { NavigationItemCaptionProps } from './NavigationItemCaption.types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunit/oui",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.12",
|
|
4
4
|
"validate-branch-name": {
|
|
5
5
|
"pattern": "^(main|develop)|(feature|fix|release|hotfix|qe)/.+$",
|
|
6
6
|
"errorMsg": "The branch name is not correct. Please check the pattern. (ex. feature/add-something)"
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"clsx": "^2.0.0",
|
|
26
26
|
"date-fns": "2.30.0",
|
|
27
27
|
"lodash": "^4.17.21",
|
|
28
|
+
"react-router-dom": "^7.9.6",
|
|
28
29
|
"tinycolor2": "^1.6.0",
|
|
29
30
|
"uuid": "^11.1.0",
|
|
30
31
|
"victory": "^37.3.6",
|
|
@@ -142,7 +143,6 @@
|
|
|
142
143
|
"@storybook/test": "^7.6.17",
|
|
143
144
|
"@storybook/theming": "^7.6.17",
|
|
144
145
|
"@svgr/webpack": "^8.1.0",
|
|
145
|
-
"storybook": "^7.6.17",
|
|
146
146
|
"@testing-library/jest-dom": "^5.17.0",
|
|
147
147
|
"@testing-library/react": "^13.4.0",
|
|
148
148
|
"@testing-library/user-event": "^13.5.0",
|
|
@@ -199,6 +199,7 @@
|
|
|
199
199
|
"sass-loader": "^12.3.0",
|
|
200
200
|
"semver": "^7.3.5",
|
|
201
201
|
"source-map-loader": "^3.0.0",
|
|
202
|
+
"storybook": "^7.6.17",
|
|
202
203
|
"style-loader": "^3.3.1",
|
|
203
204
|
"styled-components": "^6.1.1",
|
|
204
205
|
"tailwindcss": "^3.0.2",
|