@lunit/oui 1.0.0-alpha.9 → 1.0.1-alpha.1

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 (130) hide show
  1. package/dist/components/Alert/Alert.js +1 -1
  2. package/dist/components/Alert/Alert.utils.js +1 -1
  3. package/dist/components/Chip/Chip.js +1 -1
  4. package/dist/components/Chip/Chip.utils.js +1 -1
  5. package/dist/components/DatePicker/DatePicker.js +1 -1
  6. package/dist/components/Dialog/Dialog.js +1 -1
  7. package/dist/components/Dropdown/Dropdown.js +1 -1
  8. package/dist/components/Dropdown/DropdownItem.js +1 -1
  9. package/dist/components/Dropdown/IconDropdown.js +1 -1
  10. package/dist/components/List/List.js +1 -1
  11. package/dist/components/List/ListItem.styled.js +1 -1
  12. package/dist/components/Pagination/Pagination.js +65 -0
  13. package/dist/components/Pagination/Pagination.styled.js +64 -0
  14. package/dist/components/Pagination/Pagination.types.js +2 -0
  15. package/dist/components/Pagination/index.js +2 -0
  16. package/dist/components/ProductLabel/ProductLabel.js +1 -1
  17. package/dist/components/TextField/components/Buttons.js +1 -1
  18. package/dist/components/UploadManager/UploadManager.js +1 -1
  19. package/dist/components/index.js +1 -1
  20. package/dist/foundations/index.js +1 -0
  21. package/dist/foundations/palette.js +4 -0
  22. package/dist/foundations/styles.js +7 -0
  23. package/dist/icons/BellNoti/index.js +14 -0
  24. package/dist/icons/CloseLarge/index.js +14 -0
  25. package/dist/icons/CloseSmall/index.js +14 -0
  26. package/dist/{components/Icons → icons}/DownloadPdf/index.js +4 -4
  27. package/dist/icons/Ellipse/index.js +14 -0
  28. package/dist/icons/FilterNoti/index.js +14 -0
  29. package/dist/icons/HideLarge/index.js +14 -0
  30. package/dist/icons/HideSmall/index.js +14 -0
  31. package/dist/{components/Icons → icons}/InformationLarge/index.js +4 -4
  32. package/dist/{components/Icons → icons}/InformationSmall/index.js +4 -4
  33. package/dist/{components/Icons → icons}/Manufacturer/index.js +4 -4
  34. package/dist/icons/Rectangle/index.js +14 -0
  35. package/dist/{components/Icons → icons}/RefreshLeft/index.js +4 -4
  36. package/dist/{components/Icons → icons}/RefreshRight/index.js +4 -4
  37. package/dist/icons/ShowLarge/index.js +14 -0
  38. package/dist/icons/ShowSmall/index.js +14 -0
  39. package/dist/types/components/Pagination/Pagination.d.ts +3 -0
  40. package/dist/types/components/Pagination/Pagination.styled.d.ts +24 -0
  41. package/dist/types/components/Pagination/Pagination.types.d.ts +35 -0
  42. package/dist/types/components/Pagination/index.d.ts +2 -0
  43. package/dist/types/components/index.d.ts +1 -1
  44. package/dist/types/foundations/index.d.ts +1 -0
  45. package/dist/types/foundations/palette.d.ts +8 -1
  46. package/dist/types/foundations/styles.d.ts +2 -0
  47. package/dist/types/{components/Icons → icons}/BellNoti/index.d.ts +2 -2
  48. package/dist/types/{components/Icons → icons}/CloseLarge/index.d.ts +2 -2
  49. package/dist/types/{components/Icons → icons}/CloseSmall/index.d.ts +2 -2
  50. package/dist/types/{components/Icons → icons}/DownloadPdf/index.d.ts +2 -2
  51. package/dist/types/{components/Icons → icons}/Ellipse/index.d.ts +2 -2
  52. package/dist/types/{components/Icons → icons}/FilterNoti/index.d.ts +2 -2
  53. package/dist/types/{components/Icons → icons}/HideLarge/index.d.ts +2 -2
  54. package/dist/types/{components/Icons → icons}/HideSmall/index.d.ts +2 -2
  55. package/dist/types/{components/Icons → icons}/InformationLarge/index.d.ts +2 -2
  56. package/dist/types/{components/Icons → icons}/InformationSmall/index.d.ts +2 -2
  57. package/dist/types/{components/Icons → icons}/Manufacturer/index.d.ts +2 -2
  58. package/dist/types/{components/Icons → icons}/Rectangle/index.d.ts +2 -2
  59. package/dist/types/{components/Icons → icons}/RefreshLeft/index.d.ts +2 -2
  60. package/dist/types/{components/Icons → icons}/RefreshRight/index.d.ts +2 -2
  61. package/dist/types/{components/Icons → icons}/ShowLarge/index.d.ts +2 -2
  62. package/dist/types/{components/Icons → icons}/ShowSmall/index.d.ts +2 -2
  63. package/package.json +1 -1
  64. package/src/components/Alert/Alert.tsx +1 -1
  65. package/src/components/Alert/Alert.utils.tsx +1 -1
  66. package/src/components/Chip/Chip.tsx +1 -1
  67. package/src/components/Chip/Chip.utils.tsx +1 -1
  68. package/src/components/DatePicker/DatePicker.tsx +1 -1
  69. package/src/components/Dialog/Dialog.tsx +1 -1
  70. package/src/components/Dropdown/Dropdown.tsx +1 -1
  71. package/src/components/Dropdown/DropdownItem.tsx +1 -1
  72. package/src/components/Dropdown/IconDropdown.tsx +1 -1
  73. package/src/components/List/List.tsx +1 -1
  74. package/src/components/List/ListItem.styled.tsx +1 -1
  75. package/src/components/Pagination/Pagination.styled.tsx +71 -0
  76. package/src/components/Pagination/Pagination.tsx +182 -0
  77. package/src/components/Pagination/Pagination.types.ts +39 -0
  78. package/src/components/Pagination/index.ts +2 -0
  79. package/src/components/ProductLabel/ProductLabel.tsx +1 -1
  80. package/src/components/TextField/components/Buttons.tsx +1 -1
  81. package/src/components/UploadManager/UploadManager.tsx +1 -1
  82. package/src/components/index.ts +1 -1
  83. package/src/foundations/index.ts +1 -0
  84. package/src/foundations/palette.ts +12 -1
  85. package/src/foundations/styles.ts +9 -0
  86. package/src/icons/BellNoti/index.tsx +28 -0
  87. package/src/icons/CloseLarge/index.tsx +28 -0
  88. package/src/icons/CloseSmall/index.tsx +28 -0
  89. package/src/icons/DownloadPdf/index.tsx +28 -0
  90. package/src/icons/Ellipse/index.tsx +28 -0
  91. package/src/icons/FilterNoti/index.tsx +28 -0
  92. package/src/icons/HideLarge/index.tsx +28 -0
  93. package/src/icons/HideSmall/index.tsx +28 -0
  94. package/src/icons/InformationLarge/index.tsx +28 -0
  95. package/src/icons/InformationSmall/index.tsx +28 -0
  96. package/src/icons/Manufacturer/index.tsx +28 -0
  97. package/src/icons/Rectangle/index.tsx +28 -0
  98. package/src/icons/RefreshLeft/index.tsx +28 -0
  99. package/src/icons/RefreshRight/index.tsx +28 -0
  100. package/src/icons/ShowLarge/index.tsx +28 -0
  101. package/src/icons/ShowSmall/index.tsx +28 -0
  102. package/dist/components/Icons/BellNoti/index.js +0 -14
  103. package/dist/components/Icons/CloseLarge/index.js +0 -14
  104. package/dist/components/Icons/CloseSmall/index.js +0 -14
  105. package/dist/components/Icons/Ellipse/index.js +0 -14
  106. package/dist/components/Icons/FilterNoti/index.js +0 -14
  107. package/dist/components/Icons/HideLarge/index.js +0 -14
  108. package/dist/components/Icons/HideSmall/index.js +0 -14
  109. package/dist/components/Icons/Rectangle/index.js +0 -14
  110. package/dist/components/Icons/ShowLarge/index.js +0 -14
  111. package/dist/components/Icons/ShowSmall/index.js +0 -14
  112. package/src/components/Icons/BellNoti/index.tsx +0 -22
  113. package/src/components/Icons/CloseLarge/index.tsx +0 -22
  114. package/src/components/Icons/CloseSmall/index.tsx +0 -22
  115. package/src/components/Icons/DownloadPdf/index.tsx +0 -22
  116. package/src/components/Icons/Ellipse/index.tsx +0 -22
  117. package/src/components/Icons/FilterNoti/index.tsx +0 -22
  118. package/src/components/Icons/HideLarge/index.tsx +0 -22
  119. package/src/components/Icons/HideSmall/index.tsx +0 -22
  120. package/src/components/Icons/InformationLarge/index.tsx +0 -22
  121. package/src/components/Icons/InformationSmall/index.tsx +0 -22
  122. package/src/components/Icons/Manufacturer/index.tsx +0 -22
  123. package/src/components/Icons/Rectangle/index.tsx +0 -22
  124. package/src/components/Icons/RefreshLeft/index.tsx +0 -22
  125. package/src/components/Icons/RefreshRight/index.tsx +0 -22
  126. package/src/components/Icons/ShowLarge/index.tsx +0 -22
  127. package/src/components/Icons/ShowSmall/index.tsx +0 -22
  128. /package/dist/{components/Icons → icons}/index.js +0 -0
  129. /package/dist/types/{components/Icons → icons}/index.d.ts +0 -0
  130. /package/src/{components/Icons → icons}/index.ts +0 -0
