@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,95 @@
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/WdRadioGroup.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, createElementVNode as _createElementVNode, toDisplayString as _toDisplayString, normalizeClass as _normalizeClass, mergeProps as _mergeProps } from "vue";
12
+ import { computed } from "vue";
13
+ var _hoisted_1 = ["aria-checked", "disabled", "onClick"];
14
+ var _hoisted_2 = { class: "wd-radio__label" };
15
+ var WdRadioGroup_default = /* @__PURE__ */ _defineComponent({
16
+ ...{ name: "WdRadioGroup" },
17
+ __name: "WdRadioGroup",
18
+ props: {
19
+ modelValue: { type: [String, Number], required: false },
20
+ defaultValue: { type: [String, Number], required: false },
21
+ options: { type: Array, required: false, default: () => [] },
22
+ disabled: { type: Boolean, required: false, default: false }
23
+ },
24
+ emits: ["update:modelValue", "change"],
25
+ setup(__props, { emit: __emit }) {
26
+ const formA11y = useFormItemA11y();
27
+ const props = __props;
28
+ const emit = __emit;
29
+ const { value, set } = useControllable({
30
+ modelValue: computed(() => props.modelValue),
31
+ defaultValue: computed(() => props.defaultValue),
32
+ fallback: "",
33
+ onChange: (v) => {
34
+ emit("update:modelValue", v);
35
+ emit("change", v);
36
+ }
37
+ });
38
+ const items = computed(
39
+ () => props.options.map((o) => typeof o === "string" ? { label: o, value: o } : o)
40
+ );
41
+ function pick(value2) {
42
+ if (!props.disabled) set(value2);
43
+ }
44
+ return (_ctx, _cache) => {
45
+ return _openBlock(), _createElementBlock(
46
+ "div",
47
+ _mergeProps({
48
+ class: "wd-radio-group",
49
+ role: "radiogroup"
50
+ }, _unref(formA11y).attrs.value),
51
+ [
52
+ (_openBlock(true), _createElementBlock(
53
+ _Fragment,
54
+ null,
55
+ _renderList(items.value, (o) => {
56
+ return _openBlock(), _createElementBlock("button", {
57
+ key: o.value,
58
+ type: "button",
59
+ role: "radio",
60
+ class: _normalizeClass(["wd-radio", { "wd-radio--checked": _unref(value) === o.value, "wd-radio--disabled": __props.disabled }]),
61
+ "aria-checked": _unref(value) === o.value,
62
+ disabled: __props.disabled,
63
+ onClick: ($event) => pick(o.value)
64
+ }, [
65
+ _cache[0] || (_cache[0] = _createElementVNode(
66
+ "span",
67
+ { class: "wd-radio__dot" },
68
+ [
69
+ _createElementVNode("span", { class: "wd-radio__inner" })
70
+ ],
71
+ -1
72
+ /* CACHED */
73
+ )),
74
+ _createElementVNode(
75
+ "span",
76
+ _hoisted_2,
77
+ _toDisplayString(o.label),
78
+ 1
79
+ /* TEXT */
80
+ )
81
+ ], 10, _hoisted_1);
82
+ }),
83
+ 128
84
+ /* KEYED_FRAGMENT */
85
+ ))
86
+ ],
87
+ 16
88
+ /* FULL_PROPS */
89
+ );
90
+ };
91
+ }
92
+ });
93
+ export {
94
+ WdRadioGroup_default as WdRadioGroup
95
+ };
@@ -0,0 +1,128 @@
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/WdRate.ts
13
+ import { defineComponent as _defineComponent } from "vue";
14
+ import { unref as _unref, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, createVNode as _createVNode, normalizeClass as _normalizeClass, mergeProps as _mergeProps } from "vue";
15
+ import { computed, ref } from "vue";
16
+ var _hoisted_1 = ["aria-label", "aria-disabled"];
17
+ var _hoisted_2 = ["aria-checked", "aria-label", "tabindex", "disabled", "onPointerenter", "onClick"];
18
+ var WdRate_default = /* @__PURE__ */ _defineComponent({
19
+ ...{ name: "WdRate" },
20
+ __name: "WdRate",
21
+ props: {
22
+ modelValue: { type: Number, required: false },
23
+ defaultValue: { type: Number, required: false },
24
+ count: { type: Number, required: false, default: 5 },
25
+ disabled: { type: Boolean, required: false, default: false },
26
+ clearable: { type: Boolean, required: false, default: true },
27
+ color: { type: String, required: false, default: "var(--wd-red)" },
28
+ colorOff: { type: String, required: false, default: "var(--wd-field-hover)" },
29
+ icon: { type: String, required: false, default: "star" },
30
+ size: { type: Number, required: false, default: 22 }
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: 0,
41
+ onChange: (v) => {
42
+ emit("update:modelValue", v);
43
+ emit("change", v);
44
+ }
45
+ });
46
+ const hover = ref(-1);
47
+ function isHoverPointer(e) {
48
+ return e.pointerType === "mouse" || e.pointerType === "pen";
49
+ }
50
+ function onEnter(i, e) {
51
+ if (props.disabled || !isHoverPointer(e)) return;
52
+ hover.value = i;
53
+ }
54
+ function onLeave(e) {
55
+ if (!isHoverPointer(e)) return;
56
+ hover.value = -1;
57
+ }
58
+ function pick(i) {
59
+ if (props.disabled) return;
60
+ hover.value = -1;
61
+ const next = value.value === i + 1 ? props.clearable ? 0 : i + 1 : i + 1;
62
+ set(next);
63
+ }
64
+ const shown = computed(() => hover.value >= 0 ? hover.value + 1 : props.modelValue);
65
+ const root = ref(null);
66
+ function onKeydown(e) {
67
+ if (props.disabled) return;
68
+ const cur = props.modelValue;
69
+ let next = null;
70
+ if (e.key === "ArrowRight" || e.key === "ArrowUp") next = Math.min(props.count, cur + 1);
71
+ else if (e.key === "ArrowLeft" || e.key === "ArrowDown") next = Math.max(0, cur - 1);
72
+ else if (e.key === "Home") next = 1;
73
+ else if (e.key === "End") next = props.count;
74
+ else if (e.key === "Delete" || e.key === "Backspace") next = 0;
75
+ if (next === null) return;
76
+ e.preventDefault();
77
+ emit("update:modelValue", next);
78
+ }
79
+ return (_ctx, _cache) => {
80
+ return _openBlock(), _createElementBlock("div", _mergeProps({
81
+ ref_key: "root",
82
+ ref: root,
83
+ class: ["wd-rate", { "wd-rate--disabled": __props.disabled }],
84
+ style: {
85
+ "--rate-color": __props.color,
86
+ "--rate-color-off": __props.colorOff
87
+ },
88
+ role: "radiogroup",
89
+ "aria-label": `\u8BC4\u5206\uFF0C\u5171 ${__props.count} \u661F\uFF0C\u5F53\u524D ${_unref(value)} \u661F`,
90
+ "aria-disabled": __props.disabled || void 0,
91
+ onMouseleave: _cache[1] || (_cache[1] = ($event) => hover.value = -1),
92
+ onKeydown
93
+ }, _unref(formA11y).attrs.value), [
94
+ (_openBlock(true), _createElementBlock(
95
+ _Fragment,
96
+ null,
97
+ _renderList(__props.count, (i) => {
98
+ return _openBlock(), _createElementBlock("button", {
99
+ key: i,
100
+ type: "button",
101
+ class: _normalizeClass(["wd-rate__item", { "wd-rate__item--on": i <= shown.value }]),
102
+ role: "radio",
103
+ "aria-checked": i === _unref(value),
104
+ "aria-label": `${i} \u661F`,
105
+ tabindex: __props.disabled ? -1 : i === (_unref(value) || (hover.value >= 0 ? hover.value + 1 : 1)) ? 0 : -1,
106
+ disabled: __props.disabled,
107
+ onPointerenter: ($event) => onEnter(i - 1, $event),
108
+ onPointerleave: _cache[0] || (_cache[0] = ($event) => onLeave($event)),
109
+ onClick: ($event) => pick(i - 1)
110
+ }, [
111
+ _createCommentVNode('\n \u7528 filled \u53D8\u4F53\uFF1A\u5B9E\u5FC3\u661F\u6BD4\u63CF\u8FB9\u661F\u66F4\u6709"\u8BC4\u5206"\u7684\u5206\u91CF\u611F\u3002\n variant="filled" \u8BA9 WdIcon \u53BB\u627E filled \u76EE\u5F55\u4E0B\u7684\u540C\u540D\u56FE\u6807\u3002\n '),
112
+ _createVNode(_unref(WdIcon_default), {
113
+ name: __props.icon,
114
+ variant: "filled",
115
+ size: __props.size
116
+ }, null, 8, ["name", "size"])
117
+ ], 42, _hoisted_2);
118
+ }),
119
+ 128
120
+ /* KEYED_FRAGMENT */
121
+ ))
122
+ ], 16, _hoisted_1);
123
+ };
124
+ }
125
+ });
126
+ export {
127
+ WdRate_default as WdRate
128
+ };
@@ -0,0 +1,86 @@
1
+ import {
2
+ WdIcon_default
3
+ } from "./chunk-Q34U2HES.js";
4
+
5
+ // .lib-build/WdResult.ts
6
+ import { defineComponent as _defineComponent } from "vue";
7
+ import { renderSlot as _renderSlot, unref as _unref, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, createElementVNode as _createElementVNode, toDisplayString as _toDisplayString, createElementBlock as _createElementBlock, createTextVNode as _createTextVNode, normalizeClass as _normalizeClass } from "vue";
8
+ var _hoisted_1 = { class: "wd-result__icon" };
9
+ var _hoisted_2 = {
10
+ key: 0,
11
+ class: "wd-result__title"
12
+ };
13
+ var _hoisted_3 = {
14
+ key: 1,
15
+ class: "wd-result__desc"
16
+ };
17
+ var _hoisted_4 = {
18
+ key: 2,
19
+ class: "wd-result__extra"
20
+ };
21
+ var WdResult_default = /* @__PURE__ */ _defineComponent({
22
+ ...{ name: "WdResult" },
23
+ __name: "WdResult",
24
+ props: {
25
+ status: { type: String, required: false, default: "info" },
26
+ title: { type: String, required: false, default: "" },
27
+ description: { type: String, required: false, default: "" }
28
+ },
29
+ setup(__props) {
30
+ return (_ctx, _cache) => {
31
+ return _openBlock(), _createElementBlock(
32
+ "div",
33
+ {
34
+ class: _normalizeClass(["wd-result", `wd-result--${__props.status}`])
35
+ },
36
+ [
37
+ _createElementVNode("div", _hoisted_1, [
38
+ _renderSlot(_ctx.$slots, "icon", {}, () => [
39
+ __props.status === "success" ? (_openBlock(), _createBlock(_unref(WdIcon_default), {
40
+ key: 0,
41
+ name: "check-circle",
42
+ size: 30
43
+ })) : __props.status === "warning" ? (_openBlock(), _createBlock(_unref(WdIcon_default), {
44
+ key: 1,
45
+ name: "warning-circle",
46
+ size: 30
47
+ })) : __props.status === "error" ? (_openBlock(), _createBlock(_unref(WdIcon_default), {
48
+ key: 2,
49
+ name: "close-circle",
50
+ size: 30
51
+ })) : (_openBlock(), _createBlock(_unref(WdIcon_default), {
52
+ key: 3,
53
+ name: "info-circle",
54
+ size: 30
55
+ }))
56
+ ])
57
+ ]),
58
+ __props.title ? (_openBlock(), _createElementBlock(
59
+ "div",
60
+ _hoisted_2,
61
+ _toDisplayString(__props.title),
62
+ 1
63
+ /* TEXT */
64
+ )) : _createCommentVNode("v-if", true),
65
+ __props.description || _ctx.$slots.default ? (_openBlock(), _createElementBlock("div", _hoisted_3, [
66
+ _renderSlot(_ctx.$slots, "default", {}, () => [
67
+ _createTextVNode(
68
+ _toDisplayString(__props.description),
69
+ 1
70
+ /* TEXT */
71
+ )
72
+ ])
73
+ ])) : _createCommentVNode("v-if", true),
74
+ _ctx.$slots.extra ? (_openBlock(), _createElementBlock("div", _hoisted_4, [
75
+ _renderSlot(_ctx.$slots, "extra")
76
+ ])) : _createCommentVNode("v-if", true)
77
+ ],
78
+ 2
79
+ /* CLASS */
80
+ );
81
+ };
82
+ }
83
+ });
84
+ export {
85
+ WdResult_default as WdResult
86
+ };
@@ -0,0 +1,186 @@
1
+ // .lib-build/WdScrollbar.ts
2
+ import { defineComponent as _defineComponent } from "vue";
3
+ import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, createCommentVNode as _createCommentVNode, normalizeStyle as _normalizeStyle, withModifiers as _withModifiers, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
4
+ import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from "vue";
5
+ var _hoisted_1 = ["aria-label"];
6
+ var WdScrollbar_default = /* @__PURE__ */ _defineComponent({
7
+ ...{ name: "WdScrollbar" },
8
+ __name: "WdScrollbar",
9
+ props: {
10
+ maxHeight: { type: [String, Number], required: false, default: void 0 },
11
+ size: { type: Number, required: false, default: 8 },
12
+ always: { type: Boolean, required: false, default: false },
13
+ native: { type: Boolean, required: false, default: false },
14
+ label: { type: String, required: false, default: "" }
15
+ },
16
+ setup(__props) {
17
+ const props = __props;
18
+ const wrap = ref(null);
19
+ const view = ref(null);
20
+ const thumb = ref({ top: 0, height: 0 });
21
+ const showThumb = ref(false);
22
+ const hovering = ref(false);
23
+ const dragging = ref(false);
24
+ const overflow = ref(false);
25
+ let ro = null;
26
+ let mo = null;
27
+ function measure() {
28
+ const v = view.value;
29
+ const w = wrap.value;
30
+ if (!v || !w) return;
31
+ const { scrollHeight, clientHeight, scrollTop } = v;
32
+ overflow.value = scrollHeight > clientHeight + 1;
33
+ if (!overflow.value) {
34
+ showThumb.value = false;
35
+ return;
36
+ }
37
+ const trackH = w.clientHeight;
38
+ const ratio = clientHeight / scrollHeight;
39
+ const h = Math.max(28, Math.round(trackH * ratio));
40
+ const maxTop = trackH - h;
41
+ const maxScroll = scrollHeight - clientHeight;
42
+ const top = maxScroll > 0 ? scrollTop / maxScroll * maxTop : 0;
43
+ thumb.value = { top, height: h };
44
+ showThumb.value = true;
45
+ }
46
+ function onScroll() {
47
+ measure();
48
+ }
49
+ let dragStartY = 0;
50
+ let dragStartTop = 0;
51
+ function onThumbDown(e) {
52
+ const v = view.value;
53
+ const w = wrap.value;
54
+ if (!v || !w) return;
55
+ e.preventDefault();
56
+ dragging.value = true;
57
+ dragStartY = e.clientY;
58
+ dragStartTop = thumb.value.top;
59
+ e.target.setPointerCapture?.(e.pointerId);
60
+ }
61
+ function onThumbMove(e) {
62
+ if (!dragging.value) return;
63
+ const v = view.value;
64
+ const w = wrap.value;
65
+ if (!v || !w) return;
66
+ const delta = e.clientY - dragStartY;
67
+ const maxTop = w.clientHeight - thumb.value.height;
68
+ if (maxTop <= 0) return;
69
+ const nextTop = Math.max(0, Math.min(dragStartTop + delta, maxTop));
70
+ const maxScroll = v.scrollHeight - v.clientHeight;
71
+ v.scrollTop = nextTop / maxTop * maxScroll;
72
+ }
73
+ function onThumbUp(e) {
74
+ dragging.value = false;
75
+ e.target.releasePointerCapture?.(e.pointerId);
76
+ }
77
+ function onTrackDown(e) {
78
+ const v = view.value;
79
+ const w = wrap.value;
80
+ if (!v || !w) return;
81
+ const rect = w.getBoundingClientRect();
82
+ const y = e.clientY - rect.top;
83
+ const page = v.clientHeight;
84
+ if (y < thumb.value.top) v.scrollTop -= page;
85
+ else v.scrollTop += page;
86
+ measure();
87
+ }
88
+ watch(
89
+ () => props.maxHeight,
90
+ () => nextTick(measure)
91
+ );
92
+ onMounted(async () => {
93
+ await nextTick();
94
+ measure();
95
+ const v = view.value;
96
+ const w = wrap.value;
97
+ if (!v || !w) return;
98
+ v.addEventListener("scroll", onScroll, { passive: true });
99
+ w.addEventListener("mouseenter", () => {
100
+ hovering.value = true;
101
+ });
102
+ w.addEventListener("mouseleave", () => {
103
+ hovering.value = false;
104
+ });
105
+ if (typeof ResizeObserver !== "undefined") {
106
+ ro = new ResizeObserver(() => measure());
107
+ ro.observe(v);
108
+ ro.observe(w);
109
+ }
110
+ if (typeof MutationObserver !== "undefined") {
111
+ mo = new MutationObserver(() => measure());
112
+ mo.observe(v, { childList: true, subtree: true, characterData: true });
113
+ }
114
+ });
115
+ onBeforeUnmount(() => {
116
+ view.value?.removeEventListener("scroll", onScroll);
117
+ ro?.disconnect();
118
+ mo?.disconnect();
119
+ });
120
+ const wrapStyle = computed(() => {
121
+ if (props.maxHeight === void 0) return {};
122
+ return {
123
+ maxHeight: typeof props.maxHeight === "number" ? `${props.maxHeight}px` : props.maxHeight
124
+ };
125
+ });
126
+ const visible = computed(() => props.always || hovering.value || dragging.value);
127
+ return (_ctx, _cache) => {
128
+ return _openBlock(), _createElementBlock(
129
+ "div",
130
+ {
131
+ ref_key: "wrap",
132
+ ref: wrap,
133
+ class: _normalizeClass(["wd-scrollbar", { "is-hover": visible.value }]),
134
+ style: _normalizeStyle(wrapStyle.value),
135
+ onMouseenter: _cache[0] || (_cache[0] = ($event) => hovering.value = true),
136
+ onMouseleave: _cache[1] || (_cache[1] = ($event) => hovering.value = false)
137
+ },
138
+ [
139
+ _createElementVNode("div", {
140
+ ref_key: "view",
141
+ ref: view,
142
+ class: _normalizeClass(["wd-scrollbar__view", { "is-native": __props.native }]),
143
+ tabindex: "0",
144
+ role: "group",
145
+ "aria-label": __props.label || void 0
146
+ }, [
147
+ _renderSlot(_ctx.$slots, "default")
148
+ ], 10, _hoisted_1),
149
+ _createCommentVNode("\n \u81EA\u5B9A\u4E49\u6ED1\u5757\u3002\n \u26A0\uFE0F \u539F\u751F\u6EDA\u52A8\u6761\u7528 CSS \u9690\u85CF\uFF08scrollbar-width: none + ::-webkit-scrollbar\uFF09\uFF0C\n \u4F46**\u6EDA\u52A8\u80FD\u529B\u5B8C\u5168\u4FDD\u7559** \u2014\u2014 \u7528 JS \u6A21\u62DF\u6EDA\u52A8\u4F1A\u4E22\u5931\u60EF\u6027\u3001\u952E\u76D8\u3001\u89E6\u63A7\u677F\u652F\u6301\u3002\n \u8FD9\u662F\u672C\u7EC4\u4EF6\u6700\u5BB9\u6613\u5199\u9519\u7684\u5730\u65B9\uFF1A\u8981\u300C\u53EA\u6362\u5916\u89C2\uFF0C\u4E0D\u6362\u6EDA\u52A8\u673A\u5236\u300D\u3002\n "),
150
+ !__props.native && overflow.value ? (_openBlock(), _createElementBlock(
151
+ "div",
152
+ {
153
+ key: 0,
154
+ class: _normalizeClass(["wd-scrollbar__track", { "is-visible": visible.value }]),
155
+ style: _normalizeStyle({ width: __props.size + "px" }),
156
+ onMousedown: _withModifiers(onTrackDown, ["self"])
157
+ },
158
+ [
159
+ _createElementVNode(
160
+ "div",
161
+ {
162
+ class: _normalizeClass(["wd-scrollbar__thumb", { "is-dragging": dragging.value }]),
163
+ style: _normalizeStyle({ top: thumb.value.top + "px", height: thumb.value.height + "px" }),
164
+ onPointerdown: onThumbDown,
165
+ onPointermove: onThumbMove,
166
+ onPointerup: onThumbUp,
167
+ onPointercancel: onThumbUp
168
+ },
169
+ null,
170
+ 38
171
+ /* CLASS, STYLE, NEED_HYDRATION */
172
+ )
173
+ ],
174
+ 38
175
+ /* CLASS, STYLE, NEED_HYDRATION */
176
+ )) : _createCommentVNode("v-if", true)
177
+ ],
178
+ 38
179
+ /* CLASS, STYLE, NEED_HYDRATION */
180
+ );
181
+ };
182
+ }
183
+ });
184
+ export {
185
+ WdScrollbar_default as WdScrollbar
186
+ };
@@ -0,0 +1,11 @@
1
+ import {
2
+ WdSegmented_default
3
+ } from "./chunk-3LVE72ZK.js";
4
+ import "./chunk-5HYOQ52I.js";
5
+ import "./chunk-WFXLDBP2.js";
6
+ import "./chunk-VUJL2HGD.js";
7
+ import "./chunk-UYUNYHZD.js";
8
+ import "./chunk-Q34U2HES.js";
9
+ export {
10
+ WdSegmented_default as WdSegmented
11
+ };