@sdata/web-vue 4.1.0 → 4.3.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 (109) hide show
  1. package/dist/sd.css +135 -117
  2. package/dist/sd.min.css +2 -2
  3. package/es/_components/auto-tooltip/auto-tooltip.vue_vue_type_script_setup_true_lang.js +17 -50
  4. package/es/_components/input-label/input-label.vue_vue_type_script_setup_true_lang.js +2 -2
  5. package/es/_components/picker/input-range.vue_vue_type_script_setup_true_lang.js +1 -1
  6. package/es/_components/picker/input.vue_vue_type_script_setup_true_lang.js +1 -1
  7. package/es/_components/select-view/style/index.css +0 -39
  8. package/es/anchor/anchor.vue.d.ts +1 -1
  9. package/es/anchor/index.d.ts +3 -3
  10. package/es/auto-complete/auto-complete.vue.d.ts +4 -4
  11. package/es/auto-complete/auto-complete.vue_vue_type_script_setup_true_lang.js +6 -6
  12. package/es/avatar/avatar.vue_vue_type_script_setup_true_lang.js +1 -1
  13. package/es/bloom-menu/bloom-menu.js +5 -0
  14. package/es/bloom-menu/bloom-menu.vue.d.ts +52 -0
  15. package/es/bloom-menu/bloom-menu.vue_vue_type_script_setup_true_lang.js +380 -0
  16. package/es/bloom-menu/index.d.ts +6 -0
  17. package/es/bloom-menu/index.js +10 -0
  18. package/es/bloom-menu/style/css.js +2 -0
  19. package/es/bloom-menu/style/index.css +135 -0
  20. package/es/bloom-menu/style/index.d.ts +2 -0
  21. package/es/bloom-menu/style/index.js +2 -0
  22. package/es/bloom-menu/style/index.scss +153 -0
  23. package/es/bloom-menu/style/token.scss +24 -0
  24. package/es/bloom-menu/types.d.ts +11 -0
  25. package/es/button/button.vue_vue_type_script_setup_true_lang.js +1 -1
  26. package/es/cascader/cascader-option.vue_vue_type_script_setup_true_lang.js +1 -1
  27. package/es/cascader/cascader-panel.vue.d.ts +1 -1
  28. package/es/cascader/cascader.vue.d.ts +1 -1
  29. package/es/cascader/cascader.vue_vue_type_script_setup_true_lang.js +1 -1
  30. package/es/clamp/index.d.ts +212 -0
  31. package/es/clamp/index.js +15 -0
  32. package/es/clamp/style/css.js +1 -0
  33. package/es/clamp/style/index.css +0 -0
  34. package/es/clamp/style/index.d.ts +1 -0
  35. package/es/clamp/style/index.js +1 -0
  36. package/es/clamp/style/index.scss +1 -0
  37. package/es/clamp/style/token.scss +1 -0
  38. package/es/color-picker/color-picker.vue_vue_type_script_setup_true_lang.js +1 -1
  39. package/es/components.d.ts +5 -0
  40. package/es/date-picker/picker.vue_vue_type_script_setup_true_lang.js +2 -2
  41. package/es/date-picker/range-picker.vue_vue_type_script_setup_true_lang.js +2 -2
  42. package/es/drawer/drawer.vue_vue_type_script_setup_true_lang.js +1 -1
  43. package/es/ellipsis/ellipsis.vue.d.ts +8 -15
  44. package/es/ellipsis/ellipsis.vue_vue_type_script_setup_true_lang.js +113 -118
  45. package/es/ellipsis/index.d.ts +14 -16
  46. package/es/ellipsis/performant-ellipsis.vue.d.ts +3 -5
  47. package/es/ellipsis/performant-ellipsis.vue_vue_type_script_setup_true_lang.js +12 -24
  48. package/es/ellipsis/style/index.css +0 -2
  49. package/es/ellipsis/style/index.scss +3 -2
  50. package/es/file-previewer/file-previewer.vue_vue_type_script_setup_true_lang.js +1 -1
  51. package/es/image/image.vue_vue_type_script_setup_true_lang.js +1 -1
  52. package/es/image/preview.vue_vue_type_script_setup_true_lang.js +1 -1
  53. package/es/index.css +135 -117
  54. package/es/index.d.ts +4 -0
  55. package/es/index.js +5 -3
  56. package/es/index.scss +2 -0
  57. package/es/input/input.vue_vue_type_script_setup_true_lang.js +2 -2
  58. package/es/input-tag/index.d.ts +0 -4
  59. package/es/input-tag/input-tag.vue.d.ts +3 -7
  60. package/es/input-tag/input-tag.vue_vue_type_script_setup_true_lang.js +85 -157
  61. package/es/input-tag/style/index.css +6 -39
  62. package/es/input-tag/style/index.scss +7 -0
  63. package/es/input-tag/style/input-tag.scss +0 -45
  64. package/es/link/link.vue_vue_type_script_setup_true_lang.js +2 -2
  65. package/es/list/index.d.ts +3 -3
  66. package/es/list/list.vue.d.ts +1 -1
  67. package/es/locale/interface.d.ts +2 -0
  68. package/es/locale/lang/en-us.js +2 -0
  69. package/es/locale/lang/zh-cn.js +2 -0
  70. package/es/menu/base-menu.vue_vue_type_script_setup_true_lang.js +3 -3
  71. package/es/menu/overflow-wrap.vue_vue_type_script_setup_true_lang.js +21 -27
  72. package/es/menu/style/index.css +5 -2
  73. package/es/menu/style/index.scss +5 -2
  74. package/es/modal/index.js +1 -1
  75. package/es/modal/modal.vue_vue_type_script_setup_true_lang.js +1 -1
  76. package/es/popover/style/index.css +0 -1
  77. package/es/popover/style/index.scss +0 -1
  78. package/es/rate/rate.vue_vue_type_script_setup_true_lang.js +1 -1
  79. package/es/sd-vue.js +9 -2
  80. package/es/secret/secret.vue_vue_type_script_setup_true_lang.js +2 -2
  81. package/es/select/select.vue_vue_type_script_setup_true_lang.js +2 -2
  82. package/es/sender/sender.vue_vue_type_script_setup_true_lang.js +1 -1
  83. package/es/table/index.d.ts +8 -8
  84. package/es/table/table-tr.vue.d.ts +1 -1
  85. package/es/table/table.vue.d.ts +2 -2
  86. package/es/tag/tag.vue_vue_type_script_setup_true_lang.js +1 -1
  87. package/es/tag-group/index.d.ts +4 -6
  88. package/es/tag-group/style/index.css +6 -29
  89. package/es/tag-group/style/index.scss +9 -34
  90. package/es/tag-group/tag-group.vue.d.ts +8 -11
  91. package/es/tag-group/tag-group.vue_vue_type_script_setup_true_lang.js +91 -272
  92. package/es/textarea/textarea.vue_vue_type_script_setup_true_lang.js +2 -2
  93. package/es/time-picker/time-picker.vue_vue_type_script_setup_true_lang.js +1 -1
  94. package/es/tree/node-switcher.vue_vue_type_script_setup_true_lang.js +1 -1
  95. package/es/tree/tree.vue.d.ts +12 -12
  96. package/es/tree/tree.vue_vue_type_script_setup_true_lang.js +1 -1
  97. package/es/tree-select/tree-select.vue_vue_type_script_setup_true_lang.js +2 -2
  98. package/es/trigger/trigger.vue_vue_type_script_setup_true_lang.js +3 -3
  99. package/es/typography/base.vue.d.ts +15 -15
  100. package/es/typography/base.vue_vue_type_script_setup_true_lang.js +93 -164
  101. package/es/typography/interface.d.ts +1 -2
  102. package/es/typography/style/index.css +0 -5
  103. package/es/typography/style/index.scss +0 -7
  104. package/json/vetur-attributes.json +0 -20
  105. package/json/vetur-tags.json +5 -10
  106. package/json/web-types.json +9 -53
  107. package/package.json +2 -1
  108. package/es/typography/utils/measure.d.ts +0 -6
  109. package/es/typography/utils/measure.js +0 -69
