@solhun/feedback-kit-web 0.4.0 → 0.5.0

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/index.cjs CHANGED
@@ -854,7 +854,7 @@ var import_feedback_kit_core3 = require("@solhun/feedback-kit-core");
854
854
  var import_react = require("react");
855
855
 
856
856
  // src/version.ts
857
- var VERSION = true ? "0.4.0" : "dev";
857
+ var VERSION = true ? "0.5.0" : "dev";
858
858
 
859
859
  // src/feedback-kit.tsx
860
860
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -1012,6 +1012,96 @@ var inputStyle = {
1012
1012
  padding: "10px 11px",
1013
1013
  font: "inherit"
1014
1014
  };
1015
+ function PickToggle({
1016
+ active,
1017
+ disabled,
1018
+ variant,
1019
+ focusId,
1020
+ onToggle
1021
+ }) {
1022
+ const floating = variant === "floating";
1023
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1024
+ "button",
1025
+ {
1026
+ type: "button",
1027
+ role: "switch",
1028
+ "aria-checked": active,
1029
+ "aria-label": "\uC694\uC18C \uC9C0\uBAA9 \uBAA8\uB4DC",
1030
+ "data-fk-pick-toggle": active ? "on" : "off",
1031
+ "data-fk-focus-id": focusId,
1032
+ disabled,
1033
+ onClick: onToggle,
1034
+ style: {
1035
+ ...baseButton,
1036
+ display: "flex",
1037
+ alignItems: "center",
1038
+ gap: 10,
1039
+ opacity: disabled ? 0.5 : 1,
1040
+ cursor: disabled ? "not-allowed" : "pointer",
1041
+ // 항상 값을 준다. 조건부로 빼면 리렌더 때 shorthand(border)와 충돌한다고 React 가 경고한다.
1042
+ borderColor: active ? TOKENS.accent : TOKENS.line,
1043
+ ...floating ? {
1044
+ position: "fixed",
1045
+ top: 16,
1046
+ left: "50%",
1047
+ transform: "translateX(-50%)",
1048
+ // 오버레이 자체는 클릭을 통과시킨다(pointerEvents:none) — 이 토글만 되살린다.
1049
+ pointerEvents: "auto",
1050
+ background: TOKENS.surface,
1051
+ boxShadow: TOKENS.shadow
1052
+ } : {
1053
+ width: "100%",
1054
+ justifyContent: "space-between",
1055
+ marginBottom: 16,
1056
+ background: active ? "rgba(49, 93, 115, 0.06)" : TOKENS.surface
1057
+ }
1058
+ },
1059
+ children: [
1060
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { style: { display: "inline-flex", alignItems: "center", gap: 7 }, children: [
1061
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { "aria-hidden": "true", style: { color: active ? TOKENS.accent : TOKENS.muted }, children: "\u25CE" }),
1062
+ "\uC694\uC18C \uC9C0\uBAA9 \uBAA8\uB4DC"
1063
+ ] }),
1064
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { "aria-hidden": "true", style: { display: "inline-flex", alignItems: "center", gap: 8 }, children: [
1065
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1066
+ "span",
1067
+ {
1068
+ style: { fontSize: 12, fontWeight: 600, color: active ? TOKENS.accent : TOKENS.muted },
1069
+ children: active ? "\uCF1C\uC9D0" : "\uAEBC\uC9D0"
1070
+ }
1071
+ ),
1072
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1073
+ "span",
1074
+ {
1075
+ style: {
1076
+ position: "relative",
1077
+ display: "inline-block",
1078
+ width: 38,
1079
+ height: 22,
1080
+ borderRadius: 11,
1081
+ background: active ? TOKENS.accent : TOKENS.line
1082
+ },
1083
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1084
+ "span",
1085
+ {
1086
+ style: {
1087
+ position: "absolute",
1088
+ top: 3,
1089
+ left: active ? 19 : 3,
1090
+ width: 16,
1091
+ height: 16,
1092
+ borderRadius: "50%",
1093
+ background: TOKENS.surface,
1094
+ boxShadow: "0 1px 3px rgba(23, 32, 42, 0.35)"
1095
+ }
1096
+ }
1097
+ )
1098
+ }
1099
+ )
1100
+ ] })
1101
+ ]
1102
+ }
1103
+ );
1104
+ }
1015
1105
  function MarkerStatus({ status }) {
1016
1106
  const presentation = status === "sending" ? { icon: "\u21BB", text: "\uC804\uC1A1 \uC911", color: TOKENS.accent } : status === "done" ? { icon: "\u2713", text: "\uC644\uB8CC", color: TOKENS.success } : { icon: "\u25F7", text: "\uB300\uAE30", color: TOKENS.warning };
1017
1107
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { style: { display: "inline-flex", gap: 4, alignItems: "center", color: presentation.color }, children: [
@@ -1120,8 +1210,12 @@ function FeedbackKit(props) {
1120
1210
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...OWN_UI_PROPS, "data-feedback-kit-loading": "true" });
1121
1211
  }
1122
1212
  const activeKit = kit;
1123
- const { modal, screen } = widgetState;
1213
+ const { modal, screen, pickingActive } = widgetState;
1124
1214
  const draftLocked = modal.submitStatus === "sending" || modal.submitStatus === "pending";
1215
+ function togglePicking() {
1216
+ if (pickingActive) activeKit.widget.stopPicking();
1217
+ else activeKit.widget.startPicking();
1218
+ }
1125
1219
  async function withOwnUiHidden(action) {
1126
1220
  const root = rootRef.current;
1127
1221
  const previousVisibility = root?.style.visibility ?? "";
@@ -1193,8 +1287,7 @@ function FeedbackKit(props) {
1193
1287
  ref: floatingButtonRef,
1194
1288
  id: import_feedback_kit_core3.FLOATING_BUTTON_ID,
1195
1289
  type: "button",
1196
- disabled: screen === "picking",
1197
- "aria-label": screen === "picking" ? "\uC694\uC18C \uC9C0\uBAA9 \uC911" : "\uD53C\uB4DC\uBC31 \uBCF4\uB0B4\uAE30",
1290
+ "aria-label": "\uD53C\uB4DC\uBC31 \uBCF4\uB0B4\uAE30",
1198
1291
  onClick: () => void openReport(),
1199
1292
  style: {
1200
1293
  ...primaryButton,
@@ -1205,11 +1298,9 @@ function FeedbackKit(props) {
1205
1298
  minWidth: 112,
1206
1299
  minHeight: 46,
1207
1300
  borderRadius: 24,
1208
- boxShadow: TOKENS.shadow,
1209
- opacity: screen === "picking" ? 0.76 : 1,
1210
- cursor: screen === "picking" ? "default" : "pointer"
1301
+ boxShadow: TOKENS.shadow
1211
1302
  },
1212
- children: screen === "picking" ? "\uC9C0\uBAA9 \uC911" : "\uD53C\uB4DC\uBC31"
1303
+ children: "\uD53C\uB4DC\uBC31"
1213
1304
  }
1214
1305
  ) : null,
1215
1306
  announcement && !modal.open ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -1293,7 +1384,17 @@ function FeedbackKit(props) {
1293
1384
  ]
1294
1385
  }
1295
1386
  ),
