@1337exp/taoui 1.1.0 → 1.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,15 +1,15 @@
1
- import { defineComponent, openBlock, createElementBlock, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, renderSlot, computed, normalizeStyle, inject, useId, ref, watch, onBeforeUnmount, createBlock, Teleport, createVNode, Transition, withCtx, withModifiers, unref, nextTick, Fragment, renderList, createTextVNode, resolveDynamicComponent, useCssVars, onMounted, reactive, onBeforeMount, withDirectives, vModelText, resolveComponent, mergeProps, provide, TransitionGroup, onUpdated, createApp } from "vue";
2
- const _hoisted_1$E = ["type", "disabled"];
3
- const _hoisted_2$z = {
1
+ import { defineComponent, openBlock, createElementBlock, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, renderSlot, computed, normalizeStyle, inject, useId, ref, unref, watch, onBeforeUnmount, createBlock, Teleport, createVNode, Transition, withCtx, withModifiers, nextTick, Fragment, renderList, createTextVNode, resolveDynamicComponent, useCssVars, onMounted, reactive, onBeforeMount, useSlots, withDirectives, vModelText, resolveComponent, mergeProps, provide, TransitionGroup, onUpdated, createApp } from "vue";
2
+ const _hoisted_1$F = ["type", "disabled"];
3
+ const _hoisted_2$A = {
4
4
  key: 0,
5
5
  class: "tao-button__loader"
6
6
  };
7
- const _hoisted_3$r = {
7
+ const _hoisted_3$u = {
8
8
  key: 1,
9
9
  class: "tao-button__icon"
10
10
  };
11
- const _hoisted_4$l = { class: "tao-button__content" };
12
- const _sfc_main$N = /* @__PURE__ */ defineComponent({
11
+ const _hoisted_4$o = { class: "tao-button__content" };
12
+ const _sfc_main$O = /* @__PURE__ */ defineComponent({
13
13
  ...{ name: "TaoButton" },
14
14
  __name: "TaoButton",
15
15
  props: {
@@ -46,12 +46,12 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
46
46
  disabled: __props.disabled || __props.loading,
47
47
  onClick: handleClick
48
48
  }, [
49
- __props.loading ? (openBlock(), createElementBlock("span", _hoisted_2$z)) : createCommentVNode("", true),
50
- __props.icon ? (openBlock(), createElementBlock("span", _hoisted_3$r, toDisplayString(__props.icon), 1)) : createCommentVNode("", true),
51
- createElementVNode("span", _hoisted_4$l, [
49
+ __props.loading ? (openBlock(), createElementBlock("span", _hoisted_2$A)) : createCommentVNode("", true),
50
+ __props.icon ? (openBlock(), createElementBlock("span", _hoisted_3$u, toDisplayString(__props.icon), 1)) : createCommentVNode("", true),
51
+ createElementVNode("span", _hoisted_4$o, [
52
52
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
53
53
  ])
54
- ], 10, _hoisted_1$E);
54
+ ], 10, _hoisted_1$F);
55
55
  };
56
56
  }
57
57
  });
@@ -62,8 +62,9 @@ const _export_sfc = (sfc, props) => {
62
62
  }
63
63
  return target;
64
64
  };
65
- const TaoButton = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["__scopeId", "data-v-5a0fd489"]]);
66
- const _sfc_main$M = /* @__PURE__ */ defineComponent({
65
+ const TaoButton = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["__scopeId", "data-v-5a0fd489"]]);
66
+ const _sfc_main$N = /* @__PURE__ */ defineComponent({
67
+ ...{ name: "TaoBlock" },
67
68
  __name: "TaoBlock",
68
69
  props: {
69
70
  padding: { default: 16 },
@@ -94,24 +95,24 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
94
95
  };
95
96
  }
96
97
  });
97
- const TaoBlock = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["__scopeId", "data-v-4d014dd0"]]);
98
+ const TaoBlock = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["__scopeId", "data-v-feb87e36"]]);
98
99
  const formFieldKey = Symbol("taoFormField");
99
- const _hoisted_1$D = { class: "tao-input-wrapper" };
100
- const _hoisted_2$y = ["for"];
101
- const _hoisted_3$q = {
100
+ const _hoisted_1$E = { class: "tao-input-wrapper" };
101
+ const _hoisted_2$z = ["for"];
102
+ const _hoisted_3$t = {
102
103
  key: 0,
103
104
  class: "tao-input__affix tao-input__affix--prefix"
104
105
  };
105
- const _hoisted_4$k = ["id", "type", "value", "placeholder", "disabled", "aria-invalid", "aria-describedby"];
106
- const _hoisted_5$c = {
106
+ const _hoisted_4$n = ["id", "type", "value", "placeholder", "disabled", "aria-invalid", "aria-describedby"];
107
+ const _hoisted_5$f = {
107
108
  key: 1,
108
109
  class: "tao-input__affix tao-input__affix--suffix"
109
110
  };
110
- const _hoisted_6$9 = {
111
+ const _hoisted_6$b = {
111
112
  key: 1,
112
113
  class: "tao-input__error"
113
114
  };
114
- const _sfc_main$L = /* @__PURE__ */ defineComponent({
115
+ const _sfc_main$M = /* @__PURE__ */ defineComponent({
115
116
  ...{ name: "TaoInput" },
116
117
  __name: "TaoInput",
117
118
  props: {
@@ -147,12 +148,12 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
147
148
  emit("focus", event);
148
149
  }
149
150
  return (_ctx, _cache) => {
150
- return openBlock(), createElementBlock("div", _hoisted_1$D, [
151
- __props.label ? (openBlock(), createElementBlock("label", {
151
+ return openBlock(), createElementBlock("div", _hoisted_1$E, [
152
+ __props.label && !unref(field) ? (openBlock(), createElementBlock("label", {
152
153
  key: 0,
153
154
  class: "tao-input__label",
154
155
  for: controlId.value
155
- }, toDisplayString(__props.label), 9, _hoisted_2$y)) : createCommentVNode("", true),
156
+ }, toDisplayString(__props.label), 9, _hoisted_2$z)) : createCommentVNode("", true),
156
157
  createElementVNode("div", {
157
158
  class: normalizeClass(["tao-input-shell", {
158
159
  "tao-input-shell--focused": focused.value,
@@ -162,7 +163,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
162
163
  "tao-input-shell--suffix": _ctx.$slots.suffix
163
164
  }])
164
165
  }, [
165
- _ctx.$slots.prefix ? (openBlock(), createElementBlock("span", _hoisted_3$q, [
166
+ _ctx.$slots.prefix ? (openBlock(), createElementBlock("span", _hoisted_3$t, [
166
167
  renderSlot(_ctx.$slots, "prefix", {}, void 0, true)
167
168
  ])) : createCommentVNode("", true),
168
169
  createElementVNode("input", {
@@ -177,27 +178,27 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
177
178
  onInput: handleInput,
178
179
  onBlur: handleBlur,
179
180
  onFocus: handleFocus
180
- }, null, 42, _hoisted_4$k),
181
- _ctx.$slots.suffix ? (openBlock(), createElementBlock("span", _hoisted_5$c, [
181
+ }, null, 42, _hoisted_4$n),
182
+ _ctx.$slots.suffix ? (openBlock(), createElementBlock("span", _hoisted_5$f, [
182
183
  renderSlot(_ctx.$slots, "suffix", {}, void 0, true)
183
184
  ])) : createCommentVNode("", true)
184
185
  ], 2),
185
- __props.error && __props.errorMessage ? (openBlock(), createElementBlock("span", _hoisted_6$9, toDisplayString(__props.errorMessage), 1)) : createCommentVNode("", true)
186
+ __props.error && __props.errorMessage ? (openBlock(), createElementBlock("span", _hoisted_6$b, toDisplayString(__props.errorMessage), 1)) : createCommentVNode("", true)
186
187
  ]);
187
188
  };
188
189
  }
189
190
  });
190
- const TaoInput = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["__scopeId", "data-v-49211edd"]]);
191
- const _hoisted_1$C = {
191
+ const TaoInput = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["__scopeId", "data-v-b522e041"]]);
192
+ const _hoisted_1$D = {
192
193
  key: 0,
193
194
  class: "tao-input-group__addon tao-input-group__addon--before"
194
195
  };
195
- const _hoisted_2$x = { class: "tao-input-group__field" };
196
- const _hoisted_3$p = {
196
+ const _hoisted_2$y = { class: "tao-input-group__field" };
197
+ const _hoisted_3$s = {
197
198
  key: 1,
198
199
  class: "tao-input-group__addon tao-input-group__addon--after"
199
200
  };
200
- const _sfc_main$K = /* @__PURE__ */ defineComponent({
201
+ const _sfc_main$L = /* @__PURE__ */ defineComponent({
201
202
  ...{ name: "TaoInputGroup" },
202
203
  __name: "TaoInputGroup",
203
204
  setup(__props) {
@@ -219,28 +220,28 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
219
220
  onFocusin: onFocusIn,
220
221
  onFocusout: onFocusOut
221
222
  }, [
222
- _ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_1$C, [
223
+ _ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_1$D, [
223
224
  renderSlot(_ctx.$slots, "before", {}, void 0, true)
224
225
  ])) : createCommentVNode("", true),
225
- createElementVNode("div", _hoisted_2$x, [
226
+ createElementVNode("div", _hoisted_2$y, [
226
227
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
227
228
  ]),
228
- _ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_3$p, [
229
+ _ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_3$s, [
229
230
  renderSlot(_ctx.$slots, "after", {}, void 0, true)
230
231
  ])) : createCommentVNode("", true)
231
232
  ], 34);
232
233
  };
233
234
  }
234
235
  });
235
- const TaoInputGroup = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["__scopeId", "data-v-f06bb3b1"]]);
236
- const _hoisted_1$B = ["id", "value", "placeholder", "disabled", "aria-invalid", "aria-describedby", "aria-valuenow", "aria-valuemin", "aria-valuemax"];
237
- const _hoisted_2$w = {
236
+ const TaoInputGroup = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["__scopeId", "data-v-f06bb3b1"]]);
237
+ const _hoisted_1$C = ["id", "value", "placeholder", "disabled", "aria-invalid", "aria-describedby", "aria-valuenow", "aria-valuemin", "aria-valuemax"];
238
+ const _hoisted_2$x = {
238
239
  key: 0,
239
240
  class: "tao-input-number__steppers"
240
241
  };
241
- const _hoisted_3$o = ["disabled"];
242
- const _hoisted_4$j = ["disabled"];
243
- const _sfc_main$J = /* @__PURE__ */ defineComponent({
242
+ const _hoisted_3$r = ["disabled"];
243
+ const _hoisted_4$m = ["disabled"];
244
+ const _sfc_main$K = /* @__PURE__ */ defineComponent({
244
245
  ...{ name: "TaoInputNumber" },
245
246
  __name: "TaoInputNumber",
246
247
  props: {
@@ -389,8 +390,8 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
389
390
  onFocus,
390
391
  onBlur,
391
392
  onKeydown
392
- }, null, 40, _hoisted_1$B),
393
- __props.controls ? (openBlock(), createElementBlock("div", _hoisted_2$w, [
393
+ }, null, 40, _hoisted_1$C),
394
+ __props.controls ? (openBlock(), createElementBlock("div", _hoisted_2$x, [
394
395
  createElementVNode("button", {
395
396
  type: "button",
396
397
  class: "tao-input-number__step",
@@ -398,7 +399,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
398
399
  tabindex: "-1",
399
400
  disabled: __props.disabled || atMax.value,
400
401
  onClick: _cache[0] || (_cache[0] = ($event) => bump(1))
401
- }, " + ", 8, _hoisted_3$o),
402
+ }, " + ", 8, _hoisted_3$r),
402
403
  createElementVNode("button", {
403
404
  type: "button",
404
405
  class: "tao-input-number__step",
@@ -406,17 +407,17 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
406
407
  tabindex: "-1",
407
408
  disabled: __props.disabled || atMin.value,
408
409
  onClick: _cache[1] || (_cache[1] = ($event) => bump(-1))
409
- }, " − ", 8, _hoisted_4$j)
410
+ }, " − ", 8, _hoisted_4$m)
410
411
  ])) : createCommentVNode("", true)
411
412
  ], 2);
412
413
  };
413
414
  }
414
415
  });
415
- const TaoInputNumber = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__scopeId", "data-v-55b65a4d"]]);
416
- const _hoisted_1$A = ["aria-label", "disabled"];
417
- const _hoisted_2$v = ["id", "value", "disabled", "aria-invalid", "aria-describedby", "aria-valuenow", "aria-valuemin", "aria-valuemax"];
418
- const _hoisted_3$n = ["disabled"];
419
- const _sfc_main$I = /* @__PURE__ */ defineComponent({
416
+ const TaoInputNumber = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["__scopeId", "data-v-55b65a4d"]]);
417
+ const _hoisted_1$B = ["aria-label", "disabled"];
418
+ const _hoisted_2$w = ["id", "value", "disabled", "aria-invalid", "aria-describedby", "aria-valuenow", "aria-valuemin", "aria-valuemax"];
419
+ const _hoisted_3$q = ["disabled"];
420
+ const _sfc_main$J = /* @__PURE__ */ defineComponent({
420
421
  ...{ name: "TaoQuantity" },
421
422
  __name: "TaoQuantity",
422
423
  props: {
@@ -549,7 +550,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
549
550
  "aria-label": minusLabel.value,
550
551
  disabled: minusDisabled.value,
551
552
  onClick: onDec
552
- }, " − ", 8, _hoisted_1$A),
553
+ }, " − ", 8, _hoisted_1$B),
553
554
  createElementVNode("input", {
554
555
  id: controlId.value,
555
556
  class: "tao-quantity__input",
@@ -569,37 +570,37 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
569
570
  onFocus,
570
571
  onBlur,
571
572
  onKeydown
572
- }, null, 40, _hoisted_2$v),
573
+ }, null, 40, _hoisted_2$w),
573
574
  createElementVNode("button", {
574
575
  type: "button",
575
576
  class: "tao-quantity__btn tao-quantity__btn--inc",
576
577
  "aria-label": "Увеличить",
577
578
  disabled: plusDisabled.value,
578
579
  onClick: onInc
579
- }, " + ", 8, _hoisted_3$n)
580
+ }, " + ", 8, _hoisted_3$q)
580
581
  ], 2);
581
582
  };
582
583
  }
583
584
  });
