@dotss/tictoccroc 0.8.1 → 0.9.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 (26) hide show
  1. package/dist/index.mjs +23 -21
  2. package/dist/shared/components/ChatKit/ImageMessage/ImageMessage.d.ts +30 -0
  3. package/dist/shared/components/ChatKit/ImageMessage/ImageMessage.mjs +145 -0
  4. package/dist/shared/components/ChatKit/ImageMessage/ImageMessage.utils.d.ts +12 -0
  5. package/dist/shared/components/ChatKit/ImageMessage/ImageMessage.utils.mjs +21 -0
  6. package/dist/shared/components/ChatKit/ImageMessage/ImageMessage.utils.test.d.ts +1 -0
  7. package/dist/shared/components/ChatKit/ImageMessage/index.d.ts +4 -0
  8. package/dist/shared/components/ChatKit/ImageMessage/index.mjs +6 -0
  9. package/dist/shared/components/ChatKit/InputBar/InputBar.d.ts +3 -2
  10. package/dist/shared/components/ChatKit/InputBar/InputBar.mjs +30 -30
  11. package/dist/shared/components/ChatKit/Message/Message.mjs +60 -102
  12. package/dist/shared/components/ChatKit/Message/Message.utils.mjs +15 -3
  13. package/dist/shared/components/ChatKit/Message/Message.utils.test.d.ts +1 -0
  14. package/dist/shared/components/ChatKit/MessageFailedActions/MessageFailedActions.d.ts +10 -0
  15. package/dist/shared/components/ChatKit/MessageFailedActions/MessageFailedActions.mjs +65 -0
  16. package/dist/shared/components/ChatKit/MessageFailedActions/index.d.ts +3 -0
  17. package/dist/shared/components/ChatKit/MessageFailedActions/index.mjs +5 -0
  18. package/dist/shared/components/ChatKit/index.d.ts +2 -0
  19. package/dist/shared/components/ChatKit/index.mjs +12 -10
  20. package/dist/shared/components/Image/Image.mjs +113 -111
  21. package/dist/shared/components/Image/Image.utils.d.ts +7 -0
  22. package/dist/shared/components/Image/Image.utils.mjs +21 -0
  23. package/dist/shared/components/Image/Image.utils.test.d.ts +1 -0
  24. package/dist/shared/components/index.d.ts +1 -1
  25. package/dist/shared/components/index.mjs +12 -10
  26. package/package.json +2 -2
@@ -1,63 +1,55 @@
1
1
  import e from "../../../hooks/useInView/index.mjs";
2
2
  import t from "../../Image/index.mjs";
3
- import { useEffect as n, useImperativeHandle as r, useRef as i } from "react";
4
- import { Button as a, CircularProgressIndicator as o, Flexbox as s, Icon as c, Menu as l, MenuBlock as u, Typography as d } from "@dotss/ui";
5
- import f from "@dotss/ui/core/useTheme";
6
- import p from "dayjs";
7
- import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
8
- import { useCheckHoverPossible as _ } from "@dotss/ui/hooks";
9
- import { MenuButton as v } from "@dotss/ui/Menu";
3
+ import n from "../MessageFailedActions/index.mjs";
4
+ import { useEffect as r, useImperativeHandle as i, useRef as a } from "react";
5
+ import { Button as o, CircularProgressIndicator as s, Flexbox as c, Icon as l, Typography as u } from "@dotss/ui";
6
+ import d from "@dotss/ui/core/useTheme";
7
+ import f from "dayjs";
8
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
9
+ import { useCheckHoverPossible as h } from "@dotss/ui/hooks";
10
10
  //#region shared/components/ChatKit/Message/Message.tsx
