@lunit/oui 2.4.11 → 2.4.13

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.
Files changed (25) hide show
  1. package/dist/components/Navigation/Navigation.d.ts +3 -0
  2. package/dist/components/Navigation/Navigation.js +6 -0
  3. package/dist/components/Navigation/Navigation.types.d.ts +2 -0
  4. package/dist/components/Navigation/Navigation.types.js +1 -0
  5. package/dist/components/Navigation/NavigationGroup.d.ts +3 -0
  6. package/dist/components/Navigation/NavigationGroup.js +22 -0
  7. package/dist/components/Navigation/NavigationGroup.styled.d.ts +6 -0
  8. package/dist/components/Navigation/NavigationGroup.styled.js +25 -0
  9. package/dist/components/Navigation/NavigationGroup.types.d.ts +18 -0
  10. package/dist/components/Navigation/NavigationGroup.types.js +1 -0
  11. package/dist/components/Navigation/NavigationItem.d.ts +3 -0
  12. package/dist/components/Navigation/NavigationItem.js +8 -0
  13. package/dist/components/Navigation/NavigationItem.styled.d.ts +3 -0
  14. package/dist/components/Navigation/NavigationItem.styled.js +24 -0
  15. package/dist/components/Navigation/NavigationItem.types.d.ts +14 -0
  16. package/dist/components/Navigation/NavigationItem.types.js +1 -0
  17. package/dist/components/Navigation/NavigationItemCaption.d.ts +3 -0
  18. package/dist/components/Navigation/NavigationItemCaption.js +6 -0
  19. package/dist/components/Navigation/NavigationItemCaption.types.d.ts +3 -0
  20. package/dist/components/Navigation/NavigationItemCaption.types.js +1 -0
  21. package/dist/components/Navigation/index.d.ts +8 -0
  22. package/dist/components/Navigation/index.js +4 -0
  23. package/dist/components/index.d.ts +2 -0
  24. package/dist/components/index.js +2 -0
  25. package/package.json +3 -2
@@ -0,0 +1,3 @@
1
+ import type { NavigationProps } from './Navigation.types';
2
+ declare const Navigation: (props: NavigationProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default Navigation;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { List } from '../List';
3
+ const Navigation = (props) => {
4
+ return _jsx(List, { ...props });
5
+ };
6
+ export default Navigation;
@@ -0,0 +1,2 @@
1
+ import type { ListProps } from '../List';
2
+ export type NavigationProps = Omit<ListProps, 'size' | 'subheader' | 'open' | 'onOpen' | 'onClose' | 'showCheck'>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { NavigationGroupComponent } from './NavigationGroup.types';
2
+ declare const NavigationGroup: NavigationGroupComponent;
3
+ export default NavigationGroup;
@@ -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,3 @@
1
+ import type { NavigationItemComponent } from './NavigationItem.types';
2
+ declare const NavigationItem: NavigationItemComponent;
3
+ export default NavigationItem;
@@ -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,3 @@
1
+ import { ListItem } from '../List';
2
+ export { EmptyIcon } from '../List/ListItem.styled';
3
+ export declare const StyledNavigationItem: typeof ListItem;
@@ -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,3 @@
1
+ import type { NavigationItemCaptionProps } from './NavigationItemCaption.types';
2
+ declare const NavigationItemCaption: (props: NavigationItemCaptionProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default NavigationItemCaption;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { ListItemCaption } from '../List';
3
+ const NavigationItemCaption = (props) => {
4
+ return _jsx(ListItemCaption, { ...props });
5
+ };
6
+ export default NavigationItemCaption;
@@ -0,0 +1,3 @@
1
+ import type { ListItemCaptionProps } from '../List';
2
+ export interface NavigationItemCaptionProps extends ListItemCaptionProps {
3
+ }
@@ -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';
@@ -0,0 +1,4 @@
1
+ export { default as Navigation } from './Navigation';
2
+ export { default as NavigationGroup } from './NavigationGroup';
3
+ export { default as NavigationItem } from './NavigationItem';
4
+ export { default as NavigationItemCaption } from './NavigationItemCaption';
@@ -24,3 +24,5 @@ export * from './Toggle';
24
24
  export * from './Tooltip';
25
25
  export * from './UploadManager';
26
26
  export * from './NoMatchContainer';
27
+ export * from './Navigation';
28
+ export * from './ResizeObserver';
@@ -24,3 +24,5 @@ export * from './Toggle';
24
24
  export * from './Tooltip';
25
25
  export * from './UploadManager';
26
26
  export * from './NoMatchContainer';
27
+ export * from './Navigation';
28
+ export * from './ResizeObserver';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunit/oui",
3
- "version": "2.4.11",
3
+ "version": "2.4.13",
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",