@w-run/wdesign-ui 0.0.0-stage → 1.1.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.
Files changed (214) hide show
  1. package/README.md +255 -2
  2. package/dist/index.d.ts +1013 -0
  3. package/dist/parts/WdAffix.js +159 -0
  4. package/dist/parts/WdAiMessage.js +277 -0
  5. package/dist/parts/WdAlert.js +92 -0
  6. package/dist/parts/WdAnchor.js +159 -0
  7. package/dist/parts/WdAudioPlayer.js +1024 -0
  8. package/dist/parts/WdAvatar.js +6 -0
  9. package/dist/parts/WdAvatarGroup.js +46 -0
  10. package/dist/parts/WdBacktop.js +120 -0
  11. package/dist/parts/WdBadge.js +61 -0
  12. package/dist/parts/WdBento.js +40 -0
  13. package/dist/parts/WdBentoItem.js +43 -0
  14. package/dist/parts/WdBottomSheet.js +263 -0
  15. package/dist/parts/WdBreadcrumb.js +64 -0
  16. package/dist/parts/WdButton.js +94 -0
  17. package/dist/parts/WdCalendar.js +11 -0
  18. package/dist/parts/WdCard.js +113 -0
  19. package/dist/parts/WdCarousel.js +365 -0
  20. package/dist/parts/WdCascader.js +386 -0
  21. package/dist/parts/WdCheckbox.js +81 -0
  22. package/dist/parts/WdCollapse.js +135 -0
  23. package/dist/parts/WdColorPicker.js +592 -0
  24. package/dist/parts/WdCommand.js +357 -0
  25. package/dist/parts/WdContainer.js +37 -0
  26. package/dist/parts/WdCountdown.js +163 -0
  27. package/dist/parts/WdDanmaku.js +6 -0
  28. package/dist/parts/WdDatePicker.js +169 -0
  29. package/dist/parts/WdDateTimePicker.js +162 -0
  30. package/dist/parts/WdDescriptions.js +146 -0
  31. package/dist/parts/WdDivider.js +64 -0
  32. package/dist/parts/WdDrawer.js +176 -0
  33. package/dist/parts/WdDropdown.js +140 -0
  34. package/dist/parts/WdEmpty.js +79 -0
  35. package/dist/parts/WdExplorer.js +336 -0
  36. package/dist/parts/WdFileList.js +177 -0
  37. package/dist/parts/WdForm.js +111 -0
  38. package/dist/parts/WdFormItem.js +156 -0
  39. package/dist/parts/WdGrid.js +40 -0
  40. package/dist/parts/WdGroup.js +68 -0
  41. package/dist/parts/WdImagePreview.js +274 -0
  42. package/dist/parts/WdInput.js +10 -0
  43. package/dist/parts/WdInputNumber.js +253 -0
  44. package/dist/parts/WdListItem.js +60 -0
  45. package/dist/parts/WdLoading.js +128 -0
  46. package/dist/parts/WdMarkdown.js +172 -0
  47. package/dist/parts/WdMarquee.js +80 -0
  48. package/dist/parts/WdMasonry.js +40 -0
  49. package/dist/parts/WdMediaCard.js +302 -0
  50. package/dist/parts/WdMentions.js +277 -0
  51. package/dist/parts/WdModal.js +149 -0
  52. package/dist/parts/WdNav.js +311 -0
  53. package/dist/parts/WdNotification.js +112 -0
  54. package/dist/parts/WdOtp.js +107 -0
  55. package/dist/parts/WdPagination.js +252 -0
  56. package/dist/parts/WdPopconfirm.js +214 -0
  57. package/dist/parts/WdPopover.js +203 -0
  58. package/dist/parts/WdPostItem.js +84 -0
  59. package/dist/parts/WdProgress.js +48 -0
  60. package/dist/parts/WdProgressRing.js +101 -0
  61. package/dist/parts/WdPullRefresh.js +167 -0
  62. package/dist/parts/WdQRCode.js +1909 -0
  63. package/dist/parts/WdRadioGroup.js +95 -0
  64. package/dist/parts/WdRate.js +128 -0
  65. package/dist/parts/WdResult.js +86 -0
  66. package/dist/parts/WdScrollbar.js +186 -0
  67. package/dist/parts/WdSegmented.js +11 -0
  68. package/dist/parts/WdSelect.js +465 -0
  69. package/dist/parts/WdSkeleton.js +69 -0
  70. package/dist/parts/WdSlider.js +100 -0
  71. package/dist/parts/WdSortableList.js +291 -0
  72. package/dist/parts/WdSpace.js +46 -0
  73. package/dist/parts/WdSparkline.js +148 -0
  74. package/dist/parts/WdSpinner.js +6 -0
  75. package/dist/parts/WdSplitter.js +183 -0
  76. package/dist/parts/WdStatBar.js +202 -0
  77. package/dist/parts/WdStatistic.js +131 -0
  78. package/dist/parts/WdSteps.js +110 -0
  79. package/dist/parts/WdSwitch.js +63 -0
  80. package/dist/parts/WdTabBar.js +84 -0
  81. package/dist/parts/WdTable.js +589 -0
  82. package/dist/parts/WdTabs.js +219 -0
  83. package/dist/parts/WdTag.js +6 -0
  84. package/dist/parts/WdTagInput.js +181 -0
  85. package/dist/parts/WdTimePicker.js +12 -0
  86. package/dist/parts/WdTimeline.js +145 -0
  87. package/dist/parts/WdTooltip.js +108 -0
  88. package/dist/parts/WdTour.js +264 -0
  89. package/dist/parts/WdTransfer.js +446 -0
  90. package/dist/parts/WdTree.js +322 -0
  91. package/dist/parts/WdUpload.js +309 -0
  92. package/dist/parts/WdVideoPlayer.js +1006 -0
  93. package/dist/parts/WdVirtualList.js +169 -0
  94. package/dist/parts/WdWatermark.js +150 -0
  95. package/dist/parts/chunk-3LVE72ZK.js +361 -0
  96. package/dist/parts/chunk-5HYOQ52I.js +101 -0
  97. package/dist/parts/chunk-7M3MUL3B.js +275 -0
  98. package/dist/parts/chunk-AOTJ63HN.js +15 -0
  99. package/dist/parts/chunk-AXEF2U2A.js +41 -0
  100. package/dist/parts/chunk-CY3QOSFP.js +645 -0
  101. package/dist/parts/chunk-G7NN4A6J.js +40 -0
  102. package/dist/parts/chunk-HAKYCUAR.js +9 -0
  103. package/dist/parts/chunk-JDE4AHBR.js +160 -0
  104. package/dist/parts/chunk-LT3NTWIT.js +117 -0
  105. package/dist/parts/chunk-OGHYFT7B.js +387 -0
  106. package/dist/parts/chunk-Q34U2HES.js +261 -0
  107. package/dist/parts/chunk-RLSVPJHM.js +10 -0
  108. package/dist/parts/chunk-U2CDKD2T.js +30 -0
  109. package/dist/parts/chunk-UYUNYHZD.js +40 -0
  110. package/dist/parts/chunk-VUJL2HGD.js +23 -0
  111. package/dist/parts/chunk-WCFG5KNT.js +51 -0
  112. package/dist/parts/chunk-WDDAALPI.js +42 -0
  113. package/dist/parts/chunk-WFXLDBP2.js +149 -0
  114. package/dist/style/affix.css +566 -0
  115. package/dist/style/ai-msg.css +746 -0
  116. package/dist/style/alert.css +636 -0
  117. package/dist/style/anchor.css +630 -0
  118. package/dist/style/audio.css +1954 -0
  119. package/dist/style/avatar.css +651 -0
  120. package/dist/style/backtop.css +625 -0
  121. package/dist/style/badge.css +632 -0
  122. package/dist/style/bento.css +763 -0
  123. package/dist/style/bottom-sheet.css +776 -0
  124. package/dist/style/breadcrumb.css +629 -0
  125. package/dist/style/button.css +829 -0
  126. package/dist/style/calendar.css +1512 -0
  127. package/dist/style/card.css +748 -0
  128. package/dist/style/carousel.css +670 -0
  129. package/dist/style/cascader.css +862 -0
  130. package/dist/style/checkbox.css +706 -0
  131. package/dist/style/chevron.css +575 -0
  132. package/dist/style/collapse.css +648 -0
  133. package/dist/style/colorpicker.css +876 -0
  134. package/dist/style/command.css +760 -0
  135. package/dist/style/container.css +550 -0
  136. package/dist/style/countdown.css +722 -0
  137. package/dist/style/danmaku.css +644 -0
  138. package/dist/style/datepicker.css +683 -0
  139. package/dist/style/datetime-picker.css +714 -0
  140. package/dist/style/descriptions.css +712 -0
  141. package/dist/style/divider.css +604 -0
  142. package/dist/style/dot.css +585 -0
  143. package/dist/style/drawer.css +743 -0
  144. package/dist/style/dropdown.css +645 -0
  145. package/dist/style/empty.css +657 -0
  146. package/dist/style/explorer.css +944 -0
  147. package/dist/style/file-list.css +664 -0
  148. package/dist/style/flip.css +600 -0
  149. package/dist/style/form.css +638 -0
  150. package/dist/style/grid.css +618 -0
  151. package/dist/style/group.css +1022 -0
  152. package/dist/style/icon-btn.css +641 -0
  153. package/dist/style/image-preview.css +725 -0
  154. package/dist/style/input-number.css +680 -0
  155. package/dist/style/input.css +682 -0
  156. package/dist/style/list.css +630 -0
  157. package/dist/style/loading.css +667 -0
  158. package/dist/style/markdown.css +884 -0
  159. package/dist/style/marquee.css +678 -0
  160. package/dist/style/masonry.css +614 -0
  161. package/dist/style/media-card.css +1229 -0
  162. package/dist/style/mentions.css +690 -0
  163. package/dist/style/modal.css +775 -0
  164. package/dist/style/nav.css +1046 -0
  165. package/dist/style/notification.css +601 -0
  166. package/dist/style/otp.css +699 -0
  167. package/dist/style/pagination.css +680 -0
  168. package/dist/style/popconfirm.css +645 -0
  169. package/dist/style/popover.css +740 -0
  170. package/dist/style/post-item.css +676 -0
  171. package/dist/style/progress-ring.css +640 -0
  172. package/dist/style/progress.css +576 -0
  173. package/dist/style/pull-refresh.css +637 -0
  174. package/dist/style/qrcode.css +613 -0
  175. package/dist/style/radio.css +705 -0
  176. package/dist/style/rate.css +637 -0
  177. package/dist/style/result.css +597 -0
  178. package/dist/style/scroll-reveal.css +613 -0
  179. package/dist/style/scrollbar.css +644 -0
  180. package/dist/style/segmented-picker.css +679 -0
  181. package/dist/style/segmented.css +894 -0
  182. package/dist/style/select.css +937 -0
  183. package/dist/style/skeleton.css +590 -0
  184. package/dist/style/slider.css +642 -0
  185. package/dist/style/sortable.css +714 -0
  186. package/dist/style/space.css +568 -0
  187. package/dist/style/sparkline.css +606 -0
  188. package/dist/style/spinner.css +586 -0
  189. package/dist/style/splitter.css +711 -0
  190. package/dist/style/stat-bar.css +767 -0
  191. package/dist/style/statistic.css +589 -0
  192. package/dist/style/steps.css +724 -0
  193. package/dist/style/switch.css +676 -0
  194. package/dist/style/tab-bar.css +647 -0
  195. package/dist/style/table.css +1229 -0
  196. package/dist/style/tabs.css +756 -0
  197. package/dist/style/tag-input.css +710 -0
  198. package/dist/style/tag.css +682 -0
  199. package/dist/style/time-picker.css +749 -0
  200. package/dist/style/timeline.css +1082 -0
  201. package/dist/style/toast.css +598 -0
  202. package/dist/style/tooltip.css +604 -0
  203. package/dist/style/tour.css +683 -0
  204. package/dist/style/transfer.css +858 -0
  205. package/dist/style/tree.css +786 -0
  206. package/dist/style/typography.css +947 -0
  207. package/dist/style/upload.css +758 -0
  208. package/dist/style/vlist.css +591 -0
  209. package/dist/style/vplayer.css +1588 -0
  210. package/dist/style/watermark.css +570 -0
  211. package/dist/wdesign-ui.css +21093 -0
  212. package/dist/wdesign-ui.esm.js +20265 -0
  213. package/package.json +134 -4
  214. package/tokens.json +385 -0
