@jk-core/components 1.1.11 → 1.1.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.
Files changed (84) hide show
  1. package/README.md +73 -73
  2. package/dist/index.js +276 -275
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.umd.cjs +6 -6
  5. package/dist/index.umd.cjs.map +1 -1
  6. package/dist/src/common/DropDown/index.d.ts +5 -1
  7. package/package.json +99 -99
  8. package/src/Calendar/Calendar.module.scss +213 -213
  9. package/src/Calendar/RangeCalendar.tsx +125 -125
  10. package/src/Calendar/ScrollCalendar.module.scss +214 -214
  11. package/src/Calendar/ScrollCalendar.tsx +124 -124
  12. package/src/Calendar/SingleCalendar.tsx +121 -121
  13. package/src/Calendar/components/DateLabel/DateLabel.module.scss +89 -89
  14. package/src/Calendar/components/DateLabel/index.tsx +91 -91
  15. package/src/Calendar/components/DayTile/DayTile.module.scss +117 -117
  16. package/src/Calendar/components/DayTile/index.tsx +108 -108
  17. package/src/Calendar/components/MonthTile/MonthTile.module.scss +59 -59
  18. package/src/Calendar/components/MonthTile/index.tsx +50 -50
  19. package/src/Calendar/components/ViewSelector/ViewSelector.module.scss +48 -48
  20. package/src/Calendar/components/ViewSelector/index.tsx +49 -49
  21. package/src/Calendar/components/YearTile/YearTile.module.scss +85 -85
  22. package/src/Calendar/components/YearTile/index.tsx +65 -65
  23. package/src/Calendar/hooks/useCalendarNav.ts +83 -83
  24. package/src/Calendar/hooks/useDateSelect.ts +54 -54
  25. package/src/Calendar/index.scss +189 -189
  26. package/src/Calendar/index.tsx +66 -66
  27. package/src/Calendar/type.ts +3 -3
  28. package/src/Calendar/utils/getWeeksInMonth.ts +45 -45
  29. package/src/Calendar/utils/isInRange.ts +8 -8
  30. package/src/Calendar/utils/isSameDay.ts +21 -21
  31. package/src/assets/arrow.svg +11 -11
  32. package/src/assets/close.svg +15 -15
  33. package/src/assets/drop-arrow.svg +3 -3
  34. package/src/common/Accordion/Accordion.module.scss +53 -53
  35. package/src/common/Accordion/arrow-down.svg +3 -3
  36. package/src/common/Accordion/arrow-up.svg +3 -3
  37. package/src/common/Accordion/index.tsx +54 -54
  38. package/src/common/Breadcrumbs/Breadcrumbs.module.scss +46 -46
  39. package/src/common/Breadcrumbs/home.svg +5 -5
  40. package/src/common/Breadcrumbs/index.tsx +82 -82
  41. package/src/common/Button/Button.module.scss +127 -127
  42. package/src/common/Button/index.tsx +60 -60
  43. package/src/common/Card/Card.module.scss +28 -28
  44. package/src/common/Card/index.tsx +19 -19
  45. package/src/common/Divider/Divider.module.scss +101 -101
  46. package/src/common/Divider/index.tsx +24 -24
  47. package/src/common/DropDown/DropDown.module.scss +135 -135
  48. package/src/common/DropDown/List.tsx +156 -156
  49. package/src/common/DropDown/arrow-down.svg +3 -3
  50. package/src/common/DropDown/index.tsx +108 -103
  51. package/src/common/DropDown/search.svg +4 -4
  52. package/src/common/Pagination/Pagination.module.scss +210 -210
  53. package/src/common/Pagination/arrow-left.svg +11 -11
  54. package/src/common/Pagination/arrow-right.svg +11 -11
  55. package/src/common/Pagination/index.tsx +156 -156
  56. package/src/common/SegmentButton/SegmentButton.module.scss +45 -45
  57. package/src/common/SegmentButton/index.tsx +79 -79
  58. package/src/common/Skeleton/Skeleton.module.scss +80 -80
  59. package/src/common/Skeleton/index.tsx +47 -47
  60. package/src/common/SwitchButton/SwitchButton.module.scss +65 -65
  61. package/src/common/SwitchButton/index.tsx +56 -56
  62. package/src/common/Table/Table.module.scss +70 -70
  63. package/src/common/Table/index.tsx +128 -128
  64. package/src/index.scss +1 -1
  65. package/src/index.tsx +21 -21
  66. package/src/styles/color.scss +346 -346
  67. package/src/styles/font-face.scss +18 -18
  68. package/src/styles/font.scss +49 -49
  69. package/src/styles/mediaQuery.scss +22 -22
  70. package/src/styles/scrollbar.scss +71 -71
  71. package/src/svg.d.ts +6 -6
  72. package/src/utils/styles/mediaQuery.scss +22 -22
  73. package/src/utils/ts/allowDecimal.ts +4 -4
  74. package/src/utils/ts/autoHypen.ts +33 -33
  75. package/src/utils/ts/calculateMax.ts +24 -24
  76. package/src/utils/ts/checkIsMobilePlatform.ts +15 -15
  77. package/src/utils/ts/formatFileSize.ts +16 -16
  78. package/src/utils/ts/formatMoney.ts +16 -16
  79. package/src/utils/ts/gradientRatio.ts +61 -61
  80. package/src/utils/ts/kiloToMega.ts +30 -30
  81. package/src/utils/ts/maskingPhone.ts +8 -8
  82. package/src/utils/ts/toQueryString.ts +7 -7
  83. package/src/utils/ts/valueAsNumber.ts +15 -15
  84. package/src/vite-env.d.ts +2 -2