@@ -0,0 +1,2 @@
1
+ export { default as Pagination } from './Pagination';
2
+ export type { PaginationProps } from './Pagination.types';
@@ -9,10 +9,10 @@ export * from './Dialog';
9
9
  export * from './Divider';
10
10
  export * from './Dropdown';
11
11
  export * from './FileDnDZone';
12
- export * from './Icons';
13
12
  export * from './List';
14
13
  export * from './LoadingIndicator';
15
14
  export * from './Menu';
15
+ export * from './Pagination';
16
16
  export * from './ProductLabel';
17
17
  export * from './Progress';
18
18
  export * from './Radio';
@@ -1,3 +1,4 @@
1
1
  export { default as palette } from './palette';
2
2
  export { default as typography } from './typography';
3
3
  export { default as spacing } from './spacing';
4
+ export { subScrollbarWidth } from './styles';
@@ -38,7 +38,14 @@ export type Alert = PaletteOptionItem<AlertKey>;
38
38
  type AnalysisStatusKey = 'Uploaded' | 'Ready' | 'ReadyHover' | 'ReadySelected' | 'Inferred' | 'InferredHover' | 'InferredSelected' | 'Analyzing' | 'Analyzed' | 'FailedEnabled' | 'FailedHover' | 'FailedSelected' | 'Ready' | 'ReadyHover' | 'ReadySelected' | 'Inferred' | 'InferredHover' | 'InferredSelected' | 'Invalid' | 'InvalidHover' | 'InvalidSelected';