@@ -0,0 +1,149 @@
1
+ import {
2
+ popDuration
3
+ } from "./chunk-HAKYCUAR.js";
4
+ import {
5
+ useFocusTrap,
6
+ useScrollLock
7
+ } from "./chunk-LT3NTWIT.js";
8
+ import {
9
+ nextZIndex
10
+ } from "./chunk-5HYOQ52I.js";
11
+ import {
12
+ WdIcon_default
13
+ } from "./chunk-Q34U2HES.js";
14
+
15
+ // .lib-build/WdModal.ts
16
+ import { defineComponent as _defineComponent } from "vue";
17
+ import { createCommentVNode as _createCommentVNode, createElementVNode as _createElementVNode, toDisplayString as _toDisplayString, unref as _unref, createVNode as _createVNode, renderSlot as _renderSlot, openBlock as _openBlock, createElementBlock as _createElementBlock, normalizeStyle as _normalizeStyle, vShow as _vShow, withModifiers as _withModifiers, mergeProps as _mergeProps, withDirectives as _withDirectives, Teleport as _Teleport, createBlock as _createBlock } from "vue";
18
+ import { computed, ref, toRef, watchEffect } from "vue";
19
+ var _hoisted_1 = ["aria-label"];
20
+ var _hoisted_2 = { class: "wd-modal__head" };
21
+ var _hoisted_3 = { class: "wd-modal__title" };
22
+ var _hoisted_4 = {
23
+ key: 0,
24
+ class: "wd-modal__body"
25
+ };
26
+ var _hoisted_5 = {
27
+ key: 1,
28
+ class: "wd-modal__foot"
29
+ };
30
+ var WdModal_default = /* @__PURE__ */ _defineComponent({
31
+ ...{ name: "WdModal" },
32
+ __name: "WdModal",
33
+ props: {
34
+ modelValue: { type: Boolean, required: false, default: false },
35
+ title: { type: String, required: false, default: "" },
36
+ width: { type: [Number, String], required: false, default: 440 },
37
+ closeOnMask: { type: Boolean, required: false, default: true },
38
+ destroyOnClose: { type: Boolean, required: false, default: false }
39
+ },
40
+ emits: ["update:modelValue"],
41
+ setup(__props, { emit: __emit }) {
42
+ const POP_DURATION = popDuration();
43
+ const props = __props;
44
+ const emit = __emit;
45
+ const panel = ref(null);
46
+ const mounted = ref(false);
47
+ watchEffect(() => {
48
+ if (props.modelValue) mounted.value = true;
49
+ });
50
+ const contentAlive = ref(false);
51
+ let destroyTimer;
52
+ watchEffect(() => {
53
+ if (props.modelValue) {
54
+ contentAlive.value = true;
55
+ if (destroyTimer) {
56
+ clearTimeout(destroyTimer);
57
+ destroyTimer = void 0;
58
+ }
59
+ } else if (props.destroyOnClose && contentAlive.value) {
60
+ destroyTimer = window.setTimeout(() => {
61
+ contentAlive.value = false;
62
+ }, POP_DURATION);
63
+ }
64
+ });
65
+ const openRef = toRef(props, "modelValue");
66
+ const myZ = ref(0);
67
+ watchEffect(() => {
68
+ if (props.modelValue) myZ.value = nextZIndex();
69
+ });
70
+ useScrollLock(openRef);
71
+ useFocusTrap(openRef, panel, () => {
72
+ close();
73
+ return true;
74
+ });
75
+ const maxWidth = computed(
76
+ () => typeof props.width === "number" ? `${props.width}px` : props.width
77
+ );
78
+ function close() {
79
+ emit("update:modelValue", false);
80
+ }
81
+ return (_ctx, _cache) => {
82
+ return _openBlock(), _createBlock(_Teleport, { to: "body" }, [
83
+ _createCommentVNode("\n \u4E0D\u7528 <Transition>\uFF1A\u5176 enter \u9636\u6BB5\u4F9D\u8D56 nextFrame\uFF0C\u52A8\u753B\u65F6\u949F\u505C\u6446\u65F6\n \uFF08\u540E\u53F0\u6807\u7B7E\u9875 / \u65E0\u5934\u6E32\u67D3 / \u51CF\u5F31\u52A8\u6548\uFF09\u6C38\u4E0D\u63A8\u8FDB\uFF0Center-from \u4F1A\u6B8B\u7559\uFF0C\n \u5173\u95ED\u65F6\u518D\u53E0 leave-* \u5C31\u5F7B\u5E95\u9500\u6BC1\u4E0D\u6389 \u2014\u2014 \u8868\u73B0\u4E3A\u300C\u5F39\u7A97\u5173\u4E0D\u6389\u3001\u8FD8\u6321\u7740\u70B9\u51FB\u300D\u3002\n \u6539\u4E3A\u5E38\u9A7B\u8282\u70B9 + .is-open \u7C7B\uFF0C\u53EF\u89C1\u6027\u4EA4\u7ED9 display\uFF0C\u52A8\u753B\u53EA\u8D1F\u8D23\u597D\u770B\u3002\n "),
84
+ _withDirectives(_createElementVNode("div", _mergeProps(_ctx.$attrs, {
85
+ class: ["wd-modal", { "is-open": __props.modelValue }],
86
+ role: "dialog",
87
+ "aria-modal": "true",
88
+ "aria-label": __props.title || void 0,
89
+ style: { zIndex: myZ.value },
90
+ onTransitionend: _cache[1] || (_cache[1] = _withModifiers(
91
+ //@ts-ignore
92
+ (...args) => _ctx.onLeaveEnd && _ctx.onLeaveEnd(...args),
93
+ ["self"]
94
+ ))
95
+ }), [
96
+ _createElementVNode("div", {
97
+ class: "wd-modal__mask",
98
+ onClick: _cache[0] || (_cache[0] = ($event) => __props.closeOnMask && close())
99
+ }),
100
+ _createElementVNode(
101
+ "div",
102
+ {
103
+ ref_key: "panel",
104
+ ref: panel,
105
+ class: "wd-modal__panel",
106
+ tabindex: "-1",
107
+ style: _normalizeStyle({ maxWidth: maxWidth.value })
108
+ },
109
+ [
110
+ _createElementVNode("div", _hoisted_2, [
111
+ _createElementVNode(
112
+ "div",
113
+ _hoisted_3,
114
+ _toDisplayString(__props.title),
115
+ 1
116
+ /* TEXT */
117
+ ),
118
+ _createElementVNode("button", {
119
+ type: "button",
120
+ class: "wd-modal__close",
121
+ "aria-label": "\u5173\u95ED",
122
+ onClick: close
123
+ }, [
124
+ _createVNode(_unref(WdIcon_default), {
125
+ name: "close",
126
+ size: 15
127
+ })
128
+ ])
129
+ ]),
130
+ contentAlive.value || !__props.destroyOnClose ? (_openBlock(), _createElementBlock("div", _hoisted_4, [
131
+ _renderSlot(_ctx.$slots, "default")
132
+ ])) : _createCommentVNode("v-if", true),
133
+ _ctx.$slots.footer && (contentAlive.value || !__props.destroyOnClose) ? (_openBlock(), _createElementBlock("div", _hoisted_5, [
134
+ _renderSlot(_ctx.$slots, "footer")
135
+ ])) : _createCommentVNode("v-if", true)
136
+ ],
137
+ 4
138
+ /* STYLE */
139
+ )
140
+ ], 16, _hoisted_1), [
141
+ [_vShow, mounted.value]
142
+ ])
143
+ ]);
144
+ };
145
+ }
146
+ });
147
+ export {
148
+ WdModal_default as WdModal
149
+ };
@@ -0,0 +1,311 @@
1
+ import {
2
+ WdIcon_default
3
+ } from "./chunk-Q34U2HES.js";
4
+
5
+ // .lib-build/WdNav.ts
6
+ import { defineComponent as _defineComponent } from "vue";
7
+ import { createCommentVNode as _createCommentVNode, renderSlot as _renderSlot, toDisplayString as _toDisplayString, openBlock as _openBlock, createElementBlock as _createElementBlock, unref as _unref, createVNode as _createVNode, createElementVNode as _createElementVNode, renderList as _renderList, Fragment as _Fragment, normalizeClass as _normalizeClass, createBlock as _createBlock, resolveDynamicComponent as _resolveDynamicComponent, withCtx as _withCtx } from "vue";
8
+ import { computed, nextTick, ref, watch } from "vue";
9
+ var _hoisted_1 = ["aria-label"];
10
+ var _hoisted_2 = { class: "wd-nav__brand" };
11
+ var _hoisted_3 = {
12
+ key: 0,
13
+ class: "wd-nav__brand-text"
14
+ };
15
+ var _hoisted_4 = ["aria-label", "aria-expanded"];
16
+ var _hoisted_5 = ["aria-expanded", "onClick"];
17
+ var _hoisted_6 = {
18
+ key: 1,
19
+ class: "wd-nav__group"
20
+ };
21
+ var _hoisted_7 = {
22
+ key: 0,
23
+ class: "wd-nav__icon"
24
+ };
25
+ var _hoisted_8 = {
26
+ key: 1,
27
+ class: "wd-nav__icon-fallback"
28
+ };
29
+ var _hoisted_9 = {
30
+ key: 2,
31
+ class: "wd-nav__dot"
32
+ };
33
+ var _hoisted_10 = {
34
+ key: 3,
35
+ class: "wd-nav__badge"
36
+ };
37
+ var _hoisted_11 = {
38
+ key: 1,
39
+ class: "wd-nav__label"
40
+ };
41
+ var _hoisted_12 = {
42
+ key: 0,
43
+ class: "wd-nav__footer"
44
+ };
45
+ var WdNav_default = /* @__PURE__ */ _defineComponent({
46
+ ...{ name: "WdNav" },
47
+ __name: "WdNav",
48
+ props: {
49
+ direction: { type: String, required: false, default: "horizontal" },
50
+ items: { type: Array, required: false, default: () => [] },
51
+ active: { type: String, required: false, default: "" },
52
+ brand: { type: String, required: false, default: "" },
53
+ collapsed: { type: Boolean, required: false, default: false },
54
+ iconOnly: { type: Boolean, required: false, default: false },
55
+ sticky: { type: Boolean, required: false, default: true },
56
+ size: { type: String, required: false, default: "md" },
57
+ collapsibleGroups: { type: Boolean, required: false, default: false },
58
+ defaultCollapsedGroups: { type: Array, required: false, default: () => [] },
59
+ scrollActiveIntoView: { type: Boolean, required: false, default: true }
60
+ },
61
+ emits: ["update:active", "select", "update:collapsed"],
62
+ setup(__props, { emit: __emit }) {
63
+ const props = __props;
64
+ const emit = __emit;
65
+ const isVertical = computed(() => props.direction === "vertical");
66
+ const thin = computed(() => isVertical.value && (props.collapsed || props.iconOnly));
67
+ function onSelect(item, e) {
68
+ if (item.disabled) {
69
+ e.preventDefault();
70
+ return;
71
+ }
72
+ emit("update:active", item.key);
73
+ emit("select", item);
74
+ }
75
+ const navEl = ref(null);
76
+ function onNavKeydown(e) {
77
+ const forward = isVertical.value ? "ArrowDown" : "ArrowRight";
78
+ const backward = isVertical.value ? "ArrowUp" : "ArrowLeft";
79
+ if (![forward, backward, "Home", "End"].includes(e.key)) return;
80
+ const list = Array.from(
81
+ navEl.value?.querySelectorAll(".wd-nav__item:not(:disabled)") ?? []
82
+ );
83
+ if (!list.length) return;
84
+ const cur = list.indexOf(document.activeElement);
85
+ let next = cur;
86
+ if (e.key === "Home") next = 0;
87
+ else if (e.key === "End") next = list.length - 1;
88
+ else if (e.key === forward) next = Math.min(list.length - 1, cur + 1);
89
+ else next = Math.max(0, cur - 1);
90
+ if (next !== cur) {
91
+ e.preventDefault();
92
+ list[next]?.focus();
93
+ }
94
+ }
95
+ const collapsedGroups = ref(new Set(props.defaultCollapsedGroups));
96
+ function isGroupCollapsed(title) {
97
+ return collapsedGroups.value.has(title);
98
+ }
99
+ function visibleItems(g) {
100
+ if (!props.collapsibleGroups || !g.title) return g.items;
101
+ return isGroupCollapsed(g.title) ? [] : g.items;
102
+ }
103
+ function toggleGroup(title) {
104
+ const next = new Set(collapsedGroups.value);
105
+ if (next.has(title)) next.delete(title);
106
+ else next.add(title);
107
+ collapsedGroups.value = next;
108
+ }
109
+ function toggleCollapse() {
110
+ if (props.iconOnly) return;
111
+ emit("update:collapsed", !props.collapsed);
112
+ }
113
+ const listEl = ref(null);
114
+ watch(
115
+ () => props.active,
116
+ async (key) => {
117
+ if (!key) return;
118
+ if (props.collapsibleGroups) {
119
+ const item = props.items.find((it) => it.key === key);
120
+ if (item?.group && collapsedGroups.value.has(item.group)) {
121
+ const next = new Set(collapsedGroups.value);
122
+ next.delete(item.group);
123
+ collapsedGroups.value = next;
124
+ }
125
+ }
126
+ if (!props.scrollActiveIntoView) return;
127
+ await nextTick();
128
+ listEl.value?.querySelector(".is-active")?.scrollIntoView({ block: "nearest" });
129
+ },
130
+ { immediate: true }
131
+ );
132
+ const groups = computed(() => {
133
+ if (!isVertical.value) return [{ title: "", items: props.items }];
134
+ const map = /* @__PURE__ */ new Map();
135
+ for (const it of props.items) {
136
+ const g = it.group ?? "";
137
+ if (!map.has(g)) map.set(g, []);
138
+ map.get(g).push(it);
139
+ }
140
+ return [...map.entries()].map(([title, items]) => ({ title, items }));
141
+ });
142
+ const iconSize = computed(() => {
143
+ if (isVertical.value) {
144
+ if (thin.value) return props.size === "sm" ? 19 : 21;
145
+ return props.size === "sm" ? 17 : 19;
146
+ }
147
+ return props.size === "sm" ? 14 : 16;
148
+ });
149
+ return (_ctx, _cache) => {
150
+ return _openBlock(), _createElementBlock("nav", {
151
+ ref_key: "navEl",
152
+ ref: navEl,
153
+ class: _normalizeClass(["wd-nav", [
154
+ `wd-nav--${__props.direction}`,
155
+ `wd-nav--${__props.size}`,
156
+ {
157
+ "is-collapsed": thin.value,
158
+ "is-sticky": __props.sticky && !isVertical.value
159
+ }
160
+ ]]),
161
+ "aria-label": __props.brand || "\u5BFC\u822A",
162
+ onKeydown: onNavKeydown
163
+ }, [
164
+ _createCommentVNode(" \u54C1\u724C\u533A "),
165
+ _createElementVNode("div", _hoisted_2, [
166
+ _renderSlot(_ctx.$slots, "brand", {}, () => [
167
+ __props.brand ? (_openBlock(), _createElementBlock(
168
+ "span",
169
+ _hoisted_3,
170
+ _toDisplayString(__props.brand),
171
+ 1
172
+ /* TEXT */
173
+ )) : _createCommentVNode("v-if", true)
174
+ ]),
175
+ _createCommentVNode(" \u7AD6\u680F\u6298\u53E0\u6309\u94AE\uFF1A\u653E\u5728\u54C1\u724C\u4E0B\u65B9\uFF0C\u4E0E\u56FE\u6807\u7AD6\u76F4\u5BF9\u9F50 "),
176
+ isVertical.value && !__props.iconOnly && (__props.collapsed || __props.items.length) ? (_openBlock(), _createElementBlock("button", {
177
+ key: 0,
178
+ type: "button",
179
+ class: "wd-nav__collapse",
180
+ "aria-label": __props.collapsed ? "\u5C55\u5F00\u5BFC\u822A" : "\u6536\u8D77\u5BFC\u822A",
181
+ "aria-expanded": !__props.collapsed,
182
+ onClick: toggleCollapse
183
+ }, [
184
+ _createVNode(_unref(WdIcon_default), {
185
+ name: __props.collapsed ? "arrow-right" : "arrow-left",
186
+ size: 13
187
+ }, null, 8, ["name"])
188
+ ], 8, _hoisted_4)) : _createCommentVNode("v-if", true)
189
+ ]),
190
+ _createCommentVNode(" \u5BFC\u822A\u9879 "),
191
+ _createElementVNode(
192
+ "div",
193
+ {
194
+ ref_key: "listEl",
195
+ ref: listEl,
196
+ class: "wd-nav__list"
197
+ },
198
+ [
199
+ (_openBlock(true), _createElementBlock(
200
+ _Fragment,
201
+ null,
202
+ _renderList(groups.value, (g, gi) => {
203
+ return _openBlock(), _createElementBlock(
204
+ _Fragment,
205
+ { key: gi },
206
+ [
207
+ _createCommentVNode(" \u5206\u7EC4\u5934\uFF1A\u53EF\u6298\u53E0\u65F6\u662F\u4E2A\u6309\u94AE\uFF0C\u70B9\u51FB\u6536\u8D77/\u5C55\u5F00\u8FD9\u4E00\u7EC4 "),
208
+ g.title && !thin.value && __props.collapsibleGroups ? (_openBlock(), _createElementBlock("button", {
209
+ key: 0,
210
+ type: "button",
211
+ class: _normalizeClass(["wd-nav__group is-toggle", { "is-collapsed": isGroupCollapsed(g.title) }]),
212
+ "aria-expanded": !isGroupCollapsed(g.title),
213
+ onClick: ($event) => toggleGroup(g.title)
214
+ }, [
215
+ _createElementVNode(
216
+ "span",
217
+ null,
218
+ _toDisplayString(g.title),
219
+ 1
220
+ /* TEXT */
221
+ ),
222
+ _createVNode(_unref(WdIcon_default), {
223
+ class: "wd-nav__group-arrow",
224
+ name: "chevron-down",
225
+ size: 12
226
+ })
227
+ ], 10, _hoisted_5)) : g.title && !thin.value ? (_openBlock(), _createElementBlock(
228
+ "div",
229
+ _hoisted_6,
230
+ _toDisplayString(g.title),
231
+ 1
232
+ /* TEXT */
233
+ )) : _createCommentVNode("v-if", true),
234
+ (_openBlock(true), _createElementBlock(
235
+ _Fragment,
236
+ null,
237
+ _renderList(visibleItems(g), (it) => {
238
+ return _openBlock(), _createBlock(_resolveDynamicComponent(it.href ? "a" : "button"), {
239
+ key: it.key,
240
+ class: _normalizeClass(["wd-nav__item", {
241
+ "is-active": it.key === __props.active,
242
+ "is-disabled": it.disabled
243
+ }]),
244
+ href: it.href,
245
+ type: it.href ? void 0 : "button",
246
+ "aria-current": it.key === __props.active ? "page" : void 0,
247
+ "aria-label": thin.value && it.label ? it.label : void 0,
248
+ title: !thin.value && it.label ? it.label : void 0,
249
+ onClick: ($event) => onSelect(it, $event)
250
+ }, {
251
+ default: _withCtx(() => [
252
+ _createCommentVNode('\n \u56FE\u6807\u5BB9\u5668\u53EA\u5728\u9700\u8981\u65F6\u6E32\u67D3\uFF1A\n \xB7 \u6709 icon \u2192 \u663E\u793A\u56FE\u6807\n \xB7 \u7AD6\u680F\u65E0 icon \u2192 \u663E\u793A\u9996\u5B57\u5360\u4F4D\uFF08\u7AD6\u680F\u9760\u56FE\u6807\u8FA8\u8BC6\uFF0C\u5FC5\u987B\u6709\u89C6\u89C9\u951A\u70B9\uFF09\n \xB7 **\u6A2A\u680F\u65E0 icon \u2192 \u4EC0\u4E48\u90FD\u4E0D\u663E\u793A**\uFF08\u6A2A\u680F\u9760\u6587\u5B57\u8FA8\u8BC6\uFF0C\n \u52A0\u9996\u5B57\u5360\u4F4D\u4F1A\u51FA\u73B0"\u6307 \u6307\u5357"\u8FD9\u79CD\u91CD\u590D\uFF09\n '),
253
+ it.icon || isVertical.value ? (_openBlock(), _createElementBlock("span", _hoisted_7, [
254
+ it.icon ? (_openBlock(), _createBlock(_unref(WdIcon_default), {
255
+ key: 0,
256
+ name: it.icon,
257
+ size: iconSize.value
258
+ }, null, 8, ["name", "size"])) : (_openBlock(), _createElementBlock(
259
+ "span",
260
+ _hoisted_8,
261
+ _toDisplayString((it.label || "?").slice(0, 1)),
262
+ 1
263
+ /* TEXT */
264
+ )),
265
+ it.dot ? (_openBlock(), _createElementBlock("span", _hoisted_9)) : _createCommentVNode("v-if", true),
266
+ it.badge ? (_openBlock(), _createElementBlock(
267
+ "i",
268
+ _hoisted_10,
269
+ _toDisplayString(it.badge),
270
+ 1
271
+ /* TEXT */
272
+ )) : _createCommentVNode("v-if", true)
273
+ ])) : _createCommentVNode("v-if", true),
274
+ !thin.value && it.label ? (_openBlock(), _createElementBlock(
275
+ "span",
276
+ _hoisted_11,
277
+ _toDisplayString(it.label),
278
+ 1
279
+ /* TEXT */
280
+ )) : _createCommentVNode("v-if", true)
281
+ ]),
282
+ _: 2
283
+ /* DYNAMIC */
284
+ }, 1032, ["class", "href", "type", "aria-current", "aria-label", "title", "onClick"]);
285
+ }),
286
+ 128
287
+ /* KEYED_FRAGMENT */
288
+ ))
289
+ ],
290
+ 64
291
+ /* STABLE_FRAGMENT */
292
+ );
293
+ }),
294
+ 128
295
+ /* KEYED_FRAGMENT */
296
+ ))
297
+ ],
298
+ 512
299
+ /* NEED_PATCH */
300
+ ),
301
+ _createCommentVNode(" \u5E95\u90E8\u533A\uFF08\u4E3B\u9898\u5207\u6362 / \u7528\u6237 / \u9000\u51FA\uFF09 "),
302
+ _ctx.$slots.footer ? (_openBlock(), _createElementBlock("div", _hoisted_12, [
303
+ _renderSlot(_ctx.$slots, "footer")
304
+ ])) : _createCommentVNode("v-if", true)
305
+ ], 42, _hoisted_1);
306
+ };
307
+ }
308
+ });
309
+ export {
310
+ WdNav_default as WdNav
311
+ };
@@ -0,0 +1,112 @@
1
+ import {
2
+ popDuration
3
+ } from "./chunk-HAKYCUAR.js";
4
+ import {
5
+ WdIcon_default
6
+ } from "./chunk-Q34U2HES.js";
7
+
8
+ // .lib-build/WdNotification.ts
9
+ import { defineComponent as _defineComponent } from "vue";
10
+ import { unref as _unref, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, toDisplayString as _toDisplayString, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, renderSlot as _renderSlot, createTextVNode as _createTextVNode, createVNode as _createVNode, mergeProps as _mergeProps, Transition as _Transition, withCtx as _withCtx, Teleport as _Teleport, createBlock as _createBlock } from "vue";
11
+ import { watchEffect } from "vue";
12
+ var _hoisted_1 = { class: "wd-notification__body" };
13
+ var _hoisted_2 = {
14
+ key: 0,
15
+ class: "wd-notification__title"
16
+ };
17
+ var _hoisted_3 = {
18
+ key: 1,
19
+ class: "wd-notification__desc"
20
+ };
21
+ var WdNotification_default = /* @__PURE__ */ _defineComponent({
22
+ ...{ name: "WdNotification" },
23
+ __name: "WdNotification",
24
+ props: {
25
+ modelValue: { type: Boolean, required: false, default: false },
26
+ title: { type: String, required: false, default: "" },
27
+ description: { type: String, required: false, default: "" },
28
+ variant: { type: String, required: false, default: "info" }
29
+ },
30
+ emits: ["update:modelValue"],
31
+ setup(__props, { emit: __emit }) {
32
+ const POP_DURATION = popDuration();
33
+ const props = __props;
34
+ const emit = __emit;
35
+ function close() {
36
+ emit("update:modelValue", false);
37
+ }
38
+ watchEffect((onCleanup) => {
39
+ if (!props.modelValue) return;
40
+ const fn = (e) => {
41
+ if (e.key === "Escape") close();
42
+ };
43
+ document.addEventListener("keydown", fn);
44
+ onCleanup(() => document.removeEventListener("keydown", fn));
45
+ });
46
+ return (_ctx, _cache) => {
47
+ return _openBlock(), _createBlock(_Teleport, { to: "body" }, [
48
+ _createVNode(_Transition, {
49
+ name: "wd-notification-fade",
50
+ duration: _unref(POP_DURATION)
51
+ }, {
52
+ default: _withCtx(() => [
53
+ __props.modelValue ? (_openBlock(), _createElementBlock(
54
+ "div",
55
+ _mergeProps({ key: 0 }, _ctx.$attrs, {
56
+ class: ["wd-notification", `wd-notification--${__props.variant}`],
57
+ role: "alert"
58
+ }),
59
+ [
60
+ _createElementVNode(
61
+ "span",
62
+ {
63
+ class: _normalizeClass(["wd-notification__icon wd-dot wd-dot--lg", `wd-dot--${__props.variant}`])
64
+ },
65
+ null,
66
+ 2
67
+ /* CLASS */
68
+ ),
69
+ _createElementVNode("div", _hoisted_1, [
70
+ __props.title ? (_openBlock(), _createElementBlock(
71
+ "div",
72
+ _hoisted_2,
73
+ _toDisplayString(__props.title),
74
+ 1
75
+ /* TEXT */
76
+ )) : _createCommentVNode("v-if", true),
77
+ __props.description || _ctx.$slots.default ? (_openBlock(), _createElementBlock("div", _hoisted_3, [
78
+ _renderSlot(_ctx.$slots, "default", {}, () => [
79
+ _createTextVNode(
80
+ _toDisplayString(__props.description),
81
+ 1
82
+ /* TEXT */
83
+ )
84
+ ])
85
+ ])) : _createCommentVNode("v-if", true)
86
+ ]),
87
+ _createElementVNode("button", {
88
+ type: "button",
89
+ class: "wd-icon-btn wd-icon-btn--ghost wd-icon-btn--sm",
90
+ "aria-label": "\u5173\u95ED",
91
+ onClick: close
92
+ }, [
93
+ _createVNode(_unref(WdIcon_default), {
94
+ name: "close",
95
+ size: 13
96
+ })
97
+ ])
98
+ ],
99
+ 16
100
+ /* FULL_PROPS */
101
+ )) : _createCommentVNode("v-if", true)
102
+ ]),
103
+ _: 3
104
+ /* FORWARDED */
105
+ }, 8, ["duration"])
106
+ ]);
107
+ };
108
+ }
109
+ });
110
+ export {
111
+ WdNotification_default as WdNotification
112
+ };
@@ -0,0 +1,107 @@
1
+ import {
2
+ useControllable
3
+ } from "./chunk-G7NN4A6J.js";
4
+ import {
5
+ useFormItemA11y
6
+ } from "./chunk-VUJL2HGD.js";
7
+ import "./chunk-UYUNYHZD.js";
8
+
9
+ // .lib-build/WdOtp.ts
10
+ import { defineComponent as _defineComponent } from "vue";
11
+ import { unref as _unref, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, mergeProps as _mergeProps } from "vue";
12
+ import { computed, ref } from "vue";
13
+ var _hoisted_1 = ["aria-label"];
14
+ var _hoisted_2 = ["aria-label", "value", "disabled", "onInput", "onKeydown"];
15
+ var WdOtp_default = /* @__PURE__ */ _defineComponent({
16
+ ...{ name: "WdOtp" },
17
+ __name: "WdOtp",
18
+ props: {
19
+ modelValue: { type: String, required: false },
20
+ defaultValue: { type: String, required: false },
21
+ length: { type: Number, required: false, default: 6 },
22
+ disabled: { type: Boolean, required: false, default: false },
23
+ variant: { type: String, required: false, default: "separate" }
24
+ },
25
+ emits: ["update:modelValue", "change"],
26
+ setup(__props, { emit: __emit }) {
27
+ const formA11y = useFormItemA11y();
28
+ const props = __props;
29
+ const emit = __emit;
30
+ const { value, set } = useControllable({
31
+ modelValue: computed(() => props.modelValue),
32
+ defaultValue: computed(() => props.defaultValue),
33
+ fallback: "",
34
+ onChange: (v) => {
35
+ emit("update:modelValue", v);
36
+ emit("change", v);
37
+ }
38
+ });
39
+ const boxes = ref([]);
40
+ function charAt(i) {
41
+ return value.value[i] || "";
42
+ }
43
+ function onInput(i, e) {
44
+ const el = e.target;
45
+ const next = el.value.replace(/\D/g, "").slice(-1);
46
+ const arr = value.value.split("");
47
+ arr[i] = next;
48
+ set(arr.join("").slice(0, props.length));
49
+ if (next && i < props.length - 1) boxes.value[i + 1]?.focus();
50
+ }
51
+ function onKeydown(i, e) {
52
+ if (e.key === "Backspace" && !charAt(i) && i > 0) {
53
+ const arr = value.value.split("");
54
+ arr[i - 1] = "";
55
+ set(arr.join(""));
56
+ boxes.value[i - 1]?.focus();
57
+ }
58
+ if (e.key === "ArrowLeft" && i > 0) boxes.value[i - 1]?.focus();
59
+ if (e.key === "ArrowRight" && i < props.length - 1) boxes.value[i + 1]?.focus();
60
+ }
61
+ function onPaste(e) {
62
+ e.preventDefault();
63
+ const text = (e.clipboardData?.getData("text") || "").replace(/\D/g, "").slice(0, props.length);
64
+ if (!text) return;
65
+ set(text);
66
+ boxes.value[Math.min(text.length, props.length - 1)]?.focus();
67
+ }
68
+ return (_ctx, _cache) => {
69
+ return _openBlock(), _createElementBlock("div", _mergeProps({
70
+ class: ["wd-otp", [
71
+ `wd-otp--${__props.variant}`,
72
+ { "wd-otp--disabled": __props.disabled }
73
+ ]],
74
+ role: "group",
75
+ "aria-label": _ctx.$attrs["aria-label"] || "\u9A8C\u8BC1\u7801",
76
+ onPaste
77
+ }, _unref(formA11y).attrs.value), [
78
+ (_openBlock(true), _createElementBlock(
79
+ _Fragment,
80
+ null,
81
+ _renderList(__props.length, (i) => {
82
+ return _openBlock(), _createElementBlock("input", {
83
+ key: i,
84
+ ref_for: true,
85
+ ref_key: "boxes",
86
+ ref: boxes,
87
+ class: "wd-otp__box",
88
+ "aria-label": "\u9A8C\u8BC1\u7801\u7B2C " + i + " \u4F4D\uFF0C\u5171 " + __props.length + " \u4F4D",
89
+ value: charAt(i - 1),
90
+ disabled: __props.disabled,
91
+ inputmode: "numeric",
92
+ maxlength: "1",
93
+ autocomplete: "one-time-code",
94
+ onInput: ($event) => onInput(i - 1, $event),
95
+ onKeydown: ($event) => onKeydown(i - 1, $event)
96
+ }, null, 40, _hoisted_2);
97
+ }),
98
+ 128
99
+ /* KEYED_FRAGMENT */
100
+ ))
101
+ ], 16, _hoisted_1);
102
+ };
103
+ }
104
+ });
105
+ export {
106
+ WdOtp_default as WdOtp
107
+ };