@@ -1,128 +1,128 @@
1
- import { cn } from '@jk-core/utils';
2
- import styles from './Table.module.scss';
3
-
4
- interface TableLabelType{
5
- text: string | number;
6
- align?: 'left' | 'center' | 'right';
7
- }
8
- interface TableHeaderType {
9
- label: TableLabelType;
10
- width?: string;
11
- subWidth?: string[];
12
- subLabel?:TableLabelType[];
13
- }
14
-
15
- interface TableBodyType{
16
- head?: TableLabelType;
17
- labels: TableLabelType[];
18
- }
19
-
20
- interface TableProps {
21
- /**
22
- * 테이블 헤더 설정
23
- * - `label`: 헤더의 라벨 텍스트, text와 align 속성을 포함한 객체
24
- * - `width`: 헤더의 너비, subWidth가 있을 경우 무시됨 (선택적)
25
- * - `subWidth`: 서브 헤더의 너비 배열 (선택적)
26
- * - `subLabel`: 서브 헤더의 라벨, text와 align 속성을 포함한 객체 배열 (선택적)
27
- */
28
- header: TableHeaderType[];
29
- /**
30
- * 테이블 바디 설정
31
- * - `head`: 바디의 헤더 텍스트, text와 align 속성을 포함한 객체 (선택적)
32
- * - `labels`: 각 행의 라벨 배열, text와 align 속성을 포함한 객체 배열
33
- */
34
- body: TableBodyType[];
35
- /**
36
- * 테이블의 모서리를 둥글게 처리할지 여부
37
- * - `rounded`: true일 경우 모서리가 둥글게 처리됨
38
- */
39
- rounded?: boolean;
40
- /**
41
- * 테이블의 테두리 표시 여부
42
- * - `border`: true일 경우 테이블에 테두리가 표시됨
43
- */
44
- border?: boolean;
45
- }
46
-
47
- /**
48
- * 테이블 컴포넌트
49
- * 헤더와 바디를 설정하여 테이블을 렌더링합니다.
50
- * - `header`: 테이블의 헤더 설정
51
- * - `body`: 테이블의 바디 설정
52
- * - `rounded`: 테이블의 모서리를 둥글게 처리할지 여부
53
- * - `border`: 테이블에 테두리를 표시할지 여부
54
- */
55
- export default function Table({ header, body, rounded, border }: TableProps) {
56
- const subLabels = header.flatMap(col => col.subLabel || []);
57
- const isBodyWithHead = body.some(row => row.head);
58
-
59
- return (
60
- <div className={cn({
61
- [styles.wrapper]: true,
62
- [styles.wrapper__rounded]: !!rounded,
63
- [styles.wrapper__border]: !!border,
64
- })}
65
- >
66
-
67
- <table className={styles.table}>
68
- <colgroup>
69
- {isBodyWithHead && <col style={{ width: '100px' }} />}
70
- {header.map((col, colIndex) =>
71
- col.subLabel
72
- ? col.subLabel.map((_, subIndex) => (
73
- <col
74
- key={`col-${colIndex}-sub-${subIndex}`}
75
- style={{ width: col?.subWidth?.[subIndex] || 'auto' }}
76
- />
77
- ))
78
- : (
79
- <col
80
- key={`col-${colIndex}`}
81
- style={{ width: col.width || 'auto' }}
82
- />
83
- ),
84
- )}
85
-
86
- </colgroup>
87
- <thead>
88
- <tr>
89
- {body.some(row => row.head) && <th className={styles.fixed} rowSpan={2} />}
90
- {header.map((col, index) => (
91
- <th
92
- key={index}
93
- style={{ textAlign: col.label.align || 'left' }}
94
- rowSpan={col.subLabel ? 1 : 2}
95
- colSpan={col.subLabel ? col.subLabel.length : undefined}
96
- >
97
- {col.label.text}
98
- </th>
99
- ))}
100
- </tr>
101
- {subLabels.length > 0 && (
102
- <tr>
103
- {subLabels.map((subLabel, index) => (
104
- <th
105
- style={{ textAlign: subLabel.align || 'left' }}
106
- key={index}
107
- >{subLabel.text}
108
- </th>
109
- ))}
110
- </tr>
111
- )}
112
- </thead>
113
- <tbody>
114
- {body.map((row, rowIndex) => (
115
- <tr key={rowIndex}>
116
- {isBodyWithHead && <th style={{ textAlign: row?.head?.align || 'left' }}>{row?.head?.text || ''}</th>}
117
- {row.labels.map((col, colIndex) => (
118
- <td style={{ textAlign: col.align || 'left' }} key={colIndex}>
119
- {col.text}
120
- </td>
121
- ))}
122
- </tr>
123
- ))}
124
- </tbody>
125
- </table>
126
- </div>
127
- );
128
- }
1
+ import { cn } from '@jk-core/utils';
2
+ import styles from './Table.module.scss';
3
+
4
+ interface TableLabelType{
5
+ text: string | number;
6
+ align?: 'left' | 'center' | 'right';
7
+ }
8
+ interface TableHeaderType {
9
+ label: TableLabelType;
10
+ width?: string;
11
+ subWidth?: string[];
12
+ subLabel?:TableLabelType[];
13
+ }
14
+
15
+ interface TableBodyType{
16
+ head?: TableLabelType;
17
+ labels: TableLabelType[];
18
+ }
19
+
20
+ interface TableProps {
21
+ /**
22
+ * 테이블 헤더 설정
23
+ * - `label`: 헤더의 라벨 텍스트, text와 align 속성을 포함한 객체
24
+ * - `width`: 헤더의 너비, subWidth가 있을 경우 무시됨 (선택적)
25
+ * - `subWidth`: 서브 헤더의 너비 배열 (선택적)
26
+ * - `subLabel`: 서브 헤더의 라벨, text와 align 속성을 포함한 객체 배열 (선택적)
27
+ */
28
+ header: TableHeaderType[];
29
+ /**
30
+ * 테이블 바디 설정
31
+ * - `head`: 바디의 헤더 텍스트, text와 align 속성을 포함한 객체 (선택적)
32
+ * - `labels`: 각 행의 라벨 배열, text와 align 속성을 포함한 객체 배열
33
+ */
34
+ body: TableBodyType[];
35
+ /**
36
+ * 테이블의 모서리를 둥글게 처리할지 여부
37
+ * - `rounded`: true일 경우 모서리가 둥글게 처리됨
38
+ */
39
+ rounded?: boolean;
40
+ /**
41
+ * 테이블의 테두리 표시 여부
42
+ * - `border`: true일 경우 테이블에 테두리가 표시됨
43
+ */
44
+ border?: boolean;
45
+ }
46
+
47
+ /**
48
+ * 테이블 컴포넌트
49
+ * 헤더와 바디를 설정하여 테이블을 렌더링합니다.
50
+ * - `header`: 테이블의 헤더 설정
51
+ * - `body`: 테이블의 바디 설정
52
+ * - `rounded`: 테이블의 모서리를 둥글게 처리할지 여부
53
+ * - `border`: 테이블에 테두리를 표시할지 여부
54
+ */
55
+ export default function Table({ header, body, rounded, border }: TableProps) {
56
+ const subLabels = header.flatMap(col => col.subLabel || []);
57
+ const isBodyWithHead = body.some(row => row.head);
58
+
59
+ return (
60
+ <div className={cn({
61
+ [styles.wrapper]: true,
62
+ [styles.wrapper__rounded]: !!rounded,
63
+ [styles.wrapper__border]: !!border,
64
+ })}
65
+ >
66
+
67
+ <table className={styles.table}>
68
+ <colgroup>
69
+ {isBodyWithHead && <col style={{ width: '100px' }} />}
70
+ {header.map((col, colIndex) =>
71
+ col.subLabel
72
+ ? col.subLabel.map((_, subIndex) => (
73
+ <col
74
+ key={`col-${colIndex}-sub-${subIndex}`}
75
+ style={{ width: col?.subWidth?.[subIndex] || 'auto' }}
76
+ />
77
+ ))
78
+ : (
79
+ <col
80
+ key={`col-${colIndex}`}
81
+ style={{ width: col.width || 'auto' }}
82
+ />
83
+ ),
84
+ )}
85
+
86
+ </colgroup>
87
+ <thead>
88
+ <tr>
89
+ {body.some(row => row.head) && <th className={styles.fixed} rowSpan={2} />}
90
+ {header.map((col, index) => (
91
+ <th
92
+ key={index}
93
+ style={{ textAlign: col.label.align || 'left' }}
94
+ rowSpan={col.subLabel ? 1 : 2}
95
+ colSpan={col.subLabel ? col.subLabel.length : undefined}
96
+ >
97
+ {col.label.text}
98
+ </th>
99
+ ))}
100
+ </tr>
101
+ {subLabels.length > 0 && (
102
+ <tr>
103
+ {subLabels.map((subLabel, index) => (
104
+ <th
105
+ style={{ textAlign: subLabel.align || 'left' }}
106
+ key={index}
107
+ >{subLabel.text}
108
+ </th>
109
+ ))}
110
+ </tr>
111
+ )}
112
+ </thead>
113
+ <tbody>
114
+ {body.map((row, rowIndex) => (
115
+ <tr key={rowIndex}>
116
+ {isBodyWithHead && <th style={{ textAlign: row?.head?.align || 'left' }}>{row?.head?.text || ''}</th>}
117
+ {row.labels.map((col, colIndex) => (
118
+ <td style={{ textAlign: col.align || 'left' }} key={colIndex}>
119
+ {col.text}
120
+ </td>
121
+ ))}
122
+ </tr>
123
+ ))}
124
+ </tbody>
125
+ </table>
126
+ </div>
127
+ );
128
+ }
package/src/index.scss CHANGED
@@ -1 +1 @@
1
- @forward "@/styles/color";
1
+ @forward "@/styles/color";
package/src/index.tsx CHANGED
@@ -1,22 +1,22 @@
1
- import Breadcrumbs, { BreadcrumbsItem } from '@/common/Breadcrumbs';
2
- import Button from '@/common/Button';
3
- import Pagination from '@/common/Pagination';
4
- import Skeleton from '@/common/Skeleton';
5
- import SwitchButton from '@/common/SwitchButton';
6
- import Table from '@/common/Table';
7
- import Calendar from './Calendar';
8
- import { CalendarRange, CalendarView } from './Calendar/type';
9
- import Accordion from './common/Accordion';
10
- import Card from './common/Card';
11
- import DropDown from './common/DropDown';
12
- import SegmentButton from './common/SegmentButton';
13
-
14
- export {
15
- Calendar, Accordion, Breadcrumbs, Button,
16
- Pagination, Skeleton, SwitchButton,
17
- Card, DropDown, SegmentButton, BreadcrumbsItem, Table,
18
- };
19
-
20
- export type { CalendarView, CalendarRange };
21
-
1
+ import Breadcrumbs, { BreadcrumbsItem } from '@/common/Breadcrumbs';
2
+ import Button from '@/common/Button';
3
+ import Pagination from '@/common/Pagination';
4
+ import Skeleton from '@/common/Skeleton';
5
+ import SwitchButton from '@/common/SwitchButton';
6
+ import Table from '@/common/Table';
7
+ import Calendar from './Calendar';
8
+ import { CalendarRange, CalendarView } from './Calendar/type';
9
+ import Accordion from './common/Accordion';
10
+ import Card from './common/Card';
11
+ import DropDown from './common/DropDown';
12
+ import SegmentButton from './common/SegmentButton';
13
+
14
+ export {
15
+ Calendar, Accordion, Breadcrumbs, Button,
16
+ Pagination, Skeleton, SwitchButton,
17
+ Card, DropDown, SegmentButton, BreadcrumbsItem, Table,
18
+ };
19
+
20
+ export type { CalendarView, CalendarRange };
21
+
22
22
  import './index.scss';