@loafacto/ui 0.8.8 → 0.8.9

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.
@@ -4,7 +4,37 @@ type __VLS_Props = {
4
4
  size?: 'sm' | 'md' | 'lg' | 'xl';
5
5
  /** 화면 높이를 거의 채운다. 목록·에디터처럼 내용이 긴 모달용. */
6
6
  fullHeight?: boolean;
7
- /** 바깥 클릭·ESC 로 닫히지 않게 한다. 입력 중이던 내용을 잃는 모달에 쓴다. */
7
+ /**
8
+ * 바깥(스크림)을 눌러 닫을 수 있게 한다. **기본은 닫지 않는다.**
9
+ *
10
+ * 예전에는 기본이 반대였다. 그러자 입력이 있는 모달마다 하나씩 `persistent` 를
11
+ * 손으로 달게 됐다 — hub 에서만 로그인·비밀번호 찾기·프로필 편집·비밀번호 재설정·
12
+ * 소셜 연동 확인·변경 이력·공지까지 13곳이 그랬다. **매번 켜야 하는 옵션이면
13
+ * 그게 기본값이어야 한다.**
14
+ *
15
+ * 값이 대칭이 아닌 것이 결정적이다. 바깥 클릭은 사고로 가장 쉽게 나오는 동작이고
16
+ * (스크롤하려고, 창에 포커스 주려고, 툴팁 지우려고 누른다) 그 대가는 적던 내용이
17
+ * 말없이 사라지는 것이다. 반대쪽 대가는 X 를 한 번 더 누르는 것뿐이다.
18
+ *
19
+ * 갇히지도 않는다 — `closable` 이 기본으로 켜져 있어 닫기 버튼이 늘 있다.
20
+ * 읽기만 하는 모달(상세 보기·미리 보기)처럼 잃을 것이 없으면 이 값을 켜면 된다.
21
+ */
22
+ closeOnScrim?: boolean;
23
+ /**
24
+ * ESC 로 닫을 수 있게 한다. **기본은 닫는다.**
25
+ *
26
+ * 스크림과 한 덩어리로 다루면 안 된다. ESC 는 사고로 눌리지 않고, 의도적이며,
27
+ * 키보드 사용자에게는 유일한 탈출구다 — WAI-ARIA 의 dialog 패턴이 요구하는
28
+ * 동작이기도 하다. 끄는 것은 대답을 받아야만 넘어가는 모달에서만 뜻이 있다.
29
+ */
30
+ closeOnEsc?: boolean;
31
+ /**
32
+ * 바깥 클릭과 ESC 를 **함께** 막는다.
33
+ *
34
+ * @deprecated 기본값이 뒤집히면서 스크림 쪽으로는 할 일이 없어졌다. ESC 까지
35
+ * 막아야 하는 자리면 `:close-on-esc="false"` 를 쓰는 편이 무엇을 끄는지 분명하다.
36
+ * 이미 달려 있는 곳(hub 13곳)이 조용히 뜻을 바꾸지 않도록 남겨 둔다.
37
+ */
8
38
  persistent?: boolean;
9
39
  /** 닫기 버튼을 놓을지. */
10
40
  closable?: boolean;
@@ -32,6 +62,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
32
62
  "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
33
63
  }>, {
34
64
  size: "sm" | "md" | "lg" | "xl";
65
+ closeOnScrim: boolean;
66
+ closeOnEsc: boolean;
35
67
  closable: boolean;
36
68
  closeLabel: string;
37
69
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { readonly, ref, openBlock, createElementBlock, createStaticVNode, createElementVNode, defineComponent, computed, watch, onBeforeUnmount, normalizeStyle, createCommentVNode, Fragment, toDisplayString, createVNode, renderList, normalizeClass, renderSlot, unref, onUnmounted, createBlock, Teleport, TransitionGroup, withCtx, withModifiers, Transition, useTemplateRef, nextTick, createTextVNode, withDirectives, withKeys, vModelText, resolveDynamicComponent, useModel, useId, mergeProps, vModelDynamic, mergeModels, onMounted, vModelSelect, vModelCheckbox, vModelRadio, useSlots } from "vue";
1
+ import { readonly, ref, openBlock, createElementBlock, createStaticVNode, createElementVNode, defineComponent, computed, watch, onBeforeUnmount, normalizeStyle, createCommentVNode, Fragment, toDisplayString, createVNode, renderList, normalizeClass, renderSlot, unref, onUnmounted, createBlock, Teleport, TransitionGroup, withCtx, withModifiers, Transition, useTemplateRef, onMounted, nextTick, createTextVNode, withDirectives, withKeys, vModelText, resolveDynamicComponent, useModel, useId, mergeProps, vModelDynamic, mergeModels, vModelSelect, vModelCheckbox, vModelRadio, useSlots } from "vue";
2
2
  import { a as applyTheme, D as DARK_THEME, L as LIGHT_THEME } from "./applyTheme-EBr0eOKY.js";
3
3
  import { b, c, d, e, f, h, i, l } from "./applyTheme-EBr0eOKY.js";
4
4
  import { defineStore } from "pinia";
@@ -767,6 +767,13 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
767
767
  setup(__props) {
768
768
  const store = useConfirmStore();
769
769
  const requireInput = useTemplateRef("requireInput");
770
+ function onKeydown(e2) {
771
+ if (e2.key !== "Escape" || !store.open) return;
772
+ e2.stopPropagation();
773
+ store.resolve(false);
774
+ }
775
+ onMounted(() => document.addEventListener("keydown", onKeydown));
776
+ onBeforeUnmount(() => document.removeEventListener("keydown", onKeydown));
770
777
  watch(
771
778
  () => store.open,
772
779
  async (open) => {
@@ -828,7 +835,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
828
835
  };
829
836
  }
830
837
  });
831
- const AppConfirmModal = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-0f5ba1a6"]]);
838
+ const AppConfirmModal = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-d4c67de1"]]);
832
839
  const LF_ICONS = {
833
840
  close: "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z",
834
841
  search: "M15.5 14h-.79l-.28-.27A6.47 6.47 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19 15.5 14zm-6 0A4.5 4.5 0 1 1 14 9.5 4.5 4.5 0 0 1 9.5 14z",
@@ -1566,6 +1573,8 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
1566
1573
  subtitle: {},
1567
1574
  size: { default: "md" },
1568
1575
  fullHeight: { type: Boolean },
1576
+ closeOnScrim: { type: Boolean, default: false },
1577
+ closeOnEsc: { type: Boolean, default: true },
1569
1578
  persistent: { type: Boolean },
1570
1579
  closable: { type: Boolean, default: true },
1571
1580
  closeLabel: { default: "닫기" },
@@ -1593,10 +1602,10 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
1593
1602
  function onScrimClick() {
1594
1603
  if (!downOnScrim) return;
1595
1604
  downOnScrim = false;
1596
- if (!props.persistent) close("scrim");
1605
+ if (props.closeOnScrim && !props.persistent) close("scrim");
1597
1606
  }
1598
1607
  function onKeydown(e2) {
1599
- if (e2.key === "Escape" && !props.persistent) {
1608
+ if (e2.key === "Escape" && props.closeOnEsc && !props.persistent) {
1600
1609
  e2.stopPropagation();
1601
1610
  close("esc");
1602
1611
  return;
@@ -1703,7 +1712,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
1703
1712
  };
1704
1713
  }
1705
1714
  });
1706
- const LfModal = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-e52c29ac"]]);
1715
+ const LfModal = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-f5492216"]]);
1707
1716
  const _hoisted_1$c = {
1708
1717
  key: 0,
1709
1718
  class: "lf-card__head"