@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,386 @@
1
+ import {
2
+ uid
3
+ } from "./chunk-RLSVPJHM.js";
4
+ import {
5
+ useOverlayLayer
6
+ } from "./chunk-5HYOQ52I.js";
7
+ import {
8
+ WdSpinner_default
9
+ } from "./chunk-WDDAALPI.js";
10
+ import {
11
+ useAnchoredPosition,
12
+ useDismiss
13
+ } from "./chunk-WFXLDBP2.js";
14
+ import {
15
+ useFormItemA11y
16
+ } from "./chunk-VUJL2HGD.js";
17
+ import "./chunk-UYUNYHZD.js";
18
+ import {
19
+ WdIcon_default
20
+ } from "./chunk-Q34U2HES.js";
21
+
22
+ // .lib-build/WdCascader.ts
23
+ import { defineComponent as _defineComponent } from "vue";
24
+ import { unref as _unref, toDisplayString as _toDisplayString, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, createCommentVNode as _createCommentVNode, createVNode as _createVNode, withModifiers as _withModifiers, openBlock as _openBlock, createElementBlock as _createElementBlock, mergeProps as _mergeProps, renderList as _renderList, Fragment as _Fragment, renderSlot as _renderSlot, createBlock as _createBlock, createTextVNode as _createTextVNode, normalizeStyle as _normalizeStyle, Teleport as _Teleport } from "vue";
25
+ import { computed, nextTick, ref, watch } from "vue";
26
+ var _hoisted_1 = ["tabindex", "aria-expanded", "aria-controls"];
27
+ var _hoisted_2 = ["data-placement", "id"];
28
+ var _hoisted_3 = ["disabled", "aria-selected", "onClick"];
29
+ var _hoisted_4 = { class: "wd-cascader__label" };
30
+ var _hoisted_5 = {
31
+ key: 0,
32
+ class: "wd-cascader__loading",
33
+ role: "status",
34
+ "aria-live": "polite"
35
+ };
36
+ var _hoisted_6 = {
37
+ key: 1,
38
+ class: "wd-cascader__empty"
39
+ };
40
+ var WdCascader_default = /* @__PURE__ */ _defineComponent({
41
+ ...{ name: "WdCascader" },
42
+ __name: "WdCascader",
43
+ props: {
44
+ options: { type: Array, required: false, default: () => [] },
45
+ modelValue: { type: Array, required: false, default: void 0 },
46
+ placeholder: { type: String, required: false, default: "\u8BF7\u9009\u62E9" },
47
+ changeOnSelect: { type: Boolean, required: false, default: false },
48
+ disabled: { type: Boolean, required: false, default: false },
49
+ clearable: { type: Boolean, required: false, default: true },
50
+ size: { type: String, required: false, default: "md" },
51
+ maxHeight: { type: Number, required: false, default: 280 },
52
+ loading: { type: Boolean, required: false, default: false },
53
+ emptyText: { type: String, required: false, default: "\u6682\u65E0\u9009\u9879" }
54
+ },
55
+ emits: ["update:modelValue", "change"],
56
+ setup(__props, { emit: __emit }) {
57
+ const formA11y = useFormItemA11y();
58
+ const panelId = uid("wd-cascader-panel");
59
+ const props = __props;
60
+ const emit = __emit;
61
+ const open = ref(false);
62
+ const mounted = ref(false);
63
+ const rootEl = ref(null);
64
+ const panelEl = ref(null);
65
+ const { pos, actual } = useAnchoredPosition(open, rootEl, panelEl, {
66
+ placement: "bottom-start",
67
+ gap: 6,
68
+ matchWidth: true
69
+ });
70
+ const inner = ref([]);
71
+ const isControlled = computed(() => props.modelValue !== void 0);
72
+ const selected = computed(() => isControlled.value ? props.modelValue : inner.value);
73
+ const browsing = ref([]);
74
+ const kbdCursor = ref(null);
75
+ const columns = computed(() => {
76
+ const out = [props.options];
77
+ let level = props.options;
78
+ for (const v of browsing.value) {
79
+ const hit = level.find((o) => o.value === v);
80
+ if (!hit?.children?.length) break;
81
+ out.push(hit.children);
82
+ level = hit.children;
83
+ }
84
+ return out;
85
+ });
86
+ function pickedAt(level) {
87
+ return browsing.value[level];
88
+ }
89
+ function labelsOf(values) {
90
+ const out = [];
91
+ let level = props.options;
92
+ for (const v of values) {
93
+ const hit = level.find((o) => o.value === v);
94
+ if (!hit) break;
95
+ out.push(hit.label);
96
+ level = hit.children ?? [];
97
+ }
98
+ return out;
99
+ }
100
+ const displayText = computed(() => labelsOf(selected.value).join(" / "));
101
+ watch(open, (v) => {
102
+ if (v) {
103
+ browsing.value = [...selected.value];
104
+ kbdCursor.value = selected.value.length ? selected.value[selected.value.length - 1] : null;
105
+ } else {
106
+ kbdCursor.value = null;
107
+ }
108
+ });
109
+ function toggleOpen() {
110
+ if (props.disabled) return;
111
+ if (open.value) close();
112
+ else {
113
+ mounted.value = true;
114
+ open.value = true;
115
+ }
116
+ }
117
+ function close() {
118
+ open.value = false;
119
+ window.setTimeout(() => {
120
+ if (!open.value) mounted.value = false;
121
+ }, 200);
122
+ }
123
+ function pick(level, opt) {
124
+ if (opt.disabled) return;
125
+ const next = browsing.value.slice(0, level);
126
+ next.push(opt.value);
127
+ const hasChildren = !!opt.children?.length;
128
+ if (hasChildren) {
129
+ browsing.value = next;
130
+ if (props.changeOnSelect) commit(next);
131
+ return;
132
+ }
133
+ browsing.value = next;
134
+ commit(next);
135
+ close();
136
+ }
137
+ function commit(values) {
138
+ if (!isControlled.value) inner.value = values;
139
+ emit("update:modelValue", values);
140
+ emit("change", values, labelsOf(values));
141
+ }
142
+ function clear(e) {
143
+ e.stopPropagation();
144
+ browsing.value = [];
145
+ if (!isControlled.value) inner.value = [];
146
+ emit("update:modelValue", []);
147
+ emit("change", [], []);
148
+ }
149
+ function onKeydown(e) {
150
+ if (e.key === "Escape") {
151
+ close();
152
+ return;
153
+ }
154
+ if (!open.value) {
155
+ if (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") {
156
+ e.preventDefault();
157
+ toggleOpen();
158
+ }
159
+ return;
160
+ }
161
+ const cols = columns.value;
162
+ const level = cols.length - 1;
163
+ const col = cols[level] ?? [];
164
+ if (!col.length) return;
165
+ const idx = col.findIndex((o) => o.value === kbdCursor.value);
166
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") {
167
+ e.preventDefault();
168
+ let next;
169
+ if (idx < 0) next = e.key === "ArrowDown" ? 0 : col.length - 1;
170
+ else next = e.key === "ArrowDown" ? Math.min(idx + 1, col.length - 1) : Math.max(idx - 1, 0);
171
+ let guard = 0;
172
+ while (col[next]?.disabled && guard++ < col.length) {
173
+ next += e.key === "ArrowDown" ? 1 : -1;
174
+ if (next < 0 || next >= col.length) return;
175
+ }
176
+ kbdCursor.value = col[next].value;
177
+ return;
178
+ }
179
+ if (e.key === "ArrowRight") {
180
+ const hit = col.find((o) => o.value === kbdCursor.value);
181
+ if (hit?.children?.length) {
182
+ e.preventDefault();
183
+ browsing.value = [...browsing.value.slice(0, level), hit.value];
184
+ kbdCursor.value = hit.children[0].value;
185
+ }
186
+ return;
187
+ }
188
+ if (e.key === "ArrowLeft") {
189
+ if (level > 0) {
190
+ e.preventDefault();
191
+ kbdCursor.value = browsing.value[level - 1] ?? null;
192
+ browsing.value = browsing.value.slice(0, level - 1);
193
+ }
194
+ return;
195
+ }
196
+ if (e.key === "Enter" || e.key === " ") {
197
+ e.preventDefault();
198
+ const hit = col.find((o) => o.value === kbdCursor.value);
199
+ if (!hit || hit.disabled) return;
200
+ if (hit.children?.length) {
201
+ browsing.value = [...browsing.value.slice(0, level), hit.value];
202
+ kbdCursor.value = hit.children[0].value;
203
+ } else {
204
+ pick(level, hit);
205
+ kbdCursor.value = null;
206
+ }
207
+ }
208
+ }
209
+ useDismiss([rootEl, panelEl], close, open);
210
+ useOverlayLayer(open, panelEl, () => {
211
+ close();
212
+ return true;
213
+ });
214
+ const style = computed(() => ({
215
+ top: pos.value.top + "px",
216
+ left: pos.value.left + "px",
217
+ maxHeight: props.maxHeight + "px"
218
+ }));
219
+ watch(open, async (v) => {
220
+ if (v) {
221
+ await nextTick();
222
+ }
223
+ });
224
+ return (_ctx, _cache) => {
225
+ return _openBlock(), _createElementBlock(
226
+ _Fragment,
227
+ null,
228
+ [
229
+ _createElementVNode("div", _mergeProps({
230
+ ref_key: "rootEl",
231
+ ref: rootEl,
232
+ class: ["wd-cascader", [`wd-cascader--${__props.size}`, { "is-open": open.value, "is-disabled": __props.disabled }]],
233
+ tabindex: __props.disabled ? -1 : 0,
234
+ role: "combobox",
235
+ "aria-expanded": open.value,
236
+ "aria-haspopup": "listbox",
237
+ "aria-controls": open.value ? _unref(panelId) : void 0,
238
+ onClick: toggleOpen,
239
+ onKeydown
240
+ }, { ..._ctx.$attrs, ..._unref(formA11y).attrs.value }), [
241
+ _createElementVNode(
242
+ "span",
243
+ {
244
+ class: _normalizeClass(["wd-cascader__value", { "is-placeholder": !displayText.value }])
245
+ },
246
+ _toDisplayString(displayText.value || __props.placeholder),
247
+ 3
248
+ /* TEXT, CLASS */
249
+ ),
250
+ _createCommentVNode(" \u6E05\u7A7A\uFF1A\u53EA\u5728\u6709\u503C\u65F6\u51FA\u73B0\uFF0C\u4E14\u4E0D\u89E6\u53D1\u9762\u677F\u5F00\u5173 "),
251
+ __props.clearable && displayText.value && !__props.disabled ? (_openBlock(), _createElementBlock("button", {
252
+ key: 0,
253
+ type: "button",
254
+ class: "wd-cascader__clear",
255
+ "aria-label": "\u6E05\u7A7A",
256
+ onClick: _withModifiers(clear, ["stop"])
257
+ }, [
258
+ _createVNode(_unref(WdIcon_default), {
259
+ name: "close",
260
+ size: 13,
261
+ "aria-hidden": "true"
262
+ })
263
+ ])) : _createCommentVNode("v-if", true),
264
+ _createVNode(_unref(WdIcon_default), {
265
+ class: _normalizeClass(["wd-cascader__caret", { "is-open": open.value }]),
266
+ name: "chevron-down",
267
+ size: 15
268
+ }, null, 8, ["class"])
269
+ ], 16, _hoisted_1),
270
+ (_openBlock(), _createBlock(_Teleport, { to: "body" }, [
271
+ mounted.value ? (_openBlock(), _createElementBlock("div", {
272
+ key: 0,
273
+ ref_key: "panelEl",
274
+ ref: panelEl,
275
+ class: _normalizeClass(["wd-cascader__panel", { "is-open": open.value }]),
276
+ style: _normalizeStyle(style.value),
277
+ "data-placement": _unref(actual),
278
+ id: _unref(panelId),
279
+ role: "listbox"
280
+ }, [
281
+ _createCommentVNode("\n \u591A\u5217\u5E76\u6392\uFF1A\u6BCF\u4E00\u5C42\u4E00\u5217\u3002\n \u26A0\uFE0F \u7528 flex \u800C\u4E0D\u662F\u7EDD\u5BF9\u5B9A\u4F4D\u53E0\u52A0 \u2014\u2014 \u5217\u5BBD\u7531\u5185\u5BB9\u51B3\u5B9A\uFF0C\n \u7EDD\u5BF9\u5B9A\u4F4D\u9700\u8981\u9884\u77E5\u6BCF\u5217\u5BBD\u5EA6\uFF0C\u591A\u8BED\u8A00\u4E0B\u4F1A\u7B97\u9519\u3002\n "),
282
+ (_openBlock(true), _createElementBlock(
283
+ _Fragment,
284
+ null,
285
+ _renderList(columns.value, (col, level) => {
286
+ return _openBlock(), _createElementBlock("div", {
287
+ key: level,
288
+ class: "wd-cascader__column"
289
+ }, [
290
+ (_openBlock(true), _createElementBlock(
291
+ _Fragment,
292
+ null,
293
+ _renderList(col, (opt) => {
294
+ return _openBlock(), _createElementBlock("button", {
295
+ key: opt.value,
296
+ type: "button",
297
+ class: _normalizeClass(["wd-cascader__option", {
298
+ /*
299
+ * 高亮:键盘游标优先。
300
+ *
301
+ * is-active 原来只认 browsing(pickedAt)。键盘引入独立游标后,
302
+ * ↓/↑ 只改 kbdCursor 不动 browsing —— 若不在这里读 kbdCursor,
303
+ * 光标移动就没有任何视觉反馈,等于键盘导航「看不见」。
304
+ * 鼠标操作时 kbdCursor 恰好等于 browsing 的对应值,不受影响。
305
+ */
306
+ /*
307
+ * 高亮:分两种情况。
308
+ *
309
+ * · 光标所在列 → 认 kbdCursor(键盘游标)
310
+ * · 更浅的列 → 认 browsing(已展开的父级路径,要一直亮着,
311
+ * 否则按 → 进入子列后,父级「浙江」就灭掉,
312
+ * 用户会丢失「我现在在哪条路径上」的上下文)
313
+ */
314
+ "is-active": (level === columns.value.length - 1 ? kbdCursor.value ?? pickedAt(level) : pickedAt(level)) === opt.value,
315
+ "is-selected": selected.value[level] === opt.value,
316
+ "is-disabled": opt.disabled
317
+ }]),
318
+ disabled: opt.disabled,
319
+ role: "option",
320
+ "aria-selected": selected.value[level] === opt.value,
321
+ onClick: _withModifiers(($event) => pick(level, opt), ["stop"])
322
+ }, [
323
+ _renderSlot(_ctx.$slots, "option", {
324
+ item: opt,
325
+ level,
326
+ selected: selected.value[level] === opt.value
327
+ }, () => [
328
+ _createElementVNode(
329
+ "span",
330
+ _hoisted_4,
331
+ _toDisplayString(opt.label),
332
+ 1
333
+ /* TEXT */
334
+ )
335
+ ]),
336
+ opt.children?.length ? (_openBlock(), _createBlock(_unref(WdIcon_default), {
337
+ key: 0,
338
+ class: "wd-cascader__arrow",
339
+ name: "chevron-right",
340
+ size: 14
341
+ })) : selected.value[level] === opt.value ? (_openBlock(), _createBlock(_unref(WdIcon_default), {
342
+ key: 1,
343
+ class: "wd-cascader__check",
344
+ name: "check",
345
+ size: 14
346
+ })) : _createCommentVNode("v-if", true)
347
+ ], 10, _hoisted_3);
348
+ }),
349
+ 128
350
+ /* KEYED_FRAGMENT */
351
+ )),
352
+ __props.loading ? (_openBlock(), _createElementBlock("div", _hoisted_5, [
353
+ _createVNode(WdSpinner_default, { size: "sm" }),
354
+ _cache[0] || (_cache[0] = _createElementVNode(
355
+ "span",
356
+ null,
357
+ "\u52A0\u8F7D\u4E2D\u2026",
358
+ -1
359
+ /* CACHED */
360
+ ))
361
+ ])) : col.length === 0 ? (_openBlock(), _createElementBlock("div", _hoisted_6, [
362
+ _renderSlot(_ctx.$slots, "empty", {}, () => [
363
+ _createTextVNode(
364
+ _toDisplayString(__props.emptyText),
365
+ 1
366
+ /* TEXT */
367
+ )
368
+ ])
369
+ ])) : _createCommentVNode("v-if", true)
370
+ ]);
371
+ }),
372
+ 128
373
+ /* KEYED_FRAGMENT */
374
+ ))
375
+ ], 14, _hoisted_2)) : _createCommentVNode("v-if", true)
376
+ ]))
377
+ ],
378
+ 64
379
+ /* STABLE_FRAGMENT */
380
+ );
381
+ };
382
+ }
383
+ });
384
+ export {
385
+ WdCascader_default as WdCascader
386
+ };
@@ -0,0 +1,81 @@
1
+ import {
2
+ useControllable
3
+ } from "./chunk-G7NN4A6J.js";
4
+ import {
5
+ useFormItemA11y
6
+ } from "./chunk-VUJL2HGD.js";
7
+ import "./chunk-UYUNYHZD.js";
8
+ import {
9
+ WdIcon_default
10
+ } from "./chunk-Q34U2HES.js";
11
+
12
+ // .lib-build/WdCheckbox.ts
13
+ import { defineComponent as _defineComponent } from "vue";
14
+ import { unref as _unref, createVNode as _createVNode, createElementVNode as _createElementVNode, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, mergeProps as _mergeProps } from "vue";
15
+ import { computed } from "vue";
16
+ var _hoisted_1 = ["aria-checked", "disabled"];
17
+ var _hoisted_2 = { class: "wd-checkbox__box" };
18
+ var _hoisted_3 = {
19
+ key: 0,
20
+ class: "wd-checkbox__label"
21
+ };
22
+ var WdCheckbox_default = /* @__PURE__ */ _defineComponent({
23
+ ...{ name: "WdCheckbox" },
24
+ __name: "WdCheckbox",
25
+ props: {
26
+ modelValue: { type: Boolean, required: false },
27
+ defaultValue: { type: Boolean, required: false },
28
+ label: { type: String, required: false, default: "" },
29
+ disabled: { type: Boolean, required: false, default: false },
30
+ color: { type: String, required: false, default: "" }
31
+ },
32
+ emits: ["update:modelValue", "change"],
33
+ setup(__props, { emit: __emit }) {
34
+ const formA11y = useFormItemA11y();
35
+ const props = __props;
36
+ const emit = __emit;
37
+ const { value, set } = useControllable({
38
+ modelValue: computed(() => props.modelValue),
39
+ defaultValue: computed(() => props.defaultValue),
40
+ fallback: false,
41
+ onChange: (v) => {
42
+ emit("update:modelValue", v);
43
+ emit("change", v);
44
+ }
45
+ });
46
+ function toggle() {
47
+ if (!props.disabled) set(!value.value);
48
+ }
49
+ return (_ctx, _cache) => {
50
+ return _openBlock(), _createElementBlock("button", _mergeProps({
51
+ type: "button",
52
+ role: "checkbox",
53
+ class: ["wd-checkbox", { "wd-checkbox--checked": _unref(value), "wd-checkbox--disabled": __props.disabled }],
54
+ "aria-checked": _unref(value)
55
+ }, _unref(formA11y).attrs.value, {
56
+ disabled: __props.disabled,
57
+ style: __props.color ? { "--wd-check-color": __props.color } : void 0,
58
+ onClick: toggle
59
+ }), [
60
+ _createElementVNode("span", _hoisted_2, [
61
+ _createVNode(_unref(WdIcon_default), {
62
+ name: "check",
63
+ size: 13
64
+ })
65
+ ]),
66
+ __props.label || _ctx.$slots.default ? (_openBlock(), _createElementBlock("span", _hoisted_3, [
67
+ _renderSlot(_ctx.$slots, "default", {}, () => [
68
+ _createTextVNode(
69
+ _toDisplayString(__props.label),
70
+ 1
71
+ /* TEXT */
72
+ )
73
+ ])
74
+ ])) : _createCommentVNode("v-if", true)
75
+ ], 16, _hoisted_1);
76
+ };
77
+ }
78
+ });
79
+ export {
80
+ WdCheckbox_default as WdCheckbox
81
+ };
@@ -0,0 +1,135 @@
1
+ import {
2
+ useControllable
3
+ } from "./chunk-G7NN4A6J.js";
4
+ import {
5
+ WdIcon_default
6
+ } from "./chunk-Q34U2HES.js";
7
+
8
+ // .lib-build/WdCollapse.ts
9
+ import { defineComponent as _defineComponent } from "vue";
10
+ import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, unref as _unref, normalizeClass as _normalizeClass, createVNode as _createVNode, createTextVNode as _createTextVNode } from "vue";
11
+ import { computed } from "vue";
12
+ var _hoisted_1 = ["aria-expanded", "disabled", "onClick"];
13
+ var _hoisted_2 = { class: "wd-collapse__body" };
14
+ var _hoisted_3 = { class: "wd-collapse__inner" };
15
+ var _hoisted_4 = { class: "wd-collapse__content" };
16
+ var WdCollapse_default = /* @__PURE__ */ _defineComponent({
17
+ ...{ name: "WdCollapse" },
18
+ __name: "WdCollapse",
19
+ props: {
20
+ modelValue: { type: Array, required: false },
21
+ defaultValue: { type: Array, required: false, default: () => [] },
22
+ items: { type: Array, required: false, default: () => [] },
23
+ accordion: { type: Boolean, required: false, default: false },
24
+ collapsible: { type: Boolean, required: false, default: true },
25
+ size: { type: String, required: false, default: "md" }
26
+ },
27
+ emits: ["update:modelValue", "change"],
28
+ setup(__props, { emit: __emit }) {
29
+ const props = __props;
30
+ const emit = __emit;
31
+ const { value: opened, set: setOpened } = useControllable({
32
+ modelValue: computed(() => props.modelValue),
33
+ defaultValue: computed(() => props.defaultValue),
34
+ fallback: [],
35
+ onChange: (v) => emit("update:modelValue", v)
36
+ });
37
+ const openSet = computed(() => new Set(opened.value));
38
+ function commit(next, action) {
39
+ setOpened(next);
40
+ emit("change", next, action);
41
+ }
42
+ function toggle(i) {
43
+ if (props.items[i]?.disabled) return;
44
+ const willOpen = !openSet.value.has(i);
45
+ if (!props.accordion) {
46
+ const next = new Set(opened.value);
47
+ if (next.has(i)) next.delete(i);
48
+ else next.add(i);
49
+ commit([...next].sort((a, b) => a - b), willOpen ? "open" : "close");
50
+ return;
51
+ }
52
+ if (openSet.value.has(i)) {
53
+ commit(props.collapsible ? [] : [i], props.collapsible ? "close" : "open");
54
+ } else {
55
+ commit([i], "open");
56
+ }
57
+ }
58
+ return (_ctx, _cache) => {
59
+ return _openBlock(), _createElementBlock(
60
+ "div",
61
+ {
62
+ class: _normalizeClass(["wd-collapse", "wd-collapse--" + __props.size])
63
+ },
64
+ [
65
+ (_openBlock(true), _createElementBlock(
66
+ _Fragment,
67
+ null,
68
+ _renderList(props.items, (item, i) => {
69
+ return _openBlock(), _createElementBlock(
70
+ "div",
71
+ {
72
+ key: i,
73
+ class: _normalizeClass(["wd-collapse__item", {
74
+ "wd-collapse__item--open": openSet.value.has(i),
75
+ "wd-collapse__item--disabled": item.disabled
76
+ }])
77
+ },
78
+ [
79
+ _createElementVNode("button", {
80
+ type: "button",
81
+ class: "wd-collapse__head",
82
+ "aria-expanded": openSet.value.has(i),
83
+ disabled: item.disabled,
84
+ onClick: ($event) => toggle(i)
85
+ }, [
86
+ _renderSlot(_ctx.$slots, "title", {
87
+ item,
88
+ index: i,
89
+ open: openSet.value.has(i)
90
+ }, () => [
91
+ _createElementVNode(
92
+ "span",
93
+ null,
94
+ _toDisplayString(item.title),
95
+ 1
96
+ /* TEXT */
97
+ )
98
+ ]),
99
+ _createVNode(_unref(WdIcon_default), {
100
+ class: _normalizeClass(["wd-chevron", { "wd-chevron--open": openSet.value.has(i) }]),
101
+ name: "chevron-down",
102
+ size: 15
103
+ }, null, 8, ["class"])
104
+ ], 8, _hoisted_1),
105
+ _createElementVNode("div", _hoisted_2, [
106
+ _createElementVNode("div", _hoisted_3, [
107
+ _createElementVNode("div", _hoisted_4, [
108
+ _renderSlot(_ctx.$slots, `item-${i}`, { item }, () => [
109
+ _createTextVNode(
110
+ _toDisplayString(item.content),
111
+ 1
112
+ /* TEXT */
113
+ )
114
+ ])
115
+ ])
116
+ ])
117
+ ])
118
+ ],
119
+ 2
120
+ /* CLASS */
121
+ );
122
+ }),
123
+ 128
124
+ /* KEYED_FRAGMENT */
125
+ ))
126
+ ],
127
+ 2
128
+ /* CLASS */
129
+ );
130
+ };
131
+ }
132
+ });
133
+ export {
134
+ WdCollapse_default as WdCollapse
135
+ };