@dotss/ui 0.0.10 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/Accordion/Accordion.cjs +13 -7
  2. package/Accordion/Accordion.d.ts +2 -0
  3. package/Accordion/Accordion.es.js +86 -65
  4. package/Autocomplete/Autocomplete.cjs +1 -1
  5. package/Autocomplete/Autocomplete.d.ts +1 -1
  6. package/Autocomplete/Autocomplete.es.js +235 -80
  7. package/BottomSheet/BottomSheet.cjs +5 -5
  8. package/BottomSheet/BottomSheet.d.ts +3 -0
  9. package/BottomSheet/BottomSheet.es.js +88 -70
  10. package/BottomSheet/BottomSheetText/BottomSheetText.cjs +2 -2
  11. package/BottomSheet/BottomSheetText/BottomSheetText.es.js +18 -6
  12. package/BottomSheet/BottomSheetTitle/BottomSheetTitle.cjs +6 -6
  13. package/BottomSheet/BottomSheetTitle/BottomSheetTitle.d.ts +2 -1
  14. package/BottomSheet/BottomSheetTitle/BottomSheetTitle.es.js +26 -15
  15. package/Button/Button.cjs +6 -6
  16. package/Button/Button.es.js +35 -29
  17. package/ChainPicker/ChainPicker.cjs +16 -6
  18. package/ChainPicker/ChainPicker.d.ts +4 -2
  19. package/ChainPicker/ChainPicker.es.js +155 -110
  20. package/ChainPicker/ChainPicker.stories.d.ts +1 -1
  21. package/Checkbox/Checkbox.cjs +3 -3
  22. package/Checkbox/Checkbox.es.js +12 -10
  23. package/CircularProgressIndicator/CircularProgressIndicator.cjs +5 -5
  24. package/CircularProgressIndicator/CircularProgressIndicator.es.js +25 -22
  25. package/DatePicker/DatePicker.cjs +37 -20
  26. package/DatePicker/DatePicker.d.ts +2 -1
  27. package/DatePicker/DatePicker.es.js +345 -320
  28. package/DatePicker/DatePicker.stories.d.ts +1 -0
  29. package/DatePicker/EventDot/EventDot.cjs +8 -0
  30. package/DatePicker/EventDot/EventDot.d.ts +8 -0
  31. package/DatePicker/EventDot/EventDot.es.js +19 -0
  32. package/DatePicker/EventDot/index.cjs +1 -0
  33. package/DatePicker/EventDot/index.d.ts +3 -0
  34. package/DatePicker/EventDot/index.es.js +4 -0
  35. package/DatePicker/EventDotGroup/EventDotGroup.cjs +8 -0
  36. package/DatePicker/EventDotGroup/EventDotGroup.d.ts +8 -0
  37. package/DatePicker/EventDotGroup/EventDotGroup.es.js +39 -0
  38. package/DatePicker/EventDotGroup/index.cjs +1 -0
  39. package/DatePicker/EventDotGroup/index.d.ts +3 -0
  40. package/DatePicker/EventDotGroup/index.es.js +4 -0
  41. package/DatePicker/index.cjs +1 -1
  42. package/DatePicker/index.d.ts +2 -0
  43. package/DatePicker/index.es.js +6 -2
  44. package/Dialog/Dialog.cjs +2 -2
  45. package/Dialog/Dialog.d.ts +2 -0
  46. package/Dialog/Dialog.es.js +45 -40
  47. package/Dialog/Dialog.stories.d.ts +10 -0
  48. package/Dialog/DialogText/DialogText.cjs +1 -1
  49. package/Dialog/DialogText/DialogText.es.js +1 -1
  50. package/Dialog/DialogTitle/DialogTitle.cjs +4 -4
  51. package/Dialog/DialogTitle/DialogTitle.d.ts +2 -1
  52. package/Dialog/DialogTitle/DialogTitle.es.js +17 -17
  53. package/FocusBoundary/FocusBoundary.cjs +1 -1
  54. package/FocusBoundary/FocusBoundary.d.ts +3 -1
  55. package/FocusBoundary/FocusBoundary.es.js +49 -42
  56. package/FormControlText/FormControlText.cjs +7 -5
  57. package/FormControlText/FormControlText.d.ts +2 -0
  58. package/FormControlText/FormControlText.es.js +50 -40
  59. package/Icon/Icon.cjs +1 -1
  60. package/Icon/Icon.es.js +1 -1
  61. package/IconButton/IconButton.cjs +8 -8
  62. package/IconButton/IconButton.es.js +32 -25
  63. package/LineProgressIndicator/LineProgressIndicator.cjs +6 -6
  64. package/LineProgressIndicator/LineProgressIndicator.es.js +34 -22
  65. package/Menu/Menu.cjs +16 -16
  66. package/Menu/Menu.d.ts +3 -2
  67. package/Menu/Menu.es.js +115 -81
  68. package/Menu/Menu.stories.d.ts +1 -0
  69. package/Menu/MenuBlock/MenuBlock.cjs +14 -7
  70. package/Menu/MenuBlock/MenuBlock.d.ts +1 -0
  71. package/Menu/MenuBlock/MenuBlock.es.js +47 -35
  72. package/Menu/MenuButton/MenuButton.cjs +1 -0
  73. package/Menu/MenuButton/MenuButton.d.ts +10 -0
  74. package/Menu/MenuButton/MenuButton.es.js +44 -0
  75. package/Menu/MenuButton/index.cjs +1 -0
  76. package/Menu/MenuButton/index.d.ts +3 -0
  77. package/Menu/MenuButton/index.es.js +4 -0
  78. package/Menu/index.cjs +1 -1
  79. package/Menu/index.d.ts +1 -0
  80. package/Menu/index.es.js +4 -2
  81. package/NumberKeypad/NumberKeypad.cjs +2 -2
  82. package/NumberKeypad/NumberKeypad.es.js +18 -16
  83. package/NumberKeypad/NumberKeypadBlock/NumberKeypadBlock.cjs +1 -1
  84. package/NumberKeypad/NumberKeypadBlock/NumberKeypadBlock.es.js +10 -1
  85. package/PageControl/PageControl.cjs +16 -5
  86. package/PageControl/PageControl.d.ts +3 -0
  87. package/PageControl/PageControl.es.js +77 -24
  88. package/PageControl/PageControl.stories.d.ts +1 -0
  89. package/Radio/Radio.cjs +3 -3
  90. package/Radio/Radio.es.js +22 -20
  91. package/RadioGroup/RadioGroup.cjs +1 -0
  92. package/RadioGroup/RadioGroup.d.ts +8 -0
  93. package/RadioGroup/RadioGroup.es.js +28 -0
  94. package/RadioGroup/RadioGroup.stories.d.ts +14 -0
  95. package/RadioGroup/index.cjs +1 -0
  96. package/RadioGroup/index.d.ts +3 -0
  97. package/RadioGroup/index.es.js +4 -0
  98. package/SegmentedButton/SegmentedButton.cjs +14 -3
  99. package/SegmentedButton/SegmentedButton.es.js +108 -34
  100. package/Select/Select.cjs +4 -4
  101. package/Select/Select.es.js +95 -86
  102. package/Slider/Slider.cjs +27 -12
  103. package/Slider/Slider.d.ts +1 -0
  104. package/Slider/Slider.es.js +177 -90
  105. package/Switch/Switch.cjs +28 -11
  106. package/Switch/Switch.d.ts +2 -0
  107. package/Switch/Switch.es.js +185 -65
  108. package/Switch/Switch.stories.d.ts +1 -0
  109. package/Tab/Tab.es.js +2 -4
  110. package/TextArea/TextArea.cjs +42 -34
  111. package/TextArea/TextArea.es.js +116 -82
  112. package/TextArea/TextArea.stories.d.ts +1 -1
  113. package/TextField/TextField.cjs +29 -13
  114. package/TextField/TextField.d.ts +2 -1
  115. package/TextField/TextField.es.js +122 -79
  116. package/TextField/TextField.stories.d.ts +1 -0
  117. package/Tooltip/Tooltip.cjs +7 -6
  118. package/Tooltip/Tooltip.d.ts +8 -3
  119. package/Tooltip/Tooltip.es.js +248 -146
  120. package/Tooltip/Tooltip.stories.d.ts +1 -0
  121. package/hooks/index.cjs +1 -1
  122. package/hooks/index.d.ts +3 -0
  123. package/hooks/index.es.js +7 -1
  124. package/hooks/useCheckHasFocus/useCheckHasFocus.cjs +1 -0
  125. package/hooks/useCheckHasFocus/useCheckHasFocus.d.ts +9 -0
  126. package/hooks/useCheckHasFocus/useCheckHasFocus.es.js +21 -0
  127. package/hooks/useCheckKeyboardMode/useCheckKeyboardMode.cjs +1 -0
  128. package/hooks/useCheckKeyboardMode/useCheckKeyboardMode.d.ts +4 -0
  129. package/hooks/useCheckKeyboardMode/useCheckKeyboardMode.es.js +30 -0
  130. package/hooks/useFocusBoundary/useFocusBoundary.cjs +1 -0
  131. package/hooks/useFocusBoundary/useFocusBoundary.d.ts +12 -0
  132. package/hooks/useFocusBoundary/useFocusBoundary.es.js +63 -0
  133. package/index.cjs +1 -1
  134. package/index.d.ts +2 -1
  135. package/index.es.js +97 -90
  136. package/package.json +3 -3
  137. package/resources/tictoccroc/icons/fill/certified-fill.svg-B_RVx6K_.cjs +1 -0
  138. package/resources/tictoccroc/icons/fill/certified-fill.svg-CK7UqYft.js +5 -0
  139. package/resources/tictoccroc/icons/fill/index.d.ts +3 -0
  140. package/resources/tictoccroc/icons/fill/location-fill.svg-DfSHAnsd.js +5 -0
  141. package/resources/tictoccroc/icons/fill/location-fill.svg-Die9mxQH.cjs +1 -0
  142. package/resources/tictoccroc/icons/fill/send-fill.svg-CItD_2L1.js +5 -0
  143. package/resources/tictoccroc/icons/fill/send-fill.svg-D197Lwl0.cjs +1 -0
  144. package/resources/tictoccroc/icons/index.ts-BmqvB_n6.cjs +1 -0
  145. package/resources/tictoccroc/icons/index.ts-CzTh-XsD.js +228 -0
  146. package/resources/tictoccroc/icons/line/index.d.ts +4 -0
  147. package/resources/tictoccroc/icons/line/list-line.svg-r5d5htjN.cjs +1 -0
  148. package/resources/tictoccroc/icons/line/list-line.svg-yFfhZxUp.js +5 -0
  149. package/resources/tictoccroc/icons/line/monthly-line.svg-BdyaJ1t_.cjs +1 -0
  150. package/resources/tictoccroc/icons/line/monthly-line.svg-DY5-Xv34.js +5 -0
  151. package/resources/tictoccroc/icons/line/review-line.svg-B4rfJrsO.js +5 -0
  152. package/resources/tictoccroc/icons/line/review-line.svg-DYUuUybx.cjs +1 -0
  153. package/resources/tictoccroc/icons/line/weekly-line.svg-BCO-LS_a.cjs +1 -0
  154. package/resources/tictoccroc/icons/line/weekly-line.svg-BUPmmgeE.js +5 -0
  155. package/utils/getIconLabel/getIconLabel.cjs +1 -1
  156. package/utils/getIconLabel/getIconLabel.es.js +8 -1
  157. package/utils/getSibling/getSibling.es.js +1 -2
  158. package/resources/tictoccroc/icons/index.ts-CarI_z7q.js +0 -214
  159. package/resources/tictoccroc/icons/index.ts-IVJAK4qr.cjs +0 -1