@@ -0,0 +1,380 @@
1
+ import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.142.0/helpers/esm/objectSpread2.js";
2
+ import { getPrefixCls } from "../_utils/global-config.js";
3
+ import IconClose from "../icon/icon-close/index.js";
4
+ import { useI18n } from "../locale/index.js";
5
+ import Trigger from "../trigger/index.js";
6
+ import Button from "../button/index.js";
7
+ import IconPlus from "../icon/icon-plus/index.js";
8
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeProps, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, openBlock, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, unref, useTemplateRef, watch, withCtx } from "vue";
9
+ import { shift } from "@floating-ui/vue";
10
+ import { Motion, useReducedMotion } from "motion-v";
11
+ //#region components/bloom-menu/bloom-menu.vue?vue&type=script&setup=true&lang.ts
12
+ var _hoisted_1 = { ref: "panelRoot" };
13
+ var bloom_menu_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent(_objectSpread2(_objectSpread2({}, { name: "BloomMenu" }), {}, {
14
+ __name: "bloom-menu",
15
+ props: {
16
+ items: {},
17
+ modelValue: {
18
+ type: Boolean,
19
+ default: () => void 0
20
+ },
21
+ defaultOpen: {
22
+ type: Boolean,
23
+ default: false
24
+ },
25
+ columns: { default: 3 },
26
+ title: { default: "Create" },
27
+ triggerText: { default: "Create" },
28
+ buttonProps: {},
29
+ offset: {},
30
+ closeAriaLabel: {}
31
+ },
32
+ emits: [
33
+ "update:modelValue",
34
+ "open",
35
+ "close",
36
+ "select"
37
+ ],
38
+ setup(__props, { emit: __emit }) {
39
+ var _props$modelValue;
40
+ const emit = __emit;
41
+ const prefixCls = getPrefixCls("bloom-menu");
42
+ const { t } = useI18n();
43
+ const triggerButtonRef = useTemplateRef("triggerButton");
44
+ const panelRootRef = useTemplateRef("panelRoot");
45
+ const internalOpen = shallowRef(__props.defaultOpen);
46
+ const popupVisible = shallowRef((_props$modelValue = __props.modelValue) !== null && _props$modelValue !== void 0 ? _props$modelValue : __props.defaultOpen);
47
+ const reducedMotion = useReducedMotion();
48
+ const triggerStyle = shallowRef({
49
+ width: 144,
50
+ height: 44,
51
+ backgroundColor: "transparent",
52
+ borderColor: "transparent",
53
+ borderRadius: "16px",
54
+ boxShadow: "none",
55
+ color: "currentColor"
56
+ });
57
+ const normalizedColumns = computed(() => Math.max(1, Math.floor(__props.columns)));
58
+ const rowCount = computed(() => Math.max(1, Math.ceil(__props.items.length / normalizedColumns.value)));
59
+ const isOpen = computed(() => {
60
+ var _props$modelValue2;
61
+ return (_props$modelValue2 = __props.modelValue) !== null && _props$modelValue2 !== void 0 ? _props$modelValue2 : internalOpen.value;
62
+ });
63
+ const rootClasses = computed(() => [prefixCls, { [`${prefixCls}-open`]: isOpen.value }]);
64
+ const centerMiddleware = computed(() => ({
65
+ name: "bloomMenuCenter",
66
+ fn: ({ rects }) => {
67
+ var _props$offset$left, _props$offset, _props$offset$top, _props$offset2;
68
+ return {
69
+ x: rects.reference.x + (rects.reference.width - rects.floating.width) / 2 + ((_props$offset$left = (_props$offset = __props.offset) === null || _props$offset === void 0 ? void 0 : _props$offset.left) !== null && _props$offset$left !== void 0 ? _props$offset$left : 0),
70
+ y: rects.reference.y + (rects.reference.height - rects.floating.height) / 2 + ((_props$offset$top = (_props$offset2 = __props.offset) === null || _props$offset2 === void 0 ? void 0 : _props$offset2.top) !== null && _props$offset$top !== void 0 ? _props$offset$top : 0)
71
+ };
72
+ }
73
+ }));
74
+ const floatingOptions = computed(() => ({
75
+ placement: "top",
76
+ middleware: [centerMiddleware.value, shift({ crossAxis: true })]
77
+ }));
78
+ const popupContentStyle = computed(() => ({ pointerEvents: isOpen.value ? void 0 : "none" }));
79
+ const panelStyle = computed(() => ({
80
+ "--bloom-menu-columns": normalizedColumns.value,
81
+ "--bloom-menu-source-width": `${triggerStyle.value.width}px`,
82
+ "--bloom-menu-source-height": `${triggerStyle.value.height}px`,
83
+ "--bloom-menu-source-background": triggerStyle.value.backgroundColor,
84
+ "--bloom-menu-source-border-color": triggerStyle.value.borderColor,
85
+ "--bloom-menu-source-border-radius": triggerStyle.value.borderRadius,
86
+ "--bloom-menu-source-box-shadow": triggerStyle.value.boxShadow,
87
+ "--bloom-menu-source-color": triggerStyle.value.color
88
+ }));
89
+ const panelCollapsed = computed(() => reducedMotion.value ? {} : {
90
+ width: "var(--bloom-menu-source-width)",
91
+ height: "var(--bloom-menu-source-height)",
92
+ color: "var(--bloom-menu-source-color)",
93
+ backgroundColor: "var(--bloom-menu-source-background)",
94
+ borderColor: "var(--bloom-menu-source-border-color)",
95
+ borderRadius: "var(--bloom-menu-source-border-radius)",
96
+ boxShadow: "var(--bloom-menu-source-box-shadow)"
97
+ });
98
+ const panelInitial = computed(() => _objectSpread2(_objectSpread2({}, panelCollapsed.value), {}, { opacity: reducedMotion.value ? 0 : .98 }));
99
+ const panelAnimate = computed(() => ({
100
+ width: "var(--bloom-menu-panel-width)",
101
+ height: "auto",
102
+ color: "var(--bloom-menu-panel-color)",
103
+ backgroundColor: "var(--bloom-menu-panel-background)",
104
+ borderColor: "var(--bloom-menu-panel-border-color)",
105
+ borderRadius: "var(--bloom-menu-panel-border-radius)",
106
+ boxShadow: "var(--bloom-menu-panel-shadow)",
107
+ opacity: 1
108
+ }));
109
+ const panelTarget = computed(() => isOpen.value ? panelAnimate.value : panelCollapsed.value);
110
+ const morphTransition = computed(() => reducedMotion.value ? { duration: .15 } : {
111
+ type: "spring",
112
+ stiffness: 300,
113
+ damping: 32,
114
+ mass: .9
115
+ });
116
+ const contentTransition = computed(() => ({
117
+ delay: isOpen.value && !reducedMotion.value ? .12 : 0,
118
+ duration: reducedMotion.value ? .15 : isOpen.value ? .2 : .12
119
+ }));
120
+ const gridInitial = computed(() => reducedMotion.value ? false : { clipPath: "inset(45% 34% 45% 34%)" });
121
+ const gridTransition = computed(() => ({
122
+ delay: reducedMotion.value ? 0 : .08,
123
+ duration: reducedMotion.value ? .15 : .45,
124
+ ease: [
125
+ .16,
126
+ 1,
127
+ .3,
128
+ 1
129
+ ]
130
+ }));
131
+ function getTriggerElement(event) {
132
+ var _triggerButtonRef$val;
133
+ if ((event === null || event === void 0 ? void 0 : event.currentTarget) instanceof HTMLElement) return event.currentTarget;
134
+ return (_triggerButtonRef$val = triggerButtonRef.value) === null || _triggerButtonRef$val === void 0 ? void 0 : _triggerButtonRef$val.$el;
135
+ }
136
+ function captureTriggerStyle(event) {
137
+ const element = getTriggerElement(event);
138
+ if (!element || typeof window === "undefined") return;
139
+ const rect = element.getBoundingClientRect();
140
+ const style = window.getComputedStyle(element);
141
+ triggerStyle.value = {
142
+ width: rect.width,
143
+ height: rect.height,
144
+ backgroundColor: style.backgroundColor,
145
+ borderColor: style.borderColor,
146
+ borderRadius: style.borderRadius,
147
+ boxShadow: style.boxShadow,
148
+ color: style.color
149
+ };
150
+ }
151
+ function setOpen(nextOpen) {
152
+ if (nextOpen === isOpen.value) return;
153
+ if (__props.modelValue === void 0) internalOpen.value = nextOpen;
154
+ emit("update:modelValue", nextOpen);
155
+ if (nextOpen) emit("open");
156
+ else emit("close");
157
+ }
158
+ function handlePopupVisibleChange(visible) {
159
+ if (visible) {
160
+ captureTriggerStyle();
161
+ setOpen(true);
162
+ } else {
163
+ var _panelRootRef$value;
164
+ if (document.activeElement instanceof HTMLElement && ((_panelRootRef$value = panelRootRef.value) === null || _panelRootRef$value === void 0 ? void 0 : _panelRootRef$value.contains(document.activeElement))) focusTrigger();
165
+ setOpen(false);
166
+ }
167
+ }
168
+ let closeTimer = 0;
169
+ function schedulePopupHide() {
170
+ window.clearTimeout(closeTimer);
171
+ closeTimer = window.setTimeout(() => {
172
+ if (!isOpen.value) popupVisible.value = false;
173
+ }, reducedMotion.value ? 150 : 450);
174
+ }
175
+ function open() {
176
+ captureTriggerStyle();
177
+ setOpen(true);
178
+ }
179
+ function focusTrigger() {
180
+ var _triggerButtonRef$val2;
181
+ (_triggerButtonRef$val2 = triggerButtonRef.value) === null || _triggerButtonRef$val2 === void 0 || (_triggerButtonRef$val2 = _triggerButtonRef$val2.$el) === null || _triggerButtonRef$val2 === void 0 || _triggerButtonRef$val2.focus();
182
+ }
183
+ function close(restoreFocus = false) {
184
+ setOpen(false);
185
+ if (restoreFocus) nextTick(focusTrigger);
186
+ }
187
+ function focusPanel(attempt = 0) {
188
+ nextTick(() => {
189
+ var _panelRootRef$value2, _panelRootRef$value3;
190
+ const firstItem = (_panelRootRef$value2 = panelRootRef.value) === null || _panelRootRef$value2 === void 0 ? void 0 : _panelRootRef$value2.querySelector(`.${prefixCls}-item:not(:disabled)`);
191
+ const closeButton = (_panelRootRef$value3 = panelRootRef.value) === null || _panelRootRef$value3 === void 0 ? void 0 : _panelRootRef$value3.querySelector(`.${prefixCls}-close`);
192
+ const target = firstItem !== null && firstItem !== void 0 ? firstItem : closeButton;
193
+ if (!target || getComputedStyle(target).visibility === "hidden") {
194
+ if (attempt < 30) requestAnimationFrame(() => focusPanel(attempt + 1));
195
+ return;
196
+ }
197
+ target.focus();
198
+ });
199
+ }
200
+ function selectItem(item, index) {
201
+ if (item.disabled) return;
202
+ emit("select", item, index);
203
+ close(true);
204
+ }
205
+ function getItemClasses(item, index) {
206
+ const column = index % normalizedColumns.value;
207
+ const row = Math.floor(index / normalizedColumns.value);
208
+ return [`${prefixCls}-item`, {
209
+ [`${prefixCls}-item-border-right`]: column < normalizedColumns.value - 1,
210
+ [`${prefixCls}-item-border-bottom`]: row < rowCount.value - 1,
211
+ [`${prefixCls}-item-disabled`]: item.disabled
212
+ }];
213
+ }
214
+ function getItemInitial() {
215
+ return reducedMotion.value ? { opacity: 0 } : {
216
+ opacity: 0,
217
+ scale: .85,
218
+ filter: "blur(6px)"
219
+ };
220
+ }
221
+ function getItemTransition(index) {
222
+ const column = index % normalizedColumns.value;
223
+ const row = Math.floor(index / normalizedColumns.value);
224
+ const distance = Math.hypot(column - (normalizedColumns.value - 1) / 2, row - (rowCount.value - 1) / 2);
225
+ return {
226
+ delay: reducedMotion.value ? 0 : .1 + distance * .07,
227
+ type: "spring",
228
+ stiffness: 440,
229
+ damping: 34
230
+ };
231
+ }
232
+ onMounted(captureTriggerStyle);
233
+ watch(isOpen, (openState) => {
234
+ if (!openState) {
235
+ schedulePopupHide();
236
+ return;
237
+ }
238
+ window.clearTimeout(closeTimer);
239
+ popupVisible.value = true;
240
+ captureTriggerStyle();
241
+ focusPanel();
242
+ }, { immediate: true });
243
+ onBeforeUnmount(() => window.clearTimeout(closeTimer));
244
+ return (_ctx, _cache) => {
245
+ return openBlock(), createElementBlock("div", { class: normalizeClass(rootClasses.value) }, [createVNode(unref(Trigger), {
246
+ "popup-visible": popupVisible.value,
247
+ trigger: "click",
248
+ "floating-options": floatingOptions.value,
249
+ "content-class": `${unref(prefixCls)}-popup`,
250
+ "content-style": popupContentStyle.value,
251
+ duration: 0,
252
+ "animation-name": "",
253
+ "render-to-body": "",
254
+ "esc-to-close": "",
255
+ "aria-has-popup": "dialog",
256
+ onPopupVisibleChange: handlePopupVisibleChange
257
+ }, {
258
+ content: withCtx(() => [createVNode(unref(Motion), {
259
+ "data-bloom-menu-panel": "",
260
+ initial: panelInitial.value,
261
+ animate: panelTarget.value,
262
+ transition: morphTransition.value,
263
+ style: normalizeStyle(panelStyle.value),
264
+ class: normalizeClass(`${unref(prefixCls)}-panel`),
265
+ role: "dialog",
266
+ "aria-label": __props.title
267
+ }, {
268
+ default: withCtx(() => [createElementVNode("div", _hoisted_1, [createVNode(unref(Motion), {
269
+ initial: { opacity: 0 },
270
+ animate: { opacity: isOpen.value ? 1 : 0 },
271
+ transition: contentTransition.value,
272
+ class: normalizeClass(`${unref(prefixCls)}-content`)
273
+ }, {
274
+ default: withCtx(() => [createElementVNode("div", { class: normalizeClass(`${unref(prefixCls)}-header`) }, [renderSlot(_ctx.$slots, "header", { close }, () => {
275
+ var _props$closeAriaLabel;
276
+ return [createElementVNode("span", { class: normalizeClass(`${unref(prefixCls)}-title`) }, toDisplayString(__props.title), 3), createVNode(unref(Button), {
277
+ type: "text",
278
+ shape: "circle",
279
+ size: "mini",
280
+ class: normalizeClass(`${unref(prefixCls)}-close`),
281
+ "aria-label": (_props$closeAriaLabel = __props.closeAriaLabel) !== null && _props$closeAriaLabel !== void 0 ? _props$closeAriaLabel : unref(t)("a11y.bloomMenuClose"),
282
+ onClick: _cache[0] || (_cache[0] = ($event) => close(true))
283
+ }, {
284
+ icon: withCtx(() => [createVNode(unref(IconClose))]),
285
+ _: 1
286
+ }, 8, ["class", "aria-label"])];
287
+ })], 2), __props.items.length ? (openBlock(), createBlock(unref(Motion), {
288
+ key: 0,
289
+ initial: gridInitial.value,
290
+ animate: { clipPath: "inset(0% 0% 0% 0%)" },
291
+ transition: gridTransition.value,
292
+ class: normalizeClass(`${unref(prefixCls)}-grid`)
293
+ }, {
294
+ default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item, index) => {
295
+ return openBlock(), createBlock(unref(Button), {
296
+ key: item.value,
297
+ type: "text",
298
+ long: "",
299
+ class: normalizeClass(getItemClasses(item, index)),
300
+ disabled: item.disabled,
301
+ onClick: ($event) => selectItem(item, index)
302
+ }, {
303
+ default: withCtx(() => [createVNode(unref(Motion), {
304
+ initial: getItemInitial(),
305
+ animate: {
306
+ opacity: 1,
307
+ scale: 1,
308
+ filter: "blur(0px)"
309
+ },
310
+ transition: getItemTransition(index),
311
+ class: normalizeClass(`${unref(prefixCls)}-item-content`)
312
+ }, {
313
+ default: withCtx(() => [renderSlot(_ctx.$slots, "item", {
314
+ item,
315
+ index
316
+ }, () => [item.icon || _ctx.$slots.icon ? (openBlock(), createElementBlock("span", {
317
+ key: 0,
318
+ class: normalizeClass(`${unref(prefixCls)}-item-icon`)
319
+ }, [renderSlot(_ctx.$slots, "icon", {
320
+ item,
321
+ index
322
+ }, () => [item.icon ? (openBlock(), createBlock(resolveDynamicComponent(item.icon), { key: 0 })) : createCommentVNode("", true)])], 2)) : createCommentVNode("", true), createElementVNode("span", { class: normalizeClass(`${unref(prefixCls)}-item-label`) }, toDisplayString(item.label), 3)])]),
323
+ _: 2
324
+ }, 1032, [
325
+ "initial",
326
+ "transition",
327
+ "class"
328
+ ])]),
329
+ _: 2
330
+ }, 1032, [
331
+ "class",
332
+ "disabled",
333
+ "onClick"
334
+ ]);
335
+ }), 128))]),
336
+ _: 3
337
+ }, 8, [
338
+ "initial",
339
+ "transition",
340
+ "class"
341
+ ])) : (openBlock(), createElementBlock("div", {
342
+ key: 1,
343
+ class: normalizeClass(`${unref(prefixCls)}-empty`)
344
+ }, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(unref(t)("a11y.bloomMenuEmpty")), 1)])], 2))]),
345
+ _: 3
346
+ }, 8, [
347
+ "animate",
348
+ "transition",
349
+ "class"
350
+ ])], 512)]),
351
+ _: 3
352
+ }, 8, [
353
+ "initial",
354
+ "animate",
355
+ "transition",
356
+ "style",
357
+ "class",
358
+ "aria-label"
359
+ ])]),
360
+ default: withCtx(() => [createVNode(unref(Button), mergeProps(__props.buttonProps, {
361
+ ref: "triggerButton",
362
+ "data-bloom-menu-trigger": "",
363
+ class: `${unref(prefixCls)}-trigger`,
364
+ onPointerdown: captureTriggerStyle
365
+ }), {
366
+ default: withCtx(() => [createElementVNode("span", { class: normalizeClass(`${unref(prefixCls)}-trigger-content`) }, [renderSlot(_ctx.$slots, "trigger", { open }, () => [createTextVNode(toDisplayString(__props.triggerText) + " ", 1), createVNode(unref(IconPlus))])], 2)]),
367
+ _: 3
368
+ }, 16, ["class"])]),
369
+ _: 3
370
+ }, 8, [
371
+ "popup-visible",
372
+ "floating-options",
373
+ "content-class",
374
+ "content-style"
375
+ ])], 2);
376
+ };
377
+ }
378
+ }));
379
+ //#endregion
380
+ export { bloom_menu_vue_vue_type_script_setup_true_lang_default as default };
@@ -0,0 +1,6 @@
1
+ import type { SFCWithInstall } from '../_utils/types';
2
+ import _BloomMenu from './bloom-menu.vue';
3
+ export type { BloomMenuItem, BloomMenuOffset } from './types';
4
+ declare const BloomMenu: SFCWithInstall<typeof _BloomMenu>;
5
+ export type BloomMenuInstance = InstanceType<typeof _BloomMenu>;
6
+ export default BloomMenu;
@@ -0,0 +1,10 @@
1
+ import { getComponentPrefix, setGlobalConfig } from "../_utils/global-config.js";
2
+ import bloom_menu_default from "./bloom-menu.js";
3
+ //#region components/bloom-menu/index.ts
4
+ var BloomMenu = Object.assign(bloom_menu_default, { install: (app, options) => {
5
+ setGlobalConfig(app, options);
6
+ const componentPrefix = getComponentPrefix(options);
7
+ app.component(componentPrefix + bloom_menu_default.name, bloom_menu_default);
8
+ } });
9
+ //#endregion
10
+ export { BloomMenu as default };
@@ -0,0 +1,2 @@
1
+ import "../../style/index.css";
2
+ import "./index.css";
@@ -0,0 +1,135 @@
1
+ /******** borderSize *******/
2
+ /******** borderStyle *******/
3
+ /******** radius *******/
4
+ /******** shadow distance *******/
5
+ /******** size *******/
6
+ /******** spacing *******/
7
+ /******** shadow *******/
8
+ /******** opacity *******/
9
+ /******** fontSize *******/
10
+ /******** fontWeight ********/
11
+ /******** Primary *******/
12
+ /******** success *******/
13
+ /******** warning *******/
14
+ /******** danger *******/
15
+ /******** link *******/
16
+ /******** radius *******/
17
+ /********* icon hover *********/
18
+ .sd-bloom-menu {
19
+ display: inline-flex;
20
+ font-family: inter, "-apple-system", blinkmacsystemfont, "PingFang SC", "Hiragino Sans GB", "noto sans", "Microsoft YaHei", "Helvetica Neue", helvetica, arial, sans-serif;
21
+ }
22
+ .sd-bloom-menu-trigger-content {
23
+ display: inline-flex;
24
+ gap: 8px;
25
+ align-items: center;
26
+ white-space: nowrap;
27
+ }
28
+ .sd-bloom-menu-trigger-content svg {
29
+ width: 16px;
30
+ height: 16px;
31
+ }
32
+ .sd-bloom-menu-panel {
33
+ --bloom-menu-panel-width: min(86vw, 420px);
34
+ --bloom-menu-panel-color: var(--sd-color-text-1);
35
+ --bloom-menu-panel-background: var(--sd-color-bg-2);
36
+ --bloom-menu-panel-border-color: var(--sd-color-neutral-3);
37
+ --bloom-menu-panel-border-radius: var(--sd-border-radius-medium);
38
+ --bloom-menu-panel-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
39
+ overflow: hidden;
40
+ border: 1px solid var(--sd-color-neutral-3);
41
+ }
42
+ .sd-bloom-menu-popup {
43
+ padding: 0;
44
+ }
45
+ .sd-bloom-menu-content {
46
+ width: 100%;
47
+ }
48
+ .sd-bloom-menu-header {
49
+ display: flex;
50
+ align-items: center;
51
+ justify-content: space-between;
52
+ padding: 12px 16px;
53
+ color: var(--sd-color-text-2);
54
+ border-bottom: 1px solid var(--sd-color-neutral-3);
55
+ }
56
+ .sd-bloom-menu-title {
57
+ font-weight: 500;
58
+ font-size: 14px;
59
+ }
60
+ .sd-bloom-menu-close {
61
+ color: inherit;
62
+ }
63
+ .sd-bloom-menu-close:hover {
64
+ color: var(--sd-color-text-1);
65
+ }
66
+ .sd-bloom-menu-close svg {
67
+ width: 16px;
68
+ height: 16px;
69
+ }
70
+ .sd-bloom-menu-grid {
71
+ display: grid;
72
+ grid-template-columns: repeat(var(--bloom-menu-columns), minmax(0, 1fr));
73
+ }
74
+ .sd-bloom-menu-item {
75
+ min-width: 0;
76
+ height: auto;
77
+ padding: 24px 12px;
78
+ color: var(--sd-color-text-2);
79
+ border-radius: 0;
80
+ }
81
+ .sd-bloom-menu-item:hover:not(:disabled) {
82
+ color: var(--sd-color-text-1);
83
+ background: var(--sd-color-fill-2);
84
+ }
85
+ .sd-bloom-menu-item:focus-visible {
86
+ position: relative;
87
+ z-index: 1;
88
+ outline: 2px solid rgb(var(--sd-primary-6));
89
+ outline-offset: -2px;
90
+ }
91
+ .sd-bloom-menu-item-border-right {
92
+ border-right: 1px solid var(--sd-color-neutral-3);
93
+ }
94
+ .sd-bloom-menu-item-border-bottom {
95
+ border-bottom: 1px solid var(--sd-color-neutral-3);
96
+ }
97
+ .sd-bloom-menu-item-disabled, .sd-bloom-menu-item:disabled {
98
+ color: var(--sd-color-text-4);
99
+ cursor: not-allowed;
100
+ }
101
+ .sd-bloom-menu-item-content {
102
+ display: flex;
103
+ flex-direction: column;
104
+ gap: 8px;
105
+ align-items: center;
106
+ min-width: 0;
107
+ }
108
+ .sd-bloom-menu-item-icon {
109
+ display: inline-flex;
110
+ font-size: 20px;
111
+ }
112
+ .sd-bloom-menu-item-icon svg {
113
+ width: 20px;
114
+ height: 20px;
115
+ }
116
+ .sd-bloom-menu-item-label {
117
+ max-width: 100%;
118
+ overflow: hidden;
119
+ font-weight: 500;
120
+ font-size: 14px;
121
+ white-space: nowrap;
122
+ text-overflow: ellipsis;
123
+ }
124
+ .sd-bloom-menu-empty {
125
+ padding: 24px 16px;
126
+ color: var(--sd-color-text-2);
127
+ font-size: 14px;
128
+ text-align: center;
129
+ }
130
+
131
+ @media (prefers-reduced-motion: reduce) {
132
+ .sd-bloom-menu-item, .sd-bloom-menu-close {
133
+ transition: none;
134
+ }
135
+ }
@@ -0,0 +1,2 @@
1
+ import '../../style/index.scss';
2
+ import './index.scss';
@@ -0,0 +1,2 @@
1
+ import "../../style/index.scss";
2
+ import "./index.scss";
@@ -0,0 +1,153 @@
1
+ @use '@style/theme/index.scss' as theme;
2
+ @use 'sass:string';
3
+ @use '@components/bloom-menu/style/token.scss' as *;
4
+
5
+ $bloom-menu-prefix-cls: string.unquote('#{theme.$prefix}-bloom-menu');
6
+
7
+ .#{$bloom-menu-prefix-cls} {
8
+ display: inline-flex;
9
+ font-family: theme.$font-family;
10
+
11
+ // 触发按钮的默认尺寸与字重由组件以 buttonProps 默认值(行内样式)提供,
12
+ // 避免 class 硬编码压过用户传入的 size/shape 等尺寸类
13
+ &-trigger-content {
14
+ display: inline-flex;
15
+ gap: $bloom-menu-item-gap;
16
+ align-items: center;
17
+ white-space: nowrap;
18
+
19
+ svg {
20
+ width: theme.$size-4;
21
+ height: theme.$size-4;
22
+ }
23
+ }
24
+
25
+ &-panel {
26
+ --bloom-menu-panel-width: #{$bloom-menu-panel-width};
27
+ --bloom-menu-panel-color: #{$bloom-menu-text-color};
28
+ --bloom-menu-panel-background: #{$bloom-menu-background};
29
+ --bloom-menu-panel-border-color: #{$bloom-menu-border-color};
30
+ --bloom-menu-panel-border-radius: #{theme.$radius-medium};
31
+ --bloom-menu-panel-shadow: #{$bloom-menu-shadow};
32
+
33
+ overflow: hidden;
34
+ border: $bloom-menu-border-width $bloom-menu-border-style $bloom-menu-border-color;
35
+ }
36
+
37
+ &-popup {
38
+ padding: 0;
39
+ }
40
+
41
+ &-content {
42
+ width: 100%;
43
+ }
44
+
45
+ &-header {
46
+ display: flex;
47
+ align-items: center;
48
+ justify-content: space-between;
49
+ padding: $bloom-menu-header-padding-block $bloom-menu-header-padding-inline;
50
+ color: $bloom-menu-muted-color;
51
+ border-bottom: $bloom-menu-border-width $bloom-menu-border-style $bloom-menu-border-color;
52
+ }
53
+
54
+ &-title {
55
+ font-weight: $bloom-menu-font-weight;
56
+ font-size: $bloom-menu-font-size;
57
+ }
58
+
59
+ &-close {
60
+ color: inherit;
61
+
62
+ &:hover {
63
+ color: $bloom-menu-text-color;
64
+ }
65
+
66
+ svg {
67
+ width: theme.$size-4;
68
+ height: theme.$size-4;
69
+ }
70
+ }
71
+
72
+ &-grid {
73
+ display: grid;
74
+ grid-template-columns: repeat(var(--bloom-menu-columns), minmax(0, 1fr));
75
+ }
76
+
77
+ &-item {
78
+ min-width: 0;
79
+ height: auto;
80
+ padding: $bloom-menu-item-padding-block $bloom-menu-item-padding-inline;
81
+ color: $bloom-menu-muted-color;
82
+ border-radius: 0;
83
+
84
+ &:hover:not(:disabled) {
85
+ color: $bloom-menu-text-color;
86
+ background: $bloom-menu-hover-background;
87
+ }
88
+
89
+ &:focus-visible {
90
+ position: relative;
91
+ z-index: 1;
92
+ outline: 2px solid theme.$color-primary-6;
93
+ outline-offset: -2px;
94
+ }
95
+
96
+ &-border-right {
97
+ border-right: $bloom-menu-border-width $bloom-menu-border-style $bloom-menu-border-color;
98
+ }
99
+
100
+ &-border-bottom {
101
+ border-bottom: $bloom-menu-border-width $bloom-menu-border-style $bloom-menu-border-color;
102
+ }
103
+
104
+ &-disabled,
105
+ &:disabled {
106
+ color: $bloom-menu-disabled-color;
107
+ cursor: not-allowed;
108
+ }
109
+ }
110
+
111
+ &-item-content {
112
+ display: flex;
113
+ flex-direction: column;
114
+ gap: $bloom-menu-item-gap;
115
+ align-items: center;
116
+ min-width: 0;
117
+ }
118
+
119
+ &-item-icon {
120
+ display: inline-flex;
121
+ font-size: $bloom-menu-icon-size;
122
+
123
+ svg {
124
+ width: $bloom-menu-icon-size;
125
+ height: $bloom-menu-icon-size;
126
+ }
127
+ }
128
+
129
+ &-item-label {
130
+ max-width: 100%;
131
+ overflow: hidden;
132
+ font-weight: $bloom-menu-font-weight;
133
+ font-size: $bloom-menu-font-size;
134
+ white-space: nowrap;
135
+ text-overflow: ellipsis;
136
+ }
137
+
138
+ &-empty {
139
+ padding: $bloom-menu-item-padding-block $bloom-menu-header-padding-inline;
140
+ color: $bloom-menu-muted-color;
141
+ font-size: $bloom-menu-font-size;
142
+ text-align: center;
143
+ }
144
+ }
145
+
146
+ @media (prefers-reduced-motion: reduce) {
147
+ .#{$bloom-menu-prefix-cls} {
148
+ &-item,
149
+ &-close {
150
+ transition: none;
151
+ }
152
+ }
153
+ }