39
39
  export type AnalysisStatus = PaletteOptionItem<AnalysisStatusKey>;
40
40
  export interface LunitPalette {
41
- brand: unknown;
41
+ brand: {
42
+ primary: React.CSSProperties['color'];
43
+ secondary: React.CSSProperties['color'];
44
+ };
45
+ scope1: React.CSSProperties['color'];
46
+ scope2: React.CSSProperties['color'];
47
+ scope3: React.CSSProperties['color'];
48
+ scope4: React.CSSProperties['color'];
42
49
  lunitTeal: LunitTeal;
43
50
  neutralGrey: NeutralColor;
44
51
  yellow: Yellow;
@@ -0,0 +1,2 @@
1
+ export declare function subScrollbarWidth(value: string): string;
2
+ export declare function subScrollbarWidth(value: number): number;
@@ -1,6 +1,6 @@
1
- import { SvgIconProps } from "@mui/material/SvgIcon";
1
+ import { SvgIconProps } from '@mui/material/SvgIcon';
2
2
  declare const variants: readonly ["outlined"];
3
- type Variant = typeof variants[number];
3
+ type Variant = (typeof variants)[number];
4
4
  type IconProps = SvgIconProps & {
5
5
  variant?: Variant;
6
6
  };
@@ -1,6 +1,6 @@
1
- import { SvgIconProps } from "@mui/material/SvgIcon";
1
+ import { SvgIconProps } from '@mui/material/SvgIcon';
2
2
  declare const variants: readonly ["outlined"];
3
- type Variant = typeof variants[number];
3
+ type Variant = (typeof variants)[number];
4
4
  type IconProps = SvgIconProps & {
5
5
  variant?: Variant;
6
6
  };
@@ -1,6 +1,6 @@
1
- import { SvgIconProps } from "@mui/material/SvgIcon";
1
+ import { SvgIconProps } from '@mui/material/SvgIcon';
2
2
  declare const variants: readonly ["outlined"];
3
- type Variant = typeof variants[number];
3
+ type Variant = (typeof variants)[number];
4
4
  type IconProps = SvgIconProps & {
5
5
  variant?: Variant;
6
6
  };
@@ -1,6 +1,6 @@
1
- import { SvgIconProps } from "@mui/material/SvgIcon";
1
+ import { SvgIconProps } from '@mui/material/SvgIcon';
2
2
  declare const variants: readonly ["outlined"];
3
- type Variant = typeof variants[number];
3
+ type Variant = (typeof variants)[number];
4
4
  type IconProps = SvgIconProps & {
5
5
  variant?: Variant;
6
6
  };
@@ -1,6 +1,6 @@
1
- import { SvgIconProps } from "@mui/material/SvgIcon";
1
+ import { SvgIconProps } from '@mui/material/SvgIcon';
2
2
  declare const variants: readonly ["outlined"];
3
- type Variant = typeof variants[number];
3
+ type Variant = (typeof variants)[number];
4
4
  type IconProps = SvgIconProps & {
5
5
  variant?: Variant;
6
6
  };
@@ -1,6 +1,6 @@
1
- import { SvgIconProps } from "@mui/material/SvgIcon";
1
+ import { SvgIconProps } from '@mui/material/SvgIcon';
2
2
  declare const variants: readonly ["outlined"];
3
- type Variant = typeof variants[number];
3
+ type Variant = (typeof variants)[number];
4
4
  type IconProps = SvgIconProps & {
5
5
  variant?: Variant;
6
6
  };
@@ -1,6 +1,6 @@
1
- import { SvgIconProps } from "@mui/material/SvgIcon";
1
+ import { SvgIconProps } from '@mui/material/SvgIcon';
2
2
  declare const variants: readonly ["outlined"];
3
- type Variant = typeof variants[number];
3
+ type Variant = (typeof variants)[number];
4
4
  type IconProps = SvgIconProps & {
5
5
  variant?: Variant;
6
6
  };
@@ -1,6 +1,6 @@
1
- import { SvgIconProps } from "@mui/material/SvgIcon";
1
+ import { SvgIconProps } from '@mui/material/SvgIcon';
2
2
  declare const variants: readonly ["outlined"];
3
- type Variant = typeof variants[number];
3
+ type Variant = (typeof variants)[number];
4
4
  type IconProps = SvgIconProps & {
5
5
  variant?: Variant;
6
6
  };
@@ -1,6 +1,6 @@
1
- import { SvgIconProps } from "@mui/material/SvgIcon";
1
+ import { SvgIconProps } from '@mui/material/SvgIcon';
2
2
  declare const variants: readonly ["outlined"];
3
- type Variant = typeof variants[number];
3
+ type Variant = (typeof variants)[number];
4
4
  type IconProps = SvgIconProps & {
5
5
  variant?: Variant;
6
6
  };
@@ -1,6 +1,6 @@
1
- import { SvgIconProps } from "@mui/material/SvgIcon";
1
+ import { SvgIconProps } from '@mui/material/SvgIcon';
2
2
  declare const variants: readonly ["outlined"];
3
- type Variant = typeof variants[number];
3
+ type Variant = (typeof variants)[number];
4
4
  type IconProps = SvgIconProps & {
5
5
  variant?: Variant;
6
6
  };
@@ -1,6 +1,6 @@
1
- import { SvgIconProps } from "@mui/material/SvgIcon";
1
+ import { SvgIconProps } from '@mui/material/SvgIcon';
2
2
  declare const variants: readonly ["outlined"];
3
- type Variant = typeof variants[number];
3
+ type Variant = (typeof variants)[number];
4
4
  type IconProps = SvgIconProps & {
5
5
  variant?: Variant;
6
6
  };
@@ -1,6 +1,6 @@
1
- import { SvgIconProps } from "@mui/material/SvgIcon";
1
+ import { SvgIconProps } from '@mui/material/SvgIcon';
2
2
  declare const variants: readonly ["outlined"];
3
- type Variant = typeof variants[number];
3
+ type Variant = (typeof variants)[number];
4
4
  type IconProps = SvgIconProps & {
5
5
  variant?: Variant;
6
6
  };
@@ -1,6 +1,6 @@
1
- import { SvgIconProps } from "@mui/material/SvgIcon";
1
+ import { SvgIconProps } from '@mui/material/SvgIcon';
2
2
  declare const variants: readonly ["outlined"];
3
- type Variant = typeof variants[number];
3
+ type Variant = (typeof variants)[number];
4
4
  type IconProps = SvgIconProps & {
5
5
  variant?: Variant;
6
6
  };
@@ -1,6 +1,6 @@
1
- import { SvgIconProps } from "@mui/material/SvgIcon";
1
+ import { SvgIconProps } from '@mui/material/SvgIcon';
2
2
  declare const variants: readonly ["outlined"];
3
- type Variant = typeof variants[number];
3
+ type Variant = (typeof variants)[number];
4
4
  type IconProps = SvgIconProps & {
5
5
  variant?: Variant;
6
6
  };
@@ -1,6 +1,6 @@
1
- import { SvgIconProps } from "@mui/material/SvgIcon";
1
+ import { SvgIconProps } from '@mui/material/SvgIcon';
2
2
  declare const variants: readonly ["outlined"];
3
- type Variant = typeof variants[number];
3
+ type Variant = (typeof variants)[number];
4
4
  type IconProps = SvgIconProps & {
5
5
  variant?: Variant;
6
6
  };
@@ -1,6 +1,6 @@
1
- import { SvgIconProps } from "@mui/material/SvgIcon";
1
+ import { SvgIconProps } from '@mui/material/SvgIcon';
2
2
  declare const variants: readonly ["outlined"];
3
- type Variant = typeof variants[number];
3
+ type Variant = (typeof variants)[number];
4
4
  type IconProps = SvgIconProps & {
5
5
  variant?: Variant;
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunit/oui",
3
- "version": "1.0.0-alpha.9",
3
+ "version": "1.0.1-alpha.1",
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)"
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { forwardRef } from 'react';
3
- import { Close } from '../Icons';
3
+ import { Close } from '../../icons';
4
4
  import BaseAlert from './Alert.styled';
5
5
  import type { AlertProps } from './Alert.types';
6
6
  import { getAccentColor, getIcons } from './Alert.utils';
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { AlertColor } from '@mui/material';
3
- import { Success, Error, Information } from '../Icons';
3
+ import { Success, Error, Information } from '../../icons';
4
4
  import theme from '../../theme';
5
5
 
6
6
  export const getIcons = (severity: AlertColor | undefined) => {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { CloseSmall } from '../Icons';
2
+ import { CloseSmall } from '../../icons';
3
3
  import StyledChip from './Chip.styled';
4
4
  import type { ChipProps } from './Chip.types';
5
5
  import { presetMap } from './Chip.utils';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Error16, StartT2 } from '../Icons';
2
+ import { Error16, StartT2 } from '../../icons';
3
3
 
4
4
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
5
  const presetMap: any = {
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { useState, useMemo, useEffect } from 'react';
3
- import { CloseSmall, ArrowLeft, ArrowRight } from '../Icons';
3
+ import { CloseSmall, ArrowLeft, ArrowRight } from '../../icons';
4
4
 
5
5
  import { StyledDatePicker } from './DatePicker.styled';
6
6
  import type { DatePickerProps } from './DatePicker.types';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { CloseSmall } from '../Icons';
2
+ import { CloseSmall } from '../../icons';
3
3
 
4
4
  import { Box } from '@mui/material';
5
5
  import theme from '../../theme';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ArrowDown } from '../Icons';
2
+ import { ArrowDown } from '../../icons';
3
3
 
4
4
  import type { SelectChangeEvent } from '@mui/material';
5
5
  import { useState } from 'react';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Check } from '../Icons';
