@tu-design/vue 0.2.1 → 0.2.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.mjs CHANGED
@@ -1,11 +1,14 @@
1
1
  import { clsx } from "clsx";
2
2
  import { twMerge } from "tailwind-merge";
3
- import { Comment, Fragment, Text, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, h, mergeModels, normalizeClass, openBlock, ref, renderList, renderSlot, resolveDynamicComponent, toDisplayString, unref, useId, useModel, vModelText, withCtx, withDirectives } from "vue";
3
+ import { Comment, Fragment, Text, cloneVNode, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, h, inject, mergeModels, mergeProps, normalizeClass, onMounted, onUnmounted, openBlock, provide, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, unref, useId, useModel, vModelText, watch, withCtx, withDirectives, withModifiers } from "vue";
4
4
  import { Avatar } from "@ark-ui/vue/avatar";
5
5
  import { cva } from "class-variance-authority";
6
6
  import { Checkbox } from "@ark-ui/vue/checkbox";
7
7
  import { Dialog } from "@ark-ui/vue/dialog";
8
8
  import { Menu } from "@ark-ui/vue/menu";
9
+ import { NumberInput } from "@ark-ui/vue/number-input";
10
+ import { PinInput } from "@ark-ui/vue/pin-input";
11
+ import { Popover } from "@ark-ui/vue/popover";
9
12
  import { RadioGroup } from "@ark-ui/vue/radio-group";
10
13
  import { createListCollection } from "@ark-ui/vue/collection";
11
14
  import { Select } from "@ark-ui/vue/select";
