@tu-design/vue 0.5.1 → 0.5.2
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.
- package/dist/index.d.mts +197 -53
- package/dist/index.mjs +174 -11
- package/dist/registry/vue/alert-dialog.json +1 -1
- package/dist/registry/vue/alert.json +1 -1
- package/dist/registry/vue/avatar-group.json +1 -1
- package/dist/registry/vue/avatar.json +1 -1
- package/dist/registry/vue/badge.json +1 -1
- package/dist/registry/vue/button.json +1 -1
- package/dist/registry/vue/calendar.json +1 -1
- package/dist/registry/vue/card.json +1 -1
- package/dist/registry/vue/cascader.json +1 -1
- package/dist/registry/vue/checkbox.json +1 -1
- package/dist/registry/vue/context-menu.json +1 -1
- package/dist/registry/vue/currency-input.json +1 -1
- package/dist/registry/vue/date-picker.json +1 -1
- package/dist/registry/vue/date-range-picker.json +1 -1
- package/dist/registry/vue/date-shared.json +1 -1
- package/dist/registry/vue/dialog.json +1 -1
- package/dist/registry/vue/drawer.json +1 -1
- package/dist/registry/vue/dropdown-menu.json +1 -1
- package/dist/registry/vue/empty.json +1 -1
- package/dist/registry/vue/form-render.json +1 -1
- package/dist/registry/vue/form.json +1 -1
- package/dist/registry/vue/icon-shared.json +1 -1
- package/dist/registry/vue/input.json +1 -1
- package/dist/registry/vue/label.json +1 -1
- package/dist/registry/vue/month-picker.json +1 -1
- package/dist/registry/vue/number-input.json +1 -1
- package/dist/registry/vue/overlay-shared.json +1 -1
- package/dist/registry/vue/password-input.json +1 -1
- package/dist/registry/vue/pin-input.json +1 -1
- package/dist/registry/vue/popconfirm.json +1 -1
- package/dist/registry/vue/popover.json +2 -2
- package/dist/registry/vue/progress.json +1 -1
- package/dist/registry/vue/radio-group.json +1 -1
- package/dist/registry/vue/registry.json +52 -52
- package/dist/registry/vue/select.json +1 -1
- package/dist/registry/vue/separator.json +1 -1
- package/dist/registry/vue/skeleton.json +1 -1
- package/dist/registry/vue/slider.json +1 -1
- package/dist/registry/vue/slot.json +1 -1
- package/dist/registry/vue/spin.json +1 -1
- package/dist/registry/vue/switch.json +1 -1
- package/dist/registry/vue/table-render.json +1 -1
- package/dist/registry/vue/tabs.json +1 -1
- package/dist/registry/vue/textarea.json +1 -1
- package/dist/registry/vue/timeline.json +1 -1
- package/dist/registry/vue/toast.json +1 -1
- package/dist/registry/vue/tokens.json +1 -1
- package/dist/registry/vue/tooltip.json +1 -1
- package/dist/registry/vue/tree-select.json +1 -1
- package/dist/registry/vue/tree-shared.json +1 -1
- package/dist/registry/vue/utils.json +1 -1
- package/dist/registry/vue/week-picker.json +1 -1
- package/dist/registry/vue/year-picker.json +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -5857,11 +5857,72 @@ const _sfc_main$34 = /*@__PURE__*/ defineComponent({
|
|
|
5857
5857
|
type: Boolean,
|
|
5858
5858
|
default: false
|
|
5859
5859
|
},
|
|
5860
|
-
/**
|
|
5860
|
+
/** 触发方式:click(默认,内建切换+完整 aria) / hover / focus(带延迟,Anchor+手动 aria) / manual(纯受控,仅定位锚点) */
|
|
5861
|
+
trigger: {
|
|
5862
|
+
type: String,
|
|
5863
|
+
default: "click"
|
|
5864
|
+
},
|
|
5865
|
+
/** hover/focus 打开延迟(毫秒) */
|
|
5866
|
+
openDelay: {
|
|
5867
|
+
type: Number,
|
|
5868
|
+
default: 100
|
|
5869
|
+
},
|
|
5870
|
+
/** hover/focus 关闭延迟(毫秒) */
|
|
5871
|
+
closeDelay: {
|
|
5872
|
+
type: Number,
|
|
5873
|
+
default: 100
|
|
5874
|
+
},
|
|
5875
|
+
/** hover/focus 时悬浮/聚焦面板保持打开 */
|
|
5876
|
+
keepAliveOnHover: {
|
|
5877
|
+
type: Boolean,
|
|
5878
|
+
default: true
|
|
5879
|
+
},
|
|
5880
|
+
/** 面板主轴方向(与 align 组合定位);attrs.positioning.placement 显式给出时以其为准 */
|
|
5881
|
+
side: {
|
|
5882
|
+
type: String,
|
|
5883
|
+
default: "bottom"
|
|
5884
|
+
},
|
|
5885
|
+
/** 面板相对触发器的对齐方向(默认居中) */
|
|
5861
5886
|
align: {
|
|
5862
5887
|
type: String,
|
|
5863
5888
|
default: "center"
|
|
5864
5889
|
},
|
|
5890
|
+
/** 显示箭头(shadcn 风格默认无箭头) */
|
|
5891
|
+
arrow: {
|
|
5892
|
+
type: Boolean,
|
|
5893
|
+
default: false
|
|
5894
|
+
},
|
|
5895
|
+
/** 追加/覆盖箭头样式类 */
|
|
5896
|
+
arrowClass: {
|
|
5897
|
+
type: String,
|
|
5898
|
+
default: void 0
|
|
5899
|
+
},
|
|
5900
|
+
/** 禁用触发(不响应任何触发事件;已打开状态不受影响) */
|
|
5901
|
+
disabled: {
|
|
5902
|
+
type: Boolean,
|
|
5903
|
+
default: false
|
|
5904
|
+
},
|
|
5905
|
+
/** 是否 Teleport(浮层定位不受嵌套裁剪影响);false 时面板留在原地 */
|
|
5906
|
+
portal: {
|
|
5907
|
+
type: Boolean,
|
|
5908
|
+
default: true
|
|
5909
|
+
},
|
|
5910
|
+
/** Teleport 目标(选择器或元素),仅 portal=true 时生效;
|
|
5911
|
+
缺省时若应用挂载容器处于 shadow DOM(微前端沙箱)自动降级为该容器,否则 body */
|
|
5912
|
+
to: {
|
|
5913
|
+
type: [String, Object],
|
|
5914
|
+
default: void 0
|
|
5915
|
+
},
|
|
5916
|
+
/** 面板宽度与触发元素一致 */
|
|
5917
|
+
matchTriggerWidth: {
|
|
5918
|
+
type: Boolean,
|
|
5919
|
+
default: false
|
|
5920
|
+
},
|
|
5921
|
+
/** 覆盖面板/定位层级(默认走 --z-overlay) */
|
|
5922
|
+
zIndex: {
|
|
5923
|
+
type: Number,
|
|
5924
|
+
default: void 0
|
|
5925
|
+
},
|
|
5865
5926
|
/** 追加/覆盖面板样式类(默认 w-72 可由此覆盖,如 "w-56 p-0") */
|
|
5866
5927
|
contentClass: {
|
|
5867
5928
|
type: String,
|
|
@@ -5877,48 +5938,150 @@ const _sfc_main$34 = /*@__PURE__*/ defineComponent({
|
|
|
5877
5938
|
setup(__props, { emit: __emit }) {
|
|
5878
5939
|
const props = __props;
|
|
5879
5940
|
const emit = __emit;
|
|
5941
|
+
const slots = useSlots();
|
|
5880
5942
|
const attrs = useAttrs();
|
|
5943
|
+
const instance = getCurrentInstance();
|
|
5944
|
+
const detectedTarget = ref("body");
|
|
5945
|
+
onMounted(() => {
|
|
5946
|
+
queueMicrotask(() => {
|
|
5947
|
+
if (props.to) return;
|
|
5948
|
+
const container = (instance?.appContext.app)?._container;
|
|
5949
|
+
if (container && container.getRootNode() instanceof ShadowRoot) detectedTarget.value = container;
|
|
5950
|
+
});
|
|
5951
|
+
});
|
|
5952
|
+
const teleportTarget = computed(() => props.to ?? detectedTarget.value);
|
|
5881
5953
|
const { isOpen, setOpen } = useControlledBoolean({
|
|
5882
5954
|
controlled: () => props.open,
|
|
5883
5955
|
defaultValue: () => props.defaultOpen,
|
|
5884
5956
|
onChange: (open) => emit("update:open", open)
|
|
5885
5957
|
});
|
|
5958
|
+
const useNativeTrigger = computed(() => props.trigger === "click" && !props.disabled);
|
|
5959
|
+
const contentId = useId();
|
|
5960
|
+
const rootIds = computed(() => {
|
|
5961
|
+
if (useNativeTrigger.value) return void 0;
|
|
5962
|
+
return {
|
|
5963
|
+
...attrs.ids ?? {},
|
|
5964
|
+
content: contentId
|
|
5965
|
+
};
|
|
5966
|
+
});
|
|
5967
|
+
const anchorAria = computed(() => useNativeTrigger.value ? {} : {
|
|
5968
|
+
"aria-haspopup": "dialog",
|
|
5969
|
+
"aria-expanded": isOpen.value,
|
|
5970
|
+
"aria-controls": contentId
|
|
5971
|
+
});
|
|
5972
|
+
let timer = null;
|
|
5973
|
+
const clearTimer = () => {
|
|
5974
|
+
if (timer !== null) {
|
|
5975
|
+
clearTimeout(timer);
|
|
5976
|
+
timer = null;
|
|
5977
|
+
}
|
|
5978
|
+
};
|
|
5979
|
+
const schedule = (next, delay) => {
|
|
5980
|
+
if (props.disabled) return;
|
|
5981
|
+
clearTimer();
|
|
5982
|
+
if (delay <= 0) {
|
|
5983
|
+
setOpen(next);
|
|
5984
|
+
return;
|
|
5985
|
+
}
|
|
5986
|
+
timer = setTimeout(() => {
|
|
5987
|
+
timer = null;
|
|
5988
|
+
if (!props.disabled) setOpen(next);
|
|
5989
|
+
}, delay);
|
|
5990
|
+
};
|
|
5991
|
+
const isHoverFocus = () => props.trigger === "hover" || props.trigger === "focus";
|
|
5992
|
+
const onTriggerEnter = () => {
|
|
5993
|
+
if (!isHoverFocus()) return;
|
|
5994
|
+
schedule(true, props.openDelay);
|
|
5995
|
+
};
|
|
5996
|
+
const onTriggerLeave = () => {
|
|
5997
|
+
if (!isHoverFocus()) return;
|
|
5998
|
+
schedule(false, props.closeDelay);
|
|
5999
|
+
};
|
|
6000
|
+
const onPanelEnter = () => {
|
|
6001
|
+
if (!isHoverFocus() || !props.keepAliveOnHover) return;
|
|
6002
|
+
clearTimer();
|
|
6003
|
+
};
|
|
6004
|
+
const onPanelLeave = () => {
|
|
6005
|
+
if (!isHoverFocus()) return;
|
|
6006
|
+
schedule(false, props.closeDelay);
|
|
6007
|
+
};
|
|
6008
|
+
onBeforeUnmount(clearTimer);
|
|
5886
6009
|
const rootPositioning = computed(() => {
|
|
5887
6010
|
const user = attrs.positioning ?? {};
|
|
5888
|
-
|
|
5889
|
-
const placement = props.align === "center" ? "bottom" : `bottom-${props.align}`;
|
|
6011
|
+
const placement = props.align === "center" ? props.side : `${props.side}-${props.align}`;
|
|
5890
6012
|
return {
|
|
5891
6013
|
...user,
|
|
5892
|
-
placement
|
|
6014
|
+
placement,
|
|
6015
|
+
sameWidth: props.matchTriggerWidth || user.sameWidth
|
|
5893
6016
|
};
|
|
5894
6017
|
});
|
|
5895
6018
|
const contentClass = computed(() => cn("bg-popover text-popover-foreground z-[var(--z-overlay)] w-72 rounded-md border p-4 shadow-md outline-none data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95", props.contentClass, props.contentProps?.["class"]));
|
|
6019
|
+
const arrowClass = computed(() => cn("[--arrow-size:10px] [--arrow-background:var(--popover)]", props.arrowClass));
|
|
6020
|
+
const positionerClass = computed(() => props.zIndex != null ? "" : "z-[var(--z-overlay)]");
|
|
6021
|
+
const positionerStyle = computed(() => props.zIndex != null ? { zIndex: props.zIndex } : void 0);
|
|
5896
6022
|
return (_ctx, _cache) => {
|
|
5897
6023
|
return openBlock(), createBlock(unref(Popover).Root, mergeProps(unref(attrs), {
|
|
5898
6024
|
open: unref(isOpen),
|
|
5899
6025
|
positioning: rootPositioning.value,
|
|
6026
|
+
ids: rootIds.value,
|
|
5900
6027
|
"lazy-mount": props.lazyMount,
|
|
5901
6028
|
"unmount-on-exit": props.unmountOnExit,
|
|
5902
6029
|
"onUpdate:open": unref(setOpen)
|
|
5903
6030
|
}), {
|
|
5904
6031
|
default: withCtx(() => [
|
|
5905
|
-
createCommentVNode("
|
|
5906
|
-
|
|
6032
|
+
createCommentVNode(" click 且未禁用:内建 Trigger,行为/aria 与旧版完全一致 "),
|
|
6033
|
+
useNativeTrigger.value ? (openBlock(), createBlock(unref(Popover).Trigger, {
|
|
6034
|
+
key: 0,
|
|
6035
|
+
"as-child": ""
|
|
6036
|
+
}, {
|
|
5907
6037
|
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
5908
6038
|
_: 3
|
|
5909
|
-
}),
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
|
|
6039
|
+
})) : unref(slots).default ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [createCommentVNode(" hover/focus/manual 或 disabled:Anchor + 自绑监听 + 手动 aria "), createVNode(unref(Popover).Anchor, mergeProps({ "as-child": "" }, anchorAria.value, {
|
|
6040
|
+
onMouseenter: onTriggerEnter,
|
|
6041
|
+
onMouseleave: onTriggerLeave,
|
|
6042
|
+
onFocusin: onTriggerEnter,
|
|
6043
|
+
onFocusout: onTriggerLeave
|
|
6044
|
+
}), {
|
|
6045
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
6046
|
+
_: 3
|
|
6047
|
+
}, 16)], 2112)) : createCommentVNode("v-if", true),
|
|
6048
|
+
createCommentVNode(" portal:Teleport(Ark Vue 原语不自带传送,浮层定位不受嵌套 overflow 裁剪影响);\n portal=false 时 disabled Teleport 面板留在原地;to 显式指定目标,\n 缺省时在 shadow DOM 沙箱(wujie 等)自动降级为应用挂载容器,避免传送出 shadow root "),
|
|
6049
|
+
(openBlock(), createBlock(Teleport, {
|
|
6050
|
+
to: teleportTarget.value,
|
|
6051
|
+
disabled: !props.portal
|
|
6052
|
+
}, [createVNode(unref(Popover).Positioner, {
|
|
6053
|
+
class: normalizeClass(positionerClass.value),
|
|
6054
|
+
style: normalizeStyle(positionerStyle.value)
|
|
6055
|
+
}, {
|
|
6056
|
+
default: withCtx(() => [createVNode(unref(Popover).Content, mergeProps(props.contentProps, {
|
|
6057
|
+
class: contentClass.value,
|
|
6058
|
+
onMouseenter: onPanelEnter,
|
|
6059
|
+
onMouseleave: onPanelLeave,
|
|
6060
|
+
onFocusin: onPanelEnter,
|
|
6061
|
+
onFocusout: onPanelLeave
|
|
6062
|
+
}), {
|
|
6063
|
+
default: withCtx(() => [
|
|
6064
|
+
props.arrow ? (openBlock(), createBlock(unref(Popover).Arrow, {
|
|
6065
|
+
key: 0,
|
|
6066
|
+
class: normalizeClass(arrowClass.value)
|
|
6067
|
+
}, {
|
|
6068
|
+
default: withCtx(() => [createVNode(unref(Popover).ArrowTip)]),
|
|
6069
|
+
_: 1
|
|
6070
|
+
}, 8, ["class"])) : createCommentVNode("v-if", true),
|
|
6071
|
+
renderSlot(_ctx.$slots, "header"),
|
|
6072
|
+
renderSlot(_ctx.$slots, "content"),
|
|
6073
|
+
renderSlot(_ctx.$slots, "footer")
|
|
6074
|
+
]),
|
|
5913
6075
|
_: 3
|
|
5914
6076
|
}, 16, ["class"])]),
|
|
5915
6077
|
_: 3
|
|
5916
|
-
})
|
|
6078
|
+
}, 8, ["class", "style"])], 8, ["to", "disabled"]))
|
|
5917
6079
|
]),
|
|
5918
6080
|
_: 3
|
|
5919
6081
|
}, 16, [
|
|
5920
6082
|
"open",
|
|
5921
6083
|
"positioning",
|
|
6084
|
+
"ids",
|
|
5922
6085
|
"lazy-mount",
|
|
5923
6086
|
"unmount-on-exit",
|
|
5924
6087
|
"onUpdate:open"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "alert-dialog",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "确认弹窗单组件:v-model:open 控制显隐,title/description 传文案,@confirm/@cancel 处理确认与取消;确认处理器返回 Promise 时按钮进入 loading 并锁定 ESC/遮罩关闭,resolve 自动关闭、reject 保持打开;内容节点为 role=alertdialog。",
|
|
7
7
|
"registryDependencies": ["button", "utils", "overlay-shared"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "calendar",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "日历(TCalendar):紧凑日历卡。Picker 弹层内为 embedded 内嵌形态(TDatePicker/TDateRangePicker 自动挂靠,纯卡片内核);独立使用即 standalone 独立形态(自带日历状态与 v-model,恒开展示)。",
|
|
7
7
|
"registryDependencies": ["icon-shared", "utils", "date-shared"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "card",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "卡片容器:单组件 API,title/description 头部 + 命名插槽(cover/action/footer/header),支持尺寸、视觉变体、分段分隔与可关闭。",
|
|
7
7
|
"registryDependencies": ["utils"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "cascader",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "级联选择:一站式 props 驱动,多列联动、勾选级联、路径回显与多标签。",
|
|
7
7
|
"registryDependencies": ["icon-shared", "tree-shared", "utils", "date-shared", "overlay-shared"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "context-menu",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "右键菜单:单组件模式,items 描述菜单项(与 dropdown-menu 同构,含分组/标题/分隔线,支持嵌套),默认插槽为触发元素(ContextTrigger as-child,右键唤出并定位到指针处),内置键盘导航与选中回调。",
|
|
7
7
|
"registryDependencies": ["utils", "dropdown-menu"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "currency-input",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "金额输入框:内置万/元/角/分单位后缀,labelUnit 输入单位与 valueUnit 存储单位自动换算(整数分最小精度),值以 number|null 受控。",
|
|
7
7
|
"registryDependencies": ["utils"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "date-picker",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "日期选择器:输入框 + 日历弹层(月/年视图切换),支持手动键入/清空/min-max 边界/不可选谓词,值以 \"yyyy-MM-dd\" 字符串受控。",
|
|
7
7
|
"registryDependencies": ["utils", "date-shared", "calendar"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "date-range-picker",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "日期范围选择器:双月日历弹层(月/年视图切换),点选起点与终点,值以 [\"yyyy-MM-dd\", \"yyyy-MM-dd\"] 有序元组受控,空值归一 null。",
|
|
7
7
|
"registryDependencies": ["icon-shared", "utils", "date-shared", "calendar", "overlay-shared"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "date-shared",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "日期家族共享模块:ISO 值域解析(日期/月/年/区间)、日历样式常量与单值选择器外壳(PickerShell/usePickerBridge)。",
|
|
7
7
|
"registryDependencies": ["icon-shared", "utils", "overlay-shared"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "dialog",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "模态对话框单组件:#trigger 放触发元素,title/description 传文案,#footer 注入 close 关闭;基于 Ark UI Dialog 原语,含焦点圈定、Escape/遮罩关闭与进出场动画,支持 v-model:open。",
|
|
7
7
|
"registryDependencies": ["icon-shared", "utils", "overlay-shared"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "drawer",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "抽屉单组件:从四方向滑出的侧边/顶底面板,#trigger 放触发元素,title/description 传文案,#footer 注入 close 关闭;基于 Ark UI Drawer 原语,进出场动画随 placement 方向自适应,含焦点圈定、Escape/遮罩关闭,支持 v-model:open。",
|
|
7
7
|
"registryDependencies": ["icon-shared", "utils", "overlay-shared"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "dropdown-menu",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "下拉菜单:单组件模式,items 描述菜单项(含分组/标题/分隔线,支持嵌套),内置键盘导航与选中回调,默认插槽为触发元素(asChild 透传)。",
|
|
7
7
|
"registryDependencies": ["utils", "overlay-shared"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "form-render",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "配置驱动表单渲染器:defineForm 聚合 TanStack Form 实例与字段配置,柯里化 widget DSL 声明控件,Tailwind 栅格自适应布局,复用 Form 家族 aria 接线。",
|
|
7
7
|
"registryDependencies": [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "form",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "表单状态与校验:基于 TanStack Form,配合 Valibot(Standard Schema)声明式校验,aria 自动接线。",
|
|
7
7
|
"registryDependencies": ["utils", "input", "button", "label"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "icon-shared",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "内置功能性图标(CloseIcon/ChevronIcon/CalendarIcon),内部共享,非公共 API。图标组件零默认类:尺寸/旋转/过渡类由使用处显式传入,避免 fallthrough 拼接时同名工具类排序冲突。",
|
|
7
7
|
"files": [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "month-picker",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "月份选择器:输入框 + 锁定月视图的日历弹层,值以 \"yyyy-MM\" 字符串受控,min/max 为月粒度闭区间(内部换算到当月末日)。",
|
|
7
7
|
"registryDependencies": ["utils", "date-shared", "calendar"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "number-input",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "数字输入框:内置加减步进按钮与数值边界,值以 number|null 受控(空值归一 null),支持 Intl 数字格式化。",
|
|
7
7
|
"registryDependencies": ["utils"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "overlay-shared",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "弹层家族共享逻辑:受控开合桥接(useControlledBoolean)与确认 pending 语义(useConfirmPending)。",
|
|
7
7
|
"files": [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "password-input",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "密码输入框:内置明文/掩码切换按钮(Eye/EyeOff,带 aria 语义),值与可见性均支持 v-model 受控。",
|
|
7
7
|
"registryDependencies": ["utils"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "pin-input",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "多格验证码输入:length 指定格数,支持 otp/mask/字符类型、焦点自动跳格与填满回调,可选分隔符插槽。",
|
|
7
7
|
"registryDependencies": ["utils"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "popconfirm",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "气泡确认:Popover 薄壳变体单组件,默认插槽为触发元素本体(asChild),title/description 传文案,@confirm/@cancel 处理确认与取消;确认处理器返回 Promise 时确认钮 loading 并锁定关闭通道,resolve 自动关闭、reject 保持打开。",
|
|
7
7
|
"registryDependencies": ["utils", "popover", "button", "overlay-shared"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
3
|
"name": "popover",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"type": "registry:ui",
|
|
6
6
|
"description": "气泡弹层:基于 Ark UI Popover 原语的单组件,默认插槽为触发元素本体(asChild 语义),面板内容放 #content 插槽,受控/非受控开关。",
|
|
7
7
|
"registryDependencies": ["utils", "overlay-shared"],
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"path": "popover/Popover.vue",
|
|
12
12
|
"type": "registry:component",
|
|
13
13
|
"target": "components/ui/popover/Popover.vue",
|
|
14
|
-
"content": "<script setup lang=\"ts\">\nimport type { ClassValue } from \"clsx\";\nimport type { PropType } from \"vue\";\nimport {
|
|
14
|
+
"content": "<script setup lang=\"ts\">\nimport type { ClassValue } from \"clsx\";\nimport type { PropType } from \"vue\";\nimport {\n computed,\n getCurrentInstance,\n onBeforeUnmount,\n onMounted,\n ref,\n useAttrs,\n useId,\n useSlots,\n} from \"vue\";\nimport type { PopoverRootProps } from \"@ark-ui/vue/popover\";\nimport { Popover as ArkPopover } from \"@ark-ui/vue/popover\";\nimport { cn } from \"@/lib/utils\";\nimport { useControlledBoolean } from \"../overlay-shared/useControlledBoolean\";\n\n/** 面板相对触发器的对齐方向 */\ntype Align = \"start\" | \"center\" | \"end\";\n/** 面板主轴方向(与 align 组合成 12 方位 placement) */\ntype Side = \"top\" | \"bottom\" | \"left\" | \"right\";\n/** 触发方式:click 内建切换;hover/focus 延迟桥接;manual 纯受控 */\ntype TriggerMode = \"click\" | \"hover\" | \"focus\" | \"manual\";\n\n/** Ark Popover Root 的 positioning 配置(placement 含四方向 × 对齐组合) */\ntype ArkPositioning = NonNullable<PopoverRootProps[\"positioning\"]>;\ntype ArkPlacement = NonNullable<ArkPositioning[\"placement\"]>;\n\ndefineOptions({ inheritAttrs: false });\n\nconst props = defineProps({\n /** 受控开关(配合 v-model:open);不传时为非受控 */\n open: { type: Boolean as PropType<boolean | undefined>, default: undefined },\n /** 非受控时的初始开关 */\n defaultOpen: { type: Boolean, default: false },\n /** 首次展开才挂载面板内容 */\n lazyMount: { type: Boolean, default: false },\n /** 收起时卸载面板内容 */\n unmountOnExit: { type: Boolean, default: false },\n /** 触发方式:click(默认,内建切换+完整 aria) / hover / focus(带延迟,Anchor+手动 aria) / manual(纯受控,仅定位锚点) */\n trigger: { type: String as PropType<TriggerMode>, default: \"click\" },\n /** hover/focus 打开延迟(毫秒) */\n openDelay: { type: Number, default: 100 },\n /** hover/focus 关闭延迟(毫秒) */\n closeDelay: { type: Number, default: 100 },\n /** hover/focus 时悬浮/聚焦面板保持打开 */\n keepAliveOnHover: { type: Boolean, default: true },\n /** 面板主轴方向(与 align 组合定位);attrs.positioning.placement 显式给出时以其为准 */\n side: { type: String as PropType<Side>, default: \"bottom\" },\n /** 面板相对触发器的对齐方向(默认居中) */\n align: { type: String as PropType<Align>, default: \"center\" },\n /** 显示箭头(shadcn 风格默认无箭头) */\n arrow: { type: Boolean, default: false },\n /** 追加/覆盖箭头样式类 */\n arrowClass: { type: String, default: undefined },\n /** 禁用触发(不响应任何触发事件;已打开状态不受影响) */\n disabled: { type: Boolean, default: false },\n /** 是否 Teleport(浮层定位不受嵌套裁剪影响);false 时面板留在原地 */\n portal: { type: Boolean, default: true },\n /** Teleport 目标(选择器或元素),仅 portal=true 时生效;\n 缺省时若应用挂载容器处于 shadow DOM(微前端沙箱)自动降级为该容器,否则 body */\n to: { type: [String, Object] as PropType<string | HTMLElement>, default: undefined },\n /** 面板宽度与触发元素一致 */\n matchTriggerWidth: { type: Boolean, default: false },\n /** 覆盖面板/定位层级(默认走 --z-overlay) */\n zIndex: { type: Number, default: undefined },\n /** 追加/覆盖面板样式类(默认 w-72 可由此覆盖,如 \"w-56 p-0\") */\n contentClass: { type: String, default: undefined },\n /** 透传到面板根元素上的属性(id/style/data-* 等,class 请用 contentClass) */\n contentProps: { type: Object as PropType<Record<string, unknown>>, default: undefined },\n});\n\nconst emit = defineEmits<{ \"update:open\": [open: boolean] }>();\n\nconst slots = useSlots();\nconst attrs = useAttrs();\n\n// —— Teleport 目标解析:显式 to > shadow DOM 自动降级 > body ——\n// app._container 在 mount 的 render 完成后才赋值(runtime-core 3.5.43:render L4337\n// → 赋值 L4340),而子组件 onMounted 在 render 内同步执行、届时仍为 undefined,\n// 故检测再延后一个微任务(mount 调用栈结束后 _container 必已赋值),结果存 ref\n// 驱动 computed 重算;getCurrentInstance 仅 setup 同步上下文可用,须顶层捕获。\n// 共享 Vue(__MICRO_SHARED__)下各子应用 app._container 相互独立,检测按实例隔离;\n// 非 shadow 环境 getRootNode() 返回 Document → 兜底 body,零破坏\nconst instance = getCurrentInstance();\nconst detectedTarget = ref<string | HTMLElement>(\"body\");\nonMounted(() => {\n queueMicrotask(() => {\n if (props.to) return;\n const container = (instance?.appContext.app as { _container?: HTMLElement } | undefined)\n ?._container;\n if (container && container.getRootNode() instanceof ShadowRoot) {\n detectedTarget.value = container;\n }\n });\n});\nconst teleportTarget = computed<string | HTMLElement>(() => props.to ?? detectedTarget.value);\n\n// —— 受控桥接(Dialog 同款):Root 恒走受控,非受控语义由内部 ref 实现 ——\nconst { isOpen, setOpen } = useControlledBoolean({\n controlled: () => props.open,\n defaultValue: () => props.defaultOpen,\n onChange: (open) => emit(\"update:open\", open),\n});\n\n// —— 触发路径分派:click 用内建 Trigger(完整 aria 自动接线);\n// hover/focus/manual 用 Anchor 作定位锚点(无内建 click,语义不冲突)。\n// disabled 时也切 Anchor:内建 TOGGLE 无法从外部短路(AT_TARGET 阶段监听器按注册顺序\n// 执行、capture 无优先级),不渲染 Trigger 是唯一可靠方式 ——\nconst useNativeTrigger = computed(() => props.trigger === \"click\" && !props.disabled);\n\n// Anchor 模式的手动 aria 接线(补偿放弃 Trigger 的自动接线):\n// 经 ids.content 定死面板 id,保证 aria-controls 可靠指向\nconst contentId = useId();\nconst rootIds = computed<Record<string, string> | undefined>(() => {\n if (useNativeTrigger.value) return undefined;\n const user = (attrs.ids ?? {}) as Record<string, string>;\n return { ...user, content: contentId };\n});\nconst anchorAria = computed(() =>\n useNativeTrigger.value\n ? {}\n : {\n \"aria-haspopup\": \"dialog\" as const,\n \"aria-expanded\": isOpen.value,\n \"aria-controls\": contentId,\n },\n);\n\n// —— 延迟桥接(hover/focus):单一定时器,进入取消关闭、离开取消打开 ——\nlet timer: ReturnType<typeof setTimeout> | null = null;\nconst clearTimer = () => {\n if (timer !== null) {\n clearTimeout(timer);\n timer = null;\n }\n};\nconst schedule = (next: boolean, delay: number) => {\n if (props.disabled) return;\n clearTimer();\n if (delay <= 0) {\n setOpen(next);\n return;\n }\n timer = setTimeout(() => {\n timer = null;\n if (!props.disabled) setOpen(next);\n }, delay);\n};\n\nconst isHoverFocus = () => props.trigger === \"hover\" || props.trigger === \"focus\";\n\nconst onTriggerEnter = () => {\n if (!isHoverFocus()) return;\n schedule(true, props.openDelay);\n};\nconst onTriggerLeave = () => {\n if (!isHoverFocus()) return;\n schedule(false, props.closeDelay);\n};\n// 面板悬浮/聚焦保活(keep-alive 语义):仅取消挂起的关闭计时\nconst onPanelEnter = () => {\n if (!isHoverFocus() || !props.keepAliveOnHover) return;\n clearTimer();\n};\n// 离开面板(去往触发器以外的地方)也应关闭:覆盖 trigger→panel→outside 链路\nconst onPanelLeave = () => {\n if (!isHoverFocus()) return;\n schedule(false, props.closeDelay);\n};\n\nonBeforeUnmount(clearTimer);\n\n// side/align → Ark positioning.placement(12 方位,居中不带对齐后缀);\n// 外部经 attrs 传入的 positioning 已显式指定 placement 时以其为准,其余字段原样合并\nconst rootPositioning = computed<ArkPositioning>(() => {\n const user = (attrs.positioning ?? {}) as ArkPositioning;\n const placement = (\n props.align === \"center\" ? props.side : `${props.side}-${props.align}`\n ) as ArkPlacement;\n return { ...user, placement, sameWidth: props.matchTriggerWidth || user.sameWidth };\n});\n\n// 面板样式:内置类 + contentClass + contentProps.class 三方合并(twMerge 自动去冲突,后者优先)\nconst contentClass = computed(() =>\n cn(\n \"bg-popover text-popover-foreground z-[var(--z-overlay)] w-72 rounded-md border p-4 shadow-md outline-none data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95\",\n props.contentClass,\n props.contentProps?.[\"class\"] as ClassValue,\n ),\n);\n\n// 箭头:尺寸/底色经 CSS 变量交给 zag 内联样式(arrowTip 自动取 --arrow-background 上色)\nconst arrowClass = computed(() =>\n cn(\"[--arrow-size:10px] [--arrow-background:var(--popover)]\", props.arrowClass),\n);\n\n// zIndex prop 走内联 style(Tailwind 任意值类不适合动态拼接);未传保持默认层级类\nconst positionerClass = computed(() => (props.zIndex != null ? \"\" : \"z-[var(--z-overlay)]\"));\nconst positionerStyle = computed(() =>\n props.zIndex != null ? { zIndex: props.zIndex } : undefined,\n);\n</script>\n\n<template>\n <ArkPopover.Root\n v-bind=\"attrs\"\n :open=\"isOpen\"\n :positioning=\"rootPositioning\"\n :ids=\"rootIds\"\n :lazy-mount=\"props.lazyMount\"\n :unmount-on-exit=\"props.unmountOnExit\"\n @update:open=\"setOpen\"\n >\n <!-- click 且未禁用:内建 Trigger,行为/aria 与旧版完全一致 -->\n <ArkPopover.Trigger v-if=\"useNativeTrigger\" as-child>\n <slot />\n </ArkPopover.Trigger>\n\n <!-- hover/focus/manual 或 disabled:Anchor + 自绑监听 + 手动 aria -->\n <ArkPopover.Anchor\n v-else-if=\"slots.default\"\n as-child\n v-bind=\"anchorAria\"\n @mouseenter=\"onTriggerEnter\"\n @mouseleave=\"onTriggerLeave\"\n @focusin=\"onTriggerEnter\"\n @focusout=\"onTriggerLeave\"\n >\n <slot />\n </ArkPopover.Anchor>\n\n <!-- portal:Teleport(Ark Vue 原语不自带传送,浮层定位不受嵌套 overflow 裁剪影响);\n portal=false 时 disabled Teleport 面板留在原地;to 显式指定目标,\n 缺省时在 shadow DOM 沙箱(wujie 等)自动降级为应用挂载容器,避免传送出 shadow root -->\n <Teleport :to=\"teleportTarget\" :disabled=\"!props.portal\">\n <ArkPopover.Positioner :class=\"positionerClass\" :style=\"positionerStyle\">\n <ArkPopover.Content\n v-bind=\"props.contentProps\"\n :class=\"contentClass\"\n @mouseenter=\"onPanelEnter\"\n @mouseleave=\"onPanelLeave\"\n @focusin=\"onPanelEnter\"\n @focusout=\"onPanelLeave\"\n >\n <ArkPopover.Arrow v-if=\"props.arrow\" :class=\"arrowClass\">\n <ArkPopover.ArrowTip />\n </ArkPopover.Arrow>\n <slot name=\"header\" />\n <slot name=\"content\" />\n <slot name=\"footer\" />\n </ArkPopover.Content>\n </ArkPopover.Positioner>\n </Teleport>\n </ArkPopover.Root>\n</template>\n"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
"path": "popover/index.ts",
|