2
+ import { Check } from '../../icons';
3
3
  import { BaseDropdownItem, KeyboardShortcut } from './DropdownItem.styled';
4
4
  import type { DropdownItemProps } from './DropdownItem.types';
5
5
  import { BUTTON_DROPDOWN_ITEM, shouldPadForEmptyIcon } from './DropdownItem.utils';
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { useState } from 'react';
3
- import { ArrowDownXs } from '../Icons';
3
+ import { ArrowDownXs } from '../../icons';
4
4
  import { BaseIconDropdown } from './IconDropdown.styled';
5
5
  import theme from '../../theme';
6
6
  import type { IconDropdownProps } from './IconDropdown.types';
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable no-nested-ternary */
2
2
  import React from 'react';
3
3
  import { createContext, useMemo } from 'react';
4
- import { ArrowDownSm, ArrowUpSm } from '../Icons';
4
+ import { ArrowDownSm, ArrowUpSm } from '../../icons';
5
5
  import { Collapse } from '@mui/material';
6
6
  import { MuiList, MuiListSubheader } from './List.styled';
7
7
  import type { ListProps, ListContextValue } from './List.types';
@@ -7,7 +7,7 @@ import {
7
7
  styled,
8
8
  typographyClasses,
9
9
  } from '@mui/material';
