@sdata/web-vue 4.0.0 → 4.2.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 (62) hide show
  1. package/dist/sd.css +189 -0
  2. package/dist/sd.min.css +2 -2
  3. package/es/badge/badge.vue.d.ts +2 -0
  4. package/es/badge/badge.vue_vue_type_script_setup_true_lang.js +19 -4
  5. package/es/badge/index.d.ts +3 -0
  6. package/es/bloom-menu/bloom-menu.js +5 -0
  7. package/es/bloom-menu/bloom-menu.vue.d.ts +52 -0
  8. package/es/bloom-menu/bloom-menu.vue_vue_type_script_setup_true_lang.js +380 -0
  9. package/es/bloom-menu/index.d.ts +6 -0
  10. package/es/bloom-menu/index.js +10 -0
  11. package/es/bloom-menu/style/css.js +2 -0
  12. package/es/bloom-menu/style/index.css +135 -0
  13. package/es/bloom-menu/style/index.d.ts +2 -0
  14. package/es/bloom-menu/style/index.js +2 -0
  15. package/es/bloom-menu/style/index.scss +153 -0
  16. package/es/bloom-menu/style/token.scss +24 -0
  17. package/es/bloom-menu/types.d.ts +11 -0
  18. package/es/components.d.ts +3 -0
  19. package/es/index.css +189 -0
  20. package/es/index.d.ts +4 -0
  21. package/es/index.js +5 -1
  22. package/es/index.scss +2 -0
  23. package/es/locale/interface.d.ts +2 -0
  24. package/es/locale/lang/en-us.js +2 -0
  25. package/es/locale/lang/zh-cn.js +2 -0
  26. package/es/number-flow/continuous.d.ts +2 -0
  27. package/es/number-flow/continuous.js +7 -0
  28. package/es/number-flow/formatter.d.ts +15 -0
  29. package/es/number-flow/formatter.js +54 -0
  30. package/es/number-flow/group-key.d.ts +11 -0
  31. package/es/number-flow/group-key.js +4 -0
  32. package/es/number-flow/index.d.ts +63 -0
  33. package/es/number-flow/index.js +15 -0
  34. package/es/number-flow/number-flow-group.js +5 -0
  35. package/es/number-flow/number-flow-group.vue.d.ts +12 -0
  36. package/es/number-flow/number-flow-group.vue_vue_type_script_setup_true_lang.js +58 -0
  37. package/es/number-flow/number-flow.js +5 -0
  38. package/es/number-flow/number-flow.vue.d.ts +20 -0
  39. package/es/number-flow/number-flow.vue_vue_type_script_setup_true_lang.js +284 -0
  40. package/es/number-flow/style/css.js +2 -0
  41. package/es/number-flow/style/index.css +85 -0
  42. package/es/number-flow/style/index.d.ts +2 -0
  43. package/es/number-flow/style/index.js +2 -0
  44. package/es/number-flow/style/index.scss +93 -0
  45. package/es/number-flow/style/token.scss +5 -0
  46. package/es/number-flow/types.d.ts +46 -0
  47. package/es/number-flow/use-can-animate.d.ts +4 -0
  48. package/es/number-flow/use-can-animate.js +30 -0
  49. package/es/rich-text-editor/index.d.ts +3 -3
  50. package/es/rich-text-editor/rich-text-editor.vue.d.ts +1 -1
  51. package/es/sd-vue.js +5 -0
  52. package/es/statistic/countdown.vue.d.ts +9 -0
  53. package/es/statistic/countdown.vue_vue_type_script_setup_true_lang.js +29 -2
  54. package/es/statistic/index.d.ts +15 -0
  55. package/es/statistic/statistic.vue.d.ts +3 -3
  56. package/es/statistic/statistic.vue_vue_type_script_setup_true_lang.js +31 -62
  57. package/es/statistic/style/index.css +3 -0
  58. package/es/statistic/style/index.scss +5 -0
  59. package/json/vetur-attributes.json +8 -0
  60. package/json/vetur-tags.json +12 -1
  61. package/json/web-types.json +35 -1
  62. package/package.json +1 -1
@@ -14,6 +14,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
14
14
  color?: ColorType | string;
15
15
  status?: BadgeStatus;
16
16
  count?: number;
17
+ animation?: boolean;
17
18
  }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
18
19
  text?: string;
19
20
  dot?: boolean;
@@ -23,6 +24,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
23
24
  color?: ColorType | string;
24
25
  status?: BadgeStatus;
25
26
  count?: number;
27
+ animation?: boolean;
26
28
  }> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
27
29
  default?: () => unknown;
28
30
  content?: () => unknown;
@@ -1,7 +1,8 @@
1
1
  import { configProviderInjectionKey } from "../config-provider/context.js";
2
2
  import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.142.0/helpers/esm/objectSpread2.js";
3
3
  import { getPrefixCls } from "../_utils/global-config.js";
4
- import { computed, createCommentVNode, createElementBlock, createElementVNode, defineComponent, inject, normalizeClass, normalizeStyle, openBlock, renderSlot, toDisplayString, unref, useSlots } from "vue";
4
+ import NumberFlow from "../number-flow/index.js";
5
+ import { computed, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, inject, normalizeClass, normalizeStyle, openBlock, renderSlot, toDisplayString, unref, useSlots } from "vue";
5
6
  //#region components/badge/badge.vue?vue&type=script&setup=true&lang.ts
6
7
  var _hoisted_1 = ["aria-label"];
7
8
  var COLORS = [
@@ -31,7 +32,11 @@ var badge_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComp
31
32
  offset: { default: () => [] },
32
33
  color: {},
33
34
  status: {},
34
- count: {}
35
+ count: {},
36
+ animation: {
37
+ type: Boolean,
38
+ default: true
39
+ }
35
40
  },