584
- const TaoQuantity = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__scopeId", "data-v-df6baf04"]]);
585
- const _hoisted_1$z = {
585
+ const TaoQuantity = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__scopeId", "data-v-df6baf04"]]);
586
+ const _hoisted_1$A = {
586
587
  key: 0,
587
588
  class: "tao-card__cover"
588
589
  };
589
- const _hoisted_2$u = {
590
+ const _hoisted_2$v = {
590
591
  key: 0,
591
592
  class: "tao-card__header-title"
592
593
  };
593
- const _hoisted_3$m = { key: 0 };
594
- const _hoisted_4$i = {
594
+ const _hoisted_3$p = { key: 0 };
595
+ const _hoisted_4$l = {
595
596
  key: 2,
596
597
  class: "tao-card__title-block"
597
598
  };
598
- const _hoisted_5$b = {
599
+ const _hoisted_5$e = {
599
600
  key: 0,
600
601
  class: "tao-card__title"
601
602
  };
602
- const _hoisted_6$8 = {
603
+ const _hoisted_6$a = {
603
604
  key: 1,
604
605
  class: "tao-card__sub"
605
606
  };
@@ -611,7 +612,8 @@ const _hoisted_8$6 = {
611
612
  key: 4,
612
613
  class: "tao-card__footer"
613
614
  };
614
- const _sfc_main$H = /* @__PURE__ */ defineComponent({
615
+ const _sfc_main$I = /* @__PURE__ */ defineComponent({
616
+ ...{ name: "TaoCard" },
615
617
  __name: "TaoCard",
616
618
  props: {
617
619
  padding: { default: 20 },
@@ -642,14 +644,14 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
642
644
  }]),
643
645
  style: normalizeStyle(radiusStyle.value)
644
646
  }, [
645
- _ctx.$slots.cover ? (openBlock(), createElementBlock("div", _hoisted_1$z, [
647
+ _ctx.$slots.cover ? (openBlock(), createElementBlock("div", _hoisted_1$A, [
646
648
  renderSlot(_ctx.$slots, "cover", {}, void 0, true)
647
649
  ])) : createCommentVNode("", true),
648
650
  createElementVNode("div", {
649
651
  class: "tao-card__content",
650
652
  style: normalizeStyle(paddingStyle.value)
651
653
  }, [
652
- _ctx.$slots.headerTitle ? (openBlock(), createElementBlock("h2", _hoisted_2$u, [
654
+ _ctx.$slots.headerTitle ? (openBlock(), createElementBlock("h2", _hoisted_2$v, [
653
655
  renderSlot(_ctx.$slots, "headerTitle", {}, void 0, true)
654
656
  ])) : createCommentVNode("", true),
655
657
  _ctx.$slots.header || _ctx.$slots.headerSecondary ? (openBlock(), createElementBlock("div", {
@@ -659,15 +661,15 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
659
661
  createElementVNode("span", null, [
660
662
  renderSlot(_ctx.$slots, "header", {}, void 0, true)
661
663
  ]),
662
- _ctx.$slots.headerSecondary ? (openBlock(), createElementBlock("span", _hoisted_3$m, [
664
+ _ctx.$slots.headerSecondary ? (openBlock(), createElementBlock("span", _hoisted_3$p, [
663
665
  renderSlot(_ctx.$slots, "headerSecondary", {}, void 0, true)
664
666
  ])) : createCommentVNode("", true)
665
667
  ], 2)) : createCommentVNode("", true),
666
- _ctx.$slots.title || _ctx.$slots.sub ? (openBlock(), createElementBlock("div", _hoisted_4$i, [
667
- _ctx.$slots.title ? (openBlock(), createElementBlock("h2", _hoisted_5$b, [
668
+ _ctx.$slots.title || _ctx.$slots.sub ? (openBlock(), createElementBlock("div", _hoisted_4$l, [
669
+ _ctx.$slots.title ? (openBlock(), createElementBlock("h2", _hoisted_5$e, [
668
670
  renderSlot(_ctx.$slots, "title", {}, void 0, true)
669
671
  ])) : createCommentVNode("", true),
670
- _ctx.$slots.sub ? (openBlock(), createElementBlock("div", _hoisted_6$8, [
672
+ _ctx.$slots.sub ? (openBlock(), createElementBlock("div", _hoisted_6$a, [
671
673
  renderSlot(_ctx.$slots, "sub", {}, void 0, true)
672
674
  ])) : createCommentVNode("", true)
673
675
  ])) : createCommentVNode("", true),
@@ -682,7 +684,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
682
684
  };
683
685
  }
684
686
  });
685
- const TaoCard = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__scopeId", "data-v-b752c7cb"]]);
687
+ const TaoCard = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__scopeId", "data-v-2ff3d055"]]);
686
688
  const FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
687
689
  function getFocusable(root) {
688
690
  return [...root.querySelectorAll(FOCUSABLE)].filter(
@@ -711,18 +713,19 @@ function trapTab(event, root) {
711
713
  first.focus();
712
714
  }
713
715
  }
714
- const _hoisted_1$y = ["aria-labelledby"];
715
- const _hoisted_2$t = {
716
+ const _hoisted_1$z = ["aria-labelledby"];
717
+ const _hoisted_2$u = {
716
718
  key: 0,
717
719
  class: "tao-modal__header"
718
720
  };
719
- const _hoisted_3$l = ["id"];
720
- const _hoisted_4$h = { class: "tao-modal__content" };
721
- const _hoisted_5$a = {
721
+ const _hoisted_3$o = ["id"];
722
+ const _hoisted_4$k = { key: 1 };
723
+ const _hoisted_5$d = { class: "tao-modal__content" };
724
+ const _hoisted_6$9 = {
722
725
  key: 1,
723
726
  class: "tao-modal__footer"
724
727
  };
725
- const _sfc_main$G = /* @__PURE__ */ defineComponent({
728
+ const _sfc_main$H = /* @__PURE__ */ defineComponent({
726
729
  ...{ name: "TaoModal" },
727
730
  __name: "TaoModal",
728
731
  props: {
@@ -822,12 +825,13 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
822
825
  "aria-labelledby": __props.title ? unref(titleId) : void 0,
823
826
  tabindex: "-1"
824
827
  }, [
825
- __props.title || _ctx.$slots.header ? (openBlock(), createElementBlock("div", _hoisted_2$t, [
828
+ __props.title || _ctx.$slots.header || __props.closable ? (openBlock(), createElementBlock("div", _hoisted_2$u, [
826
829
  renderSlot(_ctx.$slots, "header", {}, () => [
827
- createElementVNode("h2", {
830
+ __props.title ? (openBlock(), createElementBlock("h2", {
831
+ key: 0,
828
832
  id: unref(titleId),
829
833
  class: "tao-modal__title"
830
- }, toDisplayString(__props.title), 9, _hoisted_3$l)
834
+ }, toDisplayString(__props.title), 9, _hoisted_3$o)) : (openBlock(), createElementBlock("span", _hoisted_4$k))
831
835
  ], true),
832
836
  __props.closable ? (openBlock(), createElementBlock("button", {
833
837
  key: 0,
@@ -837,13 +841,13 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
837
841
  onClick: close
838
842
  }, " × ")) : createCommentVNode("", true)
839
843
  ])) : createCommentVNode("", true),
840
- createElementVNode("div", _hoisted_4$h, [
844
+ createElementVNode("div", _hoisted_5$d, [
841
845
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
842
846
  ]),
843
- _ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_5$a, [
847
+ _ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_6$9, [
844
848
  renderSlot(_ctx.$slots, "footer", {}, void 0, true)
845
849
  ])) : createCommentVNode("", true)
846
- ], 8, _hoisted_1$y)
850
+ ], 8, _hoisted_1$z)
847
851
  ], 32)) : createCommentVNode("", true)
848
852
  ]),
849
853
  _: 3
@@ -852,11 +856,11 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
852
856
  };
853
857
  }
854
858
  });
855
- const TaoModal = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-399d4fdf"]]);
856
- const _hoisted_1$x = { class: "tao-tabs" };
857
- const _hoisted_2$s = ["id", "aria-selected", "aria-controls", "tabindex", "disabled", "onClick"];
858
- const _hoisted_3$k = ["id", "aria-labelledby"];
859
- const _sfc_main$F = /* @__PURE__ */ defineComponent({
859
+ const TaoModal = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__scopeId", "data-v-0cffe849"]]);
860
+ const _hoisted_1$y = { class: "tao-tabs" };
861
+ const _hoisted_2$t = ["id", "aria-selected", "aria-controls", "tabindex", "disabled", "onClick"];
862
+ const _hoisted_3$n = ["id", "aria-labelledby"];
863
+ const _sfc_main$G = /* @__PURE__ */ defineComponent({
860
864
  ...{ name: "TaoTabs" },
861
865
  __name: "TaoTabs",
862
866
  props: {
@@ -920,7 +924,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
920
924
  }
921
925
  }
922
926
  return (_ctx, _cache) => {
923
- return openBlock(), createElementBlock("div", _hoisted_1$x, [
927
+ return openBlock(), createElementBlock("div", _hoisted_1$y, [
924
928
  createElementVNode("div", {
925
929
  class: "tao-tabs__list",
926
930
  role: "tablist",
@@ -945,7 +949,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
945
949
  }, void 0, true, 0) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
946
950
  createTextVNode(toDisplayString(tab.label), 1)
947
951
  ], 64))
948
- ], 8, _hoisted_2$s);
952
+ ], 8, _hoisted_2$t);
949
953
  }), 128))
950
954
  ], 32),
951
955
  createElementVNode("div", {
@@ -955,13 +959,14 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
955
959
  "aria-labelledby": tabId(__props.modelValue)
956
960
  }, [
957
961
  renderSlot(_ctx.$slots, "default", { activeTab: __props.modelValue }, void 0, true)
958
- ], 8, _hoisted_3$k)
962
+ ], 8, _hoisted_3$n)
959
963
  ]);
960
964
  };
961
965
  }
962
966
  });
963
- const TaoTabs = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__scopeId", "data-v-bf16735e"]]);
964
- const _sfc_main$E = /* @__PURE__ */ defineComponent({
967
+ const TaoTabs = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-bf16735e"]]);
968
+ const _sfc_main$F = /* @__PURE__ */ defineComponent({
969
+ ...{ name: "TaoTooltip" },
965
970
  __name: "TaoTooltip",
966
971
  props: {
967
972
  content: {},
@@ -992,28 +997,37 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
992
997
  };
993
998
  }
994
999
  });
995
- const TaoTooltip = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__scopeId", "data-v-0f7a5b9b"]]);
996
- const _hoisted_1$w = { class: "tao-spoiler" };
997
- const _hoisted_2$r = {
1000
+ const TaoTooltip = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__scopeId", "data-v-6f3b3c11"]]);
1001
+ const _hoisted_1$x = { class: "tao-spoiler" };
1002
+ const _hoisted_2$s = ["aria-expanded", "aria-controls"];
1003
+ const _hoisted_3$m = {
998
1004
  key: 0,
999
1005
  class: "tao-spoiler__title"
1000
1006
  };
1001
- const _hoisted_3$j = {
1002
- key: 0,
1003
- class: "tao-spoiler__content"
1004
- };
1005
- const _hoisted_4$g = { class: "tao-spoiler__content-inner" };
1006
- const _sfc_main$D = /* @__PURE__ */ defineComponent({
1007
+ const _hoisted_4$j = ["id"];
1008
+ const _hoisted_5$c = { class: "tao-spoiler__content-inner" };
1009
+ const _sfc_main$E = /* @__PURE__ */ defineComponent({
1010
+ ...{ name: "TaoSpoiler" },
1007
1011
  __name: "TaoSpoiler",
1008
1012
  props: {
1009
1013
  title: { default: "" },
1010
- defaultOpen: { type: Boolean, default: false }
1014
+ defaultOpen: { type: Boolean, default: false },
1015
+ modelValue: { type: Boolean, default: void 0 }
1011
1016
  },
1012
- setup(__props) {
1017
+ emits: ["update:modelValue"],
1018
+ setup(__props, { emit: __emit }) {
1013
1019
  const props = __props;
1014
- const isOpen = ref(props.defaultOpen);
1020
+ const emit = __emit;
1021
+ const panelId = useId();
1022
+ const internal = ref(props.defaultOpen);
1023
+ const isControlled = computed(() => props.modelValue !== void 0);
1024
+ const isOpen = computed(() => isControlled.value ? Boolean(props.modelValue) : internal.value);
1015
1025
  function toggle() {
1016
- isOpen.value = !isOpen.value;
1026
+ const next = !isOpen.value;
1027
+ if (!isControlled.value) {
1028
+ internal.value = next;
1029
+ }
1030
+ emit("update:modelValue", next);
1017
1031
  }
1018
1032
  function onBeforeEnter(el) {
1019
1033
  el.style.height = "0";
@@ -1035,20 +1049,23 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
1035
1049
  });
1036
1050
  }
1037
1051
  return (_ctx, _cache) => {
1038
- return openBlock(), createElementBlock("div", _hoisted_1$w, [
1052
+ return openBlock(), createElementBlock("div", _hoisted_1$x, [
1039
1053
  createElementVNode("button", {
1054
+ type: "button",
1040
1055
  class: "tao-spoiler__header",
1056
+ "aria-expanded": isOpen.value,
1057
+ "aria-controls": unref(panelId),
1041
1058
  onClick: toggle
1042
1059
  }, [
1043
1060
  createElementVNode("span", {
1044
1061
  class: normalizeClass(["tao-spoiler__icon", { "tao-spoiler__icon--open": isOpen.value }])
1045
1062
  }, "▶", 2),
1046
- __props.title || _ctx.$slots.title ? (openBlock(), createElementBlock("span", _hoisted_2$r, [
1063
+ __props.title || _ctx.$slots.title ? (openBlock(), createElementBlock("span", _hoisted_3$m, [
1047
1064
  renderSlot(_ctx.$slots, "title", {}, () => [
1048
1065
  createTextVNode(toDisplayString(__props.title), 1)
1049
1066
  ], true)
1050
1067
  ])) : createCommentVNode("", true)
1051
- ]),
1068
+ ], 8, _hoisted_2$s),
1052
1069
  createVNode(Transition, {
1053
1070
  name: "tao-spoiler-slide",
1054
1071
  onBeforeEnter,
@@ -1057,11 +1074,15 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
1057
1074
  onLeave
1058
1075
  }, {
1059
1076
  default: withCtx(() => [
1060
- isOpen.value ? (openBlock(), createElementBlock("div", _hoisted_3$j, [
1061
- createElementVNode("div", _hoisted_4$g, [
1077
+ isOpen.value ? (openBlock(), createElementBlock("div", {
1078
+ key: 0,
1079
+ id: unref(panelId),
1080
+ class: "tao-spoiler__content"
1081
+ }, [
1082
+ createElementVNode("div", _hoisted_5$c, [
1062
1083
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
1063
1084
  ])
1064
- ])) : createCommentVNode("", true)
1085
+ ], 8, _hoisted_4$j)) : createCommentVNode("", true)
1065
1086
  ]),
1066
1087
  _: 3
1067
1088
  })
@@ -1069,9 +1090,10 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
1069
1090
  };
1070
1091
  }
1071
1092
  });
1072
- const TaoSpoiler = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-061480fb"]]);
1073
- const _hoisted_1$v = { class: "tao-copy" };
1074
- const _sfc_main$C = /* @__PURE__ */ defineComponent({
1093
+ const TaoSpoiler = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__scopeId", "data-v-c9f4d962"]]);
1094
+ const _hoisted_1$w = { class: "tao-copy" };
1095
+ const _sfc_main$D = /* @__PURE__ */ defineComponent({
1096
+ ...{ name: "TaoCopy" },
1075
1097
  __name: "TaoCopy",
1076
1098
  props: {
1077
1099
  text: {},
@@ -1094,12 +1116,13 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
1094
1116
  }
1095
1117
  }
1096
1118
  return (_ctx, _cache) => {
1097
- return openBlock(), createElementBlock("div", _hoisted_1$v, [
1119
+ return openBlock(), createElementBlock("div", _hoisted_1$w, [
1098
1120
  renderSlot(_ctx.$slots, "default", {
1099
1121
  copy,
1100
1122
  copied: copied.value
1101
1123
  }, () => [
1102
1124
  createElementVNode("button", {
1125
+ type: "button",
1103
1126
  class: normalizeClass(["tao-copy__button", { "tao-copy__button--copied": copied.value }]),
1104
1127
  onClick: copy
1105
1128
  }, toDisplayString(copied.value ? __props.successMessage : "Копировать"), 3)
@@ -1108,8 +1131,9 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
1108
1131
  };
1109
1132
  }
1110
1133
  });
1111
- const TaoCopy = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-810f1bc7"]]);
1112
- const _sfc_main$B = /* @__PURE__ */ defineComponent({
1134
+ const TaoCopy = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-73a42ad9"]]);
1135
+ const _sfc_main$C = /* @__PURE__ */ defineComponent({
1136
+ ...{ name: "TaoContainer" },
1113
1137
  __name: "TaoContainer",
1114
1138
  props: {
1115
1139
  size: { default: "wide" },
@@ -1125,8 +1149,9 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
1125
1149
  };
1126
1150
  }
1127
1151
  });
1128
- const TaoContainer = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__scopeId", "data-v-81987648"]]);
1129
- const _sfc_main$A = /* @__PURE__ */ defineComponent({
1152
+ const TaoContainer = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-4c0deb90"]]);
1153
+ const _sfc_main$B = /* @__PURE__ */ defineComponent({
1154
+ ...{ name: "TaoFlex" },
1130
1155
  __name: "TaoFlex",
1131
1156
  props: {
1132
1157
  tag: { default: "div" },
@@ -1156,7 +1181,8 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
1156
1181
  };
1157
1182
  }
1158
1183
  });
1159
- const _sfc_main$z = /* @__PURE__ */ defineComponent({
1184
+ const _sfc_main$A = /* @__PURE__ */ defineComponent({
1185
+ ...{ name: "TaoSpace" },
1160
1186
  __name: "TaoSpace",
1161
1187
  props: {
1162
1188
  block: { type: Boolean, default: false },
@@ -1175,9 +1201,10 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
1175
1201
  };
1176
1202
  }
1177
1203
  });
1178
- const TaoSpace = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-4190f6ba"]]);
1179
- const _hoisted_1$u = { class: "tao-icon" };
1180
- const _sfc_main$y = /* @__PURE__ */ defineComponent({
1204
+ const TaoSpace = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["__scopeId", "data-v-698ca712"]]);
1205
+ const _hoisted_1$v = { class: "tao-icon" };
1206
+ const _sfc_main$z = /* @__PURE__ */ defineComponent({
1207
+ ...{ name: "TaoIcon" },
1181
1208
  __name: "TaoIcon",
1182
1209
  props: {
1183
1210
  name: {},
@@ -1187,11 +1214,11 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
1187
1214
  },
1188
1215
  setup(__props) {
1189
1216
  useCssVars((_ctx) => ({
1190
- "v2b130076": props.margin
1217
+ "a2e86200": props.margin
1191
1218
  }));
1192
1219
  const props = __props;
1193
1220
  return (_ctx, _cache) => {
1194
- return openBlock(), createElementBlock("span", _hoisted_1$u, [
1221
+ return openBlock(), createElementBlock("span", _hoisted_1$v, [
1195
1222
  renderSlot(_ctx.$slots, "prefix", {}, void 0, true),
1196
1223
  createElementVNode("i", {
1197
1224
  class: normalizeClass(["tao-icon__value", [`icon-${props.name}`, { "tao-icon__value--invert": props.invert }]]),
@@ -1202,8 +1229,9 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
1202
1229
  };
1203
1230
  }
1204
1231
  });
1205
- const TaoIcon = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__scopeId", "data-v-b561364f"]]);
1206
- const _sfc_main$x = /* @__PURE__ */ defineComponent({
1232
+ const TaoIcon = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-145b2cfc"]]);
1233
+ const _sfc_main$y = /* @__PURE__ */ defineComponent({
1234
+ ...{ name: "TaoLoader" },
1207
1235
  __name: "TaoLoader",
1208
1236
  props: {
1209
1237
  color: { default: "var(--tao-color-accent)" },
@@ -1212,10 +1240,10 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
1212
1240
  },
1213
1241
  setup(__props) {
1214
1242
  useCssVars((_ctx) => ({
1215
- "v052ed61b": positions.value.first,
1216
- "v05f388d2": positions.value.third,
1217
- "bdfc57e2": positions.value.fourth,
1218
- "v50ec8284": positions.value.animationDistance
1243
+ "d349d504": positions.value.first,
1244
+ "d1c06f96": positions.value.third,
1245
+ "v355d810c": positions.value.fourth,
1246
+ "v09447532": positions.value.animationDistance
1219
1247
  }));
1220
1248
  const props = __props;
1221
1249
  const normalizedSize = computed(() => {
@@ -1263,10 +1291,11 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
1263
1291
  };
1264
1292
  }
1265
1293
  });
1266
- const TaoLoader = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__scopeId", "data-v-3a29f095"]]);
1267
- const _hoisted_1$t = { class: "tao-image" };
1268
- const _hoisted_2$q = ["src", "alt"];
1269
- const _sfc_main$w = /* @__PURE__ */ defineComponent({
1294
+ const TaoLoader = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__scopeId", "data-v-75a40018"]]);
1295
+ const _hoisted_1$u = { class: "tao-image" };
1296
+ const _hoisted_2$r = ["src", "alt"];
1297
+ const _sfc_main$x = /* @__PURE__ */ defineComponent({
1298
+ ...{ name: "TaoImage" },
1270
1299
  __name: "TaoImage",
1271
1300
  props: {
1272
1301
  src: { default: "" },
@@ -1290,7 +1319,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
1290
1319
  isLoaded.value = false;
1291
1320
  });
1292
1321
  return (_ctx, _cache) => {
1293
- return openBlock(), createElementBlock("div", _hoisted_1$t, [
1322
+ return openBlock(), createElementBlock("div", _hoisted_1$u, [
1294
1323
  __props.src ? (openBlock(), createElementBlock("img", {
1295
1324
  key: 0,
1296
1325
  class: normalizeClass({ "tao-image__img--hidden": !isLoaded.value, "tao-image__img--pixelated": props.pixelated }),
@@ -1299,47 +1328,54 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
1299
1328
  draggable: "false",
1300
1329
  onLoad: handleLoad,
1301
1330
  onError: handleError
1302
- }, null, 42, _hoisted_2$q)) : renderSlot(_ctx.$slots, "default", {}, () => [
1331
+ }, null, 42, _hoisted_2$r)) : renderSlot(_ctx.$slots, "default", {}, () => [
1303
1332
  _cache[0] || (_cache[0] = createElementVNode("div", { class: "tao-image__placeholder" }, "No image available", -1))
1304
1333
  ], true, 1)
1305
1334
  ]);
1306
1335
  };
1307
1336
  }
1308
1337
  });
1309
- const TaoImage = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__scopeId", "data-v-8272e203"]]);
1310
- const _hoisted_1$s = ["checked", "disabled"];
1311
- const _hoisted_2$p = {
1338
+ const TaoImage = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__scopeId", "data-v-9da4bb7d"]]);
1339
+ const _hoisted_1$t = ["for"];
1340
+ const _hoisted_2$q = ["id", "checked", "disabled", "aria-checked", "aria-invalid", "aria-describedby"];
1341
+ const _hoisted_3$l = {
1312
1342
  key: 0,
1313
1343
  class: "tao-checkbox__label"
1314
1344
  };
1315
- const _hoisted_3$i = {
1345
+ const _hoisted_4$i = {
1316
1346
  key: 1,
1317
1347
  class: "tao-checkbox__label"
1318
1348
  };
1319
- const _sfc_main$v = /* @__PURE__ */ defineComponent({
1349
+ const _sfc_main$w = /* @__PURE__ */ defineComponent({
1350
+ ...{ name: "TaoCheckbox" },
1320
1351
  __name: "TaoCheckbox",
1321
1352
  props: {
1322
1353
  value: { type: Boolean, default: void 0 },
1323
1354
  modelValue: { type: Boolean, default: void 0 },
1324
1355
  label: { default: "" },
1325
- disabled: { type: Boolean, default: false }
1356
+ disabled: { type: Boolean, default: false },
1357
+ error: { type: Boolean, default: false },
1358
+ indeterminate: { type: Boolean, default: false }
1326
1359
  },
1327
1360
  emits: ["update:modelValue", "change"],
1328
1361
  setup(__props, { emit: __emit }) {
1329
1362
  const props = __props;
1330
1363
  const emit = __emit;
1364
+ const field = inject(formFieldKey, null);
1365
+ const localId = useId();
1366
+ const controlId = computed(() => (field == null ? void 0 : field.id) ?? localId);
1367
+ const invalid = computed(() => props.error || Boolean(field == null ? void 0 : field.invalid.value));
1368
+ const describedBy = computed(() => field == null ? void 0 : field.describedBy.value);
1331
1369
  const isChecked = computed({
1332
1370
  get: () => {
1333
1371
  if (props.modelValue !== void 0) {
1334
1372
  return props.modelValue;
1335
1373
  }
1336
- return props.value;
1374
+ return Boolean(props.value);
1337
1375
  },
1338
- set: (value) => {
1339
- if (props.modelValue !== void 0) {
1340
- emit("update:modelValue", value);
1341
- }
1342
- emit("change", value);
1376
+ set: (next) => {
1377
+ emit("update:modelValue", next);
1378
+ emit("change", next);
1343
1379
  }
1344
1380
  });
1345
1381
  function onInputChange(event) {
@@ -1349,33 +1385,50 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
1349
1385
  const target = event.target;
1350
1386
  isChecked.value = target.checked;
1351
1387
  }
1388
+ const inputRef = ref(null);
1389
+ watch(
1390
+ [inputRef, isChecked, () => props.indeterminate],
1391
+ () => {
1392
+ const el = inputRef.value;
1393
+ if (!el) {
1394
+ return;
1395
+ }
1396
+ el.checked = isChecked.value;
1397
+ el.indeterminate = Boolean(props.indeterminate);
1398
+ },
1399
+ { flush: "post" }
1400
+ );
1352
1401
  return (_ctx, _cache) => {
1353
1402
  return openBlock(), createElementBlock("label", {
1354
- class: normalizeClass(["tao-checkbox", { "tao-checkbox--disabled": props.disabled }])
1403
+ class: normalizeClass(["tao-checkbox", { "tao-checkbox--disabled": __props.disabled }]),
1404
+ for: controlId.value
1355
1405
  }, [
1356
- renderSlot(_ctx.$slots, "pre", {
1357
- text: props.label
1358
- }, void 0, true),
1406
+ renderSlot(_ctx.$slots, "pre", { text: __props.label }, void 0, true),
1359
1407
  createElementVNode("input", {
1408
+ id: controlId.value,
1409
+ ref_key: "inputRef",
1410
+ ref: inputRef,
1360
1411
  class: "tao-checkbox__input tao-sr-only",
1361
1412
  type: "checkbox",
1362
1413
  checked: isChecked.value,
1363
- disabled: props.disabled,
1414
+ disabled: __props.disabled,
1415
+ "aria-checked": __props.indeterminate ? "mixed" : void 0,
1416
+ "aria-invalid": invalid.value || void 0,
1417
+ "aria-describedby": describedBy.value,
1364
1418
  onChange: onInputChange
1365
- }, null, 40, _hoisted_1$s),
1419
+ }, null, 40, _hoisted_2$q),
1366
1420
  _cache[0] || (_cache[0] = createElementVNode("span", { class: "tao-checkbox__box" }, null, -1)),
1367
- props.label ? (openBlock(), createElementBlock("span", _hoisted_2$p, toDisplayString(props.label), 1)) : (openBlock(), createElementBlock("span", _hoisted_3$i, [
1421
+ __props.label ? (openBlock(), createElementBlock("span", _hoisted_3$l, toDisplayString(__props.label), 1)) : (openBlock(), createElementBlock("span", _hoisted_4$i, [
1368
1422
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
1369
1423
  ])),
1370
- renderSlot(_ctx.$slots, "post", {
1371
- text: props.label
1372
- }, void 0, true)
1373
- ], 2);
1424
+ renderSlot(_ctx.$slots, "post", { text: __props.label }, void 0, true)
1425
+ ], 10, _hoisted_1$t);
1374
1426
  };
1375
1427
  }
1376
1428
  });
1377
- const TaoCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__scopeId", "data-v-0bb22ce9"]]);
1378
- const _sfc_main$u = /* @__PURE__ */ defineComponent({
1429
+ const TaoCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__scopeId", "data-v-f6b0e565"]]);
1430
+ const _sfc_main$v = /* @__PURE__ */ defineComponent({
1431
+ ...{ name: "TaoTag" },
1379
1432
  __name: "TaoTag",
1380
1433
  props: {
1381
1434
  type: { default: "" },
@@ -1386,6 +1439,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
1386
1439
  },
1387
1440
  setup(__props) {
1388
1441
  const props = __props;
1442
+ const tone = computed(() => props.type === "error" ? "danger" : props.type);
1389
1443
  const style = computed(() => ({
1390
1444
  color: props.color || "",
1391
1445
  background: props.background || "",
@@ -1393,7 +1447,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
1393
1447
  }));
1394
1448
  return (_ctx, _cache) => {
1395
1449
  return openBlock(), createElementBlock("div", {
1396
- class: normalizeClass(["tao-tag", [props.pointer && "tao-tag--pointer", props.type ? `tao-tag--${props.type}` : ""]]),
1450
+ class: normalizeClass(["tao-tag", [props.pointer && "tao-tag--pointer", tone.value ? `tao-tag--${tone.value}` : ""]]),
1397
1451
  style: normalizeStyle(style.value)
1398
1452
  }, [
1399
1453
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
@@ -1401,39 +1455,43 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
1401
1455
  };
1402
1456
  }
1403
1457
  });
1404
- const TaoTag = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-3f6b9f30"]]);
1405
- const _hoisted_1$r = {
1458
+ const TaoTag = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__scopeId", "data-v-290c0f6a"]]);
1459
+ const _hoisted_1$s = {
1406
1460
  key: 1,
1407
1461
  class: "tao-divider-text"
1408
1462
  };
1409
- const _hoisted_2$o = { class: "tao-divider-text__value" };
1410
- const _hoisted_3$h = {
1463
+ const _hoisted_2$p = { class: "tao-divider-text__value" };
1464
+ const _hoisted_3$k = {
1411
1465
  key: 2,
1412
1466
  class: "tao-divider-line"
1413
1467
  };
1414
- const _sfc_main$t = /* @__PURE__ */ defineComponent({
1468
+ const _sfc_main$u = /* @__PURE__ */ defineComponent({
1469
+ ...{ name: "TaoDivider" },
1415
1470
  __name: "TaoDivider",
1416
1471
  props: {
1417
1472
  variant: { default: "line" },
1418
1473
  size: { default: "medium" }
1419
1474
  },
1420
1475
  setup(__props) {
1476
+ const props = __props;
1477
+ const gapSize = computed(() => props.size === "big" ? "large" : props.size);
1421
1478
  return (_ctx, _cache) => {
1422
1479
  return __props.variant === "gap" ? (openBlock(), createElementBlock("div", {
1423
1480
  key: 0,
1424
- class: normalizeClass(["tao-divider-gap", `tao-divider-gap--${__props.size}`])
1425
- }, null, 2)) : __props.variant === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$r, [
1481
+ class: normalizeClass(["tao-divider-gap", `tao-divider-gap--${gapSize.value}`])
1482
+ }, null, 2)) : __props.variant === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$s, [
1426
1483
  _cache[0] || (_cache[0] = createElementVNode("span", { class: "tao-divider-text__line tao-divider-text__line--left" }, null, -1)),
1427
- createElementVNode("span", _hoisted_2$o, [
1484
+ createElementVNode("span", _hoisted_2$p, [
1428
1485
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
1429
1486
  ]),
1430
1487
  _cache[1] || (_cache[1] = createElementVNode("span", { class: "tao-divider-text__line tao-divider-text__line--right" }, null, -1))
1431
- ])) : (openBlock(), createElementBlock("div", _hoisted_3$h));
1488
+ ])) : (openBlock(), createElementBlock("div", _hoisted_3$k));
1432
1489
  };
1433
1490
  }
1434
1491
  });
1435
- const TaoDivider = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__scopeId", "data-v-9db02640"]]);
1436
- const _sfc_main$s = /* @__PURE__ */ defineComponent({
1492
+ const TaoDivider = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-8187a15d"]]);
1493
+ const _sfc_main$t = /* @__PURE__ */ defineComponent({
1494
+ ...{ name: "TaoAnimatedBorder" },
1437
1495
  __name: "TaoAnimatedBorder",
1438
1496
  props: {
1439
1497
  borderWidth: { default: 3 },
@@ -1456,13 +1514,19 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
1456
1514
  };
1457
1515
  }
1458
1516
  });
1459
- const TaoAnimatedBorder = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__scopeId", "data-v-4ca22c09"]]);
1460
- const _hoisted_1$q = {
1517
+ const TaoAnimatedBorder = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__scopeId", "data-v-f1534571"]]);
1518
+ const _hoisted_1$r = {
1461
1519
  key: 0,
1462
1520
  class: "tao-textarea tao-textarea--dummy"
1463
1521
  };
1464
- const _hoisted_2$n = ["placeholder", "spellcheck", "autocomplete", "minlength", "maxlength", "disabled", "rows", "value"];
1465
- const _sfc_main$r = /* @__PURE__ */ defineComponent({
1522
+ const _hoisted_2$o = {
1523
+ key: 1,
1524
+ class: "tao-textarea-wrap"
1525
+ };
1526
+ const _hoisted_3$j = ["id", "placeholder", "spellcheck", "autocomplete", "minlength", "maxlength", "disabled", "rows", "value", "aria-invalid", "aria-describedby"];
1527
+ const _hoisted_4$h = ["id"];
1528
+ const _sfc_main$s = /* @__PURE__ */ defineComponent({
1529
+ ...{ name: "TaoTextarea" },
1466
1530
  __name: "TaoTextarea",
1467
1531
  props: {
1468
1532
  placeholder: { default: "" },
@@ -1481,12 +1545,34 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1481
1545
  autoFocus: { type: Boolean, default: false },
1482
1546
  borderInverse: { type: Boolean, default: false },
1483
1547
  textCenter: { type: Boolean, default: false },
1484
- submitOnEnter: { type: Boolean, default: false }
1548
+ submitOnEnter: { type: Boolean, default: false },
1549
+ error: { type: Boolean, default: false },
1550
+ id: {},
1551
+ count: { type: Boolean, default: false }
1485
1552
  },
1486
1553
  emits: ["update:modelValue", "change", "focus", "blur", "keydown"],
1487
1554
  setup(__props, { emit: __emit }) {
1488
1555
  const props = __props;
1489
1556
  const emit = __emit;
1557
+ const field = inject(formFieldKey, null);
1558
+ const localId = useId();
1559
+ const controlId = computed(() => props.id || (field == null ? void 0 : field.id) || localId);
1560
+ const invalid = computed(() => props.error || Boolean(field == null ? void 0 : field.invalid.value));
1561
+ const counterId = computed(() => `${controlId.value}-count`);
1562
+ const describedBy = computed(() => {
1563
+ const ids = [field == null ? void 0 : field.describedBy.value, props.count ? counterId.value : void 0].filter(Boolean);
1564
+ return ids.length ? ids.join(" ") : void 0;
1565
+ });
1566
+ const currentLength = computed(() => String(props.modelValue ?? "").length);
1567
+ const countLabel = computed(() => {
1568
+ if (props.maxlength != null && props.maxlength > 0) {
1569
+ return `${currentLength.value} / ${props.maxlength}`;
1570
+ }
1571
+ return String(currentLength.value);
1572
+ });
1573
+ const atLimit = computed(
1574
+ () => props.maxlength != null && props.maxlength > 0 && currentLength.value >= props.maxlength
1575
+ );
1490
1576
  const textareaRef = ref(null);
1491
1577
  function onInput(e) {
1492
1578
  const target = e.target;
@@ -1522,9 +1608,12 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1522
1608
  textarea.style.height = "auto";
1523
1609
  textarea.style.height = `${Math.min(textarea.scrollHeight, 500)}px`;
1524
1610
  }
1525
- watch(() => props.modelValue, () => {
1526
- nextTick(autoResize);
1527
- });
1611
+ watch(
1612
+ () => props.modelValue,
1613
+ () => {
1614
+ nextTick(autoResize);
1615
+ }
1616
+ );
1528
1617
  onMounted(() => {
1529
1618
  var _a;
1530
1619
  if (props.autoFocus) {
@@ -1533,40 +1622,51 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1533
1622
  nextTick(autoResize);
1534
1623
  });
1535
1624
  return (_ctx, _cache) => {
1536
- return props.dummy ? (openBlock(), createElementBlock("span", _hoisted_1$q, toDisplayString(props.modelValue), 1)) : (openBlock(), createElementBlock("textarea", {
1537
- key: 1,
1538
- ref_key: "textareaRef",
1539
- ref: textareaRef,
1540
- class: normalizeClass(["tao-textarea", {
1541
- "tao-textarea--inverse": props.borderInverse,
1542
- "tao-textarea--center": props.textCenter,
1543
- "tao-textarea--no-border": props.noBorder,
1544
- "tao-textarea--no-background": props.noBackground,
1545
- "tao-textarea--no-resize": !props.resize
1546
- }]),
1547
- placeholder: props.placeholder,
1548
- spellcheck: props.spellcheck,
1549
- autocomplete: props.autocomplete,
1550
- minlength: props.minlength,
1551
- maxlength: props.maxlength,
1552
- disabled: props.disabled,
1553
- rows: props.rows,
1554
- value: props.modelValue,
1555
- draggable: "false",
1556
- onInput,
1557
- onChange,
1558
- onFocus,
1559
- onBlur,
1560
- onKeydown
1561
- }, null, 42, _hoisted_2$n));
1625
+ return __props.dummy ? (openBlock(), createElementBlock("span", _hoisted_1$r, toDisplayString(__props.modelValue), 1)) : (openBlock(), createElementBlock("div", _hoisted_2$o, [
1626
+ createElementVNode("textarea", {
1627
+ id: controlId.value,
1628
+ ref_key: "textareaRef",
1629
+ ref: textareaRef,
1630
+ class: normalizeClass(["tao-textarea", {
1631
+ "tao-textarea--inverse": __props.borderInverse,
1632
+ "tao-textarea--center": __props.textCenter,
1633
+ "tao-textarea--no-border": __props.noBorder,
1634
+ "tao-textarea--no-background": __props.noBackground,
1635
+ "tao-textarea--no-resize": !__props.resize,
1636
+ "tao-textarea--invalid": invalid.value
1637
+ }]),
1638
+ placeholder: __props.placeholder,
1639
+ spellcheck: __props.spellcheck,
1640
+ autocomplete: __props.autocomplete,
1641
+ minlength: __props.minlength,
1642
+ maxlength: __props.maxlength,
1643
+ disabled: __props.disabled,
1644
+ rows: __props.rows,
1645
+ value: __props.modelValue,
1646
+ "aria-invalid": invalid.value || void 0,
1647
+ "aria-describedby": describedBy.value,
1648
+ draggable: "false",
1649
+ onInput,
1650
+ onChange,
1651
+ onFocus,
1652
+ onBlur,
1653
+ onKeydown
1654
+ }, null, 42, _hoisted_3$j),
1655
+ __props.count ? (openBlock(), createElementBlock("span", {
1656
+ key: 0,
1657
+ id: counterId.value,
1658
+ class: normalizeClass(["tao-textarea__count", { "tao-textarea__count--limit": atLimit.value }])
1659
+ }, toDisplayString(countLabel.value), 11, _hoisted_4$h)) : createCommentVNode("", true)
1660
+ ]));
1562
1661
  };
1563
1662
  }
1564
1663
  });
1565
- const TaoTextarea = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-a56ad167"]]);
1566
- const _hoisted_1$p = ["tabindex"];
1567
- const _hoisted_2$m = { class: "tao-scroll-top__content" };
1664
+ const TaoTextarea = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__scopeId", "data-v-2534c0c4"]]);
1665
+ const _hoisted_1$q = ["tabindex"];
1666
+ const _hoisted_2$n = { class: "tao-scroll-top__content" };
1568
1667
  const RIPPLE_DURATION = 750;
1569
- const _sfc_main$q = /* @__PURE__ */ defineComponent({
1668
+ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1669
+ ...{ name: "TaoScrollTop" },
1570
1670
  __name: "TaoScrollTop",
1571
1671
  props: {
1572
1672
  size: { default: 40 },
@@ -1658,13 +1758,14 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
1658
1758
  default: withCtx(() => [
1659
1759
  isActive.value ? (openBlock(), createElementBlock("button", {
1660
1760
  key: 0,
1761
+ type: "button",
1661
1762
  style: normalizeStyle(mainStyle),
1662
1763
  tabindex: props.tabindex,
1663
1764
  class: normalizeClass(["tao-scroll-top", { "tao-scroll-top--no-outline": !props.hasOutline }]),
1664
- "aria-label": "Scroll to top",
1765
+ "aria-label": "Наверх",
1665
1766
  onClick: withModifiers(onClick, ["prevent"])
1666
1767
  }, [
1667
- createElementVNode("div", _hoisted_2$m, [
1768
+ createElementVNode("div", _hoisted_2$n, [
1668
1769
  createElementVNode("div", {
1669
1770
  class: normalizeClass([{ "tao-scroll-top__ripple--active": isRippleActive.value }, "tao-scroll-top__ripple"]),
1670
1771
  style: normalizeStyle(rippleStyle)
@@ -1681,69 +1782,101 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
1681
1782
  ], -1))
1682
1783
  ], true)
1683
1784
  ])
1684
- ], 14, _hoisted_1$p)) : createCommentVNode("", true)
1785
+ ], 14, _hoisted_1$q)) : createCommentVNode("", true)
1685
1786
  ]),
1686
1787
  _: 3
1687
1788
  });
1688
1789
  };
1689
1790
  }
1690
1791
  });
1691
- const TaoScrollTop = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scopeId", "data-v-a6b96e61"]]);
1692
- const _hoisted_1$o = { class: "tao-progress" };
1693
- const _hoisted_2$l = {
1792
+ const TaoScrollTop = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-ce902f42"]]);
1793
+ const _hoisted_1$p = { class: "tao-progress" };
1794
+ const _hoisted_2$m = {
1694
1795
  key: 0,
1695
1796
  class: "tao-progress__side"
1696
1797
  };
1697
- const _hoisted_3$g = { class: "tao-progress__side" };
1698
- const _hoisted_4$f = {
1798
+ const _hoisted_3$i = { class: "tao-progress__main" };
1799
+ const _hoisted_4$g = {
1699
1800
  key: 0,
1700
1801
  class: "tao-progress__percentage"
1701
1802
  };
1702
- const _sfc_main$p = /* @__PURE__ */ defineComponent({
1803
+ const _hoisted_5$b = {
1804
+ key: 1,
1805
+ class: "tao-progress__side"
1806
+ };
1807
+ const _hoisted_6$8 = {
1808
+ key: 0,
1809
+ class: "tao-progress__percentage"
1810
+ };
1811
+ const _sfc_main$q = /* @__PURE__ */ defineComponent({
1812
+ ...{ name: "TaoProgress" },
1703
1813
  __name: "TaoProgress",
1704
1814
  props: {
1705
- min: { default: 200 },
1706
- max: { default: 400 },
1815
+ minWidth: { default: void 0 },
1816
+ maxWidth: { default: void 0 },
1817
+ min: { default: void 0 },
1818
+ max: { default: void 0 },
1707
1819
  progress: { default: 0 },
1708
1820
  height: { default: 8 },
1709
- showPercentage: { type: Boolean, default: false },
1821
+ showPercentage: { type: [Boolean, String], default: true },
1710
1822
  animated: { type: Boolean, default: true }
1711
1823
  },
1712
1824
  setup(__props) {
1825
+ const props = __props;
1826
+ const slots = useSlots();
1827
+ const minW = computed(() => props.minWidth ?? props.min ?? 200);
1828
+ const maxW = computed(() => props.maxWidth ?? props.max ?? 400);
1829
+ const hasRight = computed(() => Boolean(slots.right));
1830
+ const percentPlace = computed(() => {
1831
+ if (!props.showPercentage) {
1832
+ return null;
1833
+ }
1834
+ return props.showPercentage === "right" ? "right" : "top";
1835
+ });
1836
+ const showOverPercent = computed(() => percentPlace.value === "top");
1837
+ const showEndPercent = computed(() => percentPlace.value === "right");
1838
+ const endPercentLabel = computed(
1839
+ () => hasRight.value ? `(${props.progress}%)` : `${props.progress}%`
1840
+ );
1713
1841
  return (_ctx, _cache) => {
1714
- return openBlock(), createElementBlock("div", _hoisted_1$o, [
1842
+ return openBlock(), createElementBlock("div", _hoisted_1$p, [
1715
1843
  createElementVNode("div", {
1716
- class: "tao-progress__container",
1717
- style: normalizeStyle({ minWidth: `${__props.min}px`, maxWidth: `${__props.max}px` })
1844
+ class: normalizeClass(["tao-progress__container", { "tao-progress__container--over": showOverPercent.value }]),
1845
+ style: normalizeStyle({ minWidth: `${minW.value}px`, maxWidth: `${maxW.value}px` })
1718
1846
  }, [
1719
- _ctx.$slots.left ? (openBlock(), createElementBlock("div", _hoisted_2$l, [
1847
+ _ctx.$slots.left ? (openBlock(), createElementBlock("div", _hoisted_2$m, [
1720
1848
  renderSlot(_ctx.$slots, "left", {}, void 0, true)
1721
1849
  ])) : createCommentVNode("", true),
1722
- createElementVNode("div", {
1723
- class: "tao-progress__track",
1724
- style: normalizeStyle({ height: `${__props.height}px` })
1725
- }, [
1850
+ createElementVNode("div", _hoisted_3$i, [
1851
+ showOverPercent.value ? (openBlock(), createElementBlock("span", _hoisted_4$g, toDisplayString(__props.progress) + "%", 1)) : createCommentVNode("", true),
1726
1852
  createElementVNode("div", {
1727
- class: normalizeClass(["tao-progress__fill", { "tao-progress__fill--animated": __props.animated }]),
1728
- style: normalizeStyle({ width: `${__props.progress}%` })
1729
- }, null, 6)
1730
- ], 4),
1731
- createElementVNode("div", _hoisted_3$g, [
1732
- __props.showPercentage ? (openBlock(), createElementBlock("span", _hoisted_4$f, toDisplayString(__props.progress) + "%", 1)) : createCommentVNode("", true),
1733
- renderSlot(_ctx.$slots, "right", {}, void 0, true)
1734
- ])
1735
- ], 4)
1853
+ class: "tao-progress__track",
1854
+ style: normalizeStyle({ height: `${__props.height}px` })
1855
+ }, [
1856
+ createElementVNode("div", {
1857
+ class: normalizeClass(["tao-progress__fill", { "tao-progress__fill--animated": __props.animated }]),
1858
+ style: normalizeStyle({ width: `${__props.progress}%` })
1859
+ }, null, 6)
1860
+ ], 4)
1861
+ ]),
1862
+ _ctx.$slots.right || showEndPercent.value ? (openBlock(), createElementBlock("div", _hoisted_5$b, [
1863
+ renderSlot(_ctx.$slots, "right", {}, void 0, true),
1864
+ showEndPercent.value ? (openBlock(), createElementBlock("span", _hoisted_6$8, toDisplayString(endPercentLabel.value), 1)) : createCommentVNode("", true)
1865
+ ])) : createCommentVNode("", true)
1866
+ ], 6)
1736
1867
  ]);
1737
1868
  };
1738
1869
  }
1739
1870
  });
1740
- const TaoProgress = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-3780642d"]]);
1741
- const _hoisted_1$n = ["placeholder"];
1742
- const _hoisted_2$k = {
1871
+ const TaoProgress = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scopeId", "data-v-54c13718"]]);
1872
+ const _hoisted_1$o = ["id", "tabindex", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-disabled", "aria-describedby"];
1873
+ const _hoisted_2$l = ["placeholder"];
1874
+ const _hoisted_3$h = {
1743
1875
  key: 1,
1744
1876
  class: "tao-slider__value"
1745
1877
  };
1746
- const _sfc_main$o = /* @__PURE__ */ defineComponent({
1878
+ const _sfc_main$p = /* @__PURE__ */ defineComponent({
1879
+ ...{ name: "TaoSlider" },
1747
1880
  __name: "TaoSlider",
1748
1881
  props: {
1749
1882
  min: { default: 0 },
@@ -1751,18 +1884,25 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
1751
1884
  step: { default: 1 },
1752
1885
  showValue: { type: Boolean, default: false },
1753
1886
  placeholder: { default: "" },
1754
- modelValue: {}
1887
+ modelValue: {},
1888
+ disabled: { type: Boolean, default: false }
1755
1889
  },
1756
1890
  emits: ["update:modelValue"],
1757
1891
  setup(__props, { emit: __emit }) {
1758
1892
  const props = __props;
1759
1893
  const emit = __emit;
1894
+ const field = inject(formFieldKey, null);
1895
+ const localId = useId();
1896
+ const controlId = computed(() => (field == null ? void 0 : field.id) ?? localId);
1897
+ const describedBy = computed(() => field == null ? void 0 : field.describedBy.value);
1760
1898
  function packModelValue(value) {
1761
1899
  return typeof props.modelValue === "string" ? `${value}` : value;
1762
1900
  }
1763
1901
  function unpackModelValue() {
1764
- return typeof props.modelValue === "string" ? parseFloat(props.modelValue) : props.modelValue;
1902
+ const raw = typeof props.modelValue === "string" ? parseFloat(props.modelValue) : props.modelValue;
1903
+ return Number.isFinite(raw) ? raw : props.min;
1765
1904
  }
1905
+ const current = computed(() => unpackModelValue());
1766
1906
  const trackRef = ref(null);
1767
1907
  const isDragging = ref(false);
1768
1908
  const shadowInputRef = ref(null);
@@ -1770,11 +1910,17 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
1770
1910
  const showShadowModel = ref(false);
1771
1911
  const progressPercent = computed(() => {
1772
1912
  const range = props.max - props.min;
1773
- return (unpackModelValue() - props.min) / range * 100;
1913
+ if (range <= 0) {
1914
+ return 0;
1915
+ }
1916
+ return (current.value - props.min) / range * 100;
1774
1917
  });
1775
1918
  function clampValue(v) {
1776
1919
  return Math.min(Math.max(v, props.min), props.max);
1777
1920
  }
1921
+ function commit(value) {
1922
+ emit("update:modelValue", packModelValue(clampValue(value)));
1923
+ }
1778
1924
  function calculateValue(event) {
1779
1925
  if (!trackRef.value) {
1780
1926
  return props.min;
@@ -1782,12 +1928,15 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
1782
1928
  const rect = trackRef.value.getBoundingClientRect();
1783
1929
  const clientX = "touches" in event ? event.touches[0].clientX : event.clientX;
1784
1930
  const x = Math.min(Math.max(clientX - rect.left, 0), rect.width);
1785
- const ratio = x / rect.width;
1786
- const v = Math.round(props.min + ratio * (props.max - props.min));
1931
+ const ratio = rect.width ? x / rect.width : 0;
1932
+ const v = props.min + ratio * (props.max - props.min);
1787
1933
  return clampValue(Math.round((v - props.min) / props.step) * props.step + props.min);
1788
1934
  }
1789
1935
  function handleMove(event) {
1790
- emit("update:modelValue", packModelValue(calculateValue(event)));
1936
+ if (props.disabled) {
1937
+ return;
1938
+ }
1939
+ commit(calculateValue(event));
1791
1940
  }
1792
1941
  function onMouseUp(event) {
1793
1942
  const evBtn = "touches" in event ? void 0 : event.button;
@@ -1797,6 +1946,9 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
1797
1946
  isDragging.value = false;
1798
1947
  }
1799
1948
  function onMouseDown(event) {
1949
+ if (props.disabled) {
1950
+ return;
1951
+ }
1800
1952
  const evBtn = "touches" in event ? void 0 : event.button;
1801
1953
  if (typeof evBtn !== "undefined" && evBtn !== 0 || showShadowModel.value) {
1802
1954
  return;
@@ -1811,6 +1963,33 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
1811
1963
  }
1812
1964
  handleMove(event);
1813
1965
  }
1966
+ function onKeydown(event) {
1967
+ if (props.disabled || showShadowModel.value) {
1968
+ return;
1969
+ }
1970
+ const keys = {
1971
+ ArrowLeft: -props.step,
1972
+ ArrowDown: -props.step,
1973
+ ArrowRight: props.step,
1974
+ ArrowUp: props.step,
1975
+ PageDown: -props.step * 10,
1976
+ PageUp: props.step * 10
1977
+ };
1978
+ if (event.key in keys) {
1979
+ event.preventDefault();
1980
+ commit(current.value + keys[event.key]);
1981
+ return;
1982
+ }
1983
+ if (event.key === "Home") {
1984
+ event.preventDefault();
1985
+ commit(props.min);
1986
+ return;
1987
+ }
1988
+ if (event.key === "End") {
1989
+ event.preventDefault();
1990
+ commit(props.max);
1991
+ }
1992
+ }
1814
1993
  function onBlurShadowModel() {
1815
1994
  if (shadowModel.value) {
1816
1995
  const newValue = packModelValue(clampValue(parseFloat(shadowModel.value) || 0));
@@ -1826,14 +2005,15 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
1826
2005
  }
1827
2006
  }
1828
2007
  function onContextMenu() {
1829
- if (props.showValue) {
1830
- shadowModel.value = `${props.modelValue}`;
1831
- showShadowModel.value = true;
1832
- requestAnimationFrame(() => {
1833
- var _a;
1834
- return (_a = shadowInputRef.value) == null ? void 0 : _a.focus();
1835
- });
2008
+ if (props.disabled || !props.showValue) {
2009
+ return;
1836
2010
  }
2011
+ shadowModel.value = `${props.modelValue}`;
2012
+ showShadowModel.value = true;
2013
+ requestAnimationFrame(() => {
2014
+ var _a;
2015
+ return (_a = shadowInputRef.value) == null ? void 0 : _a.focus();
2016
+ });
1837
2017
  }
1838
2018
  onMounted(() => {
1839
2019
  window.addEventListener("mouseleave", onMouseUp);
@@ -1851,12 +2031,21 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
1851
2031
  });
1852
2032
  return (_ctx, _cache) => {
1853
2033
  return openBlock(), createElementBlock("div", {
2034
+ id: controlId.value,
1854
2035
  ref_key: "trackRef",
1855
2036
  ref: trackRef,
1856
- class: normalizeClass(["tao-slider", { "tao-slider--show-value": __props.showValue }]),
2037
+ class: normalizeClass(["tao-slider", { "tao-slider--show-value": __props.showValue, "tao-slider--disabled": __props.disabled }]),
2038
+ role: "slider",
2039
+ tabindex: __props.disabled ? -1 : 0,
2040
+ "aria-valuemin": __props.min,
2041
+ "aria-valuemax": __props.max,
2042
+ "aria-valuenow": current.value,
2043
+ "aria-disabled": __props.disabled || void 0,
2044
+ "aria-describedby": describedBy.value,
1857
2045
  onContextmenu: withModifiers(onContextMenu, ["prevent"]),
1858
2046
  onMousedown: onMouseDown,
1859
- onTouchstart: onMouseDown
2047
+ onTouchstart: onMouseDown,
2048
+ onKeydown
1860
2049
  }, [
1861
2050
  _cache[2] || (_cache[2] = createElementVNode("div", { class: "tao-slider__track" }, null, -1)),
1862
2051
  createElementVNode("div", {
@@ -1880,21 +2069,22 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
1880
2069
  onKeydown: onShadowKeydown,
1881
2070
  onMousedown: _cache[1] || (_cache[1] = withModifiers(() => {
1882
2071
  }, ["stop"]))
1883
- }, null, 40, _hoisted_1$n)), [
2072
+ }, null, 40, _hoisted_2$l)), [
1884
2073
  [vModelText, shadowModel.value]
1885
- ]) : __props.showValue ? (openBlock(), createElementBlock("div", _hoisted_2$k, [
2074
+ ]) : __props.showValue ? (openBlock(), createElementBlock("div", _hoisted_3$h, [
1886
2075
  renderSlot(_ctx.$slots, "pre-value", {}, void 0, true),
1887
2076
  createTextVNode(toDisplayString(__props.modelValue), 1),
1888
2077
  renderSlot(_ctx.$slots, "post-value", {}, void 0, true)
1889
2078
  ])) : createCommentVNode("", true)
1890
- ], 34);
2079
+ ], 42, _hoisted_1$o);
1891
2080
  };
1892
2081
  }
1893
2082
  });
1894
- const TaoSlider = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-9f531a81"]]);
1895
- const _hoisted_1$m = { class: "tao-file-drop" };
1896
- const _hoisted_2$j = ["accept", "multiple"];
1897
- const _sfc_main$n = /* @__PURE__ */ defineComponent({
2083
+ const TaoSlider = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-241d1042"]]);
2084
+ const _hoisted_1$n = { class: "tao-file-drop" };
2085
+ const _hoisted_2$k = ["accept", "multiple"];
2086
+ const _sfc_main$o = /* @__PURE__ */ defineComponent({
2087
+ ...{ name: "TaoFileDrop" },
1898
2088
  __name: "TaoFileDrop",
1899
2089
  props: {
1900
2090
  modelValue: { default: () => [] },
@@ -1934,10 +2124,6 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
1934
2124
  function requestClear() {
1935
2125
  emit("clear-request");
1936
2126
  }
1937
- function triggerFileInput() {
1938
- var _a;
1939
- (_a = fileInput.value) == null ? void 0 : _a.click();
1940
- }
1941
2127
  function processFiles(fileList) {
1942
2128
  const files = Array.from(fileList);
1943
2129
  const result = !props.multiple && files.length > 1 ? [files[0]] : files;
@@ -1950,46 +2136,48 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
1950
2136
  }
1951
2137
  }
1952
2138
  return (_ctx, _cache) => {
1953
- return openBlock(), createElementBlock("div", _hoisted_1$m, [
2139
+ return openBlock(), createElementBlock("div", _hoisted_1$n, [
1954
2140
  __props.showClear && __props.modelValue.length ? (openBlock(), createElementBlock("button", {
1955
2141
  key: 0,
1956
2142
  type: "button",
1957
2143
  class: "tao-file-drop__clear",
2144
+ "aria-label": "Очистить файлы",
1958
2145
  onClick: requestClear
1959
2146
  }, " ✕ ")) : createCommentVNode("", true),
1960
- createElementVNode("div", {
2147
+ createElementVNode("label", {
1961
2148
  class: normalizeClass(["tao-file-drop__zone", [`tao-file-drop__zone--${__props.size}`, { "tao-file-drop__zone--dragging": isDragging.value }]]),
1962
2149
  onDragover: handleDragOver,
1963
2150
  onDragleave: handleDragLeave,
1964
- onDrop: handleDrop,
1965
- onClick: triggerFileInput
2151
+ onDrop: handleDrop
1966
2152
  }, [
1967
2153
  renderSlot(_ctx.$slots, "default", {}, () => [
1968
- _cache[0] || (_cache[0] = createTextVNode("Перетащите файл сюда или нажмите, чтобы выбрать", -1))
2154
+ _cache[1] || (_cache[1] = createTextVNode("Перетащите файл сюда или нажмите, чтобы выбрать", -1))
1969
2155
  ], true),
1970
2156
  createElementVNode("input", {
1971
2157
  ref_key: "fileInput",
1972
2158
  ref: fileInput,
2159
+ class: "tao-sr-only",
1973
2160
  type: "file",
1974
- hidden: "",
1975
2161
  accept: __props.accept,
1976
2162
  multiple: __props.multiple,
1977
- onChange: handleFileSelect
1978
- }, null, 40, _hoisted_2$j)
2163
+ onChange: handleFileSelect,
2164
+ onClick: _cache[0] || (_cache[0] = withModifiers(() => {
2165
+ }, ["stop"]))
2166
+ }, null, 40, _hoisted_2$k)
1979
2167
  ], 34)
1980
2168
  ]);
1981
2169
  };
1982
2170
  }
1983
2171
  });
1984
- const TaoFileDrop = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-547ed4de"]]);
1985
- const _hoisted_1$l = ["aria-expanded"];
1986
- const _hoisted_2$i = {
2172
+ const TaoFileDrop = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-3543419a"]]);
2173
+ const _hoisted_1$m = ["aria-expanded"];
2174
+ const _hoisted_2$j = {
1987
2175
  key: 1,
1988
2176
  "aria-label": "Меню"
1989
2177
  };
1990
- const _hoisted_3$f = ["onClick", "onMouseenter"];
1991
- const _hoisted_4$e = { key: 1 };
1992
- const _sfc_main$m = /* @__PURE__ */ defineComponent({
2178
+ const _hoisted_3$g = ["onClick", "onMouseenter"];
2179
+ const _hoisted_4$f = { key: 1 };
2180
+ const _sfc_main$n = /* @__PURE__ */ defineComponent({
1993
2181
  ...{ name: "TaoDropdownMenu" },
1994
2182
  __name: "TaoDropdownMenu",
1995
2183
  props: {
@@ -2124,8 +2312,8 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2124
2312
  "aria-expanded": isOpen.value,
2125
2313
  onClick: toggleMenu
2126
2314
  }, [
2127
- _ctx.$slots.button ? renderSlot(_ctx.$slots, "button", {}, void 0, true, 0) : (openBlock(), createElementBlock("span", _hoisted_2$i, "⋮"))
2128
- ], 8, _hoisted_1$l),
2315
+ _ctx.$slots.button ? renderSlot(_ctx.$slots, "button", {}, void 0, true, 0) : (openBlock(), createElementBlock("span", _hoisted_2$j, "⋮"))
2316
+ ], 8, _hoisted_1$m),
2129
2317
  (openBlock(), createBlock(Teleport, { to: "body" }, [
2130
2318
  isOpen.value ? (openBlock(), createElementBlock("div", {
2131
2319
  key: 0,
@@ -2150,8 +2338,8 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2150
2338
  id: action.id,
2151
2339
  ico: action.ico,
2152
2340
  text: action.name
2153
- }, void 0, true, 0) : (openBlock(), createElementBlock("span", _hoisted_4$e, toDisplayString(action.name), 1))
2154
- ], 42, _hoisted_3$f);
2341
+ }, void 0, true, 0) : (openBlock(), createElementBlock("span", _hoisted_4$f, toDisplayString(action.name), 1))
2342
+ ], 42, _hoisted_3$g);
2155
2343
  }), 128))
2156
2344
  ], 36)) : createCommentVNode("", true)
2157
2345
  ]))
@@ -2159,133 +2347,185 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2159
2347
  };
2160
2348
  }
2161
2349
  });
2162
- const TaoDropdownMenu = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__scopeId", "data-v-3f30c1d7"]]);
2163
- const _hoisted_1$k = { class: "tao-pin-code" };
2164
- const _hoisted_2$h = ["value", "placeholder", "type", "inputmode", "pattern", "onInput", "onKeydown", "onFocus"];
2165
- const _sfc_main$l = /* @__PURE__ */ defineComponent({
2350
+ const TaoDropdownMenu = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-420a7e63"]]);
2351
+ const _hoisted_1$l = ["aria-invalid", "aria-describedby"];
2352
+ const _hoisted_2$i = ["id", "value", "placeholder", "type", "inputmode", "pattern", "onInput", "onKeydown", "onFocus"];
2353
+ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2354
+ ...{ name: "TaoPinCode" },
2166
2355
  __name: "TaoPinCode",
2167
2356
  props: {
2168
2357
  length: {},
2169
2358
  hidden: { type: Boolean, default: false },
2170
2359
  placeholder: { default: "" },
2171
- modelValue: {},
2172
- numbersOnly: { type: Boolean, default: false }
2360
+ modelValue: { default: "" },
2361
+ numbersOnly: { type: Boolean, default: false },
2362
+ clearOn: { default: "focus" }
2173
2363
  },
2174
- emits: ["update:modelValue", "change", "active", "blur"],
2364
+ emits: ["update:modelValue", "change", "complete", "active", "blur"],
2175
2365
  setup(__props, { emit: __emit }) {
2176
2366
  const props = __props;
2177
2367
  const emit = __emit;
2178
- let lastPinCode = NaN;
2368
+ const field = inject(formFieldKey, null);
2369
+ const localId = useId();
2370
+ const controlId = computed(() => (field == null ? void 0 : field.id) ?? localId);
2371
+ const invalid = computed(() => Boolean(field == null ? void 0 : field.invalid.value));
2372
+ const describedBy = computed(() => field == null ? void 0 : field.describedBy.value);
2179
2373
  const numbers = ref([]);
2180
2374
  const inputRefs = ref([]);
2181
2375
  const activeNumber = ref(-1);
2376
+ function acceptChar(ch) {
2377
+ if (!ch) {
2378
+ return "";
2379
+ }
2380
+ if (props.numbersOnly && !/^[0-9]$/.test(ch)) {
2381
+ return "";
2382
+ }
2383
+ return ch;
2384
+ }
2385
+ function cellsFromModel(value) {
2386
+ const raw = value ?? "";
2387
+ return Array.from({ length: props.length }, (_, index) => acceptChar(raw[index] ?? ""));
2388
+ }
2389
+ function serialize() {
2390
+ return numbers.value.join("");
2391
+ }
2182
2392
  function emitChange() {
2183
- const s = numbers.value.map((e) => e ? e : "0").join("");
2184
- const curPinCode = parseFloat(s);
2185
- if (lastPinCode !== curPinCode) {
2186
- lastPinCode = curPinCode;
2187
- emit("change", curPinCode);
2393
+ const next = serialize();
2394
+ if (next !== (props.modelValue ?? "")) {
2395
+ emit("update:modelValue", next);
2396
+ emit("change", next);
2188
2397
  }
2189
- emit("update:modelValue", s);
2190
2398
  }
2191
- function emitBlur() {
2192
- activeNumber.value = -1;
2193
- emit("blur");
2399
+ function firstEmptyIndex() {
2400
+ const index = numbers.value.findIndex((cell) => !cell);
2401
+ return index === -1 ? numbers.value.length : index;
2402
+ }
2403
+ function focusCell(index) {
2404
+ var _a;
2405
+ (_a = inputRefs.value[index]) == null ? void 0 : _a.focus();
2194
2406
  }
2195
- function init() {
2196
- numbers.value = [...Array(props.length)].map(() => "");
2197
- inputRefs.value = [];
2198
- activeNumber.value = -1;
2407
+ function isFilled() {
2408
+ return numbers.value.length === props.length && numbers.value.every((cell) => cell !== "");
2199
2409
  }
2200
2410
  function mutation(v, index) {
2201
- var _a, _b;
2411
+ var _a;
2412
+ const char = v.length > 1 ? v[v.length - 1] ?? "" : v;
2413
+ const next = acceptChar(char);
2414
+ if (props.numbersOnly && char && !next) {
2415
+ return;
2416
+ }
2202
2417
  numbers.value = [...numbers.value];
2203
- if (v.length > 1) {
2204
- v = v[v.length - 1] ?? "";
2418
+ numbers.value[index] = next;
2419
+ emitChange();
2420
+ if (!next) {
2421
+ return;
2205
2422
  }
2206
- if (props.numbersOnly && v && !/^[0-9]$/.test(v)) {
2207
- numbers.value[index] = numbers.value[index] ?? "";
2423
+ if (isFilled()) {
2424
+ (_a = inputRefs.value[index]) == null ? void 0 : _a.blur();
2425
+ emit("complete", serialize());
2208
2426
  return;
2209
2427
  }
2210
- numbers.value[index] = v;
2211
- const getNextIdx = () => {
2212
- if (numbers.value.length >= index + 1) {
2213
- return numbers.value.findIndex((e) => e === "");
2214
- }
2215
- return index + 1;
2216
- };
2217
- const nextIndex = getNextIdx();
2218
- if (nextIndex !== -1 && !numbers.value[nextIndex]) {
2219
- const el = inputRefs.value[nextIndex];
2220
- if (el) {
2221
- el.focus();
2222
- } else {
2223
- (_a = inputRefs.value[index]) == null ? void 0 : _a.blur();
2224
- emitBlur();
2225
- }
2226
- } else {
2227
- (_b = inputRefs.value[index]) == null ? void 0 : _b.blur();
2228
- emitBlur();
2428
+ const nextEmpty = numbers.value.findIndex((cell, cellIndex) => cellIndex > index && !cell);
2429
+ const target = nextEmpty !== -1 ? nextEmpty : index + 1;
2430
+ if (target < props.length) {
2431
+ focusCell(target);
2229
2432
  }
2230
- emitChange();
2231
2433
  }
2232
2434
  function onFocus(index) {
2233
- numbers.value = [...numbers.value];
2234
- numbers.value[index] = "";
2435
+ if (props.clearOn === "input") {
2436
+ const firstEmpty = firstEmptyIndex();
2437
+ if (firstEmpty < props.length && index > firstEmpty) {
2438
+ focusCell(firstEmpty);
2439
+ return;
2440
+ }
2441
+ activeNumber.value = index;
2442
+ emit("active", inputRefs.value[index] ?? null, index);
2443
+ requestAnimationFrame(() => {
2444
+ var _a;
2445
+ return (_a = inputRefs.value[index]) == null ? void 0 : _a.select();
2446
+ });
2447
+ return;
2448
+ }
2449
+ numbers.value = numbers.value.map((cell, cellIndex) => cellIndex >= index ? "" : cell);
2235
2450
  activeNumber.value = index;
2236
2451
  emitChange();
2237
- emit("active", inputRefs.value[index], index);
2452
+ emit("active", inputRefs.value[index] ?? null, index);
2238
2453
  }
2239
2454
  function onChange(e, index) {
2240
- const v = e.target.value;
2241
- mutation(v, index);
2455
+ mutation(e.target.value, index);
2242
2456
  }
2243
2457
  function onKeydown(event, index) {
2244
2458
  if (event.key !== "Backspace") {
2245
2459
  return;
2246
2460
  }
2247
- if (!numbers.value[index] && index > 0) {
2461
+ if (numbers.value[index]) {
2462
+ return;
2463
+ }
2464
+ if (index > 0) {
2248
2465
  event.preventDefault();
2249
2466
  numbers.value = [...numbers.value];
2250
2467
  numbers.value[index - 1] = "";
2251
- const prevEl = inputRefs.value[index - 1];
2252
- prevEl == null ? void 0 : prevEl.focus();
2468
+ focusCell(index - 1);
2253
2469
  activeNumber.value = index - 1;
2254
2470
  emitChange();
2255
2471
  }
2256
2472
  }
2257
- watch(() => props.modelValue, (v) => {
2258
- if (!v.length) {
2259
- init();
2260
- emitChange();
2261
- }
2262
- });
2263
- init();
2473
+ function onBlur() {
2474
+ requestAnimationFrame(() => {
2475
+ const active = document.activeElement;
2476
+ if (!inputRefs.value.includes(active)) {
2477
+ activeNumber.value = -1;
2478
+ emit("blur");
2479
+ }
2480
+ });
2481
+ }
2482
+ watch(
2483
+ () => [props.modelValue, props.length, props.numbersOnly],
2484
+ () => {
2485
+ const next = cellsFromModel(props.modelValue ?? "");
2486
+ if (next.join("") !== numbers.value.join("") || next.length !== numbers.value.length) {
2487
+ numbers.value = next;
2488
+ }
2489
+ },
2490
+ { immediate: true }
2491
+ );
2264
2492
  return (_ctx, _cache) => {
2265
- return openBlock(), createElementBlock("div", _hoisted_1$k, [
2493
+ return openBlock(), createElementBlock("div", {
2494
+ class: "tao-pin-code",
2495
+ role: "group",
2496
+ "aria-invalid": invalid.value || void 0,
2497
+ "aria-describedby": describedBy.value
2498
+ }, [
2266
2499
  (openBlock(true), createElementBlock(Fragment, null, renderList(numbers.value, (num, index) => {
2267
2500
  return openBlock(), createElementBlock("input", {
2501
+ id: index === 0 ? controlId.value : void 0,
2268
2502
  key: index,
2269
2503
  ref_for: true,
2270
2504
  ref: (el) => inputRefs.value[index] = el,
2271
- class: normalizeClass(["tao-pin-code__value", { "tao-pin-code__value--active": activeNumber.value === index }]),
2505
+ class: normalizeClass(["tao-pin-code__value", {
2506
+ "tao-pin-code__value--active": activeNumber.value === index,
2507
+ "tao-pin-code__value--invalid": invalid.value
2508
+ }]),
2272
2509
  value: num,
2273
2510
  placeholder: __props.placeholder,
2274
2511
  type: __props.hidden ? "password" : "text",
2275
2512
  inputmode: __props.numbersOnly ? "numeric" : "text",
2276
2513
  pattern: __props.numbersOnly ? "[0-9]" : void 0,
2514
+ autocomplete: "one-time-code",
2277
2515
  maxlength: "1",
2278
2516
  onInput: ($event) => onChange($event, index),
2279
2517
  onKeydown: ($event) => onKeydown($event, index),
2280
- onFocus: ($event) => onFocus(index)
2281
- }, null, 42, _hoisted_2$h);
2518
+ onFocus: ($event) => onFocus(index),
2519
+ onBlur
2520
+ }, null, 42, _hoisted_2$i);
2282
2521
  }), 128))
2283
- ]);
2522
+ ], 8, _hoisted_1$l);
2284
2523
  };
2285
2524
  }
2286
2525
  });
2287
- const TaoPinCode = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__scopeId", "data-v-b8c7bf2c"]]);
2288
- const _sfc_main$k = /* @__PURE__ */ defineComponent({
2526
+ const TaoPinCode = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__scopeId", "data-v-c3182673"]]);
2527
+ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2528
+ ...{ name: "TaoLink" },
2289
2529
  __name: "TaoLink",
2290
2530
  props: {
2291
2531
  to: { default: void 0 },
@@ -2326,8 +2566,8 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
2326
2566
  };
2327
2567
  }
2328
2568
  });
2329
- const _hoisted_1$j = ["for"];
2330
- const _sfc_main$j = /* @__PURE__ */ defineComponent({
2569
+ const _hoisted_1$k = ["for"];
2570
+ const _sfc_main$k = /* @__PURE__ */ defineComponent({
2331
2571
  ...{ name: "TaoFormField" },
2332
2572
  __name: "TaoFormField",
2333
2573
  props: {
@@ -2363,7 +2603,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
2363
2603
  key: 0,
2364
2604
  class: "tao-form-field__label",
2365
2605
  for: unref(id)
2366
- }, toDisplayString(__props.label), 9, _hoisted_1$j)) : createCommentVNode("", true),
2606
+ }, toDisplayString(__props.label), 9, _hoisted_1$k)) : createCommentVNode("", true),
2367
2607
  renderSlot(_ctx.$slots, "default", {}, void 0, true),
2368
2608
  __props.error ? (openBlock(), createElementBlock("p", {
2369
2609
  key: 1,
@@ -2378,12 +2618,12 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
2378
2618
  };
2379
2619
  }
2380
2620
  });
2381
- const TaoFormField = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-11324f0c"]]);
2382
- const _hoisted_1$i = ["id", "aria-expanded", "aria-invalid", "aria-describedby", "disabled"];
2383
- const _hoisted_2$g = { class: "tao-select__value" };
2384
- const _hoisted_3$e = ["aria-activedescendant"];
2385
- const _hoisted_4$d = ["id", "aria-selected", "aria-disabled", "data-tao-select-index", "onClick", "onMouseenter"];
2386
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
2621
+ const TaoFormField = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-11324f0c"]]);
2622
+ const _hoisted_1$j = ["id", "aria-expanded", "aria-invalid", "aria-describedby", "disabled"];
2623
+ const _hoisted_2$h = { class: "tao-select__value" };
2624
+ const _hoisted_3$f = ["aria-activedescendant"];
2625
+ const _hoisted_4$e = ["id", "aria-selected", "aria-disabled", "data-tao-select-index", "onClick", "onMouseenter"];
2626
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
2387
2627
  ...{ name: "TaoSelect" },
2388
2628
  __name: "TaoSelect",
2389
2629
  props: {
@@ -2393,7 +2633,286 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2393
2633
  disabled: { type: Boolean, default: false },
2394
2634
  error: { type: Boolean, default: false }
2395
2635
  },
2396
- emits: ["update:modelValue", "change"],
2636
+ emits: ["update:modelValue", "change"],
2637
+ setup(__props, { emit: __emit }) {
2638
+ const props = __props;
2639
+ const emit = __emit;
2640
+ const field = inject(formFieldKey, null);
2641
+ const localId = useId();
2642
+ const listId = `${localId}-list`;
2643
+ const controlId = computed(() => (field == null ? void 0 : field.id) ?? localId);
2644
+ const invalid = computed(() => props.error || Boolean(field == null ? void 0 : field.invalid.value));
2645
+ const describedBy = computed(() => field == null ? void 0 : field.describedBy.value);
2646
+ const open = ref(false);
2647
+ const activeIndex = ref(-1);
2648
+ const triggerRef = ref(null);
2649
+ const panelRef = ref(null);
2650
+ const listRef = ref(null);
2651
+ const listStyle = ref({ top: "0px", left: "0px", width: "0px" });
2652
+ const selected = computed(() => props.options.find((option) => option.value === props.modelValue) ?? null);
2653
+ const enabledIndexes = computed(
2654
+ () => props.options.map((option, index) => option.disabled ? -1 : index).filter((index) => index >= 0)
2655
+ );
2656
+ function updatePosition() {
2657
+ const trigger = triggerRef.value;
2658
+ const panel = panelRef.value;
2659
+ if (!trigger || !panel) {
2660
+ return;
2661
+ }
2662
+ const rect = trigger.getBoundingClientRect();
2663
+ const panelHeight = panel.offsetHeight;
2664
+ const gap = 4;
2665
+ const spaceBelow = window.innerHeight - rect.bottom - gap;
2666
+ const openUp = spaceBelow < panelHeight && rect.top > spaceBelow;
2667
+ listStyle.value = {
2668
+ top: `${openUp ? rect.top - panelHeight - gap : rect.bottom + gap}px`,
2669
+ left: `${rect.left}px`,
2670
+ width: `${rect.width}px`
2671
+ };
2672
+ }
2673
+ async function setOpen(next) {
2674
+ var _a;
2675
+ if (props.disabled) {
2676
+ return;
2677
+ }
2678
+ open.value = next;
2679
+ if (!next) {
2680
+ return;
2681
+ }
2682
+ const selectedIndex = props.options.findIndex((option) => option.value === props.modelValue);
2683
+ activeIndex.value = selectedIndex >= 0 ? selectedIndex : enabledIndexes.value[0] ?? -1;
2684
+ await nextTick();
2685
+ updatePosition();
2686
+ (_a = listRef.value) == null ? void 0 : _a.focus();
2687
+ scrollActiveIntoView();
2688
+ }
2689
+ function toggle() {
2690
+ void setOpen(!open.value);
2691
+ }
2692
+ function close() {
2693
+ open.value = false;
2694
+ }
2695
+ function selectOption(option) {
2696
+ var _a;
2697
+ if (option.disabled) {
2698
+ return;
2699
+ }
2700
+ emit("update:modelValue", option.value);
2701
+ emit("change", option.value);
2702
+ close();
2703
+ (_a = triggerRef.value) == null ? void 0 : _a.focus();
2704
+ }
2705
+ function clear() {
2706
+ var _a;
2707
+ emit("update:modelValue", null);
2708
+ emit("change", null);
2709
+ close();
2710
+ (_a = triggerRef.value) == null ? void 0 : _a.focus();
2711
+ }
2712
+ function moveActive(delta) {
2713
+ const enabled = enabledIndexes.value;
2714
+ if (!enabled.length) {
2715
+ return;
2716
+ }
2717
+ const currentPos = enabled.indexOf(activeIndex.value);
2718
+ const nextPos = currentPos < 0 ? 0 : (currentPos + delta + enabled.length) % enabled.length;
2719
+ activeIndex.value = enabled[nextPos];
2720
+ scrollActiveIntoView();
2721
+ }
2722
+ function scrollActiveIntoView() {
2723
+ const list = listRef.value;
2724
+ if (!list || activeIndex.value < 0) {
2725
+ return;
2726
+ }
2727
+ const option = list.querySelector(`[data-tao-select-index="${activeIndex.value}"]`);
2728
+ option == null ? void 0 : option.scrollIntoView({ block: "nearest" });
2729
+ }
2730
+ function onTriggerKeydown(event) {
2731
+ if (props.disabled) {
2732
+ return;
2733
+ }
2734
+ if ((event.key === "Backspace" || event.key === "Delete") && selected.value) {
2735
+ event.preventDefault();
2736
+ clear();
2737
+ return;
2738
+ }
2739
+ if (event.key === "ArrowDown" || event.key === "ArrowUp" || event.key === "Enter" || event.key === " ") {
2740
+ event.preventDefault();
2741
+ void setOpen(true);
2742
+ }
2743
+ }
2744
+ function onListKeydown(event) {
2745
+ var _a;
2746
+ if (event.key === "Escape") {
2747
+ event.preventDefault();
2748
+ close();
2749
+ (_a = triggerRef.value) == null ? void 0 : _a.focus();
2750
+ return;
2751
+ }
2752
+ if (event.key === "ArrowDown") {
2753
+ event.preventDefault();
2754
+ moveActive(1);
2755
+ return;
2756
+ }
2757
+ if (event.key === "ArrowUp") {
2758
+ event.preventDefault();
2759
+ moveActive(-1);
2760
+ return;
2761
+ }
2762
+ if (event.key === "Home") {
2763
+ event.preventDefault();
2764
+ activeIndex.value = enabledIndexes.value[0] ?? -1;
2765
+ scrollActiveIntoView();
2766
+ return;
2767
+ }
2768
+ if (event.key === "End") {
2769
+ event.preventDefault();
2770
+ activeIndex.value = enabledIndexes.value[enabledIndexes.value.length - 1] ?? -1;
2771
+ scrollActiveIntoView();
2772
+ return;
2773
+ }
2774
+ if (event.key === "Backspace" || event.key === "Delete") {
2775
+ if (selected.value) {
2776
+ event.preventDefault();
2777
+ clear();
2778
+ }
2779
+ return;
2780
+ }
2781
+ if (event.key === "Enter" || event.key === " ") {
2782
+ event.preventDefault();
2783
+ const option = props.options[activeIndex.value];
2784
+ if (option) {
2785
+ selectOption(option);
2786
+ }
2787
+ }
2788
+ }
2789
+ function onDocumentPointer(event) {
2790
+ var _a, _b;
2791
+ const target = event.target;
2792
+ if (((_a = triggerRef.value) == null ? void 0 : _a.contains(target)) || ((_b = panelRef.value) == null ? void 0 : _b.contains(target))) {
2793
+ return;
2794
+ }
2795
+ close();
2796
+ }
2797
+ function onViewportChange() {
2798
+ if (open.value) {
2799
+ updatePosition();
2800
+ }
2801
+ }
2802
+ watch(open, (isOpen) => {
2803
+ if (isOpen) {
2804
+ document.addEventListener("pointerdown", onDocumentPointer);
2805
+ window.addEventListener("resize", onViewportChange);
2806
+ window.addEventListener("scroll", onViewportChange, true);
2807
+ return;
2808
+ }
2809
+ document.removeEventListener("pointerdown", onDocumentPointer);
2810
+ window.removeEventListener("resize", onViewportChange);
2811
+ window.removeEventListener("scroll", onViewportChange, true);
2812
+ });
2813
+ onBeforeUnmount(() => {
2814
+ document.removeEventListener("pointerdown", onDocumentPointer);
2815
+ window.removeEventListener("resize", onViewportChange);
2816
+ window.removeEventListener("scroll", onViewportChange, true);
2817
+ });
2818
+ return (_ctx, _cache) => {
2819
+ var _a;
2820
+ return openBlock(), createElementBlock("div", {
2821
+ class: normalizeClass(["tao-select", { "tao-select--open": open.value, "tao-select--invalid": invalid.value }])
2822
+ }, [
2823
+ createElementVNode("button", {
2824
+ id: controlId.value,
2825
+ ref_key: "triggerRef",
2826
+ ref: triggerRef,
2827
+ type: "button",
2828
+ class: normalizeClass(["tao-select__trigger", { "tao-select__trigger--placeholder": !selected.value }]),
2829
+ role: "combobox",
2830
+ "aria-expanded": open.value,
2831
+ "aria-haspopup": "listbox",
2832
+ "aria-controls": listId,
2833
+ "aria-invalid": invalid.value || void 0,
2834
+ "aria-describedby": describedBy.value,
2835
+ disabled: __props.disabled,
2836
+ onClick: toggle,
2837
+ onKeydown: onTriggerKeydown
2838
+ }, [
2839
+ createElementVNode("span", _hoisted_2$h, toDisplayString(((_a = selected.value) == null ? void 0 : _a.label) ?? __props.placeholder), 1),
2840
+ _cache[2] || (_cache[2] = createElementVNode("span", {
2841
+ class: "tao-select__chevron",
2842
+ "aria-hidden": "true"
2843
+ }, null, -1))
2844
+ ], 42, _hoisted_1$j),
2845
+ (openBlock(), createBlock(Teleport, { to: "body" }, [
2846
+ open.value ? (openBlock(), createElementBlock("div", {
2847
+ key: 0,
2848
+ ref_key: "panelRef",
2849
+ ref: panelRef,
2850
+ class: "tao-select__panel",
2851
+ style: normalizeStyle(listStyle.value)
2852
+ }, [
2853
+ createElementVNode("ul", {
2854
+ id: listId,
2855
+ ref_key: "listRef",
2856
+ ref: listRef,
2857
+ class: "tao-select__list",
2858
+ role: "listbox",
2859
+ tabindex: "-1",
2860
+ "aria-activedescendant": activeIndex.value >= 0 ? `${listId}-opt-${activeIndex.value}` : void 0,
2861
+ onKeydown: onListKeydown
2862
+ }, [
2863
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option, index) => {
2864
+ return openBlock(), createElementBlock("li", {
2865
+ id: `${listId}-opt-${index}`,
2866
+ key: String(option.value),
2867
+ class: normalizeClass(["tao-select__option", {
2868
+ "tao-select__option--active": index === activeIndex.value,
2869
+ "tao-select__option--selected": option.value === __props.modelValue,
2870
+ "tao-select__option--disabled": option.disabled
2871
+ }]),
2872
+ role: "option",
2873
+ "aria-selected": option.value === __props.modelValue,
2874
+ "aria-disabled": option.disabled || void 0,
2875
+ "data-tao-select-index": index,
2876
+ onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
2877
+ }, ["prevent"])),
2878
+ onClick: ($event) => selectOption(option),
2879
+ onMouseenter: ($event) => !option.disabled && (activeIndex.value = index)
2880
+ }, toDisplayString(option.label), 43, _hoisted_4$e);
2881
+ }), 128))
2882
+ ], 40, _hoisted_3$f),
2883
+ selected.value ? (openBlock(), createElementBlock("button", {
2884
+ key: 0,
2885
+ type: "button",
2886
+ class: "tao-select__clear",
2887
+ onMousedown: _cache[1] || (_cache[1] = withModifiers(() => {
2888
+ }, ["prevent"])),
2889
+ onClick: clear
2890
+ }, " Очистить ", 32)) : createCommentVNode("", true)
2891
+ ], 4)) : createCommentVNode("", true)
2892
+ ]))
2893
+ ], 2);
2894
+ };
2895
+ }
2896
+ });
2897
+ const TaoSelect = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-42551757"]]);
2898
+ const _hoisted_1$i = ["id", "aria-expanded", "aria-activedescendant", "aria-invalid", "aria-describedby", "disabled", "placeholder", "value"];
2899
+ const _hoisted_2$g = {
2900
+ key: 0,
2901
+ class: "tao-combobox__empty"
2902
+ };
2903
+ const _hoisted_3$e = ["id", "aria-selected", "aria-disabled", "data-tao-combobox-index", "onClick", "onMouseenter"];
2904
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2905
+ ...{ name: "TaoCombobox" },
2906
+ __name: "TaoCombobox",
2907
+ props: {
2908
+ modelValue: { default: null },
2909
+ options: { default: () => [] },
2910
+ placeholder: { default: "Начните вводить" },
2911
+ disabled: { type: Boolean, default: false },
2912
+ error: { type: Boolean, default: false },
2913
+ allowCreate: { type: Boolean, default: false }
2914
+ },
2915
+ emits: ["update:modelValue", "change", "create"],
2397
2916
  setup(__props, { emit: __emit }) {
2398
2917
  const props = __props;
2399
2918
  const emit = __emit;
@@ -2404,62 +2923,164 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2404
2923
  const invalid = computed(() => props.error || Boolean(field == null ? void 0 : field.invalid.value));
2405
2924
  const describedBy = computed(() => field == null ? void 0 : field.describedBy.value);
2406
2925
  const open = ref(false);
2926
+ const focused = ref(false);
2927
+ const picking = ref(false);
2928
+ const skipFocusOpen = ref(false);
2929
+ const query = ref("");
2407
2930
  const activeIndex = ref(-1);
2408
- const triggerRef = ref(null);
2931
+ const fieldRef = ref(null);
2932
+ const inputRef = ref(null);
2933
+ const panelRef = ref(null);
2409
2934
  const listRef = ref(null);
2410
2935
  const listStyle = ref({ top: "0px", left: "0px", width: "0px" });
2411
- const selected = computed(() => props.options.find((option) => option.value === props.modelValue) ?? null);
2936
+ const selected = computed(() => {
2937
+ const found = props.options.find((option) => option.value === props.modelValue);
2938
+ if (found) {
2939
+ return found;
2940
+ }
2941
+ if (props.modelValue === null || props.modelValue === void 0 || props.modelValue === "") {
2942
+ return null;
2943
+ }
2944
+ return { value: props.modelValue, label: String(props.modelValue) };
2945
+ });
2946
+ const needle = computed(() => query.value.trim().toLowerCase());
2947
+ const filtered = computed(() => {
2948
+ if (!needle.value) {
2949
+ return props.options;
2950
+ }
2951
+ return props.options.filter((option) => option.label.toLowerCase().includes(needle.value));
2952
+ });
2953
+ const canCreate = computed(() => {
2954
+ const text = query.value.trim();
2955
+ if (!props.allowCreate || !text) {
2956
+ return false;
2957
+ }
2958
+ return !props.options.some((option) => option.label.toLowerCase() === text.toLowerCase());
2959
+ });
2960
+ const rows = computed(() => {
2961
+ const next = filtered.value.map((option) => ({ kind: "option", option }));
2962
+ if (canCreate.value) {
2963
+ next.push({ kind: "create", text: query.value.trim() });
2964
+ }
2965
+ return next;
2966
+ });
2412
2967
  const enabledIndexes = computed(
2413
- () => props.options.map((option, index) => option.disabled ? -1 : index).filter((index) => index >= 0)
2968
+ () => rows.value.map((row, index) => row.kind === "option" && row.option.disabled ? -1 : index).filter((index) => index >= 0)
2414
2969
  );
2970
+ const activeId = computed(() => activeIndex.value >= 0 ? `${listId}-row-${activeIndex.value}` : void 0);
2971
+ function syncQueryFromModel() {
2972
+ var _a;
2973
+ query.value = ((_a = selected.value) == null ? void 0 : _a.label) ?? "";
2974
+ }
2415
2975
  function updatePosition() {
2416
- const trigger = triggerRef.value;
2417
- const list = listRef.value;
2418
- if (!trigger || !list) {
2976
+ const trigger = fieldRef.value;
2977
+ const panel = panelRef.value;
2978
+ if (!trigger || !panel) {
2419
2979
  return;
2420
2980
  }
2421
2981
  const rect = trigger.getBoundingClientRect();
2422
- const listHeight = list.offsetHeight;
2982
+ const panelHeight = panel.offsetHeight;
2423
2983
  const gap = 4;
2424
2984
  const spaceBelow = window.innerHeight - rect.bottom - gap;
2425
- const openUp = spaceBelow < listHeight && rect.top > spaceBelow;
2985
+ const openUp = spaceBelow < panelHeight && rect.top > spaceBelow;
2426
2986
  listStyle.value = {
2427
- top: `${openUp ? rect.top - listHeight - gap : rect.bottom + gap}px`,
2987
+ top: `${openUp ? rect.top - panelHeight - gap : rect.bottom + gap}px`,
2428
2988
  left: `${rect.left}px`,
2429
2989
  width: `${rect.width}px`
2430
2990
  };
2431
2991
  }
2992
+ function resetActive() {
2993
+ const selectedIndex = rows.value.findIndex(
2994
+ (row) => row.kind === "option" && row.option.value === props.modelValue
2995
+ );
2996
+ if (selectedIndex >= 0 && enabledIndexes.value.includes(selectedIndex)) {
2997
+ activeIndex.value = selectedIndex;
2998
+ return;
2999
+ }
3000
+ activeIndex.value = enabledIndexes.value[0] ?? -1;
3001
+ }
2432
3002
  async function setOpen(next) {
2433
- var _a;
2434
3003
  if (props.disabled) {
2435
3004
  return;
2436
3005
  }
2437
3006
  open.value = next;
2438
- if (!next) {
2439
- return;
2440
- }
2441
- const selectedIndex = props.options.findIndex((option) => option.value === props.modelValue);
2442
- activeIndex.value = selectedIndex >= 0 ? selectedIndex : enabledIndexes.value[0] ?? -1;
3007
+ resetActive();
2443
3008
  await nextTick();
2444
3009
  updatePosition();
2445
- (_a = listRef.value) == null ? void 0 : _a.focus();
2446
3010
  scrollActiveIntoView();
2447
3011
  }
2448
- function toggle() {
2449
- void setOpen(!open.value);
3012
+ function emitValue(value) {
3013
+ emit("update:modelValue", value);
3014
+ emit("change", value);
2450
3015
  }
2451
- function close() {
3016
+ function keepFocusQuiet() {
3017
+ var _a;
3018
+ skipFocusOpen.value = true;
3019
+ picking.value = false;
3020
+ (_a = inputRef.value) == null ? void 0 : _a.focus();
3021
+ }
3022
+ function commitCreated(value) {
3023
+ emitValue(value);
3024
+ emit("create", value);
3025
+ query.value = value;
2452
3026
  open.value = false;
3027
+ keepFocusQuiet();
2453
3028
  }
2454
3029
  function selectOption(option) {
2455
- var _a;
2456
3030
  if (option.disabled) {
2457
3031
  return;
2458
3032
  }
2459
- emit("update:modelValue", option.value);
2460
- emit("change", option.value);
2461
- close();
2462
- (_a = triggerRef.value) == null ? void 0 : _a.focus();
3033
+ emitValue(option.value);
3034
+ query.value = option.label;
3035
+ open.value = false;
3036
+ keepFocusQuiet();
3037
+ }
3038
+ function createFromQuery(text) {
3039
+ const value = text.trim();
3040
+ if (!value) {
3041
+ return;
3042
+ }
3043
+ const exact = props.options.find(
3044
+ (option) => !option.disabled && option.label.toLowerCase() === value.toLowerCase()
3045
+ );
3046
+ if (exact) {
3047
+ selectOption(exact);
3048
+ return;
3049
+ }
3050
+ if (!props.allowCreate) {
3051
+ return;
3052
+ }
3053
+ commitCreated(value);
3054
+ }
3055
+ function revertQuery() {
3056
+ syncQueryFromModel();
3057
+ }
3058
+ function closeAndRevert() {
3059
+ open.value = false;
3060
+ revertQuery();
3061
+ }
3062
+ function closeAndCommit() {
3063
+ open.value = false;
3064
+ const text = query.value.trim();
3065
+ if (!text) {
3066
+ revertQuery();
3067
+ return;
3068
+ }
3069
+ const exact = props.options.find(
3070
+ (option) => !option.disabled && option.label.toLowerCase() === text.toLowerCase()
3071
+ );
3072
+ if (exact) {
3073
+ emitValue(exact.value);
3074
+ query.value = exact.label;
3075
+ return;
3076
+ }
3077
+ if (props.allowCreate) {
3078
+ emitValue(text);
3079
+ emit("create", text);
3080
+ query.value = text;
3081
+ return;
3082
+ }
3083
+ revertQuery();
2463
3084
  }
2464
3085
  function moveActive(delta) {
2465
3086
  const enabled = enabledIndexes.value;
@@ -2476,69 +3097,156 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2476
3097
  if (!list || activeIndex.value < 0) {
2477
3098
  return;
2478
3099
  }
2479
- const option = list.querySelector(`[data-tao-select-index="${activeIndex.value}"]`);
3100
+ const option = list.querySelector(`[data-tao-combobox-index="${activeIndex.value}"]`);
2480
3101
  option == null ? void 0 : option.scrollIntoView({ block: "nearest" });
2481
3102
  }
2482
- function onTriggerKeydown(event) {
3103
+ function onFieldMouseDown(event) {
3104
+ var _a;
3105
+ if (props.disabled || event.button !== 0) {
3106
+ return;
3107
+ }
3108
+ const onInput2 = event.target === inputRef.value;
3109
+ if (onInput2) {
3110
+ if (focused.value && !open.value) {
3111
+ void setOpen(true);
3112
+ }
3113
+ return;
3114
+ }
3115
+ event.preventDefault();
3116
+ if (open.value) {
3117
+ open.value = false;
3118
+ return;
3119
+ }
3120
+ (_a = inputRef.value) == null ? void 0 : _a.focus();
3121
+ void setOpen(true);
3122
+ }
3123
+ function onInput() {
2483
3124
  if (props.disabled) {
2484
3125
  return;
2485
3126
  }
2486
- if (event.key === "ArrowDown" || event.key === "ArrowUp" || event.key === "Enter" || event.key === " ") {
2487
- event.preventDefault();
2488
- void setOpen(true);
3127
+ void setOpen(true);
3128
+ resetActive();
3129
+ }
3130
+ function onFocus() {
3131
+ if (props.disabled) {
3132
+ return;
2489
3133
  }
3134
+ focused.value = true;
3135
+ if (skipFocusOpen.value) {
3136
+ skipFocusOpen.value = false;
3137
+ return;
3138
+ }
3139
+ void setOpen(true);
3140
+ nextTick(() => {
3141
+ var _a;
3142
+ return (_a = inputRef.value) == null ? void 0 : _a.select();
3143
+ });
2490
3144
  }
2491
- function onListKeydown(event) {
2492
- var _a;
3145
+ function markPicking() {
3146
+ picking.value = true;
3147
+ }
3148
+ function onBlur() {
3149
+ focused.value = false;
3150
+ window.setTimeout(() => {
3151
+ var _a, _b;
3152
+ if (picking.value) {
3153
+ picking.value = false;
3154
+ return;
3155
+ }
3156
+ if (((_a = fieldRef.value) == null ? void 0 : _a.contains(document.activeElement)) || ((_b = panelRef.value) == null ? void 0 : _b.contains(document.activeElement))) {
3157
+ return;
3158
+ }
3159
+ if (props.allowCreate) {
3160
+ closeAndCommit();
3161
+ return;
3162
+ }
3163
+ closeAndRevert();
3164
+ }, 0);
3165
+ }
3166
+ function activateRow(row) {
3167
+ if (row.kind === "create") {
3168
+ createFromQuery(row.text);
3169
+ return;
3170
+ }
3171
+ selectOption(row.option);
3172
+ }
3173
+ function onInputKeydown(event) {
3174
+ if (props.disabled) {
3175
+ return;
3176
+ }
2493
3177
  if (event.key === "Escape") {
2494
3178
  event.preventDefault();
2495
- close();
2496
- (_a = triggerRef.value) == null ? void 0 : _a.focus();
3179
+ closeAndRevert();
2497
3180
  return;
2498
3181
  }
2499
3182
  if (event.key === "ArrowDown") {
2500
3183
  event.preventDefault();
3184
+ if (!open.value) {
3185
+ void setOpen(true);
3186
+ return;
3187
+ }
2501
3188
  moveActive(1);
2502
3189
  return;
2503
3190
  }
2504
3191
  if (event.key === "ArrowUp") {
2505
3192
  event.preventDefault();
3193
+ if (!open.value) {
3194
+ void setOpen(true);
3195
+ return;
3196
+ }
2506
3197
  moveActive(-1);
2507
3198
  return;
2508
3199
  }
2509
- if (event.key === "Home") {
2510
- event.preventDefault();
2511
- activeIndex.value = enabledIndexes.value[0] ?? -1;
2512
- scrollActiveIntoView();
2513
- return;
2514
- }
2515
- if (event.key === "End") {
2516
- event.preventDefault();
2517
- activeIndex.value = enabledIndexes.value[enabledIndexes.value.length - 1] ?? -1;
2518
- scrollActiveIntoView();
2519
- return;
2520
- }
2521
- if (event.key === "Enter" || event.key === " ") {
3200
+ if (event.key === "Enter") {
2522
3201
  event.preventDefault();
2523
- const option = props.options[activeIndex.value];
2524
- if (option) {
2525
- selectOption(option);
3202
+ if (!open.value) {
3203
+ void setOpen(true);
3204
+ return;
3205
+ }
3206
+ const row = rows.value[activeIndex.value];
3207
+ if (row) {
3208
+ activateRow(row);
3209
+ return;
3210
+ }
3211
+ if (props.allowCreate) {
3212
+ createFromQuery(query.value);
2526
3213
  }
2527
3214
  }
2528
3215
  }
2529
3216
  function onDocumentPointer(event) {
2530
3217
  var _a, _b;
2531
3218
  const target = event.target;
2532
- if (((_a = triggerRef.value) == null ? void 0 : _a.contains(target)) || ((_b = listRef.value) == null ? void 0 : _b.contains(target))) {
3219
+ if (((_a = fieldRef.value) == null ? void 0 : _a.contains(target)) || ((_b = panelRef.value) == null ? void 0 : _b.contains(target))) {
2533
3220
  return;
2534
3221
  }
2535
- close();
3222
+ if (props.allowCreate) {
3223
+ closeAndCommit();
3224
+ return;
3225
+ }
3226
+ closeAndRevert();
2536
3227
  }
2537
3228
  function onViewportChange() {
2538
3229
  if (open.value) {
2539
3230
  updatePosition();
2540
3231
  }
2541
3232
  }
3233
+ watch(
3234
+ () => props.modelValue,
3235
+ () => {
3236
+ if (!focused.value) {
3237
+ syncQueryFromModel();
3238
+ }
3239
+ },
3240
+ { immediate: true }
3241
+ );
3242
+ watch(rows, () => {
3243
+ if (!open.value) {
3244
+ return;
3245
+ }
3246
+ if (!enabledIndexes.value.includes(activeIndex.value)) {
3247
+ activeIndex.value = enabledIndexes.value[0] ?? -1;
3248
+ }
3249
+ });
2542
3250
  watch(open, (isOpen) => {
2543
3251
  if (isOpen) {
2544
3252
  document.addEventListener("pointerdown", onDocumentPointer);
@@ -2556,71 +3264,105 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2556
3264
  window.removeEventListener("scroll", onViewportChange, true);
2557
3265
  });
2558
3266
  return (_ctx, _cache) => {
2559
- var _a;
2560
3267
  return openBlock(), createElementBlock("div", {
2561
- class: normalizeClass(["tao-select", { "tao-select--open": open.value, "tao-select--invalid": invalid.value }])
3268
+ class: normalizeClass(["tao-combobox", {
3269
+ "tao-combobox--open": open.value,
3270
+ "tao-combobox--invalid": invalid.value,
3271
+ "tao-combobox--disabled": __props.disabled
3272
+ }])
2562
3273
  }, [
2563
- createElementVNode("button", {
2564
- id: controlId.value,
2565
- ref_key: "triggerRef",
2566
- ref: triggerRef,
2567
- type: "button",
2568
- class: normalizeClass(["tao-select__trigger", { "tao-select__trigger--placeholder": !selected.value }]),
2569
- role: "combobox",
2570
- "aria-expanded": open.value,
2571
- "aria-haspopup": "listbox",
2572
- "aria-controls": listId,
2573
- "aria-invalid": invalid.value || void 0,
2574
- "aria-describedby": describedBy.value,
2575
- disabled: __props.disabled,
2576
- onClick: toggle,
2577
- onKeydown: onTriggerKeydown
3274
+ createElementVNode("div", {
3275
+ ref_key: "fieldRef",
3276
+ ref: fieldRef,
3277
+ class: "tao-combobox__field",
3278
+ onMousedown: onFieldMouseDown
2578
3279
  }, [
2579
- createElementVNode("span", _hoisted_2$g, toDisplayString(((_a = selected.value) == null ? void 0 : _a.label) ?? __props.placeholder), 1),
3280
+ createElementVNode("input", {
3281
+ id: controlId.value,
3282
+ ref_key: "inputRef",
3283
+ ref: inputRef,
3284
+ class: "tao-combobox__input",
3285
+ type: "text",
3286
+ role: "combobox",
3287
+ autocomplete: "off",
3288
+ "aria-autocomplete": "list",
3289
+ "aria-haspopup": "listbox",
3290
+ "aria-expanded": open.value,
3291
+ "aria-controls": listId,
3292
+ "aria-activedescendant": open.value ? activeId.value : void 0,
3293
+ "aria-invalid": invalid.value || void 0,
3294
+ "aria-describedby": describedBy.value,
3295
+ disabled: __props.disabled,
3296
+ placeholder: __props.placeholder,
3297
+ value: query.value,
3298
+ onInput: _cache[0] || (_cache[0] = ($event) => {
3299
+ query.value = $event.target.value;
3300
+ onInput();
3301
+ }),
3302
+ onFocus,
3303
+ onBlur,
3304
+ onKeydown: onInputKeydown
3305
+ }, null, 40, _hoisted_1$i),
2580
3306
  _cache[1] || (_cache[1] = createElementVNode("span", {
2581
- class: "tao-select__chevron",
3307
+ class: "tao-combobox__chevron",
2582
3308
  "aria-hidden": "true"
2583
3309
  }, null, -1))
2584
- ], 42, _hoisted_1$i),
3310
+ ], 544),
2585
3311
  (openBlock(), createBlock(Teleport, { to: "body" }, [
2586
- open.value ? (openBlock(), createElementBlock("ul", {
3312
+ open.value ? (openBlock(), createElementBlock("div", {
2587
3313
  key: 0,
2588
- id: listId,
2589
- ref_key: "listRef",
2590
- ref: listRef,
2591
- class: "tao-select__list",
2592
- role: "listbox",
2593
- tabindex: "-1",
2594
- "aria-activedescendant": activeIndex.value >= 0 ? `${listId}-opt-${activeIndex.value}` : void 0,
2595
- style: normalizeStyle(listStyle.value),
2596
- onKeydown: onListKeydown
3314
+ ref_key: "panelRef",
3315
+ ref: panelRef,
3316
+ class: "tao-combobox__panel",
3317
+ style: normalizeStyle(listStyle.value)
2597
3318
  }, [
2598
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option, index) => {
2599
- return openBlock(), createElementBlock("li", {
2600
- id: `${listId}-opt-${index}`,
2601
- key: String(option.value),
2602
- class: normalizeClass(["tao-select__option", {
2603
- "tao-select__option--active": index === activeIndex.value,
2604
- "tao-select__option--selected": option.value === __props.modelValue,
2605
- "tao-select__option--disabled": option.disabled
2606
- }]),
2607
- role: "option",
2608
- "aria-selected": option.value === __props.modelValue,
2609
- "aria-disabled": option.disabled || void 0,
2610
- "data-tao-select-index": index,
2611
- onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
2612
- }, ["prevent"])),
2613
- onClick: ($event) => selectOption(option),
2614
- onMouseenter: ($event) => !option.disabled && (activeIndex.value = index)
2615
- }, toDisplayString(option.label), 43, _hoisted_4$d);
2616
- }), 128))
2617
- ], 44, _hoisted_3$e)) : createCommentVNode("", true)
3319
+ createElementVNode("ul", {
3320
+ id: listId,
3321
+ ref_key: "listRef",
3322
+ ref: listRef,
3323
+ class: "tao-combobox__list",
3324
+ role: "listbox"
3325
+ }, [
3326
+ !rows.value.length ? (openBlock(), createElementBlock("li", _hoisted_2$g, "Ничего не найдено")) : createCommentVNode("", true),
3327
+ (openBlock(true), createElementBlock(Fragment, null, renderList(rows.value, (row, index) => {
3328
+ return openBlock(), createElementBlock("li", {
3329
+ id: `${listId}-row-${index}`,
3330
+ key: row.kind === "create" ? "create" : String(row.option.value),
3331
+ class: normalizeClass(["tao-combobox__option", {
3332
+ "tao-combobox__option--active": index === activeIndex.value,
3333
+ "tao-combobox__option--selected": row.kind === "option" && row.option.value === __props.modelValue,
3334
+ "tao-combobox__option--disabled": row.kind === "option" && row.option.disabled,
3335
+ "tao-combobox__option--create": row.kind === "create"
3336
+ }]),
3337
+ role: "option",
3338
+ "aria-selected": row.kind === "option" && row.option.value === __props.modelValue,
3339
+ "aria-disabled": row.kind === "option" && row.option.disabled ? true : void 0,
3340
+ "data-tao-combobox-index": index,
3341
+ onMousedown: withModifiers(markPicking, ["prevent"]),
3342
+ onClick: ($event) => activateRow(row),
3343
+ onMouseenter: ($event) => !(row.kind === "option" && row.option.disabled) && (activeIndex.value = index)
3344
+ }, [
3345
+ row.kind === "create" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3346
+ createTextVNode("Добавить «" + toDisplayString(row.text) + "»", 1)
3347
+ ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
3348
+ createTextVNode(toDisplayString(row.option.label), 1)
3349
+ ], 64))
3350
+ ], 42, _hoisted_3$e);
3351
+ }), 128))
3352
+ ], 512),
3353
+ selected.value ? (openBlock(), createElementBlock("button", {
3354
+ key: 0,
3355
+ type: "button",
3356
+ class: "tao-combobox__clear",
3357
+ onMousedown: withModifiers(markPicking, ["prevent"])
3358
+ }, " Очистить ", 32)) : createCommentVNode("", true)
3359
+ ], 4)) : createCommentVNode("", true)
2618
3360
  ]))
2619
3361
  ], 2);
2620
3362
  };
2621
3363
  }
2622
3364
  });
2623
- const TaoSelect = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-fbdc9884"]]);
3365
+ const TaoCombobox = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-adeb76a4"]]);
2624
3366
  const ISO_DATE = /^(\d{4})-(\d{2})-(\d{2})$/;
2625
3367
  function formatTaoDateIso(parts) {
2626
3368
  return `${String(parts.y).padStart(4, "0")}-${String(parts.m).padStart(2, "0")}-${String(parts.d).padStart(2, "0")}`;
@@ -2721,8 +3463,8 @@ function buildTaoDateGrid(year, month) {
2721
3463
  const _hoisted_1$h = ["id", "aria-expanded", "aria-invalid", "aria-describedby", "disabled"];
2722
3464
  const _hoisted_2$f = { class: "tao-date__value" };
2723
3465
  const _hoisted_3$d = ["aria-label"];
2724
- const _hoisted_4$c = { class: "tao-date__header" };
2725
- const _hoisted_5$9 = { class: "tao-date__month" };
3466
+ const _hoisted_4$d = { class: "tao-date__header" };
3467
+ const _hoisted_5$a = { class: "tao-date__month" };
2726
3468
  const _hoisted_6$7 = {
2727
3469
  class: "tao-date__weekdays",
2728
3470
  "aria-hidden": "true"
@@ -3005,7 +3747,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
3005
3747
  style: normalizeStyle(panelStyle.value),
3006
3748
  onKeydown: onPanelKeydown
3007
3749
  }, [
3008
- createElementVNode("div", _hoisted_4$c, [
3750
+ createElementVNode("div", _hoisted_4$d, [
3009
3751
  createElementVNode("button", {
3010
3752
  type: "button",
3011
3753
  class: "tao-date__nav",
@@ -3029,7 +3771,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
3029
3771
  })
3030
3772
  ], -1)
3031
3773
  ])]),
3032
- createElementVNode("p", _hoisted_5$9, toDisplayString(monthLabel.value), 1),
3774
+ createElementVNode("p", _hoisted_5$a, toDisplayString(monthLabel.value), 1),
3033
3775
  createElementVNode("button", {
3034
3776
  type: "button",
3035
3777
  class: "tao-date__nav",
@@ -3100,14 +3842,14 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
3100
3842
  };
3101
3843
  }
3102
3844
  });
3103
- const TaoDate = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-15d8ee2a"]]);
3845
+ const TaoDate = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-4227e5f8"]]);
3104
3846
  const _hoisted_1$g = ["for"];
3105
3847
  const _hoisted_2$e = ["id", "checked", "disabled", "aria-checked"];
3106
3848
  const _hoisted_3$c = {
3107
3849
  key: 0,
3108
3850
  class: "tao-switch__label"
3109
3851
  };
3110
- const _hoisted_4$b = {
3852
+ const _hoisted_4$c = {
3111
3853
  key: 1,
3112
3854
  class: "tao-switch__label"
3113
3855
  };
@@ -3155,7 +3897,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
3155
3897
  }, [
3156
3898
  createElementVNode("span", { class: "tao-switch__thumb" })
3157
3899
  ], -1)),
3158
- __props.label ? (openBlock(), createElementBlock("span", _hoisted_3$c, toDisplayString(__props.label), 1)) : _ctx.$slots.default ? (openBlock(), createElementBlock("span", _hoisted_4$b, [
3900
+ __props.label ? (openBlock(), createElementBlock("span", _hoisted_3$c, toDisplayString(__props.label), 1)) : _ctx.$slots.default ? (openBlock(), createElementBlock("span", _hoisted_4$c, [
3159
3901
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
3160
3902
  ])) : createCommentVNode("", true)
3161
3903
  ], 10, _hoisted_1$g);
@@ -3170,7 +3912,7 @@ const _hoisted_3$b = {
3170
3912
  key: 0,
3171
3913
  class: "tao-radio__label"
3172
3914
  };
3173
- const _hoisted_4$a = {
3915
+ const _hoisted_4$b = {
3174
3916
  key: 1,
3175
3917
  class: "tao-radio__label"
3176
3918
  };
@@ -3226,7 +3968,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
3226
3968
  class: "tao-radio__dot",
3227
3969
  "aria-hidden": "true"
3228
3970
  }, null, -1)),
3229
- __props.label ? (openBlock(), createElementBlock("span", _hoisted_3$b, toDisplayString(__props.label), 1)) : (openBlock(), createElementBlock("span", _hoisted_4$a, [
3971
+ __props.label ? (openBlock(), createElementBlock("span", _hoisted_3$b, toDisplayString(__props.label), 1)) : (openBlock(), createElementBlock("span", _hoisted_4$b, [
3230
3972
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
3231
3973
  ]))
3232
3974
  ], 10, _hoisted_1$f);
@@ -3285,7 +4027,7 @@ const _hoisted_3$a = {
3285
4027
  key: 0,
3286
4028
  class: "tao-alert__title"
3287
4029
  };
3288
- const _hoisted_4$9 = {
4030
+ const _hoisted_4$a = {
3289
4031
  key: 1,
3290
4032
  class: "tao-alert__message"
3291
4033
  };
@@ -3301,16 +4043,17 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
3301
4043
  setup(__props, { emit: __emit }) {
3302
4044
  const props = __props;
3303
4045
  const emit = __emit;
3304
- const live = computed(() => props.type === "error" || props.type === "warning" ? "assertive" : "polite");
4046
+ const tone = computed(() => props.type === "danger" ? "error" : props.type);
4047
+ const live = computed(() => tone.value === "error" || tone.value === "warning" ? "assertive" : "polite");
3305
4048
  return (_ctx, _cache) => {
3306
4049
  return openBlock(), createElementBlock("div", {
3307
- class: normalizeClass(["tao-alert", `tao-alert--${__props.type}`]),
3308
- role: __props.type === "error" ? "alert" : "status",
4050
+ class: normalizeClass(["tao-alert", `tao-alert--${tone.value}`]),
4051
+ role: tone.value === "error" ? "alert" : "status",
3309
4052
  "aria-live": live.value
3310
4053
  }, [
3311
4054
  createElementVNode("div", _hoisted_2$b, [
3312
4055
  __props.title ? (openBlock(), createElementBlock("strong", _hoisted_3$a, toDisplayString(__props.title), 1)) : createCommentVNode("", true),
3313
- _ctx.$slots.default ? (openBlock(), createElementBlock("p", _hoisted_4$9, [
4056
+ _ctx.$slots.default ? (openBlock(), createElementBlock("p", _hoisted_4$a, [
3314
4057
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
3315
4058
  ])) : createCommentVNode("", true)
3316
4059
  ]),
@@ -3325,12 +4068,12 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
3325
4068
  };
3326
4069
  }
3327
4070
  });
3328
- const TaoAlert = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-21abd6e5"]]);
4071
+ const TaoAlert = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-4c89fa1f"]]);
3329
4072
  const _hoisted_1$c = { key: 0 };
3330
4073
  const _hoisted_2$a = ["aria-sort"];
3331
4074
  const _hoisted_3$9 = ["onClick"];
3332
- const _hoisted_4$8 = { key: 1 };
3333
- const _hoisted_5$8 = { key: 0 };
4075
+ const _hoisted_4$9 = { key: 1 };
4076
+ const _hoisted_5$9 = { key: 0 };
3334
4077
  const _hoisted_6$6 = ["colspan"];
3335
4078
  const _hoisted_7$4 = ["onClick"];
3336
4079
  const _hoisted_8$4 = {
@@ -3443,13 +4186,13 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
3443
4186
  }]),
3444
4187
  "aria-hidden": "true"
3445
4188
  }, null, 2)
3446
- ], 8, _hoisted_3$9)) : (openBlock(), createElementBlock("span", _hoisted_4$8, toDisplayString(column.label), 1))
4189
+ ], 8, _hoisted_3$9)) : (openBlock(), createElementBlock("span", _hoisted_4$9, toDisplayString(column.label), 1))
3447
4190
  ], 12, _hoisted_2$a);
3448
4191
  }), 128))
3449
4192
  ])
3450
4193
  ]),
3451
4194
  createElementVNode("tbody", null, [
3452
- isEmpty.value ? (openBlock(), createElementBlock("tr", _hoisted_5$8, [
4195
+ isEmpty.value ? (openBlock(), createElementBlock("tr", _hoisted_5$9, [
3453
4196
  createElementVNode("td", {
3454
4197
  class: "tao-table__empty",
3455
4198
  colspan: colCount.value
@@ -3530,8 +4273,8 @@ const _hoisted_2$9 = {
3530
4273
  class: "tao-pagination__total"
3531
4274
  };
3532
4275
  const _hoisted_3$8 = { class: "tao-pagination__pages" };
3533
- const _hoisted_4$7 = ["disabled"];
3534
- const _hoisted_5$7 = ["aria-label", "disabled", "onClick"];
4276
+ const _hoisted_4$8 = ["disabled"];
4277
+ const _hoisted_5$8 = ["aria-label", "disabled", "onClick"];
3535
4278
  const _hoisted_6$5 = {
3536
4279
  key: 1,
3537
4280
  class: "tao-pagination__ellipsis",
@@ -3597,7 +4340,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3597
4340
  "aria-label": "Назад",
3598
4341
  disabled: __props.disabled || current.value <= 1,
3599
4342
  onClick: _cache[0] || (_cache[0] = ($event) => goTo(current.value - 1))
3600
- }, " ‹ ", 8, _hoisted_4$7),
4343
+ }, " ‹ ", 8, _hoisted_4$8),
3601
4344
  (openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item) => {
3602
4345
  return openBlock(), createElementBlock(Fragment, {
3603
4346
  key: item.type === "page" ? item.page : item.id
@@ -3609,7 +4352,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3609
4352
  "aria-label": item.id === "left" ? `Назад на ${__props.jump} страниц` : `Вперёд на ${__props.jump} страниц`,
3610
4353
  disabled: __props.disabled,
3611
4354
  onClick: ($event) => goTo(item.id === "left" ? current.value - __props.jump : current.value + __props.jump)
3612
- }, " … ", 8, _hoisted_5$7)) : item.type === "ellipsis" ? (openBlock(), createElementBlock("span", _hoisted_6$5, "…")) : (openBlock(), createElementBlock("button", {
4355
+ }, " … ", 8, _hoisted_5$8)) : item.type === "ellipsis" ? (openBlock(), createElementBlock("span", _hoisted_6$5, "…")) : (openBlock(), createElementBlock("button", {
3613
4356
  key: 2,
3614
4357
  type: "button",
3615
4358
  class: normalizeClass(["tao-pagination__btn", { "tao-pagination__btn--current": item.page === current.value }]),
@@ -3642,11 +4385,11 @@ const _hoisted_3$7 = {
3642
4385
  key: 1,
3643
4386
  class: "tao-empty__title"
3644
4387
  };
3645
- const _hoisted_4$6 = {
4388
+ const _hoisted_4$7 = {
3646
4389
  key: 2,
3647
4390
  class: "tao-empty__text"
3648
4391
  };
3649
- const _hoisted_5$6 = {
4392
+ const _hoisted_5$7 = {
3650
4393
  key: 3,
3651
4394
  class: "tao-empty__action"
3652
4395
  };
@@ -3663,10 +4406,10 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
3663
4406
  renderSlot(_ctx.$slots, "icon", {}, void 0, true)
3664
4407
  ])) : createCommentVNode("", true),
3665
4408
  __props.title ? (openBlock(), createElementBlock("p", _hoisted_3$7, toDisplayString(__props.title), 1)) : createCommentVNode("", true),
3666
- _ctx.$slots.default ? (openBlock(), createElementBlock("p", _hoisted_4$6, [
4409
+ _ctx.$slots.default ? (openBlock(), createElementBlock("p", _hoisted_4$7, [
3667
4410
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
3668
4411
  ])) : createCommentVNode("", true),
3669
- _ctx.$slots.action ? (openBlock(), createElementBlock("div", _hoisted_5$6, [
4412
+ _ctx.$slots.action ? (openBlock(), createElementBlock("div", _hoisted_5$7, [
3670
4413
  renderSlot(_ctx.$slots, "action", {}, void 0, true)
3671
4414
  ])) : createCommentVNode("", true)
3672
4415
  ]);
@@ -3710,8 +4453,8 @@ const _hoisted_2$7 = {
3710
4453
  class: "tao-drawer__header"
3711
4454
  };
3712
4455
  const _hoisted_3$6 = ["id"];
3713
- const _hoisted_4$5 = { key: 1 };
3714
- const _hoisted_5$5 = { class: "tao-drawer__content" };
4456
+ const _hoisted_4$6 = { key: 1 };
4457
+ const _hoisted_5$6 = { class: "tao-drawer__content" };
3715
4458
  const _hoisted_6$4 = {
3716
4459
  key: 1,
3717
4460
  class: "tao-drawer__footer"
@@ -3827,7 +4570,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
3827
4570
  key: 0,
3828
4571
  id: unref(titleId),
3829
4572
  class: "tao-drawer__title"
3830
- }, toDisplayString(__props.title), 9, _hoisted_3$6)) : (openBlock(), createElementBlock("span", _hoisted_4$5)),
4573
+ }, toDisplayString(__props.title), 9, _hoisted_3$6)) : (openBlock(), createElementBlock("span", _hoisted_4$6)),
3831
4574
  __props.closable ? (openBlock(), createElementBlock("button", {
3832
4575
  key: 2,
3833
4576
  type: "button",
@@ -3836,7 +4579,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
3836
4579
  onClick: close
3837
4580
  }, " × ")) : createCommentVNode("", true)
3838
4581
  ])) : createCommentVNode("", true),
3839
- createElementVNode("div", _hoisted_5$5, [
4582
+ createElementVNode("div", _hoisted_5$6, [
3840
4583
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
3841
4584
  ]),
3842
4585
  _ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_6$4, [
@@ -3853,8 +4596,14 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
3853
4596
  });
3854
4597
  const TaoDrawer = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-6a0c0e98"]]);
3855
4598
  const _hoisted_1$7 = ["title"];
3856
- const _hoisted_2$6 = ["src", "alt"];
3857
- const _hoisted_3$5 = ["aria-label"];
4599
+ const _hoisted_2$6 = { class: "tao-avatar__face" };
4600
+ const _hoisted_3$5 = ["src", "alt"];
4601
+ const _hoisted_4$5 = ["aria-label"];
4602
+ const _hoisted_5$5 = {
4603
+ key: 1,
4604
+ class: "tao-avatar__badge",
4605
+ "aria-hidden": "true"
4606
+ };
3858
4607
  const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3859
4608
  ...{ name: "TaoAvatar" },
3860
4609
  __name: "TaoAvatar",
@@ -3862,10 +4611,21 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3862
4611
  src: { default: "" },
3863
4612
  name: { default: "" },
3864
4613
  alt: { default: "" },
3865
- size: { default: "m" }
4614
+ size: { default: "medium" },
4615
+ dot: { type: [Boolean, String], default: false },
4616
+ count: { default: void 0 }
3866
4617
  },
3867
4618
  setup(__props) {
3868
4619
  const props = __props;
4620
+ const sizeClass = computed(() => {
4621
+ if (props.size === "small" || props.size === "s") {
4622
+ return "s";
4623
+ }
4624
+ if (props.size === "large" || props.size === "l") {
4625
+ return "l";
4626
+ }
4627
+ return "m";
4628
+ });
3869
4629
  const initials = computed(() => {
3870
4630
  const parts = props.name.trim().split(/\s+/).filter(Boolean);
3871
4631
  if (!parts.length) {
@@ -3876,27 +4636,74 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3876
4636
  }
3877
4637
  return `${parts[0][0] ?? ""}${parts[1][0] ?? ""}`.toUpperCase();
3878
4638
  });
3879
- const label = computed(() => props.alt || props.name || "Аватар");
4639
+ const dotTone = computed(() => {
4640
+ if (!props.dot) {
4641
+ return null;
4642
+ }
4643
+ if (props.dot === true) {
4644
+ return "success";
4645
+ }
4646
+ return props.dot === "error" ? "danger" : props.dot;
4647
+ });
4648
+ const badge = computed(() => {
4649
+ if (props.count === void 0 || props.count === "") {
4650
+ return "";
4651
+ }
4652
+ const numeric = typeof props.count === "number" ? props.count : Number(props.count);
4653
+ if (Number.isFinite(numeric)) {
4654
+ if (numeric <= 0) {
4655
+ return "";
4656
+ }
4657
+ return numeric > 99 ? "99+" : String(numeric);
4658
+ }
4659
+ return String(props.count);
4660
+ });
4661
+ const dotLabel = {
4662
+ success: "в сети",
4663
+ danger: "занят",
4664
+ warning: "отошёл",
4665
+ info: "статус",
4666
+ neutral: "не в сети"
4667
+ };
4668
+ const label = computed(() => {
4669
+ const base = props.alt || props.name || "Аватар";
4670
+ const extra = [];
4671
+ if (dotTone.value) {
4672
+ extra.push(dotLabel[dotTone.value]);
4673
+ }
4674
+ if (badge.value) {
4675
+ extra.push(`${badge.value} уведомлений`);
4676
+ }
4677
+ return extra.length ? `${base}, ${extra.join(", ")}` : base;
4678
+ });
3880
4679
  return (_ctx, _cache) => {
3881
4680
  return openBlock(), createElementBlock("span", {
3882
- class: normalizeClass(["tao-avatar", `tao-avatar--${__props.size}`]),
3883
- title: __props.name || void 0
4681
+ class: normalizeClass(["tao-avatar", `tao-avatar--${sizeClass.value}`]),
4682
+ title: label.value
3884
4683
  }, [
3885
- __props.src ? (openBlock(), createElementBlock("img", {
4684
+ createElementVNode("span", _hoisted_2$6, [
4685
+ __props.src ? (openBlock(), createElementBlock("img", {
4686
+ key: 0,
4687
+ class: "tao-avatar__img",
4688
+ src: __props.src,
4689
+ alt: label.value
4690
+ }, null, 8, _hoisted_3$5)) : (openBlock(), createElementBlock("span", {
4691
+ key: 1,
4692
+ class: "tao-avatar__fallback",
4693
+ "aria-label": label.value
4694
+ }, toDisplayString(initials.value || "?"), 9, _hoisted_4$5))
4695
+ ]),
4696
+ dotTone.value ? (openBlock(), createElementBlock("span", {
3886
4697
  key: 0,
3887
- class: "tao-avatar__img",
3888
- src: __props.src,
3889
- alt: label.value
3890
- }, null, 8, _hoisted_2$6)) : (openBlock(), createElementBlock("span", {
3891
- key: 1,
3892
- class: "tao-avatar__fallback",
3893
- "aria-label": label.value
3894
- }, toDisplayString(initials.value || "?"), 9, _hoisted_3$5))
4698
+ class: normalizeClass(["tao-avatar__dot", `tao-avatar__dot--${dotTone.value}`]),
4699
+ "aria-hidden": "true"
4700
+ }, null, 2)) : createCommentVNode("", true),
4701
+ badge.value ? (openBlock(), createElementBlock("span", _hoisted_5$5, toDisplayString(badge.value), 1)) : createCommentVNode("", true)
3895
4702
  ], 10, _hoisted_1$7);
3896
4703
  };
3897
4704
  }
3898
4705
  });
3899
- const TaoAvatar = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-b03b36f2"]]);
4706
+ const TaoAvatar = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-cb4ec893"]]);
3900
4707
  const _hoisted_1$6 = {
3901
4708
  class: "tao-breadcrumb",
3902
4709
  "aria-label": "Хлебные крошки"
@@ -3932,7 +4739,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
3932
4739
  class: "tao-breadcrumb__item"
3933
4740
  }, [
3934
4741
  index > 0 ? (openBlock(), createElementBlock("span", _hoisted_3$4, "/")) : createCommentVNode("", true),
3935
- index === __props.items.length - 1 ? (openBlock(), createElementBlock("span", _hoisted_4$4, toDisplayString(item.label), 1)) : item.to ? (openBlock(), createBlock(_sfc_main$k, {
4742
+ index === __props.items.length - 1 ? (openBlock(), createElementBlock("span", _hoisted_4$4, toDisplayString(item.label), 1)) : item.to ? (openBlock(), createBlock(_sfc_main$l, {
3936
4743
  key: 2,
3937
4744
  class: "tao-breadcrumb__link",
3938
4745
  to: item.to
@@ -4123,7 +4930,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
4123
4930
  function goNext() {
4124
4931
  goTo(index.value + step.value);
4125
4932
  }
4126
- function goTo(next) {
4933
+ function goTo(next, instant = false) {
4127
4934
  const el = track.value;
4128
4935
  const { width, gap, total } = metrics();
4129
4936
  if (!el || width <= 0 || total <= 0) {
@@ -4145,7 +4952,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
4145
4952
  }
4146
4953
  el.scrollTo({
4147
4954
  left: page * (width + gap),
4148
- behavior: prefersReducedMotion() || dragging.value || wrapping ? "auto" : "smooth"
4955
+ behavior: prefersReducedMotion() || dragging.value || wrapping || instant ? "auto" : "smooth"
4149
4956
  });
4150
4957
  setIndex(page);
4151
4958
  }
@@ -4203,6 +5010,35 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
4203
5010
  setIndex(nearestIndex());
4204
5011
  });
4205
5012
  }
5013
+ function releaseDragCapture() {
5014
+ const el = track.value;
5015
+ const id = dragPointer;
5016
+ if (!el || id === -1) {
5017
+ return;
5018
+ }
5019
+ if (typeof el.hasPointerCapture === "function" && !el.hasPointerCapture(id)) {
5020
+ return;
5021
+ }
5022
+ try {
5023
+ el.releasePointerCapture(id);
5024
+ } catch {
5025
+ }
5026
+ }
5027
+ function endDrag(keepClickGuard = false) {
5028
+ if (!dragging.value) {
5029
+ return;
5030
+ }
5031
+ dragging.value = false;
5032
+ releaseDragCapture();
5033
+ dragPointer = -1;
5034
+ if (!keepClickGuard) {
5035
+ dragMoved = 0;
5036
+ }
5037
+ if (track.value) {
5038
+ goTo(nearestIndex(), true);
5039
+ }
5040
+ syncAutoplay();
5041
+ }
4206
5042
  function onPointerDown(event) {
4207
5043
  if (event.pointerType !== "mouse" || event.button !== 0 || !track.value) {
4208
5044
  return;
@@ -4212,7 +5048,10 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
4212
5048
  dragStartScroll = track.value.scrollLeft;
4213
5049
  dragMoved = 0;
4214
5050
  dragging.value = true;
4215
- track.value.setPointerCapture(event.pointerId);
5051
+ try {
5052
+ track.value.setPointerCapture(event.pointerId);
5053
+ } catch {
5054
+ }
4216
5055
  }
4217
5056
  function onPointerMove(event) {
4218
5057
  if (!dragging.value || event.pointerId !== dragPointer || !track.value) {
@@ -4222,13 +5061,25 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
4222
5061
  dragMoved = Math.abs(dx);
4223
5062
  track.value.scrollLeft = dragStartScroll - dx;
4224
5063
  }
4225
- function onPointerUp(event) {
4226
- if (!dragging.value || event.pointerId !== dragPointer) {
5064
+ function onPointerEnd(event) {
5065
+ if (!dragging.value) {
4227
5066
  return;
4228
5067
  }
4229
- dragging.value = false;
4230
- dragPointer = -1;
4231
- goTo(nearestIndex());
5068
+ if (dragPointer !== -1 && event.pointerId !== dragPointer) {
5069
+ return;
5070
+ }
5071
+ endDrag(true);
5072
+ }
5073
+ function onLostPointerCapture() {
5074
+ endDrag();
5075
+ }
5076
+ function onWindowBlur() {
5077
+ endDrag();
5078
+ }
5079
+ function onVisibilityChange() {
5080
+ if (document.hidden) {
5081
+ endDrag();
5082
+ }
4232
5083
  syncAutoplay();
4233
5084
  }
4234
5085
  function onClickCapture(event) {
@@ -4267,13 +5118,18 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
4267
5118
  goTo(props.modelValue);
4268
5119
  syncAutoplay();
4269
5120
  });
4270
- document.addEventListener("visibilitychange", syncAutoplay);
5121
+ document.addEventListener("visibilitychange", onVisibilityChange);
5122
+ window.addEventListener("blur", onWindowBlur);
5123
+ window.addEventListener("pagehide", onWindowBlur);
4271
5124
  });
4272
5125
  onUpdated(refreshCount);
4273
5126
  onBeforeUnmount(() => {
5127
+ endDrag();
4274
5128
  cancelAnimationFrame(scrollFrame);
4275
5129
  stopAutoplay();
4276
- document.removeEventListener("visibilitychange", syncAutoplay);
5130
+ document.removeEventListener("visibilitychange", onVisibilityChange);
5131
+ window.removeEventListener("blur", onWindowBlur);
5132
+ window.removeEventListener("pagehide", onWindowBlur);
4277
5133
  });
4278
5134
  return (_ctx, _cache) => {
4279
5135
  return openBlock(), createElementBlock("div", {
@@ -4326,8 +5182,9 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
4326
5182
  onKeydown,
4327
5183
  onPointerdown: onPointerDown,
4328
5184
  onPointermove: onPointerMove,
4329
- onPointerup: onPointerUp,
4330
- onPointercancel: onPointerUp,
5185
+ onPointerup: onPointerEnd,
5186
+ onPointercancel: onPointerEnd,
5187
+ onLostpointercapture: onLostPointerCapture,
4331
5188
  onClickCapture
4332
5189
  }, [
4333
5190
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
@@ -4393,7 +5250,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
4393
5250
  };
4394
5251
  }
4395
5252
  });
4396
- const TaoCarousel = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-173f4ce0"]]);
5253
+ const TaoCarousel = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-81afb8b0"]]);
4397
5254
  const _hoisted_1$3 = ["aria-label"];
4398
5255
  const _hoisted_2$2 = ["aria-label"];
4399
5256
  const _hoisted_3$2 = {
@@ -4446,6 +5303,9 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
4446
5303
  bad: "ошибка"
4447
5304
  };
4448
5305
  function statusOf(item) {
5306
+ if (item.status === "danger") {
5307
+ return "bad";
5308
+ }
4449
5309
  return item.status ?? "wait";
4450
5310
  }
4451
5311
  function itemLabel(item) {
@@ -4523,7 +5383,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
4523
5383
  };
4524
5384
  }
4525
5385
  });
4526
- const TaoStages = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-fc11408a"]]);
5386
+ const TaoStages = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-fefa5c65"]]);
4527
5387
  const TOAST_POSITIONS = [
4528
5388
  "topRight",
4529
5389
  "topLeft",
@@ -4649,6 +5509,7 @@ const _hoisted_10 = {
4649
5509
  class: "tao-toast__actions"
4650
5510
  };
4651
5511
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
5512
+ ...{ name: "TaoToastItem" },
4652
5513
  __name: "TaoToastItem",
4653
5514
  props: {
4654
5515
  toast: {}
@@ -4703,7 +5564,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
4703
5564
  return (_ctx, _cache) => {
4704
5565
  return openBlock(), createElementBlock("div", {
4705
5566
  class: normalizeClass(["tao-toast", [`tao-toast--${__props.toast.type}`, { "tao-toast--paused": paused.value }]]),
4706
- role: __props.toast.type === "error" || __props.toast.type === "warning" ? "alert" : "status",
5567
+ role: __props.toast.type === "error" || __props.toast.type === "danger" || __props.toast.type === "warning" ? "alert" : "status",
4707
5568
  "aria-live": "polite",
4708
5569
  onMouseenter: pause,
4709
5570
  onMouseleave: resume
@@ -4732,7 +5593,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
4732
5593
  "stroke-linecap": "round",
4733
5594
  "stroke-linejoin": "round"
4734
5595
  }, null, -1)
4735
- ])])) : __props.toast.type === "error" ? (openBlock(), createElementBlock("svg", _hoisted_4$1, [..._cache[1] || (_cache[1] = [
5596
+ ])])) : __props.toast.type === "error" || __props.toast.type === "danger" ? (openBlock(), createElementBlock("svg", _hoisted_4$1, [..._cache[1] || (_cache[1] = [
4736
5597
  createElementVNode("circle", {
4737
5598
  cx: "10",
4738
5599
  cy: "10",
@@ -4822,7 +5683,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
4822
5683
  };
4823
5684
  }
4824
5685
  });
4825
- const TaoToastItem = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-04783988"]]);
5686
+ const TaoToastItem = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-c8a329f5"]]);
4826
5687
  const _hoisted_1$1 = { class: "tao-toast-slot__inner" };
4827
5688
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
4828
5689
  ...{ name: "TaoToastViewport" },
@@ -5143,6 +6004,7 @@ const TaoConfirmHost = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "da
5143
6004
  const TYPE_TIMEOUT = {
5144
6005
  success: 3e3,
5145
6006
  error: 5e3,
6007
+ danger: 5e3,
5146
6008
  warning: 4e3,
5147
6009
  info: 3e3,
5148
6010
  neutral: 2500
@@ -5215,6 +6077,11 @@ function createBuilder$1() {
5215
6077
  draft.timeout = TYPE_TIMEOUT.error;
5216
6078
  return ctx;
5217
6079
  },
6080
+ danger() {
6081
+ draft.type = "danger";
6082
+ draft.timeout = TYPE_TIMEOUT.danger;
6083
+ return ctx;
6084
+ },
5218
6085
  warning() {
5219
6086
  draft.type = "warning";
5220
6087
  draft.timeout = TYPE_TIMEOUT.warning;
@@ -5364,6 +6231,9 @@ const toast = Object.assign(createBuilder$1, {
5364
6231
  error(message, options) {
5365
6232
  return shortcut("error", message, options);
5366
6233
  },
6234
+ danger(message, options) {
6235
+ return shortcut("danger", message, options);
6236
+ },
5367
6237
  warning(message, options) {
5368
6238
  return shortcut("warning", message, options);
5369
6239
  },
@@ -5520,7 +6390,7 @@ const components = [
5520
6390
  TaoSpoiler,
5521
6391
  TaoCopy,
5522
6392
  TaoContainer,
5523
- _sfc_main$A,
6393
+ _sfc_main$B,
5524
6394
  TaoSpace,
5525
6395
  TaoIcon,
5526
6396
  TaoLoader,
@@ -5536,9 +6406,10 @@ const components = [
5536
6406
  TaoFileDrop,
5537
6407
  TaoDropdownMenu,
5538
6408
  TaoPinCode,
5539
- _sfc_main$k,
6409
+ _sfc_main$l,
5540
6410
  TaoFormField,
5541
6411
  TaoSelect,
6412
+ TaoCombobox,
5542
6413
  TaoDate,
5543
6414
  TaoSwitch,
5544
6415
  TaoRadio,
@@ -5574,6 +6445,7 @@ export {
5574
6445
  TaoCard,
5575
6446
  TaoCarousel,
5576
6447
  TaoCheckbox,
6448
+ TaoCombobox,
5577
6449
  TaoConfirmHost,
5578
6450
  TaoContainer,
5579
6451
  TaoCopy,
@@ -5584,14 +6456,14 @@ export {
5584
6456
  TaoDropdownMenu,
5585
6457
  TaoEmpty,
5586
6458
  TaoFileDrop,
5587
- _sfc_main$A as TaoFlex,
6459
+ _sfc_main$B as TaoFlex,
5588
6460
  TaoFormField,
5589
6461
  TaoIcon,
5590
6462
  TaoImage,
5591
6463
  TaoInput,
5592
6464
  TaoInputGroup,
5593
6465
  TaoInputNumber,
5594
- _sfc_main$k as TaoLink,
6466
+ _sfc_main$l as TaoLink,
5595
6467
  TaoLoader,
5596
6468
  TaoModal,
5597
6469
  TaoPagination,