11
- function y({ id: y, content: b = "", mine: x = !1, avatarUrl: S = "", unreadUserCount: C = 0, regDatetime: w, status: T, onView: E, openMenu: D, onClickAvatar: O, onCloseMenu: k, onClickMenu: A, onResend: j, onDelete: M, onViewAll: N, showAvatar: P, showTime: F, ref: I, inlineCSS: L, ...R }) {
12
- let { palette: { brand: z, grey: B, etc: V }, spacing: H } = f(), { isHoverPossible: U } = _(), W = i(null), G = i(null), K = i(null);
13
- r(I, () => W.current);
14
- let q = e(W), J = T === "FAILED", Y = b.length > 300, X = (e) => {
15
- e === "resend" ? (k?.(), K.current = setTimeout(() => {
16
- j?.();
17
- }, 200)) : e === "delete" && (k?.(), K.current = setTimeout(() => {
18
- M?.();
19
- }, 200));
20
- }, Z = (e) => {
11
+ function g({ id: g, content: _ = "", mine: v = !1, avatarUrl: y = "", unreadUserCount: b = 0, regDatetime: x, status: S, onView: C, openMenu: w, onClickAvatar: T, onCloseMenu: E, onClickMenu: D, onResend: O, onDelete: k, onViewAll: A, showAvatar: j, showTime: M, ref: N, inlineCSS: P, ...F }) {
12
+ let { palette: { brand: I, grey: L } } = d(), { isHoverPossible: R } = h(), z = a(null);
13
+ i(N, () => z.current);
14
+ let B = e(z), V = S === "FAILED", H = _.length > 300, U = (e) => {
21
15
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.currentTarget.click());
22
16
  };
23
- return n(() => {
24
- q && E?.();
25
- }, [q, E]), n(() => {
26
- J && W?.current?.scrollIntoView();
27
- }, [J]), n(() => () => {
28
- K.current && clearTimeout(K.current);
29
- }, []), /* @__PURE__ */ g(s, {
30
- ref: W,
17
+ return r(() => {
18
+ B && C?.();
19
+ }, [B, C]), r(() => {
20
+ V && z?.current?.scrollIntoView();
21
+ }, [V]), /* @__PURE__ */ m(c, {
22
+ ref: z,
31
23
  alignItems: "flex-end",
32
- flexDirection: x ? "row-reverse" : "row",
24
+ flexDirection: v ? "row-reverse" : "row",
33
25
  pl: 4,
34
26
  pr: 4,
35
27
  gap: 1,
36
- "aria-busy": T === "PENDING",
37
- ...R,
28
+ "aria-busy": S === "PENDING",
29
+ ...F,
38
30
  inlineCSS: {
39
- cursor: T === "PENDING" ? "wait" : "default",
31
+ cursor: S === "PENDING" ? "wait" : "default",
40
32
  overflowAnchor: "none",
41
- ...L
33
+ ...P
42
34
  },
43
35
  children: [
44
- /* @__PURE__ */ g(s, {
36
+ /* @__PURE__ */ m(c, {
45
37
  alignItems: "flex-start",
46
38
  gap: 2.5,
47
- children: [!x && P && S && /* @__PURE__ */ h(s, {
48
- role: typeof O == "function" ? "button" : void 0,
49
- tabIndex: typeof O == "function" ? 0 : -1,
50
- onClick: O,
51
- onKeyDown: Z,
52
- "aria-label": typeof O == "function" ? "선생님 프로필 보기" : void 0,
39
+ children: [!v && j && y && /* @__PURE__ */ p(c, {
40
+ role: typeof T == "function" ? "button" : void 0,
41
+ tabIndex: typeof T == "function" ? 0 : -1,
42
+ onClick: T,
43
+ onKeyDown: U,
44
+ "aria-label": typeof T == "function" ? "선생님 프로필 보기" : void 0,
53
45
  inlineCSS: {
54
46
  position: "relative",
55
47
  overflow: "hidden",
56
48
  minWidth: 32,
57
- cursor: typeof O == "function" ? "pointer" : void 0
49
+ cursor: typeof T == "function" ? "pointer" : void 0
58
50
  },
59
- children: /* @__PURE__ */ h(t, {
60
- src: S,
51
+ children: /* @__PURE__ */ p(t, {
52
+ src: y,
61
53
  width: 32,
62
54
  height: 32,
63
55
  borderRadius: "50%",
@@ -66,19 +58,19 @@ function y({ id: y, content: b = "", mine: x = !1, avatarUrl: S = "", unreadUser
66
58
  enableFallback: !0,
67
59
  style: { objectFit: "cover" }
68
60
  })
69
- }), /* @__PURE__ */ g(s, {
61
+ }), /* @__PURE__ */ m(c, {
70
62
  pt: 2,
71
63
  pb: 2,
72
64
  pl: 3,
73
65
  pr: 3,
74
- ml: !x && !P && S ? 10.5 : void 0,
66
+ ml: !v && !j && y ? 10.5 : void 0,
75
67
  flexDirection: "column",
76
68
  gap: 2.5,
77
69
  inlineCSS: {
78
70
  borderRadius: 12,
79
- backgroundColor: x ? z.primary.pageControl : B[10]
71
+ backgroundColor: v ? I.primary.pageControl : L[10]
80
72
  },
81
- children: [/* @__PURE__ */ h(d, {
73
+ children: [/* @__PURE__ */ p(u, {
82
74
  tag: "p",
83
75
  variant: "b3R",
84
76
  inlineCSS: {
@@ -87,76 +79,42 @@ function y({ id: y, content: b = "", mine: x = !1, avatarUrl: S = "", unreadUser
87
79
  userSelect: "text",
88
80
  "& *": { userSelect: "text" }
89
81
  },
90
- children: Y ? b.slice(0, 300) + "..." : b
91
- }), Y && /* @__PURE__ */ h(a, {
82
+ children: H ? _.slice(0, 300) + "..." : _
83
+ }), H && /* @__PURE__ */ p(o, {
92
84
  variant: "text",
93
85
  size: "xSmall",
94
- endAdornment: /* @__PURE__ */ h(c, { name: "ChevronRightLine" }),
95
- onClick: N,
86
+ endAdornment: /* @__PURE__ */ p(l, { name: "ChevronRightLine" }),
87
+ onClick: A,
96
88
  inlineCSS: {
97
89
  marginLeft: "auto",
98
- "&:active:not([aria-disabled=\"true\"])": { backgroundColor: z.primary.main },
99
- ...U && { "&:hover:not([aria-disabled=\"true\"])": { backgroundColor: z.primary.main } }
90
+ "&:active:not([aria-disabled=\"true\"])": { backgroundColor: I.primary.main },
91
+ ...R && { "&:hover:not([aria-disabled=\"true\"])": { backgroundColor: I.primary.main } }
100
92
  },
101
93
  children: "전체보기"
102
94
  })]
103
95
  })]
104
96
  }),
105
- J && /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ g(v, {
106
- ref: G,
107
- isMenuOpen: !!D,
108
- menuId: `message-${y}-menu`,
109
- onClick: A,
110
- size: "xSmall",
111
- inlineCSS: {
112
- padding: H.content(.5),
113
- gap: H.content(.5),
114
- borderRadius: 200,
115
- backgroundColor: D ? B[10] : "transparent",
116
- cursor: "pointer",
117
- ...U && { "&:hover": { backgroundColor: `${B[10]} !important` } },
118
- "&:active": { backgroundColor: `${B[10]} !important` }
119
- },
120
- children: [/* @__PURE__ */ h(c, {
121
- name: "ResetLine",
122
- size: "xSmall",
123
- color: "grey.70",
124
- inlineCSS: { color: `${B[70]} !important` }
125
- }), /* @__PURE__ */ h(c, {
126
- name: "CloseLine",
127
- size: "xSmall",
128
- color: "etc.red",
129
- inlineCSS: { color: `${V.red} !important` }
130
- })]
131
- }), /* @__PURE__ */ g(l, {
132
- id: `message-${y}-menu`,
133
- anchorRef: G,
134
- open: D,
135
- onClose: k,
136
- onChange: X,
137
- width: 160,
138
- placement: "bottom-left",
139
- children: [/* @__PURE__ */ h(u, {
140
- value: "resend",
141
- children: "재전송"
142
- }), /* @__PURE__ */ h(u, {
143
- value: "delete",
144
- children: "삭제"
145
- })]
146
- })] }),
147
- !J && /* @__PURE__ */ g(s, {
97
+ V && /* @__PURE__ */ p(n, {
98
+ id: g,
99
+ openMenu: w,
100
+ onClickMenu: D,
101
+ onCloseMenu: E,
102
+ onResend: O,
103
+ onDelete: k
104
+ }),
105
+ !V && /* @__PURE__ */ m(c, {
148
106
  flexDirection: "column",
149
- alignItems: x ? "flex-end" : "flex-start",
107
+ alignItems: v ? "flex-end" : "flex-start",
150
108
  inlineCSS: { whiteSpace: "nowrap" },
151
109
  children: [
152
- x && C > 0 && T === "SUCCEEDED" && /* @__PURE__ */ h(d, {
110
+ v && b > 0 && S === "SUCCEEDED" && /* @__PURE__ */ p(u, {
153
111
  tag: "span",
154
112
  variant: "c5B",
155
113
  "aria-hidden": !0,
156
- inlineCSS: { color: z.primary.text },
157
- children: C
114
+ inlineCSS: { color: I.primary.text },
115
+ children: b
158
116
  }),
159
- x && C > 0 && T === "PENDING" && /* @__PURE__ */ h(o, {
117
+ v && b > 0 && S === "PENDING" && /* @__PURE__ */ p(s, {
160
118
  size: "small",
161
119
  loop: !0,
162
120
  inlineCSS: {
@@ -164,12 +122,12 @@ function y({ id: y, content: b = "", mine: x = !1, avatarUrl: S = "", unreadUser
164
122
  height: 12
165
123
  }
166
124
  }),
167
- /* @__PURE__ */ h(d, {
125
+ /* @__PURE__ */ p(u, {
168
126
  tag: "span",
169
127
  variant: "c5R",
170
128
  color: "etc.dimmed01",
171
- inlineCSS: { display: F ? void 0 : "none" },
172
- children: p(w).format("A h:mm")
129
+ inlineCSS: { display: M ? void 0 : "none" },
130
+ children: f(x).format("A h:mm")
173
131
  })
174
132
  ]
175
133
  })
@@ -177,4 +135,4 @@ function y({ id: y, content: b = "", mine: x = !1, avatarUrl: S = "", unreadUser
177
135
  });
178
136
  }
179
137
  //#endregion
180
- export { y as default };
138
+ export { g as default };
@@ -15,8 +15,20 @@ function t(e) {
15
15
  }))];
16
16
  });
17
17
  }
18
- function n({ mine: t, status: n, unreadUserCount: r, content: i, regDatetime: a }) {
19
- return `${t ? "나" : "상대방"}, ${i}, ${r && r > 0 ? "읽지 않음" : "읽음"}, ${n === "SUCCEEDED" ? "전송됨" : "전송 실패"}, ${e(a).format("YYYY년 MM월 DD일 A h:mm")}`;
18
+ var n = {
19
+ SUCCEEDED: "전송됨",
20
+ FAILED: "전송 실패",
21
+ PENDING: "전송 중"
22
+ };
23
+ function r({ mine: t, status: r, unreadUserCount: i, content: a, regDatetime: o }) {
24
+ let s = n[r];
25
+ return [
26
+ t ? "나" : "상대방",
27
+ a,
28
+ i && i > 0 ? "읽지 않음" : "읽음",
29
+ s,
30
+ e(o).format("YYYY년 MM월 DD일 A h:mm")
31
+ ].join(", ");
20
32
  }
21
33
  //#endregion
22
- export { n as getMessageLabel, t as markMessageGroupBoundaries };
34
+ export { r as getMessageLabel, t as markMessageGroupBoundaries };
@@ -0,0 +1,10 @@
1
+ export interface MessageFailedActionsProps {
2
+ id: string | number;
3
+ openMenu?: boolean;
4
+ onClickMenu?: () => void;
5
+ onCloseMenu?: () => void;
6
+ onResend?: () => void;
7
+ onDelete?: () => void;
8
+ }
9
+ declare function MessageFailedActions({ id, openMenu, onClickMenu, onCloseMenu, onResend, onDelete }: MessageFailedActionsProps): import("@emotion/react/jsx-runtime").JSX.Element;
10
+ export default MessageFailedActions;
@@ -0,0 +1,65 @@
1
+ import { useEffect as e, useRef as t } from "react";
2
+ import { Icon as n, Menu as r, MenuBlock as i } from "@dotss/ui";
3
+ import a from "@dotss/ui/core/useTheme";
4
+ import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
5
+ import { useCheckHoverPossible as l } from "@dotss/ui/hooks";
6
+ import { MenuButton as u } from "@dotss/ui/Menu";
7
+ //#region shared/components/ChatKit/MessageFailedActions/MessageFailedActions.tsx
8
+ var d = 200;
9
+ function f({ id: f, openMenu: p, onClickMenu: m, onCloseMenu: h, onResend: g, onDelete: _ }) {
10
+ let { palette: { grey: v, etc: y }, spacing: b } = a(), { isHoverPossible: x } = l(), S = t(null), C = t(null), w = (e) => {
11
+ if (e !== "resend" && e !== "delete") return;
12
+ let t = e === "resend" ? g : _;
13
+ C.current && clearTimeout(C.current), C.current = setTimeout(() => {
14
+ t?.();
15
+ }, d);
16
+ };
17
+ return e(() => () => {
18
+ C.current && clearTimeout(C.current);
19
+ }, []), /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ c(u, {
20
+ ref: S,
21
+ isMenuOpen: !!p,
22
+ menuId: `message-${f}-menu`,
23
+ onClick: () => m?.(),
24
+ size: "xSmall",
25
+ "aria-label": "전송 실패 메뉴 열기",
26
+ inlineCSS: {
27
+ padding: b.content(.5),
28
+ gap: b.content(.5),
29
+ borderRadius: 200,
30
+ backgroundColor: p ? v[10] : "transparent",
31
+ cursor: "pointer",
32
+ ...x && { "&:hover": { backgroundColor: `${v[10]} !important` } },
33
+ "&:active": { backgroundColor: `${v[10]} !important` }
34
+ },
35
+ children: [/* @__PURE__ */ s(n, {
36
+ name: "ResetLine",
37
+ size: "xSmall",
38
+ color: "grey.70",
39
+ inlineCSS: { color: `${v[70]} !important` }
40
+ }), /* @__PURE__ */ s(n, {
41
+ name: "CloseLine",
42
+ size: "xSmall",
43
+ color: "etc.red",
44
+ inlineCSS: { color: `${y.red} !important` }
45
+ })]
46
+ }), /* @__PURE__ */ c(r, {
47
+ id: `message-${f}-menu`,
48
+ anchorRef: S,
49
+ open: p,
50
+ onClose: h,
51
+ onChange: w,
52
+ transitionDuration: d,
53
+ width: 160,
54
+ placement: "bottom-left",
55
+ children: [/* @__PURE__ */ s(i, {
56
+ value: "resend",
57
+ children: "재전송"
58
+ }), /* @__PURE__ */ s(i, {
59
+ value: "delete",
60
+ children: "삭제"
61
+ })]
62
+ })] });
63
+ }
64
+ //#endregion
65
+ export { f as default };
@@ -0,0 +1,3 @@
1
+ import { default as MessageFailedActions, MessageFailedActionsProps } from './MessageFailedActions';
2
+ export type { MessageFailedActionsProps };
3
+ export default MessageFailedActions;
@@ -0,0 +1,5 @@
1
+ import e from "./MessageFailedActions.mjs";
2
+ //#region shared/components/ChatKit/MessageFailedActions/index.ts
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };
@@ -1,10 +1,12 @@
1
1
  export { default as Message } from './Message';
2
+ export { default as ImageMessage } from './ImageMessage';
2
3
  export { default as SystemMessage } from './SystemMessage';
3
4
  export { default as BotMessage } from './BotMessage';
4
5
  export { default as InputBar } from './InputBar';
5
6
  export { default as Seperator } from './Seperator';
6
7
  export { default as UnreadMessagePill } from './UnreadMessagePill';
7
8
  export * from './Message';
9
+ export * from './ImageMessage';
8
10
  export * from './SystemMessage';
9
11
  export * from './BotMessage';
10
12
  export * from './InputBar';
@@ -1,13 +1,15 @@
1
1
  import e from "./Message/Message.fallback.mjs";
2
2
  import { getMessageLabel as t, markMessageGroupBoundaries as n } from "./Message/Message.utils.mjs";
3
3
  import r from "./Message/index.mjs";
4
- import i from "./SystemMessage/(Actions)/DirectTrageRiskInfoBottomSheet/DirectTrageRiskInfoBottomSheet.mjs";
5
- import { getSystemMessageLabel as a } from "./SystemMessage/SystemMessage.utils.mjs";
6
- import o from "./SystemMessage/index.mjs";
7
- import { getBotMessageLabel as s, getCtaButtonText as c } from "./BotMessage/BotMessage.utils.mjs";
8
- import l from "./BotMessage/index.mjs";
9
- import u from "./InputBar/InputBar.fallback.mjs";
10
- import d from "./InputBar/index.mjs";
11
- import f from "./Seperator/index.mjs";
12
- import p from "./UnreadMessagePill/index.mjs";
13
- export { l as BotMessage, i as DirectTradeRiskInfoBottomSheet, d as InputBar, u as InputBarFallback, r as Message, e as MessageFallback, f as Seperator, o as SystemMessage, p as UnreadMessagePill, s as getBotMessageLabel, c as getCtaButtonText, t as getMessageLabel, a as getSystemMessageLabel, n as markMessageGroupBoundaries };
4
+ import { getImageMessageLabel as i, getPhotoAssetMessage as a } from "./ImageMessage/ImageMessage.utils.mjs";
5
+ import o from "./ImageMessage/index.mjs";
6
+ import s from "./SystemMessage/(Actions)/DirectTrageRiskInfoBottomSheet/DirectTrageRiskInfoBottomSheet.mjs";
7
+ import { getSystemMessageLabel as c } from "./SystemMessage/SystemMessage.utils.mjs";
8
+ import l from "./SystemMessage/index.mjs";
9
+ import { getBotMessageLabel as u, getCtaButtonText as d } from "./BotMessage/BotMessage.utils.mjs";
10
+ import f from "./BotMessage/index.mjs";
11
+ import p from "./InputBar/InputBar.fallback.mjs";
12
+ import m from "./InputBar/index.mjs";
13
+ import h from "./Seperator/index.mjs";
14
+ import g from "./UnreadMessagePill/index.mjs";
15
+ export { f as BotMessage, s as DirectTradeRiskInfoBottomSheet, o as ImageMessage, m as InputBar, p as InputBarFallback, r as Message, e as MessageFallback, h as Seperator, l as SystemMessage, g as UnreadMessagePill, u as getBotMessageLabel, d as getCtaButtonText, i as getImageMessageLabel, t as getMessageLabel, a as getPhotoAssetMessage, c as getSystemMessageLabel, n as markMessageGroupBoundaries };