36
41
  setup(__props) {
37
42
  const slots = useSlots();
@@ -56,7 +61,9 @@ var badge_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComp
56
61
  return style;
57
62
  });
58
63
  const mergedStyle = computed(() => _objectSpread2(_objectSpread2({}, !__props.color || COLORS.includes(__props.color) ? {} : { backgroundColor: __props.color }), computedDotStyle.value));
59
- const displayCount = computed(() => __props.maxCount && countValue.value > __props.maxCount ? `${__props.maxCount}+` : countValue.value);
64
+ const isCountOverflow = computed(() => Boolean(__props.maxCount && countValue.value > __props.maxCount));
65
+ const displayCount = computed(() => isCountOverflow.value ? __props.maxCount : countValue.value);
66
+ const displaySuffix = computed(() => isCountOverflow.value ? "+" : void 0);
60
67
  return (_ctx, _cache) => {
61
68
  return openBlock(), createElementBlock("span", { class: normalizeClass(wrapperClassName.value) }, [renderSlot(_ctx.$slots, "default"), _ctx.$slots.content ? (openBlock(), createElementBlock("span", {
62
69
  key: 0,
@@ -89,7 +96,15 @@ var badge_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComp
89
96
  key: 4,
90
97
  class: normalizeClass(`${unref(prefixCls)}-number`),
91
98
  style: normalizeStyle(mergedStyle.value)
92
- }, [createElementVNode("span", null, toDisplayString(displayCount.value), 1)], 6)) : createCommentVNode("", true)], 2);
99
+ }, [createVNode(unref(NumberFlow), {
100
+ value: displayCount.value,
101
+ suffix: displaySuffix.value,
102
+ animated: __props.animation
103
+ }, null, 8, [
104
+ "value",
105
+ "suffix",
106
+ "animated"
107
+ ])], 6)) : createCommentVNode("", true)], 2);
93
108
  };
94
109
  }
95
110
  }));
@@ -11,6 +11,7 @@ declare const Badge: {
11
11
  color?: import("./badge.vue").ColorType | string;
12
12
  status?: import("./badge.vue").BadgeStatus;
13
13
  count?: number;
14
+ animation?: boolean;
14
15
  }> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {}, false, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
15
16
  P: {};
16
17
  B: {};
@@ -27,6 +28,7 @@ declare const Badge: {
27
28
  color?: import("./badge.vue").ColorType | string;
28
29
  status?: import("./badge.vue").BadgeStatus;
29
30
  count?: number;
31
+ animation?: boolean;
30
32
  }> & Readonly<{}>, {}, {}, {}, {}, {}>;
31
33
  __isFragment?: never;
32
34
  __isTeleport?: never;
@@ -40,6 +42,7 @@ declare const Badge: {
40
42
  color?: import("./badge.vue").ColorType | string;
41
43
  status?: import("./badge.vue").BadgeStatus;
42
44
  count?: number;
45
+ animation?: boolean;
43
46
  }> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {}, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
44
47
  $slots: {
45
48
  default?: () => unknown;
@@ -0,0 +1,5 @@
1
+ import bloom_menu_vue_vue_type_script_setup_true_lang_default from "./bloom-menu.vue_vue_type_script_setup_true_lang.js";
2
+ //#region components/bloom-menu/bloom-menu.vue
3
+ var bloom_menu_default = bloom_menu_vue_vue_type_script_setup_true_lang_default;
4
+ //#endregion
5
+ export { bloom_menu_default as default };
@@ -0,0 +1,52 @@
1
+ import type { Merge, UnknownRecord } from 'type-fest';
2
+ import type { HTMLAttributes, VNode } from 'vue';
3
+ import type { ButtonInstance } from '../button';
4
+ import type { BloomMenuItem, BloomMenuOffset } from './types';
5
+ type BloomMenuButtonProps = Merge<HTMLAttributes, ButtonInstance['$props']> & UnknownRecord;
6
+ type __VLS_Props = {
7
+ items: readonly BloomMenuItem[];
8
+ modelValue?: boolean;
9
+ defaultOpen?: boolean;
10
+ columns?: number;
11
+ title?: string;
12
+ triggerText?: string;
13
+ buttonProps?: BloomMenuButtonProps;
14
+ offset?: BloomMenuOffset;
15
+ closeAriaLabel?: string;
16
+ };
17
+ type __VLS_Slots = {
18
+ trigger(props: {
19
+ open: () => void;
20
+ }): VNode[];
21
+ header(props: {
22
+ close: (restoreFocus?: boolean) => void;
23
+ }): VNode[];
24
+ icon(props: {
25
+ item: BloomMenuItem;
26
+ index: number;
27
+ }): VNode[];
28
+ item(props: {
29
+ item: BloomMenuItem;
30
+ index: number;
31
+ }): VNode[];
32
+ empty(): VNode[];
33
+ };
34
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
35
+ open: () => any;
36
+ close: () => any;
37
+ select: (item: BloomMenuItem, index: number) => any;
38
+ "update:modelValue": (value: boolean) => any;
39
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
40
+ onOpen?: (() => any) | undefined;
41
+ onClose?: (() => any) | undefined;
42
+ onSelect?: ((item: BloomMenuItem, index: number) => any) | undefined;
43
+ "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
44
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
45
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
46
+ declare const _default: typeof __VLS_export;
47
+ export default _default;
48
+ type __VLS_WithSlots<T, S> = T & {
49
+ new (): {
50
+ $slots: S;
51
+ };
52
+ };
@@ -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";