@tipp/ui 2.2.9 → 2.2.10
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/app/index.cjs +2 -0
- package/dist/app/index.cjs.map +1 -1
- package/dist/app/index.js +76 -76
- package/dist/app/platform/coach-question-list.cjs +2 -0
- package/dist/app/platform/coach-question-list.cjs.map +1 -1
- package/dist/app/platform/coach-question-list.js +14 -14
- package/dist/app/platform/contents-card.cjs +2 -0
- package/dist/app/platform/contents-card.cjs.map +1 -1
- package/dist/app/platform/contents-card.js +14 -14
- package/dist/app/platform/curriculum-card.js +4 -4
- package/dist/app/platform/edit-coaching-time.cjs +2 -0
- package/dist/app/platform/edit-coaching-time.cjs.map +1 -1
- package/dist/app/platform/edit-coaching-time.js +51 -51
- package/dist/app/platform/edit-service-type.cjs +2 -0
- package/dist/app/platform/edit-service-type.cjs.map +1 -1
- package/dist/app/platform/edit-service-type.js +52 -52
- package/dist/app/platform/goal-manage-card-edit.cjs +2 -0
- package/dist/app/platform/goal-manage-card-edit.cjs.map +1 -1
- package/dist/app/platform/goal-manage-card-edit.js +51 -51
- package/dist/app/platform/goal-manage-card-read.cjs +2 -0
- package/dist/app/platform/goal-manage-card-read.cjs.map +1 -1
- package/dist/app/platform/goal-manage-card-read.js +14 -14
- package/dist/app/platform/on-offline-radio-card.cjs +2 -0
- package/dist/app/platform/on-offline-radio-card.cjs.map +1 -1
- package/dist/app/platform/on-offline-radio-card.js +51 -51
- package/dist/app/platform/report-card.cjs +2 -0
- package/dist/app/platform/report-card.cjs.map +1 -1
- package/dist/app/platform/report-card.js +14 -14
- package/dist/app/platform/reservation-card.cjs +2 -0
- package/dist/app/platform/reservation-card.cjs.map +1 -1
- package/dist/app/platform/reservation-card.js +52 -52
- package/dist/app/platform/session-card.cjs +2 -0
- package/dist/app/platform/session-card.cjs.map +1 -1
- package/dist/app/platform/session-card.js +54 -54
- package/dist/app/platform/session-review-simple-read.cjs +2 -0
- package/dist/app/platform/session-review-simple-read.cjs.map +1 -1
- package/dist/app/platform/session-review-simple-read.js +14 -14
- package/dist/app/platform/userInfos/coaching-customer-info/index.cjs +2 -0
- package/dist/app/platform/userInfos/coaching-customer-info/index.cjs.map +1 -1
- package/dist/app/platform/userInfos/coaching-customer-info/index.js +18 -18
- package/dist/app/platform/userInfos/coaching-customer-info/large.cjs +2 -0
- package/dist/app/platform/userInfos/coaching-customer-info/large.cjs.map +1 -1
- package/dist/app/platform/userInfos/coaching-customer-info/large.js +15 -15
- package/dist/app/platform/userInfos/coaching-customer-info/medium.cjs +2 -0
- package/dist/app/platform/userInfos/coaching-customer-info/medium.cjs.map +1 -1
- package/dist/app/platform/userInfos/coaching-customer-info/medium.js +15 -15
- package/dist/app/platform/userInfos/coaching-customer-info/small.cjs +2 -0
- package/dist/app/platform/userInfos/coaching-customer-info/small.cjs.map +1 -1
- package/dist/app/platform/userInfos/coaching-customer-info/small.js +14 -14
- package/dist/app/platform/userInfos/session-user-info-detail.cjs +2 -0
- package/dist/app/platform/userInfos/session-user-info-detail.cjs.map +1 -1
- package/dist/app/platform/userInfos/session-user-info-detail.js +15 -15
- package/dist/app/platform/userInfos/utils.cjs +2 -0
- package/dist/app/platform/userInfos/utils.cjs.map +1 -1
- package/dist/app/platform/userInfos/utils.js +14 -14
- package/dist/atoms/bullet-text.js +2 -2
- package/dist/atoms/button.cjs +1 -0
- package/dist/atoms/button.cjs.map +1 -1
- package/dist/atoms/button.js +1 -1
- package/dist/atoms/dialog.cjs +1 -0
- package/dist/atoms/dialog.cjs.map +1 -1
- package/dist/atoms/dialog.js +3 -3
- package/dist/atoms/drawer.cjs +1 -0
- package/dist/atoms/drawer.cjs.map +1 -1
- package/dist/atoms/drawer.js +2 -2
- package/dist/atoms/ellipsis-tooltip.js +1 -1
- package/dist/atoms/field-error-wrapper.js +2 -2
- package/dist/atoms/icon-button.cjs +1 -0
- package/dist/atoms/icon-button.cjs.map +1 -1
- package/dist/atoms/icon-button.js +1 -1
- package/dist/atoms/index.cjs +2 -0
- package/dist/atoms/index.cjs.map +1 -1
- package/dist/atoms/index.js +20 -20
- package/dist/atoms/list.js +2 -2
- package/dist/atoms/pagination.cjs +1 -0
- package/dist/atoms/pagination.cjs.map +1 -1
- package/dist/atoms/pagination.js +4 -4
- package/dist/chunk-2U66KQZ2.js +75 -0
- package/dist/chunk-2U66KQZ2.js.map +1 -0
- package/dist/chunk-4DJKPP4U.js +70 -0
- package/dist/chunk-4DJKPP4U.js.map +1 -0
- package/dist/chunk-5JQOU3IR.js +70 -0
- package/dist/chunk-5JQOU3IR.js.map +1 -0
- package/dist/chunk-6CZL4QRJ.js +79 -0
- package/dist/chunk-6CZL4QRJ.js.map +1 -0
- package/dist/chunk-7EO2IDDI.js +100 -0
- package/dist/chunk-7EO2IDDI.js.map +1 -0
- package/dist/chunk-A2PJJQL2.js +68 -0
- package/dist/chunk-A2PJJQL2.js.map +1 -0
- package/dist/chunk-CLIVD43W.js +117 -0
- package/dist/chunk-CLIVD43W.js.map +1 -0
- package/dist/chunk-DDQFYUS2.js +165 -0
- package/dist/chunk-DDQFYUS2.js.map +1 -0
- package/dist/chunk-DL2PXGQN.js +151 -0
- package/dist/chunk-DL2PXGQN.js.map +1 -0
- package/dist/chunk-EWOE4O34.js +174 -0
- package/dist/chunk-EWOE4O34.js.map +1 -0
- package/dist/chunk-F7JSPN5P.js +163 -0
- package/dist/chunk-F7JSPN5P.js.map +1 -0
- package/dist/chunk-GXX5RVW2.js +69 -0
- package/dist/chunk-GXX5RVW2.js.map +1 -0
- package/dist/chunk-GZ3ZMUVY.js +145 -0
- package/dist/chunk-GZ3ZMUVY.js.map +1 -0
- package/dist/chunk-I3JO5M7P.js +89 -0
- package/dist/chunk-I3JO5M7P.js.map +1 -0
- package/dist/chunk-IUWVB3C4.js +64 -0
- package/dist/chunk-IUWVB3C4.js.map +1 -0
- package/dist/chunk-IWBIHII5.js +125 -0
- package/dist/chunk-IWBIHII5.js.map +1 -0
- package/dist/chunk-JFG3VQJJ.js +63 -0
- package/dist/chunk-JFG3VQJJ.js.map +1 -0
- package/dist/chunk-JGGBQ33D.js +233 -0
- package/dist/chunk-JGGBQ33D.js.map +1 -0
- package/dist/chunk-JHM7EMDO.js +192 -0
- package/dist/chunk-JHM7EMDO.js.map +1 -0
- package/dist/chunk-JWAQUXGB.js +106 -0
- package/dist/chunk-JWAQUXGB.js.map +1 -0
- package/dist/chunk-LR46FY6A.js +144 -0
- package/dist/chunk-LR46FY6A.js.map +1 -0
- package/dist/chunk-MLTB7HIP.js +196 -0
- package/dist/chunk-MLTB7HIP.js.map +1 -0
- package/dist/chunk-OHNBVT52.js +53 -0
- package/dist/chunk-OHNBVT52.js.map +1 -0
- package/dist/chunk-R7YKR6O3.js +54 -0
- package/dist/chunk-R7YKR6O3.js.map +1 -0
- package/dist/chunk-RHOMLB32.js +101 -0
- package/dist/chunk-RHOMLB32.js.map +1 -0
- package/dist/chunk-SECCJJQH.js +54 -0
- package/dist/chunk-SECCJJQH.js.map +1 -0
- package/dist/chunk-SUQY6DPL.js +74 -0
- package/dist/chunk-SUQY6DPL.js.map +1 -0
- package/dist/chunk-V7MDEDWX.js +64 -0
- package/dist/chunk-V7MDEDWX.js.map +1 -0
- package/dist/chunk-VM5GDS2C.js +57 -0
- package/dist/chunk-VM5GDS2C.js.map +1 -0
- package/dist/chunk-VMYPC5QK.js +63 -0
- package/dist/chunk-VMYPC5QK.js.map +1 -0
- package/dist/chunk-VRJIVH6A.js +30 -0
- package/dist/chunk-VRJIVH6A.js.map +1 -0
- package/dist/chunk-X7TJ2DUL.js +363 -0
- package/dist/chunk-X7TJ2DUL.js.map +1 -0
- package/dist/chunk-XK6VEVOK.js +47 -0
- package/dist/chunk-XK6VEVOK.js.map +1 -0
- package/dist/chunk-XWRELLWY.js +228 -0
- package/dist/chunk-XWRELLWY.js.map +1 -0
- package/dist/chunk-YQRJ52FA.js +135 -0
- package/dist/chunk-YQRJ52FA.js.map +1 -0
- package/dist/chunk-ZI34IKO5.js +101 -0
- package/dist/chunk-ZI34IKO5.js.map +1 -0
- package/dist/chunk-ZVDAEY5Q.js +47 -0
- package/dist/chunk-ZVDAEY5Q.js.map +1 -0
- package/dist/context/index.js +2 -2
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +101 -101
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/index.cjs +2 -0
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/index.cjs.map +1 -1
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/index.js +22 -22
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-comp.cjs +2 -0
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-comp.cjs.map +1 -1
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-comp.js +14 -14
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-body.cjs +2 -0
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-body.cjs.map +1 -1
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-body.js +19 -19
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-footer.cjs +2 -0
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-footer.cjs.map +1 -1
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-footer.js +14 -14
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-header.cjs +2 -0
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-header.cjs.map +1 -1
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-header.js +14 -14
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-layout.cjs +2 -0
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-layout.cjs.map +1 -1
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-layout.js +13 -13
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-radio.cjs +2 -0
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-radio.cjs.map +1 -1
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-radio.js +15 -15
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-satisfaction-option.cjs +2 -0
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-satisfaction-option.cjs.map +1 -1
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-satisfaction-option.js +15 -15
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-satisfaction-text.cjs +2 -0
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-satisfaction-text.cjs.map +1 -1
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-satisfaction-text.js +15 -15
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-text.cjs +2 -0
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-text.cjs.map +1 -1
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/ReviewQuestion/review-question-text.js +15 -15
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/complete-review.cjs +2 -0
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/complete-review.cjs.map +1 -1
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/complete-review.js +14 -14
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/index.cjs +2 -0
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/index.cjs.map +1 -1
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/index.js +25 -25
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/start-review.cjs +2 -0
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/start-review.cjs.map +1 -1
- package/dist/molecules/curriculumV2/CurriculumContents/CurriculumReviewSteps/start-review.js +14 -14
- package/dist/molecules/curriculumV2/CurriculumContents/curriculum-ai-traning.cjs +2 -0
- package/dist/molecules/curriculumV2/CurriculumContents/curriculum-ai-traning.cjs.map +1 -1
- package/dist/molecules/curriculumV2/CurriculumContents/curriculum-ai-traning.js +14 -14
- package/dist/molecules/curriculumV2/CurriculumContents/curriculum-review.cjs +2 -0
- package/dist/molecules/curriculumV2/CurriculumContents/curriculum-review.cjs.map +1 -1
- package/dist/molecules/curriculumV2/CurriculumContents/curriculum-review.js +26 -26
- package/dist/molecules/curriculumV2/CurriculumContents/curriculum-video.cjs +2 -0
- package/dist/molecules/curriculumV2/CurriculumContents/curriculum-video.cjs.map +1 -1
- package/dist/molecules/curriculumV2/CurriculumContents/curriculum-video.js +13 -13
- package/dist/molecules/curriculumV2/CurriculumContents/index.cjs +2 -0
- package/dist/molecules/curriculumV2/CurriculumContents/index.cjs.map +1 -1
- package/dist/molecules/curriculumV2/CurriculumContents/index.js +29 -29
- package/dist/molecules/curriculumV2/CurriculumSidebar/Items/curriculum-item-title.cjs +2 -0
- package/dist/molecules/curriculumV2/CurriculumSidebar/Items/curriculum-item-title.cjs.map +1 -1
- package/dist/molecules/curriculumV2/CurriculumSidebar/Items/curriculum-item-title.js +14 -14
- package/dist/molecules/curriculumV2/CurriculumSidebar/Items/curriculum-sidebar-item-wrapper.cjs +2 -0
- package/dist/molecules/curriculumV2/CurriculumSidebar/Items/curriculum-sidebar-item-wrapper.cjs.map +1 -1
- package/dist/molecules/curriculumV2/CurriculumSidebar/Items/curriculum-sidebar-item-wrapper.js +13 -13
- package/dist/molecules/curriculumV2/CurriculumSidebar/Items/section-item.cjs +2 -0
- package/dist/molecules/curriculumV2/CurriculumSidebar/Items/section-item.cjs.map +1 -1
- package/dist/molecules/curriculumV2/CurriculumSidebar/Items/section-item.js +15 -15
- package/dist/molecules/curriculumV2/CurriculumSidebar/Items/section-title.cjs +2 -0
- package/dist/molecules/curriculumV2/CurriculumSidebar/Items/section-title.cjs.map +1 -1
- package/dist/molecules/curriculumV2/CurriculumSidebar/Items/section-title.js +13 -13
- package/dist/molecules/curriculumV2/CurriculumSidebar/index.cjs +2 -0
- package/dist/molecules/curriculumV2/CurriculumSidebar/index.cjs.map +1 -1
- package/dist/molecules/curriculumV2/CurriculumSidebar/index.js +17 -17
- package/dist/molecules/curriculumV2/CurriculumSidebar/sidebar-item.cjs +2 -0
- package/dist/molecules/curriculumV2/CurriculumSidebar/sidebar-item.cjs.map +1 -1
- package/dist/molecules/curriculumV2/CurriculumSidebar/sidebar-item.js +16 -16
- package/dist/molecules/curriculumV2/curriculum-sub-nav.cjs +2 -0
- package/dist/molecules/curriculumV2/curriculum-sub-nav.cjs.map +1 -1
- package/dist/molecules/curriculumV2/curriculum-sub-nav.js +14 -14
- package/dist/molecules/curriculumV2/curriculum-v2-layout.cjs +2 -0
- package/dist/molecules/curriculumV2/curriculum-v2-layout.cjs.map +1 -1
- package/dist/molecules/curriculumV2/curriculum-v2-layout.js +13 -13
- package/dist/molecules/curriculumV2/index.cjs +2 -0
- package/dist/molecules/curriculumV2/index.cjs.map +1 -1
- package/dist/molecules/curriculumV2/index.js +35 -35
- package/dist/molecules/date-picker/date-picker-button.cjs +2 -0
- package/dist/molecules/date-picker/date-picker-button.cjs.map +1 -1
- package/dist/molecules/date-picker/date-picker-button.js +15 -15
- package/dist/molecules/date-picker/index.cjs +2 -0
- package/dist/molecules/date-picker/index.cjs.map +1 -1
- package/dist/molecules/date-picker/index.js +14 -14
- package/dist/molecules/download-card.cjs +1 -0
- package/dist/molecules/download-card.cjs.map +1 -1
- package/dist/molecules/download-card.js +3 -3
- package/dist/molecules/dynamic-field.js +4 -4
- package/dist/molecules/dynamic-form.cjs +2 -0
- package/dist/molecules/dynamic-form.cjs.map +1 -1
- package/dist/molecules/dynamic-form.js +16 -16
- package/dist/molecules/expand-table/index.cjs +2 -0
- package/dist/molecules/expand-table/index.cjs.map +1 -1
- package/dist/molecules/expand-table/index.js +14 -14
- package/dist/molecules/expand-table/row.cjs +2 -0
- package/dist/molecules/expand-table/row.cjs.map +1 -1
- package/dist/molecules/expand-table/row.js +13 -13
- package/dist/molecules/force-refresh.js +2 -2
- package/dist/molecules/ghost-post.cjs +1 -0
- package/dist/molecules/ghost-post.cjs.map +1 -1
- package/dist/molecules/ghost-post.js +4 -4
- package/dist/molecules/index.cjs +2 -0
- package/dist/molecules/index.cjs.map +1 -1
- package/dist/molecules/index.js +54 -54
- package/dist/molecules/learning-post.cjs +1 -0
- package/dist/molecules/learning-post.cjs.map +1 -1
- package/dist/molecules/learning-post.js +5 -5
- package/dist/molecules/navigation.cjs +2 -0
- package/dist/molecules/navigation.cjs.map +1 -1
- package/dist/molecules/navigation.js +14 -14
- package/dist/molecules/radio-button-card.cjs +2 -0
- package/dist/molecules/radio-button-card.cjs.map +1 -1
- package/dist/molecules/radio-button-card.js +13 -13
- package/dist/molecules/stepper.js +3 -3
- package/dist/molecules/tag-selector.cjs +2 -0
- package/dist/molecules/tag-selector.cjs.map +1 -1
- package/dist/molecules/tag-selector.js +14 -14
- package/dist/molecules/time-select.cjs +2 -0
- package/dist/molecules/time-select.cjs.map +1 -1
- package/dist/molecules/time-select.js +14 -14
- package/dist/utils/index.js +3 -3
- package/package.json +1 -1
- package/src/atoms/button.tsx +1 -0
- package/src/atoms/icon-button.tsx +1 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Popover
|
|
3
|
+
} from "./chunk-5AVBYDPB.js";
|
|
4
|
+
import {
|
|
5
|
+
Heading
|
|
6
|
+
} from "./chunk-BESTU2AY.js";
|
|
7
|
+
import {
|
|
8
|
+
IconButton
|
|
9
|
+
} from "./chunk-XK6VEVOK.js";
|
|
10
|
+
import {
|
|
11
|
+
Box
|
|
12
|
+
} from "./chunk-4Y5BEXVN.js";
|
|
13
|
+
import {
|
|
14
|
+
Typo
|
|
15
|
+
} from "./chunk-PMJIFLDT.js";
|
|
16
|
+
import {
|
|
17
|
+
Flex
|
|
18
|
+
} from "./chunk-25HMMI7R.js";
|
|
19
|
+
import {
|
|
20
|
+
Button
|
|
21
|
+
} from "./chunk-ZVDAEY5Q.js";
|
|
22
|
+
import {
|
|
23
|
+
ChevronLeftIcon,
|
|
24
|
+
ChevronRightIcon
|
|
25
|
+
} from "./chunk-V5XKNSCK.js";
|
|
26
|
+
import {
|
|
27
|
+
__objRest,
|
|
28
|
+
__spreadProps,
|
|
29
|
+
__spreadValues
|
|
30
|
+
} from "./chunk-CRTRMMJ7.js";
|
|
31
|
+
|
|
32
|
+
// src/molecules/date-picker/index.tsx
|
|
33
|
+
import { forwardRef, useMemo, useState, useEffect, useRef } from "react";
|
|
34
|
+
import ReactDatePicker from "react-datepicker";
|
|
35
|
+
import { ko } from "date-fns/locale";
|
|
36
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
37
|
+
var DatePicker = forwardRef(
|
|
38
|
+
(props, ref) => {
|
|
39
|
+
const _a = props, { fullWidth } = _a, rest = __objRest(_a, ["fullWidth"]);
|
|
40
|
+
const fullWidthClassName = fullWidth ? "full-width" : "";
|
|
41
|
+
const [isYearDropdownOpen, setIsYearDropdownOpen] = useState(false);
|
|
42
|
+
const [isMonthDropdownOpen, setIsMonthDropdownOpen] = useState(false);
|
|
43
|
+
const renderCustomHeader = useMemo(() => {
|
|
44
|
+
const getYears = () => {
|
|
45
|
+
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
46
|
+
return Array.from(
|
|
47
|
+
{ length: currentYear + 5 - 1920 },
|
|
48
|
+
(_, index) => 1920 + index
|
|
49
|
+
).filter((year) => {
|
|
50
|
+
if (props.minDate && year < props.minDate.getFullYear()) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
if (props.maxDate && year > props.maxDate.getFullYear()) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
return true;
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
return getRenderCustomHeader(__spreadProps(__spreadValues({}, props), {
|
|
60
|
+
years: getYears(),
|
|
61
|
+
isYearDropdownOpen,
|
|
62
|
+
setIsYearDropdownOpen,
|
|
63
|
+
isMonthDropdownOpen,
|
|
64
|
+
setIsMonthDropdownOpen
|
|
65
|
+
}));
|
|
66
|
+
}, [isMonthDropdownOpen, isYearDropdownOpen, props]);
|
|
67
|
+
return /* @__PURE__ */ jsx(Flex, { p: "0", width: "100%", children: /* @__PURE__ */ jsx(
|
|
68
|
+
ReactDatePicker,
|
|
69
|
+
__spreadProps(__spreadValues({
|
|
70
|
+
dateFormat: "yyyy/MM/dd h:mm aa",
|
|
71
|
+
formatWeekDay: (nameOfDay) => {
|
|
72
|
+
return nameOfDay[0];
|
|
73
|
+
},
|
|
74
|
+
locale: ko,
|
|
75
|
+
nextMonthButtonLabel: "\uB2E4\uC74C \uB2EC",
|
|
76
|
+
placeholderText: "YYYY/MM/DD hh:mm AM/PM",
|
|
77
|
+
popperProps: { strategy: "fixed" },
|
|
78
|
+
previousMonthButtonLabel: "\uC774\uC804 \uB2EC",
|
|
79
|
+
ref,
|
|
80
|
+
renderCustomHeader,
|
|
81
|
+
showPopperArrow: false,
|
|
82
|
+
timeCaption: "\uC2DC\uAC04",
|
|
83
|
+
timeFormat: "aa h:mm",
|
|
84
|
+
timeIntervals: 10
|
|
85
|
+
}, rest), {
|
|
86
|
+
calendarClassName: `tipp_datePicker_calendar ${rest.calendarClassName || ""}`,
|
|
87
|
+
wrapperClassName: `tipp_datePicker ${fullWidthClassName} ${rest.wrapperClassName || ""}`
|
|
88
|
+
})
|
|
89
|
+
) });
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
DatePicker.displayName = "DatePicker";
|
|
93
|
+
function DropdownSelector({
|
|
94
|
+
isOpen,
|
|
95
|
+
onOpenChange,
|
|
96
|
+
onSelect,
|
|
97
|
+
options,
|
|
98
|
+
selectedValue,
|
|
99
|
+
suffix
|
|
100
|
+
}) {
|
|
101
|
+
const scrollContainerRef = useRef(null);
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
if (isOpen) {
|
|
104
|
+
queueMicrotask(() => {
|
|
105
|
+
var _a;
|
|
106
|
+
const item = (_a = scrollContainerRef.current) == null ? void 0 : _a.querySelector(
|
|
107
|
+
`[data-year-month-dropdown-tiem="${selectedValue}"]`
|
|
108
|
+
);
|
|
109
|
+
if (item) {
|
|
110
|
+
item.scrollIntoView({ behavior: "instant" });
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}, [isOpen]);
|
|
115
|
+
return /* @__PURE__ */ jsxs(Popover.Root, { modal: true, onOpenChange, open: isOpen, children: [
|
|
116
|
+
/* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(Button, { className: "react-datepicker_dropdown_header", variant: "ghost", children: /* @__PURE__ */ jsxs(Heading, { variant: "heading4", weight: "regular", children: [
|
|
117
|
+
selectedValue,
|
|
118
|
+
suffix
|
|
119
|
+
] }) }) }),
|
|
120
|
+
/* @__PURE__ */ jsx(Popover.Content, { side: "bottom", children: /* @__PURE__ */ jsx(
|
|
121
|
+
Box,
|
|
122
|
+
{
|
|
123
|
+
maxHeight: "200px",
|
|
124
|
+
overflowY: "auto",
|
|
125
|
+
ref: scrollContainerRef,
|
|
126
|
+
style: { scrollbarWidth: "none" },
|
|
127
|
+
children: /* @__PURE__ */ jsx(Flex, { direction: "column", gap: "1", children: options.map((item) => /* @__PURE__ */ jsx(
|
|
128
|
+
Button,
|
|
129
|
+
{
|
|
130
|
+
className: "react-datepicker_dropdown_item",
|
|
131
|
+
color: "gray",
|
|
132
|
+
"data-year-month-dropdown-tiem": item,
|
|
133
|
+
onClick: () => {
|
|
134
|
+
onSelect(item);
|
|
135
|
+
},
|
|
136
|
+
onMouseDown: (e) => {
|
|
137
|
+
e.stopPropagation();
|
|
138
|
+
e.preventDefault();
|
|
139
|
+
},
|
|
140
|
+
variant: "transparent",
|
|
141
|
+
children: /* @__PURE__ */ jsxs(Typo, { weight: item === selectedValue ? "bold" : void 0, children: [
|
|
142
|
+
item,
|
|
143
|
+
suffix
|
|
144
|
+
] })
|
|
145
|
+
},
|
|
146
|
+
item
|
|
147
|
+
)) })
|
|
148
|
+
}
|
|
149
|
+
) })
|
|
150
|
+
] });
|
|
151
|
+
}
|
|
152
|
+
var getRenderCustomHeader = (props) => {
|
|
153
|
+
const renderer = (renderCustomHeaderProps) => {
|
|
154
|
+
const {
|
|
155
|
+
date,
|
|
156
|
+
decreaseMonth,
|
|
157
|
+
increaseMonth,
|
|
158
|
+
prevMonthButtonDisabled,
|
|
159
|
+
nextMonthButtonDisabled,
|
|
160
|
+
changeYear,
|
|
161
|
+
changeMonth
|
|
162
|
+
} = renderCustomHeaderProps;
|
|
163
|
+
const {
|
|
164
|
+
years,
|
|
165
|
+
isYearDropdownOpen,
|
|
166
|
+
setIsYearDropdownOpen,
|
|
167
|
+
isMonthDropdownOpen,
|
|
168
|
+
setIsMonthDropdownOpen
|
|
169
|
+
} = props;
|
|
170
|
+
const year = date ? new Date(date).getFullYear() : "-";
|
|
171
|
+
const month = date ? new Date(date).getMonth() + 1 : "-";
|
|
172
|
+
return /* @__PURE__ */ jsxs(Flex, { align: "center", justify: "between", pl: "2", pr: "2", children: [
|
|
173
|
+
/* @__PURE__ */ jsx(
|
|
174
|
+
IconButton,
|
|
175
|
+
{
|
|
176
|
+
className: "react-datepicker_dropdown_header",
|
|
177
|
+
disabled: prevMonthButtonDisabled,
|
|
178
|
+
onClick: decreaseMonth,
|
|
179
|
+
type: "button",
|
|
180
|
+
variant: "ghost",
|
|
181
|
+
children: /* @__PURE__ */ jsx(ChevronLeftIcon, {})
|
|
182
|
+
}
|
|
183
|
+
),
|
|
184
|
+
/* @__PURE__ */ jsxs(Flex, { gap: "3", children: [
|
|
185
|
+
/* @__PURE__ */ jsx(
|
|
186
|
+
DropdownSelector,
|
|
187
|
+
{
|
|
188
|
+
isOpen: isYearDropdownOpen,
|
|
189
|
+
onOpenChange: setIsYearDropdownOpen,
|
|
190
|
+
onSelect: (value) => {
|
|
191
|
+
changeYear(value);
|
|
192
|
+
setIsYearDropdownOpen(false);
|
|
193
|
+
},
|
|
194
|
+
options: years,
|
|
195
|
+
selectedValue: year,
|
|
196
|
+
suffix: "\uB144"
|
|
197
|
+
}
|
|
198
|
+
),
|
|
199
|
+
/* @__PURE__ */ jsx(
|
|
200
|
+
DropdownSelector,
|
|
201
|
+
{
|
|
202
|
+
isOpen: isMonthDropdownOpen,
|
|
203
|
+
onOpenChange: setIsMonthDropdownOpen,
|
|
204
|
+
onSelect: (value) => {
|
|
205
|
+
changeMonth(value - 1);
|
|
206
|
+
setIsMonthDropdownOpen(false);
|
|
207
|
+
},
|
|
208
|
+
options: Array.from({ length: 12 }, (_, index) => index + 1),
|
|
209
|
+
selectedValue: month,
|
|
210
|
+
suffix: "\uC6D4"
|
|
211
|
+
}
|
|
212
|
+
)
|
|
213
|
+
] }),
|
|
214
|
+
/* @__PURE__ */ jsx(
|
|
215
|
+
IconButton,
|
|
216
|
+
{
|
|
217
|
+
className: "react-datepicker_dropdown_header",
|
|
218
|
+
disabled: nextMonthButtonDisabled,
|
|
219
|
+
onClick: increaseMonth,
|
|
220
|
+
type: "button",
|
|
221
|
+
variant: "ghost",
|
|
222
|
+
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
223
|
+
}
|
|
224
|
+
)
|
|
225
|
+
] });
|
|
226
|
+
};
|
|
227
|
+
return renderer;
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
export {
|
|
231
|
+
DatePicker
|
|
232
|
+
};
|
|
233
|
+
//# sourceMappingURL=chunk-JGGBQ33D.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/molecules/date-picker/index.tsx"],"sourcesContent":["import type { ElementRef } from 'react';\nimport React, { forwardRef, useMemo, useState, useEffect, useRef } from 'react';\nimport type { DatePickerProps as ReactDatePickerProps } from 'react-datepicker';\nimport ReactDatePicker from 'react-datepicker';\nimport { ko } from 'date-fns/locale';\nimport { Box, Button, Popover, Typo } from '@/atoms';\nimport { IconButton } from '../../atoms/icon-button';\nimport { Flex } from '../../atoms/flex';\nimport { ChevronLeftIcon, ChevronRightIcon } from '../../icon';\nimport { Heading } from '../../atoms/heading';\n\nexport type DatePickerProps = ReactDatePickerProps & {\n fullWidth?: boolean;\n};\ntype DatePickerRef = ElementRef<typeof ReactDatePicker>;\n\nexport const DatePicker = forwardRef<DatePickerRef, DatePickerProps>(\n (props, ref): React.ReactNode => {\n const { fullWidth, ...rest } = props;\n const fullWidthClassName = fullWidth ? 'full-width' : '';\n const [isYearDropdownOpen, setIsYearDropdownOpen] = useState(false);\n const [isMonthDropdownOpen, setIsMonthDropdownOpen] = useState(false);\n\n const renderCustomHeader = useMemo(() => {\n const getYears = (): number[] => {\n const currentYear = new Date().getFullYear();\n return Array.from(\n { length: currentYear + 5 - 1920 },\n (_, index) => 1920 + index\n ).filter((year) => {\n if (props.minDate && year < props.minDate.getFullYear()) {\n return false;\n }\n if (props.maxDate && year > props.maxDate.getFullYear()) {\n return false;\n }\n return true;\n });\n };\n\n return getRenderCustomHeader({\n ...props,\n years: getYears(),\n isYearDropdownOpen,\n setIsYearDropdownOpen,\n isMonthDropdownOpen,\n setIsMonthDropdownOpen,\n });\n }, [isMonthDropdownOpen, isYearDropdownOpen, props]);\n\n return (\n <Flex p=\"0\" width=\"100%\">\n <ReactDatePicker\n dateFormat=\"yyyy/MM/dd h:mm aa\"\n formatWeekDay={(nameOfDay) => {\n return nameOfDay[0];\n }}\n locale={ko}\n nextMonthButtonLabel=\"다음 달\"\n placeholderText=\"YYYY/MM/DD hh:mm AM/PM\"\n popperProps={{ strategy: 'fixed' }}\n previousMonthButtonLabel=\"이전 달\"\n ref={ref}\n renderCustomHeader={renderCustomHeader}\n showPopperArrow={false}\n timeCaption=\"시간\"\n timeFormat=\"aa h:mm\"\n timeIntervals={10}\n {...rest}\n calendarClassName={`tipp_datePicker_calendar ${rest.calendarClassName || ''}`}\n wrapperClassName={`tipp_datePicker ${fullWidthClassName} ${rest.wrapperClassName || ''}`}\n />\n </Flex>\n );\n }\n);\n\nDatePicker.displayName = 'DatePicker';\n\ninterface DropdownSelectorProps {\n isOpen: boolean;\n onOpenChange: (open: boolean) => void;\n onSelect: (value: number) => void;\n options: number[];\n selectedValue: number | string;\n suffix: string;\n}\n\nfunction DropdownSelector({\n isOpen,\n onOpenChange,\n onSelect,\n options,\n selectedValue,\n suffix,\n}: DropdownSelectorProps): React.JSX.Element {\n const scrollContainerRef = useRef<HTMLDivElement>(null);\n useEffect(() => {\n if (isOpen) {\n queueMicrotask(() => {\n const item = scrollContainerRef.current?.querySelector(\n `[data-year-month-dropdown-tiem=\"${selectedValue}\"]`\n );\n if (item) {\n item.scrollIntoView({ behavior: 'instant' });\n }\n });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps -- 트리거 최적화\n }, [isOpen]);\n\n return (\n <Popover.Root modal onOpenChange={onOpenChange} open={isOpen}>\n <Popover.Trigger>\n <Button className=\"react-datepicker_dropdown_header\" variant=\"ghost\">\n <Heading variant=\"heading4\" weight=\"regular\">\n {selectedValue}\n {suffix}\n </Heading>\n </Button>\n </Popover.Trigger>\n <Popover.Content side=\"bottom\">\n <Box\n maxHeight=\"200px\"\n overflowY=\"auto\"\n ref={scrollContainerRef}\n style={{ scrollbarWidth: 'none' }}\n >\n <Flex direction=\"column\" gap=\"1\">\n {options.map((item: number) => (\n <Button\n className=\"react-datepicker_dropdown_item\"\n color=\"gray\"\n data-year-month-dropdown-tiem={item}\n key={item}\n onClick={() => {\n onSelect(item);\n }}\n onMouseDown={(e) => {\n e.stopPropagation();\n e.preventDefault();\n }}\n variant=\"transparent\"\n >\n <Typo weight={item === selectedValue ? 'bold' : undefined}>\n {item}\n {suffix}\n </Typo>\n </Button>\n ))}\n </Flex>\n </Box>\n </Popover.Content>\n </Popover.Root>\n );\n}\n\nconst getRenderCustomHeader: (\n props: ReactDatePickerProps & {\n years: number[];\n isYearDropdownOpen: boolean;\n setIsYearDropdownOpen: (show: boolean) => void;\n isMonthDropdownOpen: boolean;\n setIsMonthDropdownOpen: (show: boolean) => void;\n }\n) => ReactDatePickerProps['renderCustomHeader'] = (props) => {\n const renderer: ReactDatePickerProps['renderCustomHeader'] = (\n renderCustomHeaderProps\n ) => {\n const {\n date,\n decreaseMonth,\n increaseMonth,\n prevMonthButtonDisabled,\n nextMonthButtonDisabled,\n changeYear,\n changeMonth,\n } = renderCustomHeaderProps;\n const {\n years,\n isYearDropdownOpen,\n setIsYearDropdownOpen,\n isMonthDropdownOpen,\n setIsMonthDropdownOpen,\n } = props;\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- date가 undefined일 수 있음\n const year = date ? new Date(date).getFullYear() : '-';\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- date가 undefined일 수 있음\n const month = date ? new Date(date).getMonth() + 1 : '-';\n\n return (\n <Flex align=\"center\" justify=\"between\" pl=\"2\" pr=\"2\">\n <IconButton\n className=\"react-datepicker_dropdown_header\"\n disabled={prevMonthButtonDisabled}\n onClick={decreaseMonth}\n type=\"button\"\n variant=\"ghost\"\n >\n <ChevronLeftIcon />\n </IconButton>\n <Flex gap=\"3\">\n <DropdownSelector\n isOpen={isYearDropdownOpen}\n onOpenChange={setIsYearDropdownOpen}\n onSelect={(value) => {\n changeYear(value);\n setIsYearDropdownOpen(false);\n }}\n options={years}\n selectedValue={year}\n suffix=\"년\"\n />\n <DropdownSelector\n isOpen={isMonthDropdownOpen}\n onOpenChange={setIsMonthDropdownOpen}\n onSelect={(value) => {\n changeMonth(value - 1);\n setIsMonthDropdownOpen(false);\n }}\n options={Array.from({ length: 12 }, (_, index) => index + 1)}\n selectedValue={month}\n suffix=\"월\"\n />\n </Flex>\n\n <IconButton\n className=\"react-datepicker_dropdown_header\"\n disabled={nextMonthButtonDisabled}\n onClick={increaseMonth}\n type=\"button\"\n variant=\"ghost\"\n >\n <ChevronRightIcon />\n </IconButton>\n </Flex>\n );\n };\n return renderer;\n};\n\n// DatePicker.displayName = 'DatePicker';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAgB,YAAY,SAAS,UAAU,WAAW,cAAc;AAExE,OAAO,qBAAqB;AAC5B,SAAS,UAAU;AAgDX,cA+DE,YA/DF;AApCD,IAAM,aAAa;AAAA,EACxB,CAAC,OAAO,QAAyB;AAC/B,UAA+B,YAAvB,YAlBZ,IAkBmC,IAAT,iBAAS,IAAT,CAAd;AACR,UAAM,qBAAqB,YAAY,eAAe;AACtD,UAAM,CAAC,oBAAoB,qBAAqB,IAAI,SAAS,KAAK;AAClE,UAAM,CAAC,qBAAqB,sBAAsB,IAAI,SAAS,KAAK;AAEpE,UAAM,qBAAqB,QAAQ,MAAM;AACvC,YAAM,WAAW,MAAgB;AAC/B,cAAM,eAAc,oBAAI,KAAK,GAAE,YAAY;AAC3C,eAAO,MAAM;AAAA,UACX,EAAE,QAAQ,cAAc,IAAI,KAAK;AAAA,UACjC,CAAC,GAAG,UAAU,OAAO;AAAA,QACvB,EAAE,OAAO,CAAC,SAAS;AACjB,cAAI,MAAM,WAAW,OAAO,MAAM,QAAQ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Pagination
|
|
9
|
+
} from "./chunk-IWBIHII5.js";
|
|
10
|
+
import {
|
|
11
|
+
Typo
|
|
12
|
+
} from "./chunk-PMJIFLDT.js";
|
|
13
|
+
import {
|
|
14
|
+
Flex
|
|
15
|
+
} from "./chunk-25HMMI7R.js";
|
|
16
|
+
import {
|
|
17
|
+
TriangleArrowUpIcon
|
|
18
|
+
} from "./chunk-2O45FRFQ.js";
|
|
19
|
+
import {
|
|
20
|
+
TriangleArrowDownIcon
|
|
21
|
+
} from "./chunk-776WBOKL.js";
|
|
22
|
+
|
|
23
|
+
// src/molecules/expand-table/index.tsx
|
|
24
|
+
import {
|
|
25
|
+
flexRender,
|
|
26
|
+
getCoreRowModel,
|
|
27
|
+
useReactTable,
|
|
28
|
+
getSortedRowModel,
|
|
29
|
+
createColumnHelper,
|
|
30
|
+
getPaginationRowModel
|
|
31
|
+
} from "@tanstack/react-table";
|
|
32
|
+
import { useCallback, useMemo, useState } from "react";
|
|
33
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
34
|
+
function ExpandTable(props) {
|
|
35
|
+
const {
|
|
36
|
+
data,
|
|
37
|
+
columns,
|
|
38
|
+
ExpandComp,
|
|
39
|
+
placeholder,
|
|
40
|
+
onRowClick,
|
|
41
|
+
tableStyle,
|
|
42
|
+
showPagination = true,
|
|
43
|
+
isLoading,
|
|
44
|
+
pageIndex = 0,
|
|
45
|
+
pageSize = 10,
|
|
46
|
+
siblingCount = 2,
|
|
47
|
+
getRowStyle,
|
|
48
|
+
getCellStyle
|
|
49
|
+
} = props;
|
|
50
|
+
const defaultAlign = "left";
|
|
51
|
+
const [pagination, setPagination] = useState({
|
|
52
|
+
pageIndex: pageIndex || 0,
|
|
53
|
+
pageSize: pageSize || 9999
|
|
54
|
+
});
|
|
55
|
+
const [sorting, setSorting] = useState([]);
|
|
56
|
+
const { getRowModel, getHeaderGroups, setPageIndex } = useReactTable({
|
|
57
|
+
data: data || [],
|
|
58
|
+
columns,
|
|
59
|
+
getCoreRowModel: getCoreRowModel(),
|
|
60
|
+
getSortedRowModel: getSortedRowModel(),
|
|
61
|
+
state: {
|
|
62
|
+
sorting,
|
|
63
|
+
pagination
|
|
64
|
+
},
|
|
65
|
+
onSortingChange: setSorting,
|
|
66
|
+
getPaginationRowModel: getPaginationRowModel(),
|
|
67
|
+
onPaginationChange: setPagination
|
|
68
|
+
});
|
|
69
|
+
const gridTemplateColumns = useMemo(() => {
|
|
70
|
+
return columns.map((col) => {
|
|
71
|
+
var _a;
|
|
72
|
+
if ((_a = col.meta) == null ? void 0 : _a.autoSize) return `minmax(${col.size || 50}px, 1fr)`;
|
|
73
|
+
return `${col.size || 150}px`;
|
|
74
|
+
}).join(" ");
|
|
75
|
+
}, [columns]);
|
|
76
|
+
const rowModels = getRowModel();
|
|
77
|
+
const onChangePagination = useCallback(
|
|
78
|
+
(page) => {
|
|
79
|
+
setPageIndex(page - 1);
|
|
80
|
+
},
|
|
81
|
+
[setPageIndex]
|
|
82
|
+
);
|
|
83
|
+
const helpCompRender = useCallback(
|
|
84
|
+
(rowLength) => {
|
|
85
|
+
if (isLoading) {
|
|
86
|
+
return /* @__PURE__ */ jsx(
|
|
87
|
+
Flex,
|
|
88
|
+
{
|
|
89
|
+
align: "center",
|
|
90
|
+
height: "100%",
|
|
91
|
+
justify: "center",
|
|
92
|
+
p: "5",
|
|
93
|
+
width: "100%",
|
|
94
|
+
children: /* @__PURE__ */ jsx(Spinner, {})
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
if (rowLength === 0) {
|
|
99
|
+
return /* @__PURE__ */ jsx("div", { className: "tr", children: /* @__PURE__ */ jsx(Flex, { align: "center", justify: "center", children: placeholder || /* @__PURE__ */ jsx(Typo, { color: "gray", mb: "6", mt: "6", variant: "body", children: "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4" }) }) }, "expand_placeholder");
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
},
|
|
103
|
+
[isLoading, placeholder]
|
|
104
|
+
);
|
|
105
|
+
const pageCount = useMemo(() => {
|
|
106
|
+
if (!data) return 0;
|
|
107
|
+
return Math.ceil(data.length / pageSize);
|
|
108
|
+
}, [data, pageSize]);
|
|
109
|
+
return /* @__PURE__ */ jsxs("div", { className: "expand-table-wrapper", children: [
|
|
110
|
+
/* @__PURE__ */ jsxs("div", { className: "expand-table", style: tableStyle, children: [
|
|
111
|
+
/* @__PURE__ */ jsx("div", { className: "thead", children: getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx(
|
|
112
|
+
"div",
|
|
113
|
+
{
|
|
114
|
+
className: "tr",
|
|
115
|
+
style: { gridTemplateColumns },
|
|
116
|
+
children: headerGroup.headers.map((header) => {
|
|
117
|
+
var _a;
|
|
118
|
+
const sortable = header.column.getCanSort();
|
|
119
|
+
const sortedState = header.column.getIsSorted();
|
|
120
|
+
const justifyContent = ((_a = header.column.columnDef.meta) == null ? void 0 : _a.align) || defaultAlign;
|
|
121
|
+
return /* @__PURE__ */ jsx("div", { className: `${justifyContent} th`, children: /* @__PURE__ */ jsxs(
|
|
122
|
+
"button",
|
|
123
|
+
{
|
|
124
|
+
onClick: header.column.getToggleSortingHandler(),
|
|
125
|
+
style: sortable ? { cursor: "pointer" } : { cursor: "default" },
|
|
126
|
+
type: "button",
|
|
127
|
+
children: [
|
|
128
|
+
/* @__PURE__ */ jsx(Typo, { as: "div", variant: "body", children: flexRender(
|
|
129
|
+
header.column.columnDef.header,
|
|
130
|
+
header.getContext()
|
|
131
|
+
) }),
|
|
132
|
+
sortable ? /* @__PURE__ */ jsxs(
|
|
133
|
+
Flex,
|
|
134
|
+
{
|
|
135
|
+
direction: "column",
|
|
136
|
+
style: { marginLeft: "var(--space-2)" },
|
|
137
|
+
children: [
|
|
138
|
+
/* @__PURE__ */ jsx(
|
|
139
|
+
TriangleArrowUpIcon,
|
|
140
|
+
{
|
|
141
|
+
color: sortedState === "asc" ? "var(--iris-10)" : "var(--iris-6)"
|
|
142
|
+
}
|
|
143
|
+
),
|
|
144
|
+
/* @__PURE__ */ jsx(
|
|
145
|
+
TriangleArrowDownIcon,
|
|
146
|
+
{
|
|
147
|
+
color: sortedState === "desc" ? "var(--iris-10)" : "var(--iris-6)"
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
) : null
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
) }, header.id);
|
|
156
|
+
})
|
|
157
|
+
},
|
|
158
|
+
headerGroup.id
|
|
159
|
+
)) }),
|
|
160
|
+
/* @__PURE__ */ jsx("div", { className: "tbody", children: helpCompRender(rowModels.rows.length) || rowModels.rows.map((row) => {
|
|
161
|
+
return /* @__PURE__ */ jsx(
|
|
162
|
+
Row,
|
|
163
|
+
{
|
|
164
|
+
ExpandComp,
|
|
165
|
+
defaultAlign,
|
|
166
|
+
getCellStyle,
|
|
167
|
+
getRowStyle,
|
|
168
|
+
gridTemplateColumns,
|
|
169
|
+
onRowClick,
|
|
170
|
+
row
|
|
171
|
+
},
|
|
172
|
+
`row_${row.id}`
|
|
173
|
+
);
|
|
174
|
+
}) })
|
|
175
|
+
] }),
|
|
176
|
+
showPagination ? /* @__PURE__ */ jsx(Flex, { justify: "end", pt: "3", width: "100%", children: /* @__PURE__ */ jsx(
|
|
177
|
+
Pagination,
|
|
178
|
+
{
|
|
179
|
+
count: pageCount,
|
|
180
|
+
onChange: onChangePagination,
|
|
181
|
+
page: pagination.pageIndex + 1,
|
|
182
|
+
siblingCount
|
|
183
|
+
}
|
|
184
|
+
) }) : null
|
|
185
|
+
] });
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export {
|
|
189
|
+
createColumnHelper,
|
|
190
|
+
ExpandTable
|
|
191
|
+
};
|
|
192
|
+
//# sourceMappingURL=chunk-JHM7EMDO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/molecules/expand-table/index.tsx"],"sourcesContent":["import type {\n ColumnDef,\n SortingState,\n RowData,\n Row as RowType,\n PaginationState,\n} from '@tanstack/react-table';\nimport type { CSSProperties } from 'react';\nimport {\n flexRender,\n getCoreRowModel,\n useReactTable,\n getSortedRowModel,\n createColumnHelper,\n getPaginationRowModel,\n} from '@tanstack/react-table';\nimport React, { useCallback, useMemo, useState } from 'react';\nimport { Flex, Pagination, Spinner, Typo } from '../../atoms';\nimport { TriangleArrowDownIcon } from '../../icons/down';\nimport { TriangleArrowUpIcon } from '../../icons/up';\nimport { Row, type ExpandComp, type OnRowClick } from './row';\n\nexport type { ExpandComp, OnRowClick, ColumnDef, RowType as Row };\nexport { createColumnHelper };\n\nexport interface ExpandTableProps<Datum extends RowData> {\n /** 렌더할 데이터 배열 */\n data?: Datum[];\n /** 테이블 컬럼의 메타 데이터 */\n columns: ColumnDef<Datum>[];\n /** Row의 open이 true인 경우 하단의 collapse에 렌더할 컴포넌트 */\n ExpandComp?: ExpandComp<Datum>;\n /** 데이테가 없을 시 화면에 표시할 컴포넌트 */\n placeholder?: React.ReactNode;\n /** 행 클릭 시 실행할 콜백 */\n onRowClick?: OnRowClick<Datum>;\n getRowStyle?: (data: Datum) => CSSProperties;\n getCellStyle?: (data: Datum) => CSSProperties;\n tableStyle?: CSSProperties;\n isLoading?: boolean;\n\n /** pagination - 표시 유무, 기본값 true */\n showPagination?: boolean;\n /** pagination - 현재 선택된 페이지, 0부터 시작 */\n pageIndex?: number;\n /** pagination - 한 페이지에 표시될 컬럼 개수, 기본값 10 */\n pageSize?: number;\n /** pagination - */\n siblingCount?: number;\n}\n\nexport function ExpandTable<Datum extends RowData>(\n props: ExpandTableProps<Datum>\n): React.ReactNode {\n const {\n data,\n columns,\n ExpandComp,\n placeholder,\n onRowClick,\n tableStyle,\n showPagination = true,\n isLoading,\n pageIndex = 0,\n pageSize = 10,\n siblingCount = 2,\n getRowStyle,\n getCellStyle,\n } = props;\n const defaultAlign = 'left';\n const [pagination, setPagination] = useState<PaginationState>({\n pageIndex: pageIndex || 0,\n pageSize: pageSize || 9999,\n });\n\n const [sorting, setSorting] = useState<SortingState>([]);\n const { getRowModel, getHeaderGroups, setPageIndex } = useReactTable({\n data: data || [],\n columns,\n getCoreRowModel: getCoreRowModel(),\n getSortedRowModel: getSortedRowModel(),\n state: {\n sorting,\n pagination,\n },\n onSortingChange: setSorting,\n getPaginationRowModel: getPaginationRowModel(),\n onPaginationChange: setPagination,\n });\n\n const gridTemplateColumns = useMemo<string>(() => {\n return columns\n .map((col) => {\n if (col.meta?.autoSize) return `minmax(${col.size || 50}px, 1fr)`;\n return `${col.size || 150}px`;\n })\n .join(' ');\n }, [columns]);\n\n const rowModels = getRowModel();\n\n const onChangePagination = useCallback(\n (page: number) => {\n setPageIndex(page - 1);\n },\n [setPageIndex]\n );\n\n const helpCompRender = useCallback(\n (rowLength: number) => {\n if (isLoading) {\n return (\n <Flex\n align=\"center\"\n height=\"100%\"\n justify=\"center\"\n p=\"5\"\n width=\"100%\"\n >\n <Spinner />\n </Flex>\n );\n }\n if (rowLength === 0) {\n return (\n <div className=\"tr\" key=\"expand_placeholder\">\n <Flex align=\"center\" justify=\"center\">\n {placeholder || (\n <Typo color=\"gray\" mb=\"6\" mt=\"6\" variant=\"body\">\n 데이터가 없습니다\n </Typo>\n )}\n </Flex>\n </div>\n );\n }\n return null;\n },\n [isLoading, placeholder]\n );\n\n const pageCount = useMemo(() => {\n if (!data) return 0;\n return Math.ceil(data.length / pageSize);\n }, [data, pageSize]);\n\n return (\n <div className=\"expand-table-wrapper\">\n <div className=\"expand-table\" style={tableStyle}>\n <div className=\"thead\">\n {getHeaderGroups().map((headerGroup) => (\n <div\n className=\"tr\"\n key={headerGroup.id}\n style={{ gridTemplateColumns }}\n >\n {headerGroup.headers.map((header) => {\n const sortable = header.column.getCanSort();\n const sortedState = header.column.getIsSorted();\n const justifyContent =\n header.column.columnDef.meta?.align || defaultAlign;\n\n return (\n <div className={`${justifyContent} th`} key={header.id}>\n <button\n onClick={header.column.getToggleSortingHandler()}\n style={\n sortable ? { cursor: 'pointer' } : { cursor: 'default' }\n }\n type=\"button\"\n >\n <Typo as=\"div\" variant=\"body\">\n {flexRender(\n header.column.columnDef.header,\n header.getContext()\n )}\n </Typo>\n {sortable ? (\n <Flex\n direction=\"column\"\n style={{ marginLeft: 'var(--space-2)' }}\n >\n <TriangleArrowUpIcon\n color={\n sortedState === 'asc'\n ? 'var(--iris-10)'\n : 'var(--iris-6)'\n }\n />\n <TriangleArrowDownIcon\n color={\n sortedState === 'desc'\n ? 'var(--iris-10)'\n : 'var(--iris-6)'\n }\n />\n </Flex>\n ) : null}\n </button>\n </div>\n );\n })}\n </div>\n ))}\n </div>\n <div className=\"tbody\">\n {/* 조건에 따라 placeholder 또는 loading 렌더*/}\n {helpCompRender(rowModels.rows.length) ||\n rowModels.rows.map((row) => {\n return (\n <Row\n ExpandComp={ExpandComp}\n defaultAlign={defaultAlign}\n getCellStyle={getCellStyle}\n getRowStyle={getRowStyle}\n gridTemplateColumns={gridTemplateColumns}\n key={`row_${row.id}`}\n onRowClick={onRowClick}\n row={row}\n />\n );\n })}\n </div>\n </div>\n {showPagination ? (\n <Flex justify=\"end\" pt=\"3\" width=\"100%\">\n <Pagination\n count={pageCount}\n onChange={onChangePagination}\n page={pagination.pageIndex + 1}\n siblingCount={siblingCount}\n />\n </Flex>\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAQA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAgB,aAAa,SAAS,gBAAgB;AAuG1C,cA2DU,YA3DV;AApEL,SAAS,YACd,OACiB;AACjB,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,iBAAiB;AAAA,IACjB;AAAA,IACA,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,eAAe;AAAA,IACf;AAAA,I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AA,wBAER;AAAA,wBACA;AAAA,0BAAC;AAAA;AAAA,4BACC,OACE,gBAAgB,SACZ,mBACA;AAAA;AAAA,wBAER;AAAA;AAAA;AAAA,kBACF,IACE;AAAA;AAAA;AAAA,YACN,KAnC2C,OAAO,EAoCpD;AAAA,UAEJ,CAAC;AAAA;AAAA,QAhDI,YAAY;AAAA,MAiDnB,CACD,GACH;AAAA,MACA,oBAAC,SAAI,WAAU,SAEZ,yBAAe,UAAU,KAAK,MAAM,KACnC,UAAU,KAAK,IAAI,CAAC,QAAQ;AAC1B,eACE;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YAEA;AAAA,YACA;AAAA;AAAA,UAFK,OAAO,IAAI,EAAE;AAAA,QAGpB;AAAA,MAEJ,CAAC,GACL;AAAA,OACF;AAAA,IACG,iBACG,oBAAC,QAAK,SAAQ,OAAM,IAAG,KAAI,OAAM,QAC/B;AAAA,MAAC;AAAA;AAAA,QACC,OAAO;AAAA,QACP,UAAU;AAAA,QACV,MAAM,WAAW,YAAY;AAAA,QAC7B;AAAA;AAAA,IACF,GACF,IACE;AAAA,KACR;AAEJ;","names":[]}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DataList
|
|
3
|
+
} from "./chunk-VTJZMOSP.js";
|
|
4
|
+
import {
|
|
5
|
+
Button
|
|
6
|
+
} from "./chunk-ZVDAEY5Q.js";
|
|
7
|
+
|
|
8
|
+
// src/app/platform/userInfos/utils.tsx
|
|
9
|
+
import { format } from "date-fns";
|
|
10
|
+
import { CopyIcon } from "@radix-ui/react-icons";
|
|
11
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
var infoList = [
|
|
13
|
+
{ label: "\uC774\uB984", getValue: (customer) => customer == null ? void 0 : customer.username },
|
|
14
|
+
{ label: "\uC131\uBCC4", getValue: (customer) => customer == null ? void 0 : customer.gender },
|
|
15
|
+
{
|
|
16
|
+
label: "\uC0DD\uB144\uC6D4\uC77C",
|
|
17
|
+
getValue: (customer) => (customer == null ? void 0 : customer.birthdate) && format(customer.birthdate, "yyyy.MM.dd")
|
|
18
|
+
},
|
|
19
|
+
{ label: "\uBD80\uC11C", getValue: (customer) => customer == null ? void 0 : customer.team },
|
|
20
|
+
{ label: "\uC9C1\uCC45", getValue: (customer) => customer == null ? void 0 : customer.position },
|
|
21
|
+
{ label: "\uC9C1\uAE09", getValue: (customer) => customer == null ? void 0 : customer.level },
|
|
22
|
+
{ label: "\uC774\uBA54\uC77C", getValue: (customer) => customer == null ? void 0 : customer.email, copyable: true },
|
|
23
|
+
{
|
|
24
|
+
label: "\uC804\uD654\uBC88\uD638",
|
|
25
|
+
getValue: (customer) => customer == null ? void 0 : customer.phone,
|
|
26
|
+
render: (value) => {
|
|
27
|
+
return value == null ? void 0 : value.replace(/[^0-9]/g, "").replace(/^(\d{2,3})(\d{3,4})(\d{4})$/, `$1-$2-$3`);
|
|
28
|
+
},
|
|
29
|
+
copyable: true
|
|
30
|
+
}
|
|
31
|
+
];
|
|
32
|
+
var sessionStatusChecker = (value, session) => {
|
|
33
|
+
if ((session == null ? void 0 : session.state) === "inProgress") {
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
return "-";
|
|
37
|
+
};
|
|
38
|
+
var sessionList = [
|
|
39
|
+
{
|
|
40
|
+
label: "\uC9C4\uD589\uC911\uC778 \uC138\uC158",
|
|
41
|
+
getValue: (session) => {
|
|
42
|
+
const { currentSession, totalSession } = session || {};
|
|
43
|
+
if (currentSession && totalSession && currentSession > totalSession) {
|
|
44
|
+
return "-";
|
|
45
|
+
}
|
|
46
|
+
return sessionStatusChecker(
|
|
47
|
+
`${currentSession || "-"}\uD68C\uCC28/${totalSession || "-"}\uD68C\uCC28`,
|
|
48
|
+
session
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
label: "\uB2E4\uC74C \uC138\uC158 \uC77C\uC2DC",
|
|
54
|
+
getValue: (session) => sessionStatusChecker(
|
|
55
|
+
(session == null ? void 0 : session.nextSessionDate) ? format(session.nextSessionDate, "yyyy\uB144 MM\uC6D4 dd\uC77C HH\uC2DC mm\uBD84") : "-",
|
|
56
|
+
session
|
|
57
|
+
)
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
label: "\uB2E4\uC74C \uC138\uC158 \uCC38\uC5EC \uBC29\uC2DD",
|
|
61
|
+
getValue: (session) => sessionStatusChecker((session == null ? void 0 : session.nextSessionType) || "-", session)
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
label: "\uCF54\uCE6D \uB9CC\uB8CC \uAE30\uD55C",
|
|
65
|
+
getValue: (session) => (session == null ? void 0 : session.expiredAt) ? format(session.expiredAt, "yyyy\uB144 MM\uC6D4 dd\uC77C") : "-"
|
|
66
|
+
}
|
|
67
|
+
];
|
|
68
|
+
var renderItem = (args) => {
|
|
69
|
+
const { info, data, onClickCopy } = args;
|
|
70
|
+
const value = info.getValue(data);
|
|
71
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
72
|
+
info.render ? info.render(value) : value || "-",
|
|
73
|
+
info.copyable && value ? /* @__PURE__ */ jsx(CopyButton, { onClickCopy, value }) : null
|
|
74
|
+
] });
|
|
75
|
+
};
|
|
76
|
+
var renderDataListItem = (args) => {
|
|
77
|
+
const { info, data, onClickCopy } = args;
|
|
78
|
+
return /* @__PURE__ */ jsxs(DataList.Item, { children: [
|
|
79
|
+
/* @__PURE__ */ jsx(DataList.Label, { children: info.label }),
|
|
80
|
+
/* @__PURE__ */ jsx(DataList.Value, { children: renderItem({ info, data, onClickCopy }) })
|
|
81
|
+
] }, info.label);
|
|
82
|
+
};
|
|
83
|
+
function CopyButton(props) {
|
|
84
|
+
const { value, onClickCopy } = props;
|
|
85
|
+
return /* @__PURE__ */ jsx(
|
|
86
|
+
Button,
|
|
87
|
+
{
|
|
88
|
+
color: "gray",
|
|
89
|
+
onClick: () => {
|
|
90
|
+
onClickCopy(value);
|
|
91
|
+
},
|
|
92
|
+
style: { marginLeft: "0", marginTop: "0" },
|
|
93
|
+
variant: "transparent",
|
|
94
|
+
children: /* @__PURE__ */ jsx(CopyIcon, {})
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export {
|
|
100
|
+
infoList,
|
|
101
|
+
sessionList,
|
|
102
|
+
renderItem,
|
|
103
|
+
renderDataListItem,
|
|
104
|
+
CopyButton
|
|
105
|
+
};
|
|
106
|
+
//# sourceMappingURL=chunk-JWAQUXGB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/app/platform/userInfos/utils.tsx"],"sourcesContent":["import type { ProjectStatus } from '@tipp/biz-utils';\nimport { format } from 'date-fns';\nimport { CopyIcon } from '@radix-ui/react-icons';\nimport { Button, DataList } from '../../../atoms';\n\nexport interface CoachingCustomerInfoProps {\n customer?: Customer;\n session?: Session;\n children?: React.ReactNode;\n badge?: React.ReactNode;\n onClickCopy: (value: string) => void;\n}\n\nexport interface Customer {\n username?: string;\n email?: string;\n gender?: string;\n birthdate?: Date;\n phone?: string;\n company?: string;\n team?: string;\n position?: string;\n level: string;\n}\n\nexport interface Session {\n state?: ProjectStatus;\n totalSession?: number;\n currentSession?: number;\n nextSessionDate?: Date;\n nextSessionType?: string;\n expiredAt?: Date;\n}\n\nexport interface DataListItems<T> {\n label: string;\n getValue: (original?: T) => string | undefined;\n copyable?: boolean;\n render?: (value?: string) => React.ReactNode;\n}\n\nexport const infoList: DataListItems<Customer>[] = [\n { label: '이름', getValue: (customer) => customer?.username },\n { label: '성별', getValue: (customer) => customer?.gender },\n {\n label: '생년월일',\n getValue: (customer) =>\n customer?.birthdate && format(customer.birthdate, 'yyyy.MM.dd'),\n },\n { label: '부서', getValue: (customer) => customer?.team },\n { label: '직책', getValue: (customer) => customer?.position },\n { label: '직급', getValue: (customer) => customer?.level },\n { label: '이메일', getValue: (customer) => customer?.email, copyable: true },\n {\n label: '전화번호',\n getValue: (customer) => customer?.phone,\n render: (value) => {\n // 핸드폰 전화번호 형식으로 변환\n return (\n value\n ?.replace(/[^0-9]/g, '')\n // eslint-disable-next-line prefer-named-capture-group -- target es 변경하기 전이라서 이대로 둠\n .replace(/^(\\d{2,3})(\\d{3,4})(\\d{4})$/, `$1-$2-$3`)\n );\n },\n copyable: true,\n },\n];\n\nconst sessionStatusChecker = <T,>(value: T, session?: Session): T | string => {\n if (session?.state === 'inProgress') {\n return value;\n }\n return '-';\n};\n\nexport const sessionList: DataListItems<Session>[] = [\n {\n label: '진행중인 세션',\n getValue: (session) => {\n const { currentSession, totalSession } = session || {};\n if (currentSession && totalSession && currentSession > totalSession) {\n return '-';\n }\n\n return sessionStatusChecker(\n `${currentSession || '-'}회차/${totalSession || '-'}회차`,\n session\n );\n },\n },\n {\n label: '다음 세션 일시',\n getValue: (session) =>\n sessionStatusChecker(\n session?.nextSessionDate\n ? format(session.nextSessionDate, 'yyyy년 MM월 dd일 HH시 mm분')\n : '-',\n session\n ),\n },\n {\n label: '다음 세션 참여 방식',\n getValue: (session) =>\n sessionStatusChecker(session?.nextSessionType || '-', session),\n },\n {\n label: '코칭 만료 기한',\n getValue: (session) =>\n session?.expiredAt ? format(session.expiredAt, 'yyyy년 MM월 dd일') : '-',\n },\n];\n\nexport const renderItem = <T extends object>(args: {\n info: DataListItems<T>;\n data?: T;\n onClickCopy: (value: string) => void;\n}): React.ReactNode => {\n const { info, data, onClickCopy } = args;\n const value = info.getValue(data);\n return (\n <>\n {info.render ? info.render(value) : value || '-'}\n {info.copyable && value ? (\n <CopyButton onClickCopy={onClickCopy} value={value} />\n ) : null}\n </>\n );\n};\n\nexport const renderDataListItem = <T extends object>(args: {\n info: DataListItems<T>;\n data?: T;\n onClickCopy: (value: string) => void;\n}): React.ReactNode => {\n const { info, data, onClickCopy } = args;\n return (\n <DataList.Item key={info.label}>\n <DataList.Label>{info.label}</DataList.Label>\n <DataList.Value>{renderItem({ info, data, onClickCopy })}</DataList.Value>\n </DataList.Item>\n );\n};\n\nexport function CopyButton(props: {\n value: string;\n onClickCopy: (value: string) => void;\n}): React.ReactNode {\n const { value, onClickCopy } = props;\n return (\n <Button\n color=\"gray\"\n onClick={() => {\n onClickCopy(value);\n }}\n style={{ marginLeft: '0', marginTop: '0' }}\n variant=\"transparent\"\n >\n <CopyIcon />\n </Button>\n );\n}\n"],"mappings":";;;;;;;;AACA,SAAS,cAAc;AACvB,SAAS,gBAAgB;AAuHrB,mBAGI,KAHJ;AAhFG,IAAM,WAAsC;AAAA,EACjD,EAAE,OAAO,gBAAM,UAAU,CAAC,aAAa,qCAAU,SAAS;AAAA,EAC1D,EAAE,OAAO,gBAAM,UAAU,CAAC,aAAa,qCAAU,OAAO;AAAA,EACxD;AAAA,IACE,OAAO;AAAA,IACP,UAAU,CAAC,cACT,qCAAU,cAAa,OAAO,SAAS,WAAW,YAAY;AAAA,EAClE;AAAA,EACA,EAAE,OAAO,gBAAM,UAAU,CAAC,aAAa,qCAAU,KAAK;AAAA,EACtD,EAAE,OAAO,gBAAM,UAAU,CAAC,aAAa,qCAAU,SAAS;AAAA,EAC1D,EAAE,OAAO,gBAAM,UAAU,CAAC,aAAa,qCAAU,MAAM;AAAA,EACvD,EAAE,OAAO,sBAAO,UAAU,CAAC,aAAa,qCAAU,OAAO,UAAU,KAAK;AAAA,EACxE;AAAA,IACE,OAAO;AAAA,IACP,UAAU,CAAC,aAAa,qCAAU;AAAA,IAClC,QAAQ,CAAC,UAAU;AAEjB,aACE,+BACI,QAAQ,WAAW,IAEpB,QAAQ,+BAA+B;AAAA,IAE9C;AAAA,IACA,UAAU;AAAA,EACZ;AACF;AAEA,IAAM,uBAAuB,CAAK,OAAU,YAAkC;AAC5E,OAAI,mCAAS,WAAU,cAAc;AACnC,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEO,IAAM,cAAwC;AAAA,EACnD;AAAA,IACE,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