@@ -1,13 +1,13 @@
1
- import { jsxs as y, jsx as c } from "@emotion/react/jsx-runtime";
2
- import { forwardRef as z, useState as S } from "react";
3
- import f from "../Icon/Icon.es.js";
1
+ import { jsxs as g, jsx as l } from "@emotion/react/jsx-runtime";
2
+ import { forwardRef as T, useId as v, useState as S } from "react";
3
+ import b from "../Icon/Icon.es.js";
4
4
  import u from "@emotion/styled";
5
- const F = u.div`
5
+ const V = u.div`
6
6
  position: relative;
7
7
  display: flex;
8
8
  flex-direction: column;
9
9
  ${({ fullWidth: t }) => t ? { width: "100%" } : null};
10
- `, O = u.div`
10
+ `, E = u.div`
11
11
  display: flex;
12
12
  align-items: center;
13
13
  justify-content: center;
@@ -16,9 +16,9 @@ const F = u.div`
16
16
 
17
17
  ${({
18
18
  theme: {
19
- palette: { green: t, grey: e, background: i, etc: n }
19
+ palette: { green: t, grey: e, background: o, etc: n }
20
20
  },
21
- variant: g,
21
+ variant: f,
22
22
  helper: r
23
23
  }) => {
24
24
  let s = {
@@ -26,7 +26,7 @@ const F = u.div`
26
26
  borderColor: e[50],