10
- import { Check, Dummy } from '../Icons';
10
+ import { Check, Dummy } from '../../icons';
11
11
  import getPadding from './List.utils';
12
12
  import type { StyledListItemButtonProps } from './ListItem.types';
13
13
 
@@ -0,0 +1,71 @@
1
+ import { Button, styled, Box } from '@mui/material';
2
+ import { subScrollbarWidth } from '../../foundations';
3
+
4
+ export const DEFAULT_PAGE_SIZE = 100;
5
+ export const PAGE_SIZE_LIST = [25, 50, 75, 100];
6
+
7
+ export const PaginationBox = styled(Box)(({ theme }) => ({
8
+ ...theme.typography.body5,
9
+ display: 'flex',
10
+ justifyContent: 'space-between',
11
+ alignItems: 'center',
12
+ borderTop: `1px solid ${theme.palette.neutralGrey[90]}`,
13
+ height: '48px',
14
+ padding: '14px 0',
15
+ color: theme.palette.neutralGrey[40],
16
+ }));
17
+
18
+ export const PaperProps = { style: { maxHeight: 378, width: 136 } };
19
+
20
+ export const SidePageBox = styled('div')({
21
+ display: 'flex',
22
+ alignItems: 'center',
23
+ height: '20px',
24
+ });
25
+
26
+ export const SelectButton = styled(Button)(({ theme }) => ({
27
+ justifyContent: 'flex-end',
28
+ border: '1px solid transparent',
29
+ minWidth: 'auto',
30
+ width: '58px',
31
+ height: '28px',
32
+ marginLeft: theme.spacing(3),
33
+ padding: '4px 4px 4px 8px',
34
+ color: theme.palette.neutralGrey[15],
35
+ '.MuiButton-endIcon': { margin: 0 },
36
+ '&:hover': {
37
+ background: 'transparent',
38
+ borderColor: theme.palette.neutralGrey[40],
39
+ },
40
+ '&:focus-visible': {
41
+ background: 'transparent',
42
+ borderColor: theme.palette.scope1,
43
+ },
44
+ }));
45
+
46
+ export const ArrowButton = styled(Button)(({ theme }) => ({
47
+ border: '1px solid transparent',
48
+ minWidth: 'auto',
49
+ height: '28px',
50
+ padding: theme.spacing(0.5),
51
+ color: theme.palette.neutralGrey[40],
52
+ '&:hover': {
53
+ background: theme.palette.neutralGrey[70],
54
+ },
55
+ '&:disabled': {
56
+ color: theme.palette.neutralGrey[40],
57
+ opacity: 0.4,
58
+ },
59
+ '.MuiButton-endIcon': {
60
+ margin: 0,
61
+ },
62
+ }));
63
+
64
+ export const PaginationContainer = styled('div')(({ theme }) => ({
65
+ padding: `0 ${subScrollbarWidth(theme.spacing(5))} 0 ${theme.spacing(5)}`,
66
+ }));
67
+
68
+ export const divider = {
69
+ borderWidth: '0',
70
+ margin: '0 12px',
71
+ } as const;
@@ -0,0 +1,182 @@
1
+ import React from 'react';
2
+ import { useState, MouseEvent, useEffect, useMemo } from 'react';
3
+ import { ArrowDown } from '../../icons';
4
+ import { Divider } from '../Divider';
5
+ import { MenuItem, Menu } from '../Menu';
6
+
7
+ import { PaginationProps } from './Pagination.types';
8
+ import {
9
+ PaperProps,
10
+ PaginationBox,
11
+ SidePageBox,
12
+ SelectButton,
13
+ ArrowButton,
14
+ PAGE_SIZE_LIST,
15
+ divider,
16
+ } from './Pagination.styled';
17
+
18
+ function Pagination({
19
+ count: itemCount,
20
+ page: selectedPage = 1,
21
+ perPage: selectedPerPage,
22
+ totalPage,
23
+ onPageChange,
24
+ onPerPageChange,
25
+ }: PaginationProps) {
26
+ const [perPageAnchorEl, setPerPageAnchorEl] = useState<null | HTMLElement>(null);
27
+ const [pageAnchorEl, setPageAnchorEl] = useState<null | HTMLElement>(null);
28
+
29
+ const perPageOpen = Boolean(perPageAnchorEl);
30
+ const pageOpen = Boolean(pageAnchorEl);
31
+
32
+ const pages = useMemo(
33
+ () => Array.from({ length: totalPage }, (_, index) => index + 1),
34
+ [totalPage],
35
+ );
36
+
37
+ const startItemNumber = selectedPerPage * (selectedPage - 1) + 1;
38
+ const endItemNumber = Math.min(startItemNumber + selectedPerPage - 1, itemCount);
39
+
40
+ const handlePerPageClick = (event: MouseEvent<HTMLButtonElement>) => {
41
+ setPerPageAnchorEl(event.currentTarget);
42
+ };
43
+
44
+ const handlePerPageClose = () => {
45
+ setPerPageAnchorEl(null);
46
+ };
47
+
48
+ const handlePageClick = (event: MouseEvent<HTMLButtonElement>) => {
49
+ setPageAnchorEl(event.currentTarget);
50
+ };
51
+
52
+ const handlePageClose = () => {
53
+ setPageAnchorEl(null);
54
+ };
55
+
56
+ useEffect(() => {
57
+ if (selectedPage > totalPage) {
58
+ onPageChange?.(null, totalPage);
59
+ }
60
+ }, [totalPage, selectedPage, onPageChange]);
61
+
62
+ return (
63
+ <PaginationBox>
64
+ <SidePageBox>
65
+ Items per page
66
+ <SelectButton
67
+ endIcon={
68
+ <ArrowDown
69
+ style={{
70
+ transform: perPageOpen ? 'rotate(180deg)' : 'rotate(0deg)',
71
+ }}
72
+ />
73
+ }
74
+ onClick={handlePerPageClick}
75
+ >
76
+ {selectedPerPage}
77
+ </SelectButton>
78
+ <Menu
79
+ showCheck
80
+ anchorEl={perPageAnchorEl}
81
+ anchorOrigin={{
82
+ vertical: 'top',
83
+ horizontal: 'right',
84
+ }}
85
+ transformOrigin={{
86
+ vertical: 'bottom',
87
+ horizontal: 'right',
88
+ }}
89
+ PaperProps={PaperProps}
90
+ onClose={handlePerPageClose}
91
+ open={perPageOpen}
92
+ >
93
+ {PAGE_SIZE_LIST.map((perPage) => (
94
+ <MenuItem
95
+ key={perPage}
96
+ selected={perPage === selectedPerPage}
97
+ onClick={(event) => {
98
+ event.preventDefault();
99
+ onPerPageChange?.(event, perPage);
100
+ handlePerPageClose();
101
+ }}
102
+ label={perPage}
103
+ />
104
+ ))}
105
+ </Menu>
106
+ <Divider
107
+ orientation="vertical"
108
+ sx={divider}
109
+ />
110
+ {startItemNumber}-{endItemNumber} of &nbsp;{itemCount} items
111
+ </SidePageBox>
112
+ <SidePageBox>
113
+ This page
114
+ <SelectButton
115
+ id="selected-page"
116
+ endIcon={
117
+ <ArrowDown
118
+ style={{
119
+ transform: pageOpen ? 'rotate(180deg)' : 'rotate(0deg)',
120
+ }}
121
+ />
122
+ }
123
+ onClick={handlePageClick}
124
+ >
125
+ {selectedPage}
126
+ </SelectButton>
127
+ <Menu
128
+ showCheck
129
+ anchorEl={pageAnchorEl}
130
+ anchorOrigin={{
131
+ vertical: 'top',
132
+ horizontal: 'right',
133
+ }}
134
+ transformOrigin={{
135
+ vertical: 'bottom',
136
+ horizontal: 'right',
137
+ }}
138
+ PaperProps={PaperProps}
139
+ onClose={handlePageClose}
140
+ open={pageOpen}
141
+ >
142
+ {pages.map((page) => (
143
+ <MenuItem
144
+ key={page}
145
+ selected={page === selectedPage}
146
+ onClick={(event) => {
147
+ event.preventDefault();
148
+ onPageChange?.(event, page);
149
+ handlePageClose();
150
+ }}
151
+ label={page}
152
+ />
153
+ ))}
154
+ </Menu>
155
+ <Divider
156
+ orientation="vertical"
157
+ sx={divider}
158
+ />
159
+ <ArrowButton
160
+ id="prev-button"
161
+ disabled={selectedPage === 1}
162
+ onClick={(event) => {
163
+ event.preventDefault();
164
+ onPageChange?.(event, selectedPage - 1);
165
+ }}
166
+ endIcon={<ArrowDown style={{ transform: 'rotate(90deg)' }} />}
167
+ />
168
+ <ArrowButton
169
+ id="next-button"
170
+ disabled={selectedPage === totalPage}
171
+ onClick={(event) => {
172
+ event.preventDefault();
173
+ onPageChange?.(event, selectedPage + 1);
174
+ }}
175
+ endIcon={<ArrowDown style={{ transform: 'rotate(-90deg)' }} />}
176
+ />
177
+ </SidePageBox>
178
+ </PaginationBox>
179
+ );
180
+ }
181
+
182
+ export default Pagination;
@@ -0,0 +1,39 @@
1
+ export interface PaginationProps {
2
+ count: number;
3
+ page?: number;
4
+ perPage: number;
5
+ totalPage: number;
6
+ onPageChange?: (
7
+ event: React.MouseEvent<HTMLLIElement> | React.MouseEvent<HTMLButtonElement> | null,
8
+ page: number,
9
+ ) => void;
10
+ onPerPageChange?: (event: React.MouseEvent<HTMLLIElement> | null, perPage: number) => void;
11
+ }
12
+
13
+ interface SortObject {
14
+ empty: boolean;
15
+ unsorted: boolean;
16
+ sorted: boolean;
17
+ }
18
+
19
+ interface Pageable {
20
+ offset: number;
21
+ sort: SortObject;
22
+ paged: boolean;
23
+ unpaged: boolean;
24
+ pageNumber: number;
25
+ pageSize: number;
26
+ }
27
+
28
+ export interface PaginationViewInfo {
29
+ totalElements: number;
30
+ totalPages: number;
31
+ size: number;
32
+ number: number;
33
+ sort: SortObject;
34
+ pageable: Pageable;
35
+ numberOfElements: number;
36
+ first: boolean;
37
+ last: boolean;
38
+ empty: boolean;
39
+ }
@@ -0,0 +1,2 @@
1
+ export { default as Pagination } from './Pagination';
2
+ export type { PaginationProps } from './Pagination.types';
@@ -5,7 +5,7 @@ import { Box, Typography } from '@mui/material';
5
5
  import { LabelContainer, LabelContent, LabelCloseButton } from './ProductLabel.styled';