1296
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { style: { margin: "0 0 18px", color: TOKENS.muted }, children: "\uD604\uC7AC \uD654\uBA74\uC758 \uBB38\uC81C\uB098 \uC758\uACAC\uC744 \uB0A8\uACA8\uC8FC\uC138\uC694." }),
1387
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { style: { margin: "0 0 14px", color: TOKENS.muted }, children: "\uD604\uC7AC \uD654\uBA74\uC758 \uBB38\uC81C\uB098 \uC758\uACAC\uC744 \uB0A8\uACA8\uC8FC\uC138\uC694." }),
1388
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1389
+ PickToggle,
1390
+ {
1391
+ variant: "inline",
1392
+ active: pickingActive,
1393
+ disabled: draftLocked,
1394
+ focusId: import_feedback_kit_core3.MODAL_ACTION_PICK,
1395
+ onToggle: togglePicking
1396
+ }
1397
+ ),
1297
1398
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { "aria-labelledby": "feedback-kit-screenshot-label", style: { marginBottom: 16 }, children: [
1298
1399
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { id: "feedback-kit-screenshot-label", children: "\uC2A4\uD06C\uB9B0\uC0F7" }),
1299
1400
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -1407,19 +1508,6 @@ function FeedbackKit(props) {
1407
1508
  ]
1408
1509
  }
1409
1510
  ),
1410
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1411
- "button",
1412
- {
1413
- type: "button",
1414
- role: "switch",
1415
- "aria-checked": "false",
1416
- disabled: draftLocked,
1417
- "data-fk-focus-id": import_feedback_kit_core3.MODAL_ACTION_PICK,
1418
- onClick: () => kit.widget.startPicking(),
1419
- style: { ...baseButton, width: "100%", marginTop: 16 },
1420
- children: "\uC694\uC18C \uC9C0\uBAA9"
1421
- }
1422
- ),
1423
1511
  modal.submitStatus !== "idle" || modal.pending > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
1424
1512
  "div",
1425
1513
  {
@@ -1542,22 +1630,7 @@ function FeedbackKit(props) {
1542
1630
  }
1543
1631
  }
1544
1632
  ) : null,
1545
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1546
- "button",
1547
- {
1548
- type: "button",
1549
- onClick: () => kit.widget.stopPicking(),
1550
- style: {
1551
- ...primaryButton,
1552
- position: "fixed",
1553
- top: 18,
1554
- right: 18,
1555
- pointerEvents: "auto",
1556
- boxShadow: TOKENS.shadow
1557
- },
1558
- children: "\uC9C0\uBAA9 \uC885\uB8CC"
1559
- }
1560
- ),
1633
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PickToggle, { variant: "floating", active: true, onToggle: togglePicking }),
1561
1634
  pickingState.markers.map((marker, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1562
1635
  "div",
1563
1636
  {