27
27
  color: e[100]
28
28
  };
29
- switch (g) {
29
+ switch (f) {
30
30
  case "outlined":
31
31
  (r == null ? void 0 : r.severity) === "success" && (s = {
32
32
  ...s,
@@ -38,7 +38,7 @@ const F = u.div`
38
38
  break;
39
39
  case "filled":
40
40
  s = {
41
- backgroundColor: i.primary
41
+ backgroundColor: o.primary
42
42
  };
43
43
  break;
44
44
  }
@@ -46,14 +46,14 @@ const F = u.div`
46
46
  }};
47
47
 
48
48
  ${({ theme: { spacing: t }, size: e }) => {
49
- let i = {
49
+ let o = {
50
50
  maxHeight: 48,
51
51
  padding: `${t.content(3)}px ${t.content(4)}px`,
52
52
  borderRadius: 10
53
53
  };
54
54
  switch (e) {
55
55
  case "2xLarge":
56
- i = {
56
+ o = {
57
57
  maxHeight: 80,
58
58
  padding: `${t.content(4)}px ${t.content(5)}px`,
59
59
  borderRadius: 12,
@@ -64,14 +64,14 @@ const F = u.div`
64
64
  };
65
65
  break;
66
66
  case "xLarge":
67
- i = {
67
+ o = {
68
68
  maxHeight: 56,
69
69
  padding: t.content(4),
70
70
  borderRadius: 12
71
71
  };
72
72
  break;
73
73
  }
74
- return i;
74
+ return o;
75
75
  }};
76
76
 
77
77
  ${({
@@ -79,8 +79,8 @@ const F = u.div`
79
79
  palette: { brand: t }
80
80
  },
81
81
  variant: e,
82
- focus: i
83
- }) => e === "outlined" && i ? {
82
+ focus: o
83
+ }) => e === "outlined" && o ? {
84
84
  borderColor: t.primary.line
85
85
  } : null};
86
86
 
@@ -91,10 +91,9 @@ const F = u.div`
91
91
  palette: { grey: t }
92
92
  },
93
93
  variant: e,
94
- disabled: i
94
+ disabled: o
95
95
  }) => {
96
- if (!i)
97
- return null;
96
+ if (!o) return null;
98
97
  let n = {
99
98
  backgroundColor: t[10],
100
99
  borderColor: t[30]
@@ -108,7 +107,7 @@ const F = u.div`
108
107
  }
109
108
  return n;
110
109
  }}
111
- `, T = u.input`
110
+ `, W = u.input`
112
111
  width: inherit;
113
112
  flex-grow: 1;
114
113
  border: none;
@@ -119,8 +118,8 @@ const F = u.div`
119
118
  theme: {
120
119
  typography: { b2R: t, h0R: e }
121
120
  },
122
- inputSize: i
123
- }) => i === "2xLarge" ? {
121
+ inputSize: o
122
+ }) => o === "2xLarge" ? {
124
123
  fontSize: e.size,
125
124
  fontWeight: e.weight,
126
125
  lineHeight: e.lineHeight,
@@ -132,7 +131,7 @@ const F = u.div`
132
131
  letterSpacing: t.letterSpacing