6
6
  import { ProductLabelProps } from './ProductLabel.types';
7
7
  import { Divider } from '../Divider';
8
- import { Close } from '../Icons';
8
+ import { Close } from '../../icons';
9
9
  import { LunitScope } from '@lunit/design-system-logo';
10
10
 
11
11
  function ProductLabel({ open, onClose, children, footerStart, footerEnd }: ProductLabelProps) {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { CloseSmall, HideSmall, ShowSmall } from '../../Icons';
2
+ import { CloseSmall, HideSmall, ShowSmall } from '../../../icons';
3
3
  import { ButtonWrapper } from '../TextInput.styled';
4
4
 
5
5
  function ClearButton({ onClick }: { onClick?: () => void }) {
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Grow, Typography, Box } from '@mui/material';
3
3
 
4
- import { ArrowUp, Close, Success, Error16, RefreshLeft } from '../Icons';
4
+ import { ArrowUp, Close, Success, Error16, RefreshLeft } from '../../icons';
5
5
 
6
6
  import { useState, Fragment, useMemo } from 'react';
7
7
  import { Divider } from '../Divider';
@@ -9,10 +9,10 @@ export * from './Dialog';
9
9
  export * from './Divider';
10
10
  export * from './Dropdown';
11
11
  export * from './FileDnDZone';
12
- export * from './Icons';
13
12
  export * from './List';
14
13
  export * from './LoadingIndicator';
15
14
  export * from './Menu';
15
+ export * from './Pagination';
16
16
  export * from './ProductLabel';
17
17
  export * from './Progress';
18
18
  export * from './Radio';