@jk-core/components 1.1.15 → 1.1.17

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 +2 -2
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.umd.cjs +1 -1
  5. package/dist/index.umd.cjs.map +1 -1
  6. package/dist/src/Calendar/index.d.ts +1 -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 -108
  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 +57 -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,59 +1,59 @@
1
- @use "../../../styles/mediaQuery.scss" as media;
2
-
3
- .month-tile {
4
- position: relative;
5
- min-height: 310px;
6
- padding: 5px;
7
- display: grid;
8
- grid-template-columns: repeat(3, 1fr);
9
- grid-template-rows: repeat(4, 1fr);
10
- gap: 5px;
11
-
12
- &__month {
13
- display: flex;
14
- flex-direction: column;
15
- justify-content: center;
16
- align-items: center;
17
- padding: 5px;
18
- border-radius: 10px;
19
- color: var(--calendar-G-80);
20
-
21
- svg {
22
- width: 15px;
23
- height: 15px;
24
- cursor: pointer;
25
- }
26
-
27
- &:hover {
28
- @include media.pc {
29
- background-color: var(--calendar-G-5);
30
- }
31
- }
32
-
33
- &:active {
34
- background-color: var(--calendar-G-10);
35
- }
36
-
37
- &:disabled {
38
- color: var(--calendar-G-40) !important;
39
- background-color: transparent !important;
40
- cursor: default;
41
- border-radius: 0 !important;
42
- }
43
-
44
- &--selected {
45
- background-color: var(--calendar-P-50) !important;
46
- color: var(--calendar-white) !important;
47
- }
48
-
49
- &--today {
50
- color: var(--calendar-P-50);
51
- font-weight: 600;
52
- }
53
-
54
- &--tile {
55
- justify-content: flex-start;
56
- gap: 5px;
57
- }
58
- }
59
- }
1
+ @use "../../../styles/mediaQuery.scss" as media;
2
+
3
+ .month-tile {
4
+ position: relative;
5
+ min-height: 310px;
6
+ padding: 5px;
7
+ display: grid;
8
+ grid-template-columns: repeat(3, 1fr);
9
+ grid-template-rows: repeat(4, 1fr);
10
+ gap: 5px;
11
+
12
+ &__month {
13
+ display: flex;
14
+ flex-direction: column;
15
+ justify-content: center;
16
+ align-items: center;
17
+ padding: 5px;
18
+ border-radius: 10px;
19
+ color: var(--calendar-G-80);
20
+
21
+ svg {
22
+ width: 15px;
23
+ height: 15px;
24
+ cursor: pointer;
25
+ }
26
+
27
+ &:hover {
28
+ @include media.pc {
29
+ background-color: var(--calendar-G-5);
30
+ }
31
+ }
32
+
33
+ &:active {
34
+ background-color: var(--calendar-G-10);
35
+ }
36
+
37
+ &:disabled {
38
+ color: var(--calendar-G-40) !important;
39
+ background-color: transparent !important;
40
+ cursor: default;
41
+ border-radius: 0 !important;
42
+ }
43
+
44
+ &--selected {
45
+ background-color: var(--calendar-P-50) !important;
46
+ color: var(--calendar-white) !important;
47
+ }
48
+
49
+ &--today {
50
+ color: var(--calendar-P-50);
51
+ font-weight: 600;
52
+ }
53
+
54
+ &--tile {
55
+ justify-content: flex-start;
56
+ gap: 5px;
57
+ }
58
+ }
59
+ }
@@ -1,50 +1,50 @@
1
- import { cn } from '@jk-core/utils';
2
- import { CalendarView } from '@/Calendar/type';
3
- import isSameDay from '@/Calendar/utils/isSameDay';
4
- import styles from './MonthTile.module.scss';
5
-
6
- const MONTHS = Array.from({ length: 12 }, (_, i) => i);
7
-
8
- interface Props {
9
- selectedDate?: Date;
10
- viewDate: Date;
11
- handleMonthClick: (month: number) => void;
12
- tileContent?: (date: Date, view:CalendarView) => React.ReactNode;
13
- max: Date;
14
- min: Date;
15
- }
16
-
17
- export default function MonthTile({
18
- selectedDate, viewDate, handleMonthClick, tileContent = () => false,
19
- max, min,
20
- }: Props) {
21
- const isDisabled = (month: number) => {
22
- const monthDate = new Date(viewDate.getFullYear(), month, 1);
23
-
24
- return monthDate > new Date(max.getFullYear(), max.getMonth(), 1)
25
- || monthDate < new Date(min.getFullYear(), min.getMonth(), 1);
26
- };
27
-
28
- return (
29
- <div className={styles['month-tile']}>
30
- {MONTHS.map((month) => (
31
- <button
32
- className={cn({
33
- [styles['month-tile__month']]: true,
34
- [styles['month-tile__month--selected']]: !!selectedDate && isSameDay(selectedDate, new Date(viewDate.getFullYear(), month), 'month'),
35
- [styles['month-tile__month--today']]: isSameDay(new Date(viewDate.getFullYear(), month), new Date(), 'month'),
36
- [styles['month-tile__month--tile']]: !!tileContent(new Date(viewDate.getFullYear(), month - 1, 1), 'month'),
37
- })}
38
- type="button"
39
- key={month}
40
- onClick={() => handleMonthClick(month)}
41
- disabled={isDisabled(month)}
42
- >
43
- <span>{`${month + 1}월`}</span>
44
- {!!tileContent(new Date(viewDate.getFullYear(), month - 1, 1), 'month')
45
- && tileContent(new Date(viewDate.getFullYear(), month - 1, 1), 'month')}
46
- </button>
47
- ))}
48
- </div>
49
- );
50
- }
1
+ import { cn } from '@jk-core/utils';
2
+ import { CalendarView } from '@/Calendar/type';
3
+ import isSameDay from '@/Calendar/utils/isSameDay';
4
+ import styles from './MonthTile.module.scss';
5
+
6
+ const MONTHS = Array.from({ length: 12 }, (_, i) => i);
7
+
8
+ interface Props {
9
+ selectedDate?: Date;
10
+ viewDate: Date;
11
+ handleMonthClick: (month: number) => void;
12
+ tileContent?: (date: Date, view:CalendarView) => React.ReactNode;
13
+ max: Date;
14
+ min: Date;
15
+ }
16
+
17
+ export default function MonthTile({
18
+ selectedDate, viewDate, handleMonthClick, tileContent = () => false,
19
+ max, min,
20
+ }: Props) {
21
+ const isDisabled = (month: number) => {
22
+ const monthDate = new Date(viewDate.getFullYear(), month, 1);
23
+
24
+ return monthDate > new Date(max.getFullYear(), max.getMonth(), 1)
25
+ || monthDate < new Date(min.getFullYear(), min.getMonth(), 1);
26
+ };
27
+
28
+ return (
29
+ <div className={styles['month-tile']}>
30
+ {MONTHS.map((month) => (
31
+ <button
32
+ className={cn({
33
+ [styles['month-tile__month']]: true,
34
+ [styles['month-tile__month--selected']]: !!selectedDate && isSameDay(selectedDate, new Date(viewDate.getFullYear(), month), 'month'),
35
+ [styles['month-tile__month--today']]: isSameDay(new Date(viewDate.getFullYear(), month), new Date(), 'month'),
36
+ [styles['month-tile__month--tile']]: !!tileContent(new Date(viewDate.getFullYear(), month - 1, 1), 'month'),
37
+ })}
38
+ type="button"
39
+ key={month}
40
+ onClick={() => handleMonthClick(month)}
41
+ disabled={isDisabled(month)}
42
+ >
43
+ <span>{`${month + 1}월`}</span>
44
+ {!!tileContent(new Date(viewDate.getFullYear(), month - 1, 1), 'month')
45
+ && tileContent(new Date(viewDate.getFullYear(), month - 1, 1), 'month')}
46
+ </button>
47
+ ))}
48
+ </div>
49
+ );
50
+ }
@@ -1,48 +1,48 @@
1
- .view {
2
- position: relative;
3
- margin: 0 auto;
4
- width: 90%;
5
- display: flex;
6
- justify-content: space-between;
7
- align-items: center;
8
- background-color: var(--calendar-S-10);
9
- color: var(--calendar-black);
10
- border-radius: 10px;
11
-
12
- &__block {
13
- position: absolute;
14
- background-color: var(--calendar-white);
15
- left: 0;
16
- height: 100%;
17
- border: 2px solid var(--calendar-G-30);
18
- width: 33.3%;
19
- border-radius: 10px;
20
- transition: 0.3s;
21
-
22
- &--second {
23
- left: 33%;
24
- }
25
-
26
- &--last {
27
- left: 66.6%;
28
- }
29
- }
30
-
31
- &__selector {
32
- position: relative;
33
- height: 40px;
34
- flex: 1 0;
35
- display: flex;
36
- align-items: center;
37
- justify-content: center;
38
- color: var(--calendar-G-60);
39
- font-size: 1em;
40
- font-weight: 400;
41
-
42
- &--selected {
43
- color: var(--calendar-G-80);
44
- font-size: 1em;
45
- font-weight: 600;
46
- }
47
- }
48
- }
1
+ .view {
2
+ position: relative;
3
+ margin: 0 auto;
4
+ width: 90%;
5
+ display: flex;
6
+ justify-content: space-between;
7
+ align-items: center;
8
+ background-color: var(--calendar-S-10);
9
+ color: var(--calendar-black);
10
+ border-radius: 10px;
11
+
12
+ &__block {
13
+ position: absolute;
14
+ background-color: var(--calendar-white);
15
+ left: 0;
16
+ height: 100%;
17
+ border: 2px solid var(--calendar-G-30);
18
+ width: 33.3%;
19
+ border-radius: 10px;
20
+ transition: 0.3s;
21
+
22
+ &--second {
23
+ left: 33%;
24
+ }
25
+
26
+ &--last {
27
+ left: 66.6%;
28
+ }
29
+ }
30
+
31
+ &__selector {
32
+ position: relative;
33
+ height: 40px;
34
+ flex: 1 0;
35
+ display: flex;
36
+ align-items: center;
37
+ justify-content: center;
38
+ color: var(--calendar-G-60);
39
+ font-size: 1em;
40
+ font-weight: 400;
41
+
42
+ &--selected {
43
+ color: var(--calendar-G-80);
44
+ font-size: 1em;
45
+ font-weight: 600;
46
+ }
47
+ }
48
+ }
@@ -1,49 +1,49 @@
1
- import { cn } from '@jk-core/utils';
2
- import { CalendarView } from '@/Calendar/type';
3
- import styles from './ViewSelector.module.scss';
4
-
5
- interface ViewSelectorProps {
6
- method: CalendarView;
7
- selectView: (value: CalendarView) => void;
8
- }
9
- export default function ViewSelector({ method, selectView }:ViewSelectorProps) {
10
- return (
11
- <div className={styles.view}>
12
- <div className={
13
- cn({
14
- [styles.view__block]: true,
15
- [styles['view__block--second']]: method === 'month',
16
- [styles['view__block--last']]: method === 'year',
17
- })
18
- }
19
- />
20
- <button
21
- className={cn({
22
- [styles.view__selector]: true,
23
- [styles['view__selector--selected']]: method === 'day',
24
- })}
25
- type="button"
26
- onClick={() => selectView('day')}
27
- >일
28
- </button>
29
- <button
30
- className={cn({
31
- [styles.view__selector]: true,
32
- [styles['view__selector--selected']]: method === 'month',
33
- })}
34
- type="button"
35
- onClick={() => selectView('month')}
36
- >월
37
- </button>
38
- <button
39
- className={cn({
40
- [styles.view__selector]: true,
41
- [styles['view__selector--selected']]: method === 'year',
42
- })}
43
- type="button"
44
- onClick={() => selectView('year')}
45
- >년
46
- </button>
47
- </div>
48
- );
49
- }
1
+ import { cn } from '@jk-core/utils';
2
+ import { CalendarView } from '@/Calendar/type';
3
+ import styles from './ViewSelector.module.scss';
4
+
5
+ interface ViewSelectorProps {
6
+ method: CalendarView;
7
+ selectView: (value: CalendarView) => void;
8
+ }
9
+ export default function ViewSelector({ method, selectView }:ViewSelectorProps) {
10
+ return (
11
+ <div className={styles.view}>
12
+ <div className={
13
+ cn({
14
+ [styles.view__block]: true,
15
+ [styles['view__block--second']]: method === 'month',
16
+ [styles['view__block--last']]: method === 'year',
17
+ })
18
+ }
19
+ />
20
+ <button
21
+ className={cn({
22
+ [styles.view__selector]: true,
23
+ [styles['view__selector--selected']]: method === 'day',
24
+ })}
25
+ type="button"
26
+ onClick={() => selectView('day')}
27
+ >일
28
+ </button>
29
+ <button
30
+ className={cn({
31
+ [styles.view__selector]: true,
32
+ [styles['view__selector--selected']]: method === 'month',
33
+ })}
34
+ type="button"
35
+ onClick={() => selectView('month')}
36
+ >월
37
+ </button>
38
+ <button
39
+ className={cn({
40
+ [styles.view__selector]: true,
41
+ [styles['view__selector--selected']]: method === 'year',
42
+ })}
43
+ type="button"
44
+ onClick={() => selectView('year')}
45
+ >년
46
+ </button>
47
+ </div>
48
+ );
49
+ }
@@ -1,85 +1,85 @@
1
- @use "../../../styles/mediaQuery.scss" as media;
2
-
3
- .year-tile {
4
- min-height: 310px;
5
- padding: 5px;
6
- position: relative;
7
- height: 310px;
8
- display: flex;
9
- flex-direction: column;
10
- align-items: center;
11
- overflow: auto;
12
- gap: 10px;
13
-
14
- &::-webkit-scrollbar {
15
- display: none;
16
- }
17
-
18
- &__blank {
19
- height: calc(50% - 40px);
20
- flex-shrink: 0;
21
-
22
- &:last-child {
23
- height: 50%;
24
- }
25
- }
26
-
27
- &__year {
28
- min-width: 50%;
29
- display: flex;
30
- flex-direction: column;
31
- align-items: center;
32
- justify-content: center;
33
- min-height: 40px;
34
- border-radius: 6px;
35
- flex-shrink: 0;
36
- overflow: hidden;
37
- font-weight: 400;
38
- font-size: 1.2em;
39
- color: var(--calendar-G-80);
40
-
41
- &:hover {
42
- @include media.pc {
43
- background-color: var(--calendar-P-5);
44
- }
45
- }
46
-
47
- &:active {
48
- background-color: var(--calendar-P-10);
49
- }
50
-
51
- &--border {
52
- border: 1px solid var(--calendar-G-30);
53
- background-color: var(--calendar-P-5);
54
-
55
- &:hover {
56
- @include media.pc {
57
- background-color: var(--calendar-P-10);
58
- }
59
- }
60
- }
61
-
62
- &--year {
63
- height: 40px;
64
- display: flex;
65
- align-items: center;
66
- justify-content: center;
67
- }
68
-
69
- &--selected {
70
- color: var(--calendar-white);
71
- background-color: var(--calendar-P-50) !important;
72
- }
73
-
74
- &--tile {
75
- display: flex;
76
- align-items: center;
77
- justify-content: center;
78
- min-height: 40px;
79
- color: var(--calendar-G-80);
80
- width: 100%;
81
- background-color: var(--calendar-white);
82
- border-top: var(--calendar-P-50);
83
- }
84
- }
85
- }
1
+ @use "../../../styles/mediaQuery.scss" as media;
2
+
3
+ .year-tile {
4
+ min-height: 310px;
5
+ padding: 5px;
6
+ position: relative;
7
+ height: 310px;
8
+ display: flex;
9
+ flex-direction: column;
10
+ align-items: center;
11
+ overflow: auto;
12
+ gap: 10px;
13
+
14
+ &::-webkit-scrollbar {
15
+ display: none;
16
+ }
17
+
18
+ &__blank {
19
+ height: calc(50% - 40px);
20
+ flex-shrink: 0;
21
+
22
+ &:last-child {
23
+ height: 50%;
24
+ }
25
+ }
26
+
27
+ &__year {
28
+ min-width: 50%;
29
+ display: flex;
30
+ flex-direction: column;
31
+ align-items: center;
32
+ justify-content: center;
33
+ min-height: 40px;
34
+ border-radius: 6px;
35
+ flex-shrink: 0;
36
+ overflow: hidden;
37
+ font-weight: 400;
38
+ font-size: 1.2em;
39
+ color: var(--calendar-G-80);
40
+
41
+ &:hover {
42
+ @include media.pc {
43
+ background-color: var(--calendar-P-5);
44
+ }
45
+ }
46
+
47
+ &:active {
48
+ background-color: var(--calendar-P-10);
49
+ }
50
+
51
+ &--border {
52
+ border: 1px solid var(--calendar-G-30);
53
+ background-color: var(--calendar-P-5);
54
+
55
+ &:hover {
56
+ @include media.pc {
57
+ background-color: var(--calendar-P-10);
58
+ }
59
+ }
60
+ }
61
+
62
+ &--year {
63
+ height: 40px;
64
+ display: flex;
65
+ align-items: center;
66
+ justify-content: center;
67
+ }
68
+
69
+ &--selected {
70
+ color: var(--calendar-white);
71
+ background-color: var(--calendar-P-50) !important;
72
+ }
73
+
74
+ &--tile {
75
+ display: flex;
76
+ align-items: center;
77
+ justify-content: center;
78
+ min-height: 40px;
79
+ color: var(--calendar-G-80);
80
+ width: 100%;
81
+ background-color: var(--calendar-white);
82
+ border-top: var(--calendar-P-50);
83
+ }
84
+ }
85
+ }