133
132
  }};
134
133
 
135
- &::placeholder {
134
+ &::placeholder, &::-webkit-input-placeholder, &::-ms-input-placeholder, &::-moz-placeholder {
136
135
  ${({
137
136
  theme: {
138
137
  palette: { grey: t }
@@ -156,7 +155,19 @@ const F = u.div`
156
155
  color: t[30]
157
156
  }
158
157
  })}
159
- `, I = u.div`
158
+
159
+ &:focus {
160
+ outline: 'none';
161
+ }
162
+
163
+ &[type='password']::-ms-reveal {
164
+ display: none;
165
+ }
166
+ `, B = u.button`
167
+ &:empty {
168
+ display: none;
169
+ }
170
+ `, M = u.div`
160
171
  position: absolute;
161
172
  left: 0;
162
173
  bottom: ${({ inputSize: t }) => t === "2xLarge" ? "-26px" : "-16px"};
@@ -165,8 +176,8 @@ const F = u.div`
165
176
  theme: {
166
177
  typography: { c3R: t, b1R: e }
167
178
  },
168
- inputSize: i
169
- }) => i === "2xLarge" ? {
179
+ inputSize: o
180
+ }) => o === "2xLarge" ? {
170
181
  fontSize: e.size,
171
182
  fontWeight: e.weight,
172
183
  lineHeight: e.lineHeight,
@@ -182,91 +193,123 @@ const F = u.div`
182
193
  theme: {
183
194
  palette: { etc: t, grey: e }
184
195
  },
185
- helper: i
196
+ helper: o
186
197
  }) => {
187
198
  const n = {
188
199
  color: e[100]
189
200
  };
190
- return (i == null ? void 0 : i.severity) === "error" ? {
201
+ return (o == null ? void 0 : o.severity) === "error" ? {
191
202
  color: t.red
192
203
  } : n;
193
204
  }}
194
- `, P = z(function({
195
- type: e,
196
- variant: i = "outlined",
205
+
206
+ &:empty {
207
+ display: none;
208
+ }
209
+ `, J = T(function({
210
+ type: e = "text",
211
+ variant: o = "outlined",
197
212
  size: n = "large",
198
- startAdornment: g,
213
+ startAdornment: f,
199
214
  endAdornment: r,
200
215
  fullWidth: s,
201
- helper: o,
216
+ helper: i,
202
217
  disabled: m,
203
218
  inlineCSS: $,
204
- onFocus: b,
205
- onBlur: p,
206
- disablePasswordVisibility: h,
207
- ...C
208
- }, k) {
209
- const [v, x] = S(!1), [l, H] = S(!1), d = !h && !r && e === "password" && (o == null ? void 0 : o.severity) !== "success", L = (a) => {
210
- x(!0), typeof b == "function" && b(a);
211
- }, j = (a) => {
212
- x(!1), typeof p == "function" && p(a);
213
- }, w = () => H((a) => !a);
214
- return /* @__PURE__ */ y(F, { fullWidth: s, children: [
215
- /* @__PURE__ */ y(
216
- O,
219
+ onFocus: x,
220
+ onBlur: y,
221
+ disablePasswordVisibility: k,
222
+ helperProps: C,
223
+ ...H
224
+ }, L) {
225
+ const j = v(), p = v(), [z, w] = S(!1), [c, I] = S(!1), a = !k && !r && e === "password" && (i == null ? void 0 : i.severity) !== "success", F = (d) => {
226
+ w(!0), typeof x == "function" && x(d);
227
+ }, h = (d) => {
228
+ w(!1), typeof y == "function" && y(d);
229
+ }, O = () => I((d) => !d);
230
+ return /* @__PURE__ */ g(V, { fullWidth: s, children: [
231
+ /* @__PURE__ */ g(
232
+ E,
217
233
  {
218
- variant: i,
234
+ variant: o,
219
235
  size: n,
220
- focus: v,
236
+ focus: z,
221
237
  fullWidth: s,
222
- helper: o,
238
+ helper: i,
223
239
  disabled: m,
224
240
  css: $,
225
241
  children: [
226
- g,
227
- /* @__PURE__ */ c(
228
- T,
242
+ f,
243
+ /* @__PURE__ */ l(
244
+ W,
229
245
  {
230
- ref: k,
231
- type: d && l ? "text" : d && !l ? "password" : e,
232
- variant: i,
246
+ ref: L,
247
+ id: j,
248
+ type: a && c ? "text" : a && !c ? "password" : e,
249
+ variant: o,
233
250
  inputSize: n,
234
251
  disabled: m,
235
- ...C,
236
- onFocus: L,
237
- onBlur: j
252
+ "aria-invalid": (i == null ? void 0 : i.severity) === "error",
253
+ "aria-describedby": i != null && i.message ? p : void 0,
254
+ ...H,
255
+ onFocus: F,
256
+ onBlur: h
238
257
  }
239
258
  ),
240
259
  r,
241
- !r && (o == null ? void 0 : o.severity) === "success" && /* @__PURE__ */ c(f, { name: "CheckLine", color: "green.70" }),
242
- d && l && /* @__PURE__ */ c(
243
- f,
260
+ !r && (i == null ? void 0 : i.severity) === "success" && /* @__PURE__ */ l(b, { name: "CheckLine", color: "green.70", "aria-label": "성공", role: "img" }),
261
+ /* @__PURE__ */ g(
262
+ B,
244
263
  {
245
- name: "EyeVisibleLine",
246
- "data-testid": "EyeVisibleLine",
247
- onClick: w,
248
- inlineCSS: {
249
- cursor: "pointer"
250
- }
251
- }
252
- ),
253
- d && !l && /* @__PURE__ */ c(
254
- f,
255
- {
256
- name: "EyeInvisibleLine",
257
- "data-testid": "EyeInvisibleLine",
258
- onClick: w,
259
- inlineCSS: {
260
- cursor: "pointer"
261
- }
264
+ type: "button",
265
+ tabIndex: a ? 0 : -1,
266
+ "aria-pressed": a ? c : void 0,
267
+ onClick: O,
268
+ "aria-hidden": !a,
269
+ "aria-label": a && c ? "비밀번호 표시됨" : "비밀번호 숨김됨",
270
+ children: [
271
+ a && c && /* @__PURE__ */ l(
272
+ b,
273
+ {
274
+ name: "EyeVisibleLine",
275
+ "data-testid": "EyeVisibleLine",
276
+ inlineCSS: {
277
+ cursor: "pointer"
278
+ }
279
+ }
280
+ ),
281
+ a && !c && /* @__PURE__ */ l(
282
+ b,
283
+ {
284
+ name: "EyeInvisibleLine",
285
+ "data-testid": "EyeInvisibleLine",
286
+ inlineCSS: {
287
+ cursor: "pointer"
288
+ }
289
+ }
290
+ )
291
+ ]
262
292
  }
263
293
  )
264
294
  ]
265
295
  }
266
296
  ),
267
- (o == null ? void 0 : o.message) && /* @__PURE__ */ c(I, { helper: o, inputSize: n, "data-testid": "helper", children: o == null ? void 0 : o.message })
297
+ /* @__PURE__ */ l(
298
+ M,
299
+ {
300
+ id: p,
301
+ className: "textfield-helper",
302
+ "aria-live": (i == null ? void 0 : i.severity) === "error" ? "assertive" : "off",
303
+ role: (i == null ? void 0 : i.severity) === "error" ? "alert" : "status",
304
+ helper: i,
305
+ inputSize: n,
306
+ "data-testid": "helper",
307
+ ...C,
308
+ children: i == null ? void 0 : i.message
309
+ }
310
+ )
268
311
  ] });
269
312
  });
270
313
  export {
271
- P as default
314
+ J as default
272
315
  };
@@ -33,3 +33,4 @@ export declare const FullWidth: Story;
33
33
  export declare const PasswordVisibility: Story;
34
34
  export declare const Success: Story;
35
35
  export declare const Error: Story;
36
+ export declare const WithScreenReaderSupport: Story;
@@ -1,10 +1,10 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("@emotion/react/jsx-runtime"),n=require("react"),p=require("../Flexbox/Flexbox.cjs"),b=require("../Icon/Icon.cjs"),k=require("../Typography/Typography.cjs"),$=require("@emotion/styled"),T=t=>t&&t.__esModule?t:{default:t},m=T($),L=m.default.div`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const x=require("@emotion/react/jsx-runtime"),s=require("react"),$=require("../Flexbox/Flexbox.cjs"),I=require("../Icon/Icon.cjs"),z=require("../Typography/Typography.cjs"),M=require("../hooks/useCheckKeyboardMode/useCheckKeyboardMode.cjs"),X=require("@emotion/styled"),N=t=>t&&t.__esModule?t:{default:t},q=N(X),F=q.default.div`
2
2
  position: relative;
3
3
  display: inline-block;
4
4
  &[open] > .tooltip {
5
5
  display: flex;
6
6
  }
7
- `,j=m.default.div`
7
+ `,H=q.default.div`
8
8
  position: absolute;
9
9
  display: none;
10
10
  flex-direction: column;
@@ -17,10 +17,11 @@
17
17
  max-height: calc(136px - 8px);
18
18
  z-index: 100003;
19
19
  white-space: nowrap;
20
+ word-break: break-all;
20
21
 
21
- ${({theme:{palette:{brand:t,grey:r}},color:a})=>{let e={};return a==="primary"&&(e={backgroundColor:t.primary.tooltip,color:r[100]}),a==="secondary"&&(e={backgroundColor:r[80],color:r.white}),e}}
22
+ ${({theme:{palette:{brand:t,grey:r}},color:f})=>{let e={};return f==="primary"&&(e={backgroundColor:t.primary.tooltip,color:r[100]}),f==="secondary"&&(e={backgroundColor:r[80],color:r.white}),e}}
22
23
 
23
- ${({theme:{typography:t}})=>({fontSize:t.b4R.size,fontWeight:t.b4R.weight,lineHeight:t.b4R.lineHeight,letterSpacing:t.b4R.letterSpacing,"& svg:not(.tooltip__closer)":{width:24,height:24}})};
24
+ ${({theme:{typography:t}})=>({fontSize:t.b4R.size,fontWeight:t.b4R.weight,lineHeight:t.b4R.lineHeight,letterSpacing:t.b4R.letterSpacing,"& svg:not(.tooltip-closer)":{width:24,height:24}})};
24
25
 
25
- ${({theme:{palette:{brand:t,grey:r}},placement:a,color:e})=>{let o={};switch(a){case"bottom-left":o={top:"-12px",left:"-6px",transform:"translateY(-100%)","&:after":{content:'""',position:"absolute",top:"100%",left:"12px",borderTop:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`,borderRight:"6px solid transparent",borderBottom:"8px solid transparent",borderLeft:"6px solid transparent"}};break;case"bottom-center":o={top:"-12px",left:"50%",transform:"translate(-50%, -100%)","&:after":{content:'""',position:"absolute",top:"100%",left:"50%",transform:"translateX(-50%)",borderTop:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`,borderRight:"6px solid transparent",borderBottom:"8px solid transparent",borderLeft:"6px solid transparent"}};break;case"bottom-right":o={top:"-12px",right:"-6px",transform:"translateY(-100%)","&:after":{content:'""',position:"absolute",top:"100%",right:"12px",borderTop:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`,borderRight:"6px solid transparent",borderBottom:"8px solid transparent",borderLeft:"6px solid transparent"}};break;case"left-top":o={top:"-6px",left:"calc(100% + 12px)","&:after":{content:'""',position:"absolute",top:"12px",right:"100%",borderTop:"6px solid transparent",borderRight:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`,borderBottom:"6px solid transparent",borderLeft:"8px solid transparent"}};break;case"left-middle":o={top:"50%",left:"calc(100% + 12px)",transform:"translateY(-50%)","&:after":{content:'""',position:"absolute",top:"50%",right:"100%",transform:"translateY(-50%)",borderTop:"6px solid transparent",borderRight:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`,borderBottom:"6px solid transparent",borderLeft:"8px solid transparent"}};break;case"left-bottom":o={bottom:"-6px",left:"calc(100% + 12px)","&:after":{content:'""',position:"absolute",bottom:"12px",right:"100%",borderTop:"6px solid transparent",borderRight:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`,borderBottom:"6px solid transparent",borderLeft:"8px solid transparent"}};break;case"top-left":o={left:"-6px",transform:"translate(0, 12px)","&:after":{content:'""',position:"absolute",bottom:"100%",left:"12px",borderTop:"8px solid transparent",borderRight:"6px solid transparent",borderBottom:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`,borderLeft:"6px solid transparent"}};break;case"top-center":o={right:"50%",transform:"translate(50%, 12px)","&:after":{content:'""',position:"absolute",bottom:"100%",left:"50%",transform:"translateX(-50%)",borderTop:"8px solid transparent",borderRight:"6px solid transparent",borderBottom:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`,borderLeft:"6px solid transparent"}};break;case"top-right":o={right:"-6px",transform:"translate(0, 12px)","&:after":{content:'""',position:"absolute",bottom:"100%",right:"12px",borderTop:"8px solid transparent",borderRight:"6px solid transparent",borderBottom:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`,borderLeft:"6px solid transparent"}};break;case"right-top":o={top:"-6px",right:"calc(100% + 12px)","&:after":{content:'""',position:"absolute",top:"12px",left:"100%",borderTop:"6px solid transparent",borderRight:"8px solid transparent",borderBottom:"6px solid transparent",borderLeft:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`}};break;case"right-middle":o={top:"50%",right:"calc(100% + 12px)",transform:"translateY(-50%)","&:after":{content:'""',position:"absolute",top:"50%",left:"100%",transform:"translateY(-50%)",borderTop:"6px solid transparent",borderRight:"8px solid transparent",borderBottom:"6px solid transparent",borderLeft:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`}};break;case"right-bottom":o={bottom:"-6px",right:"calc(100% + 12px)","&:after":{content:'""',position:"absolute",bottom:"12px",left:"100%",borderTop:"6px solid transparent",borderRight:"8px solid transparent",borderBottom:"6px solid transparent",borderLeft:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`}};break}return o}};
26
- `,B=n.forwardRef(function({children:r,placement:a="bottom-center",color:e="primary",title:o,body:h,closer:d,endAdornment:x,inlineCSS:u,open:f=!1,onClose:c,wrapperProps:s,...g},y){const l=n.useRef(null),[S,R]=n.useState(!1);return n.useEffect(()=>{l.current&&l.current.getBoundingClientRect().width>=276&&R(!0)},[f]),i.jsxs(L,{open:f,...s,css:s==null?void 0:s.inlineCSS,children:[r,i.jsxs(j,{className:"tooltip",ref:y,placement:a,color:e,...g,css:u,children:[o&&i.jsxs(p.default,{alignItems:"center",justifyContent:"space-between",gap:2,children:[i.jsx(k.default,{variant:"h5B",color:e==="primary"?"grey.100":"grey.white",children:o}),d&&i.jsx(p.default,{flexShrink:0,children:i.jsx(b.default,{className:"tooltip__closer",name:"CloseLine",size:"xSmall",color:e==="primary"?"grey.100":"grey.white",onClick:c,inlineCSS:{marginLeft:"2px",cursor:"pointer"}})})]}),i.jsxs(p.default,{alignItems:"center",gap:2,ref:l,style:S?{width:"276px",whiteSpace:"wrap"}:{},children:[h,x&&i.jsx(p.default,{flexShrink:0,inlineCSS:{fontSize:"24px"},children:x}),!o&&d&&i.jsx(p.default,{flexShrink:0,children:i.jsx(b.default,{className:"tooltip__closer",name:"CloseLine",size:"xSmall",color:e==="primary"?"grey.100":"grey.white",inlineCSS:{marginLeft:"2px",cursor:"pointer"},onClick:c})})]})]})]})});exports.default=B;
26
+ ${({theme:{palette:{brand:t,grey:r}},placement:f,color:e,offset:c,arrowOffset:d})=>{let o={};const n=(c==null?void 0:c.x)||0,p=(c==null?void 0:c.y)||0,l=(d==null?void 0:d.x)||0,a=(d==null?void 0:d.y)||0;switch(f){case"bottom-left":o={top:`calc(-12px + ${p}px)`,left:`calc(-6px + ${n}px)`,transform:"translateY(-100%)","&:after":{content:'""',position:"absolute",top:"100%",left:`calc(12px + ${l}px)`,borderTop:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`,borderRight:"6px solid transparent",borderBottom:"8px solid transparent",borderLeft:"6px solid transparent"}};break;case"bottom-center":o={top:`calc(-12px + ${p}px)`,left:"50%",transform:`translate(calc(-50% + ${n}px), -100%)`,"&:after":{content:'""',position:"absolute",top:"100%",left:`calc(50% + ${l}px)`,transform:"translateX(-50%)",borderTop:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`,borderRight:"6px solid transparent",borderBottom:"8px solid transparent",borderLeft:"6px solid transparent"}};break;case"bottom-right":o={top:`calc(-12px + ${p}px)`,right:`calc(-6px - ${n}px)`,transform:"translateY(-100%)","&:after":{content:'""',position:"absolute",top:"100%",right:`calc(12px - ${l}px)`,borderTop:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`,borderRight:"6px solid transparent",borderBottom:"8px solid transparent",borderLeft:"6px solid transparent"}};break;case"left-top":o={top:`calc(-6px + ${p}px)`,left:`calc(100% + 12px + ${n}px)`,"&:after":{content:'""',position:"absolute",top:`calc(12px + ${a}px)`,right:"100%",borderTop:"6px solid transparent",borderRight:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`,borderBottom:"6px solid transparent",borderLeft:"8px solid transparent"}};break;case"left-middle":o={top:"50%",left:`calc(100% + 12px + ${n}px)`,transform:`translateY(calc(-50% + ${p}px))`,"&:after":{content:'""',position:"absolute",top:`calc(50% + ${a}px)`,right:"100%",transform:"translateY(-50%)",borderTop:"6px solid transparent",borderRight:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`,borderBottom:"6px solid transparent",borderLeft:"8px solid transparent"}};break;case"left-bottom":o={bottom:`calc(-6px - ${p}px)`,left:`calc(100% + 12px + ${n}px)`,"&:after":{content:'""',position:"absolute",bottom:`calc(12px - ${a}px)`,right:"100%",borderTop:"6px solid transparent",borderRight:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`,borderBottom:"6px solid transparent",borderLeft:"8px solid transparent"}};break;case"top-left":o={left:`calc(-6px + ${n}px)`,transform:`translate(0, calc(12px + ${p}px))`,"&:after":{content:'""',position:"absolute",bottom:"100%",left:`calc(12px + ${l}px)`,borderTop:"8px solid transparent",borderRight:"6px solid transparent",borderBottom:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`,borderLeft:"6px solid transparent"}};break;case"top-center":o={right:"50%",transform:`translate(calc(50% + ${n}px), calc(12px + ${p}px))`,"&:after":{content:'""',position:"absolute",bottom:"100%",left:`calc(50% + ${l}px)`,transform:"translateX(-50%)",borderTop:"8px solid transparent",borderRight:"6px solid transparent",borderBottom:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`,borderLeft:"6px solid transparent"}};break;case"top-right":o={right:`calc(-6px - ${n}px)`,transform:`translate(0, calc(12px + ${p}px))`,"&:after":{content:'""',position:"absolute",bottom:"100%",right:`calc(12px - ${l}px)`,borderTop:"8px solid transparent",borderRight:"6px solid transparent",borderBottom:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`,borderLeft:"6px solid transparent"}};break;case"right-top":o={top:`calc(-6px + ${p}px)`,right:`calc(100% + 12px + ${n}px)`,"&:after":{content:'""',position:"absolute",top:`calc(12px + ${a}px)`,left:"100%",borderTop:"6px solid transparent",borderRight:"8px solid transparent",borderBottom:"6px solid transparent",borderLeft:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`}};break;case"right-middle":o={top:"50%",right:`calc(100% + 12px + ${n}px)`,transform:`translateY(calc(-50% + ${p}px))`,"&:after":{content:'""',position:"absolute",top:`calc(50% + ${a}px)`,left:"100%",transform:"translateY(-50%)",borderTop:"6px solid transparent",borderRight:"8px solid transparent",borderBottom:"6px solid transparent",borderLeft:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`}};break;case"right-bottom":o={bottom:`calc(-6px - ${p}px)`,right:`calc(100% + 12px + ${n}px)`,"&:after":{content:'""',position:"absolute",bottom:`calc(12px - ${a}px)`,left:"100%",borderTop:"6px solid transparent",borderRight:"8px solid transparent",borderBottom:"6px solid transparent",borderLeft:`8px solid ${e==="primary"?t.primary.tooltip:r[80]}`}};break}return o}};
27
+ `,V=s.forwardRef(function({children:r,placement:f="bottom-center",color:e="primary",title:c,body:d,closer:o,endAdornment:n,inlineCSS:p,open:l=!1,onClose:a,wrapperProps:y,offset:E,arrowOffset:K,...g},Y){const C=s.useId(),T=s.useId(),L=s.useId(),{isKeyboardMode:k}=M.default(),S=s.useRef(null),R=s.useRef(null),v=s.useRef(!0),[D,_]=s.useState(!1),w=(g==null?void 0:g.id)||C,B=i=>{(i.key==="Enter"||i.key===" ")&&(a==null||a(i))};return s.useEffect(()=>{R.current&&R.current.getBoundingClientRect().width>=276&&_(!0)},[l]),s.useEffect(()=>{const i=u=>{u.key==="Escape"&&l&&(u.stopPropagation(),a==null||a(u))};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[l,a]),s.useEffect(()=>{var u,m,b;if(v.current){v.current=!1;return}if(l){const h=(u=S.current)==null?void 0:u.querySelector('.tooltip-closer[role="button"]');if(h&&k&&h.focus(),!h){const j=(m=S.current)==null?void 0:m.querySelector('[role="button"]');j&&k&&j.focus()}return}const i=(b=S.current)==null?void 0:b.querySelector('[role="button"]');i&&k&&i.focus()},[l,k]),x.jsxs(F,{ref:S,open:l,...y,css:y==null?void 0:y.inlineCSS,children:[s.Children.map(r,i=>{if(!s.isValidElement(i))return i;const u=m=>{var b,h;(m.key==="Enter"||m.key===" ")&&((h=(b=i.props)==null?void 0:b.onClick)==null||h.call(b,m))};return s.cloneElement(i,{inlineCSS:{cursor:"pointer","&:active":{outline:"none"},...i.props.inlineCSS},role:"button",tabIndex:0,"aria-hidden":!1,"aria-expanded":l,"aria-haspopup":"dialog","aria-controls":w,focusable:!0,onKeyDown:u,...i.props})}),x.jsxs(H,{id:w,className:"tooltip",role:"dialog","aria-modal":"true","aria-labelledby":c?T:void 0,"aria-describedby":d?L:void 0,ref:Y,placement:f,color:e,offset:E,arrowOffset:K,...g,css:p,children:[c&&x.jsxs($.default,{alignItems:"center",justifyContent:"space-between",gap:2,children:[x.jsx(z.default,{id:T,variant:"h5B",color:e==="primary"?"grey.100":"grey.white",children:c}),o&&x.jsx($.default,{flexShrink:0,children:x.jsx(I.default,{className:"tooltip-closer",name:"CloseLine",size:"xSmall",color:e==="primary"?"grey.100":"grey.white",role:"button","aria-hidden":"false",focusable:"true",tabIndex:0,onClick:a,onKeyDown:B,"aria-label":"닫기",inlineCSS:{marginLeft:"2px",cursor:"pointer","&:active":{outline:"none"}}})})]}),d&&x.jsxs($.default,{id:L,alignItems:"center",gap:2,ref:R,style:D?{width:"276px",whiteSpace:"wrap"}:{},children:[d,n&&x.jsx($.default,{flexShrink:0,inlineCSS:{fontSize:"24px"},children:n}),!c&&o&&x.jsx($.default,{flexShrink:0,children:x.jsx(I.default,{className:"tooltip-closer",name:"CloseLine",size:"xSmall",color:e==="primary"?"grey.100":"grey.white",role:"button","aria-hidden":"false",focusable:"true",tabIndex:0,onClick:a,onKeyDown:B,"aria-label":"닫기",inlineCSS:{marginLeft:"2px",cursor:"pointer","&:active":{outline:"none"}}})})]})]})]})});exports.default=V;
@@ -1,7 +1,11 @@
1
- import { HTMLAttributes, MouseEventHandler, ReactNode } from 'react';
1
+ import { HTMLAttributes, ReactNode, SyntheticEvent } from 'react';
2
2
  import { BrandColorKey } from '../typings/color';
3
3
  import { GeneralComponentProps } from '../typings/component';
4
4
 
5
+ export interface TooltipOffset {
6
+ x?: number;
7
+ y?: number;
8
+ }
5
9
  export interface TooltipProps extends GeneralComponentProps<Omit<HTMLAttributes<HTMLDivElement>, 'title'>> {
6
10
  placement?: 'bottom-left' | 'bottom-center' | 'bottom-right' | 'left-top' | 'left-middle' | 'left-bottom' | 'top-left' | 'top-center' | 'top-right' | 'right-top' | 'right-middle' | 'right-bottom';
7
11
  color?: BrandColorKey;
@@ -10,9 +14,10 @@ export interface TooltipProps extends GeneralComponentProps<Omit<HTMLAttributes<
10
14
  endAdornment?: ReactNode;
11
15
  open?: boolean;
12
16
  closer?: boolean;
13
- onOpen?: MouseEventHandler;
14
- onClose?: MouseEventHandler;
17
+ onClose?: (e: SyntheticEvent) => void;
15
18
  wrapperProps?: GeneralComponentProps<HTMLAttributes<HTMLDivElement>>;
19
+ offset?: TooltipOffset;
20
+ arrowOffset?: TooltipOffset;
16
21
  }
17
22
  declare const Tooltip: import('react').ForwardRefExoticComponent<TooltipProps & import('react').RefAttributes<HTMLDivElement>>;
18
23
  export default Tooltip;