@@ -38,6 +41,7 @@ const COMPONENT_NAMES = [
38
41
  "CardHeader",
39
42
  "CardTitle",
40
43
  "Checkbox",
44
+ "CurrencyInput",
41
45
  "Dialog",
42
46
  "DialogClose",
43
47
  "DialogContent",
@@ -53,8 +57,22 @@ const COMPONENT_NAMES = [
53
57
  "DropdownMenuLabel",
54
58
  "DropdownMenuSeparator",
55
59
  "DropdownMenuTrigger",
60
+ "Form",
61
+ "FormControl",
62
+ "FormDescription",
63
+ "FormField",
64
+ "FormItem",
65
+ "FormLabel",
66
+ "FormMessage",
67
+ "FormSubscribe",
56
68
  "Input",
57
69
  "Label",
70
+ "NumberInput",
71
+ "PasswordInput",
72
+ "PinInput",
73
+ "Popover",
74
+ "PopoverContent",
75
+ "PopoverTrigger",
58
76
  "RadioGroup",
59
77
  "RadioGroupItem",
60
78
  "Select",
@@ -71,6 +89,7 @@ const COMPONENT_NAMES = [
71
89
  "TabsContent",
72
90
  "TabsList",
73
91
  "TabsTrigger",
92
+ "Textarea",
74
93
  "Tooltip",
75
94
  "TooltipContent",
76
95
  "TooltipTrigger"
@@ -396,8 +415,139 @@ const _sfc_main$9 = /*@__PURE__*/ defineComponent({
396
415
  }
397
416
  });
398
417
  //#endregion
399
- //#region src/components/dialog/Dialog.vue
418
+ //#region src/components/currency-input/utils.ts
419
+ /** 各单位折合整数分:分=1、角=10、元=100、万=1000000 */
420
+ const UNIT_FEN_EXP = {
421
+ 万: 6,
422
+ 元: 2,
423
+ 角: 1,
424
+ 分: 0
425
+ };
426
+ /**
427
+ * 解析输入文本为 valueUnit 单位的数值(number|null)。
428
+ * 全程十进制字符串移位(BigInt),仅在超出整数分精度时一次四舍五入;
429
+ * 白名单 ^\d*(\.\d*)?$,负号/非法字符/无数字一律 null。
430
+ */
431
+ function parseCurrency(raw, labelUnit, valueUnit) {
432
+ if (!/^\d*(\.\d*)?$/.test(raw) || !/\d/.test(raw)) return null;
433
+ const [intPart, fracPart = ""] = raw.split(".");
434
+ const digits = BigInt((intPart || "0") + fracPart);
435
+ const shift = UNIT_FEN_EXP[labelUnit] - fracPart.length;
436
+ let fen;
437
+ if (shift >= 0) fen = digits * 10n ** BigInt(shift);
438
+ else {
439
+ const divisor = 10n ** BigInt(-shift);
440
+ const q = digits / divisor;
441
+ fen = digits % divisor * 2n >= divisor ? q + 1n : q;
442
+ }
443
+ return Number(fen) / 10 ** UNIT_FEN_EXP[valueUnit];
444
+ }
445
+ /**
446
+ * 受控值(valueUnit 单位)反算为 labelUnit 单位的回显文本。
447
+ * 值先取整到整数分(吸收浮点噪声),再做十进制移位并去尾零。
448
+ */
449
+ function formatCurrency(value, valueUnit, labelUnit) {
450
+ if (!Number.isFinite(value)) return "";
451
+ const negative = value < 0;
452
+ const fen = BigInt(Math.abs(Math.round(value * 10 ** UNIT_FEN_EXP[valueUnit])));
453
+ const exp = UNIT_FEN_EXP[labelUnit];
454
+ let text;
455
+ if (exp === 0) text = fen.toString();
456
+ else {
457
+ const s = fen.toString().padStart(exp + 1, "0");
458
+ const frac = s.slice(-exp).replace(/0+$/, "");
459
+ text = frac ? `${s.slice(0, -exp)}.${frac}` : s.slice(0, -exp);
460
+ }
461
+ return negative ? `-${text}` : text;
462
+ }
463
+ //#endregion
464
+ //#region src/components/currency-input/CurrencyInput.vue
465
+ const _hoisted_1$9 = ["data-invalid"];
466
+ const _hoisted_2$1 = [
467
+ "value",
468
+ "placeholder",
469
+ "disabled",
470
+ "aria-invalid"
471
+ ];
400
472
  const _sfc_main$10 = /*@__PURE__*/ defineComponent({
473
+ inheritAttrs: false,
474
+ __name: "CurrencyInput",
475
+ props: {
476
+ /** 受控值(valueUnit 单位);undefined 走内部非受控,null 表示空 */
477
+ modelValue: {
478
+ type: Number,
479
+ default: void 0
480
+ },
481
+ /** 界面输入单位 */
482
+ labelUnit: {
483
+ type: String,
484
+ default: "元"
485
+ },
486
+ /** 存储单位(v-model 值的单位) */
487
+ valueUnit: {
488
+ type: String,
489
+ default: "元"
490
+ },
491
+ placeholder: {
492
+ type: String,
493
+ default: void 0
494
+ },
495
+ disabled: {
496
+ type: Boolean,
497
+ default: void 0
498
+ },
499
+ invalid: {
500
+ type: Boolean,
501
+ default: void 0
502
+ },
503
+ class: {
504
+ type: String,
505
+ default: void 0
506
+ }
507
+ },
508
+ emits: ["update:modelValue"],
509
+ setup(__props, { emit: __emit }) {
510
+ const props = __props;
511
+ const emit = __emit;
512
+ const internalValue = ref(null);
513
+ const isControlled = computed(() => props.modelValue !== void 0);
514
+ const display = ref(props.modelValue !== void 0 && props.modelValue !== null ? formatCurrency(props.modelValue, props.valueUnit, props.labelUnit) : "");
515
+ let lastEmitted;
516
+ function onInput(event) {
517
+ const raw = event.target.value;
518
+ display.value = raw;
519
+ const next = parseCurrency(raw, props.labelUnit, props.valueUnit);
520
+ lastEmitted = next;
521
+ if (!isControlled.value) internalValue.value = next;
522
+ emit("update:modelValue", next);
523
+ }
524
+ watch(() => props.modelValue, (value) => {
525
+ if (!isControlled.value || value === lastEmitted) return;
526
+ display.value = value === null ? "" : formatCurrency(value, props.valueUnit, props.labelUnit);
527
+ });
528
+ return (_ctx, _cache) => {
529
+ return openBlock(), createElementBlock("div", {
530
+ class: normalizeClass(unref(cn)("border-input flex h-9 w-full items-center overflow-hidden rounded-md border shadow-sm transition-[color,box-shadow] outline-none focus-within:border-ring focus-within:ring-ring/20 focus-within:ring-[3px] data-invalid:border-destructive data-invalid:ring-destructive/20 data-invalid:ring-[3px]", props.class)),
531
+ "data-invalid": props.invalid ? "" : void 0
532
+ }, [createElementVNode("input", mergeProps(_ctx.$attrs, {
533
+ type: "text",
534
+ inputmode: "decimal",
535
+ value: display.value,
536
+ placeholder: props.placeholder,
537
+ disabled: props.disabled,
538
+ "aria-invalid": props.invalid || void 0,
539
+ class: "bg-transparent h-full w-full min-w-0 flex-1 px-3 text-sm outline-none disabled:cursor-not-allowed disabled:opacity-50",
540
+ onInput
541
+ }), null, 16, _hoisted_2$1), createElementVNode("div", {
542
+ "aria-hidden": "true",
543
+ class: normalizeClass(unref(cn)("border-input text-muted-foreground flex h-full shrink-0 items-center border-l bg-muted/40 px-3 text-sm", props.disabled && "opacity-50"))
544
+ }, toDisplayString(props.labelUnit), 3)], 10, _hoisted_1$9);
545
+ };
546
+ }
547
+ });
548
+ //#endregion
549
+ //#region src/components/dialog/Dialog.vue
550
+ const _sfc_main$11 = /*@__PURE__*/ defineComponent({
401
551
  __name: "Dialog",
402
552
  props: {
403
553
  open: {
@@ -446,7 +596,7 @@ const _sfc_main$10 = /*@__PURE__*/ defineComponent({
446
596
  });
447
597
  //#endregion
448
598
  //#region src/components/dialog/DialogClose.vue
449
- const _sfc_main$11 = /*@__PURE__*/ defineComponent({
599
+ const _sfc_main$12 = /*@__PURE__*/ defineComponent({
450
600
  __name: "DialogClose",
451
601
  props: { asChild: { type: Boolean } },
452
602
  setup(__props) {
@@ -461,7 +611,7 @@ const _sfc_main$11 = /*@__PURE__*/ defineComponent({
461
611
  });
462
612
  //#endregion
463
613
  //#region src/components/dialog/DialogContent.vue
464
- const _sfc_main$12 = /*@__PURE__*/ defineComponent({
614
+ const _sfc_main$13 = /*@__PURE__*/ defineComponent({
465
615
  __name: "DialogContent",
466
616
  props: {
467
617
  showCloseButton: {
@@ -499,7 +649,7 @@ const _sfc_main$12 = /*@__PURE__*/ defineComponent({
499
649
  });
500
650
  //#endregion
501
651
  //#region src/components/dialog/DialogDescription.vue
502
- const _sfc_main$13 = /*@__PURE__*/ defineComponent({
652
+ const _sfc_main$14 = /*@__PURE__*/ defineComponent({
503
653
  __name: "DialogDescription",
504
654
  props: { class: {} },
505
655
  setup(__props) {
@@ -514,7 +664,7 @@ const _sfc_main$13 = /*@__PURE__*/ defineComponent({
514
664
  });
515
665
  //#endregion
516
666
  //#region src/components/dialog/DialogFooter.vue
517
- const _sfc_main$14 = /*@__PURE__*/ defineComponent({
667
+ const _sfc_main$15 = /*@__PURE__*/ defineComponent({
518
668
  __name: "DialogFooter",
519
669
  props: { class: {} },
520
670
  setup(__props) {
@@ -526,7 +676,7 @@ const _sfc_main$14 = /*@__PURE__*/ defineComponent({
526
676
  });
527
677
  //#endregion
528
678
  //#region src/components/dialog/DialogHeader.vue
529
- const _sfc_main$15 = /*@__PURE__*/ defineComponent({
679
+ const _sfc_main$16 = /*@__PURE__*/ defineComponent({
530
680
  __name: "DialogHeader",
531
681
  props: { class: {} },
532
682
  setup(__props) {
@@ -538,7 +688,7 @@ const _sfc_main$15 = /*@__PURE__*/ defineComponent({
538
688
  });
539
689
  //#endregion
540
690
  //#region src/components/dialog/DialogTitle.vue
541
- const _sfc_main$16 = /*@__PURE__*/ defineComponent({
691
+ const _sfc_main$17 = /*@__PURE__*/ defineComponent({
542
692
  __name: "DialogTitle",
543
693
  props: { class: {} },
544
694
  setup(__props) {
@@ -553,7 +703,7 @@ const _sfc_main$16 = /*@__PURE__*/ defineComponent({
553
703
  });
554
704
  //#endregion
555
705
  //#region src/components/dialog/DialogTrigger.vue
556
- const _sfc_main$17 = /*@__PURE__*/ defineComponent({
706
+ const _sfc_main$18 = /*@__PURE__*/ defineComponent({
557
707
  __name: "DialogTrigger",
558
708
  props: { asChild: { type: Boolean } },
559
709
  setup(__props) {
@@ -568,7 +718,7 @@ const _sfc_main$17 = /*@__PURE__*/ defineComponent({
568
718
  });
569
719
  //#endregion
570
720
  //#region src/components/dropdown-menu/DropdownMenu.vue
571
- const _sfc_main$18 = /*@__PURE__*/ defineComponent({
721
+ const _sfc_main$19 = /*@__PURE__*/ defineComponent({
572
722
  __name: "DropdownMenu",
573
723
  props: {
574
724
  open: {
@@ -621,7 +771,7 @@ const _sfc_main$18 = /*@__PURE__*/ defineComponent({
621
771
  });
622
772
  //#endregion
623
773
  //#region src/components/dropdown-menu/DropdownMenuContent.vue
624
- const _sfc_main$19 = /*@__PURE__*/ defineComponent({
774
+ const _sfc_main$20 = /*@__PURE__*/ defineComponent({
625
775
  __name: "DropdownMenuContent",
626
776
  props: { class: {} },
627
777
  setup(__props) {
@@ -639,7 +789,7 @@ const _sfc_main$19 = /*@__PURE__*/ defineComponent({
639
789
  });
640
790
  //#endregion
641
791
  //#region src/components/dropdown-menu/DropdownMenuGroup.vue
642
- const _sfc_main$20 = /*@__PURE__*/ defineComponent({
792
+ const _sfc_main$21 = /*@__PURE__*/ defineComponent({
643
793
  __name: "DropdownMenuGroup",
644
794
  props: { label: {} },
645
795
  setup(__props) {
@@ -654,7 +804,7 @@ const _sfc_main$20 = /*@__PURE__*/ defineComponent({
654
804
  });
655
805
  //#endregion
656
806
  //#region src/components/dropdown-menu/DropdownMenuItem.vue
657
- const _sfc_main$21 = /*@__PURE__*/ defineComponent({
807
+ const _sfc_main$22 = /*@__PURE__*/ defineComponent({
658
808
  __name: "DropdownMenuItem",
659
809
  props: {
660
810
  value: { default: void 0 },
@@ -685,7 +835,7 @@ const _sfc_main$21 = /*@__PURE__*/ defineComponent({
685
835
  });
686
836
  //#endregion
687
837
  //#region src/components/dropdown-menu/DropdownMenuLabel.vue
688
- const _sfc_main$22 = /*@__PURE__*/ defineComponent({
838
+ const _sfc_main$23 = /*@__PURE__*/ defineComponent({
689
839
  __name: "DropdownMenuLabel",
690
840
  props: { class: {} },
691
841
  setup(__props) {
@@ -697,7 +847,7 @@ const _sfc_main$22 = /*@__PURE__*/ defineComponent({
697
847
  });
698
848
  //#endregion
699
849
  //#region src/components/dropdown-menu/DropdownMenuSeparator.vue
700
- const _sfc_main$23 = /*@__PURE__*/ defineComponent({
850
+ const _sfc_main$24 = /*@__PURE__*/ defineComponent({
701
851
  __name: "DropdownMenuSeparator",
702
852
  props: { class: {} },
703
853
  setup(__props) {
@@ -709,7 +859,7 @@ const _sfc_main$23 = /*@__PURE__*/ defineComponent({
709
859
  });
710
860
  //#endregion
711
861
  //#region src/components/dropdown-menu/DropdownMenuTrigger.vue
712
- const _sfc_main$24 = /*@__PURE__*/ defineComponent({
862
+ const _sfc_main$25 = /*@__PURE__*/ defineComponent({
713
863
  __name: "DropdownMenuTrigger",
714
864
  props: { asChild: { type: Boolean } },
715
865
  setup(__props) {
@@ -723,10 +873,234 @@ const _sfc_main$24 = /*@__PURE__*/ defineComponent({
723
873
  }
724
874
  });
725
875
  //#endregion
876
+ //#region src/components/form/context.ts
877
+ const FORM_KEY = Symbol("tu-form");
878
+ const FIELD_KEY = Symbol("tu-form-field");
879
+ const FORM_ITEM_KEY = Symbol("tu-form-item");
880
+ //#endregion
881
+ //#region src/components/form/Form.vue
882
+ const _sfc_main$26 = /*@__PURE__*/ defineComponent({
883
+ __name: "Form",
884
+ props: {
885
+ form: {},
886
+ class: {}
887
+ },
888
+ setup(__props) {
889
+ const props = __props;
890
+ provide(FORM_KEY, props.form);
891
+ return (_ctx, _cache) => {
892
+ return openBlock(), createElementBlock("form", {
893
+ novalidate: "",
894
+ class: normalizeClass(unref(cn)("flex flex-col gap-4", props.class)),
895
+ onSubmit: _cache[0] || (_cache[0] = withModifiers(($event) => props.form.handleSubmit(), ["prevent"]))
896
+ }, [renderSlot(_ctx.$slots, "default")], 34);
897
+ };
898
+ }
899
+ });
900
+ //#endregion
901
+ //#region src/components/form/FormControl.vue
902
+ /**
903
+ * 把 id / aria-invalid / aria-describedby 合并到唯一子元素(cloneVNode)。
904
+ * aria 全同步计算:description/message 的 presence 由 FormItem 的 refs 提供。
905
+ */
906
+ const _sfc_main$27 = defineComponent({
907
+ name: "TuFormControl",
908
+ props: { class: {
909
+ type: String,
910
+ default: void 0
911
+ } },
912
+ setup(props, { slots }) {
913
+ const fieldCtx = inject(FIELD_KEY, void 0);
914
+ const itemCtx = inject(FORM_ITEM_KEY, void 0);
915
+ if (import.meta.env.DEV && (!fieldCtx || !itemCtx)) console.warn("[tu-design] <FormControl> 必须在 <FormField> + <FormItem> 内使用");
916
+ const isInvalid = computed(() => (fieldCtx?.field.value?.state.meta.errors.length ?? 0) > 0);
917
+ const describedBy = computed(() => {
918
+ if (!itemCtx) return void 0;
919
+ const ids = [itemCtx.hasDescription.value && itemCtx.descriptionId, itemCtx.hasMessage.value && itemCtx.isInvalid.value && itemCtx.messageId].filter(Boolean);
920
+ return ids.length > 0 ? ids.join(" ") : void 0;
921
+ });
922
+ return () => {
923
+ const vnodes = slots.default?.() ?? [];
924
+ if (import.meta.env.DEV && vnodes.length !== 1) console.warn("[tu-design] <FormControl> 需要且仅需要一个子元素");
925
+ const first = vnodes[0];
926
+ if (!first) return null;
927
+ return cloneVNode(first, {
928
+ id: itemCtx?.controlId,
929
+ "aria-invalid": isInvalid.value || void 0,
930
+ "aria-describedby": describedBy.value,
931
+ class: props.class
932
+ });
933
+ };
934
+ }
935
+ });
936
+ //#endregion
937
+ //#region src/components/form/FormDescription.vue
938
+ const _hoisted_1$8 = ["id"];
939
+ const _sfc_main$28 = /*@__PURE__*/ defineComponent({
940
+ __name: "FormDescription",
941
+ props: { class: {} },
942
+ setup(__props) {
943
+ const itemCtx = inject(FORM_ITEM_KEY, void 0);
944
+ const props = __props;
945
+ if (import.meta.env.DEV && !itemCtx) console.warn("[tu-design] <FormDescription> 必须在 <FormField> + <FormItem> 内使用");
946
+ onMounted(() => itemCtx && (itemCtx.hasDescription.value = true));
947
+ onUnmounted(() => itemCtx && (itemCtx.hasDescription.value = false));
948
+ return (_ctx, _cache) => {
949
+ return openBlock(), createElementBlock("p", {
950
+ id: unref(itemCtx)?.descriptionId,
951
+ class: normalizeClass(unref(cn)("text-muted-foreground text-sm", props.class))
952
+ }, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_1$8);
953
+ };
954
+ }
955
+ });
956
+ //#endregion
957
+ //#region src/components/form/FormField.vue
958
+ /**
959
+ * 渲染 TanStack `form.Field` 并经 provide 下发 field 上下文。
960
+ * field 实例只能在 form.Field 的插槽执行期取得(时序早于子组件 setup),
961
+ * 故用 defineComponent + render function 在插槽回调中写入 ShallowRef。
962
+ */
963
+ const _sfc_main$29 = defineComponent({
964
+ name: "TuFormField",
965
+ props: {
966
+ /** 字段名(TanStack 深层 key 的运行时形态) */
967
+ name: {
968
+ type: String,
969
+ required: true
970
+ },
971
+ /** 校验器配置,原样透传(值可为函数或 Standard Schema,如 valibot) */
972
+ validators: {
973
+ type: Object,
974
+ default: void 0
975
+ }
976
+ },
977
+ setup(props, { slots }) {
978
+ const form = inject(FORM_KEY);
979
+ if (!form && import.meta.env.DEV) console.warn("[tu-design] <FormField> 必须在 <Form> 内使用");
980
+ const fieldRef = shallowRef();
981
+ provide(FIELD_KEY, {
982
+ field: fieldRef,
983
+ name: props.name
984
+ });
985
+ if (!form) return () => slots.default?.({ field: void 0 });
986
+ return () => h(form.Field, {
987
+ name: props.name,
988
+ validators: props.validators
989
+ }, { default: (slotProps) => {
990
+ fieldRef.value = slotProps.field;
991
+ return slots.default?.(slotProps);
992
+ } });
993
+ }
994
+ });
995
+ //#endregion
996
+ //#region src/components/form/FormItem.vue
997
+ const _hoisted_1$7 = ["data-invalid"];
998
+ const _sfc_main$30 = /*@__PURE__*/ defineComponent({
999
+ __name: "FormItem",
1000
+ setup(__props) {
1001
+ const fieldCtx = inject(FIELD_KEY);
1002
+ const name = fieldCtx.name;
1003
+ const controlId = `${useId()}-${name}`;
1004
+ const descriptionId = `${controlId}-form-item-description`;
1005
+ const messageId = `${controlId}-form-item-message`;
1006
+ const hasDescription = ref(false);
1007
+ const hasMessage = ref(false);
1008
+ const isInvalid = computed(() => (fieldCtx.field.value?.state.meta.errors.length ?? 0) > 0);
1009
+ provide(FORM_ITEM_KEY, {
1010
+ name,
1011
+ controlId,
1012
+ descriptionId,
1013
+ messageId,
1014
+ hasDescription,
1015
+ hasMessage,
1016
+ isInvalid
1017
+ });
1018
+ return (_ctx, _cache) => {
1019
+ return openBlock(), createElementBlock("div", {
1020
+ class: normalizeClass(unref(cn)("group flex flex-col gap-1.5")),
1021
+ "data-invalid": isInvalid.value ? "" : void 0
1022
+ }, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_1$7);
1023
+ };
1024
+ }
1025
+ });
1026
+ //#endregion
1027
+ //#region src/components/form/FormLabel.vue
1028
+ const _hoisted_1$6 = ["for", "data-invalid"];
1029
+ const _sfc_main$31 = /*@__PURE__*/ defineComponent({
1030
+ __name: "FormLabel",
1031
+ props: { class: {} },
1032
+ setup(__props) {
1033
+ const itemCtx = inject(FORM_ITEM_KEY, void 0);
1034
+ const props = __props;
1035
+ if (import.meta.env.DEV && !itemCtx) console.warn("[tu-design] <FormLabel> 必须在 <FormField> + <FormItem> 内使用");
1036
+ const isInvalid = computed(() => itemCtx?.isInvalid.value ?? false);
1037
+ return (_ctx, _cache) => {
1038
+ return openBlock(), createElementBlock("label", {
1039
+ for: unref(itemCtx)?.controlId,
1040
+ "data-invalid": isInvalid.value ? "" : void 0,
1041
+ class: normalizeClass(unref(cn)("text-sm font-medium leading-none data-invalid:text-destructive", props.class))
1042
+ }, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_1$6);
1043
+ };
1044
+ }
1045
+ });
1046
+ //#endregion
1047
+ //#region src/components/form/FormMessage.vue
1048
+ const _hoisted_1$5 = ["id"];
1049
+ const _sfc_main$32 = /*@__PURE__*/ defineComponent({
1050
+ __name: "FormMessage",
1051
+ props: {
1052
+ message: {},
1053
+ class: {}
1054
+ },
1055
+ setup(__props) {
1056
+ const fieldCtx = inject(FIELD_KEY, void 0);
1057
+ const itemCtx = inject(FORM_ITEM_KEY, void 0);
1058
+ const props = __props;
1059
+ if (import.meta.env.DEV && (!fieldCtx || !itemCtx)) console.warn("[tu-design] <FormMessage> 必须在 <FormField> + <FormItem> 内使用");
1060
+ const errorText = computed(() => {
1061
+ if (props.message) return props.message;
1062
+ const raw = fieldCtx?.field.value?.state.meta.errors[0];
1063
+ if (raw === void 0) return void 0;
1064
+ return typeof raw === "string" ? raw : raw?.message;
1065
+ });
1066
+ onMounted(() => itemCtx && (itemCtx.hasMessage.value = true));
1067
+ onUnmounted(() => itemCtx && (itemCtx.hasMessage.value = false));
1068
+ return (_ctx, _cache) => {
1069
+ return errorText.value ? (openBlock(), createElementBlock("p", {
1070
+ key: 0,
1071
+ id: unref(itemCtx)?.messageId,
1072
+ class: normalizeClass(unref(cn)("text-destructive text-sm", props.class))
1073
+ }, toDisplayString(errorText.value), 11, _hoisted_1$5)) : createCommentVNode("v-if", true);
1074
+ };
1075
+ }
1076
+ });
1077
+ //#endregion
1078
+ //#region src/components/form/FormSubscribe.vue
1079
+ const _sfc_main$33 = /*@__PURE__*/ defineComponent({
1080
+ __name: "FormSubscribe",
1081
+ setup(__props) {
1082
+ const form = inject(FORM_KEY, void 0);
1083
+ if (import.meta.env.DEV && !form) console.warn("[tu-design] <FormSubscribe> 必须在 <Form> 内使用");
1084
+ return (_ctx, _cache) => {
1085
+ return unref(form) ? (openBlock(), createBlock(resolveDynamicComponent(unref(form).Subscribe), { key: 0 }, {
1086
+ default: withCtx((state) => [renderSlot(_ctx.$slots, "default", {
1087
+ canSubmit: state.canSubmit,
1088
+ isSubmitting: state.isSubmitting
1089
+ })]),
1090
+ _: 3
1091
+ })) : createCommentVNode("v-if", true);
1092
+ };
1093
+ }
1094
+ });
1095
+ //#endregion
726
1096
  //#region src/components/input/Input.vue
727
- const _sfc_main$25 = /*@__PURE__*/ defineComponent({
1097
+ const _hoisted_1$4 = ["aria-invalid"];
1098
+ const _sfc_main$34 = /*@__PURE__*/ defineComponent({
728
1099
  __name: "Input",
729
- props: /*@__PURE__*/ mergeModels({ class: {} }, {
1100
+ props: /*@__PURE__*/ mergeModels({
1101
+ class: {},
1102
+ invalid: { type: Boolean }
1103
+ }, {
730
1104
  "modelValue": {},
731
1105
  "modelModifiers": {}
732
1106
  }),
@@ -737,14 +1111,15 @@ const _sfc_main$25 = /*@__PURE__*/ defineComponent({
737
1111
  return (_ctx, _cache) => {
738
1112
  return withDirectives((openBlock(), createElementBlock("input", {
739
1113
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
740
- class: normalizeClass(unref(cn)("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50", props.class))
741
- }, null, 2)), [[vModelText, modelValue.value]]);
1114
+ "aria-invalid": props.invalid ? "true" : void 0,
1115
+ class: normalizeClass(unref(cn)("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-destructive/20 aria-invalid:border-destructive", props.class))
1116
+ }, null, 10, _hoisted_1$4)), [[vModelText, modelValue.value]]);
742
1117
  };
743
1118
  }
744
1119
  });
745
1120
  //#endregion
746
1121
  //#region src/components/label/Label.vue
747
- const _sfc_main$26 = /*@__PURE__*/ defineComponent({
1122
+ const _sfc_main$35 = /*@__PURE__*/ defineComponent({
748
1123
  __name: "Label",
749
1124
  props: { class: {} },
750
1125
  setup(__props) {
@@ -755,8 +1130,438 @@ const _sfc_main$26 = /*@__PURE__*/ defineComponent({
755
1130
  }
756
1131
  });
757
1132
  //#endregion
1133
+ //#region src/components/number-input/utils.ts
1134
+ /** Ark ValueChangeDetails → number|null(空串/NaN 归一 null,numberOrNull 为可单测的纯函数) */
1135
+ function numberOrNull(details) {
1136
+ return details.value === "" || Number.isNaN(details.valueAsNumber) ? null : details.valueAsNumber;
1137
+ }
1138
+ //#endregion
1139
+ //#region src/components/number-input/NumberInput.vue
1140
+ const _sfc_main$36 = /*@__PURE__*/ defineComponent({
1141
+ inheritAttrs: false,
1142
+ __name: "NumberInput",
1143
+ props: {
1144
+ /** 受控值:number 或 null(空);undefined 走内部非受控 */
1145
+ modelValue: {
1146
+ type: Number,
1147
+ default: void 0
1148
+ },
1149
+ min: {
1150
+ type: Number,
1151
+ default: void 0
1152
+ },
1153
+ max: {
1154
+ type: Number,
1155
+ default: void 0
1156
+ },
1157
+ step: {
1158
+ type: Number,
1159
+ default: void 0
1160
+ },
1161
+ formatOptions: {
1162
+ type: Object,
1163
+ default: void 0
1164
+ },
1165
+ disabled: {
1166
+ type: Boolean,
1167
+ default: void 0
1168
+ },
1169
+ invalid: {
1170
+ type: Boolean,
1171
+ default: void 0
1172
+ },
1173
+ class: {
1174
+ type: String,
1175
+ default: void 0
1176
+ }
1177
+ },
1178
+ emits: ["update:modelValue"],
1179
+ setup(__props, { emit: __emit }) {
1180
+ const props = __props;
1181
+ const emit = __emit;
1182
+ const internalValue = ref(null);
1183
+ const current = computed(() => props.modelValue === void 0 ? internalValue.value : props.modelValue);
1184
+ /** number → Ark 受控 string(null/NaN → 空串) */
1185
+ const arkValue = computed(() => current.value == null || Number.isNaN(current.value) ? "" : String(current.value));
1186
+ /** Ark details(value: string / valueAsNumber: number)→ number|null(空串/NaN 归一 null) */
1187
+ function handleValueChange(details) {
1188
+ const next = numberOrNull(details);
1189
+ internalValue.value = next;
1190
+ emit("update:modelValue", next);
1191
+ }
1192
+ return (_ctx, _cache) => {
1193
+ return openBlock(), createBlock(unref(NumberInput).Root, {
1194
+ "model-value": arkValue.value,
1195
+ min: props.min,
1196
+ max: props.max,
1197
+ step: props.step,
1198
+ "format-options": props.formatOptions,
1199
+ disabled: props.disabled,
1200
+ invalid: props.invalid,
1201
+ class: normalizeClass(unref(cn)("border-input flex h-9 items-stretch overflow-hidden rounded-md border shadow-sm transition-[color,box-shadow] outline-none data-invalid:border-destructive data-invalid:ring-destructive/20 data-invalid:ring-[3px]", props.class)),
1202
+ onValueChange: handleValueChange
1203
+ }, {
1204
+ default: withCtx(() => [
1205
+ createVNode(unref(NumberInput).DecrementTrigger, { class: normalizeClass("bg-muted/50 hover:bg-accent flex w-9 shrink-0 items-center justify-center border-r text-muted-foreground text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50") }, {
1206
+ default: withCtx(() => [renderSlot(_ctx.$slots, "decrement", {}, () => [_cache[0] || (_cache[0] = createElementVNode("svg", {
1207
+ viewBox: "0 0 24 24",
1208
+ fill: "none",
1209
+ stroke: "currentColor",
1210
+ "stroke-width": "2",
1211
+ "stroke-linecap": "round",
1212
+ "stroke-linejoin": "round",
1213
+ class: "size-4",
1214
+ "aria-hidden": "true"
1215
+ }, [createElementVNode("path", { d: "M5 12h14" })], -1))])]),
1216
+ _: 3
1217
+ }),
1218
+ createVNode(unref(NumberInput).Input, mergeProps(_ctx.$attrs, { class: "bg-transparent flex-1 min-w-0 px-1 text-center text-sm outline-none disabled:cursor-not-allowed" }), null, 16),
1219
+ createVNode(unref(NumberInput).IncrementTrigger, { class: normalizeClass("bg-muted/50 hover:bg-accent flex w-9 shrink-0 items-center justify-center border-l text-muted-foreground text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50") }, {
1220
+ default: withCtx(() => [renderSlot(_ctx.$slots, "increment", {}, () => [_cache[1] || (_cache[1] = createElementVNode("svg", {
1221
+ viewBox: "0 0 24 24",
1222
+ fill: "none",
1223
+ stroke: "currentColor",
1224
+ "stroke-width": "2",
1225
+ "stroke-linecap": "round",
1226
+ "stroke-linejoin": "round",
1227
+ class: "size-4",
1228
+ "aria-hidden": "true"
1229
+ }, [createElementVNode("path", { d: "M5 12h14" }), createElementVNode("path", { d: "M12 5v14" })], -1))])]),
1230
+ _: 3
1231
+ })
1232
+ ]),
1233
+ _: 3
1234
+ }, 8, [
1235
+ "model-value",
1236
+ "min",
1237
+ "max",
1238
+ "step",
1239
+ "format-options",
1240
+ "disabled",
1241
+ "invalid",
1242
+ "class"
1243
+ ]);
1244
+ };
1245
+ }
1246
+ });
1247
+ //#endregion
1248
+ //#region src/components/password-input/PasswordInput.vue
1249
+ const _hoisted_1$3 = ["data-invalid"];
1250
+ const _hoisted_2 = [
1251
+ "type",
1252
+ "value",
1253
+ "autocomplete",
1254
+ "placeholder",
1255
+ "disabled",
1256
+ "aria-invalid"
1257
+ ];
1258
+ const _hoisted_3 = [
1259
+ "aria-label",
1260
+ "aria-pressed",
1261
+ "disabled"
1262
+ ];
1263
+ const _hoisted_4 = {
1264
+ key: 0,
1265
+ viewBox: "0 0 24 24",
1266
+ fill: "none",
1267
+ stroke: "currentColor",
1268
+ "stroke-width": "2",
1269
+ "stroke-linecap": "round",
1270
+ "stroke-linejoin": "round",
1271
+ class: "size-4",
1272
+ "aria-hidden": "true"
1273
+ };
1274
+ const _hoisted_5 = {
1275
+ key: 1,
1276
+ viewBox: "0 0 24 24",
1277
+ fill: "none",
1278
+ stroke: "currentColor",
1279
+ "stroke-width": "2",
1280
+ "stroke-linecap": "round",
1281
+ "stroke-linejoin": "round",
1282
+ class: "size-4",
1283
+ "aria-hidden": "true"
1284
+ };
1285
+ const _sfc_main$37 = /*@__PURE__*/ defineComponent({
1286
+ inheritAttrs: false,
1287
+ __name: "PasswordInput",
1288
+ props: {
1289
+ /** 受控值;undefined 走内部非受控 */
1290
+ modelValue: {
1291
+ type: String,
1292
+ default: void 0
1293
+ },
1294
+ /** 明文显示;undefined 走内部非受控(默认隐藏) */
1295
+ visible: {
1296
+ type: Boolean,
1297
+ default: void 0
1298
+ },
1299
+ autoComplete: {
1300
+ type: String,
1301
+ default: "current-password"
1302
+ },
1303
+ placeholder: {
1304
+ type: String,
1305
+ default: void 0
1306
+ },
1307
+ disabled: {
1308
+ type: Boolean,
1309
+ default: void 0
1310
+ },
1311
+ invalid: {
1312
+ type: Boolean,
1313
+ default: void 0
1314
+ },
1315
+ class: {
1316
+ type: String,
1317
+ default: void 0
1318
+ }
1319
+ },
1320
+ emits: ["update:modelValue", "update:visible"],
1321
+ setup(__props, { emit: __emit }) {
1322
+ const props = __props;
1323
+ const emit = __emit;
1324
+ const internalValue = ref("");
1325
+ const current = computed(() => props.modelValue ?? internalValue.value);
1326
+ function onInput(event) {
1327
+ const value = event.target.value;
1328
+ internalValue.value = value;
1329
+ emit("update:modelValue", value);
1330
+ }
1331
+ const internalVisible = ref(false);
1332
+ const isVisible = computed(() => props.visible ?? internalVisible.value);
1333
+ function toggleVisible() {
1334
+ const next = !isVisible.value;
1335
+ internalVisible.value = next;
1336
+ emit("update:visible", next);
1337
+ }
1338
+ return (_ctx, _cache) => {
1339
+ return openBlock(), createElementBlock("div", {
1340
+ class: normalizeClass(unref(cn)("border-input flex h-9 w-full items-center rounded-md border shadow-sm transition-[color,box-shadow] outline-none focus-within:border-ring focus-within:ring-ring/20 focus-within:ring-[3px] data-invalid:border-destructive data-invalid:ring-destructive/20 data-invalid:ring-[3px]", props.class)),
1341
+ "data-invalid": props.invalid ? "" : void 0
1342
+ }, [createElementVNode("input", mergeProps(_ctx.$attrs, {
1343
+ type: isVisible.value ? "text" : "password",
1344
+ value: current.value,
1345
+ autocomplete: props.autoComplete,
1346
+ placeholder: props.placeholder,
1347
+ disabled: props.disabled,
1348
+ "aria-invalid": props.invalid || void 0,
1349
+ class: "bg-transparent h-full w-full min-w-0 flex-1 rounded-md px-3 text-sm outline-none disabled:cursor-not-allowed disabled:opacity-50",
1350
+ onInput
1351
+ }), null, 16, _hoisted_2), createElementVNode("button", {
1352
+ type: "button",
1353
+ "aria-label": isVisible.value ? "隐藏密码" : "显示密码",
1354
+ "aria-pressed": isVisible.value ? "true" : "false",
1355
+ disabled: props.disabled,
1356
+ class: normalizeClass("hover:text-foreground mr-1 flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-sm text-muted-foreground outline-none disabled:cursor-not-allowed disabled:opacity-50"),
1357
+ onClick: toggleVisible
1358
+ }, [createCommentVNode(" 可见时显示 EyeOff(点击隐藏),默认显示 Eye(点击查看) "), renderSlot(_ctx.$slots, "visibility-icon", { visible: isVisible.value }, () => [isVisible.value ? (openBlock(), createElementBlock("svg", _hoisted_4, [..._cache[0] || (_cache[0] = [
1359
+ createElementVNode("path", { d: "M9.88 9.88a3 3 0 1 0 4.24 4.24" }, null, -1),
1360
+ createElementVNode("path", { d: "M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68" }, null, -1),
1361
+ createElementVNode("path", { d: "M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61" }, null, -1),
1362
+ createElementVNode("line", {
1363
+ x1: "2",
1364
+ x2: "22",
1365
+ y1: "2",
1366
+ y2: "22"
1367
+ }, null, -1)
1368
+ ])])) : (openBlock(), createElementBlock("svg", _hoisted_5, [..._cache[1] || (_cache[1] = [createElementVNode("path", { d: "M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z" }, null, -1), createElementVNode("circle", {
1369
+ cx: "12",
1370
+ cy: "12",
1371
+ r: "3"
1372
+ }, null, -1)])]))])], 8, _hoisted_3)], 10, _hoisted_1$3);
1373
+ };
1374
+ }
1375
+ });
1376
+ //#endregion
1377
+ //#region src/components/pin-input/PinInput.vue
1378
+ const _sfc_main$38 = /*@__PURE__*/ defineComponent({
1379
+ inheritAttrs: false,
1380
+ __name: "PinInput",
1381
+ props: {
1382
+ /** 受控值:每格一个元素的数组;undefined 走内部非受控 */
1383
+ modelValue: {
1384
+ type: Array,
1385
+ default: void 0
1386
+ },
1387
+ /** 格数(默认 4) */
1388
+ length: {
1389
+ type: Number,
1390
+ default: 4
1391
+ },
1392
+ /** 单格字符类型 */
1393
+ type: {
1394
+ type: String,
1395
+ default: void 0
1396
+ },
1397
+ otp: {
1398
+ type: Boolean,
1399
+ default: void 0
1400
+ },
1401
+ mask: {
1402
+ type: Boolean,
1403
+ default: void 0
1404
+ },
1405
+ autoSubmit: {
1406
+ type: Boolean,
1407
+ default: void 0
1408
+ },
1409
+ blurOnComplete: {
1410
+ type: Boolean,
1411
+ default: void 0
1412
+ },
1413
+ placeholder: {
1414
+ type: String,
1415
+ default: void 0
1416
+ },
1417
+ disabled: {
1418
+ type: Boolean,
1419
+ default: void 0
1420
+ },
1421
+ invalid: {
1422
+ type: Boolean,
1423
+ default: void 0
1424
+ },
1425
+ class: {
1426
+ type: String,
1427
+ default: void 0
1428
+ }
1429
+ },
1430
+ emits: ["update:modelValue", "complete"],
1431
+ setup(__props, { emit: __emit }) {
1432
+ const props = __props;
1433
+ const emit = __emit;
1434
+ const internalValue = ref([]);
1435
+ const current = computed(() => props.modelValue === void 0 ? internalValue.value : props.modelValue);
1436
+ function handleValueChange(details) {
1437
+ internalValue.value = details.value;
1438
+ emit("update:modelValue", details.value);
1439
+ }
1440
+ function handleValueComplete(details) {
1441
+ emit("complete", details.value);
1442
+ }
1443
+ return (_ctx, _cache) => {
1444
+ return openBlock(), createBlock(unref(PinInput).Root, {
1445
+ "model-value": current.value,
1446
+ type: props.type,
1447
+ otp: props.otp,
1448
+ mask: props.mask,
1449
+ "auto-submit": props.autoSubmit,
1450
+ "blur-on-complete": props.blurOnComplete,
1451
+ placeholder: props.placeholder,
1452
+ disabled: props.disabled,
1453
+ invalid: props.invalid,
1454
+ class: normalizeClass(unref(cn)("flex items-center gap-2", props.class)),
1455
+ onValueChange: handleValueChange,
1456
+ onValueComplete: handleValueComplete
1457
+ }, {
1458
+ default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(props.length, (i) => {
1459
+ return openBlock(), createElementBlock(Fragment, { key: i }, [createVNode(unref(PinInput).Input, mergeProps({ ref_for: true }, i === 1 ? _ctx.$attrs : void 0, {
1460
+ index: i - 1,
1461
+ class: "border-input bg-transparent h-9 w-9 rounded-md border text-center text-sm shadow-sm transition-[color,box-shadow] outline-none data-invalid:border-destructive data-invalid:ring-destructive/20 data-invalid:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"
1462
+ }), null, 16, ["index"]), i < props.length ? renderSlot(_ctx.$slots, "separator", {}, void 0, void 0, 0) : createCommentVNode("v-if", true)], 64);
1463
+ }), 128))]),
1464
+ _: 3
1465
+ }, 8, [
1466
+ "model-value",
1467
+ "type",
1468
+ "otp",
1469
+ "mask",
1470
+ "auto-submit",
1471
+ "blur-on-complete",
1472
+ "placeholder",
1473
+ "disabled",
1474
+ "invalid",
1475
+ "class"
1476
+ ]);
1477
+ };
1478
+ }
1479
+ });
1480
+ //#endregion
1481
+ //#region src/components/popover/Popover.vue
1482
+ const _sfc_main$39 = /*@__PURE__*/ defineComponent({
1483
+ __name: "Popover",
1484
+ props: {
1485
+ open: {
1486
+ type: Boolean,
1487
+ default: void 0
1488
+ },
1489
+ defaultOpen: {
1490
+ type: Boolean,
1491
+ default: false
1492
+ },
1493
+ lazyMount: {
1494
+ type: Boolean,
1495
+ default: false
1496
+ },
1497
+ unmountOnExit: {
1498
+ type: Boolean,
1499
+ default: false
1500
+ }
1501
+ },
1502
+ emits: ["update:open"],
1503
+ setup(__props, { emit: __emit }) {
1504
+ const props = __props;
1505
+ const emit = __emit;
1506
+ const internalOpen = ref(props.defaultOpen);
1507
+ const isOpen = computed(() => props.open ?? internalOpen.value);
1508
+ function handleUpdate(open) {
1509
+ internalOpen.value = open;
1510
+ emit("update:open", open);
1511
+ }
1512
+ return (_ctx, _cache) => {
1513
+ return openBlock(), createBlock(unref(Popover).Root, {
1514
+ open: isOpen.value,
1515
+ "lazy-mount": props.lazyMount,
1516
+ "unmount-on-exit": props.unmountOnExit,
1517
+ "onUpdate:open": handleUpdate
1518
+ }, {
1519
+ default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
1520
+ _: 3
1521
+ }, 8, [
1522
+ "open",
1523
+ "lazy-mount",
1524
+ "unmount-on-exit"
1525
+ ]);
1526
+ };
1527
+ }
1528
+ });
1529
+ //#endregion
1530
+ //#region src/components/popover/PopoverContent.vue
1531
+ const _sfc_main$40 = /*@__PURE__*/ defineComponent({
1532
+ __name: "PopoverContent",
1533
+ props: { class: {} },
1534
+ setup(__props) {
1535
+ const props = __props;
1536
+ return (_ctx, _cache) => {
1537
+ return openBlock(), createBlock(unref(Popover).Positioner, { class: "z-50" }, {
1538
+ default: withCtx(() => [createVNode(unref(Popover).Content, { class: normalizeClass(unref(cn)("bg-popover text-popover-foreground z-50 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.class)) }, {
1539
+ default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
1540
+ _: 3
1541
+ }, 8, ["class"])]),
1542
+ _: 3
1543
+ });
1544
+ };
1545
+ }
1546
+ });
1547
+ //#endregion
1548
+ //#region src/components/popover/PopoverTrigger.vue
1549
+ const _sfc_main$41 = /*@__PURE__*/ defineComponent({
1550
+ __name: "PopoverTrigger",
1551
+ props: { asChild: { type: Boolean } },
1552
+ setup(__props) {
1553
+ const props = __props;
1554
+ return (_ctx, _cache) => {
1555
+ return openBlock(), createBlock(unref(Popover).Trigger, { "as-child": props.asChild }, {
1556
+ default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
1557
+ _: 3
1558
+ }, 8, ["as-child"]);
1559
+ };
1560
+ }
1561
+ });
1562
+ //#endregion
758
1563
  //#region src/components/radio-group/RadioGroup.vue
759
- const _sfc_main$27 = /*@__PURE__*/ defineComponent({
1564
+ const _sfc_main$42 = /*@__PURE__*/ defineComponent({
760
1565
  __name: "RadioGroup",
761
1566
  props: {
762
1567
  value: {},
@@ -792,7 +1597,7 @@ const _sfc_main$27 = /*@__PURE__*/ defineComponent({
792
1597
  });
793
1598
  //#endregion
794
1599
  //#region src/components/radio-group/RadioGroupItem.vue
795
- const _sfc_main$28 = /*@__PURE__*/ defineComponent({
1600
+ const _sfc_main$43 = /*@__PURE__*/ defineComponent({
796
1601
  __name: "RadioGroupItem",
797
1602
  props: {
798
1603
  value: {},
@@ -832,7 +1637,7 @@ const _sfc_main$28 = /*@__PURE__*/ defineComponent({
832
1637
  });
833
1638
  //#endregion
834
1639
  //#region src/components/select/Select.vue
835
- const _sfc_main$29 = /*@__PURE__*/ defineComponent({
1640
+ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
836
1641
  __name: "Select",
837
1642
  props: {
838
1643
  /** 选项列表(构建键盘导航/回显所需的 collection) */
@@ -912,7 +1717,7 @@ const _sfc_main$29 = /*@__PURE__*/ defineComponent({
912
1717
  });
913
1718
  //#endregion
914
1719
  //#region src/components/select/SelectContent.vue
915
- const _sfc_main$30 = /*@__PURE__*/ defineComponent({
1720
+ const _sfc_main$45 = /*@__PURE__*/ defineComponent({
916
1721
  __name: "SelectContent",
917
1722
  props: { class: {} },
918
1723
  setup(__props) {
@@ -938,7 +1743,7 @@ function normalizeSelectItem(item) {
938
1743
  }
939
1744
  //#endregion
940
1745
  //#region src/components/select/SelectItem.vue
941
- const _sfc_main$31 = /*@__PURE__*/ defineComponent({
1746
+ const _sfc_main$46 = /*@__PURE__*/ defineComponent({
942
1747
  __name: "SelectItem",
943
1748
  props: {
944
1749
  item: {
@@ -980,7 +1785,7 @@ const _sfc_main$31 = /*@__PURE__*/ defineComponent({
980
1785
  });
981
1786
  //#endregion
982
1787
  //#region src/components/select/SelectTrigger.vue
983
- const _hoisted_1$1 = {
1788
+ const _hoisted_1$2 = {
984
1789
  key: 0,
985
1790
  viewBox: "0 0 24 24",
986
1791
  fill: "none",
@@ -990,7 +1795,7 @@ const _hoisted_1$1 = {
990
1795
  "stroke-linejoin": "round",
991
1796
  class: "size-4 opacity-50"
992
1797
  };
993
- const _sfc_main$32 = /*@__PURE__*/ defineComponent({
1798
+ const _sfc_main$47 = /*@__PURE__*/ defineComponent({
994
1799
  __name: "SelectTrigger",
995
1800
  props: {
996
1801
  asChild: { type: Boolean },
@@ -1004,7 +1809,7 @@ const _sfc_main$32 = /*@__PURE__*/ defineComponent({
1004
1809
  "as-child": props.asChild,
1005
1810
  class: normalizeClass(unref(cn)("border-input data-[placeholder]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 flex h-9 w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs focus-visible:outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:shrink-0 [&_svg:not([class*=size-])]:size-4", props.class))
1006
1811
  }, {
1007
- default: withCtx(() => [renderSlot(_ctx.$slots, "default"), !props.asChild ? (openBlock(), createElementBlock("svg", _hoisted_1$1, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "m6 9 6 6 6-6" }, null, -1)])])) : createCommentVNode("v-if", true)]),
1812
+ default: withCtx(() => [renderSlot(_ctx.$slots, "default"), !props.asChild ? (openBlock(), createElementBlock("svg", _hoisted_1$2, [..._cache[0] || (_cache[0] = [createElementVNode("path", { d: "m6 9 6 6 6-6" }, null, -1)])])) : createCommentVNode("v-if", true)]),
1008
1813
  _: 3
1009
1814
  }, 8, ["as-child", "class"])]),
1010
1815
  _: 3
@@ -1014,7 +1819,7 @@ const _sfc_main$32 = /*@__PURE__*/ defineComponent({
1014
1819
  });
1015
1820
  //#endregion
1016
1821
  //#region src/components/select/SelectValueText.vue
1017
- const _sfc_main$33 = /*@__PURE__*/ defineComponent({
1822
+ const _sfc_main$48 = /*@__PURE__*/ defineComponent({
1018
1823
  __name: "SelectValueText",
1019
1824
  props: { placeholder: {} },
1020
1825
  setup(__props) {
@@ -1026,8 +1831,8 @@ const _sfc_main$33 = /*@__PURE__*/ defineComponent({
1026
1831
  });
1027
1832
  //#endregion
1028
1833
  //#region src/components/separator/Separator.vue
1029
- const _hoisted_1 = ["data-orientation"];
1030
- const _sfc_main$34 = /*@__PURE__*/ defineComponent({
1834
+ const _hoisted_1$1 = ["data-orientation"];
1835
+ const _sfc_main$49 = /*@__PURE__*/ defineComponent({
1031
1836
  __name: "Separator",
1032
1837
  props: {
1033
1838
  orientation: { default: "horizontal" },
@@ -1040,13 +1845,13 @@ const _sfc_main$34 = /*@__PURE__*/ defineComponent({
1040
1845
  return openBlock(), createElementBlock("div", {
1041
1846
  "data-orientation": props.orientation,
1042
1847
  class: normalizeClass(unref(cn)("bg-border shrink-0", orientationClass.value, props.class))
1043
- }, null, 10, _hoisted_1);
1848
+ }, null, 10, _hoisted_1$1);
1044
1849
  };
1045
1850
  }
1046
1851
  });
1047
1852
  //#endregion
1048
1853
  //#region src/components/skeleton/Skeleton.vue
1049
- const _sfc_main$35 = /*@__PURE__*/ defineComponent({
1854
+ const _sfc_main$50 = /*@__PURE__*/ defineComponent({
1050
1855
  __name: "Skeleton",
1051
1856
  props: { class: {} },
1052
1857
  setup(__props) {
@@ -1061,7 +1866,7 @@ const _sfc_main$35 = /*@__PURE__*/ defineComponent({
1061
1866
  });
1062
1867
  //#endregion
1063
1868
  //#region src/components/slider/Slider.vue
1064
- const _sfc_main$36 = /*@__PURE__*/ defineComponent({
1869
+ const _sfc_main$51 = /*@__PURE__*/ defineComponent({
1065
1870
  __name: "Slider",
1066
1871
  props: {
1067
1872
  value: {},
@@ -1120,7 +1925,7 @@ const _sfc_main$36 = /*@__PURE__*/ defineComponent({
1120
1925
  });
1121
1926
  //#endregion
1122
1927
  //#region src/components/switch/Switch.vue
1123
- const _sfc_main$37 = /*@__PURE__*/ defineComponent({
1928
+ const _sfc_main$52 = /*@__PURE__*/ defineComponent({
1124
1929
  __name: "Switch",
1125
1930
  props: {
1126
1931
  checked: {
@@ -1182,7 +1987,7 @@ const _sfc_main$37 = /*@__PURE__*/ defineComponent({
1182
1987
  });
1183
1988
  //#endregion
1184
1989
  //#region src/components/tabs/Tabs.vue
1185
- const _sfc_main$38 = /*@__PURE__*/ defineComponent({
1990
+ const _sfc_main$53 = /*@__PURE__*/ defineComponent({
1186
1991
  __name: "Tabs",
1187
1992
  props: {
1188
1993
  value: {},
@@ -1218,7 +2023,7 @@ const _sfc_main$38 = /*@__PURE__*/ defineComponent({
1218
2023
  });
1219
2024
  //#endregion
1220
2025
  //#region src/components/tabs/TabsContent.vue
1221
- const _sfc_main$39 = /*@__PURE__*/ defineComponent({
2026
+ const _sfc_main$54 = /*@__PURE__*/ defineComponent({
1222
2027
  __name: "TabsContent",
1223
2028
  props: {
1224
2029
  value: {},
@@ -1239,7 +2044,7 @@ const _sfc_main$39 = /*@__PURE__*/ defineComponent({
1239
2044
  });
1240
2045
  //#endregion
1241
2046
  //#region src/components/tabs/TabsList.vue
1242
- const _sfc_main$40 = /*@__PURE__*/ defineComponent({
2047
+ const _sfc_main$55 = /*@__PURE__*/ defineComponent({
1243
2048
  __name: "TabsList",
1244
2049
  props: { class: {} },
1245
2050
  setup(__props) {
@@ -1254,7 +2059,7 @@ const _sfc_main$40 = /*@__PURE__*/ defineComponent({
1254
2059
  });
1255
2060
  //#endregion
1256
2061
  //#region src/components/tabs/TabsTrigger.vue
1257
- const _sfc_main$41 = /*@__PURE__*/ defineComponent({
2062
+ const _sfc_main$56 = /*@__PURE__*/ defineComponent({
1258
2063
  __name: "TabsTrigger",
1259
2064
  props: {
1260
2065
  value: {},
@@ -1280,8 +2085,33 @@ const _sfc_main$41 = /*@__PURE__*/ defineComponent({
1280
2085
  }
1281
2086
  });
1282
2087
  //#endregion
2088
+ //#region src/components/textarea/Textarea.vue
2089
+ const _hoisted_1 = ["aria-invalid"];
2090
+ const _sfc_main$57 = /*@__PURE__*/ defineComponent({
2091
+ __name: "Textarea",
2092
+ props: /*@__PURE__*/ mergeModels({
2093
+ class: {},
2094
+ invalid: { type: Boolean }
2095
+ }, {
2096
+ "modelValue": {},
2097
+ "modelModifiers": {}
2098
+ }),
2099
+ emits: ["update:modelValue"],
2100
+ setup(__props) {
2101
+ const modelValue = useModel(__props, "modelValue");
2102
+ const props = __props;
2103
+ return (_ctx, _cache) => {
2104
+ return withDirectives((openBlock(), createElementBlock("textarea", {
2105
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
2106
+ "aria-invalid": props.invalid ? "true" : void 0,
2107
+ class: normalizeClass(unref(cn)("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-destructive/20 aria-invalid:border-destructive md:text-sm", props.class))
2108
+ }, null, 10, _hoisted_1)), [[vModelText, modelValue.value]]);
2109
+ };
2110
+ }
2111
+ });
2112
+ //#endregion
1283
2113
  //#region src/components/tooltip/Tooltip.vue
1284
- const _sfc_main$42 = /*@__PURE__*/ defineComponent({
2114
+ const _sfc_main$58 = /*@__PURE__*/ defineComponent({
1285
2115
  __name: "Tooltip",
1286
2116
  props: {
1287
2117
  open: {
@@ -1342,7 +2172,7 @@ const _sfc_main$42 = /*@__PURE__*/ defineComponent({
1342
2172
  });
1343
2173
  //#endregion
1344
2174
  //#region src/components/tooltip/TooltipContent.vue
1345
- const _sfc_main$43 = /*@__PURE__*/ defineComponent({
2175
+ const _sfc_main$59 = /*@__PURE__*/ defineComponent({
1346
2176
  __name: "TooltipContent",
1347
2177
  props: { class: {} },
1348
2178
  setup(__props) {
@@ -1360,7 +2190,7 @@ const _sfc_main$43 = /*@__PURE__*/ defineComponent({
1360
2190
  });
1361
2191
  //#endregion
1362
2192
  //#region src/components/tooltip/TooltipTrigger.vue
1363
- const _sfc_main$44 = /*@__PURE__*/ defineComponent({
2193
+ const _sfc_main$60 = /*@__PURE__*/ defineComponent({
1364
2194
  __name: "TooltipTrigger",
1365
2195
  props: { asChild: { type: Boolean } },
1366
2196
  setup(__props) {
@@ -1374,4 +2204,4 @@ const _sfc_main$44 = /*@__PURE__*/ defineComponent({
1374
2204
  }
1375
2205
  });
1376
2206
  //#endregion
1377
- export { _sfc_main as Avatar, _sfc_main$1 as Badge, _sfc_main$2 as Button, COMPONENT_NAMES, _sfc_main$3 as Card, _sfc_main$4 as CardContent, _sfc_main$5 as CardDescription, _sfc_main$6 as CardFooter, _sfc_main$7 as CardHeader, _sfc_main$8 as CardTitle, _sfc_main$9 as Checkbox, _sfc_main$10 as Dialog, _sfc_main$11 as DialogClose, _sfc_main$12 as DialogContent, _sfc_main$13 as DialogDescription, _sfc_main$14 as DialogFooter, _sfc_main$15 as DialogHeader, _sfc_main$16 as DialogTitle, _sfc_main$17 as DialogTrigger, _sfc_main$18 as DropdownMenu, _sfc_main$19 as DropdownMenuContent, _sfc_main$20 as DropdownMenuGroup, _sfc_main$21 as DropdownMenuItem, _sfc_main$22 as DropdownMenuLabel, _sfc_main$23 as DropdownMenuSeparator, _sfc_main$24 as DropdownMenuTrigger, _sfc_main$25 as Input, _sfc_main$26 as Label, _sfc_main$27 as RadioGroup, _sfc_main$28 as RadioGroupItem, _sfc_main$29 as Select, _sfc_main$30 as SelectContent, _sfc_main$31 as SelectItem, _sfc_main$32 as SelectTrigger, _sfc_main$33 as SelectValueText, _sfc_main$34 as Separator, _sfc_main$35 as Skeleton, _sfc_main$36 as Slider, Slot, _sfc_main$37 as Switch, _sfc_main$38 as Tabs, _sfc_main$39 as TabsContent, _sfc_main$40 as TabsList, _sfc_main$41 as TabsTrigger, _sfc_main$42 as Tooltip, _sfc_main$43 as TooltipContent, _sfc_main$44 as TooltipTrigger, TuDesignResolver, badgeVariants, buttonVariants, cn };
2207
+ export { _sfc_main as Avatar, _sfc_main$1 as Badge, _sfc_main$2 as Button, COMPONENT_NAMES, _sfc_main$3 as Card, _sfc_main$4 as CardContent, _sfc_main$5 as CardDescription, _sfc_main$6 as CardFooter, _sfc_main$7 as CardHeader, _sfc_main$8 as CardTitle, _sfc_main$9 as Checkbox, _sfc_main$10 as CurrencyInput, _sfc_main$11 as Dialog, _sfc_main$12 as DialogClose, _sfc_main$13 as DialogContent, _sfc_main$14 as DialogDescription, _sfc_main$15 as DialogFooter, _sfc_main$16 as DialogHeader, _sfc_main$17 as DialogTitle, _sfc_main$18 as DialogTrigger, _sfc_main$19 as DropdownMenu, _sfc_main$20 as DropdownMenuContent, _sfc_main$21 as DropdownMenuGroup, _sfc_main$22 as DropdownMenuItem, _sfc_main$23 as DropdownMenuLabel, _sfc_main$24 as DropdownMenuSeparator, _sfc_main$25 as DropdownMenuTrigger, _sfc_main$26 as Form, _sfc_main$27 as FormControl, _sfc_main$28 as FormDescription, _sfc_main$29 as FormField, _sfc_main$30 as FormItem, _sfc_main$31 as FormLabel, _sfc_main$32 as FormMessage, _sfc_main$33 as FormSubscribe, _sfc_main$34 as Input, _sfc_main$35 as Label, _sfc_main$36 as NumberInput, _sfc_main$37 as PasswordInput, _sfc_main$38 as PinInput, _sfc_main$39 as Popover, _sfc_main$40 as PopoverContent, _sfc_main$41 as PopoverTrigger, _sfc_main$42 as RadioGroup, _sfc_main$43 as RadioGroupItem, _sfc_main$44 as Select, _sfc_main$45 as SelectContent, _sfc_main$46 as SelectItem, _sfc_main$47 as SelectTrigger, _sfc_main$48 as SelectValueText, _sfc_main$49 as Separator, _sfc_main$50 as Skeleton, _sfc_main$51 as Slider, Slot, _sfc_main$52 as Switch, _sfc_main$53 as Tabs, _sfc_main$54 as TabsContent, _sfc_main$55 as TabsList, _sfc_main$56 as TabsTrigger, _sfc_main$57 as Textarea, _sfc_main$58 as Tooltip, _sfc_main$59 as TooltipContent, _sfc_main$60 as TooltipTrigger, TuDesignResolver, badgeVariants, buttonVariants, cn, formatCurrency, numberOrNull, parseCurrency };